/* App shell + auth + page-specific styles */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar .brand { padding: 4px 10px 14px; }
.nav-group { display: grid; gap: 2px; }
.nav-title { padding: 14px 12px 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.nav-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; }
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav-link .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; }
.plan-card { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); display: grid; gap: 8px; font-size: 13px; }
.plan-card strong { font-size: 14px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .search { width: min(380px, 100%); }
.topbar .select { width: auto; max-width: 200px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.page { padding: 28px; display: grid; gap: 22px; max-width: 1380px; width: 100%; margin: 0 auto; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { color: var(--ink-3); margin-top: 6px; max-width: 62ch; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 18px; font-weight: 600; font-size: 14px; background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--brand-soft); color: var(--brand); }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner a, .banner button { margin-left: auto; font-weight: 700; color: inherit; text-decoration: underline; background: none; border: 0; cursor: pointer; }
.user-menu { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 750; font-family: var(--font-display); border: 0; cursor: pointer; }
.menu { position: absolute; right: 0; top: 44px; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; z-index: 40; animation: pop .16s var(--ease); }
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who small { color: var(--ink-3); display: block; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--ink-2); text-align: left; }
.menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu svg { width: 17px; height: 17px; }

/* filters bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; }
.filters .input, .filters .select { width: auto; min-width: 140px; }
.filters .search { flex: 1 1 220px; }
.filters .search .input { width: 100%; }

/* charts */
.chart-box { position: relative; height: 280px; padding: 8px 20px 20px; }
.chart-box.sm { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 20px 14px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-list { display: grid; gap: 12px; padding: 16px 20px 20px; }
.bar-row { display: grid; gap: 6px; font-size: 14px; }
.bar-row .top { display: flex; justify-content: space-between; gap: 12px; }
.bar-row .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .6s var(--ease); }

/* heat strip by hour */
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; padding: 0 20px 6px; }
.heat i { height: 38px; border-radius: 3px; background: var(--brand); }
.heat-axis { display: flex; justify-content: space-between; padding: 0 20px 18px; font-size: 12px; color: var(--ink-3); }

/* receipt inbox */
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.receipt-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.receipt-card .thumb { height: 150px; background: var(--surface-2) center / cover no-repeat; position: relative; cursor: zoom-in; }
.receipt-card .thumb .badge { position: absolute; left: 10px; top: 10px; background: var(--surface); }
.receipt-card .body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.receipt-card .amount { font-family: var(--font-display); font-size: 24px; font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* evidence */
.evidence { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.evidence .side { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); display: grid; gap: 6px; font-size: 14px; align-content: start; }
.evidence .side h5 { margin: 0; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.evidence .eq { align-self: center; display: grid; justify-items: center; gap: 6px; font-weight: 700; }
.score { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.score::after { content: attr(data-v); position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.signals { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest { display: grid; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.suggest:last-child { border-bottom: 0; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 30px; text-align: center; color: var(--ink-3); display: grid; gap: 8px; justify-items: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone svg { width: 32px; height: 32px; }
.timeline { display: grid; gap: 0; }
.timeline > div { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline > div::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 5px; }
.timeline > div::after { content: ""; position: absolute; left: 4px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline > div:last-child::after { display: none; }

/* pos / cash */
.pos { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.method-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.method-picker label { display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border: 1.5px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-weight: 650; font-size: 13.5px; color: var(--ink-2); }
.method-picker label svg { width: 22px; height: 22px; }
.method-picker input { position: absolute; opacity: 0; pointer-events: none; }
.method-picker label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.method-picker label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.amount-input { font-family: var(--font-display); font-size: 40px; font-weight: 650; height: 72px; text-align: right; letter-spacing: -.02em; }

/* pricing/plan picker */
.plan-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan-pick label { padding: 16px; border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; display: grid; gap: 4px; }
.plan-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.plan-pick input { position: absolute; opacity: 0; }
.plan-pick .price { font-family: var(--font-display); font-size: 24px; font-weight: 700; }

.qr-box { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.qr-box img { width: 150px; height: 150px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.wa-qr { display: grid; justify-items: center; gap: 12px; padding: 18px; }
.wa-qr img { width: 260px; height: 260px; background: #fff; padding: 10px; border-radius: 12px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: ping 1.8s infinite; display: inline-block; }
@keyframes ping { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 70; translate: -105% 0; transition: translate .25s var(--ease); box-shadow: var(--shadow-2); }
  .sidebar.open { translate: 0 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .topbar .search { display: none; }
  .page { padding: 18px 14px 40px; }
  .pos, .evidence { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 26px; }
}

/* ---- auth screen --------------------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100dvh; }
.auth-form-side { display: grid; grid-template-rows: auto 1fr auto; padding: 28px clamp(24px, 6vw, 80px); gap: 24px; background: var(--bg); }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-box { width: min(420px, 100%); margin: auto 0; display: grid; gap: 22px; align-content: center; }
.auth-box h1 { font-size: clamp(32px, 4vw, 42px); }
.auth-box > p { color: var(--ink-2); }
.auth-alt { color: var(--ink-3); font-size: 14px; }
.auth-foot { font-size: 13px; color: var(--ink-3); }
.pw-row { position: relative; }
.pw-row button { position: absolute; right: 4px; top: 4px; height: 32px; }

.auth-art { position: relative; overflow: hidden; background: #08303a; color: #e9fbff; isolation: isolate; }
.auth-art::before { content: ""; position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(900px 600px at 85% -10%, #0e7f90 0%, transparent 60%), radial-gradient(700px 500px at 0% 100%, #5a123b 0%, transparent 60%), #08303a; }
.auth-art::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .07;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 44px 44px; }
.art-copy { position: absolute; left: clamp(28px, 5vw, 64px); right: clamp(28px, 5vw, 64px); bottom: clamp(28px, 6vh, 56px); display: grid; gap: 10px; z-index: 3; }
.art-copy h2 { font-size: clamp(26px, 3vw, 38px); max-width: 16ch; color: #fff; }
.art-copy p { color: #b6d9e0; max-width: 40ch; }
.stream { position: absolute; inset: 0; z-index: 1; }
.tk { position: absolute; width: min(300px, 62%); color: #0e1b2c; background: #fff; padding: 16px 18px 24px; border-radius: 12px 12px 0 0; font-size: 13px; box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .45);
  --notch: 6px; animation: drift 14s linear infinite; opacity: 0; }
.tk .r1 { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.tk .r1 b { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; }
.tk small { color: #5c6e83; display: block; }
.tk .stamp { position: absolute; right: 14px; bottom: 30px; padding: 3px 10px; border: 2px solid #11785a; color: #11785a; border-radius: 6px; font-weight: 800; font-size: 12px; rotate: -8deg; opacity: 0; animation: stamp 14s linear infinite; }
@keyframes drift { 0% { transform: translateY(110vh) rotate(var(--rot)); opacity: 0; } 8% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translateY(-40vh) rotate(var(--rot)); opacity: 0; } }
@keyframes stamp { 0%, 38% { opacity: 0; scale: 1.8; } 44%, 100% { opacity: 1; scale: 1; } }
.qr-deco { position: absolute; top: 9%; right: 8%; width: 120px; opacity: .9; z-index: 2; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
@media (prefers-reduced-motion: reduce) { .tk { animation: none; opacity: 1; transform: none; position: relative; margin: 10px; } .tk .stamp { animation: none; opacity: 1; } }

@media print {
  .sidebar, .topbar, .page-head .row, .filters, #banner, .toasts { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; }
  .page { padding: 0; max-width: none; }
}
.auth-art .scrim { position: absolute; inset: auto 0 0 0; height: 55%; z-index: 2; background: linear-gradient(to top, #08303a 12%, rgba(8, 48, 58, .85) 40%, transparent); pointer-events: none; }

/* ---- mobile refinements ---- */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(8, 17, 28, .45); }
  .topbar .select { max-width: 150px; }
  .filters { padding: 12px; } .filters .input, .filters .select { flex: 1 1 140px; min-width: 0; }
  .card-head { padding: 14px 16px 0; } .card-pad { padding: 16px; }
  .table th, .table td { padding: 10px 12px; }
  .drawer { width: 100%; }
  .modal { border-radius: 14px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .wa-qr img { width: min(260px, 100%); height: auto; aspect-ratio: 1; }
  .kpi .k-value { font-size: 26px; }
  .amount-input { font-size: 32px; height: 60px; }
}
@media (max-width: 760px) and (min-width: 420px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .auth-form-side { padding: 20px 20px; } .auth-top { gap: 8px; }
  .page-head .row, .page-head .row .btn { width: 100%; } .page-head .row .btn { justify-content: center; }
  .receipt-grid { grid-template-columns: 1fr; }
  .evidence .eq { grid-auto-flow: column; justify-content: center; }
}
