/* =====================================================================
   รอบ 30: หน้าแอดมินกลาง (/platform) — PlatformLayout + Components/Pages/Platform/*
   - ใช้โครงเดียวกับหลังร้าน (.shell, .sidebar, .fit ของ fit.css) แต่เป็นสีกลางของระบบ (คราม/เทาเย็น) ไม่ใช่สีของร้าน
   - ตัวแปรสีตั้งที่ <html> เมื่อหน้ามี .pf-shell / .pf-login (โดเมนหลักไม่มีสีร้านอยู่แล้ว) → Modal/Drawer ได้สีเดียวกัน
   - โหมดมืด: dark.css (โหลดทีหลัง) ทับพื้น/ตัวหนังสือ และคำนวณ --brand-soft ฯลฯ จาก --brand ของที่นี่ให้เอง
   - คลาสทั้งหมดขึ้นต้นด้วย pf-
   ===================================================================== */

html:has(.pf-shell), html:has(.pf-login) {
  --brand: #4338CA;
  --brand-strong: #3730A3;
  --brand-rgb: 67,56,202;
  --brand-soft: rgba(67,56,202,.11);
  --brand-tint: rgba(67,56,202,.05);
  --brand-ink: #FFFFFF;
  --bg: #F4F5F9;
  --chip: #ECEEF4;
  --ink: #1B1E27;
  --muted: #5D6474;
  --line: #E0E3EB;
  --shadow: 0 2px 8px rgba(30,40,80,.07);
  /* ป้ายสถานะ */
  --pf-trial-bg: #E5EEFB; --pf-trial: #1D4F8C;
  --pf-active-bg: var(--ok-soft); --pf-active: var(--ok);
  --pf-soon-bg: #FDEBDC; --pf-soon: #9A4A0C;
  --pf-grace-bg: var(--warn-soft); --pf-grace: #7A5300;
  --pf-expired-bg: var(--danger-soft); --pf-expired: var(--danger);
  --pf-susp-bg: #E7E8EE; --pf-susp: #474D5C;
  --pf-sidebar-text: #C7CCDA;
}

@media screen {
  html[data-theme="dark"]:has(.pf-shell), html[data-theme="dark"]:has(.pf-login) {
    --pf-trial-bg: var(--info-soft); --pf-trial: var(--info-text);
    --pf-soon-bg: #3A2A1C; --pf-soon: #F2B27A;
    --pf-grace-bg: var(--warn-soft); --pf-grace: var(--warn-text);
    --pf-susp-bg: var(--raised); --pf-susp: var(--muted);
  }

  /* ---------- เมนูข้าง ---------- */
  .pf-shell .sidebar { color: var(--pf-sidebar-text); }
  .pf-shell .nav a { color: var(--pf-sidebar-text); }
  .pf-shell .nav a.nav-top { color: var(--pf-sidebar-text); font-weight: 600; }
  .pf-shell .nav a.nav-top:hover, .pf-shell .nav a.nav-top.active { color: #fff; }
  .pf-shell .nav .nav-divider { background: rgba(255,255,255,.1); margin: 8px 10px; }
  .pf-brand { gap: 12px; padding: 2px 6px 4px; }
  .pf-mark {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
    background: var(--brand); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  }
  .pf-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .pf-brand-text small { color: rgba(255,255,255,.55); font-size: .74rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-nav-badge {
    margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
    background: #F59E0B; color: #1B1E27; font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums;
  }
  .pf-who-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .pf-who-avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
  .pf-who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .pf-who-text strong { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-who-text small { color: rgba(255,255,255,.55); font-size: .76rem; }
  .pf-who form .link { color: var(--pf-sidebar-text); }

  /* ---------- หัวจอ ---------- */
  .pf-topbar .pf-env { margin-right: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; font-weight: 600; }
  .pf-env-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

  /* แถบล่างมือถือ: ตัวเลขรอตรวจ */
  .pf-tabbar .tab-icon { position: relative; }
  .pf-tab-badge {
    position: absolute; top: -4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: #F59E0B; color: #1B1E27; font-style: normal; font-size: .66rem; font-weight: 800; display: grid; place-items: center;
  }

  /* ---------- ปุ่ม / ป้าย ทั่วไป ---------- */
  .pf-icon-btn { display: inline-grid; place-items: center; width: 42px; min-height: 42px; padding: 0; }
  .pf-icon-btn.is-busy svg { animation: pf-spin .9s linear infinite; }
  @keyframes pf-spin { to { transform: rotate(360deg); } }
  .pf .fit-tools > .btn { min-height: 42px; }
  .pf-btn-badge {
    margin-left: 8px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
    background: #fff; color: var(--brand-strong); font-size: .76rem; font-weight: 800;
  }
  .pf-help { margin: 0; line-height: 1.5; }
  .pf-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-size: .74rem; font-weight: 700; white-space: nowrap; }
  .pf-tag.muted { background: var(--chip); color: var(--muted); }
  .pf-avatar {
    flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: .9rem;
  }
  .pf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

  /* ป้ายสถานะ (แพ็กเกจ / แจ้งชำระ / สำรองข้อมูล) */
  .pf-st {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
    font-size: .79rem; font-weight: 700; white-space: nowrap; background: var(--chip); color: var(--muted); line-height: 1.5;
  }
  .pf-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .pf-st.s-trial { background: var(--pf-trial-bg); color: var(--pf-trial); }
  .pf-st.s-active, .pf-st.r-approved, .pf-st.b-ok { background: var(--pf-active-bg); color: var(--pf-active); }
  .pf-st.s-grace, .pf-st.r-pending, .pf-st.b-running { background: var(--pf-grace-bg); color: var(--pf-grace); }
  .pf-st.s-expired, .pf-st.r-rejected, .pf-st.b-failed { background: var(--pf-expired-bg); color: var(--pf-expired); }
  .pf-st.s-suspended, .pf-st.r-cancelled, .pf-st.b-deleted { background: var(--pf-susp-bg); color: var(--pf-susp); }

  /* สีจุดตามสถานะ (ตัวกรอง / ไทล์) */
  .s-trial .pf-dot, .pf-dot.s-trial { color: var(--pf-trial); }
  .s-active .pf-dot, .pf-dot.s-active { color: var(--pf-active); }
  .s-expiring .pf-dot, .pf-dot.s-expiring { color: var(--pf-soon); }
  .s-grace .pf-dot, .pf-dot.s-grace { color: #D99A0B; }
  .s-expired .pf-dot, .pf-dot.s-expired { color: var(--pf-expired); }
  .s-suspended .pf-dot, .pf-dot.s-suspended { color: var(--pf-susp); }

  .pf-days { font-weight: 600; color: var(--muted); }
  .pf-days.soon { color: var(--pf-soon); }
  .pf-days.late { color: var(--danger); }
  .alert.pf-warn { background: var(--warn-soft); color: var(--warn-text, #7a5300); }
  .alert.pf-info { background: var(--brand-soft); color: var(--brand-strong); }

  /* ---------- ภาพรวม: ตัวเลขสรุป ---------- */
  .pf-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; flex: none; }
  .pf-kpi {
    display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 18px; color: var(--ink); text-decoration: none;
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  }
  a.pf-kpi:hover { box-shadow: var(--shadow), 0 0 0 2px var(--brand-soft); }
  .pf-kpi-ico {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
    background: var(--brand-soft); color: var(--brand-strong);
  }
  .pf-kpi-ico.ok { background: var(--ok-soft); color: var(--ok); }
  .pf-kpi-body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
  .pf-kpi-label { color: var(--muted); font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pf-kpi-body > strong { font-size: 1.45rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* รอบ 98: คำอธิบายใต้ตัวเลขได้ 2 บรรทัด (เดิมบรรทัดเดียว จอ 1280 ถูกตัด … อ่านไม่ครบ) */
  .pf-kpi-sub { font-size: .8rem; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pf-kpi-sub a { color: var(--brand-strong); font-weight: 600; text-decoration: none; }
  .pf-kpi.hl { background: var(--brand); color: var(--brand-ink); }
  .pf-kpi.hl .pf-kpi-ico { background: rgba(255,255,255,.18); color: #fff; }
  .pf-kpi.hl .pf-kpi-label, .pf-kpi.hl .pf-kpi-sub { color: rgba(255,255,255,.82); }
  .pf-kpi.warn { box-shadow: var(--shadow), inset 0 0 0 2px #F5B342; }
  .pf-kpi.warn .pf-kpi-ico { background: var(--warn-soft); color: var(--warn-text, #7a5300); }
  .pf-kpi.warn strong { color: var(--warn-text, #8a5a00); }

  /* การ์ด */
  .panel.pf-card { margin: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .pf-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
  .pf-card-head h2 { margin: 0; font-size: 1.02rem; }
  .pf-card-meta { color: var(--muted); font-size: .84rem; }
  .pf-more { font-size: .84rem; font-weight: 600; color: var(--brand-strong); text-decoration: none; white-space: nowrap; }
  .pf-more:hover { text-decoration: underline; }
  .pf-none { margin: 0; padding: 22px 8px; text-align: center; color: var(--muted); font-size: .9rem; }
  .pf-none.ok { color: var(--ok); }

  /* สัดส่วนสถานะร้าน */
  .pf-dist { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--chip); gap: 2px; }
  .pf-dist i { display: block; min-width: 0; }
  .pf-dist i[style="width:0%"] { display: none; }
  .pf-dist .s-trial { background: #5B8DEF; }
  .pf-dist .s-active { background: #2E9E5B; }
  .pf-dist .s-grace { background: #E5A50A; }
  .pf-dist .s-expired { background: #D9483B; }
  .pf-dist .s-suspended { background: #8A90A0; }
  .pf-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
  .pf-tile {
    display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 14px; border-radius: 14px;
    background: var(--bg); color: var(--ink); text-decoration: none; border: 1px solid transparent;
  }
  .pf-tile:hover { border-color: var(--brand); background: var(--brand-tint); }
  .pf-tile-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.3; min-height: 2.1em; }
  .pf-tile strong { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }

  /* รายการร้าน (ใกล้หมดอายุ / ใหม่) */
  .pf-ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, .7fr); gap: 16px; align-items: start; }
  .pf-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; }
  .pf-list li + li { border-top: 1px solid var(--line); }
  .pf-list-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px; color: var(--ink); text-decoration: none; min-width: 0; }
  .pf-list-row:hover { background: var(--brand-tint); }
  .pf-list-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
  .pf-list-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-list-main small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-list-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
  .pf-list-end small { font-size: .78rem; }

  .pf-quick-grid { display: flex; flex-direction: column; gap: 8px; }
  .pf-quick-link { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--bg); color: var(--ink); text-decoration: none; }
  .pf-quick-link:hover { background: var(--brand-tint); }
  .pf-quick-link .pf-kpi-ico { width: 38px; height: 38px; border-radius: 12px; }
  .pf-quick-link > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .pf-quick-link small { color: var(--muted); font-size: .78rem; }

  /* ---------- ตาราง ---------- */
  /* รอบ 98: ปุ่มกรองสถานะมีได้ถึง 8 ปุ่ม (กว้าง ~1,300px) — เดิมแถวเดียวเลื่อนแบบซ่อนแถบเลื่อน ปุ่มท้าย ๆ ถูกตัดหายบนจอคอม
     → จอคอม/แท็บเล็ตให้ปุ่มขึ้นบรรทัดใหม่ในกรอบ และช่องเรียง/ประเภทลงบรรทัดใหม่เมื่อไม่พอ (มือถือยังเลื่อนแนวนอนตามเดิม) */
  .pf-bar { justify-content: flex-end; flex-wrap: wrap; }
  .pf-bar > .fitl-seg { flex: 0 1 auto; min-width: 0; margin-right: auto; flex-wrap: wrap; overflow: visible; }
  .pf-bar > .pf-sort, .pf-bar > .pf-bar-sum { flex: none; }
  .pf-bar.fitl-filters { flex-wrap: wrap; }
  .pf-sort { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; white-space: nowrap; }
  .pf-sort select { font: inherit; font-size: .9rem; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
  .pf-table td { vertical-align: middle; }
  .pf-table td.num, .pf-ends > strong, .pf-ends > .num { white-space: nowrap; }
  .pf-shop { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
  .pf-shop-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .pf-shop-text strong { font-weight: 600; }
  .pf-shop-text a, .pf-shop-text small { font-size: .8rem; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-shop-text a:hover { color: var(--brand-strong); text-decoration: underline; }
  .pf-ends { display: inline-flex; flex-direction: column; line-height: 1.3; min-width: 0; }
  .pf-ends.r { align-items: flex-end; }
  .pf-ends small { font-size: .78rem; }
  .pf-ends a { color: var(--ink); text-decoration: none; }
  .pf-ends a:hover { color: var(--brand-strong); text-decoration: underline; }
  .pf-pending { display: inline-flex; padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn-text, #7a5300); font-size: .78rem; font-weight: 700; white-space: nowrap; }
  .fit .table tr.dim td .pf-st { opacity: 1; }
  .pf-kind { display: inline-block; padding: 1px 9px; border-radius: 8px; background: var(--chip); font-size: .84rem; white-space: nowrap; }
  .pf-kind.addon { background: var(--brand-soft); color: var(--brand-strong); }
  .pf-note-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }

  /* ---------- แผงรายละเอียดร้าน ---------- */
  .pf-tabs { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: var(--chip); flex: none; }
  .pf-tabs button {
    flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 10px;
    border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  }
  .pf-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
  .pf-sub-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 16px;
    background: var(--brand-tint); box-shadow: inset 4px 0 0 var(--brand);
  }
  .pf-sub-hero.s-trial { background: var(--pf-trial-bg); box-shadow: inset 4px 0 0 var(--pf-trial); }
  .pf-sub-hero.s-active { background: var(--pf-active-bg); box-shadow: inset 4px 0 0 var(--pf-active); }
  .pf-sub-hero.s-grace { background: var(--pf-grace-bg); box-shadow: inset 4px 0 0 #D99A0B; }
  .pf-sub-hero.s-expired { background: var(--pf-expired-bg); box-shadow: inset 4px 0 0 var(--pf-expired); }
  .pf-sub-hero.s-suspended { background: var(--pf-susp-bg); box-shadow: inset 4px 0 0 var(--pf-susp); }
  .pf-sub-hero-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .pf-sub-plan { font-size: 1.2rem; font-weight: 800; color: var(--ink); }
  .pf-sub-ends { color: var(--muted); font-size: .88rem; }
  .pf-sub-left { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--surface); font-size: .86rem; font-weight: 700; }
  .pf-meters { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 6px; }
  .pf-meter-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); }
  .pf-meter-row strong { color: var(--ink); min-width: 44px; text-align: right; }
  .pf-meter { position: relative; height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
  .pf-meter i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--brand); }
  .pf-meter i.over { background: var(--danger); }
  .pf-mods { display: flex; flex-wrap: wrap; gap: 6px; }
  .pf-mod { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 10px; font-size: .84rem; font-weight: 600; background: var(--chip); color: var(--muted); }
  .pf-mod small { font-size: .72rem; font-weight: 500; opacity: .85; }
  .pf-mod.on { background: var(--ok-soft); color: var(--ok); }
  .pf-mod.off { text-decoration: line-through; text-decoration-color: rgba(127,127,127,.5); }
  .pf-mod.off small { text-decoration: none; }

  .pf-extend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .pf-extend .btn { min-height: 42px; font-variant-numeric: tabular-nums; }
  .pf-confirm { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--ink); font-size: .9rem; font-weight: 600; }
  .pf-confirm.danger { background: var(--danger-soft); color: var(--danger); }
  .pf-confirm-actions { display: flex; gap: 8px; margin-left: auto; }
  .pf-seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 4px; border-radius: 12px; background: var(--chip); }
  .pf-seg2 button { min-height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
  .pf-seg2 button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
  .pf-form2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
  .pf-form2 .field input, .pf-form2 .field select { width: 100%; }
  .pf-row-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 12px; }
  .pf-row-end > .muted { margin-right: auto; }
  .pf-addons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
  .pf-addons li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--bg); }
  .pf-addon-name { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
  .pf-addon-name small { font-size: .8rem; }
  .drw-sec.pf-danger-zone { margin-top: 4px; padding: 14px; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: 14px; }
  .drw-sec + .drw-sec.pf-danger-zone { border-top: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding-top: 14px; }
  .pf-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
  .pf-hist li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .pf-hist li:last-child { border-bottom: 0; }
  .pf-hist-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; gap: 1px; }
  .pf-hist-main strong { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 600; font-size: .94rem; }
  .pf-hist-main small { font-size: .8rem; }
  .pf-hist li > .num { white-space: nowrap; }

  /* ---------- แจ้งชำระ ---------- */
  .pf-bar-sum { padding: 6px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-text, #7a5300); font-size: .88rem; font-weight: 700; }
  .pf-req-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; padding-top: 2px; }
  .pf-req { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
  .pf-req.pending { box-shadow: var(--shadow), inset 0 3px 0 #F5B342; }
  .pf-req-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .pf-req-shop { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
  .pf-req-shop a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-req-shop a:hover { color: var(--brand-strong); }
  .pf-req-shop small { font-size: .8rem; }
  .pf-req-body { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 14px; align-items: start; }
  .pf-req-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .pf-req-kind { font-weight: 600; color: var(--muted); font-size: .9rem; }
  .pf-req-amount { font-size: 1.45rem; font-weight: 800; line-height: 1.2; color: var(--ink); }
  .pf-req-meta { font-size: .88rem; font-weight: 600; }
  .pf-req-note { margin: 4px 0 2px; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-size: .88rem; overflow-wrap: anywhere; }
  .pf-req-info small { font-size: .8rem; }
  .pf-slip { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--brand-strong); font-size: .76rem; font-weight: 600; }
  .pf-slip img { width: 112px; height: 140px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); display: block; }
  .pf-slip:hover img { border-color: var(--brand); }
  .pf-slip.none { width: 112px; height: 140px; display: grid; place-items: center; text-align: center; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); padding: 8px; }
  .pf-req-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
  .pf-req-actions .btn { min-height: 42px; }
  .pf-empty h2 { font-size: 1.1rem; }
  .pf-modal-sum { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; border-radius: 12px; background: var(--brand-tint); }
  .pf-modal-sum span { color: var(--muted); font-weight: 600; }

  /* ---------- แพ็กเกจ ---------- */
  .pf-sec-head { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin: 4px 0 -2px; }
  .pf-sec-head h2 { margin: 0; font-size: 1.05rem; }
  .pf-plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 225px), 1fr)); gap: 14px; align-items: stretch; }
  .pf-plan { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); min-width: 0; border-top: 4px solid var(--brand); }
  .pf-plan.off { border-top-color: var(--line); }
  .pf-plan.off .pf-plan-price strong { color: var(--muted); }
  .pf-plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .pf-plan-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .pf-plan-name strong { font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
  .pf-plan-tags { display: flex; flex-wrap: wrap; gap: 4px; }
  .pf-plan-tags:empty { display: none; }
  .pf-plan-price { display: flex; align-items: baseline; gap: 4px; }
  .pf-plan-price strong { font-size: 1.6rem; font-weight: 800; color: var(--brand-strong); letter-spacing: -.01em; }
  .pf-plan-price span { color: var(--muted); font-size: .9rem; }
  .pf-plan-year { margin-top: -8px; }
  .pf-plan-desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
  .pf-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
  .pf-facts > div { padding: 7px 10px; border-radius: 10px; background: var(--bg); min-width: 0; }
  .pf-facts dt { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pf-facts dd { margin: 0; font-weight: 800; font-size: 1.05rem; }
  .pf-plan-mods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
  .pf-plan-mods li { display: flex; align-items: center; gap: 8px; }
  .pf-plan-mods li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--chip); }
  .pf-plan-mods li.on::before { background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-4.9' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
  .pf-plan-mods li.off { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(127,127,127,.45); }
  .pf-plan-mods li.soon { color: var(--muted); }

  .pf-price-table td { padding-top: 8px; padding-bottom: 8px; }
  .pf-mod-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
  .fit .table input.pf-price-in { width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
  .pf-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; color: var(--muted); }
  .pf-switch input {
    appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 999px;
    background: var(--line); position: relative; cursor: pointer; transition: background .15s;
  }
  .pf-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
  .pf-switch input:checked { background: var(--ok); }
  .pf-switch input:checked::after { transform: translateX(16px); }
  .pf-switch input:checked + span { color: var(--ok); font-weight: 700; }
  .pf-switch input:disabled { opacity: .45; cursor: not-allowed; }
  .pf-mod-pick { gap: 8px; }
  .pf-mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
  .pf-mod-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; color: var(--ink); font-size: .92rem; min-width: 0; }
  .pf-mod-opt input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
  .pf-mod-opt > span:not(.pf-tag) { flex: 1 1 auto; min-width: 0; }
  .pf-mod-opt.on { border-color: var(--brand); background: var(--brand-tint); }

  /* ---------- สำรองข้อมูล / แอดมิน: ตาราง + แผงขวา ---------- */
  .pf-run { display: inline-flex; align-items: center; gap: 8px; }
  .pf-run.is-busy:disabled { opacity: .85; }
  .pf-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: pf-spin .8s linear infinite; }
  .pf-pane-flat { min-width: 0; }
  .pf-side { padding: 18px; gap: 12px; }
  .pf-side h2 { margin: 0; font-size: 1.02rem; }
  .pf-dl dd code { font-size: .82rem; overflow-wrap: anywhere; }
  .pf-callout { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn-text, #6b4a00); font-size: .88rem; line-height: 1.5; }
  .pf-file { overflow-wrap: anywhere; font-size: .78rem; }
  .pf-hint { font-size: .8rem; color: var(--muted); }
  .pf-hint.ok { color: var(--ok); }

  /* ---------- ตั้งค่าระบบ ---------- */
  .pf-form-fit { display: contents; }
  .pf-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bg); color: var(--muted); font-size: .86rem; line-height: 1.5; }
  .pf-preview { font-size: 1.3rem; color: var(--brand-strong); padding: 6px 0; }
  .pf-bank { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; align-items: start; }
  .pf-bank-fields { grid-template-columns: minmax(0, 1fr); }
  .pf-qr { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .pf-qr img, .pf-qr-empty { width: 150px; height: 150px; border-radius: 14px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
  .pf-qr-empty { display: grid; place-items: center; background: var(--bg); border-style: dashed; color: var(--muted); font-size: .85rem; text-align: center; padding: 10px; }
  .pf-upload { position: relative; overflow: hidden; cursor: pointer; }
  .pf-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
  .pf-upload.is-busy { opacity: .6; pointer-events: none; }
}

/* ---------- จอคอม ---------- */
@media screen and (min-width: 1025px) {
  .fit-split.pf-bk-split, .fit-split.pf-ad-split { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
  .pf-pane-flat { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .pf-pane-flat > .fit-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; padding: 0; }
  .pf-side { overflow: auto; }
  /* แผงรายละเอียดร้านกว้างขึ้นเล็กน้อย (ฟอร์มสองคอลัมน์) */
  .pf-shell .drw { width: min(600px, 100%); }
}
@media screen and (min-width: 1025px) and (max-width: 1440px) {
  .pf-ov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pf-ov-grid > .pf-quick { grid-column: 1 / -1; }
  .pf-ov-grid > .pf-quick .pf-quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- แท็บเล็ต ---------- */
@media screen and (max-width: 1024px) {
  .pf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-ov-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- มือถือ ---------- */
@media screen and (max-width: 760px) {
  .pf-shell .topbar { display: none; }
  .pf-shell .mobile-bar { background: var(--brand); }
  .pf .fit-tools > .btn:not(.pf-icon-btn) { flex: 1 1 auto; }
  .pf .fit-tools { flex-wrap: wrap; }
  .pf .fit-tools .fit-search { flex: 1 1 100%; order: -1; }
  .pf .fit-tools:not(:has(.fit-search)) { flex-wrap: nowrap; }
  .pf-kpis { gap: 10px; }
  .pf-kpi { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  /* รอบ 98: ตัวหนังสือในการ์ดต้องกว้างเท่าการ์ด (align-items:flex-start ทำให้ตัวเลข/ป้ายยาวล้นออกนอกการ์ด ตัด … ไม่ได้) */
  .pf-kpi-body { align-self: stretch; }
  .pf-kpi-ico { width: 36px; height: 36px; border-radius: 11px; }
  .pf-kpi-body > strong { font-size: 1.15rem; }
  .pf-kpi-sub { white-space: normal; line-height: 1.35; }
  .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pf-tile { padding: 10px 12px; }
  .pf-tile strong { font-size: 1.15rem; }
  .pf-bar { gap: 8px; flex-wrap: wrap; }
  .pf-sort { width: 100%; }
  .pf-sort select { flex: 1 1 auto; }
  .pf-bar > .fitl-seg { width: 100%; margin-right: 0; flex-wrap: nowrap; overflow-x: auto; }
  .pf-kind-seg { width: 100%; }
  .pf-table .pf-shop { width: 100%; }
  .table.cards.pf-table td:first-child { padding-bottom: 8px; }
  .table.cards.pf-table td.r:last-child:empty { display: none; }
  .pf-note-cell { max-width: none; white-space: normal; }
  .pf-extend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-form2 { grid-template-columns: minmax(0, 1fr); }
  .pf-req { padding: 14px; }
  .pf-req-body { grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; }
  .pf-slip img, .pf-slip.none { width: 92px; height: 116px; }
  .pf-req-amount { font-size: 1.25rem; }
  .pf-bank { grid-template-columns: minmax(0, 1fr); }
  .pf-qr { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .pf-qr img, .pf-qr-empty { width: 120px; height: 120px; }
  .fit .table.cards input.pf-price-in { width: 150px; }
  .pf-meter-row { grid-template-columns: 60px minmax(0, 1fr) auto; }
  .pf-sub-hero { flex-wrap: wrap; }
  .pf-list-main strong { white-space: normal; }
}

/* ---------- เข้าสู่ระบบแอดมินกลาง ---------- */
@media screen {
  .public:has(.pf-login) { background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%), var(--bg); }
  .auth.pf-login { border: 0; box-shadow: 0 10px 40px rgba(30,40,80,.12); border-radius: var(--radius-lg); gap: 16px; }
  .pf-login-top { display: flex; align-items: center; gap: 10px; }
  .pf-login-top .lang-switch { margin-left: auto; }
  .pf-login-domain { color: var(--muted); font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-login h1 { font-size: 1.45rem; margin-top: 2px; }
  .pf-login .auth-shop { color: var(--brand-strong); }
  .pf-login-hint { margin: 6px 0 0; }
}

@media screen {
  html[data-theme="dark"] .pf-tabs button.on, html[data-theme="dark"] .pf-seg2 button.on { background: var(--raised); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
  html[data-theme="dark"] .pf-btn-badge { background: rgba(255,255,255,.92); }
  html[data-theme="dark"] .pf-tile, html[data-theme="dark"] .pf-quick-link, html[data-theme="dark"] .pf-facts > div,
  html[data-theme="dark"] .pf-addons li, html[data-theme="dark"] .pf-req-note, html[data-theme="dark"] .pf-note { background: var(--chip); }
  html[data-theme="dark"] .pf-sub-left { background: var(--raised); }
  html[data-theme="dark"] .pf-qr img { background: #fff; }
  html[data-theme="dark"] .pf-switch input::after { background: #ECE7E1; }
  html[data-theme="dark"] .auth.pf-login { box-shadow: 0 10px 40px rgba(0,0,0,.5); }
  html[data-theme="dark"] .pf-kpi.warn strong { color: var(--warn-text); }
}

@media screen and (min-width: 1025px) {
  /* ตารางในแผงแยก (สำรองข้อมูล/แอดมิน) แคบกว่า → ลดช่องว่างให้ปุ่มไม่ล้น */
  .pf-table th, .pf-table td { padding-left: 10px; padding-right: 10px; }
  .pf-table th:first-child, .pf-table td:first-child { padding-left: 14px; }
  .pf-table td:first-child { min-width: 180px; }
  .pf-pane-flat .pf-table td.muted { white-space: nowrap; }
}

/* =====================================================================
   รอบ 30 ต่อ (pfa): หน้าแพ็กเกจแบบแท็บ + บัญชีรับเงินหลายบัญชี (ตั้งค่าระบบ)
   ===================================================================== */
@media screen {
  /* ---------- หน้าแพ็กเกจ: แท็บ ---------- */
  .fit > .pf-pl-tabs { flex: none; }
  .pf-pl-tabs { display: inline-flex; align-self: flex-start; gap: 3px; padding: 4px; border-radius: 14px; background: var(--chip); max-width: 100%; }
  .pf-pl-tabs button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
    border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: .94rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .pf-pl-tabs button:hover { color: var(--ink); }
  .pf-pl-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
  .pf-pl-tabs button.on svg { color: var(--brand); }
  .pf-pl-count { font-style: normal; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; background: rgba(127,127,127,.14); font-size: .78rem; font-weight: 700; }
  .pf-pl-tabs button.on .pf-pl-count { background: var(--brand-soft); color: var(--brand-strong); }
  .pf-pl-dirty { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: #F59E0B; color: #1B1E27; font-size: .72rem; font-weight: 800; }
  .pf-pl-body > .pf-pl-hint { flex: none; margin: 0; }
  /* การ์ดแพ็กเกจ: สูงสุด 4 ใบต่อแถว ความสูงเท่ากันในแถว */
  .pf-pl-body .pf-plan-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, max(250px, calc((100% - 48px) / 4))), 1fr)); gap: 16px; align-items: stretch; }
  .pf-pl-body .pf-plan { height: 100%; }
  .pf-pl-body .pf-plan-desc { flex: 1 0 auto; }
  .pf-pl-body .pf-plan-mods { padding-top: 10px; border-top: 1px dashed var(--line); }

  /* ---------- ตั้งค่าระบบ: บัญชีรับเงิน ---------- */
  .fit-cards > .pfa-sec { grid-column: 1 / -1; }
  .pfa-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
  .pfa-sec-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
  .pfa-sec-title h2 { margin: 0; font-size: 1.02rem; }
  .pfa-sec-head > .btn { display: inline-flex; align-items: center; gap: 6px; }
  .pfa-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; border-radius: 14px; border: 1px dashed var(--line); background: var(--bg); color: var(--muted); text-align: center; }
  .pfa-empty p { margin: 0; font-size: .9rem; }
  .pfa-empty-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); }
  .pfa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; align-items: stretch; }
  .pfa-card {
    display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-width: 0; padding: 14px 14px 12px 18px;
    border-radius: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: inset 4px 0 0 var(--brand);
  }
  .pfa-card.off { box-shadow: inset 4px 0 0 var(--line); background: var(--bg); }
  .pfa-card.off .pfa-card-info > :not(.pfa-meta), .pfa-card.off .pfa-qr { opacity: .6; }
  .pfa-card-main { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 14px; align-items: start; }
  .pfa-card-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.35; }
  .pfa-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .pfa-bank { font-size: 1.06rem; font-weight: 800; overflow-wrap: anywhere; }
  .pfa-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
  .pfa-no {
    font-family: var(--font-mono); font-size: 1.22rem; font-weight: 700;
    letter-spacing: .03em; color: var(--brand-strong); overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
  }
  .pfa-note { font-size: .84rem; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
  .pfa-meta { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-top: 6px; }
  .pfa-qr a { display: block; border-radius: 12px; }
  .pfa-qr img, .pfa-qr-empty { display: block; width: 104px; height: 104px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
  .pfa-qr a:hover img { border-color: var(--brand); }
  .pfa-qr-empty { display: grid; place-items: center; padding: 8px; background: var(--bg); border-style: dashed; color: var(--muted); font-size: .78rem; text-align: center; line-height: 1.3; }
  .pfa-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
  .pfa-del { margin-left: auto; display: inline-grid; place-items: center; min-width: 38px; padding: 0 10px; color: var(--danger); }
  .pfa-del:hover:not(:disabled) { background: var(--danger-soft); }
  .pfa-switch { align-self: flex-start; color: var(--ink); font-size: .94rem; }
  .pfa-no-in { font-family: var(--font-mono); letter-spacing: .03em; }
}

@media screen and (min-width: 1025px) {
  .pf-pl-body > .table-wrap.fit-scroll.pf-pl-prices { flex: 0 1 auto; }
}

@media screen and (max-width: 760px) {
  .pf-pl-tabs { display: flex; align-self: stretch; }
  .pf-pl-tabs button { flex: 1 1 0; min-width: 0; padding: 0 8px; gap: 6px; font-size: .9rem; }
  .pf-pl-tabs button svg { display: none; }
  .pf-pl-tabs button > span { overflow: hidden; text-overflow: ellipsis; }
  .pfa-sec-head > .btn { min-height: 38px; }
  .pfa-card { padding: 12px 12px 10px 16px; }
  .pfa-card-main { grid-template-columns: minmax(0, 1fr) 84px; gap: 10px; }
  .pfa-qr img, .pfa-qr-empty { width: 84px; height: 84px; }
  .pfa-no { font-size: 1.1rem; }
}

@media screen {
  html[data-theme="dark"] .pf-pl-tabs button.on { background: var(--raised); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
  html[data-theme="dark"] .pfa-card.off, html[data-theme="dark"] .pfa-empty, html[data-theme="dark"] .pfa-qr-empty { background: var(--chip); }
  html[data-theme="dark"] .pfa-qr img { background: #fff; }
}

/* =====================================================================
   รอบ 41: ทดสอบไฟล์สำรอง (PlatformBackups.razor) — ป้ายผลทดสอบ, แถวรายละเอียด, ปุ่มตรวจไฟล์/ทดลองกู้คืน, วิธีกู้คืนจริง
   ===================================================================== */
@media screen {
  .pf-bk-acts { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; max-width: 210px; }
  .pf-bk-table td.actions-cell, .pf-bk-table thead th { white-space: normal; }
  .pf-spinner.ink { width: 14px; height: 14px; border-color: rgba(var(--brand-rgb), .25); border-top-color: var(--brand); }
  .pf-st.pf-vf-none { background: var(--chip); color: var(--muted); }
  .pf-bk-stv { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
  .pf-bk-trig small { font-size: .78rem; }
  .pf-vf-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
  .pf-vf-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; }
  .pf-vf-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 999px; }
  .pf-vf-chev { flex: none; transition: transform .15s; }
  .pf-vf-btn[aria-expanded="true"] .pf-vf-chev { transform: rotate(180deg); }
  .pf-vf-when { font-size: .74rem; white-space: nowrap; }
  .table tr.pf-vf-detail td { padding-top: 4px; }
  .pf-vf { display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 8px; max-width: 820px; }
  .pf-vf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: .9rem; }
  .pf-vf-msg { margin: 0; color: var(--muted); font-size: .88rem; }
  .pf-vf-err { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: .88rem; line-height: 1.5; }
  .pf-vf-err > span { color: var(--ink); }
  .pf-vf-raw { display: block; max-height: 140px; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .78rem; white-space: pre-wrap; overflow-wrap: anywhere; }
  .pf-vf-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
  .pf-vf-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
  .pf-vf-grid dt { color: var(--muted); font-size: .76rem; }
  .pf-vf-grid dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
  .pf-vf-grid > div.hl dd { color: var(--ok); }
  .pf-vf-grid > div.warn dd { color: var(--pf-grace); }
  .pf-vf-note { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.5; }
  .pf-vf-note.warn { color: var(--pf-grace); }
  .pf-vf-good { color: var(--ok); }
  .pf-vf-bad { color: var(--danger); }
  .pf-howto { background: var(--brand-soft); color: var(--ink); }
  .pf-howto ol { margin: 4px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
  .pf-howto-cmd { display: block; margin-top: 4px; padding: 6px 8px; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .78rem; overflow-wrap: anywhere; }
  .pf-howto-tip { color: var(--muted); font-size: .82rem; }
  .pf-rt-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
  .pf-note code { overflow-wrap: anywhere; }
}
@media screen and (max-width: 760px) {
  .pf-bk-acts { max-width: none; width: 100%; }
  .pf-vf-wrap, .pf-bk-stv, .pf-bk-trig { align-items: flex-end; }
  .table.cards tr.pf-vf-detail td:first-child { font-weight: 400; font-size: inherit; padding-bottom: 0; }
  .pf-vf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ===== จบรอบ 41 ===== */

/* ---------------------------------------------------------------------
   รอบ 104: กล่องงาน (/platform/inbox) + "รอดำเนินการ" ในแผงร้าน
   --------------------------------------------------------------------- */
@media screen {
  .pf-ib-sum { margin: 0 0 10px; font-weight: 700; color: var(--ink); }
  .pf-ib-more { margin: 14px 2px 4px; font-size: .9rem; }
  .pf-ib-more a { color: var(--brand-strong); font-weight: 600; }
  .pf-ib-next { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
  .pf-ib-clear h2 { margin: 0 0 4px; }
  .pf-ib-go { flex: none; font-size: .82rem; font-weight: 700; color: var(--brand-strong); padding: 5px 10px; border-radius: 999px; background: var(--brand-soft); white-space: nowrap; }

  .pf-todo { border-radius: 14px; padding: 12px 14px; background: var(--brand-tint); box-shadow: inset 3px 0 0 #F5B342; }
  .pf-todo h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .pf-todo .pf-hist li { border-bottom-color: var(--line); }
  .pf-todo .dom-orders { padding-top: 6px; border-top: 0; }
  .pf-todo-dom { margin: 10px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
  .pf-todo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
  .pf-todo-side .num { white-space: nowrap; }
  .pf-todo-btns { display: flex; gap: 6px; }
}
@media screen and (max-width: 760px) {
  .pf-ib-go { display: none; }
  .pf-todo .pf-hist li { flex-direction: column; align-items: stretch; }
  .pf-todo .pf-todo-side { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------------------------------------------------------------------
   รอบ 111b: รายได้และคาดการณ์ (/platform/revenue) — แน่นอน = การ์ด/ตารางปกติ · ≈ คาดการณ์ = กรอบเส้นประ (แบบ .rc-card.est รอบ 109)
   --------------------------------------------------------------------- */
@media screen {
  button.pf-kpi { border: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
  button.pf-kpi:hover { box-shadow: var(--shadow), 0 0 0 2px var(--brand-soft); }
  .pf-kpi.pf-rv-est { background: transparent; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent); }
  .pf-kpi.pf-rv-est:hover { border-color: var(--brand); box-shadow: none; }
  .pf-kpi.pf-rv-est .pf-kpi-ico { background: var(--chip); color: var(--muted); font-size: 1.3rem; font-weight: 800; }
  .pf-kpi.pf-rv-est .pf-kpi-body > strong { font-weight: 700; }
  .pf-rv-body .panel.pf-card { flex-shrink: 0; }
  .pf-rv .pf-kpi-sub { -webkit-line-clamp: 3; }
  .pf-rv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .pf-rv-table td, .pf-rv-table th { white-space: nowrap; }
  .pf-rv-table tfoot td, .pf-rv-table tr.pf-rv-total td { border-top: 2px solid var(--line); font-weight: 700; }
  .pf-rv-scroll { max-height: 520px; overflow: auto; }
  .pf-rv-bar { display: block; height: 4px; margin-top: 5px; border-radius: 999px; background: var(--chip); overflow: hidden; min-width: 80px; }
  .pf-rv-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
  .pf-rv-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .84rem; line-height: 1.5; }
  .pf-rv-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex-shrink: 0; }
  .pf-rv-chip {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 10px 14px; border-radius: 14px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  }
  .pf-rv-chip span { color: var(--muted); font-size: .8rem; font-weight: 600; }
  .pf-rv-chip strong { font-size: 1.15rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .pf-rv-chip small { color: var(--muted); font-size: .78rem; }
  .pf-rv-chip.on { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
  .pf-rv-est-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex-shrink: 0; }
  .pf-rv-estcard {
    display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 18px; border-radius: var(--radius-lg);
    border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  }
  .pf-rv-est-label { color: var(--muted); font-size: .84rem; font-weight: 600; }
  .pf-rv-estcard strong { font-size: 1.4rem; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pf-rv-estcard small { color: var(--muted); font-size: .82rem; }
  .pf-rv-table th.pf-rv-esth { color: var(--muted); font-style: italic; }
  .pf-rv-table td.pf-rv-estc { background: color-mix(in srgb, var(--chip) 45%, transparent); }
  .pf-rv-rate { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
  .pf-rv-rate small { font-size: .76rem; }
  .pf-rv-bad { color: var(--danger); font-weight: 700; }
}
@media screen and (max-width: 1024px) {
  .pf-rv-grid { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 760px) {
  .pf-rv-chips { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pf-rv-chip { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
  .pf-rv-chip strong { margin-left: auto; }
  .pf-rv-est-grid { grid-template-columns: minmax(0, 1fr); }
  .pf-rv-estcard strong { font-size: 1.2rem; }
  .pf-rv-scroll { max-height: none; overflow: visible; }
  .pf-rv-table td, .pf-rv-table th { white-space: normal; }
  .pf-rv-rate { align-items: flex-end; }
  .table.cards.pf-rv-table td.pf-rv-estc { background: none; }
  .table.cards.pf-rv-table tfoot { display: block; width: 100%; }
  .table.cards.pf-rv-table tfoot td { border-top: 0; }
}

/* ---------------------------------------------------------------------
   รอบ 120: สมุดบัญชีของแพลตฟอร์ม (/platform/books) — prefix pfb-
   --------------------------------------------------------------------- */
@media screen {
  .pfb-body .panel.pf-card { flex-shrink: 0; }
  .pfb-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .pfb-neg { color: var(--danger); }
  .pfb-in { color: var(--pf-active, var(--brand)); }
  .pfb-out { color: var(--ink); }
  .pfb-table td, .pfb-table th { vertical-align: top; }
  .pfb-table tr.pfb-pick { cursor: pointer; }
  .pfb-table tr.pfb-pick.on td { background: var(--brand-tint); }
  .pfb-month { font-weight: 700; text-decoration: none; color: var(--ink); }
  .pfb-acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
  .pfb-acc-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
  .pfb-acc-list li:last-child { border-bottom: 0; }
  .pfb-acc-list li > span:first-child { display: flex; flex-direction: column; min-width: 0; }
  .pfb-acc-list li.dim { opacity: .6; }
  .pfb-acc-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .pfb-group { margin: 6px 0 0; font-size: .86rem; font-weight: 700; color: var(--muted); text-transform: none; }
  .pfb-form { max-width: 920px; }
  .pfb-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
  .pfb-kinds button {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
    padding: 8px 14px; border-radius: 999px; cursor: pointer;
  }
  .pfb-kinds button.on { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
  .pfb-preview {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; padding: 10px 14px; border-radius: 12px;
    background: var(--chip); font-size: .9rem;
  }
  .pfb-preview strong { margin-left: auto; }
  .pfb-filters { margin-bottom: 0; flex-shrink: 0; }
  .pfb-src { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); margin-right: 6px; }
  .pfb-src.s-subscription, .pfb-src.s-domain { background: var(--pf-active-bg, var(--chip)); color: var(--pf-active, var(--muted)); }
  .pfb-src.s-recurring { background: var(--pf-grace-bg, var(--chip)); color: var(--pf-grace, var(--muted)); }
  .pfb-desc { overflow-wrap: anywhere; }
  .pfb-void .pfb-desc, .pfb-void td strong { text-decoration: line-through; }
  .pfb-void-note { display: block; color: var(--danger); font-size: .78rem; }
  .pfb-lines { list-style: none; margin: 0; padding: 0; font-size: .84rem; }
  .pfb-lines b { display: inline-block; min-width: 24px; color: var(--muted); }
  .pfb-orig { display: block; font-size: .76rem; white-space: nowrap; }
  .pfb-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .pfb-inline select { min-width: 220px; max-width: 100%; }
  .pfb-presets { display: flex; gap: 8px; flex-wrap: wrap; }
  .btn.pfb-del { color: var(--danger); }
}
@media screen and (max-width: 760px) {
  .pfb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pfb-kinds button { flex: 1 1 auto; padding: 8px 10px; }
  .pfb-preview strong { margin-left: 0; width: 100%; }
  .pfb-acc-list li { flex-wrap: wrap; }
  .pfb-acc-tools { width: 100%; justify-content: flex-start; }
  .pfb-inline select { min-width: 0; flex: 1 1 100%; }
  .pfb-orig { white-space: normal; }
}
