:root {
    --bg: #f6f3ec;
    --surface: #ffffff;
    --surface-alt: #fbf9f5;
    --header-bg: #fbf9f5;
    --petrol: #0e2f34;
    --teal: #0f766e;
    --teal-soft: #eaf4f2;
    --orange: #e05a2b;
    --orange-hover: #c94a1e;
    --orange-soft: #fdf2ec;
    --ink: #1d2325;
    --body: #4b5559;
    --muted: #6c767a;
    --border: #e5dfd3;
    --shadow: 0 2px 10px rgba(14, 47, 52, 0.06);
    --shadow-lg: 0 14px 36px rgba(14, 47, 52, 0.18);
    --ok-bg: #e6f4f1;
    --ok-text: #0f766e;
    --warn-bg: #fef3c7;
    --warn-text: #92400e;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --danger-btn: #dc2626;
    --radius: 14px;
    --radius-sm: 10px;
}

[data-theme="dark"] {
    --bg: #0a191c;
    --surface: #11262a;
    --surface-alt: #18343a;
    --header-bg: #0d2024;
    --petrol: #071416;
    --teal: #2dd4bf;
    --teal-soft: rgba(45, 212, 191, 0.14);
    --orange: #f07142;
    --orange-hover: #ff8254;
    --orange-soft: rgba(240, 113, 66, 0.16);
    --ink: #f3efe6;
    --body: #c9d4d2;
    --muted: #93a7a5;
    --border: #214248;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
    --ok-bg: rgba(45, 212, 191, 0.16);
    --ok-text: #5eead4;
    --warn-bg: rgba(245, 158, 11, 0.18);
    --warn-text: #fcd34d;
    --danger-bg: rgba(239, 68, 68, 0.18);
    --danger-text: #fca5a5;
    --danger-btn: #ef4444;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.logo-dark {
    display: none;
}

[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

.muted-text {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.6rem 1.05rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.08s ease, border-color 0.15s ease, opacity 0.15s ease;
    touch-action: manipulation;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--orange);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--orange-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-alt);
}

.btn-danger {
    background: var(--danger-btn);
    color: #ffffff;
}

.btn-danger:hover {
    opacity: 0.92;
}

.btn-lg {
    min-height: 50px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.flex-1 {
    flex: 1;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.icon-btn:hover {
    background: var(--surface-alt);
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--body);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.link-btn {
    background: none;
    border: none;
    color: var(--teal);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

/* Login Screen */
.login-screen {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px 24px 22px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.login-logo-wrap .logo-img {
    height: 42px;
    width: auto;
}

.login-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}

.login-title {
    margin: 0 0 6px;
    font-size: 1.4rem;
    color: var(--ink);
}

.login-subtitle {
    margin: 0 0 20px;
    font-size: 0.92rem;
    color: var(--muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pin-input {
    width: 100%;
    min-height: 54px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.28em;
}

.pin-input:focus {
    outline: none;
    border-color: var(--teal);
    background: var(--surface);
}

.login-footer {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-logo {
    height: 26px;
    width: auto;
    flex-shrink: 0;
}

.market-pill {
    display: none;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--teal);
    background: var(--teal-soft);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

@media (min-width: 520px) {
    .header-logo {
        height: 30px;
    }
    .market-pill {
        display: inline-block;
    }
}

.desktop-nav {
    display: none;
    gap: 6px;
    background: var(--bg);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.nav-tab {
    border: none;
    background: transparent;
    color: var(--body);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 9px;
    cursor: pointer;
}

.nav-tab.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--body);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.sync-pill.is-syncing .sync-dot {
    background: var(--orange);
}

.sync-pill.is-error .sync-dot {
    background: var(--danger-btn);
}

/* Main container */
.app-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 12px calc(94px + env(safe-area-inset-bottom));
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(14, 47, 52, 0.08);
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

.bottom-nav-btn.is-active {
    color: var(--orange);
    background: var(--orange-soft);
}

/* POS Page */
.pos-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.pos-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow);
}

.pos-stat-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pos-stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.pos-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.search-wrap {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 8px 14px 8px 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--teal);
}

.category-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    flex: 0 0 auto;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--body);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cat-pill.is-active {
    background: var(--petrol);
    color: #ffffff;
    border-color: var(--petrol);
}

[data-theme="dark"] .cat-pill.is-active {
    background: var(--teal);
    color: #062120;
    border-color: var(--teal);
}

.pos-product-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pos-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 8px;
    padding: 0 2px;
}

.pos-group-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.pos-group-meta {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

.pos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.pos-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 11px;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.pos-card.is-empty {
    opacity: 0.72;
}

.pos-card.is-flash {
    border-color: var(--teal);
}

.pos-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pos-card-name {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.28;
}

.pos-card-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pos-card-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stock-ok {
    background: var(--ok-bg);
    color: var(--ok-text);
}

.stock-low {
    background: var(--warn-bg);
    color: var(--warn-text);
}

.stock-out {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.pos-card-actions {
    display: flex;
    gap: 8px;
}

.pos-sell-btn {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: 11px;
    background: var(--orange);
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    touch-action: manipulation;
    user-select: none;
}

.pos-sell-btn:hover {
    background: var(--orange-hover);
}

.pos-sell-btn:active {
    transform: scale(0.98);
}

.pos-sell-btn.is-zero {
    background: var(--surface-alt);
    color: var(--body);
    border: 1px dashed var(--border);
}

.pos-custom-btn {
    width: 52px;
    min-height: 48px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.pos-custom-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

/* Recent sales on POS */
.recent-sales-card {
    margin-top: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.recent-sales-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-sale-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.recent-sale-info {
    min-width: 0;
    flex: 1;
}

.recent-sale-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-sale-meta {
    font-size: 0.78rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.recent-sale-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.recent-sale-amount {
    font-weight: 800;
    font-size: 0.94rem;
    font-variant-numeric: tabular-nums;
}

.mini-undo-btn {
    min-height: 34px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--danger-text);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.custom-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 0.72rem;
    font-weight: 700;
}

/* Raw Data Page */
.subtab-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.subtab-btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--body);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.subtab-btn.is-active {
    background: var(--petrol);
    color: #ffffff;
    border-color: var(--petrol);
}

[data-theme="dark"] .subtab-btn.is-active {
    background: var(--teal);
    color: #062120;
    border-color: var(--teal);
}

.subtab-panel {
    display: none;
}

.subtab-panel.is-active {
    display: block;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.toolbar-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.info-banner {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 0.86rem;
    font-weight: 600;
}

.warn-banner {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--warn-bg);
    color: var(--warn-text);
    font-size: 0.86rem;
    font-weight: 700;
}

/* Raw Product Cards & Table */
.raw-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.raw-item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.raw-item-card.is-archived {
    opacity: 0.65;
}

.raw-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.raw-item-cat {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--teal);
    letter-spacing: 0.03em;
}

.raw-item-title {
    margin: 2px 0 0;
    font-size: 1rem;
    font-weight: 700;
}

.raw-item-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}

.raw-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.raw-metric span {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
}

.raw-metric strong {
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.raw-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stock-adjuster {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.adj-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

.adj-val {
    min-width: 54px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Forms & Settings */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.card h2, .card h3 {
    margin: 0 0 10px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.settings-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--body);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"] {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.98rem;
}

.field input:focus {
    outline: none;
    border-color: var(--teal);
    background: var(--surface);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 6px 0;
}

.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.danger-card {
    border-color: rgba(220, 38, 38, 0.35);
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--body);
    cursor: pointer;
}

.form-error {
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 0.88rem;
    font-weight: 600;
}

.form-feedback {
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--ok-bg);
    color: var(--ok-text);
    font-size: 0.88rem;
    font-weight: 600;
}

/* Statistics Page */
.stats-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.page-heading {
    margin: 0;
    font-size: 1.25rem;
}

.stats-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-value {
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.kpi-value.is-positive {
    color: var(--ok-text);
}

.kpi-value.is-negative {
    color: var(--danger-text);
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.3;
}

.highlights-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.highlight-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    border-radius: 12px;
    padding: 11px 13px;
    box-shadow: var(--shadow);
}

.highlight-card.is-orange {
    border-left-color: var(--orange);
}

.highlight-kicker {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
}

.highlight-title {
    font-size: 0.98rem;
    font-weight: 800;
    margin: 2px 0;
}

.highlight-sub {
    font-size: 0.82rem;
    color: var(--body);
}

.stats-section {
    margin-bottom: 14px;
}

.chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.chart-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.pill-switch {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
}

.pill-switch button {
    border: none;
    background: transparent;
    color: var(--body);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 999px;
    cursor: pointer;
}

.pill-switch button.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.svg-chart-wrap {
    width: 100%;
    overflow: hidden;
}

.svg-chart-wrap svg {
    display: block;
    width: 100%;
    height: auto;
}

.chart-meta-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.83rem;
}

.chart-meta-item span {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
}

.chart-meta-item strong {
    font-variant-numeric: tabular-nums;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.82rem;
    color: var(--body);
    margin-bottom: 8px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

/* Category & Product Ranking */
.cat-share-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.cat-share-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cat-share-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--teal);
}

.progress-fill.is-orange {
    background: var(--orange);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.data-table th, .data-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    font-size: 0.76rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.data-table td.num, .data-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ranking-row {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranking-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.ranking-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.ranking-nums {
    font-weight: 800;
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.ranking-sub {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--muted);
}

.unsold-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}

.unsold-chip {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 600;
}

/* Modals / Bottom Sheets */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(7, 20, 22, 0.62);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-sheet {
    width: 100%;
    max-width: 520px;
    max-height: 92dvh;
    overflow-y: auto;
    background: var(--surface);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
}

.modal-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-kicker {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--teal);
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.cs-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--body);
}

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

.stepper-btn {
    width: 50px;
    height: 48px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
}

.stepper-input {
    flex: 1;
    height: 48px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-alt);
    color: var(--ink);
}

.price-input {
    font-size: 1.2rem !important;
    font-weight: 800;
}

.quick-price-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
}

.chip-btn {
    min-height: 36px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.chip-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.cs-total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}

.cs-total-amount {
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.diff-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--orange-soft);
    color: var(--orange);
}

.margin-preview {
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 0.88rem;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

/* Floating Toast */
.toast-container {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    width: 100%;
    max-width: 520px;
    background: var(--petrol);
    color: #ffffff;
    border-radius: 13px;
    padding: 11px 13px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.toast-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.toast-undo-btn {
    min-height: 36px;
    padding: 5px 12px;
    border-radius: 8px;
    border: none;
    background: var(--orange);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

/* Tablet / Desktop Responsive */
@media (min-width: 600px) {
    .pos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .field-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .highlights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-meta-strip {
        grid-template-columns: repeat(4, 1fr);
    }
    .modal-backdrop {
        align-items: center;
        padding: 20px;
    }
    .modal-sheet {
        border-radius: 18px;
    }
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
    .mobile-bottom-nav {
        display: none;
    }
    .app-main {
        padding: 22px 20px 44px;
    }
    .toast-container {
        bottom: 22px;
    }
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .settings-grid {
        grid-template-columns: 1.35fr 1fr;
        align-items: start;
    }
}

@media (min-width: 960px) {
    .pos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .highlights-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .raw-card-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}
