/* ================================================================
   WANJEMA ENTERPRISE - Design System
   ================================================================ */

/* -------------------------
   CSS VARIABLES
   ------------------------- */
:root {
    --bg: #f5f7f4;
    --surface: #ffffff;
    --surface-muted: #eef3ed;
    --text: #17211a;
    --muted: #647067;
    --line: #dde5dd;
    --primary: #176b4d;
    --primary-dark: #0f4a36;
    --green: #24a06b;
    --blue: #2563eb;
    --red: #dc4a3d;
    --gold: #b7791f;
    --shadow: 0 2px 8px rgba(23, 33, 26, 0.06);
    --shadow-lg: 0 8px 30px rgba(23, 33, 26, 0.1);
    --radius: 10px;
    --sidebar-width: 260px;
    --sidebar-min-width: 68px;
    --topbar-height: 60px;
}

/* -------------------------
   RESET & BASE
   ------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
}

code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-muted);
}

small {
    font-size: 0.85em;
    color: var(--muted);
}

strong {
    font-weight: 700;
}

/* -------------------------
   APP SHELL (Grid Layout)
   ------------------------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell.sidebar-minimized {
    grid-template-columns: var(--sidebar-min-width) 1fr;
}

/* -------------------------
   SIDEBAR
   ------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: linear-gradient(180deg, #0f2b1d 0%, #12331f 100%);
    color: #f8fbf7;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Sidebar Minimized */
.sidebar-minimized .sidebar {
    width: var(--sidebar-min-width);
}

.sidebar-minimized .brand-text {
    display: none;
}

.sidebar-minimized .nav-label {
    display: none;
}

.sidebar-minimized .sidebar .theme-form {
    display: none;
}

.sidebar-minimized .sidebar .install-btn {
    display: none;
}

.sidebar-minimized .sidebar .sidebar-collapse-label {
    display: none;
}

.sidebar-minimized .nav-links a {
    justify-content: center;
    padding: 13px 0;
}

.sidebar-minimized .nav-links a .nav-label {
    display: none;
}

.sidebar-minimized .brand {
    justify-content: center;
}

.sidebar-minimized .brand-mark {
    margin: 0;
}

/* -------------------------
   SIDEBAR HEADER
   ------------------------- */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 14px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #b9c8be;
    font-size: 28px;
    cursor: pointer;
    padding: 0 12px;
    line-height: 1;
    transition: color 0.15s;
}

.sidebar-close:hover {
    color: #ffffff;
}

/* -------------------------
   BRAND
   ------------------------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    text-decoration: none;
    transition: justify-content 0.25s;
}

.brand.compact {
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #d7f0df;
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
    transition: margin 0.25s;
}

.brand strong,
.brand small {
    display: block;
    white-space: nowrap;
}

.brand strong {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.1;
}

.brand small {
    color: #b9c8be;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 500;
}

.brand.compact small {
    color: var(--muted);
}

.brand-mark-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

/* -------------------------
   NAV LINKS
   ------------------------- */
.nav-links {
    display: grid;
    gap: 2px;
    padding: 6px 0;
}

.nav-links a,
.logout-link {
    color: #cdd8d0;
    font-weight: 600;
    font-size: 14px;
    padding: 13px 16px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    margin: 2px 10px;
    min-height: 42px;
}

.nav-links a svg,
.nav-links a .nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.13);
}

/* -------------------------
   SIDEBAR BOTTOM
   ------------------------- */
.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 18px;
}

.install-btn {
    margin: 0 16px 4px;
    text-align: center;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.install-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* -------------------------
   THEME FORM (sidebar)
   ------------------------- */
.theme-form {
    padding: 0 16px;
}

.theme-form label {
    color: #dcebe0;
    font-size: 13px;
    font-weight: 600;
    display: grid;
    gap: 6px;
}

.theme-form select {
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 8px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.theme-form option {
    color: #17211a;
    background: #ffffff;
}

/* -------------------------
   LOGOUT LINK
   ------------------------- */
.logout-link {
    margin: 0 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    min-height: 42px;
    font-weight: 600;
    font-size: 14px;
    color: #cdd8d0;
    transition: background 0.15s, color 0.15s;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* -------------------------
   SIDEBAR OVERLAY (mobile)
   ------------------------- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 250;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* -------------------------
   TOP BAR
   ------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar-spacer {
    flex: 1;
}

.topbar-brand {
    display: none;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}

.topbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.topbar-toggle:hover {
    background: var(--surface-muted);
    border-color: var(--primary);
}

.topbar-toggle svg {
    width: 18px;
    height: 18px;
}

.topbar-toggle .toggle-chevron {
    display: none;
}

.topbar-toggle .toggle-hamburger {
    display: none;
}

.topbar-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.topbar-bell:hover {
    background: var(--surface-muted);
}

.topbar-bell .bell-icon {
    width: 20px;
    height: 20px;
    stroke: var(--muted);
    fill: none;
}

.topbar-bell .bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--surface);
}

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

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.topbar-username {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.topbar-logout {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.topbar-logout:hover {
    background: var(--red);
    color: #fff;
}

/* -------------------------
   MAIN WRAPPER
   ------------------------- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-minimized .main-wrapper {
    margin-left: var(--sidebar-min-width);
}

/* -------------------------
   MAIN CONTENT
   ------------------------- */
.main-content {
    width: 100%;
    max-width: 1400px;
    padding: 32px;
    margin: 0 auto;
    flex: 1;
}

/* -------------------------
   PAGE HEADING
   ------------------------- */
.page-heading {
    margin-bottom: 24px;
}

.page-heading p,
.section-title p {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-heading span {
    display: block;
    max-width: 680px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.compact-heading h1 {
    font-size: 34px;
}

/* -------------------------
   PANELS
   ------------------------- */
.panel {
    margin-top: 22px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

/* -------------------------
   DASHBOARD HERO
   ------------------------- */
.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-hero .page-heading {
    margin-bottom: 0;
}

.dashboard-graphic {
    position: relative;
    min-height: 170px;
    border: 1px solid #cfe0d2;
    border-radius: var(--radius);
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 18%, rgba(36, 160, 107, 0.18), transparent 30%),
        linear-gradient(135deg, #ffffff, #eaf3ec);
    box-shadow: var(--shadow);
}

.graphic-card {
    position: absolute;
    border: 1px solid rgba(23, 107, 77, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 14px 30px rgba(23, 33, 26, 0.12);
}

.graphic-card.main {
    left: 28px;
    top: 32px;
    width: 130px;
    height: 86px;
    padding: 16px;
}

.graphic-card.main span,
.graphic-card.main strong,
.graphic-card.main i {
    display: block;
    border-radius: 999px;
}

.graphic-card.main span {
    width: 42px;
    height: 10px;
    background: var(--primary);
}

.graphic-card.main strong {
    width: 82px;
    height: 12px;
    margin-top: 14px;
    background: var(--green);
}

.graphic-card.main i {
    width: 58px;
    height: 8px;
    margin-top: 12px;
    background: #d5e8d8;
    font-style: normal;
}

.graphic-card.small {
    width: 72px;
    height: 48px;
}

.graphic-card.small.top {
    right: 28px;
    top: 24px;
    background: #eff8f1;
}

.graphic-card.small.bottom {
    right: 52px;
    bottom: 24px;
    background: #fff7e8;
}

.graphic-bars {
    position: absolute;
    left: 46px;
    right: 38px;
    bottom: 22px;
    display: flex;
    align-items: flex-end;
    gap: 9px;
    height: 45px;
}

.graphic-bars .bar {
    width: 18px;
    border-radius: 8px 8px 3px 3px;
}

.graphic-bars .one {
    height: 24px;
    background: var(--blue);
}

.graphic-bars .two {
    height: 38px;
    background: var(--green);
}

.graphic-bars .three {
    height: 30px;
    background: var(--gold);
}

/* -------------------------
   METRICS GRID
   ------------------------- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    border-top: 5px solid var(--green);
    transition: box-shadow 0.2s;
}

.metric-card:hover {
    box-shadow: var(--shadow-lg);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.accent-green {
    border-top-color: var(--green);
}

.accent-blue {
    border-top-color: var(--blue);
}

.accent-red {
    border-top-color: var(--red);
}

.accent-gold {
    border-top-color: var(--gold);
}

/* -------------------------
   ACTION GRID
   ------------------------- */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.action-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s;
}

.action-card:hover {
    border-color: #b9d7c3;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.action-card strong {
    font-size: 15px;
    font-weight: 700;
}

.action-card span {
    color: var(--muted);
    font-size: 14px;
}

/* -------------------------
   CHARTS GRID
   ------------------------- */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.chart-panel {
    min-height: 0;
}

.chart-container {
    position: relative;
    height: 310px;
    padding: 10px 14px 0;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-container-sm {
    height: 250px;
}

/* -------------------------
   OVERVIEW PILLS
   ------------------------- */
.overview-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.overview-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

/* -------------------------
   FORMS
   ------------------------- */
label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfb;
    color: var(--text);
    font: inherit;
    padding: 10px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.65;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.12);
    outline: none;
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: end;
}

.three-columns {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
}

.two-columns {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
}

.four-columns {
    grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(130px, 1fr)) auto;
}

.report-filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
}

.checkbox-label input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--primary);
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

/* -------------------------
   BUTTONS
   ------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
}

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

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

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
}

.button.secondary:hover {
    border-color: #b9d7c3;
    background: #e3eee4;
}

.button.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
}

.button.ghost:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.button.danger {
    background: #ffe8e3;
    color: #9d2c22;
}

.button.danger:hover {
    background: #ffd6cc;
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 8px;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

/* -------------------------
   SEARCH FORMS
   ------------------------- */
.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.search-form.compact-filter {
    grid-template-columns: minmax(220px, 320px) auto;
    justify-content: start;
}

/* -------------------------
   INLINE FORMS
   ------------------------- */
.inline-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

/* -------------------------
   ROW ACTIONS
   ------------------------- */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-actions form {
    margin: 0;
}

/* -------------------------
   TABLES
   ------------------------- */
.table-wrap {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
}

th {
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    font-size: 14px;
}

tbody tr {
    transition: background 0.1s;
}

tbody tr:hover {
    background: rgba(23, 107, 77, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* -------------------------
   STATUS PILLS & BADGES
   ------------------------- */
.status {
    display: inline-flex;
    min-width: 42px;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status.ok {
    background: #e0f5e8;
    color: #176b4d;
}

.status.low {
    background: #ffe8e3;
    color: #b33024;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.paid {
    background: #e0f5e8;
    color: #176b4d;
}

.status-pill.pending {
    background: #fff7e8;
    color: #8a520f;
}

/* -------------------------
   FLASH MESSAGES
   ------------------------- */
.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-stack.compact {
    margin-bottom: 14px;
}

.flash-message {
    border: 1px solid #bdd8c4;
    border-radius: 8px;
    background: #ecf8ef;
    color: var(--primary-dark);
    font-weight: 600;
    padding: 12px 16px;
    margin-bottom: 0;
}

/* -------------------------
   RECEIPT PANEL
   ------------------------- */
.receipt-panel {
    max-width: 760px;
}

.receipt-box {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background: var(--surface-muted);
}

.receipt-box p {
    margin: 0;
}

.receipt-thanks {
    margin-top: 12px;
    color: var(--primary);
    font-weight: 800;
}

/* -------------------------
   EMPTY STATE
   ------------------------- */
.empty-state {
    border: 1px dashed #c9d6cb;
    border-radius: 8px;
    color: var(--muted);
    padding: 24px 22px;
    text-align: center;
    font-size: 14px;
}

/* -------------------------
   AUTH PAGES
   ------------------------- */
.auth-switch {
    margin: 18px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* -------------------------
   LOGIN PAGE
   ------------------------- */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(19, 37, 29, 0.88), rgba(23, 107, 77, 0.76)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='700' viewBox='0 0 900 700'%3E%3Crect width='900' height='700' fill='%23f5f7f4'/%3E%3Cg fill='%23dfe9df'%3E%3Crect x='80' y='90' width='260' height='130' rx='8'/%3E%3Crect x='390' y='120' width='420' height='90' rx='8'/%3E%3Crect x='120' y='280' width='660' height='70' rx='8'/%3E%3Crect x='170' y='400' width='250' height='120' rx='8'/%3E%3Crect x='470' y='390' width='270' height='150' rx='8'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
}

.login-shell {
    width: min(440px, 100%);
}

.login-panel {
    padding: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

.login-panel .brand {
    margin-bottom: 20px;
}

.login-panel .page-heading {
    margin-bottom: 24px;
}

.login-panel .button {
    width: 100%;
    margin-top: 4px;
}

/* -------------------------
   ADMIN SETTINGS GRID
   ------------------------- */
.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.admin-settings-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    background: var(--surface-muted);
    display: grid;
    gap: 10px;
    align-content: start;
}

.admin-settings-card h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.admin-settings-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

/* -------------------------
   COMPARISON CONTROLS
   ------------------------- */
.comparison-controls {
    display: block;
}

/* -------------------------
   PRINT AREA
   ------------------------- */
.print-area {
    /* wrapper for print content */
}

.print-heading {
    display: none;
    margin-bottom: 18px;
}

.print-heading p,
.print-heading h1,
.print-heading span {
    margin: 0;
}

.print-heading p {
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 13px;
}

.print-heading h1 {
    margin-top: 6px;
    font-size: 30px;
    font-weight: 800;
}

.print-heading span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
}

/* -------------------------
   POSITIVE / NEGATIVE
   ------------------------- */
.positive {
    color: var(--primary);
    font-weight: 800;
}

.negative {
    color: var(--red);
    font-weight: 800;
}

/* -------------------------
   NO-PRINT UTILITY
   ------------------------- */
.no-print {
    /* used by print media query */
}

/* ==================
   NOTIFICATION DROPDOWN
   ================== */
.topbar-notifications {
    position: relative;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 460px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.notif-dropdown.open {
    display: flex;
    flex-direction: column;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-muted);
}

.notif-header strong {
    font-size: 15px;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.notif-mark-all:hover {
    text-decoration: underline;
}

.notif-list {
    overflow-y: auto;
    flex: 1;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover {
    background: var(--surface-muted);
}

.notif-item.notif-unread {
    background: rgba(23, 107, 77, 0.04);
    border-left: 3px solid var(--primary);
}

.notif-item.notif-success.notif-unread {
    border-left-color: var(--green);
}

.notif-item.notif-error.notif-unread {
    border-left-color: var(--red);
}

.notif-item.notif-warning.notif-unread {
    border-left-color: var(--gold);
}

.notif-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.notif-body {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    opacity: 0.7;
}

/* ==================
   SETTINGS PAGE
   ================== */
.settings-grid {
    display: grid;
    gap: 22px;
    grid-template-columns: 1fr;
    max-width: 720px;
}

.settings-section {
    padding: 28px;
}

/* ================================================================
   RESPONSIVE: TABLETS (max-width: 980px)
   ================================================================ */
@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 300;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 250;
        display: none;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .topbar-toggle {
        display: flex;
    }

    .topbar-toggle .toggle-chevron {
        display: none;
    }

    .topbar-toggle .toggle-hamburger {
        display: block;
    }

    .topbar-brand {
        display: flex;
    }

    .topbar-username {
        display: none;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        width: 100%;
        max-width: none;
    }

    .metrics-grid,
    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-graphic {
        max-width: 360px;
    }

    .three-columns,
    .two-columns,
    .four-columns {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 240px;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-form.compact-filter {
        grid-template-columns: 1fr;
    }

    .app-footer {
        padding: 18px 20px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ================================================================
   MOBILE TOPBAR (legacy mobile header)
   ================================================================ */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.hamburger {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.hamburger:hover {
    background: var(--surface-muted);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
}

.mobile-topbar-spacer {
    flex: 1;
}

/* ================================================================
   RESPONSIVE: MOBILE (max-width: 640px)
   ================================================================ */
@media (max-width: 640px) {
    .main-content {
        padding: 16px;
    }

    .metrics-grid,
    .action-grid,
    .three-columns,
    .two-columns,
    .four-columns {
        grid-template-columns: 1fr;
    }

    .page-heading h1 {
        font-size: 26px;
    }

    .dashboard-graphic {
        min-height: 145px;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .row-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .row-actions form {
        width: 100%;
    }

    .row-actions .button {
        width: 100%;
        justify-content: center;
    }

    .app-footer {
        padding: 16px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .topbar-logout span {
        display: none;
    }

    .login-panel {
        padding: 24px;
    }

    .panel {
        padding: 18px;
    }

    table {
        min-width: 500px;
    }

    th,
    td {
        padding: 10px 12px;
    }
}

/* ================================================================
   RESPONSIVE: LARGE DESKTOP (min-width: 1400px)
   ================================================================ */
@media (min-width: 1400px) {
    .main-content {
        padding: 40px 48px;
    }
}

/* ================================================================
   DARK THEME (.theme-dark)
   ================================================================ */
.theme-dark,
.theme-system {
    color-scheme: light;
}

.theme-dark {
    --bg: #101513;
    --surface: #18201c;
    --surface-muted: #202b25;
    --text: #f2f7f3;
    --muted: #a8b7ad;
    --line: #2f3d35;
    --primary: #5bd38f;
    --primary-dark: #8be5af;
    --green: #47c784;
    --blue: #6ca4ff;
    --red: #ff7a6f;
    --gold: #f3bd58;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}

.theme-dark .sidebar {
    background: linear-gradient(180deg, #0b1710 0%, #0e1e14 100%);
}

.theme-dark input,
.theme-dark select,
.theme-dark textarea {
    background: #101713;
    border-color: var(--line);
    color: var(--text);
}

.theme-dark input::placeholder,
.theme-dark textarea::placeholder {
    color: var(--muted);
    opacity: 0.5;
}

.theme-dark .button.secondary {
    background: #202b25;
    color: var(--text);
}

.theme-dark .button.secondary:hover {
    background: #28372f;
    border-color: #3a5244;
}

.theme-dark .button.ghost:hover {
    background: #202b25;
    color: var(--text);
}

.theme-dark .button.danger {
    background: #4a201d;
    color: #ffd1cc;
}

.theme-dark .button.danger:hover {
    background: #5c2824;
}

.theme-dark tbody tr:hover {
    background: rgba(91, 211, 143, 0.04);
}

.theme-dark .flash-message {
    border-color: #2f5c43;
    background: #153321;
    color: #bff3d1;
}

.theme-dark .status.ok {
    background: #173a28;
    color: #99efbc;
}

.theme-dark .status.low {
    background: #4a201d;
    color: #ffc8c2;
}

.theme-dark .status-pill.paid {
    background: #173a28;
    color: #99efbc;
}

.theme-dark .status-pill.pending {
    background: #3a2e15;
    color: #f3d57a;
}

.theme-dark .empty-state {
    border-color: #2f3d35;
    color: var(--muted);
}

.theme-dark .login-panel {
    background: rgba(24, 32, 28, 0.96);
}

.theme-dark .dashboard-graphic {
    border-color: #2f3d35;
    background:
        radial-gradient(circle at 20% 18%, rgba(91, 211, 143, 0.18), transparent 30%),
        linear-gradient(135deg, #1a231f, #111815);
}

.theme-dark .graphic-card {
    background: rgba(24, 32, 28, 0.9);
    border-color: rgba(91, 211, 143, 0.18);
}

.theme-dark .graphic-card.small.top {
    background: #17251d;
}

.theme-dark .graphic-card.small.bottom {
    background: #2b2417;
}

.theme-dark .graphic-card.main span {
    background: var(--primary);
}

.theme-dark .graphic-card.main strong {
    background: var(--green);
}

.theme-dark .graphic-card.main i {
    background: #254a35;
}

.theme-dark .receipt-box {
    background: #1c2822;
    border-color: var(--line);
}

.theme-dark .admin-settings-card {
    background: var(--surface-muted);
    border-color: var(--line);
}

.theme-dark .topbar-toggle:hover {
    background: var(--surface-muted);
}

.theme-dark .topbar-bell:hover {
    background: var(--surface-muted);
}

.theme-dark .action-card:hover {
    border-color: #3a5244;
}

.theme-dark .metric-card:hover {
    box-shadow: var(--shadow-lg);
}

.theme-dark code {
    background: var(--surface-muted);
}

.theme-dark .theme-form select {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Dark + User Theme */
.theme-dark.user-theme {
    --bg: #0d1320;
    --surface: #151d2b;
    --surface-muted: #1c2a40;
    --text: #f0f4f8;
    --muted: #94a3b8;
    --line: #263350;
    --primary: #7db4ff;
    --primary-dark: #b8d4ff;
    --green: #38c6e8;
    --blue: #7db4ff;
    --gold: #b794ff;
}

.theme-dark.user-theme .sidebar {
    background: linear-gradient(180deg, #091427 0%, #0d1d35 100%);
}

.theme-dark.user-theme input,
.theme-dark.user-theme select,
.theme-dark.user-theme textarea {
    background: #101825;
    border-color: var(--line);
    color: var(--text);
}

.theme-dark.user-theme .button.secondary {
    background: #1c2a40;
    color: var(--text);
}

.theme-dark.user-theme .button.secondary:hover {
    background: #243654;
}

.theme-dark.user-theme .button.danger {
    background: #3a1d2e;
    color: #ffd1cc;
}

.theme-dark.user-theme .flash-message {
    border-color: #253a5c;
    background: #15243d;
    color: #bfdbfe;
}

.theme-dark.user-theme .status.ok {
    background: #15293a;
    color: #7dd3fc;
}

.theme-dark.user-theme .status.low {
    background: #3a1d2e;
    color: #fecdd3;
}

.theme-dark.user-theme tbody tr:hover {
    background: rgba(125, 180, 255, 0.04);
}

.theme-dark.user-theme .dashboard-graphic {
    border-color: #263350;
    background:
        radial-gradient(circle at 20% 18%, rgba(125, 180, 255, 0.18), transparent 30%),
        linear-gradient(135deg, #141e30, #0e1628);
}

.theme-dark.user-theme .graphic-card {
    background: rgba(21, 29, 43, 0.9);
    border-color: rgba(125, 180, 255, 0.18);
}

.theme-dark.user-theme .graphic-card.small.top {
    background: #162238;
}

.theme-dark.user-theme .graphic-card.small.bottom {
    background: #2a1f3a;
}

.theme-dark.user-theme .login-panel {
    background: rgba(21, 29, 43, 0.96);
}

.theme-dark.user-theme .receipt-box {
    background: #1c2a40;
}

.theme-dark.user-theme .admin-settings-card {
    background: var(--surface-muted);
}

.theme-dark.user-theme .theme-form select {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ================================================================
   USER THEME (.user-theme)
   ================================================================ */
.user-theme {
    --bg: #f3f7ff;
    --surface: #ffffff;
    --surface-muted: #edf4ff;
    --text: #17211a;
    --muted: #647067;
    --line: #d5e0f0;
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --green: #0ea5e9;
    --blue: #2563eb;
    --gold: #7c3aed;
    --shadow: 0 2px 8px rgba(29, 78, 216, 0.06);
    --shadow-lg: 0 8px 30px rgba(29, 78, 216, 0.1);
}

.user-theme .sidebar {
    background: linear-gradient(180deg, #0f2348 0%, #152d5a 100%);
}

.user-theme .nav-links a:hover,
.user-theme .nav-links a.active {
    background: rgba(29, 78, 216, 0.25);
}

.user-theme .brand-mark {
    background: #dbeafe;
    color: #1e3a8a;
}

.user-theme .button.primary {
    background: #1d4ed8;
}

.user-theme .button.primary:hover {
    background: #1e3a8a;
}

.user-theme .flash-message {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.user-theme .status.ok {
    background: #e0f2fe;
    color: #0369a1;
}

.user-theme .status.low {
    background: #fef2f2;
    color: #b91c1c;
}

.user-theme .logout-link {
    background: rgba(255, 255, 255, 0.08);
}

.user-theme .logout-link:hover {
    background: rgba(255, 255, 255, 0.14);
}

.user-theme .dashboard-graphic {
    border-color: #bfdbfe;
    background:
        radial-gradient(circle at 20% 18%, rgba(29, 78, 216, 0.15), transparent 30%),
        linear-gradient(135deg, #ffffff, #eff6ff);
}

.user-theme .graphic-card {
    border-color: rgba(29, 78, 216, 0.14);
}

.user-theme .graphic-card.main span {
    background: #1d4ed8;
}

.user-theme .graphic-card.main strong {
    background: #0ea5e9;
}

.user-theme .graphic-card.main i {
    background: #bfdbfe;
}

.user-theme .graphic-card.small.top {
    background: #eff6ff;
}

.user-theme .graphic-card.small.bottom {
    background: #f5f3ff;
}

.user-theme .metric-card.accent-green {
    border-top-color: var(--green);
}

.user-theme .metric-card.accent-blue {
    border-top-color: var(--blue);
}

.user-theme .metric-card.accent-gold {
    border-top-color: var(--gold);
}

.user-theme .metric-card.accent-red {
    border-top-color: var(--red);
}

.user-theme .receipt-box {
    background: var(--surface-muted);
}

.user-theme .admin-settings-card {
    background: var(--surface-muted);
    border-color: var(--line);
}

.user-theme .theme-form select {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.user-theme .overview-pill {
    background: var(--surface-muted);
    border-color: var(--line);
}

.user-theme .action-card:hover {
    border-color: #93bbfd;
}

.user-theme .topbar {
    border-bottom-color: var(--line);
}

.user-theme .topbar-toggle:hover {
    border-color: var(--primary);
}

/* ================================================================
   SYSTEM THEME - prefers-color-scheme: dark
   ================================================================ */
@media (prefers-color-scheme: dark) {
    .theme-system {
        --bg: #101513;
        --surface: #18201c;
        --surface-muted: #202b25;
        --text: #f2f7f3;
        --muted: #a8b7ad;
        --line: #2f3d35;
        --primary: #5bd38f;
        --primary-dark: #8be5af;
        --green: #47c784;
        --blue: #6ca4ff;
        --red: #ff7a6f;
        --gold: #f3bd58;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.3);
        color-scheme: dark;
    }

    .theme-system .sidebar {
        background: linear-gradient(180deg, #0b1710 0%, #0e1e14 100%);
    }

    .theme-system input,
    .theme-system select,
    .theme-system textarea {
        background: #101713;
        border-color: var(--line);
        color: var(--text);
    }

    .theme-system input::placeholder,
    .theme-system textarea::placeholder {
        color: var(--muted);
        opacity: 0.5;
    }

    .theme-system .button.secondary {
        background: #202b25;
        color: var(--text);
    }

    .theme-system .button.secondary:hover {
        background: #28372f;
        border-color: #3a5244;
    }

    .theme-system .button.ghost:hover {
        background: #202b25;
        color: var(--text);
    }

    .theme-system .button.danger {
        background: #4a201d;
        color: #ffd1cc;
    }

    .theme-system .button.danger:hover {
        background: #5c2824;
    }

    .theme-system tbody tr:hover {
        background: rgba(91, 211, 143, 0.04);
    }

    .theme-system .flash-message {
        border-color: #2f5c43;
        background: #153321;
        color: #bff3d1;
    }

    .theme-system .status.ok {
        background: #173a28;
        color: #99efbc;
    }

    .theme-system .status.low {
        background: #4a201d;
        color: #ffc8c2;
    }

    .theme-system .status-pill.paid {
        background: #173a28;
        color: #99efbc;
    }

    .theme-system .status-pill.pending {
        background: #3a2e15;
        color: #f3d57a;
    }

    .theme-system .empty-state {
        border-color: #2f3d35;
        color: var(--muted);
    }

    .theme-system .login-panel {
        background: rgba(24, 32, 28, 0.96);
    }

    .theme-system .dashboard-graphic {
        border-color: #2f3d35;
        background:
            radial-gradient(circle at 20% 18%, rgba(91, 211, 143, 0.18), transparent 30%),
            linear-gradient(135deg, #1a231f, #111815);
    }

    .theme-system .graphic-card {
        background: rgba(24, 32, 28, 0.9);
        border-color: rgba(91, 211, 143, 0.18);
    }

    .theme-system .graphic-card.small.top {
        background: #17251d;
    }

    .theme-system .graphic-card.small.bottom {
        background: #2b2417;
    }

    .theme-system .graphic-card.main span {
        background: var(--primary);
    }

    .theme-system .graphic-card.main strong {
        background: var(--green);
    }

    .theme-system .graphic-card.main i {
        background: #254a35;
    }

    .theme-system .receipt-box {
        background: #1c2822;
        border-color: var(--line);
    }

    .theme-system .admin-settings-card {
        background: var(--surface-muted);
        border-color: var(--line);
    }

    .theme-system .theme-form select {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .theme-system .action-card:hover {
        border-color: #3a5244;
    }

    .theme-system code {
        background: var(--surface-muted);
    }

    .theme-system .topbar-toggle:hover {
        background: var(--surface-muted);
    }

    .theme-system .topbar-bell:hover {
        background: var(--surface-muted);
    }
}

/* System theme + User theme */
@media (prefers-color-scheme: dark) {
    .theme-system.user-theme {
        --bg: #0d1320;
        --surface: #151d2b;
        --surface-muted: #1c2a40;
        --text: #f0f4f8;
        --muted: #94a3b8;
        --line: #263350;
        --primary: #7db4ff;
        --primary-dark: #b8d4ff;
        --green: #38c6e8;
        --blue: #7db4ff;
        --gold: #b794ff;
    }

    .theme-system.user-theme .sidebar {
        background: linear-gradient(180deg, #091427 0%, #0d1d35 100%);
    }

    .theme-system.user-theme input,
    .theme-system.user-theme select,
    .theme-system.user-theme textarea {
        background: #101825;
        border-color: var(--line);
        color: var(--text);
    }

    .theme-system.user-theme .button.secondary {
        background: #1c2a40;
        color: var(--text);
    }

    .theme-system.user-theme .button.secondary:hover {
        background: #243654;
    }

    .theme-system.user-theme .button.danger {
        background: #3a1d2e;
        color: #ffd1cc;
    }

    .theme-system.user-theme .flash-message {
        border-color: #253a5c;
        background: #15243d;
        color: #bfdbfe;
    }

    .theme-system.user-theme .status.ok {
        background: #15293a;
        color: #7dd3fc;
    }

    .theme-system.user-theme .status.low {
        background: #3a1d2e;
        color: #fecdd3;
    }

    .theme-system.user-theme tbody tr:hover {
        background: rgba(125, 180, 255, 0.04);
    }

    .theme-system.user-theme .dashboard-graphic {
        border-color: #263350;
        background:
            radial-gradient(circle at 20% 18%, rgba(125, 180, 255, 0.18), transparent 30%),
            linear-gradient(135deg, #141e30, #0e1628);
    }

    .theme-system.user-theme .graphic-card {
        background: rgba(21, 29, 43, 0.9);
        border-color: rgba(125, 180, 255, 0.18);
    }

    .theme-system.user-theme .graphic-card.small.top {
        background: #162238;
    }

    .theme-system.user-theme .graphic-card.small.bottom {
        background: #2a1f3a;
    }

    .theme-system.user-theme .login-panel {
        background: rgba(21, 29, 43, 0.96);
    }

    .theme-system.user-theme .receipt-box {
        background: #1c2a40;
    }

    .theme-system.user-theme .admin-settings-card {
        background: var(--surface-muted);
    }

    .theme-system.user-theme .theme-form select {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .theme-system.user-theme .overview-pill {
        background: var(--surface-muted);
        border-color: var(--line);
    }
}

/* ================================================================
   FOOTER
   ================================================================ */
.app-footer {
    margin-top: auto;
    padding: 20px 36px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.footer-inner a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.footer-inner a:hover {
    text-decoration: underline;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
    :root {
        --bg: #ffffff;
        --surface: #ffffff;
        --surface-muted: #f5f5f5;
        --text: #000000;
        --muted: #555555;
        --line: #e0e0e0;
        --shadow: none;
        --shadow-lg: none;
    }

    body {
        background: #ffffff;
        font-size: 12px;
    }

    .sidebar,
    .mobile-topbar,
    .topbar,
    .no-print,
    .app-footer,
    .sidebar-overlay {
        display: none !important;
    }

    .app-shell {
        display: block;
        min-height: auto;
    }

    .main-wrapper {
        min-height: auto;
        margin-left: 0 !important;
    }

    .main-content {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .print-heading {
        display: block;
    }

    .metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .metric-card,
    .panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e0e0e0;
    }

    .panel {
        margin-top: 14px;
        padding: 14px;
    }

    .metric-card:hover {
        box-shadow: none;
    }

    table {
        min-width: 0;
        font-size: 11px;
    }

    th,
    td {
        padding: 6px 8px;
    }

    a {
        color: var(--text);
    }

    .button {
        display: none;
    }

    .page-heading h1 {
        font-size: 24px;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-graphic {
        display: none;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   UTILITIES
   ================================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

/* ================================================================
   SCROLLBAR - GLOBAL
   ================================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* ================================================================
   SELECTION
   ================================================================ */
::selection {
    background: rgba(23, 107, 77, 0.2);
    color: var(--text);
}

/* ================================================================
   FOCUS-VISIBLE OUTLINES
   ================================================================ */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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