/* ==========================================================================
   AfroshiftERP — application stylesheet
   Brand: deep blue #2563EB · emerald accent · dark slate sidebar
   ========================================================================== */

:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-light: #dbeafe;
    --emerald: #10b981;
    --emerald-dark: #059669;
    --amber: #f59e0b;
    --red: #ef4444;
    --violet: #7c3aed;
    --cyan: #06b6d4;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f1f5f9;
    --card: #ffffff;
    --sidebar-w: 250px;
    --sidebar-bg: #ffffff;
    --sidebar-ink: #1e293b;
    --sidebar-muted: #5b6b80;
    --sidebar-border: #e2e8f0;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #2563eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, .15), 0 4px 10px -6px rgba(15, 23, 42, .1);
    /* aliases used by the v2 blocks */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    /* app display scale (set by the installed-app settings; 1 = normal) */
    --app-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: calc(14px * var(--app-scale));
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 20% -10%, #1e3a8a 0%, transparent 60%),
        radial-gradient(1000px 500px at 110% 10%, #0f766e 0%, transparent 55%),
        linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 34px 32px 24px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 76px; height: 76px; object-fit: contain; margin-bottom: 10px; }
.login-name { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; }
.login-name span { color: var(--brand); }
.login-tag { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.login-foot { text-align: center; color: #94a3b8; font-size: 11.5px; margin-top: 20px; }
.login-role-row { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.login-role-link { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.login-role-link:hover { text-decoration: underline; }
.login-role-link.muted { color: var(--muted); font-weight: 500; }
.login-support { text-align: center; color: #94a3b8; font-size: 10.5px; margin-top: 14px; opacity: .85; }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-muted);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 50;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}
.brand-logo img { width: 40px; height: 40px; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 16px; color: var(--sidebar-ink); letter-spacing: -.3px; }
.brand-name .brand-erp { color: var(--brand); }
.brand-tag { font-size: 10px; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-group { margin-top: 6px; }
.nav-group-title {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--sidebar-muted); padding: 10px 12px 5px; font-weight: 700;
    font-family: inherit;
}
.nav-group-title:hover { color: var(--sidebar-ink); }
.nav-chevron { font-size: 10px; transition: transform .15s ease; }
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-body { display: none; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    color: var(--sidebar-muted); padding: 8px 12px; border-radius: 8px;
    font-size: 13px; margin-bottom: 1px;
    transition: background .12s, color .12s;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }

.sidebar-foot {
    padding: 14px 18px; border-top: 1px solid var(--sidebar-border);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-wrap: wrap;
}
.install-app-btn {
    flex: 0 0 100%; order: -1; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 10px; margin-bottom: 4px;
    background: var(--sidebar-hover); border: 1px dashed var(--sidebar-border);
    border-radius: 8px; color: var(--sidebar-ink);
    font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.install-app-btn:hover { background: var(--sidebar-active); color: #fff; }
.install-app-btn[hidden] { display: none; }
.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand), var(--violet));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.user-name { color: var(--sidebar-ink); font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.user-role { color: var(--sidebar-muted); font-size: 10.5px; line-height: 1.2; }
.sidebar-foot .nav-item { padding: 6px 10px; font-size: 12px; color: var(--sidebar-muted); }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 28px 0; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.topbar-right { }
.topbar-clock { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.content { padding: 20px 28px 40px; flex: 1; min-width: 0; }
.footer { padding: 0 28px 24px; color: #94a3b8; font-size: 11.5px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.footer-support { opacity: .85; }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid .stat-card { height: 100%; }
.stat-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px; position: relative;
    border-left: 4px solid var(--line);
}
.stat-card .stat-icon {
    position: absolute; top: 16px; right: 16px;
    width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.stat-card .stat-value { font-size: 23px; font-weight: 800; letter-spacing: -.5px; margin: 3px 0 3px; }
.stat-card .stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-card .stat-hint { color: #94a3b8; font-size: 11px; }
.stat-card.tone-green { border-left-color: var(--emerald); }
.stat-card.tone-blue { border-left-color: var(--brand); }
.stat-card.tone-amber { border-left-color: var(--amber); }
.stat-card.tone-red { border-left-color: var(--red); }
.stat-card.tone-violet { border-left-color: var(--violet); }
.stat-card.tone-cyan { border-left-color: var(--cyan); }
.tone-green .stat-icon { background: #d1fae5; color: var(--emerald-dark); }
.tone-blue .stat-icon { background: var(--brand-light); color: var(--brand); }
.tone-amber .stat-icon { background: #fef3c7; color: #b45309; }
.tone-red .stat-icon { background: #fee2e2; color: var(--red); }
.tone-violet .stat-icon { background: #ede9fe; color: var(--violet); }
.tone-cyan .stat-icon { background: #cffafe; color: var(--cyan); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-title { font-weight: 700; font-size: 14.5px; }
.card-actions { display: flex; gap: 6px; }
.card-body { padding: 18px; }

/* Page header action buttons (right-aligned, professional) */
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.page-action-buttons { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .page-action-buttons { margin-left: 0; } }

/* Collapsible card (details-based) */
.collapsible-card summary.card-head { list-style: none; }
.collapsible-card summary.card-head::-webkit-details-marker { display: none; }
.collapsible-card summary.card-head::before { content: '▸'; margin-right: 8px; color: var(--muted); transition: transform 0.15s ease; }
.collapsible-card[open] summary.card-head::before { transform: rotate(90deg); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-2 .card { min-width: 0; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Approval requests
   -------------------------------------------------------------------------- */
.approval-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.approval-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.approval-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; flex: 1; min-width: 260px; max-width: 460px; }
.approval-form { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.approval-note-row { display: flex; flex-direction: column; gap: 4px; }
.approval-note-row label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.approval-note { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--input-bg, #fff); color: var(--ink); }
.approval-note:focus { outline: 2px solid var(--accent, #2563eb); outline-offset: 0; border-color: transparent; }
@media (max-width: 640px) {
  .approval-actions { min-width: 0; max-width: none; width: 100%; }
  .approval-note { font-size: 16px; } /* >=16px prevents iOS zoom on focus */
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--ink);
    border: 1px solid var(--line); border-radius: 9px;
    padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all .12s; white-space: nowrap;
    text-decoration: none;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.btn-green { background: #25d366; border-color: #25d366; color: #fff; }
.btn-green:hover { background: #1eb958; border-color: #1eb958; color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-success { background: #059669; border-color: #059669; color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.w100 { width: 100%; }
/* Password show/hide toggle */
.password-wrap { position: relative; display: block; }
.password-wrap input[type=password], .password-wrap input[type=text] { padding-right: 42px; }
.password-toggle {
    position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 16px; padding: 4px; line-height: 1;
}
.password-toggle:hover { color: var(--ink); }
.page-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.card-actions-inline { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    color: #000; font-weight: 700; padding: 10px 12px;
    border-bottom: 1px solid #000; white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid #000; vertical-align: middle; }
.data-table tbody tr:hover { background: #fff; }
.data-table .ta-r, .data-table td.ta-r { text-align: right; }
.data-table .empty-row { text-align: center; color: #94a3b8; padding: 34px 12px; }
.data-table .th-actions { text-align: right; }
.data-table .td-actions { text-align: right; white-space: nowrap; }
.data-table .td-actions .btn { margin-left: 4px; }
.data-table tfoot td { font-weight: 800; background: #fff; border-top: 1px solid #000; }
.empty { text-align: center; color: #94a3b8; padding: 34px 12px; font-size: 13px; }
.muted { color: var(--muted); font-size: 12.5px; }
.text-danger { color: var(--red) !important; }
.text-warn { color: #b45309 !important; }

/* --- legacy .table (used by reseller pages) — same look as .data-table --- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    color: #000; font-weight: 700; padding: 10px 12px;
    border-bottom: 1px solid #000; white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #000; vertical-align: middle; }
.table tbody tr:hover { background: #fff; }
.table th.r, .table td.r { text-align: right; }
.table tfoot td { font-weight: 800; background: #fff; border-top: 1px solid #000; }
.table input[type=number], .table input[type=text] {
    padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; color: var(--ink); background: #fff; box-sizing: border-box; outline: none;
}
.table input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.table .muted { font-size: 11px; }

.badge {
    display: inline-block; font-size: 10.5px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px; letter-spacing: .4px;
    text-transform: uppercase; white-space: nowrap;
}
.badge-green { background: #d1fae5; color: #047857; }
.badge-blue { background: var(--brand-light); color: var(--brand-dark); }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-violet { background: #ede9fe; color: #6d28d9; }
.badge-cyan { background: #cffafe; color: #0e7490; }
.badge-cg { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; display: inline-block; margin: 1px 2px 1px 0; }
.check-group { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check-item { display: inline-flex; align-items: center; gap: 5px; font-size: 0.9em; }

code { background: #f1f5f9; border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: #0f172a; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 5px; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=number],
.form-row input[type=date], .form-row input[type=email], .form-row select, .form-row textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 13.5px; color: var(--ink); background: #fff; outline: none; transition: border .12s, box-shadow .12s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions-inline { display: flex; gap: 8px; margin-top: 10px; }
.form-section-title { font-weight: 700; font-size: 13px; color: var(--brand-dark); margin: 16px 0 10px; text-transform: uppercase; letter-spacing: .5px; }
.note { font-size: 12px; color: var(--muted); background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin: 10px 0; }
.note-plain { font-size: 12px; color: #000; background: #fff; border: 1px solid #000; border-radius: 8px; padding: 9px 12px; margin: 10px 0; }
.text-low { color: var(--red); font-weight: 600; }
.qr-xs { vertical-align: middle; border: 1px solid var(--border); border-radius: 4px; margin-left: 5px; }
.store-qr { display: block; margin: 12px auto 2px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; }
.store-order-qr { display: block; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff; }
.note-important { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.inline-form { display: inline; }

/* --- grid-form / form-group (used by v13 reseller pages) --- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group label { font-size: 12.5px; font-weight: 600; color: #334155; }
.form-group input[type=text], .form-group input[type=password], .form-group input[type=number],
.form-group input[type=date], .form-group input[type=email], .form-group select, .form-group textarea {
    width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 13.5px; color: var(--ink); background: var(--input-bg, #fff); outline: none; transition: border .12s, box-shadow .12s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-group textarea { min-height: 64px; resize: vertical; }
.form-actions-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 620px) { .grid-form { grid-template-columns: 1fr; } }

/* --- tab bar (reseller detail page) --- */
.tab-bar { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab-bar a { padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; text-decoration: none; }
.tab-bar a:hover { color: var(--ink); }
.tab-bar a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-bar a .tab-count { color: var(--muted); font-weight: 500; font-size: 11.5px; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-big { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.alert-big a { font-weight: 700; text-decoration: underline; }

.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input[type=date], .filter-bar input[type=text], .filter-bar input[type=number] {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; background: #fff;
}
.filter-summary { margin-left: auto; color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------------------
   Segmented control
   -------------------------------------------------------------------------- */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.segmented a { padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fff; border-right: 1px solid var(--line); }
.segmented a:last-child { border-right: 0; }
.segmented a:hover { background: #f8fafc; }
.segmented a.active { background: var(--brand); color: #fff; }

/* --------------------------------------------------------------------------
   POS
   -------------------------------------------------------------------------- */
.pos-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .pos-layout { grid-template-columns: 1fr; } }
.scan-box { display: flex; gap: 8px; }
.scan-box input[type=text] { flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.scan-box input[type=number] { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.quick-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.quick-pick-item button {
    width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
    border-radius: 9px; padding: 10px 12px; cursor: pointer; transition: all .12s;
}
.quick-pick-item button:hover { border-color: var(--brand); background: #f0f6ff; }
.quick-pick-item strong { display: block; font-size: 12.5px; }
.quick-pick-item small { color: var(--muted); font-size: 11px; }
.pos-total { display: flex; justify-content: space-between; align-items: center; background: var(--brand-light); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.pos-total-label { font-weight: 700; color: var(--brand-dark); }
.pos-total-value { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.chip-chip { display: inline-block; background: #fef3c7; color: #b45309; font-size: 9.5px; font-weight: 700; border-radius: 4px; padding: 1px 5px; letter-spacing: .5px; }
.mode-chip { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; font-size: 12px; border-radius: 7px; padding: 6px 12px; letter-spacing: .6px; }
.inline-qty input { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }

/* --------------------------------------------------------------------------
   Permissions matrix
   -------------------------------------------------------------------------- */
.perm-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.perm-group-title { font-weight: 700; font-size: 12px; color: var(--brand-dark); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.perm-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 0; cursor: pointer; }
.perm-check input { accent-color: var(--brand); }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.kv-list { display: grid; gap: 2px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv span { color: var(--muted); font-size: 12.5px; }
.kv strong { font-size: 13.5px; }

.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 14px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.invoice-head h3 { font-size: 19px; }
.invoice-total { font-size: 26px; font-weight: 800; color: var(--brand-dark); }

.pl-table tr.sub td { color: #000; }
.pl-table tr.total td { font-weight: 700; border-top: 1px solid #000; }
.pl-table tr.grand td { font-weight: 800; background: #fff; font-size: 15px; border-top: 2px solid #000; }

.error-box { max-width: 480px; margin: 80px auto; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 40px; text-align: center; }
.error-box h1 { font-size: 22px; margin-bottom: 10px; }
.error-box p { color: var(--muted); margin-bottom: 14px; }

.is-disabled { opacity: .45; pointer-events: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 264px; box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    body .menu-toggle { display: inline-flex; }
body.menu-open { overflow: hidden; }
    .menu-backdrop.show { display: block; }
}

/* ==========================================================================
   v2 additions - Dashboard, POS, product images, segmented controls
   ========================================================================== */
.hidden { display: none !important; }
.seg { flex: 1; padding: 9px 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.segmented { display: flex; gap: 6px; margin-bottom: 14px; }

.tone-indigo { --accent: #6366f1; --soft: rgba(99,102,241,.10); }

.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: #fff; border: 1px solid var(--border); display: inline-block; vertical-align: middle; }
.thumb-sm { width: 30px; height: 30px; border-radius: 6px; }

.item-form-image img { max-height: 96px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }

.brand-logo-wide { max-height: 42px; max-width: 190px; width: auto; }
.brand-logo-wide img { width: auto; height: 30px; max-width: 176px; object-fit: contain; }
.login-logo-wide { max-height: 88px; max-width: 320px; width: auto; }
.login-logo-wide { height: auto; width: auto; max-height: 76px; max-width: 300px; object-fit: contain; }
.logo-preview img { max-height: 80px; width: auto; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; }

/* Dashboard */
.dash-greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.dash-greeting h1 { margin: 0 0 4px; font-size: 24px; }
.dash-greeting p { margin: 0; color: var(--muted); }
.dash-range { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; color: var(--muted); font-size: 13px; }

.dash-main-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; align-items: stretch; }
.dash-main-grid > div { min-width: 0; }
.dash-main-grid .card { margin-bottom: 0; height: 100%; }
@media (max-width: 1100px) { .dash-main-grid { grid-template-columns: 1fr; } }

/* Donut chart: bounded + centred so it never stretches across the card on wide screens */
.dash-donut { max-width: 240px; margin: 10px auto 2px; }

.dash-sub { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.dash-top-list { margin-top: 12px; }
.dash-top-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-light); font-size: 13px; }
.dash-top-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dash-top-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-top-val { color: var(--muted); white-space: nowrap; }

.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1000px) { .stat-grid-3, .stat-grid-4, .stat-grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .stat-grid-3, .stat-grid-4, .stat-grid-5 { grid-template-columns: 1fr; } }

/* Compact user cell used in reseller lists */
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell .user-avatar { width: 34px; height: 34px; font-size: 14px; flex: none; }
.user-cell .user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-cell .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert-big { display: flex; align-items: center; gap: 10px; }

/* POS */
.pos-shell { display: flex; flex-direction: column; gap: 10px; }
.pos-strip {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 9px 14px; font-size: 13px; color: var(--muted);
}
.pos-online { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--emerald, #059669); }
.pos-online i { font-size: 9px; color: var(--emerald, #059669); }
.pos-strip-loc, .pos-strip-cust, .pos-strip-ts { display: inline-flex; align-items: center; gap: 6px; }
.pos-strip-ts { margin-left: auto; }
@media (max-width: 760px) { .pos-strip-ts { display: none; } .pos-strip-cust { display: none; } }

.pos-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1050px) { .pos-layout { grid-template-columns: 1fr; } }
.pos-left, .pos-right { display: flex; flex-direction: column; gap: 12px; }

/* search row */
.pos-search-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-scan { flex: 1 1 340px; }
.pos-filter { flex: 1 1 220px; min-width: 160px; }

/* product grid */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-card { margin: 0; }
.pos-card-btn {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.pos-card-btn:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.pos-card-img { width: 100%; height: 92px; border-radius: 8px; overflow: hidden; background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.pos-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pos-card-name { font-size: 13px; font-weight: 700; line-height: 1.25; margin-top: 6px; min-height: 32px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-card-sku { font-size: 11px; color: var(--muted); font-family: var(--mono, monospace); }
.pos-card-price { font-size: 17px; font-weight: 800; color: var(--primary); margin-top: 2px; }
.pos-card-price small { font-size: 11px; color: var(--muted); font-weight: 600; }
.pos-card-piece { display: block; font-size: 11px; color: var(--muted); }
.pos-card-unit { font-size: 11px; color: var(--muted); }
.pos-mode-select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; background: var(--card); color: var(--ink); }
.pos-mode-select.pos-mode-sm { padding: 2px 6px; font-size: 11px; margin-top: 3px; }
.pos-mode-toggle { display: inline-block; }
.pos-lid-label strong { white-space: nowrap; }
.pos-card-stock { margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--emerald, #059669); }
.pos-card-stock.pos-stock-low { color: var(--amber, #d97706); }
.pos-card-stock.pos-stock-out { color: var(--red, #dc2626); }
.pos-card-lid { margin-top: 3px; font-size: 10px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 3px; }
.pos-lid-toggle { margin-top: 3px; }
.pos-lid-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); cursor: pointer; }
.pos-lid-label input { accent-color: var(--primary); }
.pos-lid-label strong { color: var(--primary); }

/* right panel */
.pos-cart-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; padding: 2px 2px 0; }
.pos-lines { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; padding: 2px; }
.pos-line {
    display: flex; align-items: center; gap: 10px; background: var(--card);
    border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.pos-line-info { flex: 1; min-width: 0; }
.pos-line-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-line-info small { color: var(--muted); font-size: 11px; }
.pos-line-qty .pos-qty { width: 64px; }
.pos-line-total { font-size: 13px; min-width: 62px; text-align: right; }
.pos-line-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.pos-line-remove:hover { color: var(--red, #dc2626); }

/* totals */
.pos-totals { border-top: 2px solid var(--border); margin-top: 4px; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pos-total-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.pos-total-row small { color: var(--muted); }
.pos-total-row.pos-grand { font-size: 17px; border-top: 1px solid var(--border-light, #eef0f3); margin-top: 4px; padding-top: 8px; }
.pos-total-row.pos-grand strong { font-size: 22px; font-weight: 800; color: var(--primary); }
.pos-total-edit input { width: 110px; text-align: right; }

/* checkout */
.pos-checkout { margin-top: 6px; }
.pos-receipt-opt {
    display: flex; align-items: center; gap: 8px; margin: 10px 0; cursor: pointer;
    background: var(--brand-light, #eef4ff); border: 1px dashed var(--primary); border-radius: 10px; padding: 10px 12px;
    font-size: 13px; font-weight: 600;
}
.pos-receipt-opt input { width: 17px; height: 17px; accent-color: var(--primary); }
.pos-receipt-opt small { display: block; color: var(--muted); font-weight: 400; }
.pos-pay { margin-top: 4px; }
.pos-clear { margin-top: 8px; text-align: center; }
.pos-done .pos-done-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.pos-scan-note { margin-top: 2px; }

/* Optional photo attachments on transactions */
.att-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.att-item { display: block; width: 72px; height: 72px; border: 1px solid var(--border, #d9dee7); border-radius: 8px; overflow: hidden; background: #fff; }
.att-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-compact .att-item { width: 34px; height: 34px; border-radius: 6px; }

/* POS full-screen app mode (no sidebar / topbar - a till, not a page) */
.pos-app-body { min-height: 100vh; }
.pos-app { display: flex; flex-direction: column; min-height: 100vh; }
.pos-appbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border);
}
.pos-appbar-brand { display: flex; align-items: center; gap: 10px; }
.pos-appbar-brand img { height: 30px; width: auto; }
.pos-appbar-title { font-weight: 800; font-size: 15px; line-height: 1.2; }
.pos-appbar-sub { font-size: 11px; color: var(--muted); }
.pos-appbar-actions { display: flex; align-items: center; gap: 8px; }
.pos-app-main { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 12px 16px 20px; }
/* use the full viewport height for the till */
.pos-app-body .pos-layout { align-items: stretch; }
.pos-app-body .pos-grid { max-height: calc(100vh - 250px); overflow: auto; padding: 2px; }
.pos-app-body .pos-lines { max-height: calc(100vh - 380px); }
@media (max-width: 760px) {
    .pos-appbar-lbl { display: none; }
    .pos-appbar-brand .pos-appbar-sub { display: none; }
    .pos-app-main { padding: 8px 10px 14px; }
}

.inline-form { display: inline; margin: 0; }

/* ==========================================================================
   v3 - professional report layout, logo rendering, table polish
   ========================================================================== */

/* --- Report masthead (top of every report screen) --- */
.report-mast {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    flex-wrap: wrap; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 20px; margin-bottom: 16px;
}
.report-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.report-brand img { height: 38px; width: auto; max-width: 170px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px 6px; }
.report-company { font-weight: 800; font-size: 15px; letter-spacing: -.2px; }
.report-address { color: #000; font-size: 11.5px; }
.report-heading { text-align: right; min-width: 0; }
.report-title { font-size: 19px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); }
.report-period { color: #000; font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.report-generated { color: #000; font-size: 11px; margin-top: 3px; }
.report-sep { width: 100%; height: 1px; background: #000; margin: 14px 0 0; }

/* --- Report toolbar (export buttons + filter summary) --- */
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.report-toolbar .filter-summary { margin-left: 0; }

/* --- Filter card tweaks --- */
.filter-card .card-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filter-card .filter-bar { margin: 0; }

/* --- Data table polish: zebra + sticky header + crisp alignment --- */
.data-table thead th { background: #fff; position: sticky; top: 0; z-index: 2; }
.data-table tbody tr:nth-child(even) { background: #fff; }
.data-table tbody tr:hover { background: #fff; }
.data-table td { color: #000; }
.data-table .ta-r, .data-table td.ta-r, .data-table th.ta-r { text-align: right; }
.data-table tfoot td { background: #fff; border-top: 1px solid #000; font-size: 12.5px; }
.data-table .mono { font-variant-numeric: tabular-nums; }

/* --- P&L statement styling --- */
.pl-table { width: 100%; }
.pl-table td { padding: 8px 12px; }
.pl-table tr.sub td { color: #000; }
.pl-table tr.total td { font-weight: 700; border-top: 1px solid #000; }
.pl-table tr.grand td { font-weight: 800; background: #fff; font-size: 15px; border-top: 2px solid #000; }

/* --- Consignment badge refinement --- */
.badge { border: 1px solid transparent; }

/* --- Small stat "delta" line for report summaries --- */
.stat-card .stat-hint { display: flex; align-items: center; gap: 4px; }

/* --- Chart containers --- */
.chart-svg { width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart-legend-col { flex-direction: column; gap: 6px; }
.chart-grid { stroke: #e2e8f0; stroke-width: 1; }
.chart-axis-x { fill: #64748b; font-size: 10px; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-axis-y { fill: #64748b; font-size: 10px; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-bar-label { fill: #334155; font-size: 10px; font-weight: 600; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-donut-total { fill: #1e293b; font-size: 22px; font-weight: 800; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-donut-cap { fill: #64748b; font-size: 9px; letter-spacing: 1px; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-empty { color: var(--muted); text-align: center; padding: 28px 0; font-size: 12.5px; }
.legend-row { display: flex; align-items: center; gap: 7px; }
.legend-row strong { margin-left: auto; color: var(--ink); }
.legend-row em { color: var(--muted); font-style: normal; font-size: 11px; width: 44px; text-align: right; }

/* --- Print-friendly for PDF-like on-screen view --- */
@media print {
    .sidebar, .topbar, .footer, .report-toolbar, .filter-card, .page-actions { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #cbd5e1; }
}

/* ==========================================================================
   v4 - v2.2: dark mode, mobile off-canvas, search, loading, contact FAB,
   confirmations, FAQ, professional grayscale reports, dashboard polish
   ========================================================================== */

/* --- semantic aliases (used by charts & dark theme) --- */
:root {
    --card-bg: #ffffff;
    --row-alt: #fafbfc;
    --row-hover: #eef4ff;
    --thead-bg: #f8fafc;
    --tfoot-bg: #eef2f7;
    --input-bg: #ffffff;
    --btn-bg: #ffffff;
    --hover-bg: #f8fafc;
    --code-bg: #f1f5f9;
}

/* --------------------------------------------------------------------------
   DARK MODE  (html[data-theme="dark"])
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
    --brand: #3b82f6;
    --brand-dark: #60a5fa;
    --brand-light: #1e3a5f;
    --emerald: #34d399;
    --emerald-dark: #10b981;
    --amber: #fbbf24;
    --red: #f87171;
    --violet: #a78bfa;
    --cyan: #22d3ee;
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --border: #1e293b;
    --border-light: #1e293b;
    --bg: #0f172a;
    --card: #141f36;
    --card-bg: #141f36;
    --sidebar-bg: #0b1220;
    --sidebar-ink: #e2e8f0;
    --sidebar-muted: #94a3b8;
    --sidebar-border: #16213b;
    --sidebar-hover: #16213b;
    --sidebar-active: #3b82f6;
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --primary-soft: #1e3a5f;
    --row-alt: #16213b;
    --row-hover: #1c2b4a;
    --thead-bg: #16213b;
    --tfoot-bg: #16213b;
    --input-bg: #0f1a2e;
    --btn-bg: #141f36;
    --hover-bg: #16213b;
    --code-bg: #1e293b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .6), 0 4px 10px -6px rgba(0, 0, 0, .5);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .report-mast,
html[data-theme="dark"] .error-box,
html[data-theme="dark"] .dash-range { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .card-head, html[data-theme="dark"] .card-body { border-color: var(--border); }
html[data-theme="dark"] .data-table thead th { background: #fff; color: #000; border-bottom-color: #000; }
html[data-theme="dark"] .data-table tbody tr:nth-child(even) { background: #fff; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #fff; }
html[data-theme="dark"] .data-table td { color: #000; border-bottom-color: #000; }
html[data-theme="dark"] .data-table tfoot td { background: #fff; border-top-color: #000; color: #000; }
html[data-theme="dark"] .btn { background: var(--btn-bg); border-color: #293548; color: var(--ink); }
html[data-theme="dark"] .btn:hover { background: var(--hover-bg); border-color: #3b475c; color: #fff; }
html[data-theme="dark"] .btn-ghost { background: transparent; color: var(--muted); }
html[data-theme="dark"] .form-row input[type=text], html[data-theme="dark"] .form-row input[type=password],
html[data-theme="dark"] .form-row input[type=number], html[data-theme="dark"] .form-row input[type=date],
html[data-theme="dark"] .form-row input[type=email], html[data-theme="dark"] .form-row select,
html[data-theme="dark"] .form-row textarea,
html[data-theme="dark"] .filter-bar select, html[data-theme="dark"] .filter-bar input[type=date],
html[data-theme="dark"] .filter-bar input[type=text], html[data-theme="dark"] .filter-bar input[type=number],
html[data-theme="dark"] .scan-box input[type=text], html[data-theme="dark"] .scan-box input[type=number] {
    background: var(--input-bg); border-color: #293548; color: var(--ink);
}
html[data-theme="dark"] .note { background: var(--input-bg); border-color: #293548; color: #cbd5e1; }
html[data-theme="dark"] .seg { background: var(--btn-bg); border-color: #293548; color: #cbd5e1; }
html[data-theme="dark"] .segmented { border-color: #293548; }
html[data-theme="dark"] .segmented a { background: var(--btn-bg); color: #cbd5e1; border-color: #293548; }
html[data-theme="dark"] .segmented a:hover { background: var(--hover-bg); }
html[data-theme="dark"] .quick-pick-item button { background: var(--btn-bg); border-color: #293548; color: var(--ink); }
html[data-theme="dark"] .quick-pick-item button:hover { border-color: var(--brand); background: var(--row-hover); }
html[data-theme="dark"] .pos-total { background: var(--primary-soft); }
html[data-theme="dark"] .pos-total-label, html[data-theme="dark"] .pos-total-value { color: #93c5fd; }
html[data-theme="dark"] .kv { border-color: var(--border); }
html[data-theme="dark"] code { background: var(--code-bg); color: #e2e8f0; }
html[data-theme="dark"] .invoice-head { border-color: #334155; }
html[data-theme="dark"] .chart-grid { stroke: #293548; }
html[data-theme="dark"] .chart-axis-x, html[data-theme="dark"] .chart-axis-y { fill: #94a3b8; }
html[data-theme="dark"] .chart-bar-label { fill: #cbd5e1; }
html[data-theme="dark"] .chart-donut-total { fill: #e2e8f0; }
html[data-theme="dark"] .chart-donut-cap { fill: #94a3b8; }
html[data-theme="dark"] .pl-table tr.grand td { background: #fff; border-top-color: #000; }
html[data-theme="dark"] .filter-summary { color: var(--muted); }
html[data-theme="dark"] .topbar-clock { color: var(--muted); }
html[data-theme="dark"] .dash-greeting p { color: var(--muted); }
html[data-theme="dark"] .form-row label { color: #cbd5e1; }
html[data-theme="dark"] .login-card { background: #ffffff; }
html[data-theme="dark"] .report-brand img, html[data-theme="dark"] .logo-preview img { background: #fff; }
html[data-theme="dark"] .error-box h1 { color: #fff; }
html[data-theme="dark"] .badge-gray { background: #293548; color: #cbd5e1; }
html[data-theme="dark"] .badge-green { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .badge-blue { background: #1e3a5f; color: #93c5fd; }
html[data-theme="dark"] .badge-amber { background: #451a03; color: #fcd34d; }
html[data-theme="dark"] .badge-red { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .badge-violet { background: #2e1065; color: #c4b5fd; }
html[data-theme="dark"] .badge-cyan { background: #164e63; color: #67e8f9; }
html[data-theme="dark"] .alert-success { background: #064e3b; color: #a7f3d0; }
html[data-theme="dark"] .alert-danger { background: #450a0a; color: #fecaca; }
html[data-theme="dark"] .alert-info { background: #1e3a5f; color: #bfdbfe; }
html[data-theme="dark"] .note-important { background: #1e3a5f; border-color: #1d4ed8; color: #bfdbfe; }
html[data-theme="dark"] .thumb { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; }

/* --------------------------------------------------------------------------
   TOPBAR / MOBILE controls
   -------------------------------------------------------------------------- */
.menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer; flex: none;
}
.menu-toggle:hover { background: var(--hover-bg); }
.menu-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .55);
    z-index: 40; display: none; backdrop-filter: blur(2px);
}
.menu-backdrop.show { display: block; }

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* --- dark mode toggle --- */
.theme-toggle {
    width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--card); color: var(--muted); font-size: 16px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.theme-toggle:hover { color: var(--ink); background: var(--hover-bg); }

/* --- app display settings (installed PWA only) --- */
.app-display-btn[hidden] { display: none; }
.app-display-pop {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 90;
    width: 264px; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px;
}
.app-display-head { font-weight: 800; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.app-display-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.app-display-scale { display: flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.app-display-scale button {
    width: 44px; height: 32px; border: 0; background: transparent; color: var(--muted);
    font-size: 12px; font-weight: 700; cursor: pointer;
}
.app-display-scale button + button { border-left: 1px solid var(--border); }
.app-display-scale button.active { background: var(--brand); color: #fff; }
.app-display-note { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.45; }

/* --- global search --- */
.search-wrap { position: relative; flex: 0 1 300px; min-width: 150px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 38px; }
.search-box i { color: var(--muted); font-size: 14px; }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; min-width: 0; }
.search-box input::placeholder { color: var(--muted); }
.search-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 80;
    display: none; padding: 6px 0;
}
.search-dropdown.show { display: block; }
.search-group-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 8px 14px 4px; font-weight: 700; }
.search-hit { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--ink); font-size: 13px; }
.search-hit:hover { background: var(--hover-bg); }
.search-hit i { color: var(--muted); width: 16px; text-align: center; }
.search-hit .search-hit-sub { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.search-empty { padding: 16px 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* --------------------------------------------------------------------------
   PAGE LOADING BAR
   -------------------------------------------------------------------------- */
#pageLoader {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300;
    overflow: hidden; pointer-events: none; opacity: 1; transition: opacity .3s;
}
#pageLoader::after {
    content: ''; display: block; height: 100%; width: 38%;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    animation: loaderSlide 1.1s linear infinite;
}
#pageLoader.done { opacity: 0; }
@keyframes loaderSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(420%); } }

.fade-in { animation: fadeIn .28s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   FLOATING CONTACT
   -------------------------------------------------------------------------- */
.contact-fab { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.contact-fab-main {
    width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--brand); color: #fff; font-size: 22px; display: inline-flex;
    align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
.contact-fab-main:hover { background: var(--brand-dark); }
.contact-pop {
    display: none; background: var(--card); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-lg); padding: 10px; min-width: 230px;
    animation: fadeIn .18s ease both;
}
.contact-pop.show { display: block; }
.contact-pop-title { font-weight: 800; font-size: 13.5px; padding: 6px 10px 8px; }
.contact-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--ink); }
.contact-link:hover { background: var(--hover-bg); color: var(--ink); }
.contact-link i { width: 20px; text-align: center; font-size: 15px; color: var(--brand); }

/* --------------------------------------------------------------------------
   CONFIRM DIALOG
   -------------------------------------------------------------------------- */
.confirm-overlay {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 200;
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.confirm-overlay.show { display: flex; }
.confirm-box {
    background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg);
    padding: 22px 24px; max-width: 420px; width: 100%; border: 1px solid var(--border);
}
.confirm-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.confirm-title i { color: var(--red); }
.confirm-msg { color: var(--muted); font-size: 13px; margin-bottom: 18px; line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* --------------------------------------------------------------------------
   PROFESSIONAL GRAYSCALE REPORTS  (report_* pages)
   -------------------------------------------------------------------------- */
body.report-body .report-period { color: #000; }
body.report-body .report-mast { border-color: #000; }
body.report-body .report-sep { background: #cbd5e1; }
body.report-body .stat-card { border-left-color: #cbd5e1 !important; }
body.report-body .stat-card .stat-icon { background: #eef2f7 !important; color: #334155 !important; }
body.report-body .badge { background: #eef2f7 !important; color: #334155 !important; border-color: #d1d5db !important; }
body.report-body .btn-primary { background: #111827; border-color: #111827; color: #fff; }
body.report-body .btn-primary:hover { background: #1f2937; border-color: #1f2937; }
body.report-body .pl-table tr.grand td { background: #eef2f7; border-top-color: #334155; }
body.report-body .data-table thead th { background: #fff; }
body.report-body .data-table tfoot td { background: #fff; border-top-color: #000; }
body.report-body .filter-card, body.report-body .report-toolbar { color: #334155; }
html[data-theme="dark"] body.report-body .report-period { color: #000; }
html[data-theme="dark"] body.report-body .report-mast { border-color: #000; }
html[data-theme="dark"] body.report-body .stat-card { border-left-color: #475569 !important; }
html[data-theme="dark"] body.report-body .stat-card .stat-icon { background: #1e293b !important; color: #cbd5e1 !important; }
html[data-theme="dark"] body.report-body .badge { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }
html[data-theme="dark"] body.report-body .btn-primary { background: #e2e8f0; border-color: #e2e8f0; color: #0f172a; }
html[data-theme="dark"] body.report-body .pl-table tr.grand td { background: #1e293b; border-top-color: #94a3b8; }

/* --------------------------------------------------------------------------
   AI REPORT (chat-style assistant)
   -------------------------------------------------------------------------- */
.ai-hero { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.ai-hero-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.ai-hero h2 { font-size: 17px; margin: 0 0 2px; }
.ai-hero p { color: var(--muted); font-size: 12.5px; margin: 0; }
.ai-input-row { display: flex; gap: 8px; margin: 14px 0; }
.ai-input-row input[type=text] { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: var(--input-bg); color: var(--ink); outline: none; }
.ai-input-row input[type=text]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ai-chip { border: 1px solid var(--border); background: var(--card); color: var(--ink); border-radius: 20px; padding: 6px 13px; font-size: 12.5px; cursor: pointer; }
.ai-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--primary-soft); }
.ai-answer { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--card); margin-bottom: 16px; }
.ai-answer-q { font-size: 13px; color: var(--muted); margin-bottom: 10px; font-style: italic; }
.ai-answer-head { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.ai-answer-delta { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.ai-answer .data-table { margin-top: 10px; }
.ai-note { font-size: 11.5px; color: var(--muted); margin-top: 14px; }

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */
.faq-list { display: grid; gap: 12px; }
.faq-item { border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.faq-q { width: 100%; text-align: left; background: transparent; border: 0; padding: 14px 18px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.faq-q i { transition: transform .2s; color: var(--muted); }
.faq-item.open .faq-q i { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 18px 16px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.faq-item.open .faq-a { display: block; }
.faq-a a { color: var(--brand); }

/* --------------------------------------------------------------------------
   BACKUP page
   -------------------------------------------------------------------------- */
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.backup-note { font-size: 12px; color: var(--muted); }
.backup-file { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.backup-file:last-child { border-bottom: 0; }

/* --------------------------------------------------------------------------
   DASHBOARD polish (smaller charts, more data)
   -------------------------------------------------------------------------- */
.dash-stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 1000px) { .dash-stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .dash-stat-grid { grid-template-columns: 1fr; } }
.dash-quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dash-quick-action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; }
.dash-quick-action i { font-size: 18px; color: var(--brand); }
.dash-quick-action:hover { border-color: var(--brand); background: var(--primary-soft); color: var(--ink); }

/* --- responsive tweaks for phones --- */
@media (max-width: 640px) {
    .topbar { padding: 12px 12px 0; }
    .topbar-clock { display: none; }
    .content { padding: 12px 12px 28px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card .stat-value { font-size: 19px; }
    .grid-2 { gap: 0 0; }
    .page-title { font-size: 18px; }
    .search-wrap { flex: 1; }
    .report-mast { padding: 12px 14px; }
    .report-brand img { height: 30px; }
    .dash-main-grid { grid-template-columns: 1fr; }
    .pos-layout { grid-template-columns: 1fr; }
    .contact-fab { right: 12px; bottom: 12px; }
    .quick-pick { grid-template-columns: 1fr 1fr; }
    .filter-bar label { width: 100%; }
    .btn { white-space: normal; }
}


/* ---------- Floating AI Report Assistant ---------- */
.ai-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 1200;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: var(--shadow-lg);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab.active { background: var(--primary-dark); }
.ai-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 1200;
  width: min(440px, calc(100vw - 32px)); height: min(580px, calc(100vh - 140px));
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); display: none; flex-direction: column;
  overflow: hidden;
}
.ai-panel.open { display: flex; }
.ai-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--border-light); flex: 0 0 auto;
}
.ai-panel-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ai-panel-title i { color: var(--brand); }
.ai-panel-close { background: none; border: none; font-size: 15px; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.ai-panel-close:hover { color: var(--ink); background: rgba(0, 0, 0, .06); }
.ai-panel-body { position: relative; flex: 1 1 auto; min-height: 0; }
.ai-panel-body iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--card); }
.ai-panel-loader { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; background: var(--card); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-embed-body { background: var(--card); color: var(--ink); font-size: calc(14px * var(--app-scale)); padding: 12px; }
.ai-embed-body .ai-input-row { margin-top: 10px; }
@media (max-width: 640px) {
  .ai-fab { right: 14px; bottom: 14px; width: 50px; height: 50px; font-size: 21px; }
  .ai-panel { right: 10px; left: 10px; bottom: 76px; width: auto; height: min(72vh, 600px); }
}


/* Baobab greeting strip (embedded assistant) */
.ai-embed-hello {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--ink);
  padding: 10px 12px; margin: -12px -12px 12px -12px;
  background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.ai-embed-hello i { color: var(--brand); }

/* ============================================================================
 * SECURITY HARDENING — approval notes & before/after change display
 * ========================================================================= */
.note-approval {
  background: #fffbeb; border-color: #f59e0b; color: #78350f;
}
html[data-theme="dark"] .note-approval {
  background: #3b2f14; border-color: #b45309; color: #fcd34d;
}
.change-old { color: var(--muted); text-decoration: line-through; }
.change-new { color: #0f7b0f; font-weight: 600; }
html[data-theme="dark"] .change-new { color: #4ade80; }

/* Security Center */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.sec-stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; align-items: flex-start; gap: 11px; }
html[data-theme="dark"] .sec-stat { background: var(--card-bg); border-color: #293548; }
.sec-stat-high { border-color: #fca5a5; background: #fef2f2; }
html[data-theme="dark"] .sec-stat-high { border-color: #7f1d1d; background: #2a1215; }
.sec-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #475569; font-size: 15.5px;
}
html[data-theme="dark"] .sec-ico { background: #1e293b; color: #94a3b8; }
.sec-stat-high .sec-ico { background: #fee2e2; color: #b91c1c; }
html[data-theme="dark"] .sec-stat-high .sec-ico { background: #450a0a; color: #fca5a5; }
.sec-stat .sec-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.sec-stat .sec-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sec-stat .sec-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.sec-hint { font-size: 12px; color: var(--muted); }
.sec-high { color: #b42318; }
html[data-theme="dark"] .sec-high { color: #f87171; }
.sec-med { color: #b45309; }
html[data-theme="dark"] .sec-med { color: #fbbf24; }
.sec-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.diff-low { color: #b91c1c; font-weight: 600; white-space: nowrap; }
.diff-high { color: #047857; font-weight: 600; white-space: nowrap; }
html[data-theme="dark"] .diff-low { color: #fca5a5; }
html[data-theme="dark"] .diff-high { color: #6ee7b7; }
.fc-table td.field-cell { font-weight: 600; white-space: nowrap; }

/* ---- v11: bell, notifications, security triage, trackers ---- */
.theme-toggle { position: relative; }
.bell-badge {
  position: absolute; top: 6px; right: 4px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: #dc2626; color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; padding: 0 4px;
}
.row-unread td { background: #fffbeb; }
.btn-ok { background: #059669; border-color: #059669; color: #fff; }
.btn-ok:hover { background: #047857; color: #fff; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.concern-form { display: flex; gap: 4px; flex-direction: column; }
.concern-form input[type="text"] { width: 100%; box-sizing: border-box; padding: 4px 6px; font-size: 12px; }
.concern-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.concern-actions .btn { padding: 3px 8px; font-size: 11.5px; }
.sec-hint { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.small { font-size: 12px; }
table.data-table td.r { text-align: right; }
table.data-table th.r { text-align: right; }
.page-actions-right { display: flex; gap: 6px; align-items: center; }
.page-actions-right .btn { margin: 0; }

/* ==========================================================================
   v13d: missing-class fixes — every class referenced in templates is defined
   ========================================================================== */

/* --- generic form container (used by login, profile, settings, store auth) --- */
.form { display: flex; flex-direction: column; gap: 0; }
.form .form-row { margin-bottom: 14px; }

/* --- button variants referenced in templates --- */
.btn-light { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
.btn-light:hover { background: #e2e8f0; border-color: #cbd5e1; color: #0f172a; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.export-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* --- badge aliases used across reseller/portal pages --- */
.badge-success { background: #d1fae5; color: #047857; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }

/* --- stat card body (portal + admin) --- */
.stat-body { min-width: 0; }

/* --- key-value table (approvals, item history) --- */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv-table td:first-child { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; width: 38%; }
.kv-table td:last-child { color: var(--ink); font-size: 13px; }
.kv-table tr:last-child td { border-bottom: 0; }
.kv-table .raw-payload { font-family: Consolas, "Courier New", monospace; font-size: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; }
.kv-table .raw-payload pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* --- simple list rows (portal dashboard pending transfers) --- */
.row-list { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row-list:last-child { border-bottom: 0; }

/* --- edit toggle (details/summary inline edit) --- */
.edit-toggle { display: inline-block; position: relative; }
.edit-toggle summary { cursor: pointer; list-style: none; }
.edit-toggle summary::-webkit-details-marker { display: none; }
.edit-toggle summary::after { content: ' ▾'; color: var(--muted); }
.edit-toggle[open] summary::after { content: ' ▴'; }
.edit-toggle .edit-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 320px; }

/* --- login back link (staff + portal) --- */
.login-back { margin-bottom: 14px; }
.login-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.login-back a:hover { color: var(--brand); }

/* --- dashboard wide layout --- */
.dash-main-wide { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1200px) { .dash-main-wide.dash-with-side { grid-template-columns: 1.6fr 1fr; } }

/* --- POS stock level tones --- */
.pos-stock-low { color: #b45309; font-weight: 700; }
.pos-stock-out { color: #dc2626; font-weight: 700; }

/* --- POS topbar --- */
.topbar-pos { display: flex; align-items: center; gap: 10px; }
.pos-appbar-btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pos-appbar-btn:hover { border-color: var(--brand); color: var(--brand); }

/* --- barcode / label svg container --- */
.barcode-svg { display: block; background: #fff; }

/* --- chart legends --- */
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* --- sale line rows (portal POS-like tables) --- */
.sale-line td { vertical-align: middle; }
.line-remove { cursor: pointer; }
.table .qty, .table .tr-qty { text-align: right; }

/* --- welcome page (auth) minimal shell --- */
.welcome { max-width: 560px; margin: 0 auto; padding: 48px 20px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.welcome-logo { text-align: center; margin-bottom: 18px; }
.welcome-logo img { max-height: 64px; object-fit: contain; }
.welcome-name { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.welcome-tag { color: var(--muted); margin-top: 4px; }
.welcome-hero { text-align: center; margin: 10px 0 28px; }
.welcome-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
@media (max-width: 620px) { .welcome-feats { grid-template-columns: 1fr; } }
.welcome-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.welcome-staff { text-align: center; margin-top: 18px; font-size: 12.5px; }
.welcome-store-btn { text-align: center; margin-top: 14px; }
.welcome-foot { text-align: center; color: #94a3b8; font-size: 11.5px; margin-top: 28px; }
.welcome-legal { text-align: center; color: #94a3b8; font-size: 10.5px; margin-top: 10px; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* --- store mode toggle (small select) --- */
.store-mode-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; background: #fff; color: var(--ink); }
