
/* Draft recovery status and independent navigation scrolling */
.sidebar{height:100vh;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#486255 transparent}
.sidebar::-webkit-scrollbar{width:7px}.sidebar::-webkit-scrollbar-thumb{background:#486255;border-radius:8px}.sidebar::-webkit-scrollbar-track{background:transparent}
.draft-indicator{display:flex;align-items:center;gap:8px;margin-left:auto;color:var(--muted);font-size:10px;font-weight:500;white-space:nowrap}.draft-indicator [data-draft-status]{min-width:84px}.draft-indicator [data-draft-status].error{color:var(--red)}.draft-indicator button{border:0;background:transparent;color:var(--green);font-size:10px;padding:4px 0}.draft-indicator button:hover{text-decoration:underline}
@media(max-width:570px){.draft-indicator{width:100%;margin:2px 0 0;justify-content:space-between}.modal-head{flex-wrap:wrap}}

/* WantokBiz core UI: quiet operations console */
:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --line: #dfe8e2;
  --line-strong: #c9d8cf;
  --ink: #16221c;
  --muted: #6b7c72;
  --muted-2: #95a39b;
  --sidebar: #1d2924;
  --sidebar-2: #26352e;
  --sidebar-text: #e7eee9;
  --green: #1d8b5b;
  --green-dark: #126a43;
  --green-soft: #e4f3eb;
  --amber: #b7791f;
  --amber-soft: #fff4da;
  --red: #bd4b4b;
  --red-soft: #fdeaea;
  --blue: #3978a9;
  --blue-soft: #e8f2fb;
  --shadow: 0 10px 30px rgba(24, 47, 34, .07);
  --shadow-lg: 0 18px 60px rgba(24, 47, 34, .16);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--green-dark); }
:focus-visible { outline: 3px solid rgba(29, 139, 91, .35); outline-offset: 2px; }

.skip-link { position: fixed; left: 12px; top: 10px; z-index: 200; transform: translateY(-150%); padding: 9px 12px; color: #fff; background: var(--green-dark); border-radius: 8px; transition: transform .16s ease; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-frame { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: 252px; padding: 24px 14px 16px; color: var(--sidebar-text); background: var(--sidebar); }
.brand-lockup, .auth-brand { display: flex; align-items: center; gap: 10px; }
.brand-lockup { padding: 0 12px 26px; }
.brand-lockup strong, .auth-brand strong { display: block; letter-spacing: -.03em; font-size: 16px; }
.brand-lockup small, .auth-brand small { display: block; margin-top: 1px; color: #9fb2a6; font-size: 10px; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; align-items: center; width: 34px; height: 34px; padding: 5px; color: #fff; background: var(--green); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-mark span { display: block; font-weight: 800; line-height: 1; text-align: center; font-size: 13px; }
.brand-mark span:first-child { transform: translateY(-2px); }
.brand-mark span:last-child { transform: translateY(2px); color: #b9ebcf; }
.sidebar-label { padding: 14px 12px 7px; color: #84988b; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-list { display: grid; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 11px; color: #b8c9bf; background: transparent; border: 1px solid transparent; border-radius: 9px; text-align: left; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(54, 177, 113, .17); border-color: rgba(117, 221, 164, .13); }
.nav-icon { display: inline-grid; place-items: center; flex: none; width: 18px; color: #89b59b; font-size: 15px; }
.nav-item.active .nav-icon { color: #73d39d; }
.module-subnav { display: grid; gap: 2px; margin: 1px 0 6px 38px; }
.module-subnav button { padding: 4px 7px; color: #92a79a; background: transparent; border: 0; border-radius: 5px; text-align: left; font-size: 11px; }
.module-subnav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-footer { margin-top: auto; padding: 14px 2px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-business { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 9px; color: #dce8df; background: transparent; border: 0; border-radius: 9px; text-align: left; }
.sidebar-business:hover { background: rgba(255,255,255,.07); }
.sidebar-business > span:nth-child(2) { min-width: 0; flex: 1; }
.sidebar-business b, .sidebar-business small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-business b { font-size: 11px; }
.sidebar-business small { margin-top: 2px; color: #91a498; font-size: 10px; }
.chevron { color: #8ea598; font-size: 18px; line-height: 1; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; font-size: 10px; font-weight: 800; }
.avatar-green { color: #d8f8e5; background: rgba(50, 170, 108, .25); }
.avatar-dark { color: #d3e8da; background: var(--sidebar-2); }
.workspace { min-width: 0; width: calc(100% - 252px); margin-left: 252px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; min-height: 72px; padding: 0 34px; background: rgba(244,247,245,.94); border-bottom: 1px solid rgba(223,232,226,.85); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--muted-2); font-size: 12px; }
.breadcrumb b { color: #b2c0b7; font-weight: 400; }
.breadcrumb strong { color: var(--ink); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top-search { display: flex; align-items: center; gap: 8px; min-width: 190px; padding: 8px 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; text-align: left; font-size: 12px; }
.top-search span:first-child { color: var(--green); font-size: 17px; }
.top-search kbd { margin-left: auto; padding: 2px 5px; color: var(--muted-2); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 4px; font-size: 10px; }
.icon-button, .mobile-menu { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; }
.icon-button:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.notification-button { position: relative; font-size: 18px; }
.notification-button i { position: absolute; top: 7px; right: 7px; width: 5px; height: 5px; background: var(--green); border: 1px solid var(--bg); border-radius: 50%; }
.top-profile { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 4px; color: var(--ink); background: transparent; border: 0; text-align: left; }
.profile-copy b, .profile-copy small { display: block; }
.profile-copy b { font-size: 11px; }
.profile-copy small { color: var(--muted); font-size: 10px; }
.mobile-menu { display: none; }
.main-content { width: min(1320px, 100%); margin: 0 auto; padding: 32px 34px 64px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { margin: 3px 0 6px; letter-spacing: -.045em; font-size: clamp(25px, 3vw, 34px); line-height: 1.08; }
.page-head p, .panel-head p { max-width: 700px; margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--green-dark); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-actions, .toolbar-left, .toolbar-right, .adm-head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 12px; font-weight: 700; transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease; }
.button:hover { border-color: #9fb9aa; background: #fbfdfc; box-shadow: 0 4px 12px rgba(29,60,43,.07); transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green); border-color: var(--green); }
.button-primary:hover { color: #fff; background: var(--green-dark); border-color: var(--green-dark); }
.button-secondary { color: var(--green-dark); background: var(--green-soft); border-color: #c4e5d2; }
.button-quiet, .button.quiet { color: var(--muted); background: transparent; border-color: transparent; }
.button-danger { color: #a53c3c; background: var(--red-soft); border-color: #f2c7c7; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat-card, .summary-tile { position: relative; min-width: 0; padding: 17px 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 0 rgba(28,54,39,.015); }
.stat-card::before, .summary-tile::before { position: absolute; inset: 0 auto 0 0; width: 3px; content: ""; background: var(--green); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.stat-icon { color: var(--green); font-size: 18px; }
.stat-value { margin-top: 11px; color: var(--ink); letter-spacing: -.045em; font-size: 25px; font-weight: 800; line-height: 1; }
.stat-foot { display: flex; gap: 7px; margin-top: 11px; color: var(--muted-2); font-size: 10px; }
.delta-up, .positive { color: var(--green-dark); }
.delta-down, .negative { color: var(--red); }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-tile { padding: 14px 16px; }
.summary-tile .stat-label, .summary-tile small { display: block; }
.summary-tile small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.summary-tile strong { display: block; margin-top: 4px; font-size: 20px; letter-spacing: -.03em; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; }
.panel-card { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-card + .panel-card { margin-top: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.panel-head h2, .panel-card h2 { margin: 0 0 4px; letter-spacing: -.025em; font-size: 16px; }
.panel-card h3 { margin: 0 0 5px; font-size: 14px; }
.panel-link { padding: 3px 0; color: var(--green-dark); background: transparent; border: 0; font-size: 11px; font-weight: 700; }
.panel-link:hover { text-decoration: underline; }
.section-divider { height: 1px; margin: 20px 0; background: var(--line); }

.filter-strip, .view-toolbar, .mr-toolbar, .adm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.search-control, .input-control, .select-control, .textarea-control { width: 100%; min-height: 36px; padding: 8px 10px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; outline: none; font-size: 12px; }
.search-control:focus, .input-control:focus, .select-control:focus, .textarea-control:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,139,91,.11); }
.search-control { max-width: 260px; }
.filter-spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full, .form-grid .full { grid-column: 1 / -1; }
.field label, .auth-field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.field label span, .auth-field label span { color: var(--muted-2); font-weight: 500; }
.textarea-control { min-height: 90px; resize: vertical; }
.toggle-row, .radio-row { display: flex; align-items: center; gap: 9px; min-height: 36px; }
.toggle-row input, .radio-row input, .auth-check input { accent-color: var(--green); }
.toggle-copy { display: grid; gap: 2px; }
.toggle-copy b { font-size: 12px; }
.toggle-copy small, .hint, .picker-hint { color: var(--muted); font-size: 11px; }
.radio-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.radio-pill:has(input:checked) { color: var(--green-dark); background: var(--green-soft); border-color: #b8ddc8; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 10px 11px; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 11px; border-bottom: 1px solid #edf2ee; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.row-avatar { display: inline-flex; align-items: center; gap: 8px; }
.item-name { font-weight: 700; }
.item-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.empty-state { padding: 28px 14px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 13px; }
.empty-state p { margin: 0; font-size: 12px; }
.status, .trial-badge, .adm-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-instock, .status-paid, .good { color: #187046; background: var(--green-soft); }
.status-low, .status-pending, .warn { color: #93621a; background: var(--amber-soft); }
.status-overdue, .bad, .error { color: #a43f3f; background: var(--red-soft); }
.status-neutral { color: var(--muted); background: #edf1ef; }

.alerts { display: grid; gap: 8px; }
.alert-row, .cash-glance, .mini-row { display: flex; align-items: center; gap: 11px; padding: 10px 11px; background: var(--surface-soft); border: 1px solid #e9f0eb; border-radius: 9px; }
.alert-icon { display: grid; place-items: center; width: 27px; height: 27px; color: #97651c; background: var(--amber-soft); border-radius: 8px; }
.alert-copy, .mini-copy { min-width: 0; flex: 1; }
.alert-copy b, .mini-copy b { display: block; font-size: 12px; }
.alert-copy small, .mini-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.mini-list { display: grid; gap: 8px; }
.mini-right { color: var(--ink); font-size: 12px; font-weight: 800; }

.chart-wrap { min-height: 220px; padding: 18px 12px 8px; background: linear-gradient(180deg, #fbfdfc, #f7faf8); border: 1px solid #edf2ee; border-radius: 10px; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.bar-column { display: flex; align-items: center; justify-content: flex-end; flex: 1; flex-direction: column; gap: 7px; height: 100%; }
.bar-stack { display: flex; align-items: flex-end; justify-content: center; width: min(34px, 70%); height: 85%; }
.bar { width: 100%; min-height: 4px; background: var(--green); border-radius: 6px 6px 2px 2px; transition: height .2s ease; }
.bar-label { color: var(--muted); font-size: 10px; }
.chart-legend { display: flex; gap: 15px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--green); border-radius: 50%; }

.cash-equation { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px; background: var(--sidebar); border-radius: 11px; color: #fff; }
.equation-block { min-width: 0; text-align: center; }
.equation-block small { display: block; color: #9bb3a5; font-size: 10px; }
.equation-block strong { display: block; margin-top: 4px; font-size: 18px; }
.equation-symbol { color: #83b898; font-size: 19px; }
.variance-card { margin-top: 14px; padding: 13px; border-radius: 9px; background: var(--surface-soft); }
.variance-card strong { font-size: 15px; }

.line-items { display: grid; gap: 8px; }
.line-items-head, .line-item { display: grid; grid-template-columns: minmax(0, 1.6fr) 85px 110px 105px 34px; align-items: center; gap: 8px; }
.line-items-head { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.line-item { padding: 6px 0; }
.line-total { text-align: right; font-weight: 800; }
.icon-delete { display: inline-grid; place-items: center; width: 30px; height: 30px; color: var(--red); background: var(--red-soft); border: 0; border-radius: 7px; }
.sale-total-box { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 20px; font-weight: 800; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(12, 25, 18, .55); backdrop-filter: blur(3px); }
.modal { width: min(680px, 100%); max-height: min(88vh, 760px); overflow: auto; background: var(--surface); border: 1px solid rgba(255,255,255,.5); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { display: inline-grid; place-items: center; width: 30px; height: 30px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 7px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.receipt { width: min(380px, 100%); margin: 0 auto; padding: 20px; background: #fff; border: 1px dashed var(--line-strong); font-family: "DM Mono", ui-monospace, monospace; }
.receipt-header { padding-bottom: 12px; text-align: center; border-bottom: 1px dashed var(--line-strong); }
.receipt-header h2 { margin: 0; font-size: 17px; }
.receipt-header small { color: var(--muted); }
.receipt-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 11px; }
.receipt-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-weight: 800; }
.receipt_footer { margin-top: 18px; color: var(--muted); text-align: center; font-size: 10px; }

/* Authentication and subscription gate */
.auth-shell { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow: auto; padding: 28px 18px; background: radial-gradient(circle at 20% 10%, #e7f4ec 0, transparent 34%), var(--bg); }
.auth-card { width: min(450px, 100%); padding: 30px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); }
.auth-brand { margin-bottom: 30px; }
.auth-brand strong { font-size: 17px; }
.auth-eyebrow { margin-bottom: 8px; color: var(--green-dark); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.auth-card h1 { margin: 0 0 8px; letter-spacing: -.045em; font-size: 28px; line-height: 1.08; }
.auth-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.auth-message { min-height: 22px; margin: 0 0 12px; color: var(--green-dark); font-size: 12px; }
.auth-message.error { padding: 9px 10px; color: #a43f3f; background: var(--red-soft); border-radius: 8px; }
.auth-field { display: grid; gap: 6px; margin-top: 13px; }
.auth-input, .auth-field input { width: 100%; min-height: 42px; padding: 10px 11px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; outline: none; }
.auth-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,139,91,.11); }
.auth-input-wrap { position: relative; }
.auth-input-wrap input { padding-right: 70px; }
.password-toggle { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); padding: 5px 7px; color: var(--green-dark); background: transparent; border: 0; font-size: 11px; font-weight: 700; }
.auth-check { display: flex; align-items: center; gap: 7px; margin: 13px 0; color: var(--muted); font-size: 11px; }
.auth-submit { width: 100%; min-height: 42px; margin-top: 18px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 14px; margin-top: 18px; }
.auth-links button { padding: 0; color: var(--green-dark); background: transparent; border: 0; font-size: 11px; }
.auth-links button:hover { text-decoration: underline; }
.gate-card, .gate-plans { width: min(720px, 100%); }
.gate-card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.gate-plans, .plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.plan-card.selected, .gate-plan.selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,139,91,.1); }
.plan-tag { color: var(--green-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.plan-price { margin: 7px 0 13px; font-size: 22px; font-weight: 800; }
.plan-features { display: grid; gap: 7px; margin: 0; padding: 0; color: var(--muted); list-style: none; font-size: 11px; }
.trial-banner { display: flex; align-items: center; gap: 11px; padding: 13px; color: #855b17; background: var(--amber-soft); border: 1px solid #f0dfae; border-radius: 10px; }
.trial-copy { flex: 1; }
.trial-copy b, .trial-copy small { display: block; }
.trial-copy small { margin-top: 2px; font-size: 11px; }

/* Platform administration */
.platform-admin-mode .main-content { max-width: 1440px; }
.adm-head { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.adm-head h1 { margin: 3px 0 6px; letter-spacing: -.045em; font-size: 32px; }
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.adm-wide { grid-column: 1 / -1; }
.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.adm-kpi { padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.adm-kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.adm-kpi strong { display: block; margin-top: 8px; font-size: 24px; letter-spacing: -.04em; }
.adm-bar { display: grid; grid-template-columns: 100px 1fr 35px; align-items: center; gap: 9px; margin: 10px 0; font-size: 11px; }
.adm-track { height: 7px; overflow: hidden; background: #e9efeb; border-radius: 999px; }
.adm-fill { height: 100%; background: var(--green); border-radius: inherit; }
.adm-table .adm-ref { color: var(--muted); font-size: 10px; }
.adm-tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.adm-tab { padding: 9px 12px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; font-size: 11px; font-weight: 800; white-space: nowrap; }
.adm-tab:hover, .adm-tab[aria-selected="true"] { color: var(--green-dark); border-bottom-color: var(--green); }
.adm-count { margin-left: 5px; padding: 2px 5px; color: #fff; background: var(--green); border-radius: 999px; font-size: 9px; }
.adm-msg { margin-bottom: 12px; padding: 10px 12px; color: var(--green-dark); background: var(--green-soft); border-radius: 8px; font-size: 12px; }
.adm-row { display: flex; align-items: center; gap: 10px; }
.adm-row-copy { min-width: 0; flex: 1; }
.adm-row-copy b, .adm-row-copy small { display: block; }
.adm-row-copy small { color: var(--muted); font-size: 10px; }

.bottom-nav { display: none; }
[hidden] { display: none !important; }
.nav-backdrop { display: none; }
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 180; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; color: #fff; background: var(--sidebar); border-left: 3px solid var(--green); border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 12px; }
.toast.error { border-left-color: var(--red); }

@media (max-width: 1120px) {
  .sidebar { width: 224px; }
  .workspace { width: calc(100% - 224px); margin-left: 224px; }
  .topbar, .main-content { padding-left: 24px; padding-right: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 15; display: block; background: rgba(12,25,18,.45); }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { padding: 0 16px; }
  .mobile-menu { display: inline-grid; margin-right: 9px; font-size: 18px; }
  .top-search { min-width: 34px; width: 34px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .top-search span:nth-child(2), .top-search kbd, .profile-copy { display: none; }
  .main-content { padding: 24px 16px 82px; }
  .page-head, .adm-head { align-items: flex-start; flex-direction: column; }
  .content-grid, .adm-grid { grid-template-columns: 1fr; }
  .adm-wide { grid-column: auto; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 5px max(7px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); box-shadow: 0 -8px 25px rgba(24,47,34,.07); backdrop-filter: blur(12px); }
  .bottom-nav button { display: grid; gap: 2px; place-items: center; padding: 2px; color: var(--muted); background: transparent; border: 0; font-size: 9px; }
  .bottom-nav button span { color: var(--green); font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-grid .full { grid-column: auto; }
  .line-items-head { display: none; }
  .line-item { grid-template-columns: 1fr 75px 34px; }
  .line-item > :nth-child(3), .line-item > :nth-child(4) { grid-column: span 1; }
}
@media (max-width: 520px) {
  .topbar { min-height: 62px; }
  .breadcrumb span, .breadcrumb b { display: none; }
  .stats-grid, .summary-strip, .adm-kpis, .plan-grid, .gate-plans { grid-template-columns: 1fr; }
  .panel-card { padding: 15px; }
  .page-head h1, .adm-head h1 { font-size: 27px; }
  .auth-card { padding: 23px 18px; }
  .cash-equation { align-items: stretch; flex-direction: column; }
  .equation-symbol { text-align: center; }
  .modal-backdrop { padding: 10px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .filter-strip, .view-toolbar, #toast-root { display: none !important; }
  .workspace { width: 100%; margin: 0; }
  .main-content { padding: 0; }
  .panel-card { border-color: #ccc; box-shadow: none; break-inside: avoid; }
}

/* Refined visual system */
:root {
  --bg: #f5f7f5;
  --surface: #fff;
  --surface-soft: #f8faf8;
  --line: #e3e9e4;
  --line-strong: #cbd7ce;
  --ink: #18251e;
  --muted: #68796f;
  --muted-2: #94a198;
  --sidebar: #192720;
  --sidebar-2: #26372e;
  --green: #18764d;
  --green-dark: #105c3a;
  --green-soft: #e8f4ec;
  --shadow: 0 5px 20px rgba(27, 49, 35, .045);
  --shadow-lg: 0 20px 55px rgba(22, 39, 29, .16);
  --radius: 15px;
}

body {
  background: var(--bg);
  letter-spacing: -.005em;
}

.sidebar {
  width: 260px;
  padding: 25px 15px 16px;
  background: linear-gradient(180deg, #1b2b23 0%, #17251e 100%);
}

.brand-lockup {
  padding: 0 11px 29px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #269260, #176b47);
  border-radius: 11px;
}

.nav-list {
  gap: 4px;
}

.nav-item {
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 10px;
}

.nav-item.active {
  background: rgba(57, 162, 104, .2);
  border-color: rgba(130, 212, 161, .16);
  box-shadow: inset 2px 0 #60c487;
}

.workspace {
  width: calc(100% - 260px);
  margin-left: 260px;
}

.topbar {
  min-height: 68px;
  padding: 0 36px;
  background: rgba(248, 250, 248, .9);
  border-bottom-color: #e7ece8;
}

.main-content {
  width: min(1380px, 100%);
  padding: 35px 36px 68px;
}

.page-head {
  margin-bottom: 27px;
}

.page-head h1,
.adm-head h1 {
  letter-spacing: -.05em;
}

.page-head p,
.panel-head p {
  line-height: 1.65;
}

.button {
  min-height: 38px;
  border-radius: 9px;
}

.button-primary {
  background: #18764d;
  border-color: #18764d;
  box-shadow: 0 2px 5px rgba(24, 118, 77, .12);
}

.stats-grid,
.summary-strip,
.content-grid,
.adm-grid,
.adm-kpis {
  gap: 15px;
}

.stat-card,
.summary-tile {
  padding: 19px 20px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.stat-card:hover,
.summary-tile:hover {
  transform: translateY(-2px);
  border-color: #d3e2d7;
  box-shadow: 0 10px 24px rgba(27, 49, 35, .07);
}

.stat-card::before,
.summary-tile::before {
  width: 3px;
  border-radius: 0 3px 3px 0;
}

.stat-label {
  font-size: 11px;
  letter-spacing: .015em;
}

.stat-value {
  margin-top: 13px;
  font-size: clamp(23px, 2.2vw, 29px);
}

.content-grid {
  margin-top: 20px;
}

.panel-card {
  padding: 22px;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.panel-head {
  margin-bottom: 19px;
}

.panel-head h2,
.panel-card h2 {
  font-size: 16px;
}

.data-table {
  font-size: 12px;
}

.data-table th {
  padding: 11px 12px;
  background: #f6f8f6;
  letter-spacing: .075em;
}

.data-table td {
  padding: 13px 12px;
}

.data-table tbody tr {
  transition: background .12s ease;
}

.data-table tbody tr:hover {
  background: #f8fbf8;
}

.search-control,
.input-control,
.select-control,
.textarea-control,
.auth-input,
.auth-field input {
  border-radius: 9px;
}

.search-control:focus,
.input-control:focus,
.select-control:focus,
.textarea-control:focus,
.auth-field input:focus {
  border-color: #58a77b;
  box-shadow: 0 0 0 3px rgba(24, 118, 77, .1);
}

.chart-wrap {
  background: linear-gradient(180deg, #fbfcfb, #f7faf7);
  border-color: #edf1ed;
}

.auth-shell {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(216, 238, 224, .8), transparent 34%),
    radial-gradient(ellipse at 85% 88%, rgba(225, 238, 227, .55), transparent 32%),
    var(--bg);
}

.auth-card {
  padding: 34px;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(25, 50, 34, .12);
}

.gate-card,
.plan-card {
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.modal {
  border-radius: 18px;
}

@media (max-width: 1120px) {
  .sidebar {
    width: 232px;
  }

  .workspace {
    width: calc(100% - 232px);
    margin-left: 232px;
  }

  .topbar,
  .main-content {
    padding-left: 26px;
    padding-right: 26px;
  }
}

@media (max-width: 780px) {
  .sidebar {
    width: min(300px, calc(100vw - 48px));
    padding-top: 22px;
  }

  .workspace {
    width: 100%;
    margin-left: 0;
  }

  .topbar {
    min-height: 64px;
    padding: 0 18px;
  }

  .main-content {
    padding: 27px 20px 96px;
  }

  .bottom-nav {
    padding-top: 9px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -5px 22px rgba(24, 47, 34, .06);
  }

  .bottom-nav button {
    min-height: 40px;
    gap: 3px;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .main-content {
    padding: 23px 15px 94px;
  }

  .page-head {
    gap: 14px;
    margin-bottom: 21px;
  }

  .stats-grid,
  .summary-strip,
  .adm-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card,
  .summary-tile {
    padding: 15px 14px;
  }

  .stat-value {
    font-size: clamp(20px, 6vw, 25px);
  }

  .summary-tile strong {
    font-size: 18px;
  }

  .panel-card {
    padding: 17px;
  }

  .auth-card {
    padding: 27px 21px;
  }
}

@media (max-width: 360px) {
  .stats-grid,
  .summary-strip,
  .adm-kpis {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.cat-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 15px 17px;
  background: #edf6ef;
  border: 1px solid #d5e9da;
  border-radius: 12px;
}

.cat-banner b,
.cat-banner small {
  display: block;
}

.cat-banner b {
  color: var(--ink);
  font-size: 13px;
}

.cat-banner small {
  max-width: 760px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.cat-banner-error {
  background: #fff7eb;
  border-color: #efdfc0;
}

.cat-picker {
  display: grid;
  gap: 15px;
  margin-top: 15px;
}

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-chip {
  min-height: 36px;
  padding: 7px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.cat-chip:hover {
  border-color: var(--green);
}

.cat-chip.on {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: #acd4ba;
}

.cat-chip.small {
  min-height: 32px;
  font-size: 11px;
}

.cat-group {
  display: grid;
  gap: 8px;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.cat-group-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.cat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.cat-msg {
  color: var(--muted);
  font-size: 12px;
}

.cat-msg.err {
  color: var(--red);
}

.cat-msg.ok {
  color: var(--green-dark);
}

.business-module-summary {
  margin-top: 18px;
}

.business-module-summary .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.module-summary-error {
  margin-top: 18px;
  border-color: #efdfc0;
  background: #fffaf1;
}

.module-summary-error p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 520px) {
  .cat-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .cat-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

.workspace-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}

.task-tile {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  min-height: 76px;
  padding: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.task-tile:hover {
  transform: translateY(-2px);
  border-color: #b7d4c1;
  box-shadow: 0 8px 20px rgba(27, 49, 35, .08);
}

.task-icon {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 35px;
  height: 35px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 10px;
  font-size: 16px;
}

.task-label {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-hint {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-muted {
  opacity: .58;
}

.cash-glance {
  display: block;
  margin-top: 18px;
}

.dashboard-single {
  grid-template-columns: minmax(0, 1fr);
}

.cash-notes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.cash-notes b {
  color: var(--ink);
}

.attention-card {
  margin-top: 18px;
}

.content-grid:empty {
  display: none;
}

.more-details {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .55);
}

.more-details > summary {
  padding: 13px 15px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.more-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.more-details > :not(summary) {
  margin-right: 14px;
  margin-left: 14px;
}

.more-details > .filter-strip {
  margin-top: 14px;
}

.more-details > .content-grid:last-child {
  margin-bottom: 14px;
}

@media (max-width: 1120px) {
  .task-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.no-sales-nav) .bottom-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  body:not(.no-sales-nav).no-inventory-nav .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  body.no-sales-nav.no-inventory-nav .bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .task-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin / business portal separation */
.platform-admin-mode .top-search, .platform-admin-mode .notification-button { display: none; }
.platform-admin-mode .adm-tabs { display: none; }
.platform-admin-mode .nav-item.active, .platform-admin-mode .bottom-nav button.active { font-weight: 700; }
.adm-announce { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px; background: #e8f3ff; color: #0b3b66; border: 1px solid #b9d9f7; }
.adm-announce-maintenance, .adm-announce-warning { background: #fff6e0; color: #6b4300; border-color: #f2d58a; }
#wb-announce:empty { display: none; }
#wb-announce { padding: 0 var(--page-pad, 16px); }

/* 7-day trial: keep the trial banner and expired-plan CTA usable on small screens */
.gate-card [data-gate-choose] { margin-bottom: 14px; }
@media (max-width: 640px) { .trial-banner { flex-wrap: wrap; } .trial-banner .button { width: 100%; } }
.gate-plan { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-align: left; font: inherit; color: var(--text, inherit); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.gate-plan span { font-weight: 700; } .gate-plan small { font-weight: 500; opacity: .7; }
.gate-plan ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; font-weight: 400; }
.gate-plan.on { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,139,91,.1); }
.role-hidden{display:none!important}

/* ===== Cross-device touch & viewport fixes (appended; wins the cascade) ===== */
/* iOS Safari only dispatches click to document-level delegated handlers for elements that look clickable. */
[data-action], [data-view], [data-toggle], [data-settings-tab], [data-modal-backdrop], [data-mr-goto], tr[data-action] { cursor: pointer; }
button, [role="button"], .nav-item, .button, .icon-button, .data-table tr[data-action], .modal-close { touch-action: manipulation; -webkit-tap-highlight-color: rgba(29,139,91,.15); }
/* Toasts must never block taps on controls underneath. */
#toast-root { pointer-events: none; }
#toast-root .toast { pointer-events: auto; }
/* Dynamic viewport units: mobile browser toolbars no longer clip the sidebar/modals. */
@supports (height: 100dvh) {
  .sidebar { height: 100dvh; }
  .app-frame { min-height: 100dvh; }
  .modal { max-height: min(88dvh, 760px); }
}
.modal, .auth-shell, .sidebar { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
body { overflow-wrap: anywhere; -webkit-text-size-adjust: 100%; }
img, svg, canvas, video { max-width: 100%; height: auto; }
.main-content > *, .panel-card, .page-head > * { min-width: 0; }
.table-wrap { -webkit-overflow-scrolling: touch; max-width: 100%; }
@media (max-width: 780px) {
  /* Closed drawer must not be focusable or tappable. */
  .sidebar { visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  body.nav-open .sidebar { visibility: visible; transition: transform .18s ease; }
  .topbar { padding-top: env(safe-area-inset-top); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .main-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
/* Touch devices: 44px targets and 16px inputs (stops iOS focus-zoom that shifts the layout). */
@media (pointer: coarse) {
  .button, .nav-item, .icon-button, .mobile-menu, .modal-close, .top-profile, .top-search, .bottom-nav button, .adm-tabs button, .icon-delete { min-height: 44px; }
  .icon-button, .mobile-menu, .modal-close, .icon-delete { min-width: 44px; }
  .search-control, .input-control, .select-control, .textarea-control, .auth-field input, .auth-field select, input, select, textarea { font-size: 16px; min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; }
  .data-table td, .data-table th { padding-top: 13px; padding-bottom: 13px; }
  .data-table tbody tr:hover, .button:hover { transform: none; }
}
@media (max-width: 520px) { .search-control { max-width: none; } .modal-foot { flex-wrap: wrap; } .modal-foot .button { flex: 1 1 auto; } }
@media (max-height: 480px) and (orientation: landscape) { .modal { max-height: 94dvh; } .auth-shell { place-items: start center; } }

/* ===== Navigation: hamburger drawer on mobile, sidebar on tablet/desktop. No bottom bar anywhere. ===== */
.bottom-nav { display: none !important; }
.sidebar-close { display: none; }
@media (max-width: 780px) {
  .mobile-menu, #mobile-menu { display: inline-grid !important; margin-right: 6px; }
  .sidebar { width: min(320px, calc(100vw - 56px)); z-index: 300; }
  .nav-backdrop { z-index: 290; }
  .sidebar-close { display: flex; align-items: center; justify-content: flex-end; width: 100%; min-height: 44px; margin: -6px 0 4px; padding: 0 10px; color: #b8c9bf; background: transparent; border: 0; font-size: 13px; font-weight: 700; }
  .sidebar-label { cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
  .sidebar-label::after { content: '⌄'; font-size: 14px; transition: transform .15s; }
  .sidebar-label.collapsed::after { transform: rotate(-90deg); }
  .sidebar-label.collapsed + .nav-list { display: none; }
  body.nav-open { overflow: hidden; touch-action: none; }
  .sidebar { touch-action: pan-y; }
  .topbar { min-height: 56px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar-actions { margin-left: auto; }
  /* Reclaim the space the bottom bar used. */
  .main-content { padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; }
  .pwa-bar { bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (min-width: 781px) { .nav-backdrop, .sidebar-close { display: none !important; } }

/* ===== Global search ===== */
.wbs-root { position: fixed; inset: 0; z-index: 400; display: flex; justify-content: center; align-items: flex-start; padding: max(12vh, 24px) 16px 16px; }
.wbs-root[hidden] { display: none !important; }
.wbs-backdrop { position: absolute; inset: 0; background: rgba(12,25,18,.55); }
.wbs-panel { position: relative; display: flex; flex-direction: column; width: min(640px, 100%); max-height: min(70vh, 640px); background: var(--surface, #fff); border-radius: 14px; box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.25)); overflow: hidden; }
.wbs-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line, #dfe8e2); }
.wbs-glass { color: var(--muted, #6b7d72); font-size: 18px; }
.wbs-bar input { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; outline: 0; background: transparent; color: var(--ink, #14281d); font-size: 16px; }
.wbs-bar input::-webkit-search-cancel-button { display: none; }
.wbs-clear, .wbs-close { min-height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted, #6b7d72); font-weight: 700; }
.wbs-close { color: var(--green, #1d8b5b); }
.wbs-status { padding: 8px 16px 0; color: var(--muted, #6b7d72); font-size: 12px; min-height: 20px; }
.wbs-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 8px 12px; }
.wbs-group { padding: 12px 8px 4px; color: var(--muted, #6b7d72); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.wbs-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px; text-align: left; background: transparent; border: 0; border-radius: 10px; color: inherit; cursor: pointer; }
.wbs-item:hover, .wbs-item.on { background: var(--surface-soft, #f1f6f3); }
.wbs-item:focus-visible { outline: 3px solid rgba(29,139,91,.35); }
.wbs-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-soft, #eaf3ee); color: var(--green, #1d8b5b); }
.wbs-main { flex: 1; min-width: 0; display: grid; }
.wbs-main b, .wbs-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wbs-main b { font-size: 14px; } .wbs-main small { color: var(--muted, #6b7d72); font-size: 12px; }
.wbs-tag { flex: none; padding: 2px 8px; border-radius: 99px; background: var(--surface-soft, #eaf3ee); color: var(--muted, #52675b); font-size: 11px; font-style: normal; text-transform: capitalize; }
.wbs-recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 8px 4px; } .wbs-recent .wbs-group { width: 100%; padding-left: 0; }
.wbs-chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line, #dfe8e2); border-radius: 99px; background: var(--surface, #fff); color: inherit; }
.wbs-link { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--green, #1d8b5b); font-weight: 700; text-decoration: underline; }
.wbs-error { margin: 8px; padding: 12px; border-radius: 10px; background: var(--red-soft, #fdecec); color: var(--red, #b42318); font-size: 13px; }
body.wbs-open { overflow: hidden; }
@media (max-width: 780px) {
  .wbs-root { padding: 0; }
  .wbs-panel { width: 100%; max-height: none; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  /* Header search shows as an icon button on phones. */
  .top-search { min-width: 44px; width: 44px; }
}
@media (min-width: 781px) and (max-width: 1120px) { .wbs-root { padding-top: 8vh; } }
@media (prefers-reduced-motion: reduce) { .wbs-panel { transition: none; } }

/* ===== WantokBiz premium sign-in (glass on green) — auth screens only ===== */
.auth-shell.auth-premium {
  --ab-deep: #06241a; --ab-forest: #0b3d2b; --ab-emerald: #1d8b5b; --ab-light: #3fbf86;
  display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; place-items: stretch;
  padding: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(63,191,134,.38), transparent 52%),
    radial-gradient(ellipse at 90% 100%, rgba(29,139,91,.45), transparent 50%),
    linear-gradient(160deg, var(--ab-emerald) 0%, var(--ab-forest) 55%, var(--ab-deep) 100%);
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.auth-premium .auth-brand-side { position: relative; display: grid; place-items: center; padding: 28px 20px 8px; overflow: hidden; text-align: center; color: #fff; }
.auth-premium .auth-brand-inner { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; }
.auth-premium .auth-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.28); object-fit: contain; }
.auth-premium .auth-brand-name { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.auth-premium .auth-tagline { margin: 0; color: #cdeedd; font-size: 14px; font-weight: 500; letter-spacing: .01em; }
.auth-premium .auth-orb { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255,255,255,.10), rgba(255,255,255,0) 70%); }
.auth-premium .auth-orb-a { width: 340px; height: 340px; top: -140px; left: -90px; }
.auth-premium .auth-orb-b { width: 260px; height: 260px; bottom: -120px; right: -60px; }
.auth-premium .auth-form-side { display: grid; place-items: center; padding: 16px 16px 28px; }
.auth-premium .auth-card {
  width: min(430px, 100%); padding: 28px 24px;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,.65); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(2,20,12,.38), inset 0 1px 0 rgba(255,255,255,.7);
  animation: authRise .5s cubic-bezier(.2,.7,.2,1) both;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .auth-premium .auth-card { background: rgba(255,255,255,.96); } }
.auth-premium .auth-card h1 { font-size: 26px; }
.auth-premium .auth-eyebrow { color: var(--green-dark); }
.auth-premium .auth-field input { min-height: 46px; font-size: 16px; border-radius: 12px; background: rgba(255,255,255,.92); transition: border-color .15s, box-shadow .15s; }
.auth-premium .auth-field input:focus-visible { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(29,139,91,.22); }
.auth-premium .password-toggle { min-width: 44px; min-height: 44px; }
.auth-premium .auth-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 12px 0 2px; }
.auth-premium .auth-row .auth-check { margin: 0; font-size: 13px; min-height: 44px; }
.auth-premium .auth-check input { width: 18px; height: 18px; }
.auth-premium .auth-forgot, .auth-premium .auth-links button { min-height: 44px; padding: 0 2px; color: var(--green-dark); background: transparent; border: 0; font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-premium .auth-forgot:hover, .auth-premium .auth-links button:hover { text-decoration: underline; }
.auth-premium .auth-submit { min-height: 48px; margin-top: 10px; font-size: 15px; font-weight: 700; border-radius: 12px; background: linear-gradient(135deg, #22a06b, #126a43); border: 0; color: #fff; box-shadow: 0 8px 20px rgba(18,106,67,.35); transition: transform .15s, box-shadow .15s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.auth-premium .auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(18,106,67,.42); }
.auth-premium .auth-submit:focus-visible, .auth-premium .auth-forgot:focus-visible, .auth-premium .auth-links button:focus-visible, .auth-premium .password-toggle:focus-visible, .auth-premium .auth-check input:focus-visible { outline: 3px solid #0b3d2b; outline-offset: 2px; }
.auth-premium .auth-submit:disabled { opacity: .8; cursor: progress; }
.auth-premium .auth-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: authSpin .7s linear infinite; }
.auth-premium .auth-links { flex-direction: column; align-items: center; gap: 0; margin-top: 12px; }
.auth-premium .auth-register-line { font-size: 13px; color: var(--muted); }
.auth-premium .auth-register-line button { font-size: 13px; }
.auth-premium .auth-admin-link { font-weight: 500 !important; color: var(--muted) !important; font-size: 12px !important; }
.auth-premium .auth-message.error { font-size: 13px; }
.auth-premium .auth-message { font-size: 13px; }
@keyframes authRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes authSpin { to { transform: rotate(360deg); } }
@media (min-width: 600px) {
  .auth-premium .auth-brand-side { padding-top: 44px; }
  .auth-premium .auth-logo { width: 96px; height: 96px; border-radius: 24px; }
  .auth-premium .auth-brand-name { font-size: 28px; }
  .auth-premium .auth-tagline { font-size: 16px; }
  .auth-premium .auth-card { padding: 34px 32px; }
}
@media (min-width: 960px) and (min-height: 560px) {
  .auth-shell.auth-premium { grid-template-columns: 1.05fr 1fr; grid-template-rows: 1fr; }
  .auth-premium .auth-brand-side { padding: 48px; }
  .auth-premium .auth-logo { width: 148px; height: 148px; border-radius: 34px; }
  .auth-premium .auth-brand-name { font-size: 40px; }
  .auth-premium .auth-tagline { font-size: 20px; }
  .auth-premium .auth-orb-a { width: 560px; height: 560px; top: -200px; left: -160px; }
  .auth-premium .auth-orb-b { width: 420px; height: 420px; bottom: -160px; right: -100px; }
  .auth-premium .auth-brand-inner { gap: 14px; }
  .auth-premium .auth-form-side { padding: 40px; background: rgba(2,20,12,.28); }
}
@media (max-height: 480px) and (orientation: landscape) { .auth-shell.auth-premium { grid-template-columns: 1fr; } .auth-premium .auth-logo { width: 48px; height: 48px; } .auth-premium .auth-brand-side { padding: 12px; } }
@media (prefers-reduced-motion: reduce) { .auth-premium .auth-card, .auth-premium .auth-submit, .auth-premium .auth-field input { animation: none !important; transition: none !important; } .auth-premium .auth-spinner { animation-duration: 1.6s; } }
/* contrast + glow refinements */
.auth-premium .auth-card { background: rgba(255,255,255,.94); }
.auth-premium .auth-subtitle, .auth-premium .auth-register-line { color: #3d4f45; }
.auth-premium .auth-field label { color: #26382e; font-size: 12px; }
.auth-premium .auth-check span { color: #26382e; }
.auth-premium .auth-field input::placeholder { color: #5f7066; }
.auth-premium .auth-admin-link { color: #4a5c52 !important; }
.auth-premium .auth-message:empty { min-height: 0; margin: 0; }
@media (max-width: 959px) { .auth-premium .auth-brand-side { overflow: visible; } .auth-premium .auth-orb-a { top: -180px; left: 50%; margin-left: -170px; } .auth-premium .auth-orb-b { display: none; } }
@media (max-width: 959px) { .auth-premium .auth-brand-side { overflow-x: clip; overflow-y: visible; } .auth-premium .auth-form-side { align-items: start; padding-top: 12px; } }
@media (min-width: 600px) and (max-width: 959px) { .auth-premium .auth-form-side { padding-top: 28px; } }
/* Google sign-in, divider, support text, terms */
.auth-premium .auth-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; color: #4a5c52; font-size: 12px; }
.auth-premium .auth-divider::before, .auth-premium .auth-divider::after { content: ""; flex: 1; height: 1px; background: rgba(18,60,40,.2); }
.auth-premium .auth-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; margin-top: 10px; padding: 0 14px; color: #1f1f1f; background: #fff; border: 1px solid #dadce0; border-radius: 12px; font: 600 15px/1 inherit; font-family: inherit; cursor: pointer; transition: box-shadow .15s, background .15s; }
.auth-premium .auth-google:hover:not(:disabled) { background: #f8f9fa; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.auth-premium .auth-google:focus-visible { outline: 3px solid #0b3d2b; outline-offset: 2px; }
.auth-premium .auth-google:disabled { opacity: .7; cursor: progress; }
.auth-premium .auth-terms { align-items: flex-start; margin: 14px 0 0; font-size: 13px; }
.auth-premium .auth-terms input { margin-top: 2px; flex: none; }
.auth-premium .auth-support { display: none; max-width: 380px; margin: 6px 0 0; color: #b9e3cc; font-size: 16px; line-height: 1.5; }
@media (min-width: 960px) and (min-height: 560px) { .auth-premium .auth-support { display: block; } }
