/* 1. GLOBAL VARIABLES (The Design System) */
:root {
    --bg-color: #f5f5f7; /* Apple's soft gray */
    --surface-color: #ffffff; /* Pure white for cards */
    --text-primary: #1d1d1f; /* Almost black */
    --text-secondary: #86868b; /* Soft gray text */
    --accent-blue: #0066cc; /* Primary action color */
    --danger-color: #ff3b30; /* iOS red — destructive / refund actions */
    --sidebar-width: 250px;
    --sidebar-padding: 32px 24px;
    --sidebar-item-padding: 14px 18px;
    --sidebar-item-radius: 10px;
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. BASE STYLES */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* Global media safeguard — prevents any image / video / inline SVG from
   ever exceeding its container and causing horizontal overflow. Named CSS
   classes that set explicit dimensions (e.g. .nav-icon, .toggle-icon) take
   precedence over these defaults due to higher specificity. */
img,
video {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* SVG-specific containment. Inline SVGs without explicit width/height
   attributes (e.g. hero illustrations) are capped to their container.
   Icon SVGs (.nav-icon etc.) override this via their own class rules. */
svg {
    max-width: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    /* Disable the rubber-band / pull-to-refresh on the document so the app
       feels like a native shell. Inner scroll containers (tables, modals)
       still scroll normally. */
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

/* Must also be on html — some browsers (Chrome Android, Samsung Internet)
   only honour overscroll-behavior-y on the root element, not body. */
html {
    overscroll-behavior-y: none;
}

/* 2b. APP-LIKE PHYSICS  ::  PWA / TOUCH POLISH
   --------------------------------------------------------------
   Strips the residual web-browser feel from interactive chrome:
     - Kills the blue tap-flash on every clickable surface.
     - Disables accidental text selection on UI shell elements
       (sidebar, top-bar, buttons, panel headers) while EXPLICITLY
       re-enabling selection inside content-bearing elements
       (inputs, tables, paragraphs, [contenteditable]).
   Selectors are tight so we never strip selection from real
   user content (receipts, customer notes, ledger rows).
*/
a,
button,
[role="button"],
input[type="button"],
input[type="submit"],
.nav-links,
.nav-links li,
.nav-links a,
.nav-icon,
.toggle-icon,
.btn-text,
.btn-icon,
.close-btn,
.qty-btn,
.metric-card,
.card-panel {
    -webkit-tap-highlight-color: transparent;
}

.sidebar,
.top-bar,
.nav-links,
.nav-links li,
.modal-header,
.panel-header,
.dialog-actions,
.legend-pills,
.btn-text,
.btn-icon,
.close-btn,
.qty-btn,
button {
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
}

/* Re-enable selection for anything the user actually needs to
   copy (search box, modal inputs, table cells, contenteditable).
   .selectable-text is an escape hatch for any inline content that
   should remain copyable (receipts, customer notes, etc.). */
input,
textarea,
select,
table,
.dialog-input,
.selectable-text,
[contenteditable="true"] {
    -webkit-user-select: text;
       -moz-user-select: text;
        -ms-user-select: text;
            user-select: text;
}

/* 3. LAYOUT STRUCTURE */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 4. THE SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid #e5e5ea;
    padding: var(--sidebar-padding);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.logo h2 {
    font-size: 20px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.logo p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    white-space: nowrap;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    display: block;
}

.nav-links li {
    padding: var(--sidebar-item-padding);
    border-radius: var(--sidebar-item-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
}

/* Supports both link markup styles:
   1) <a><li><svg/><span/></li></a>  -> the <li> is the visual button
   2) <li><a><svg/><span/></a></li>  -> the <a> is the visual content row */
.nav-links li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: inherit;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.nav-links a:hover li,
.nav-links li:hover {
    background-color: #f5f5f7;
    color: var(--text-primary);
}

/* Supports both markup styles:
   1) <a class="active"><li>...</li></a>
   2) <li class="active"><a>...</a></li>
*/
.nav-links a.active li,
.nav-links li.active {
    background-color: var(--accent-blue);
    color: #ffffff;
}

.nav-links li.active a {
    color: #ffffff;
}

/* 5. MAIN CONTENT & TOP BAR */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 70px;
    background-color: var(--surface-color);
    border-bottom: 1px solid #e5e5ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.search-box input {
    width: 100%;
    max-width: 300px;
    padding: 10px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent-blue);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 6. DASHBOARD AREA */
.dashboard-content {
    padding: 40px;
    overflow-y: auto;
}

.dashboard-content h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.dashboard-content p {
    color: var(--text-secondary);
}

/* 7. DASHBOARD METRICS GRID */
.metrics-grid {
    display: grid;
    /* This automatically makes the cards responsive on smaller screens */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.metric-card {
    background-color: var(--surface-color);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0f0f2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* This creates the smooth Apple-style float effect when you hover over a card */
.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.metric-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 12px;
}

.metric-card h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Styling the trend indicators (the small colored boxes) */
.trend {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.trend.positive {
    background-color: #e3f5eb;
    color: #1a7a4c;
}

.trend.negative {
    background-color: #feecee;
    color: #c92a2a;
}

.trend.neutral {
    background-color: #f5f5f7;
    color: var(--text-secondary);
}

/* Makes the alert card stand out slightly */
.metric-card.alert {
    border: 1px solid #feecee;
}

/* 8. DASHBOARD COLUMNS (Chart & Feed) */
.dashboard-columns {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Chart takes up 2/3, Feed takes 1/3 */
    gap: 24px;
    margin-top: 24px;
}

.card-panel {
    background-color: var(--surface-color);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #f0f0f2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}
.chart-container {
    position: relative;
    height: 350px; /* Forces the chart to render at exactly this height */
}

.feed-container {
    height: 350px; /* Matches the chart height */
    overflow-y: auto; /* Adds a scrollbar only if the feed gets too long */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-weight: 500;
    cursor: pointer;
}

/* 9. THE ACTION FEED */
.action-feed {
    list-style: none;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f2;
}

.feed-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.feed-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.feed-icon.sale { background-color: var(--accent-blue); }
.feed-icon.stock { background-color: #1a7a4c; } /* Green */
.feed-icon.alert { background-color: #c92a2a; } /* Red */

.feed-text p {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.feed-text span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* =========================================
   10. POINT OF SALE (POS) STYLES
   ========================================= */
.pos-mode {
    background-color: #e5e5ea; /* Slightly darker background for the POS */
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* TOP BAR */
.pos-top-bar {
    height: 70px;
    background-color: var(--surface-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 10;
}

.pos-branding {
    display: flex;
    align-items: center;
    gap: 24px;
}

.back-btn {
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 500;
}

.pos-search input {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    border: 2px solid var(--accent-blue); /* Highlights the scanner focus */
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

/* SPLIT SCREEN LAYOUT */
.pos-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* LEFT PANEL: THE CART */
.pos-cart-panel {
    width: 400px;
    background-color: var(--surface-color);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #d2d2d7;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
    overscroll-behavior: contain;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f2;
}

.item-details h4 {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.item-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.item-qty {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f5f5f7;
    border-radius: 8px;
    padding: 4px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background-color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.item-total {
    font-weight: 600;
    font-size: 15px;
}

/* CART SUMMARY & PAY BUTTON */
.cart-summary {
    background-color: #f5f5f7;
    padding: 24px;
    border-top: 1px solid #d2d2d7;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.summary-line.grand-total {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    margin-top: 16px;
    margin-bottom: 24px;
    padding-top: 16px;
    border-top: 1px dashed #c7c7cc;
}

.pay-btn {
    width: 100%;
    background-color: #1a7a4c; /* High-contrast Green for Money */
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pay-btn:hover {
    background-color: #14613c;
}

/* RIGHT PANEL: QUICK KEYS */
.products-panel {
    min-height: 0;
    overflow: hidden;
}

.pos-quick-keys {
    flex: 1;
    padding: 24px;
    display: grid;
    /* 120px minimum lets buttons shrink on tablets/small laptops without
       collapsing the grid to 2 columns prematurely. */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    align-content: start;
    overflow-y: auto;
    min-height: 0;
    overscroll-behavior: contain;
}

/* Slim scrollbar for both internal scroll panels */
.pos-quick-keys::-webkit-scrollbar,
.cart-items::-webkit-scrollbar {
    width: 4px;
}

.pos-quick-keys::-webkit-scrollbar-track,
.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.pos-quick-keys::-webkit-scrollbar-thumb,
.cart-items::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.pos-quick-keys::-webkit-scrollbar-thumb:hover,
.cart-items::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28);
}

/* Ghost button shown when the render limit hides items */
.quick-key--ghost {
    cursor: default;
    opacity: 0.6;
    border-style: dashed;
    background: transparent;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.quick-key {
    background-color: var(--surface-color);
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    height: 120px;
    transition: all 0.1s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.quick-key:active {
    transform: scale(0.96);
    background-color: #f5f5f7;
}

.key-price {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.key-name {
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 500;
}
/* =========================================
   11. INVENTORY LEDGER & TABLES
   ========================================= */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Cluster primary + outline actions on the inventory ledger header */
.ledger-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 6px;
    line-height: 1.4;
}

/* Wider modal + scroll region for many scanned invoice lines */
.invoice-review-modal {
    width: min(960px, 96vw);
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.invoice-review-modal .modal-header {
    flex-shrink: 0;
    align-items: flex-start;
}

.invoice-review-modal .modal-header h3 {
    margin: 0;
}

.invoice-review-table-wrap {
    flex: 1;
    min-height: 120px;
    max-height: min(52vh, 480px);
    overflow: auto;
    margin-bottom: 20px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
}

.invoice-scan-table {
    margin: 0;
}

.invoice-scan-table th,
.invoice-scan-table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.invoice-scan-table input[type="text"],
.invoice-scan-table input[type="number"] {
    width: 100%;
    min-width: 72px;
    padding: 8px 10px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
}

.invoice-scan-table .btn-delete {
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #0055aa;
}

.table-container {
    overflow-x: auto;
    padding: 0; /* Override the default card padding for flush tables */
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.inventory-table th, .inventory-table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f2;
}

.inventory-table th {
    background-color: #f9f9fb;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inventory-table td {
    font-size: 14px;
    color: var(--text-primary);
}

.inventory-table tbody tr:hover {
    background-color: #fcfcfd;
}

/* =========================================
   12. POP-UP MODALS
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex; /* Shows the modal when this class is added */
}

.modal-content {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 450px;
    margin: 0 16px;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-btn {
    background: none; border: none;
    font-size: 24px; cursor: pointer; color: var(--text-secondary);
}

.modal-form .form-group {
    margin-bottom: 16px;
}

.modal-form label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 8px;
}

.modal-form input {
    width: 100%; padding: 12px;
    border: 1px solid #d2d2d7; border-radius: 8px;
    font-size: 14px; outline: none;
}

.modal-form input:focus {
    border-color: var(--accent-blue);
}

.form-row {
    display: flex; gap: 16px;
}

.full-width {
    width: 100%; margin-top: 16px;
}

/* =========================================
   13. FINANCIAL BOOKS (ACCOUNTING)
   ========================================= */
   
/* Cash Flow Pipeline */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.pipeline-card {
    padding: 24px;
    border-radius: 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.pipeline-card.incoming {
    background-color: #1a7a4c; /* Deep Green */
}

.pipeline-card.bank {
    background-color: var(--accent-blue); /* Primary Blue */
}

.pipeline-card.outgoing {
    background-color: #c92a2a; /* Deep Red */
}

.pipeline-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.9);
}

.pipeline-card p {
    font-size: 13px;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.7);
}

.pipeline-card h2 {
    font-size: 32px;
}

/* Financial Columns */
.financial-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.finance-list {
    list-style: none;
    margin-top: 16px;
}

.finance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f2;
}

.finance-item:last-child {
    border-bottom: none;
}

.finance-details strong {
    display: block;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.finance-details span {
    font-size: 13px;
    color: var(--text-secondary);
}

.finance-action {
    display: flex;
    align-items: center;
    gap: 16px;
}

.amount {
    font-weight: 600;
    font-size: 16px;
}

.text-green { color: #1a7a4c; }
.text-red { color: #c92a2a; }

.btn-outline {
    background: transparent;
    border: 1px solid #d2d2d7;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
}

.btn-outline:hover {
    background: #f5f5f7;
}

.btn-primary-small {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary-small:hover {
    background-color: #0055aa;
}

/* =========================================
   26. PUBLIC LANDING PAGE
   ========================================= */
.landing-body {
    background-color: #fbfbfd;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Landing Navigation */
.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.3s ease;
}

.landing-nav.scrolled-nav {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 14px 5%;
}

.landing-logo h2 {
    font-size: 24px;
    letter-spacing: -1px;
    font-weight: 800;
}

.landing-nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.landing-nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.landing-nav-links a:hover {
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 80px 5% 0;
    max-width: 1100px;
    margin: 0 auto;
}

.hero-badge {
    background-color: #e5f0fa;
    color: var(--accent-blue);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    display: inline-block;
}

.hero-title {
    font-size: 64px;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 24px;
    font-weight: 800;
    color: #1d1d1f;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 650px;
    margin: 0 auto 32px auto;
    text-align: center;
}

/* Google Sign-In Button */
.hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.btn-google {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #ffffff;
    color: #3c4043;
    font-size: 16px;
    font-weight: 500;
    padding: 14px 24px;
    border-radius: 8px;
    border: 1px solid #dadce0;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: background-color 0.2s, box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-google:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Hero Screenshot — intro animation on page load */
@keyframes heroImageReveal {
    from {
        opacity: 0;
        transform: translateY(32px) scale(1.04);
    }
    to {
        opacity: 1;
        transform: translateY(20px) scale(1);
    }
}

.hero-image-wrapper {
    max-width: 1000px;
    width: 100%;
    margin: 48px auto 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    animation: heroImageReveal 1.5s var(--ease-spring) 0.2s both;
}

.hero-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.8s var(--ease-spring);
}

.hero-image-wrapper:hover img {
    transform: scale(1.015);
}

/* Features / Showcase Section */
.features-section {
    padding: 120px 5% 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.showcase-heading {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #1d1d1f;
    margin-bottom: 72px;
}

/* Z-Pattern Showcase */
.showcase-container {
    max-width: 1100px;
    margin: 0 auto;
}

.showcase-row {
    display: flex;
    align-items: center;
    gap: 60px;
    margin-bottom: 96px;
}

.showcase-row:nth-child(even) {
    flex-direction: row-reverse;
}

.showcase-row:last-child {
    margin-bottom: 0;
}

/* Text half */
.showcase-text {
    flex: 1;
}

.showcase-label {
    display: block;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.showcase-text h3 {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.25;
    color: #1d1d1f;
    margin-bottom: 18px;
}

.showcase-text p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.75;
}

/* Image half */
.showcase-image {
    flex: 1;
}

.showcase-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.7s var(--ease-spring), box-shadow 0.7s var(--ease-spring);
}

.showcase-image:hover img {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.13);
}

/* ==========================================================
   SCROLL ANIMATION ENGINE
   reveal-up  — hidden baseline; .is-visible triggers entry.
   delay-*    — stagger siblings without extra JS.
   ========================================================== */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s var(--ease-spring), transform 1s var(--ease-spring);
    will-change: opacity, transform;
}

.reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

/* When reveal-up also carries a delay, keep the delay at 0
   once it has become visible so re-triggering feels instant. */
.reveal-up.is-visible.delay-100,
.reveal-up.is-visible.delay-200,
.reveal-up.is-visible.delay-300,
.reveal-up.is-visible.delay-400,
.reveal-up.is-visible.delay-500 {
    /* delay is intentionally NOT reset — it fires once and is
       removed from the IntersectionObserver, so this is a no-op. */
}

/* Mobile: stack all rows vertically */
@media screen and (max-width: 850px) {
    .showcase-row,
    .showcase-row:nth-child(even) {
        flex-direction: column !important;
        gap: 32px;
        margin-bottom: 64px;
    }

    .showcase-text h3 {
        font-size: 24px;
    }

    .showcase-heading {
        font-size: 28px;
        margin-bottom: 48px;
    }
}

/* ==========================================================
   OUR STORY SECTION
   ========================================================== */
.story-section {
    padding: 100px 20px;
    background: #fcfcfd;
    text-align: center;
}

.story-container {
    max-width: 800px;
    margin: 0 auto;
}

.story-overline {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 20px;
}

.story-heading {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 28px;
}

.story-body {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.8;
}

@media screen and (max-width: 850px) {
    .story-heading {
        font-size: 28px;
    }

    .story-body {
        font-size: 16px;
    }
}

/* ==========================================================
   PRICING SECTION
   ========================================================== */
.pricing-section {
    padding: 100px 20px;
    background: var(--bg-color);
    text-align: center;
}

.pricing-header {
    margin-bottom: 56px;
}

.pricing-heading {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.pricing-subheading {
    font-size: 16px;
    color: var(--text-secondary);
}

.pricing-grid {
    display: grid;
    /* auto-fit collapses empty tracks so cards naturally wrap at ~300px each.
       This replaces the rigid 3-column layout and handles the "missing middle"
       (tablets / small laptops) without a dedicated media query override. */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: center;
}

.pricing-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 40px 36px;
    text-align: left;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.pricing-card.featured {
    border-top: 4px solid var(--accent-blue);
    box-shadow: 0 8px 40px rgba(0, 102, 204, 0.15);
    transform: scale(1.05);
}

.pricing-card.featured:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 20px 56px rgba(0, 102, 204, 0.2);
}

.pricing-badge {
    display: inline-block;
    background: #e8f2ff;
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.pricing-plan-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.pricing-amount-wrapper {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 28px;
}

.pricing-currency {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-value {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    color: var(--text-primary);
}

.pricing-period {
    font-size: 16px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.pricing-features {
    list-style: none;
    margin-bottom: 32px;
}

.pricing-features li {
    font-size: 15px;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-left: 24px;
    position: relative;
}

.pricing-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
    font-weight: 700;
}

.pricing-cta {
    width: 100%;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

@media screen and (max-width: 850px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .pricing-card.featured {
        transform: scale(1);
        order: -1;
    }

    .pricing-card.featured:hover {
        transform: translateY(-4px);
    }

    .pricing-card {
        width: 100%;
        max-width: 380px;
    }

    .pricing-heading {
        font-size: 28px;
    }
}

/* Loading Overlay for Auth */
.auth-loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.auth-loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f2;
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   15. SETTINGS PANEL & FORMS
   ========================================= */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.settings-card {
    padding: 32px;
}

.settings-header {
    border-bottom: 1px solid #f0f0f2;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.settings-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Reusing modal form styles for settings */
.settings-card .form-group {
    margin-bottom: 20px;
}

.settings-card label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 8px;
}

.settings-card input, .settings-select {
    width: 100%; padding: 12px;
    border: 1px solid #d2d2d7; border-radius: 8px;
    font-size: 14px; outline: none;
    background-color: #ffffff;
}

.settings-card input:focus, .settings-select:focus {
    border-color: var(--accent-blue);
}

/* Danger Zone Styles */
.danger-zone {
    border: 1px solid #feecee;
}

.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.danger-action h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.danger-action.border-top {
    border-top: 1px dashed #d2d2d7;
    padding-top: 24px;
    margin-bottom: 0;
}

.btn-danger {
    background-color: #c92a2a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background-color: #a02020;
}
/* =========================================
   16. GLOBAL LEADERBOARD & PODIUM
   ========================================= */

/* Toggle Switch (Branches vs Staff) */
.toggle-switch {
    display: flex;
    background-color: #f5f5f7;
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* The Podium Layout */
.podium-section {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin-top: 40px;
    margin-bottom: 48px;
    height: 300px;
}

.podium-spot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
}

.podium-spot h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 4px;
}

.podium-spot p {
    font-size: 13px;
    color: #1a7a4c; /* Green for hitting targets */
    font-weight: 500;
    margin-bottom: 16px;
}

/* The Colored Rank Badges */
.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.gold { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
.silver { background: linear-gradient(135deg, #e2ebf0 0%, #cfd9df 100%); color: #333; }
.bronze { background: linear-gradient(135deg, #e4a972 0%, #9941d8 100%); } /* Warm bronze/purple */

/* The Podium Blocks */
.podium-block {
    width: 100%;
    background-color: var(--surface-color);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 16px;
    font-weight: 700;
    color: var(--accent-blue);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.03);
    border: 1px solid #f0f0f2;
    border-bottom: none;
}

/* Different heights for 1st, 2nd, and 3rd */
.step-1 { height: 160px; background-color: #ffffff; border-color: #f6d365; }
.step-2 { height: 120px; }
.step-3 { height: 80px; }

/* Rankings Table */
.rankings-table {
    max-width: 800px;
    margin: 0 auto;
}

.rank-number {
    font-weight: 700;
    color: var(--text-secondary);
    margin-right: 16px;
    width: 20px;
}
/* 17. INVENTORY ACTIONS */
.action-buttons {
    display: flex;
    gap: 8px;
}
.btn-edit {
    background: transparent;
    border: none;
    color: var(--accent-blue); /* Blue for Edit */
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-edit:hover {
    text-decoration: underline;
}

.btn-delete {
    background: transparent;
    border: none;
    color: #c92a2a; /* Red */
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-delete:hover {
    text-decoration: underline;
}
/* =========================================
   18. EXPANDABLE DETAILS & ADVANCED FORMS
   ========================================= */

/* The Chevron Button on the Table */
.chevron-btn {
    background: transparent;
    border: none;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: transform 0.2s, background-color 0.2s;
}

.chevron-btn:hover {
    background-color: #f0f0f2;
    color: var(--text-primary);
}

/* Rotates the arrow when open */
.chevron-btn.open {
    transform: rotate(180deg);
}

/* The Hidden Details Drawer */
.details-row {
    background-color: #fbfbfd;
}

.details-card {
    padding: 16px 24px;
    border-left: 3px solid var(--accent-blue); /* Visual indicator */
    margin: 8px 24px 16px 24px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border: 1px solid #e5e5ea;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
}

.details-grid h5 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.details-grid p {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Advanced Settings Toggle in Form */
.advanced-toggle {
    margin-top: 8px;
    margin-bottom: 16px;
    text-align: center;
}

.advanced-toggle span {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-blue);
    cursor: pointer;
    padding: 8px;
}

.advanced-toggle span:hover {
    text-decoration: underline;
}

.modal-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.modal-form textarea:focus {
    border-color: var(--accent-blue);
}
/* =========================================
   19. ADVANCED ANALYTICS DASHBOARD
   ========================================= */
.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
    margin-bottom: 40px;
}

.full-width {
    width: 100%;
}

.legend-pills {
    display: flex;
    gap: 12px;
}

.pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.pill.historical { background: #f0f0f2; color: var(--text-primary); }
.pill.positive { background: #e3f5eb; color: #1a7a4c; }
.pill.neutral { background: #e5f0fa; color: var(--accent-blue); }
.pill.negative { background: #feecee; color: #c92a2a; }

.bottom-analytics {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 24px;
}

/* Automated Insights Panel */
.insights-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.insight-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background-color: #fbfbfd;
    border-left: 4px solid #d2d2d7;
}

.insight-item.warning { border-left-color: #ffbd2e; background-color: #fffdf5; }
.insight-item.success { border-left-color: #27c93f; background-color: #f6fdf6; }
.insight-item.action { border-left-color: var(--accent-blue); background-color: #f5f9fd; }

.insight-icon {
    font-size: 20px;
}

.insight-text h4 {
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.insight-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
/* =========================================
   20. ONBOARDING MODAL WIZARD
   ========================================= */
.onboarding-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.onboarding-overlay.active {
    display: flex;
}

.onboarding-card {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 750px;
    margin: 0 16px;
    max-height: 90vh;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.onboarding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.onboarding-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

/* Progress Indicator */
.progress-container {
    height: 6px;
    background-color: #f0f0f2;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent-blue);
    transition: width 0.3s ease;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.step-dot.active {
    color: var(--accent-blue);
}

/* Step Pages */
.onboarding-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.onboarding-step.active {
    display: block;
}

.onboarding-step h3 {
    font-size: 20px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f2;
}

/* Radio Cards (For Public vs Private) */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-card {
    flex: 1;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
}

.radio-card:hover {
    background-color: #f5f5f7;
}

.radio-card input {
    margin-right: 8px;
}

/* Conditional Logic Styles */
.conditional-section {
    margin-top: 24px;
    padding: 24px;
    background-color: #fbfbfd;
    border-radius: 12px;
    border: 1px dashed #d2d2d7;
}

.conditional-section.hidden {
    display: none;
}

/* File Upload Box */
.file-upload-box {
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    background-color: #fafafc;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.file-upload-box:hover {
    border-color: var(--accent-blue);
    background-color: #f5f9fd;
}

/* Footer Controls */
.onboarding-footer {
    display: flex;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f2;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* =========================================
   21. EMPLOYEE & PERMISSIONS UI
   ========================================= */
.permissions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background-color: #fbfbfd;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e5ea;
}

.perm-checkbox {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.perm-checkbox input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.employee-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background-color: #f0f0f2;
    color: var(--text-secondary);
}

.employee-badge.manager { background-color: #e5f0fa; color: var(--accent-blue); }
.employee-badge.cashier { background-color: #e3f5eb; color: #1a7a4c; }

.pin-display {
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 2px;
    background: #f5f5f7;
    padding: 4px 8px;
    border-radius: 4px;
}
/* =========================================
   22. POS LOCK SCREEN & KEYPAD
   ========================================= */
.pos-lock-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(229, 229, 234, 0.95); /* Semi-transparent POS background */
    backdrop-filter: blur(10px);
    display: none; /* Hidden when unlocked */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.pos-lock-overlay.active {
    display: flex;
}

.lock-container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 32px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    max-width: 380px;
    margin: 0 16px;
}

.lock-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.lock-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

/* The PIN Dots */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    height: 20px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d2d2d7;
    transition: all 0.2s;
}

.pin-dot.filled {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.error-text {
    color: #c92a2a;
    font-size: 13px;
    font-weight: 500;
    height: 20px; /* Keeps layout from jumping */
    margin-bottom: 24px;
}

/* Touch Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.keypad-btn {
    background-color: #f5f5f7;
    border: none;
    height: 64px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.1s, transform 0.1s;
}

.keypad-btn:active {
    background-color: #d2d2d7;
    transform: scale(0.95);
}

.keypad-btn.action-btn {
    background-color: transparent;
    font-size: 20px;
    color: var(--text-secondary);
}

.back-to-dash-link {
    display: block;
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 14px;
}
/* =========================================
   23. GLOBAL AUTHENTICATION & PIN RESET
   ========================================= */
.global-lock-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--surface-color); /* Solid white/grey, no transparency for max privacy */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Highest z-index to cover everything */
}

.forgot-pin-link {
    display: block;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
}

.forgot-pin-link:hover {
    color: var(--accent-blue);
}

.auth-hidden {
    display: none !important;
}
/* =========================================
   24. CUSTOM UI: TOASTS & DIALOGS
   ========================================= */

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002; /* Above everything */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none; /* Lets you click through the empty space */
}

.toast {
    background-color: var(--surface-color);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 40px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 1px solid #f0f0f2;
}

.toast.success .toast-icon { color: #1a7a4c; }
.toast.error .toast-icon { color: #c92a2a; }
.toast.info .toast-icon { color: var(--accent-blue); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Custom Dialog Modals */
.dialog-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.dialog-box {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 400px;
    margin: 0 16px;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    text-align: center;
    animation: scaleUp 0.2s ease;
}

.dialog-box h3 { margin-bottom: 12px; font-size: 20px; }
.dialog-box p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

.dialog-input {
    width: 100%; padding: 12px; border: 1px solid #d2d2d7;
    border-radius: 8px; font-size: 14px; margin-bottom: 24px; outline: none;
    text-align: center;
}

.dialog-input:focus { border-color: var(--accent-blue); }

.dialog-actions { display: flex; gap: 12px; }
.dialog-actions button { flex: 1; padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; font-size: 14px; }
.btn-cancel { background-color: #f0f0f2; color: var(--text-primary); }
.btn-cancel:hover { background-color: #e5e5ea; }
.btn-confirm { background-color: var(--accent-blue); color: white; }
.btn-confirm.danger { background-color: #c92a2a; }

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Bottom-sheet slide-up used for mobile modals (.modal-content,
   .dialog-box, .onboarding-card) inside the @media (max-width: 850px)
   block. The cubic-bezier mimics iOS UISheetPresentationController. */
@keyframes sheetUp {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
}
/* =========================================
   25. TOGGLE SWITCH & BRANCH UI
   ========================================= */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #d2d2d7;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--accent-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.branch-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background-color: #f0f0f2;
    color: var(--text-secondary);
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

/* =========================================
   26b. SIDEBAR COLLAPSE (DESKTOP)
   -----------------------------------------
   The sidebar can collapse to an icon-only
   rail. State is persisted via localStorage
   key `mawazo_sidebar_collapsed`. The rules
   below are scoped to desktop (>=851px) so
   they never conflict with the mobile
   bottom-nav layout further down.
   ========================================= */

#sidebarToggle {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e5e5ea;
    border-radius: var(--sidebar-item-radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#sidebarToggle:hover {
    background-color: #f5f5f7;
    color: var(--text-primary);
    border-color: #d2d2d7;
}

#sidebarToggle .toggle-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

@media (min-width: 851px) {
    .sidebar.collapsed {
        width: 80px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .sidebar.collapsed .logo {
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
    }

    .sidebar.collapsed .logo h2,
    .sidebar.collapsed .logo p {
        display: none;
    }

    .sidebar.collapsed .nav-text {
        display: none;
    }

    .sidebar.collapsed .nav-links li {
        justify-content: center;
        gap: 0;
        padding: 14px 10px;
    }

    .sidebar.collapsed .nav-links li > a {
        justify-content: center;
        gap: 0;
    }

    .sidebar.collapsed #sidebarToggle .toggle-label {
        display: none;
    }

    .sidebar.collapsed #sidebarToggle {
        padding: 10px 0;
    }

    .sidebar.collapsed #sidebarToggle .toggle-icon {
        transform: rotate(180deg);
    }
}

/* =========================================
   26c. TABLET BREAKPOINT  ::  The "Missing Middle"
   -----------------------------------------
   Screens 851–1100px (small laptops, iPads landscape / portrait).
   The full desktop sidebar is too wide and the POS cart panel is
   too rigid at this range. We auto-apply the icon-rail collapse
   and give the POS more breathing room — no JS involvement needed.
   The mobile rules (≤850px) are untouched.
   ========================================= */

@media (max-width: 1100px) and (min-width: 851px) {
    /* ── Sidebar: auto-collapse to 80px icon rail ──────────────── */
    .sidebar {
        width: 80px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .sidebar .logo {
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
    }

    .sidebar .logo h2,
    .sidebar .logo p {
        display: none;
    }

    .sidebar .nav-text {
        display: none;
    }

    .sidebar .nav-links li {
        justify-content: center;
        gap: 0;
        padding: 14px 10px;
    }

    .sidebar .nav-links li > a {
        justify-content: center;
        gap: 0;
    }

    .sidebar #sidebarToggle .toggle-label {
        display: none;
    }

    .sidebar #sidebarToggle {
        padding: 10px 0;
    }

    /* Point the chevron rightward to signal the sidebar can expand. */
    .sidebar #sidebarToggle .toggle-icon {
        transform: rotate(180deg);
    }

    /* ── POS: Narrow cart panel, products get remaining flex space ─ */

    /* Cart panel shrinks to 320px; the quick-key grid takes flex: 1.
       The 320px minimum keeps all checkout fields fully readable. */
    .pos-cart-panel {
        width: 320px;
        min-width: 280px;
        flex: 0 0 320px;
    }

    .products-panel {
        flex: 1;
        min-width: 0; /* Allows the grid to shrink below its natural size */
    }

    /* ── Dashboard: stack the 2fr/1fr chart+feed column on narrow laptops ── */
    .dashboard-columns {
        grid-template-columns: 1fr;
    }

    /* ── Analytics: collapse the 3-column analytics row ── */
    .bottom-analytics {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   27. MOBILE RESPONSIVENESS (PHASE 1)
   ========================================= */

@media screen and (max-width: 850px) {
    /* 1. LAYOUT & SPACING */
    .app-container {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0; /* Remove space for sidebar */
        padding: 16px;
        /* Clear the glass bottom-nav AND the iOS home-indicator safe area
           so dashboard cards / ledger tables never get hidden underneath. */
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }

    .top-bar {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
    }
    .search-box input {
        width: 100%;
    }

    /* 2. TRANSFORM SIDEBAR INTO BOTTOM APP BAR
       --------------------------------------------------------------
       Liquid-glass tab bar that floats above content, respects the
       phone's safe-area inset (iPhone home-indicator / Android gesture
       pill) and uses a backdrop-blur so content scrolls visibly behind. */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        min-height: 65px;
        flex-direction: row;
        padding: 0;
        /* Honor iOS / Android system safe area; fall back to 16px on
           devices that don't expose env() so the bar still feels right. */
        padding-bottom: env(safe-area-inset-bottom, 16px);
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        z-index: 1000;
        justify-content: center;
        /* Glassmorphism — the translucent layer + blur is what gives it
           the native iOS / iPadOS tab-bar feel. */
        background: rgba(255, 255, 255, 0.85);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
                backdrop-filter: saturate(180%) blur(20px);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
        /* No bouncy overscroll if a user accidentally pans the bar. */
        overscroll-behavior: contain;
        transition: none;
    }

    .sidebar .logo {
        display: none; /* Hide logo on mobile to save space */
    }

    .nav-links {
        display: flex;
        flex-direction: row;
        width: 100%;
        overflow-x: auto; /* Allow horizontal scroll if many tabs */
        -webkit-overflow-scrolling: touch;
        gap: 4px;
        padding: 8px;
    }

    .nav-links a {
        flex: 1;
        min-width: max-content;
    }

    .nav-links li {
        padding: 8px 10px;
        font-size: 11px;
        text-align: center;
        border-radius: 8px;
        flex-direction: column;
        gap: 4px;
        white-space: nowrap;
    }

    .nav-links li > a {
        flex-direction: column;
        gap: 4px;
    }

    .nav-icon {
        width: 20px;
        height: 20px;
    }

    .nav-text {
        font-size: 11px;
        flex: none;
    }

    /* The desktop collapse toggle is meaningless on the mobile bottom-nav. */
    #sidebarToggle {
        display: none !important;
    }

    /* 3. COLLAPSE CSS GRIDS */
    .dashboard-grid, 
    .pipeline-grid, 
    .pos-layout, 
    .settings-grid {
        grid-template-columns: 1fr; /* Force 1 column */
        gap: 16px;
    }

    /* 4. POINT OF SALE MOBILE ADJUSTMENTS */
    .pos-layout {
        display: flex;
        flex-direction: column-reverse; /* Put Cart at the top, Keypad at bottom */
    }

    .pos-quick-keys {
        grid-template-columns: repeat(2, 1fr); /* 2 buttons per row on mobile */
    }

    /* 5. FIX TABLES FOR SMALL SCREENS */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        border-radius: 8px;
    }
    
    .inventory-table {
        min-width: 700px; /* Force table to stay wide and allow swiping */
    }

    /* 6. MODALS & DIALOGS  ::  BOTTOM-SHEET TREATMENT
       --------------------------------------------------------------
       On phones, modals snap to the bottom of the screen and slide up
       from below — the iOS "sheet" pattern. The overlays stop centering
       their content vertically, and the cards stretch full-width with
       a rounded top edge. A small grabber pill is added via :before so
       users immediately recognize the dismissable-sheet metaphor. */
    .modal-overlay,
    .dialog-overlay,
    .onboarding-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-content,
    .dialog-box,
    .onboarding-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 24px 24px 0 0 !important;
        /* Generous bottom padding accounts for the phone's home-indicator
           safe-area so the last button isn't sitting on the system gesture. */
        padding: 16px 20px calc(28px + env(safe-area-inset-bottom, 0px)) 20px !important;
        max-height: 92vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
        animation: sheetUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    /* iOS-style "grabber" pill — purely cosmetic via pseudo-element so we
       don't touch any HTML. Communicates "swipe me down" affordance. */
    .modal-content::before,
    .dialog-box::before,
    .onboarding-card::before {
        content: "";
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(60, 60, 67, 0.28);
        margin: 0 auto 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* 6b. iOS SAFARI ZOOM FIX
       --------------------------------------------------------------
       iOS Safari auto-zooms whenever a user taps an input whose font
       is < 16px. Forcing every form field to 16px on phones keeps the
       cashier's POS / login / settings flows from jumping around. */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* 6c. TOUCH TARGETS  ::  Apple HIG / Material 44dp minimum
       --------------------------------------------------------------
       Tiny on desktop, finger-friendly on mobile. We expand by setting
       a min box and making the element a flex centerer so existing
       glyph contents (×, +, -, icons) stay visually centered. */
    .qty-btn,
    .btn-icon,
    .close-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
    }

    .details-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    /* 7. AUTH / LOCK SCREEN */
    .lock-container {
        width: 90%;
        padding: 24px;
    }

    .keypad {
        gap: 8px;
    }

    .keypad-btn {
        height: 56px; /* Slightly smaller for phones */
        font-size: 20px;
    }

    /* 8. LANDING PAGE ADJUSTMENTS */
    .landing-nav {
        flex-direction: column;
        gap: 16px;
    }
    .hero-title {
        font-size: 40px;
        letter-spacing: -1px;
    }
    .hero-image-wrapper {
        transform: none;
    }

    /* ── 9. STRICT X-AXIS LOCK  ::  Zero horizontal overflow
       ───────────────────────────────────────────────────────────
       Must be on html + body + .app-container because any ancestor
       that allows overflow-x will let child content escape. Setting
       max-width: 100vw is a belt-and-suspenders guard: if something
       widens the layout (a wide table inside a flex column, a long
       un-breakable string) it cannot push the viewport wider. */
    html,
    body,
    .app-container {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* ── 10. MOMENTUM SCROLLING  ::  Native-feel scroll physics
       ─────────────────────────────────────────────────────────── */

    /* .main-content is the flex-column that fills the screen minus the
       bottom nav. On mobile it must be a proper scroll root so the dashboard
       content, ledger rows, and settings cards all scroll smoothly. */
    .main-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-content,
    .feed-container {
        -webkit-overflow-scrolling: touch;
    }

    /* POS quick-key grid already has overflow-y:auto globally; add iOS
       momentum here so swiping through products feels fluid. */
    .pos-quick-keys {
        -webkit-overflow-scrolling: touch;
    }

    /* ── 11. HIDE SCROLLBARS  ::  Clean native-app appearance
       ───────────────────────────────────────────────────────────
       Content still scrolls — we just strip the visual scrollbar
       chrome that looks out of place in a PWA. Three properties are
       required for cross-browser coverage:
         -webkit-scrollbar  → Chrome / Safari / WebKit
         -ms-overflow-style → IE / Legacy Edge
         scrollbar-width    → Firefox */
    .main-content,
    .dashboard-content,
    .feed-container,
    .pos-quick-keys,
    .cart-items {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .main-content::-webkit-scrollbar,
    .dashboard-content::-webkit-scrollbar,
    .feed-container::-webkit-scrollbar,
    .pos-quick-keys::-webkit-scrollbar,
    .cart-items::-webkit-scrollbar {
        display: none;
    }

    /* ── 12. TEXT TRUNCATION  ::  Prevent dynamic data overflow
       ─────────────────────────────────────────────────────────── */

    /* POS quick-key product names: long SKUs or descriptions truncate
       gracefully instead of wrapping and breaking the card height. */
    .key-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Finance list and audit rows: entity names / descriptions
       should clip rather than stretch the row height on narrow screens. */
    .finance-details strong,
    .finance-details span,
    .audit-card-meta h3,
    .item-details h4 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Podium names can be long; let them wrap rather than overflow. */
    .podium-spot h3 {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* ── 13. BUTTON CONTAINMENT  ::  No overflow from action buttons
       ─────────────────────────────────────────────────────────────── */

    /* .btn-primary and .btn-outline inside cards / grid cells must
       never push outside their parent. white-space: normal lets the
       label text reflow to a second line rather than escaping. */
    .btn-primary,
    .btn-outline {
        max-width: 100%;
        white-space: normal;
        word-wrap: break-word;
    }
}

/* =========================================
   28. NOTIFICATION BELL & DROPDOWN
   ========================================= */
.notif-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}

.notif-bell {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    position: relative;
    padding: 0;
}

.notif-bell:hover {
    background-color: #f5f5f7;
    border-color: #e5e5ea;
}

.notif-bell:active {
    transform: scale(0.96);
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface-color);
    pointer-events: none;
    animation: notifBadgePop 0.2s ease;
}

@keyframes notifBadgePop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* Dropdown panel */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--surface-color);
    border: 1px solid #e5e5ea;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    z-index: 1500;
    overflow: hidden;
    animation: notifDropdownIn 0.18s ease;
}

@keyframes notifDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f2;
    font-size: 14px;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}

.notif-mark-all:hover {
    background: #f0f6ff;
}

.notif-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

.notif-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f7;
    transition: background-color 0.15s ease;
    position: relative;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background-color: #fafafc;
}

.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    background: #ffbd2e;
}

.notif-item.critical .notif-item-dot {
    background: #ff3b30;
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.15);
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
}

.notif-item-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-wrap: break-word;
}

.notif-item-meta {
    font-size: 11px;
    color: #b0b0b5;
    margin-top: 4px;
}

.notif-item-dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    align-self: flex-start;
    opacity: 0.5;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.notif-item-dismiss:hover {
    opacity: 1;
    background: #f0f0f2;
}

.notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid #f0f0f2;
    background: #fbfbfd;
    text-align: center;
}

.notif-dropdown-foot-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Mobile adjustments — keep the dropdown from overflowing the viewport. */
@media screen and (max-width: 850px) {
    .notif-dropdown {
        position: fixed;
        top: 70px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}

/* =========================================
   29. NETWORK PULSE  (PWA online/offline pill)
   ========================================= */
.network-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.network-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Online (green) */
.network-pill.online {
    background-color: #e3f5eb;
    color: #1a7a4c;
    border-color: #c8ecd6;
}
.network-pill.online .network-pill-dot {
    background-color: #27c93f;
    box-shadow: 0 0 0 3px rgba(39, 201, 63, 0.18);
    animation: pulseOnline 2.4s ease-in-out infinite;
}

@keyframes pulseOnline {
    0%, 100% { box-shadow: 0 0 0 3px rgba(39, 201, 63, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(39, 201, 63, 0.06); }
}

/* Offline (yellow / warning) */
.network-pill.offline {
    background-color: #fff7e0;
    color: #8a6d00;
    border-color: #ffe7a0;
}
.network-pill.offline .network-pill-dot {
    background-color: #ffbd2e;
    box-shadow: 0 0 0 3px rgba(255, 189, 46, 0.22);
    animation: pulseOffline 1.6s ease-in-out infinite;
}

@keyframes pulseOffline {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(1.2); opacity: 0.7; }
}

/* On narrow viewports, hide the text label and keep just the dot to save
   space — the color alone tells the user the state. */
@media screen and (max-width: 600px) {
    .network-pill {
        padding: 6px;
        gap: 0;
    }
    .network-pill-label {
        display: none;
    }
}

/* =========================================
   30. CAMERA BARCODE / QR SCANNER
   ========================================= */

/* Inventory: SKU input + inline "Scan" button */
.input-with-action {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
}

.input-with-action input {
    width: 100%;
    margin: 0; /* form-group inputs already have spacing rules */
}

.btn-scan {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: auto;
    min-height: 40px;
    border: 1px solid var(--accent-blue);
    background-color: #eaf3ff;
    color: var(--accent-blue);
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.btn-scan:hover  { background-color: #dceaff; box-shadow: 0 2px 6px rgba(0,102,204,0.15); }
.btn-scan:active { transform: scale(0.97); }
.btn-scan svg    { display: block; }

/* Subtle highlight pulse when the SKU is auto-filled by a scan */
@keyframes flashSuccess {
    0%   { box-shadow: 0 0 0 0   rgba(39, 201, 63, 0.45); background-color: #eaffec; }
    100% { box-shadow: 0 0 0 8px rgba(39, 201, 63, 0);    background-color: #ffffff; }
}
.flash-success {
    animation: flashSuccess 0.8s ease-out;
}

/* POS: search row + prominent "Use Device Camera" button */
.pos-search-row {
    display: flex;
    gap: 12px;
    width: 100%;
    align-items: stretch;
}

.btn-camera-pos {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: 56px;
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-camera-pos:hover  { background-color: #0050a3; box-shadow: 0 6px 16px rgba(0, 102, 204, 0.32); }
.btn-camera-pos:active { transform: scale(0.98); }
.btn-camera-pos svg    { display: block; }

/* On narrow viewports stack the camera button below the input */
@media screen and (max-width: 700px) {
    .pos-search-row {
        flex-direction: column;
    }
    .btn-camera-pos {
        width: 100%;
        justify-content: center;
    }
}

/* Scanner Modal — sits ABOVE all other modals (e.g. Add Item modal) */
.scanner-modal {
    z-index: 10005;
}

.scanner-modal-content {
    width: min(560px, calc(100vw - 32px));
    max-width: 560px;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.scanner-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f2;
}

/* The actual <div id="reader"> the html5-qrcode library renders into */
.scanner-reader {
    width: 100%;
    min-height: 320px;
    background-color: #0b0b0d;
    color: #ffffff;
}

/* The library injects buttons/selects we want to look on-brand */
.scanner-reader video {
    border-radius: 0;
    background: #000;
}
.scanner-reader button {
    background: #ffffff !important;
    color: var(--text-primary) !important;
    border: 1px solid #d2d2d7 !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    cursor: pointer !important;
    margin: 4px 4px !important;
}
.scanner-reader button:hover {
    background: #f5f5f7 !important;
}
.scanner-reader select {
    border: 1px solid #d2d2d7 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    background: #ffffff !important;
    color: var(--text-primary) !important;
    margin: 4px 4px !important;
}
.scanner-reader a {
    color: var(--accent-blue) !important;
    font-size: 12px !important;
}

.scanner-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #f0f0f2;
    background: #fbfbfd;
}

.scanner-status {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    line-height: 1;
}
.scanner-status.idle { background: #f0f0f2; color: var(--text-secondary); }
.scanner-status.ok   { background: #e3f5eb; color: #1a7a4c; }
.scanner-status.warn { background: #fff4e0; color: #8a6d00; }

.scanner-hint {
    margin: 0;
    padding: 12px 20px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
}

/* Mobile: the scanner takes the whole screen feel */
@media screen and (max-width: 500px) {
    .scanner-modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .scanner-reader {
        flex: 1;
        min-height: 0;
    }
}

/* =========================================
   31. P&L  ::  PIPELINE CARDS, SECONDARY STRIP, LEDGER TABLE
   ========================================= */

/* Color variants for the strict 3-card P&L pipeline.
   Inherits all sizing/padding/typography from .pipeline-card above. */
.pipeline-card.pnl-revenue {
    background: linear-gradient(135deg, #1a7a4c 0%, #146c40 100%);
}
.pipeline-card.pnl-expenses {
    background: linear-gradient(135deg, #c92a2a 0%, #a81f1f 100%);
}
.pipeline-card.pnl-profit {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0050a3 100%);
}

/* Net-Profit value paints itself red when the figure goes negative */
#liveNetProfit.is-loss {
    color: #ffd6d6;
}

/* Secondary metrics strip — relocates the existing Reconcile + Unpaid Bills
   info that used to live in the pipeline-grid. Kept lighter / smaller so the
   eye still gravitates to the strict 3-card P&L row above. */
.pnl-secondary-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.pnl-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background-color: var(--surface-color);
    border: 1px solid #f0f0f2;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    border-left-width: 4px;
}
.pnl-pill.bank     { border-left-color: var(--accent-blue); }
.pnl-pill.outgoing { border-left-color: #c92a2a; }

.pnl-pill-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pnl-pill-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.pnl-pill-sub {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.pnl-pill-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.pnl-pill-value-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.pnl-pill-value-row .btn-text {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}
.pnl-pill-value-row .btn-text:hover {
    background-color: #eaf3ff;
}

/* Stack the secondary strip on narrow screens */
@media screen and (max-width: 700px) {
    .pnl-secondary-strip {
        grid-template-columns: 1fr;
    }
}

/* Ledger table — reuses .inventory-table base + adds badges + tools */
.ledger-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ledger-table tbody td {
    vertical-align: middle;
}

.ledger-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.ledger-badge.income  { background-color: #e3f5eb; color: #1a7a4c; }
.ledger-badge.expense { background-color: #feecee; color: #c92a2a; }

/* Empty-state hint shown beneath the chart when there are no transactions */
.chart-empty-hint {
    margin: 24px 0 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px;
    background: #fbfbfd;
    border: 1px dashed #e5e5ea;
    border-radius: 12px;
}

/* Mobile: the ledger table needs horizontal scroll like the inventory one
   (handled by the existing .table-container rule), but make sure the card
   panel itself doesn't introduce double padding around it. */
@media screen and (max-width: 700px) {
    .ledger-table {
        min-width: 640px;
    }
}

/* =========================================
   32. AUDIT ENGINE  ::  TABS, CARDS, BRANCH PILL
   ========================================= */

/* Tab navigation strip — sits at the top of the Archive page. */
.audit-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 6px;
    background-color: #f5f5f7;
    border-radius: 14px;
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.audit-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.audit-tab:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.6);
}

.audit-tab.active {
    background-color: var(--surface-color);
    color: var(--accent-blue);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.audit-tab-icon {
    font-size: 16px;
    line-height: 1;
}

.audit-tab-badge {
    display: inline-block;
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background-color: #e5e5ea;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.audit-tab.active .audit-tab-badge {
    background-color: #eaf3ff;
    color: var(--accent-blue);
}

/* The three view containers swap visibility under tab control */
.audit-view {
    display: block;
}

/* Audit card — used inside Branch View and Staff View */
.audit-card {
    margin-bottom: 16px;
}

.audit-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: #fbfbfd;
    border-bottom: 1px solid #e5e5ea;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.audit-card-header:hover {
    background: #f5f5f7;
}

.audit-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.audit-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.audit-card-meta h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
    color: var(--text-primary);
}

.audit-card-meta p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.audit-card-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    padding: 0 16px;
    border-left: 1px solid #e5e5ea;
}

.audit-card-total-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.audit-card-total-value {
    font-size: 18px;
    font-weight: 700;
    color: #1a7a4c;
    white-space: nowrap;
}

.audit-card-chev {
    flex-shrink: 0;
}

/* Collapsible body — closed by default */
.audit-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.audit-card-body.open {
    max-height: 2000px; /* Loose upper bound — the table itself sets the real height */
}

.audit-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    margin: 0;
    font-size: 13px;
}

.audit-subtable th,
.audit-subtable td {
    font-size: 13px;
}

/* Branch pill used in tables — small, neutral, easy to scan */
.branch-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background-color: #eef4ff;
    color: var(--accent-blue);
    border: 1px solid #d6e4ff;
    white-space: nowrap;
}

/* Staff-count badge in the Branches settings list */
.branch-staff-count {
    margin-left: 8px;
    background-color: #eef4ff;
    color: var(--accent-blue);
    font-weight: 600;
}

/* Mobile tweaks */
@media screen and (max-width: 700px) {
    .audit-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    .audit-tab span:not(.audit-tab-icon):not(.audit-tab-badge) {
        display: none; /* Keep just the icon + badge to fit */
    }
    .audit-card-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    .audit-card-total {
        border-left: none;
        padding-left: 0;
        align-items: flex-start;
        width: 100%;
    }
    .audit-subtable {
        min-width: 560px;
    }
}

/* =========================================
   33. BILLING  ::  PAYWALL + PRICING GRID
   ========================================= */

/* ----- 33a. Global Paywall Overlay (created by db.js) ----- */
.paywall-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: paywallFadeIn 0.25s ease-out both;
}

@keyframes paywallFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.paywall-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface-color);
    border-radius: 20px;
    padding: 40px 32px 32px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    text-align: center;
    animation: paywallPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes paywallPop {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.paywall-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe7e7 0%, #ffd1d1 100%);
    color: #c92a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.paywall-title {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.paywall-subtitle {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.paywall-meta {
    display: inline-block;
    padding: 8px 14px;
    margin-bottom: 24px;
    background: #f5f5f7;
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-secondary);
}

.paywall-cta {
    width: 100%;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
}

.paywall-foot {
    margin: 18px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* When the paywall is up, freeze background scroll on the workspace */
body.paywall-active {
    overflow: hidden;
}

/* ----- 33b. Billing Card Header ----- */
.billing-card .billing-status-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 180px;
}

.billing-status-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.billing-status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #f0f0f2;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.billing-status-pill.billing-pill-active {
    background: #d4f7e3;
    color: #1a7a4c;
}

.billing-status-pill.billing-pill-trial {
    background: #fff4d6;
    color: #8a6500;
}

.billing-status-pill.billing-pill-expired {
    background: #fde2e2;
    color: #c92a2a;
}

.billing-status-meta {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    max-width: 240px;
}

/* ----- 33c. Pricing Grid (modern SaaS layout) ----- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.pricing-tier {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 28px 24px;
    background: var(--surface-color);
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pricing-tier:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
    border-color: #d4d4dc;
}

.pricing-tier.featured {
    border: 2px solid var(--accent-blue);
    background: linear-gradient(180deg, #f5faff 0%, #ffffff 60%);
    box-shadow: 0 16px 36px rgba(0, 102, 204, 0.10);
}

.pricing-tier.featured:hover {
    box-shadow: 0 20px 44px rgba(0, 102, 204, 0.14);
}

.pricing-savings-badge {
    position: absolute;
    top: -12px;
    right: 16px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #ff9500, #ff5f56);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(255, 95, 86, 0.30);
}

.pricing-tier-header h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-tier-tagline {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.pricing-amount {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 20px;
}

.pricing-currency {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    transform: translateY(-12px);
}

.pricing-value {
    font-size: 44px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.pricing-period {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pricing-features li {
    position: relative;
    padding-left: 24px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.pricing-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #d4f7e3;
    color: #1a7a4c;
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pricing-cta {
    margin-top: auto;
    height: 44px;
    font-weight: 600;
}

.pricing-cta:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.billing-foot {
    margin: 20px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* ----- 33d. Mobile tweaks ----- */
@media screen and (max-width: 700px) {
    .billing-card .settings-header {
        flex-direction: column;
    }
    .billing-card .billing-status-block {
        align-items: flex-start;
        width: 100%;
    }
    .billing-status-meta {
        text-align: left;
    }
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    .paywall-card {
        padding: 32px 24px 24px;
    }
    .paywall-title {
        font-size: 20px;
    }
}

/* =============================================================================
 * POS  ::  SALE / RETURN MODE TOGGLE  (pill segmented control)
 * -----------------------------------------------------------------------------
 * Lives in the cart header. Two pill buttons share a single rounded track;
 * the active button gets a lifted "tab" look. The Return active state uses
 * --danger-color so the cashier sees at a glance that the next scan will
 * REFUND money / restock inventory rather than charge for a sale.
 * ===========================================================================*/
.mode-toggle {
    display: inline-flex;
    background: #f0f0f2;
    border: 1px solid #e5e5ea;
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.mode-toggle button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1px;
    padding: 6px 16px;
    min-width: 64px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.mode-toggle button:hover:not(.active) {
    color: var(--text-primary);
}

.mode-toggle button.active {
    background: var(--surface-color);
    color: var(--accent-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mode-toggle button#modeReturnBtn.active {
    background: var(--danger-color);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(255, 59, 48, 0.35);
}

.mode-toggle button:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Subtle banner cue so the cashier never forgets they're in refund mode.
 * Applied to the cart panel via `.cart-panel.return-mode` from pos.js. */
.cart-panel.return-mode {
    box-shadow: inset 0 0 0 2px rgba(255, 59, 48, 0.35);
}

/* Refund-styled checkout button (set inline by updateCartUI in pos.js for
 * specificity, but kept here so future refactors have a single source). */
.pay-btn.refund {
    background: var(--danger-color) !important;
    border-color: var(--danger-color) !important;
    color: #ffffff !important;
}

/* =============================================================================
 * DASHBOARD  ::  FULL ANALYSIS MODAL — Tab Strip
 * -----------------------------------------------------------------------------
 * Underline-style tabs (Daily / Weekly / Monthly / Yearly) used by the
 * #fullAnalysisModal. Active tab gets the accent color + an underline so the
 * selected timeframe is unambiguous against the chart's own legend.
 * ===========================================================================*/
.analysis-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e5ea;
    margin-top: 12px;
}

.analysis-tabs .tab-btn {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    /* Negative margin so the active border sits flush with the row border. */
    margin-bottom: -1px;
}

.analysis-tabs .tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.analysis-tabs .tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.analysis-tabs .tab-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* =============================================================================
 * DASHBOARD v2  ::  PREDICTOR-UPGRADE PANELS
 * -----------------------------------------------------------------------------
 * Styles for the new Command Center sections introduced when the analytics
 * engine bumped to `meta.upgradeVersion: 2`. Each block below targets a
 * single card so individual surfaces are easy to find or restyle.
 *
 * Naming convention:
 *   .ai-*           → header status / backtest pills
 *   .mq-*           → "model quality" chip strip under the forecast title
 *   #dailyOutlook*  → 14-day daily forecast card
 *   #forecastDrivers*  → permutation-importance card
 *   #stockoutWatch* / .stockout-* → linear-projection stockout card
 *   #modelLab* / .model-lab-* → backtest leaderboard card
 *   .dow-*          → day-of-week mini bars on the daily card
 * ===========================================================================*/

/* ── Header pills ────────────────────────────────────────────────────────── */
.ai-status-pill {
    font-size: 12px;
    color: var(--text-secondary);
    background: #f5f5f7;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.ai-status-pill.ok  { background: #e3f5eb; color: #1a7a4c; }
.ai-status-pill.err { background: #feecee; color: #c92a2a; }

.ai-backtest-pill {
    font-size: 12px;
    background: #eef4ff;
    color: var(--accent-blue);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid #d6e4ff;
}

.ai-schedule-pill {
    font-size: 12px;
    color: var(--accent-blue);
    background: #e6f0fa;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.ai-schedule-icon { font-size: 14px; }

.ai-rerun-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ai-rerun-icon { display: inline-block; transition: transform 0.4s ease; }
.ai-rerun-icon.spinning { animation: ai-spin 1s linear infinite; }
@keyframes ai-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Model-quality chip strip (under forecast chart title) ──────────────── */
.model-quality-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 12px;
}
.mq-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.mq-chip-model { background: #eef4ff; color: var(--accent-blue); border-color: #d6e4ff; }
.mq-chip-mape  { background: #e3f5eb; color: #1a7a4c;            border-color: #c9ebd5; }
.mq-chip-ar1   { background: #f4ecff; color: #6f42c1;            border-color: #e1d3f8; }
.mq-chip-hp    { background: #fff8e1; color: #946200;            border-color: #ffe4a1; }
.mq-chip-closed{ background: #f5f5f7; color: var(--text-secondary); border-color: #e5e5ea; }

/* ── 14-Day Daily Outlook card ──────────────────────────────────────────── */
#dailyOutlookCard {
    margin-top: 24px;
}
.dow-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f2;
}
.dow-pill {
    height: 36px;
    border-radius: 6px;
    background: #f5f8fc;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-end;
    padding: 4px 0;
    position: relative;
    overflow: hidden;
    border: 1px solid #ebf1f7;
}
.dow-pill.closed {
    background: repeating-linear-gradient(
        45deg,
        #f5f5f7,
        #f5f5f7 4px,
        #ececef 4px,
        #ececef 8px
    );
    opacity: 0.6;
}
.dow-pill-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #5aa9e6, #0066cc);
    border-radius: 0 0 6px 6px;
    transition: height 0.3s ease;
}
.dow-pill-label {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.85);
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1;
}
.dow-pill.closed .dow-pill-label { color: var(--text-secondary); }

/* ── Forecast Drivers card (permutation importance) ─────────────────────── */
#forecastDriversCard {
    margin-top: 24px;
}
.driver-tab-btn {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    padding: 3px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.driver-tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: #f5f5f7;
}
.driver-tab-btn.active {
    color: var(--accent-blue);
    background: #eef4ff;
    border-color: #d6e4ff;
}

.drivers-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.drivers-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}
.drivers-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.drivers-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: baseline;
    font-size: 13px;
}
.drivers-label {
    color: var(--text-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drivers-spend {
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.drivers-impact {
    font-weight: 700;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.drivers-impact.positive { color: #1a7a4c; }
.drivers-impact.negative { color: #c92a2a; }

.drivers-bar-track {
    height: 6px;
    background: #f0f0f2;
    border-radius: 3px;
    overflow: hidden;
}
.drivers-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.drivers-bar.positive { background: linear-gradient(90deg, #27c93f, #1a7a4c); }
.drivers-bar.negative { background: linear-gradient(90deg, #ff6961, #c92a2a); }

/* ── Stockout Watch card ────────────────────────────────────────────────── */
#stockoutWatchCard {
    margin-top: 24px;
}
.stockout-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
}
.stockout-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}
.stockout-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid #f0f0f2;
    border-radius: 10px;
    background: #fbfbfd;
}
.stockout-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    background: var(--text-secondary);
}
.stockout-dot.ok       { background: #27c93f; }
.stockout-dot.warning  { background: #ffbd2e; }
.stockout-dot.critical { background: #c92a2a; }

.stockout-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stockout-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.stockout-name {
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stockout-eta {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.stockout-depletion {
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ── Model Lab card (backtest leaderboard) ──────────────────────────────── */
#modelLabCard {
    margin-top: 24px;
}
.model-lab-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}
.model-lab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.model-lab-table thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-bottom: 1px solid #e5e5ea;
}
.model-lab-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f2;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.model-lab-table tbody tr:last-child td { border-bottom: none; }
.model-lab-winner td {
    background: #f6fdf6;
    font-weight: 600;
}
.model-lab-winner td:first-child { border-left: 3px solid #27c93f; padding-left: 7px; }
.model-lab-star { color: #f4b400; font-weight: 700; margin-right: 4px; }
.model-lab-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px 10px;
}

.model-lab-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 10px;
    background: #fbfbfd;
    border: 1px solid #f0f0f2;
}
.ml-meta-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    border-bottom: 1px dashed #ececef;
    padding-bottom: 6px;
}
.ml-meta-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.ml-meta-line strong {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 10px;
}
.ml-meta-line span {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Quantile-ribbon toggle (full-analysis modal) ───────────────────────── */
.quantile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.quantile-toggle input[type="checkbox"] { accent-color: var(--accent-blue); }

/* ── Mobile / narrow-viewport tweaks for the v2 cards ───────────────────── */
@media (max-width: 880px) {
    .model-lab-grid {
        grid-template-columns: 1fr;
    }
    .dow-strip {
        gap: 4px;
    }
    .drivers-row {
        grid-template-columns: 1fr auto;
    }
    .drivers-spend { display: none; }
}
