/* Khushal Baba — admin panel
   Sky blue for everything you click, deep navy for structure,
   solar amber only for "New sale" and the KB mark. */
:root {
  --bg: #eef5fa;
  --panel: #ffffff;
  --ink: #0f2a3d;
  --ink-2: #33495a;
  --muted: #6a7f8f;
  --line: #e2ecf3;
  --line-strong: #cbdbe6;

  --brand: #0284c7;
  --brand-hover: #0369a1;
  --brand-ink: #ffffff;
  --brand-soft: #e0f2fe;
  --brand-softer: #f2f9fe;

  --navy: #0c4a6e;
  --navy-2: #083553;
  --sun: #f59e0b;
  --sun-ink: #3b2203;

  --danger: #c2261d;
  --danger-soft: #fdeceb;
  --warn: #9a5b00;
  --warn-soft: #fff3d6;
  --ok: #047857;
  --ok-soft: #e1f5ec;

  --r-sm: 8px;    /* inputs, buttons */
  --r-md: 12px;   /* cards */
  --r-lg: 16px;   /* dialogs, invoice */
  --shadow: 0 1px 2px rgba(12, 74, 110, .06), 0 4px 16px rgba(12, 74, 110, .05);
  --focus: 0 0 0 3px rgba(2, 132, 199, .28);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.55 "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; margin: 0; color: var(--navy-2); }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; color: var(--navy-2); }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--danger); }  /* they owe us */
.neg { color: var(--ok); }      /* we owe them / credit */

/* ───────── Layout ───────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex-shrink: 0; color: #d6ecfa;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  padding: 18px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 2px 8px 18px; letter-spacing: -.01em; }
.sidebar .logo:hover { text-decoration: none; color: #fff; }
.logo-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--sun); color: var(--sun-ink); font-size: 13px; font-weight: 800; letter-spacing: -.02em;
}
.sidebar .group { font-size: 12px; font-weight: 500; color: #8fc0dd; padding: 16px 10px 6px; }
.sidebar a { display: flex; align-items: center; gap: 11px; color: #d6ecfa; padding: 8px 10px; border-radius: 9px; font-weight: 500; }
.sidebar a .icon { flex-shrink: 0; opacity: .75; }
.sidebar a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.sidebar a.active { background: rgba(125, 211, 252, .16); color: #fff; }
.sidebar a.active .icon { opacity: 1; color: #7dd3fc; }
.sidebar .nav-cta { background: var(--sun); color: var(--sun-ink); font-weight: 700; margin: 4px 0 6px; }
.sidebar .nav-cta .icon { opacity: 1; color: var(--sun-ink); }
.sidebar .nav-cta:hover, .sidebar .nav-cta.active { background: #fbbf24; color: var(--sun-ink); }
.sidebar .nav-cta.active .icon { color: var(--sun-ink); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 10px 28px; position: sticky; top: 0; z-index: 10;
}
.topbar form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-hover); font-weight: 700; font-size: 13px;
}
.content { padding: 26px 28px 40px; max-width: 1440px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.btn.menu-toggle { display: none; }

/* ───────── Panels ───────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card.flush { padding: 0; overflow-x: auto; }
.card.flush > h2 { padding: 18px 20px 4px; }
.grid { display: grid; gap: 20px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--navy-2); margin: 4px 0 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.card.stat { border-top: 3px solid var(--brand); }

/* ───────── Tables ───────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--brand-softer); white-space: nowrap; }
tbody tr:hover td { background: #f8fbfe; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--brand-softer); border-top: 1px solid var(--line-strong); }
.table-compact td, .table-compact th { padding: 7px 12px; }

/* ───────── Forms ───────── */
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
label.check { white-space: normal; overflow: visible; }
.label-row label { overflow: hidden; text-overflow: ellipsis; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 0; }
input:hover, select:hover, textarea:hover { border-color: #a9c3d6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input:disabled { background: var(--brand-softer); color: var(--muted); }
input[type=checkbox] { width: 18px; min-height: 0; height: 18px; accent-color: var(--brand); }
.field { margin-bottom: 16px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); font-size: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters > * { width: auto; }
.filters input, .filters select { min-width: 150px; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 3px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--r-sm); border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(2, 132, 199, .25); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--brand-softer); border-color: #a9c3d6; color: var(--navy-2); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1b8b4; box-shadow: none; }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sun { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); box-shadow: 0 1px 2px rgba(245, 158, 11, .35); }
.btn.sun:hover { background: #fbbf24; border-color: #fbbf24; color: var(--sun-ink); }
.btn.small { min-height: 30px; padding: 4px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn .icon { width: 17px; height: 17px; }

/* ───────── Badges & alerts ───────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #edf2f6; color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.paid, .badge.delivered, .badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.partial, .badge.pending, .badge.confirmed { background: var(--warn-soft); color: var(--warn); }
.badge.unpaid, .badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.badge.usd { background: #e5efff; color: #1d4ed8; }
.badge.usd::before { display: none; }
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 18px; border: 1px solid transparent; font-weight: 500; }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: #b7e4cf; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: #f5c2bf; }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }

/* ───────── Searchable select ───────── */
.combo { position: relative; }
.combo-select { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.combo-input { padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236a7f8f' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: 0 12px 32px rgba(12, 74, 110, .16); max-height: 300px; overflow-y: auto; min-width: 280px;
}
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.combo-list li:hover, .combo-list li.active { background: var(--brand-soft); color: var(--navy-2); }
.combo-list li.muted { color: var(--muted); }
.filters .combo { min-width: 240px; }

/* ───────── Dialog ───────── */
.dialog { border: 0; border-radius: var(--r-lg); padding: 24px; width: min(660px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgba(8, 53, 83, .35); }
.dialog[open] { animation: dialog-in .16s ease-out; }
.dialog::backdrop { background: rgba(8, 53, 83, .5); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ───────── Invoice form lines ───────── */
.items td { padding: 8px; vertical-align: top; }
.items .col-qty { width: 100px; }
.items .col-price { width: 150px; }
.items .col-serial { width: 170px; }
.items .col-total { width: 140px; }
.items .col-x { width: 52px; }
.items tbody tr:hover td { background: transparent; }
.items .stock-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.totals { margin-left: auto; max-width: 400px; align-self: start; }
.totals td { padding: 7px 0; border: 0; }
.totals tr:hover td { background: transparent; }

/* ───────── Pagination (bootstrap markup) ───────── */
.pagination { display: flex; gap: 6px; list-style: none; padding: 14px 20px; margin: 0; flex-wrap: wrap; }
.page-link { display: block; min-width: 34px; text-align: center; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink-2); }
.page-link:hover { background: var(--brand-softer); text-decoration: none; }
.page-item.active .page-link { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-item.disabled .page-link { color: var(--muted); opacity: .6; }
nav .small.text-muted, nav .d-sm-none { display: none; }

/* ───────── Login ───────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #bae6fd 0%, transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); }
.login-box { width: 100%; max-width: 400px; }
.login-box .card { padding: 30px; border: 0; box-shadow: 0 30px 80px rgba(3, 20, 33, .35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

/* ═════════ Invoice document (A4) ═════════ */
.invoice-doc {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 44px 48px; max-width: 900px; margin: 0 auto 24px; color: var(--ink);
}
.inv-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.inv-brand { display: flex; gap: 14px; align-items: flex-start; }
.inv-brand .logo-mark { width: 52px; height: 52px; border-radius: 14px; font-size: 19px; }
.inv-brand h1 { font-size: 24px; margin-bottom: 2px; }
.inv-brand p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.inv-title { text-align: right; }
.inv-title .word { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: var(--brand); line-height: 1; }
.inv-title .no { font-size: 16px; font-weight: 700; color: var(--navy-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.inv-rule { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--sun) 70% 100%); margin: 26px 0; }
.inv-parties { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; margin-bottom: 26px; }
.inv-parties h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.inv-parties .who { font-size: 17px; font-weight: 700; color: var(--navy-2); }
.inv-parties p { margin: 2px 0; color: var(--ink-2); }
.inv-meta { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; align-content: start; }
.inv-meta dt { color: var(--muted); }
.inv-meta dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-items th { background: var(--navy); color: #fff; font-size: 12px; }
.inv-items th:first-child { border-radius: 8px 0 0 8px; }
.inv-items th:last-child { border-radius: 0 8px 8px 0; }
.inv-items td { padding: 12px 14px; }
.inv-items tbody tr:nth-child(even) td { background: #f7fbfe; }
.inv-items tbody tr:hover td { background: inherit; }
.inv-items .item-name { font-weight: 600; }
.inv-bottom { display: grid; grid-template-columns: 1fr 340px; gap: 32px; margin-top: 22px; align-items: start; }
.inv-words { background: var(--brand-softer); border-radius: 10px; padding: 12px 14px; color: var(--ink-2); }
.inv-words strong { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.inv-totals td { border: 0; padding: 6px 0; }
.inv-totals tr:hover td { background: transparent; }
.inv-totals .grand td { border-top: 2px solid var(--navy); padding-top: 10px; font-size: 18px; font-weight: 800; color: var(--navy-2); }
.inv-due { margin-top: 10px; background: var(--navy); color: #fff; border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.inv-due span { font-size: 13px; opacity: .85; }
.inv-due strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.inv-due.settled { background: var(--ok); }
.inv-khata { margin-top: 22px; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.inv-khata div span { display: block; font-size: 12px; color: var(--muted); }
.inv-khata div b { font-variant-numeric: tabular-nums; }
.inv-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 44px; }
.inv-sign { border-top: 1px solid var(--line-strong); padding-top: 6px; color: var(--muted); font-size: 12px; }
.inv-terms { margin-top: 26px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.inv-thanks { margin-top: 18px; text-align: center; font-weight: 600; color: var(--brand-hover); }
.stamp { display: inline-block; border: 2px solid currentColor; border-radius: 8px; padding: 2px 10px; font-weight: 800; transform: rotate(-4deg); }
.stamp.paid { color: var(--ok); }
.stamp.cancelled { color: var(--danger); }

/* ───────── Print ───────── */
@media print {
  @page { size: A4; margin: 12mm; }
  .sidebar, .topbar, .no-print, .alert, .bottom-nav, .sidebar-backdrop { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .invoice-doc { border: 0; box-shadow: none; padding: 0; max-width: none; margin: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ───────── Mobile ───────── */
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; box-shadow: 10px 0 40px rgba(0, 0, 0, .25); }
  .sidebar.open { left: 0; }
  .btn.menu-toggle { display: inline-flex; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 10px 16px; }
  .user-chip .who { display: none; }
  .invoice-doc { padding: 22px 18px; }
  .inv-top, .inv-parties, .inv-bottom, .inv-foot { grid-template-columns: 1fr; display: grid; }
  .inv-title { text-align: left; }
  .inv-khata { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ───────── Summary cards (colour = meaning) ───────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  --c: var(--brand); --soft: var(--brand-soft);
  position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 14px 16px 14px 18px; color: var(--ink); display: block;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.kpi .k-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.kpi .k-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); color: var(--c); flex-shrink: 0; }
.kpi .k-dot .icon { width: 15px; height: 15px; }
.kpi .k-value { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--navy-2); margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi .k-value small { font-size: 14px; font-weight: 600; color: var(--ink-2); display: block; letter-spacing: 0; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .k-bar { height: 5px; border-radius: 5px; background: var(--soft); margin-top: 10px; overflow: hidden; }
.kpi .k-bar span { display: block; height: 100%; background: var(--c); border-radius: 5px; }
.kpi.sky    { --c: #0284c7; --soft: #e0f2fe; }
.kpi.green  { --c: #059669; --soft: #d1fae5; }
.kpi.red    { --c: #dc2626; --soft: #fee2e2; }
.kpi.amber  { --c: #d97706; --soft: #fef3c7; }
.kpi.violet { --c: #7c3aed; --soft: #ede9fe; }
.kpi.teal   { --c: #0d9488; --soft: #ccfbf1; }
.kpi.pink   { --c: #db2777; --soft: #fce7f3; }
.kpi.slate  { --c: #475569; --soft: #e2e8f0; }
a.kpi:hover { text-decoration: none; border-color: var(--c); color: var(--ink); }
a.kpi.active { border-color: var(--c); box-shadow: 0 0 0 2px var(--soft), var(--shadow); }

/* label with a small action on the right (e.g. "Customer   + New customer") */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.label-row label { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand); cursor: pointer; }
.link-btn:hover { color: var(--brand-hover); text-decoration: underline; }

/* ───────── Charts (single series, sky) ───────── */
.chart-card h2 { margin-bottom: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-list li { cursor: default; }
.bl-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.bl-label { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.bl-track { height: 10px; border-radius: 4px; background: var(--brand-softer); overflow: hidden; }
.bl-track span { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: background .15s; }
.bar-list li:hover .bl-track span { background: var(--navy); }
.bl-note { font-size: 12px; color: var(--muted); margin-top: 3px; }

.col-chart { position: relative; height: 220px; margin: 8px 0 22px 52px; }
.cc-grid { position: absolute; inset: 0; pointer-events: none; }
.cc-gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.cc-gridline span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.cc-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.cc-col:hover, .cc-col:focus-visible { background: rgba(2, 132, 199, .06); border-radius: 4px; }
.cc-bar { width: min(70%, 28px); background: var(--brand); border-radius: 4px 4px 0 0; }
.cc-col:hover .cc-bar, .cc-col:focus-visible .cc-bar { background: var(--navy); }
.cc-x { position: absolute; top: calc(100% + 5px); font-size: 11px; color: var(--muted); white-space: nowrap; }
.cc-tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 28px rgba(12, 74, 110, .18);
  padding: 8px 10px; font-size: 12px; white-space: nowrap; color: var(--ink);
}
.cc-col:hover .cc-tip, .cc-col:focus-visible .cc-tip { display: block; }
.cc-col:first-child .cc-tip, .cc-col:nth-child(2) .cc-tip { left: 0; transform: none; }
.cc-col:last-child .cc-tip, .cc-col:nth-last-child(2) .cc-tip { left: auto; right: 0; transform: none; }
.cc-tip b { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .col-chart { margin-left: 44px; } }

/* fixed column counts for dense forms (fall back to auto on small screens) */
@media (min-width: 1100px) {
  .form-grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* small edit panel opened from a table row */
.inline-edit { position: relative; }
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; text-align: left;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 14px;
  box-shadow: 0 16px 40px rgba(12, 74, 110, .18);
}

/* ───────── Category tree ───────── */
.cat-tree { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.cat-card { margin: 0; padding: 16px 18px; }
.cat-main { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cat-name { font-size: 16px; font-weight: 700; color: var(--navy-2); margin-right: 6px; }
.cat-subs { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.cat-subs li { display: flex; align-items: center; gap: 8px; padding: 3px 0 3px 12px; border-left: 2px solid var(--brand-soft); }
.cat-subs li > a { flex: 1; color: var(--ink); }
.cat-subs li > a:hover { color: var(--brand); }
.cat-subs .inline-edit summary { min-height: 26px; padding: 2px 9px; }
.is-off { opacity: .55; }


/* ════════ 2026 refresh ════════ */
:root { --r-sm: 10px; --r-md: 16px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(12, 74, 110, .05), 0 8px 24px -12px rgba(12, 74, 110, .14); }
body {
  background:
    radial-gradient(900px 420px at 85% -120px, rgba(56, 189, 248, .18), transparent 70%),
    radial-gradient(700px 360px at 10% -160px, rgba(245, 158, 11, .08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.card { border-color: rgba(203, 219, 230, .7); }
a.kpi, .kpi { transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(12, 74, 110, .35); }
.kpi { padding: 16px 18px 16px 20px; }
.kpi::before { width: 100%; height: 3px; inset: 0 0 auto 0; }
.kpi .k-dot { width: 32px; height: 32px; border-radius: 10px; }
.kpi .k-value { font-size: 23px; }

/* topbar with search */
.topbar { gap: 16px; padding: 12px 28px; background: rgba(255, 255, 255, .72); backdrop-filter: saturate(1.4) blur(12px); }
.top-search { flex: 1; max-width: 560px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.top-search svg { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.top-search input[type=search] {
  padding-left: 42px; padding-right: 44px; border-radius: 999px; background: rgba(240, 249, 255, .9);
  border-color: transparent; min-height: 42px;
}
.top-search input[type=search]:hover { border-color: var(--line-strong); }
.top-search input[type=search]:focus { background: #fff; border-color: var(--brand); }
.top-search kbd {
  position: absolute; right: 12px; font: 600 11px/1 "Onest", sans-serif; color: var(--muted);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 3px 7px; background: #fff;
}

/* sidebar: pill items */
.sidebar { background: linear-gradient(180deg, #0b4467 0%, #07304b 100%); }
.sidebar a { border-radius: 12px; }
.sidebar a.active { background: linear-gradient(90deg, rgba(125, 211, 252, .22), rgba(125, 211, 252, .06)); box-shadow: inset 2px 0 0 #7dd3fc; }
.sidebar .nav-cta { border-radius: 12px; box-shadow: 0 6px 18px -8px rgba(245, 158, 11, .8); }

/* tables: calmer header, clickable rows */
th { background: transparent; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-weight: 600; }
.card.flush > table thead th { background: rgba(240, 249, 255, .6); }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: #f0f8fe; }

/* buttons */
.btn { border-radius: 10px; }
.btn:not(.secondary):not(.danger):not(.sun):hover { box-shadow: 0 6px 16px -8px rgba(2, 132, 199, .7); }

/* page heading */
h1 { font-size: 26px; }
.page-head .muted { margin-top: 2px; }

/* alerts fade out */
.alert { border-radius: 12px; transition: opacity .4s, transform .4s; }
.alert.fade-out { opacity: 0; transform: translateY(-6px); }

/* search results */
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.search-results .card { margin: 0; }
.result-list { list-style: none; margin: 0; padding: 6px; }
.result-list a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; color: var(--ink); }
.result-list a:hover { background: var(--brand-softer); text-decoration: none; }
.empty-state { text-align: center; padding: 36px 20px; }

@media (max-width: 900px) {
  .top-search kbd { display: none; }
  .topbar { padding: 10px 14px; gap: 10px; }
}

/* phones: nothing wider than the screen */
.main { overflow-x: clip; }
@media (max-width: 900px) {
  .hide-phone { display: none; }
  .topbar .user-chip .avatar { display: none; }
  .top-search { min-width: 0; }
  .page-head { gap: 10px; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row > * { flex: 1 1 auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .k-value { font-size: 18px; }
  .grid { gap: 14px; }
  .card { margin-bottom: 14px; }
}
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  /* columns may shrink below their content (wide tables scroll inside their card instead) */
  .grid-2, .grid-3, .grid-4, .grid[style] { grid-template-columns: minmax(0, 1fr) !important; }
  .cat-tree, .search-results { grid-template-columns: minmax(0, 1fr); }
  .card.flush { max-width: 100%; }
  .filters > * { flex: 1 1 140px; }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
/* phones: each invoice line becomes a small card (product on top, qty / price / serial below) */
@media (max-width: 700px) {
  .items thead { display: none; }
  .items, .items tbody { display: block; }
  .items tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 44px; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
  .items td { padding: 0; border: 0; }
  .items td:first-child { grid-column: 1 / -1; }
  .items td[data-line-total] { grid-column: 1 / 3; text-align: left; padding-top: 4px !important; }
  .items td[data-line-total]::before { content: "Line total: "; font-weight: 400; color: var(--muted); }
  .items td:last-child { grid-column: 3; grid-row: 2; }
  .items td input[data-qty]::placeholder { color: var(--muted); }
  .label-row { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .items td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
  .items td:last-child { align-self: end; }
}


/* ════════ Phones & tablets ════════ */
.bottom-nav, .sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  /* 16px text in boxes: iPhone does not zoom in when you tap a field */
  input, select, textarea { font-size: 16px; }

  /* slide-out menu with a dark backdrop */
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; height: 100dvh; z-index: 60; width: min(290px, 84vw);
    transform: translateX(-105%); transition: transform .22s ease; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  body.menu-open .sidebar { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 53, 83, .45);
    opacity: 0; pointer-events: none; transition: opacity .22s; backdrop-filter: blur(2px); }
  body.menu-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .btn.menu-toggle { display: none; }          /* the bottom bar has the menu button */

  /* app-style bottom bar */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px -16px rgba(12, 74, 110, .35);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; justify-content: center;
    color: var(--muted); font: 600 11px/1.1 "Onest", sans-serif; background: none; border: 0; border-radius: 12px; cursor: pointer;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .bn-cta { color: var(--sun-ink); }
  .bottom-nav .bn-cta .icon { width: 26px; height: 26px; }
  .bottom-nav .bn-cta::before {
    content: ""; position: absolute; width: 54px; height: 54px; border-radius: 18px; background: var(--sun);
    transform: translateY(-14px); box-shadow: 0 8px 18px -6px rgba(245, 158, 11, .7); z-index: -1;
  }
  .bottom-nav .bn-cta { position: relative; z-index: 0; }
  .bottom-nav .bn-cta .icon { transform: translateY(-14px); }
  .bottom-nav .bn-cta span { transform: translateY(-4px); }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }

  /* popups & small edit panels fit the phone */
  .dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 18px; }
  .inline-edit-form { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); top: auto; width: auto; z-index: 70; }
  .combo-list { max-height: 45vh; }

  /* charts */
  .col-chart { height: 180px; margin-left: 40px; }
  .cc-tip { font-size: 11px; }
}

@media (max-width: 700px) {
  h1 { font-size: 22px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; border-radius: 14px; }
  .card.flush > h2 { padding: 14px 16px 2px; }

  /* tables as cards: one card per row, "label   value" lines */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td {
    display: block; padding: 3px 0; border: 0; text-align: right; min-height: 26px; overflow-wrap: anywhere;
  }
  table.stack td::before {
    content: attr(data-label); float: left; margin-right: 12px; color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left;
  }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before { content: none; }
  table.stack td:empty { display: none; }
  table.stack td:first-child { text-align: left; font-weight: 600; font-size: 15px; padding-bottom: 6px; }
  table.stack td:first-child::before { content: none; }
  table.stack td.full { text-align: left; }
  table.stack td.full::before { content: none; }
  table.stack td .btn, table.stack td form { display: inline-flex; }
  table.stack tfoot tr { background: var(--brand-softer); }
  table.stack tr[data-href]:active { background: var(--brand-softer); }
  .invoice-doc table.stack tbody tr:nth-child(even) td { background: transparent; }
  .invoice-doc table.stack tr { padding: 10px 0; }

  /* forms: one column where fields are wide */
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .form-grid.cols-3, .form-grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals { max-width: none; width: 100%; }
  .page-head > .btn, .page-head > a.btn { flex: 0 0 auto; }
  .pagination { justify-content: center; }
  .kpi .k-value small { font-size: 12.5px; }
}

@media (max-width: 380px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-6 { grid-template-columns: minmax(0, 1fr); }
}

/* installed as an app: a little more room at the top */
@media (display-mode: standalone) and (max-width: 900px) {
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}

/* cards: AFN and USD always side by side, same weight */
.kpi .k-money { display: grid; gap: 2px; margin-top: 8px; }
.kpi .k-cur { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.kpi .k-tag { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--c); background: var(--soft); border-radius: 6px; padding: 1px 6px; min-width: 38px; text-align: center; }
.kpi .k-amt { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--navy-2); line-height: 1.3; }
.kpi .k-cur.is-zero .k-amt { color: #9fb2c0; font-weight: 600; }
@media (max-width: 700px) { .kpi .k-amt { font-size: 17px; } }

.cur-pair { display: inline-block; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--brand-softer); border-radius: 6px; padding: 1px 7px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.chart-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* phone polish */
.filters-toggle { display: none; }
@media (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kpi { padding: 12px 12px 12px 14px; }
  .kpi .k-label { font-size: 12px; gap: 6px; }
  .kpi .k-dot { width: 26px; height: 26px; }
  .kpi .k-tag { min-width: 32px; font-size: 10px; padding: 1px 4px; }
  .kpi .k-amt { font-size: 16px; }
  .kpi .k-sub { font-size: 11px; }

  .filters-toggle { display: inline-flex; width: 100%; margin-bottom: 10px; }
  form.filters.foldable.folded > *:not(input[name=q]):not(.btn-row):not(div:has(> input[name=q])) { display: none; }
  form.filters.foldable.folded { margin-bottom: 12px; }

  /* invoice lines: product name is the title, row number hidden */
  .invoice-doc table.stack td:first-child { display: none; }
  .invoice-doc table.stack td:nth-child(2) { text-align: left; padding-bottom: 6px; }
  .invoice-doc table.stack td:nth-child(2)::before { content: none; }
  .inv-due strong { font-size: 18px; }
}
@media (max-width: 340px) { .kpis { grid-template-columns: minmax(0, 1fr) !important; } }

/* ════════ PowerTrade Pro Modern Dashboard UI ════════ */
:root {
  --font-main: "Plus Jakarta Sans", "Onest", system-ui, -apple-system, sans-serif;
  --bg-slate: #f1f5f9;
  --sidebar-dark: #0b1322;
  --sidebar-darker: #070d18;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: #2563eb;
  --border-light: #e2e8f0;
  --text-dark: #0f172a;
  --text-muted: #64748b;
}

body {
  font-family: var(--font-main);
  background: var(--bg-slate);
  color: var(--text-dark);
}

/* ──────── Sidebar Upgrade ──────── */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-dark) 0%, var(--sidebar-darker) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 16px 14px 20px;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 12px;
}
.sidebar .logo:hover { text-decoration: none; }
.sidebar .logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f59e0b;
  color: #1e1b4b;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}
.sidebar .logo-mark .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.logo-details { display: flex; flex-direction: column; }
.logo-title { font-size: 17px; font-weight: 800; color: #ffffff; letter-spacing: -0.02em; line-height: 1.2; }
.logo-tagline { font-size: 11px; color: #94a3b8; font-weight: 500; letter-spacing: 0.02em; }

.sidebar .group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
  padding: 18px 10px 6px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 13.5px;
  transition: all .15s ease;
  margin-bottom: 2px;
}
.sidebar a .icon { flex-shrink: 0; opacity: 0.8; }
.sidebar a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  text-decoration: none;
}
.sidebar a.active {
  background: var(--sidebar-active-bg) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}
.sidebar a.active .icon { opacity: 1; color: #ffffff; }

.sidebar-user-card {
  margin-top: auto;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f59e0b;
  color: #1e1b4b;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-user-meta { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-user-meta strong { color: #ffffff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.sidebar-user-meta span { color: #94a3b8; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ──────── Topbar Upgrade ──────── */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-search {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}
.top-search input[type=search] {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding-left: 42px;
  padding-right: 40px;
  font-size: 13.5px;
  color: var(--text-dark);
  transition: all .15s ease;
}
.top-search input[type=search]:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.top-search svg { position: absolute; left: 14px; color: #94a3b8; pointer-events: none; }
.top-search kbd {
  position: absolute;
  right: 12px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: #94a3b8;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  font-size: 12.5px;
  font-weight: 500;
  color: #475569;
}
.topbar-pill .icon { width: 15px; height: 15px; color: #64748b; }
.topbar-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #475569;
  transition: background .15s;
}
.topbar-icon-btn:hover { background: #f1f5f9; color: var(--text-dark); }
.topbar-icon-btn .icon { width: 17px; height: 17px; }
.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  cursor: pointer;
}
.user-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.user-chip .who { display: flex; flex-direction: column; text-align: left; }
.user-chip .who strong { font-size: 13px; color: var(--text-dark); line-height: 1.2; }
.user-chip .who span { font-size: 11px; color: var(--text-muted); }
.user-chip .icon { width: 14px; height: 14px; color: #94a3b8; }
.logout-form { margin: 0; }

/* ──────── Content & Page Head ──────── */
.content {
  padding: 24px 28px 48px;
  max-width: 1560px;
  margin: 0 auto;
}
.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-head h1 { font-size: 26px; font-weight: 800; color: var(--text-dark); }

/* ──────── Hero Welcome Banner ──────── */
.hero-banner {
  background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 55%, #ffffff 100%);
  border: 1px solid #bae6fd;
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 4px 20px -2px rgba(2, 132, 199, 0.08);
  overflow: hidden;
}
.hero-left { flex: 1; min-width: 0; }
.hero-welcome h2 { font-size: 24px; font-weight: 800; color: var(--text-dark); margin: 0 0 4px; letter-spacing: -0.02em; }
.hero-welcome p { font-size: 14px; color: var(--text-muted); margin: 0 0 18px; }
.hero-categories { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.hero-cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}
.hero-cat-img-wrap {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.hero-cat-img { width: 100%; height: 100%; object-fit: contain; }
.hero-cat-info { display: flex; flex-direction: column; }
.hero-cat-info strong { font-size: 13px; font-weight: 700; color: var(--text-dark); line-height: 1.2; }
.hero-cat-info span { font-size: 11px; color: var(--text-muted); }

.hero-right { flex-shrink: 0; width: 440px; }
.hero-banner-visual {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  height: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 2px solid #ffffff;
}
.hero-banner-img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-quote-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.85) 100%);
  padding: 16px 14px 10px;
  color: #ffffff;
  font-size: 12.5px;
  font-style: italic;
  font-weight: 600;
  text-align: right;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ──────── 6 KPI Metric Cards ──────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform .15s ease, box-shadow .15s ease;
  text-decoration: none;
  color: inherit;
  min-height: 130px;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
}
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kpi-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.kpi-icon-box .icon { width: 18px; height: 18px; }
.bg-blue   { background: #e0f2fe; color: #0284c7; }
.bg-green  { background: #dcfce7; color: #16a34a; }
.bg-orange { background: #ffedd5; color: #ea580c; }
.bg-purple { background: #f3e8ff; color: #9333ea; }
.bg-cyan   { background: #e0f2fe; color: #0284c7; }
.bg-red    { background: #fee2e2; color: #dc2626; }

.kpi-title { font-size: 12px; font-weight: 600; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-money-wrap { margin-bottom: 8px; flex: 1; }
.kpi-money-wrap .k-money { display: flex; flex-direction: column; gap: 2px; }
.kpi-money-wrap .k-cur { display: flex; align-items: baseline; gap: 6px; }
.kpi-money-wrap .k-tag { font-size: 10px; font-weight: 700; color: #0284c7; background: #e0f2fe; border-radius: 4px; padding: 1px 5px; }
.kpi-money-wrap .k-amt { font-size: 17px; font-weight: 800; color: var(--text-dark); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-single-value { font-size: 15px; font-weight: 800; color: var(--text-dark); font-variant-numeric: tabular-nums; line-height: 1.3; }
.kpi-alert-value { font-size: 24px; font-weight: 800; color: #dc2626; line-height: 1.2; }
.kpi-sub-text { font-size: 11px; color: #64748b; margin-top: 2px; }
.kpi-trend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.kpi-trend .icon { width: 14px; height: 14px; }
.trend-green { color: #16a34a; }
.trend-red { color: #dc2626; }

/* ──────── Middle Grid: Trend, Donut, Actions ──────── */
.middle-grid {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.chart-box, .donut-box, .actions-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin: 0;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}
.chart-header h3 { font-size: 16px; font-weight: 700; color: var(--text-dark); margin: 0 0 2px; }
.chart-actions { display: flex; align-items: center; gap: 14px; }
.chart-legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: #64748b; font-weight: 500; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-blue { background: #0284c7; }
.dot-orange { background: #f97316; }
.chart-period-badge {
  font-size: 12px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px 10px;
  font-weight: 600;
}

.trend-chart-container {
  display: flex;
  gap: 12px;
  height: 180px;
  position: relative;
}
.trend-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  text-align: right;
  width: 44px;
  padding-bottom: 10px;
}
.trend-chart-body { flex: 1; height: 100%; position: relative; }
.trend-svg { width: 100%; height: 100%; overflow: visible; }
.trend-x-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  margin-left: 56px;
  margin-top: 8px;
}

/* Donut Chart */
.donut-content { display: flex; flex-direction: column; gap: 16px; }
.donut-chart-wrap { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.donut-svg { width: 100%; height: 100%; }
.donut-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-currency { font-size: 11px; font-weight: 700; color: #64748b; }
.donut-center-text strong { font-size: 15px; font-weight: 800; color: var(--text-dark); line-height: 1.1; font-variant-numeric: tabular-nums; }
.donut-sub { font-size: 10.5px; color: #94a3b8; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.legend-name { display: flex; align-items: center; gap: 8px; }
.legend-thumb { width: 22px; height: 22px; border-radius: 4px; object-fit: contain; background: #f8fafc; }
.legend-vals { display: flex; align-items: center; gap: 10px; }
.legend-pct { font-weight: 700; color: var(--text-dark); }
.legend-amt { color: #64748b; font-size: 11px; font-variant-numeric: tabular-nums; }

/* Quick Actions */
.quick-actions-list { display: flex; flex-direction: column; gap: 10px; }
.action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13.5px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.action-btn:hover { transform: translateY(-2px); text-decoration: none; color: #ffffff; }
.action-btn .action-icon { display: grid; place-items: center; }
.action-btn .action-icon .icon { width: 18px; height: 18px; }
.action-btn .action-text { flex: 1; margin-left: 12px; text-align: left; }
.action-btn .action-arrow .icon { width: 16px; height: 16px; }
.btn-orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35); }
.btn-blue   { background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35); }
.btn-green  { background: linear-gradient(135deg, #10b981 0%, #059669 100%); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35); }
.btn-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35); }

/* ──────── Bottom Grid: Tables ──────── */
.bottom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.panel-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin: 0;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.panel-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-link { font-size: 12.5px; font-weight: 600; color: #0284c7; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.modern-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modern-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
}
.modern-table td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.modern-table tr:last-child td { border-bottom: 0; }
.branch-bar-cell { display: flex; align-items: center; gap: 10px; }
.branch-bar-track { flex: 1; height: 8px; border-radius: 4px; background: #e0f2fe; overflow: hidden; }
.branch-bar-fill { display: block; height: 100%; background: #0284c7; border-radius: 4px; }
.branch-bar-val { font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.growth-badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; color: #16a34a; }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: contain; background: #f8fafc; border: 1px solid var(--border-light); flex-shrink: 0; }
.cat-pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.pill-tire    { background: #e0f2fe; color: #0284c7; }
.pill-battery { background: #fef3c7; color: #d97706; }
.pill-solar   { background: #ccfbf1; color: #0f766e; }

/* Rate Utility Card */
.rate-utility-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 12px 20px;
  margin-bottom: 20px;
}
.rate-utility-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.rate-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rate-tag { font-size: 11px; font-weight: 700; background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ──────── Responsive Breakpoints ──────── */
@media (max-width: 1280px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .middle-grid { grid-template-columns: 1fr 1fr; }
  .actions-box { grid-column: span 2; }
  .bottom-grid { grid-template-columns: 1fr; }
  .hero-right { width: 340px; }
}

@media (max-width: 900px) {
  .hero-banner { flex-direction: column; align-items: stretch; }
  .hero-right { width: 100%; }
  .hero-banner-visual { height: 180px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .middle-grid { grid-template-columns: 1fr; }
  .actions-box { grid-column: span 1; }
  .topbar-actions .topbar-pill { display: none; }
}

@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr; }
  .hero-categories { flex-direction: column; }
}

/* ───────── Needs attention today ───────── */
.attention { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 20px; }
.attention-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.attention-head h2 { margin: 0; font-size: 18px; }
.attention-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.attention-item { --c: var(--brand); --soft: var(--brand-soft); display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px; color: var(--ink); background: #fff; }
.attention-item:hover { text-decoration: none; background: var(--soft); color: var(--ink); }
.attention-item .icon { margin-left: auto; color: var(--muted); }
.attention-count { min-width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--c); font-weight: 800; font-size: 17px; }
.attention-text { display: flex; flex-direction: column; line-height: 1.3; }
.attention-text span { font-size: 12px; color: var(--muted); }
.attention-item.tone-red { --c: #dc2626; --soft: #fee2e2; }
.attention-item.tone-amber { --c: #d97706; --soft: #fef3c7; }
.attention-item.tone-sky { --c: #0284c7; --soft: #e0f2fe; }
.attention-ok { display: flex; align-items: center; gap: 10px; color: var(--ok); font-weight: 500; }
/* bell */
.bell-menu { position: relative; }
.bell-menu summary { list-style: none; }
.bell-menu summary::-webkit-details-marker { display: none; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; z-index: 30; background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: 0 16px 40px rgba(12, 74, 110, .18); padding: 8px; }
.bell-panel a { display: block; padding: 9px 10px; border-radius: 10px; color: var(--ink); }
.bell-panel a:hover { background: var(--brand-softer); text-decoration: none; }
.bell-panel a span { display: block; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }

.bottom-grid.bottom-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .bottom-grid.bottom-grid-2 { grid-template-columns: minmax(0, 1fr); } }
.kpi-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* phones: dashboard cards two per row, roomy search */
@media (max-width: 700px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .kpi-card { padding: 12px !important; }
  .kpi-card .kpi-trend, .kpi-card .kpi-sub-text { font-size: 11px; }
  .kpi-card .k-amt, .kpi-single-value, .kpi-alert-value { font-size: 16px !important; }
  .topbar .user-chip { display: none !important; }
  .top-search { flex: 1 1 auto; }
  .attention { padding: 14px; }
}
@media (max-width: 340px) { .kpi-row { grid-template-columns: minmax(0, 1fr) !important; } }

/* ───────── Category icons ───────── */
.cat-icon { --c: #475569; --soft: #e2e8f0; display: inline-grid; place-items: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 8px; background: var(--soft); color: var(--c); vertical-align: middle; }
.cat-icon .icon { width: 16px; height: 16px; }
.cat-icon.md { width: 34px; height: 34px; border-radius: 10px; }
.cat-icon.md .icon { width: 20px; height: 20px; }
.cat-icon.lg { width: 44px; height: 44px; border-radius: 12px; }
.cat-icon.lg .icon { width: 26px; height: 26px; }
.cat-icon.c-slate { --c: #334155; --soft: #e2e8f0; }
.cat-icon.c-amber { --c: #b45309; --soft: #fef3c7; }
.cat-icon.c-sky { --c: #0369a1; --soft: #e0f2fe; }
.cat-icon.c-teal { --c: #0f766e; --soft: #ccfbf1; }
.cat-icon.c-cyan { --c: #0e7490; --soft: #cffafe; }
.cat-icon.c-violet { --c: #6d28d9; --soft: #ede9fe; }
.cat-icon.c-green { --c: #047857; --soft: #d1fae5; }
.cat-icon.c-pink { --c: #be185d; --soft: #fce7f3; }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }
.cat-main .cat-name { display: inline-flex; align-items: center; gap: 10px; }

/* ───────── Profile pictures ───────── */
img.avatar-img { object-fit: cover; display: block; padding: 0; background: #e2e8f0; }
a.user-chip { text-decoration: none; }
a.user-chip:hover { border-color: #7dd3fc; }
.avatar.avatar-xl { width: 88px; height: 88px; font-size: 28px; flex-shrink: 0; }
.profile-photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.user-name-cell { display: inline-flex; align-items: center; gap: 10px; }
.user-name-cell .avatar { width: 30px; height: 30px; font-size: 11px; flex-shrink: 0; }
.backup-restore { border-left: 4px solid var(--danger); }

/* ───────── Hide / show sidebar (computers) ───────── */
.sidebar-toggle { flex-shrink: 0; }
@media (min-width: 901px) {
  .sidebar { transition: margin-left .22s ease; }
  body.sidebar-hidden .sidebar { margin-left: -244px; visibility: hidden; transition: margin-left .22s ease, visibility 0s .22s; }
  body.sidebar-hidden .sidebar-toggle { background: var(--brand-soft, #e0f2fe); color: #0369a1; border-color: #7dd3fc; }
}
@media (max-width: 900px) { .sidebar-toggle { display: none; } }   /* phones use the Menu button */

/* money coming in (cash box history) */
.money-in { color: var(--ok); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* paid more than the bill */
input.input-warn { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(194, 38, 29, .12); }
[data-out="overpaid"]:not(:empty) { color: var(--danger); font-size: 12.5px; font-weight: 600; margin-top: 4px; }
[data-out="overpaid"].is-change:not(:empty) { color: var(--ok); }

/* stock count on the right of each product in the list */
.combo-list li { display: flex; justify-content: space-between; gap: 12px; }
.combo-badge { flex-shrink: 0; font-size: 12px; font-weight: 600; color: #0369a1; background: #e0f2fe; border-radius: 999px; padding: 1px 8px; align-self: center; }
.combo-badge.warn { color: var(--danger); background: #fde8e7; }

/* change the dollar rate from the dashboard card */
.rate-edit { margin-top: 8px; }
.rate-edit summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #0369a1; }
.rate-edit summary::-webkit-details-marker { display: none; }
.rate-edit summary .icon { width: 14px; height: 14px; }
.rate-edit-panel { margin-top: 8px; display: grid; gap: 8px; }
.rate-edit-row { display: flex; gap: 6px; }
.rate-edit-row input { flex: 1; min-width: 0; min-height: 34px; padding: 4px 10px; }
/* product rows: the search list must be able to hang over the next section */
.card.flush.items-card { overflow: visible; position: relative; z-index: 5; }
.items-card .combo-list { max-height: 340px; }

/* ───────── Stylish Luxury Live Clock Widget ───────── */
.stylish-clock-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid rgba(2, 132, 199, 0.22);
  border-radius: 14px;
  padding: 8px 16px;
  box-shadow: 0 4px 18px -4px rgba(2, 132, 199, 0.12), 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: all .2s ease;
}
.stylish-clock-card:hover {
  transform: translateY(-2px);
  border-color: #0284c7;
  box-shadow: 0 8px 24px -4px rgba(2, 132, 199, 0.22);
}
.clock-dial-wrap {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.clock-analog-svg {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 2px 5px rgba(2, 132, 199, 0.18));
}
#analogHourHand, #analogMinHand, #analogSecHand {
  transform-origin: 50px 50px;
  transition: transform 0.08s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}
.clock-digital-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.clock-time-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock-digit {
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.clock-colon {
  font-size: 19px;
  font-weight: 800;
  color: #0284c7;
  margin: 0 1px;
  animation: colonPulse 1s infinite;
}
@keyframes colonPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.9); }
}
.clock-seconds {
  font-size: 16px;
  color: #0284c7;
  font-weight: 700;
}
.clock-ampm {
  font-size: 10px;
  font-weight: 800;
  color: #d97706;
  background: #fef3c7;
  border-radius: 4px;
  padding: 2px 5px;
  margin-left: 6px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.clock-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
}
.clock-date {
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}
.clock-zone-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.clock-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseLiveGreen 2s infinite;
}
@keyframes pulseLiveGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 900px) {
  .dashboard-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .stylish-clock-card { align-self: flex-start; }
}
/* the rate panel opens as a small pop-up over the cards, not squeezed inside the card */
.kpi-card:has(.rate-edit) { overflow: visible; z-index: 4; }
.rate-edit { position: relative; }
.rate-edit[open] .rate-edit-panel { position: absolute; left: 0; top: calc(100% + 6px); width: 270px; z-index: 30; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 16px 40px rgba(12, 74, 110, .18); }

/* "Print receipt" inside the green message after a payment */
.alert.success { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.alert .alert-btn { background: #067647; border-color: #067647; color: #fff; }

/* stock: pick one location */
.location-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.location-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  color: var(--ink-2, #334155); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.location-tabs a span { font-size: 11.5px; background: #e0f2fe; color: #0369a1; border-radius: 999px; padding: 1px 8px; }
.location-tabs a:hover { border-color: #7dd3fc; }
.location-tabs a.active { background: #0369a1; border-color: #0369a1; color: #fff; }
.location-tabs a.active span { background: rgba(255, 255, 255, .2); color: #fff; }
.filters label.check { display: inline-flex; align-items: center; gap: 8px; width: auto; flex: 0 0 auto; white-space: nowrap; }
.filters label.check input { width: auto; min-height: 0; }

.link-btn { background: none; border: 0; padding: 4px 0 0; color: #0369a1; font-weight: 600; font-size: 12.5px; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.stock-hint .zero-price { color: var(--danger); font-weight: 600; }

/* ───────── Alignment pass ───────── */
/* coloured top edge drawn inside the card, so rounded corners stay clean */
.card.stat { border-top: 1px solid var(--line); position: relative; overflow: hidden; padding-top: 20px; }
.card.stat::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand); }
.card.stat .value { font-size: 24px; }

/* every control in a filter row has the same height and sits on one line */
.filters { align-items: center; }
.filters input, .filters select, .filters .btn, .filters .combo-input { min-height: 40px; height: 40px; box-sizing: border-box; }
.filters .btn.small { padding: 0 14px; font-size: 13px; }
.filters h2 { margin: 0 6px 0 0; }
.filters label.check { height: 40px; }

/* ───────── UI pass 1 ───────── */
/* coloured accent as a short tab, clear of the rounded corners (no bent line) */
.kpi::before, .card.stat::before { left: 18px; right: auto; width: 40px; height: 3px; top: 0; bottom: auto; inset: 0 auto auto 18px; border-radius: 0 0 3px 3px; }

/* dates and numbers never break over lines */
td.nowrap, th.nowrap, .table-dates td:first-child { white-space: nowrap; }
.movements-table td:nth-child(3), .movements-table td:nth-child(4) { white-space: nowrap; }

/* report presets on one row */
.filters .btn-row { flex-wrap: wrap; gap: 6px; }
.filters .btn-row .btn.small { height: 40px; }

@media (max-width: 900px) {
  /* room for the bottom bar: nothing hides behind it */
  .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)) !important; }
  .filters .btn-row { width: 100%; }
  .filters .btn-row .btn.small { flex: 1 1 auto; height: 36px; }
}
.btn.icon-only { padding: 0 8px; min-width: 32px; justify-content: center; }
.btn.icon-only .icon { margin: 0; }
.filters .btn-row { display: flex; flex-direction: row; }
@media (max-width: 900px) { .filters .btn-row .btn.small { flex: 1 1 30%; } }
@media (max-width: 900px) { .filters > .btn-row { flex: 1 1 100%; } }

/* the invoice document shown on its page */
.invoice-frame { display: block; width: 100%; max-width: 860px; min-height: 700px; margin: 0 auto 22px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; box-shadow: var(--shadow); }

/* ───────── Branch switcher (admin) ───────── */
.branch-menu { position: relative; }
.branch-menu summary { list-style: none; cursor: pointer; }
.branch-menu summary::-webkit-details-marker { display: none; }
.branch-menu summary .icon:last-child { width: 14px; height: 14px; opacity: .6; }
.topbar-pill.is-filtered { background: #fff7e0; border-color: #f5c451; color: #7a4b00; font-weight: 700; }
.branch-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(12, 74, 110, .18); padding: 6px; z-index: 40; }
.branch-panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 10px 4px; font-weight: 700; }
.branch-panel a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.branch-panel a span { font-size: 11px; font-weight: 500; color: var(--muted); }
.branch-panel a:hover { background: var(--brand-soft); }
.branch-panel a.active { background: #0369a1; color: #fff; }
.branch-panel a.active span { color: rgba(255, 255, 255, .75); }
.viewing-branch { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff7e0; border: 1px solid #f5c451; color: #7a4b00;
  border-radius: 12px; padding: 9px 14px; margin-bottom: 14px; font-size: 13.5px; }
.viewing-branch a { font-weight: 700; color: #7a4b00; text-decoration: underline; }
@media (max-width: 900px) { .branch-menu .topbar-pill span { display: none; } .branch-panel { right: -60px; } }

/* ───────── Reports page ───────── */
.filters { align-items: flex-end; }                               /* fields with a label above line up with the buttons */
.filters > div > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; margin-bottom: 18px; }
.report-grid > .card { margin: 0; height: 100%; }
@media (max-width: 900px) { .report-grid { grid-template-columns: 1fr; } }
.compare-table td, .compare-table th { white-space: nowrap; }
.compare-table .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ───────── Company logo ───────── */
/* the logo is a round badge: nothing behind it */
.logo-mark.logo-img, .sidebar .logo-mark.logo-img { background: none; width: 46px; height: 46px; border-radius: 50%; padding: 0; box-shadow: none; border: 0; display: grid; place-items: center; overflow: hidden; }
.logo-mark.logo-img img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* tick boxes inside filter rows: normal size, text right beside them */
.filters input[type=checkbox], .filters input[type=radio] { width: 18px; height: 18px; min-width: 0; min-height: 0; flex: 0 0 auto; margin: 0; accent-color: #0369a1; }
.filters label.check { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; flex: 0 0 auto; width: auto; }
.filters label.check:has(input:checked) { border-color: #7dd3fc; background: #e0f2fe; color: #075985; font-weight: 600; }
