/* ============================================================
   PRO360 Technology — Accounting · Design System
   A modern accounting workspace.
   ============================================================ */

:root {
  /* Brand — PRO360 Technology (navy + gold) */
  --brand-50:  #eef5f7;
  --brand-100: #d6e6ea;
  --brand-200: #a9c8d0;
  --brand-300: #6f9aa6;
  --brand-400: #3d7180;
  --brand-500: #1c5563;
  --brand-600: #123f4b;
  --brand-700: #0e3039;
  --brand-800: #0a252c;
  --brand-900: #071b20;

  /* Gold accent */
  --gold-300: #f0d778;
  --gold-400: #ecc94b;
  --gold-500: #e0b833;
  --gold-600: #c99a2e;

  --accent-500: #e0b833;
  --accent-600: #c99a2e;

  /* Neutrals */
  --ink:        #0f172a;
  --ink-soft:   #334155;
  --muted:      #64748b;
  --muted-2:    #94a3b8;
  --line:       #e7ecf2;
  --line-soft:  #eef2f7;
  --canvas:     #f5f7fa;
  --surface:    #ffffff;

  /* Sidebar */
  --nav-bg-top: #103139;
  --nav-bg-bot: #071b20;
  --nav-text:   #9db3ba;
  --nav-text-dim: #61818a;
  --nav-active-bg: rgba(224,184,51,.14);
  --nav-active-bar: var(--gold-400);

  /* Status */
  --green:  #16a34a;
  --green-bg: #dcfce7;
  --amber:  #d97706;
  --amber-bg: #fef3c7;
  --red:    #dc2626;
  --red-bg: #fee2e2;
  --blue:   #2563eb;
  --blue-bg: #dbeafe;
  --violet: #7c3aed;
  --violet-bg: #ede9fe;

  /* Shape & shadow */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sh-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --sh:    0 1px 3px rgba(15,23,42,.05), 0 6px 20px -8px rgba(15,23,42,.12);
  --sh-lg: 0 10px 40px -12px rgba(15,23,42,.22);

  --sidebar-w: 244px;
  --topbar-h: 62px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
svg.ic { width: 18px; height: 18px; flex: none; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--brand-200); }

.boot {
  min-height: 100vh; display: grid; place-items: center;
  color: var(--muted); font-weight: 500;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd6e2; border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #aab6c6; background-clip: padding-box; }

/* ============================================================
   Layout shell
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 72px 1fr; }

/* -------- Sidebar -------- */
.sidebar {
  background: linear-gradient(185deg, var(--nav-bg-top), var(--nav-bg-bot));
  color: var(--nav-text);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
  z-index: 40;
}
.brand {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  padding: 12px; min-height: 72px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff; flex-shrink: 0; overflow: hidden;
}
.brand img.full-logo { height: 41px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: none;
  background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
  place-items: center; font-weight: 800; color: var(--gold-400); font-size: 15px;
  box-shadow: 0 6px 16px -6px #000; letter-spacing: -.03em;
}
.shell.collapsed .brand img.full-logo { display: none; }
.shell.collapsed .brand .mark { display: grid; }
.shell.collapsed .brand { justify-content: center; padding: 12px 0; }

.nav { flex: 1; overflow-y: auto; padding: 10px 12px 24px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); }

.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--nav-text-dim); font-weight: 700;
  padding: 16px 12px 6px;
}
.shell.collapsed .nav-group-label { text-align: center; font-size: 0; padding: 10px 0 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  color: var(--nav-text); font-weight: 500; font-size: 13.5px;
  position: relative; margin-bottom: 2px; user-select: none;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e8eef6; }
.nav-item.active { background: var(--nav-active-bg); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--nav-active-bar);
}
.nav-item .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: .95; }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; }
.nav-item .chev { width: 15px; height: 15px; transition: transform .18s; opacity: .6; }
.nav-item.open .chev { transform: rotate(90deg); }
.shell.collapsed .nav-item .label,
.shell.collapsed .nav-item .chev { display: none; }
.shell.collapsed .nav-item { justify-content: center; padding: 11px; }

.nav-sub { overflow: hidden; max-height: 0; transition: max-height .22s ease; }
.nav-sub.open { max-height: 420px; }
.shell.collapsed .nav-sub { display: none; }
.nav-subitem {
  display: block; padding: 8px 12px 8px 42px; font-size: 13px;
  color: var(--nav-text-dim); border-radius: 8px; cursor: pointer; margin-bottom: 1px;
  white-space: nowrap;
}
.nav-subitem:hover { color: #dbe4ef; background: rgba(255,255,255,.04); }
.nav-subitem.active { color: #fff; background: rgba(255,255,255,.06); font-weight: 600; }
.nav-subitem.active::before {
  content: "•"; color: var(--brand-400); margin-left: -14px; margin-right: 6px;
}

/* -------- Topbar -------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: grid; place-items: center;
  cursor: pointer; transition: background .12s, color .12s; position: relative;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }

.searchbar {
  flex: 1; max-width: 440px; height: 40px; display: flex; align-items: center; gap: 9px;
  background: var(--canvas); border: 1px solid var(--line); border-radius: 11px; padding: 0 13px;
  color: var(--muted); cursor: text; transition: border-color .12s, box-shadow .12s;
}
.searchbar:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); background: #fff; }
.searchbar input { border: 0; background: transparent; outline: none; flex: 1; font-size: 13.5px; color: var(--ink); }
.searchbar .kbd { font-size: 11px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: #fff; }

.spacer { flex: 1; }
.topbar .avatar {
  width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, var(--accent-500), var(--accent-600));
  color: #fff; display: grid; place-items: center; font-weight: 700; cursor: pointer; font-size: 14px;
}

/* -------- Trial banner -------- */
.trial-banner {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  color: #fff; text-align: center; font-size: 13px; font-weight: 500;
  padding: 8px 16px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.trial-banner a { text-decoration: underline; font-weight: 700; }
.trial-banner .close { margin-left: 10px; cursor: pointer; opacity: .8; }

/* -------- Content -------- */
.content { padding: 26px 30px 60px; max-width: 1420px; width: 100%; margin: 0 auto; }

/* Page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 220px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; margin-bottom: 7px; }
.breadcrumb .sep { color: var(--muted-2); }
.breadcrumb a:hover { color: var(--brand-600); }
.page-title { font-size: 23px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: all .13s; white-space: nowrap;
}
.btn:hover { border-color: #d3dbe6; background: #fbfcfe; box-shadow: var(--sh-sm); }
.btn .ic { width: 17px; height: 17px; }
.btn.primary {
  background: linear-gradient(145deg, var(--brand-500), var(--brand-600)); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px -8px var(--brand-600);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 8px 20px -8px var(--brand-600); }
.btn.accent { background: linear-gradient(145deg, var(--accent-500), var(--accent-600)); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line-soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 40px; padding: 0; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #fecaca; }

/* ============================================================
   Cards
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 22px; border-bottom: 1px solid var(--line-soft); gap: 12px; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: 1fr; } .g-2 { grid-template-columns: 1fr; } }

/* Stat cards */
.stat {
  border-radius: var(--r-lg); padding: 18px 20px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--sh); min-height: 108px; display: flex; flex-direction: column; justify-content: space-between;
}
.stat .ic-wrap { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; margin-bottom: 12px; }
.stat .ic-wrap .ic { width: 22px; height: 22px; }
.stat .k { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.stat .v { font-size: 25px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }
.stat .cap { font-size: 12px; opacity: .8; margin-top: 1px; }
.stat.teal   { background: linear-gradient(145deg, #14b8a6, #0d9488); }
.stat.blue   { background: linear-gradient(145deg, #3b82f6, #2563eb); }
.stat.indigo { background: linear-gradient(145deg, #6366f1, #4f46e5); }
.stat.amber  { background: linear-gradient(145deg, #f59e0b, #d97706); }
.stat.rose   { background: linear-gradient(145deg, #fb7185, #e11d48); }
.stat .glow { position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.12); }

/* ============================================================
   Badges / pills
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; line-height: 1.4; white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green  { color: var(--green); background: var(--green-bg); }
.badge.amber  { color: var(--amber); background: var(--amber-bg); }
.badge.red    { color: var(--red); background: var(--red-bg); }
.badge.blue   { color: var(--blue); background: var(--blue-bg); }
.badge.violet { color: var(--violet); background: var(--violet-bg); }
.badge.gray   { color: var(--muted); background: var(--line-soft); }

/* ============================================================
   Tabs (anchor style)
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab {
  padding: 11px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .12s;
}
.tab:hover { color: var(--ink-soft); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.tab .count { margin-left: 6px; font-size: 11px; background: var(--line-soft); color: var(--muted); padding: 1px 7px; border-radius: 999px; }
.tab.active .count { background: var(--brand-100); color: var(--brand-700); }

/* ============================================================
   Filters bar
   ============================================================ */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field label .req { color: var(--red); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select textarea, textarea.input, select.input {
  height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  font-size: 13.5px; color: var(--ink); background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 74px; }
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.input::placeholder { color: var(--muted-2); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted-2); }
.input-icon .input { padding-left: 36px; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: #fbfcfe; white-space: nowrap; position: sticky; top: 0;
}
table.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
table.tbl .strong { font-weight: 650; color: var(--ink); }
.doc-link { color: var(--brand-700); font-weight: 650; cursor: pointer; }
.doc-link:hover { text-decoration: underline; }
.checkbox { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #cbd5e1; cursor: pointer; accent-color: var(--brand-600); }
.avatar-sm { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff; flex-shrink: 0; }
.cell-party { display: flex; align-items: center; gap: 10px; }
.cell-party .sub { color: var(--muted); font-size: 12px; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .5; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }

/* Table toolbar + pagination */
.tbl-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: #fff; }
.tbl-toolbar .count { color: var(--muted); font-size: 13px; }
.pagination { display: flex; align-items: center; gap: 10px; padding: 12px 16px; justify-content: flex-end; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager .pg { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.pager .pg.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.pager .pg:hover:not(.active) { background: var(--line-soft); }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ic { width: 46px; height: 46px; color: var(--muted-2); margin-bottom: 12px; }
.empty h4 { color: var(--ink-soft); font-size: 16px; margin: 0 0 6px; }

/* ============================================================
   Form / document layout
   ============================================================ */
.form-section { display: grid; grid-template-columns: 260px 1fr; gap: 30px; padding: 26px 4px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-child { border-bottom: 0; }
.form-section .sec-label h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.form-section .sec-label p { margin: 0; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-content: start; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 900px) { .form-section { grid-template-columns: 1fr; gap: 16px; } .form-grid { grid-template-columns: 1fr; } }

.seg { display: inline-flex; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg .opt { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg .opt.active { background: #fff; color: var(--brand-700); box-shadow: var(--sh-sm); }

/* Line items table */
.lines { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lines th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.lines td .input { height: 36px; }
.lines .handle { color: var(--muted-2); cursor: grab; }

.totals { margin-left: auto; width: 340px; max-width: 100%; }
.totals .row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13.5px; color: var(--ink-soft); }
.totals .row.grand { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 14px; font-size: 18px; font-weight: 750; color: var(--ink); }

/* Sticky save bar */
.save-bar {
  position: sticky; bottom: 0; margin: 0 -30px -60px; padding: 14px 30px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; justify-content: flex-end; z-index: 20;
}
.save-bar .check { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 500; margin-right: auto; }

/* Chart helpers */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.legend .li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }
.donut-center { font-weight: 750; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; color: var(--ink); }

/* Toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 11px; font-size: 13.5px;
  box-shadow: var(--sh-lg); display: flex; align-items: center; gap: 10px; animation: slideIn .25s ease;
  max-width: 340px;
}
.toast .ic { width: 18px; height: 18px; color: var(--brand-400); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Progress list */
.mini-list .mi { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.mini-list .mi:last-child { border-bottom: 0; }
.mini-list .mi .grow { flex: 1; min-width: 0; }
.mini-list .mi .t { font-weight: 600; font-size: 13.5px; }
.mini-list .mi .s { color: var(--muted); font-size: 12px; }

.progress { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); }

/* ============================================================
   Print / PDF paper
   ============================================================ */
.print-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.paper {
  background: #fff; max-width: 820px; margin: 0 auto; padding: 48px 52px;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh-lg); color: #1e293b;
}
.paper-logo { height: 46px; width: auto; }
.paper-muted { color: #64748b; font-size: 12.5px; line-height: 1.6; }
.paper-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 700; margin-bottom: 5px; }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 26px; border-bottom: 2px solid #123f4b; }
.paper-parties { display: flex; justify-content: space-between; gap: 24px; margin: 26px 0; }
.paper-kv { display: flex; gap: 26px; justify-content: flex-end; font-size: 13px; padding: 2px 0; color: #475569; }
.paper-kv b { min-width: 90px; display: inline-block; text-align: right; color: #1e293b; }
.paper-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.paper-table thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: 10px 12px; background: #f1f5f9; }
.paper-table thead th.num, .paper-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.paper-table tbody td { padding: 12px; border-bottom: 1px solid #eef2f7; font-size: 13.5px; }
.paper-totals { margin-left: auto; width: 300px; margin-top: 18px; }
.paper-totals .row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; color: #475569; }
.paper-totals .row.grand { border-top: 2px solid #123f4b; margin-top: 6px; padding-top: 12px; font-size: 18px; font-weight: 800; color: #123f4b; }
.paper-foot { margin-top: 36px; padding-top: 20px; border-top: 1px solid #eef2f7; }

@media print {
  .sidebar, .topbar, .trial-banner, .save-bar, .print-toolbar, footer { display: none !important; }
  .shell { display: block !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .paper { border: 0; box-shadow: none; max-width: none; padding: 0; }
  body { background: #fff; }
}

/* ============================================================
   Digital Shoebox — 3-pane workspace
   ============================================================ */
.sb-wrap { display: grid; grid-template-columns: 300px 1fr 380px; gap: 16px; height: calc(100vh - var(--topbar-h) - 150px); min-height: 520px; }
@media (max-width: 1180px) { .sb-wrap { grid-template-columns: 260px 1fr; } .sb-form-pane { display: none; } }
@media (max-width: 820px) { .sb-wrap { grid-template-columns: 1fr; height: auto; } .sb-preview-pane { display: none; } }

.sb-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); display: flex; flex-direction: column; overflow: hidden; }
.sb-list { }
.sb-tabs { display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sb-tab { flex: 1; text-align: center; padding: 12px 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sb-tab.active { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.sb-tab .n { font-size: 11px; background: var(--line-soft); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.sb-items { flex: 1; overflow-y: auto; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .1s; }
.sb-item:hover { background: #f8fafc; }
.sb-item.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-500); }
.sb-item .grow { flex: 1; min-width: 0; }
.sb-item .t { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item .s { color: var(--muted); font-size: 12px; margin-top: 1px; }
.sb-item .tick { color: var(--green); flex-shrink: 0; }
.sb-item .tick.proc { color: var(--amber); }
.sb-item .tick.fail { color: var(--red); }
.sb-foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-shrink: 0; }

.sb-preview-pane { background: #f1f5f9; }
.sb-pdfbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #334155; color: #cbd5e1; font-size: 12.5px; flex-shrink: 0; }
.sb-pdfbar .ic { width: 16px; height: 16px; cursor: pointer; }
.sb-pdfbar .pg { background: #1e293b; border-radius: 6px; padding: 2px 8px; color: #e2e8f0; }
.sb-preview-body { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 24px; }
.receipt {
  background: #fff; width: 320px; min-height: 420px; padding: 26px 24px; box-shadow: var(--sh-lg);
  font-family: "Courier New", monospace; font-size: 12.5px; color: #1e293b; height: fit-content;
}
.receipt .r-c { text-align: center; }
.receipt .r-hr { border: 0; border-top: 1px dashed #94a3b8; margin: 10px 0; }
.receipt .r-row { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt .r-tot { font-weight: 700; font-size: 14px; }
.sb-file-meta { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--muted); flex-shrink: 0; }

.sb-form-pane { }
.sb-doctabs { display: flex; gap: 2px; padding: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sb-doctab { padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px; white-space: nowrap; }
.sb-doctab.active { color: var(--brand-700); background: var(--brand-50); }
.sb-form-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.sb-subtabs { display: inline-flex; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 16px; }
.sb-subtab { padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.sb-subtab.active { background: #fff; color: var(--brand-700); box-shadow: var(--sh-sm); }
.sb-fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sb-fgrid .full { grid-column: 1 / -1; }
.sb-form-foot { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }
.sb-quota { display: inline-flex; align-items: center; gap: 6px; background: var(--green-bg); color: var(--green); font-weight: 700; font-size: 12.5px; padding: 3px 11px; border-radius: 999px; }
.sb-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 10px; text-align: center; padding: 20px; }
.sb-empty .ic { width: 42px; height: 42px; color: var(--muted-2); }

/* ============================================================
   Login screen
   ============================================================ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand {
  background: linear-gradient(160deg, #123f4b, #071b20);
  color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-brand .glow-a { position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(224,184,51,.16), transparent 70%); top: -120px; right: -120px; }
.auth-brand .glow-b { position: absolute; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(20,184,166,.14), transparent 70%); bottom: -100px; left: -80px; }
.auth-brand img.logo { height: 62px; width: auto; position: relative; align-self: flex-start; object-fit: contain; }
.auth-brand .headline { position: relative; }
.auth-brand .headline h1 { font-size: 34px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 14px; max-width: 420px; }
.auth-brand .headline p { color: #a9c8d0; font-size: 15px; max-width: 400px; line-height: 1.6; margin: 0; }
.auth-brand .points { position: relative; display: flex; flex-direction: column; gap: 14px; }
.auth-brand .pt { display: flex; align-items: center; gap: 12px; color: #cfe0e5; font-size: 14px; }
.auth-brand .pt .dot { width: 30px; height: 30px; border-radius: 9px; background: rgba(224,184,51,.16); color: var(--gold-400); display: grid; place-items: center; flex-shrink: 0; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--canvas); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .m-logo { display: none; margin-bottom: 22px; }
.auth-card h2 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-card .lead { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; font-size: 13px; }
.auth-row label { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); cursor: pointer; }
.auth-row a { color: var(--brand-600); font-weight: 600; }
.auth-card .btn.primary { width: 100%; height: 46px; font-size: 15px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.auth-foot a { color: var(--brand-600); font-weight: 600; }
.auth-hint { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 22px; }
.persona-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.persona {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.persona:hover { border-color: var(--brand-400); box-shadow: 0 6px 20px rgba(15,40,60,.10); }
.persona:active { transform: translateY(1px); }
.persona .pa { width: 40px; height: 40px; border-radius: 11px; color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 13.5px; flex-shrink: 0; }
.persona .pt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.persona .pt b { font-size: 14.5px; color: var(--ink); }
.persona .pt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona .pgo { margin-left: auto; color: var(--muted-2); display: grid; place-items: center; flex-shrink: 0; }
.persona .pgo svg { width: 16px; height: 16px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .m-logo { display: block; }
  .auth-card .m-logo img { height: 54px; }
}

/* ============================================================
   Dropdown menu (avatar)
   ============================================================ */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-lg); min-width: 236px; padding: 6px; z-index: 60; }
.menu .head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.menu .head .n { font-weight: 700; font-size: 14px; }
.menu .head .e { color: var(--muted); font-size: 12.5px; }
.menu .mi { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.menu .mi:hover { background: var(--line-soft); }
.menu .mi.danger { color: var(--red); }
.menu .mi.danger:hover { background: var(--red-bg); }
.menu .mi .ic { width: 17px; height: 17px; }
.menu .sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }

/* ============================================================
   Global search + notifications (topbar dropdowns)
   ============================================================ */
.search-wrap { position: relative; flex: 1; max-width: 440px; }
@media (max-width: 760px) { .search-wrap { display: none; } }
.search-panel {
  position: absolute; top: 48px; left: 0; width: 460px; max-width: 92vw;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg);
  z-index: 60; max-height: 66vh; overflow-y: auto; padding: 6px;
}
.search-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; padding: 12px 12px 5px; }
.search-res { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.search-res:hover, .search-res.sel { background: var(--line-soft); }
.search-res .grow { flex: 1; min-width: 0; }
.search-res .t { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-res .s { color: var(--muted); font-size: 12px; }
.search-res .go { color: var(--muted-2); font-size: 11px; }
.search-empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.search-empty .ic { width: 34px; height: 34px; color: var(--muted-2); margin-bottom: 8px; }
.search-hintbar { padding: 9px 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11.5px; display: flex; gap: 14px; }
.search-hintbar .kbd { border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; background: var(--canvas); }

.notif-panel {
  position: absolute; right: 0; top: 46px; width: 360px; max-width: 92vw;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); z-index: 60; overflow: hidden;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); }
.notif-head h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.notif-head a { color: var(--brand-600); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: #f8fafc; }
.notif-item .ni { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item .ni.red { background: var(--red-bg); color: var(--red); }
.notif-item .ni.amber { background: var(--amber-bg); color: var(--amber); }
.notif-item .ni.teal { background: var(--brand-50); color: var(--brand-600); }
.notif-item .ni.blue { background: var(--blue-bg); color: var(--blue); }
.notif-item .grow { flex: 1; min-width: 0; }
.notif-item .t { font-weight: 600; font-size: 13px; }
.notif-item .s { color: var(--muted); font-size: 12px; margin-top: 1px; }
.notif-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.notif-empty .ic { width: 34px; height: 34px; color: var(--muted-2); margin-bottom: 8px; }

/* ============================================================
   Toggle switch + API Access page
   ============================================================ */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: var(--sh-sm); }
.switch input:checked + .track { background: var(--brand-500); }
.switch input:checked + .track::before { transform: translateX(20px); }

.api-section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 18px 0 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
.api-row { display: grid; grid-template-columns: 170px 1fr 280px; gap: 20px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.api-row:last-child { border-bottom: 0; }
.api-row > .lbl { font-weight: 600; font-size: 13.5px; color: var(--ink-soft); padding-top: 9px; }
.api-row .hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.api-row .hint code { background: var(--canvas); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: var(--ink-soft); }
.api-token { width: 100%; min-height: 92px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink-soft); resize: vertical; line-height: 1.5; }
.api-disabled { opacity: .5; pointer-events: none; }
@media (max-width: 880px) { .api-row { grid-template-columns: 1fr; gap: 8px; } .api-row > .lbl { padding-top: 0; } }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--sh-lg); width: 100%; max-width: 470px; max-height: 86vh; overflow: hidden; display: flex; flex-direction: column; animation: slideIn .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.modal-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }
.grp-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.grp-row .dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.grp-row .nm { flex: 1; font-weight: 600; font-size: 13.5px; }
.grp-row .cnt { color: var(--muted); font-size: 12px; }
.grp-add { display: flex; gap: 8px; margin-top: 14px; }
.grp-add .input { flex: 1; }

/* ============================================================
   Reports module
   ============================================================ */
.report-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; }
.report-toolbar .field { margin: 0; min-width: 160px; }
.report-toolbar .spacer { flex: 1; }
.report-paper { padding: 26px 30px; }
.report-head { margin-bottom: 18px; }
.report-head .co { font-size: 18px; font-weight: 750; color: var(--ink); letter-spacing: -.01em; }
.report-head .rt { font-size: 14px; font-weight: 700; color: var(--brand-600); margin-top: 2px; }
.report-head .rp { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.rpt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rpt th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap; }
.rpt th.num, .rpt td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rpt td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.rpt tr.sec td { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding-top: 16px; border-bottom: 0; }
.rpt tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
.rpt tr.grand td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--ink); padding-top: 12px; }
.rpt td.indent { padding-left: 28px; }
.rpt .drill { color: var(--brand-700); cursor: pointer; }
.rpt .drill:hover { text-decoration: underline; }
.rpt tbody tr:hover { background: #f8fafc; }
.pos { color: var(--green); } .neg { color: var(--red); }
.rpt-empty { text-align: center; color: var(--muted); padding: 30px; }

@media print {
  .sidebar, .topbar, .trial-banner, .report-toolbar, .page-actions, .breadcrumb, footer, .save-bar { display: none !important; }
  .shell { display: block !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .report-paper, .card { border: 0 !important; box-shadow: none !important; }
  body { background: #fff; }
  .page-head { margin-bottom: 8px; }
}

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.hide-sm { }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w); }
  .shell.mobile-open .sidebar { transform: none; box-shadow: var(--sh-lg); }
  .searchbar { display: none; }
  .content { padding: 18px 16px 60px; }
  .hide-sm { display: none; }
}

/* Timeline (invoice history, activity) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; flex: 0 0 auto; background: var(--muted); z-index: 1; }
.timeline .dot.teal { background: var(--brand, #123f4b); }
.timeline .dot.gold { background: var(--gold, #e0b833); }
.timeline .dot.muted { background: var(--line); border: 2px solid var(--muted); }

/* ===== Super Admin (Platform) portal ===== */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--hover, rgba(18,63,75,.04)); }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--line); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.tab.active .tab-count { background: var(--brand, #123f4b); color: #fff; }

.plan-card { position: relative; display: flex; flex-direction: column; }
.plan-card.popular { border-color: var(--gold, #e0b833); box-shadow: 0 0 0 1px var(--gold, #e0b833) inset; }
.plan-flag { position: absolute; top: -1px; right: -1px; background: var(--gold, #e0b833); color: #3a2d00;
  font-size: 10.5px; font-weight: 800; letter-spacing: .03em; padding: 3px 9px; border-radius: 0 12px 0 12px; text-transform: uppercase; }
.plan-name { font-size: 17px; font-weight: 800; color: var(--brand, #123f4b); }
.plan-price { margin: 10px 0 2px; font-size: 15px; }
.plan-price b { font-size: 26px; color: var(--ink); }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan-feats { list-style: none; margin: 6px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-feats li { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.plan-feats li svg { width: 14px; height: 14px; color: var(--green); flex: 0 0 auto; margin-top: 1px; }
.plan-meta { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }

/* Attention alerts (platform overview) */
.alert-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-row.click { cursor: pointer; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.alert-row.click:hover { background: var(--hover, rgba(18,63,75,.04)); }

/* ===== Power Search (⌘K command palette) ===== */
.powersearch-trigger { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; min-width: 220px; max-width: 420px; flex: 1 1 320px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface, #fff); color: var(--muted); cursor: pointer; font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
.powersearch-trigger:hover { border-color: var(--brand, #123f4b); box-shadow: 0 1px 0 rgba(18,63,75,.04); }
.powersearch-trigger svg { width: 17px; height: 17px; flex: 0 0 auto; }
.powersearch-trigger .ps-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.powersearch-trigger .kbd { flex: 0 0 auto; }
@media (max-width: 640px) { .powersearch-trigger { min-width: 0; flex: 0 0 auto; } .powersearch-trigger .ps-label, .powersearch-trigger .kbd { display: none; } }

.ps-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,32,.44); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; animation: psFade .12s ease; }
@keyframes psFade { from { opacity: 0; } to { opacity: 1; } }
.ps-modal { width: 100%; max-width: 640px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; animation: psPop .14s ease; }
@keyframes psPop { from { transform: translateY(-8px) scale(.99); opacity: .6; } to { transform: none; opacity: 1; } }
.ps-inputbar { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.ps-inputbar svg { width: 19px; height: 19px; color: var(--muted); flex: 0 0 auto; }
.ps-inputbar input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); }
.ps-results { overflow-y: auto; padding: 6px; }
.ps-group { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.ps-res { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.ps-res.active { background: var(--brand, #123f4b); }
.ps-res.active .t, .ps-res.active .s, .ps-res.active .ps-go { color: #fff; }
.ps-res.active .ps-ic-box { background: rgba(255,255,255,.16); color: #fff; }
.ps-res .grow { min-width: 0; flex: 1; }
.ps-res .t { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-res .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-res .ps-go { font-size: 11px; color: var(--muted); flex: 0 0 auto; opacity: 0; }
.ps-res.active .ps-go { opacity: 1; }
.ps-ic-box { width: 30px; height: 30px; border-radius: 8px; background: var(--hover, rgba(18,63,75,.06)); color: var(--brand, #123f4b);
  display: grid; place-items: center; flex: 0 0 auto; }
.ps-ic-box svg { width: 16px; height: 16px; }
.ps-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px; color: var(--muted); text-align: center; }
.ps-empty svg { width: 26px; height: 26px; opacity: .6; }
.ps-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.ps-foot .kbd { margin-right: 3px; }

/* Power Search — recent group header + clear */
.ps-group { display: flex; align-items: center; justify-content: space-between; }
.ps-clear { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 6px; text-transform: none; letter-spacing: 0; }
.ps-clear:hover { color: var(--brand, #123f4b); background: var(--hover, rgba(18,63,75,.06)); }

/* Row-action dropdown menu */
.rowmenu-wrap { position: relative; display: inline-block; }
.rowmenu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 940; min-width: 200px;
  background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 6px; text-align: left; }
.rowmenu .mi { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap; }
.rowmenu .mi:hover { background: var(--hover, rgba(18,63,75,.06)); }
.rowmenu .mi.danger { color: var(--red); }
.rowmenu .mi svg { width: 15px; height: 15px; color: var(--muted); }
.rowmenu .mi.danger svg { color: var(--red); }
.rowmenu .sep { height: 1px; background: var(--line); margin: 5px 8px; }

/* Attachment chips */
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.attach-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--surface, #fff); }
.attach-chip svg { width: 14px; height: 14px; color: var(--muted); }
.attach-chip button { border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--muted); }
.attach-chip button:hover { color: var(--red); }
.attach-chip button svg { width: 12px; height: 12px; }

/* Keep row actions fully opaque while a row menu is open (opacity<1 would trap the menu in a dimmed stacking context) */
.row-actions.menu-open { opacity: 1; }

/* Reconciliation method chooser */
.recon-banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; margin-bottom: 18px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; }
.recon-banner .recon-info { color: #2563eb; flex: 0 0 auto; margin-top: 2px; }
.recon-banner .recon-info svg { width: 20px; height: 20px; }
.recon-card { position: relative; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 14px;
  padding: 0 0 18px; cursor: pointer; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .1s; }
.recon-card:hover { border-color: var(--brand, #123f4b); box-shadow: var(--sh-md, 0 6px 18px rgba(0,0,0,.08)); transform: translateY(-2px); }
.recon-ic { height: 120px; background: #eff6ff; display: grid; place-items: center; border-bottom: 1px dashed var(--line); margin-bottom: 14px; }
.recon-ic svg { width: 44px; height: 44px; color: var(--brand, #123f4b); }
.recon-bank { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; }
.recon-body { padding: 0 18px; }
.recon-title { font-weight: 750; font-size: 15px; display: flex; align-items: center; flex-wrap: wrap; }
.recon-desc { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.recon-quota { position: absolute; top: 10px; left: 10px; background: #0d9488; color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.recon-quota svg { width: 13px; height: 13px; }
.recon-up { position: absolute; top: 10px; right: 12px; color: #2563eb; }
.recon-up svg { width: 20px; height: 20px; }
.recon-flag { position: absolute; top: 10px; right: 12px; }

/* ===== Online auth form + cloud sync ===== */
.auth-card #authForm .field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 5px; }
.auth-card #authForm .input { height: 44px; }
.auth-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 12.5px;
  padding: 9px 12px; border-radius: 9px; margin-bottom: 12px; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--brand, #123f4b); font-weight: 700; cursor: pointer; margin-left: 5px; }
.sync-state { font-size: 12px; color: var(--green); margin-right: 6px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.sync-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
@media (max-width: 720px) { .sync-state { display: none; } }

/* ===== Platform admin impersonation banner ===== */
.imp-banner { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13px;
  background: #fffbeb; color: #92400e; border-bottom: 1px solid #fde68a; }
.imp-banner.editing { background: #fef2f2; color: #991b1b; border-bottom-color: #fecaca; }
.imp-banner .imp-ic svg { width: 17px; height: 17px; display: block; }
.imp-banner .btn.sm { height: 30px; }
