/* ============================================================
   CRE Platform — Main Design System
   Design tokens defined in :root — use variables everywhere.
   Internal platform UI is separate from client-facing branding.
   Mobile-first. Breakpoint: 768px.
   ============================================================ */

/* ─── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
    /* Brand colours */
    --color-primary:     #1F4E79;   /* navy — headers, sidebar, primary buttons */
    --color-accent:      #C9922A;   /* gold — highlights, alerts, secondary actions */
    --color-bg:          #F8F5EF;   /* warm cream — page background */
    --color-sidebar:     #0D1F35;   /* dark navy — navigation sidebar */

    /* Surface colours */
    --color-surface:     #FFFFFF;
    --color-border:      #E4DDD4;
    --color-input-bg:    #FAFAF8;

    /* Status colours */
    --color-success:     #2E7D32;
    --color-warning:     #F57F17;
    --color-danger:      #C62828;
    --color-info:        #1565C0;

    /* Text colours */
    --color-text:        #1A1A1A;
    --color-text-muted:  #6B6457;
    --color-text-light:  #9E9690;

    /* Typography */
    --font-ui:       'DM Sans', Arial, sans-serif;
    --font-heading:  'DM Serif Display', serif;
    --font-fallback: Arial, sans-serif;

    /* Sizing */
    --sidebar-width:    240px;
    --header-height:    60px;
    --radius-card:      12px;
    --radius-btn:       8px;
    --radius-input:     6px;
    --shadow-card:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-modal:     0 20px 60px rgba(0,0,0,0.2);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-ui);
    background:  var(--color-bg);
    color:       var(--color-text);
    line-height: 1.5;
    min-height:  100vh;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    line-height: 1.25;
    color: var(--color-primary);
}

h1 { font-size: 2rem;    }
h2 { font-size: 1.5rem;  }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-family: var(--font-ui); font-weight: 600; }

p  { margin-bottom: 0.75rem; }
small { font-size: 0.8125rem; color: var(--color-text-muted); }

/* ─── Layout: App Shell ─────────────────────────────────────── */
/* Used on all authenticated pages. Structure:
   <div class="app-shell">
     <nav class="sidebar">…</nav>
     <div class="main-area">
       <header class="topbar">…</header>
       <main class="page-content">…</main>
     </div>
   </div>
*/
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width:      var(--sidebar-width);
    background: var(--color-sidebar);
    color:      #FFFFFF;
    display:    flex;
    flex-direction: column;
    position:   fixed;
    top:        0;
    left:       0;
    height:     100vh;
    z-index:    100;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo img {
    height: 32px;
    width:  auto;
}

.sidebar-logo-text {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: #FFFFFF;
    line-height: 1.2;
}

.sidebar-logo-text span {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    padding: 0.75rem 1.5rem 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: #FFFFFF;
    text-decoration: none;
}

.nav-link.active {
    background:   rgba(201,146,42,0.15);
    color:        var(--color-accent);
    border-color: var(--color-accent);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

/* ─── Main Area ─────────────────────────────────────────────── */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
    height:     var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-family: var(--font-ui);
    font-size:   1rem;
    font-weight: 600;
    color:       var(--color-text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Alert bell */
.alert-bell {
    position: relative;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem;
}

.alert-bell:hover { color: var(--color-primary); }

.alert-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--color-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-btn);
    transition: background 0.15s;
}

.user-menu:hover { background: var(--color-bg); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Hamburger — mobile only */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    padding: 0.25rem;
}

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--color-text-muted);
    margin: 0;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow:    var(--shadow-card);
    padding:       1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ─── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding:       1.25rem;
    position:      relative;
    overflow:      hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
}

.kpi-card.accent::before { background: var(--color-accent); }
.kpi-card.success::before { background: var(--color-success); }
.kpi-card.warning::before { background: var(--color-warning); }

.kpi-label {
    font-size:   0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size:   2rem;
    font-weight: 700;
    color:       var(--color-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

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

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display:        inline-flex;
    align-items:    center;
    gap:            0.4rem;
    padding:        0.5rem 1rem;
    border-radius:  var(--radius-btn);
    font-family:    var(--font-ui);
    font-size:      0.875rem;
    font-weight:    500;
    cursor:         pointer;
    border:         1px solid transparent;
    transition:     all 0.15s ease;
    white-space:    nowrap;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: #174070;
    border-color: #174070;
}

.btn-accent {
    background: var(--color-accent);
    color: #FFFFFF;
    border-color: var(--color-accent);
}

.btn-accent:hover {
    background: #B07F22;
    border-color: #B07F22;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: #FFFFFF;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

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

.btn-sm {
    padding:   0.3rem 0.65rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding:   0.75rem 1.5rem;
    font-size: 1rem;
}

.btn svg {
    width:  16px;
    height: 16px;
    flex-shrink: 0;
}

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display:     block;
    font-size:   0.8125rem;
    font-weight: 600;
    color:       var(--color-text);
    margin-bottom: 0.375rem;
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

.form-control {
    width:          100%;
    padding:        0.5rem 0.75rem;
    border:         1px solid var(--color-border);
    border-radius:  var(--radius-input);
    font-family:    var(--font-ui);
    font-size:      0.9rem;
    color:          var(--color-text);
    background:     var(--color-input-bg);
    transition:     border-color 0.15s, box-shadow 0.15s;
    appearance:     none;
}

.form-control:focus {
    outline:      none;
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(31,78,121,0.12);
    background:   #FFFFFF;
}

.form-control::placeholder {
    color: var(--color-text-light);
}

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

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6457' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

.form-hint {
    font-size: 0.78rem;
    color:     var(--color-text-muted);
    margin-top: 0.3rem;
}

/* ── Password show/hide toggle ─────────────────────────────────────────────── */
.password-wrap {
    position: relative;
}
.password-wrap .form-control {
    padding-right: 2.6rem;
}
.password-toggle {
    position:   absolute;
    right:      0.65rem;
    top:        50%;
    transform:  translateY(-50%);
    background: none;
    border:     none;
    padding:    0.2rem;
    cursor:     pointer;
    color:      var(--color-text-muted);
    line-height: 1;
    display:    flex;
    align-items: center;
}
.password-toggle:hover {
    color: var(--color-text);
}

.form-error {
    font-size: 0.78rem;
    color:     var(--color-danger);
    margin-top: 0.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─── Tables ────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    background:  var(--color-primary);
    color:       #FFFFFF;
    font-weight: 600;
    font-size:   0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding:     0.75rem 1rem;
    text-align:  left;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background 0.1s;
}

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

tbody tr:hover { background: rgba(31,78,121,0.03); }

tbody td {
    padding: 0.75rem 1rem;
    color:   var(--color-text);
}

/* ─── Badges / Pills ────────────────────────────────────────── */
.badge {
    display:        inline-flex;
    align-items:    center;
    padding:        0.2rem 0.5rem;
    border-radius:  20px;
    font-size:      0.72rem;
    font-weight:    600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space:    nowrap;
}

.badge-primary { background: rgba(31,78,121,0.12);  color: var(--color-primary); }
.badge-accent  { background: rgba(201,146,42,0.15); color: #9A6E1A; }
.badge-success { background: rgba(46,125,50,0.12);  color: var(--color-success); }
.badge-warning { background: rgba(245,127,23,0.15); color: #BF6000; }
.badge-danger  { background: rgba(198,40,40,0.12);  color: var(--color-danger); }
.badge-neutral { background: var(--color-bg);        color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ─── Stage Pipeline ────────────────────────────────────────── */
.stage-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.stage-step {
    display:      flex;
    align-items:  center;
    flex-shrink:  0;
}

.stage-label {
    padding:       0.4rem 1rem;
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    font-size:     0.78rem;
    font-weight:   500;
    color:         var(--color-text-muted);
    position:      relative;
    white-space:   nowrap;
}

.stage-label.active {
    background:    var(--color-primary);
    color:         #FFFFFF;
    border-color:  var(--color-primary);
    font-weight:   600;
}

.stage-label.completed {
    background:   rgba(46,125,50,0.1);
    color:        var(--color-success);
    border-color: rgba(46,125,50,0.3);
}

.stage-arrow {
    color:      var(--color-border);
    font-size:  1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ─── Alerts / Notifications ────────────────────────────────── */
.alert {
    display:       flex;
    align-items:   flex-start;
    gap:           0.75rem;
    padding:       0.875rem 1rem;
    border-radius: var(--radius-input);
    border:        1px solid transparent;
    margin-bottom: 1rem;
    font-size:     0.875rem;
}

.alert-success { background: rgba(46,125,50,0.08);  border-color: rgba(46,125,50,0.3);  color: var(--color-success); }
.alert-warning { background: rgba(245,127,23,0.08); border-color: rgba(245,127,23,0.3); color: #8B4800; }
.alert-danger  { background: rgba(198,40,40,0.08);  border-color: rgba(198,40,40,0.3);  color: var(--color-danger); }
.alert-info    { background: rgba(21,101,192,0.08); border-color: rgba(21,101,192,0.3); color: var(--color-info); }

/* ─── Toast Notifications ───────────────────────────────────── */
#toast-container {
    position:   fixed;
    bottom:     1.5rem;
    right:      1.5rem;
    z-index:    9999;
    display:    flex;
    flex-direction: column;
    gap:        0.5rem;
    pointer-events: none;
}

.toast {
    background:    var(--color-sidebar);
    color:         #FFFFFF;
    padding:       0.75rem 1.25rem;
    border-radius: var(--radius-btn);
    font-size:     0.875rem;
    box-shadow:    var(--shadow-modal);
    animation:     toast-in 0.2s ease;
    pointer-events: auto;
    max-width:     320px;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error   { border-left: 4px solid var(--color-danger); }
.toast.warning { border-left: 4px solid var(--color-warning); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,0.5);
    z-index:    200;
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
    background:    var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow:    var(--shadow-modal);
    width:         100%;
    max-width:     560px;
    max-height:    90vh;
    overflow-y:    auto;
}

.modal-header {
    display:       flex;
    align-items:   center;
    justify-content: space-between;
    padding:       1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size:   1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border:     none;
    cursor:     pointer;
    color:      var(--color-text-muted);
    font-size:  1.25rem;
    line-height: 1;
    padding:    0.25rem;
}

.modal-close:hover { color: var(--color-text); }

.modal-body   { padding: 1.5rem; }
.modal-footer {
    padding:      1rem 1.5rem;
    border-top:   1px solid var(--color-border);
    display:      flex;
    gap:          0.75rem;
    justify-content: flex-end;
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align:  center;
    padding:     3rem 1rem;
    color:       var(--color-text-muted);
}

.empty-state svg {
    width:  48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-family: var(--font-ui);
    font-size:   1rem;
    font-weight: 600;
    color:       var(--color-text-muted);
    margin-bottom: 0.5rem;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.spinner {
    width:  32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Login Page ────────────────────────────────────────────── */
.login-page {
    min-height:      100vh;
    display:         flex;
    align-items:     center;
    justify-content: center;
    background:      var(--color-bg);
    padding:         1rem;
}

.login-card {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow:    var(--shadow-modal);
    width:         100%;
    max-width:     420px;
    padding:       2.5rem;
}

.login-logo {
    text-align:    center;
    margin-bottom: 2rem;
}

.login-logo img {
    height: 48px;
    margin: 0 auto 0.75rem;
}

.login-logo h1 {
    font-size:     1.5rem;
    color:         var(--color-primary);
    margin-bottom: 0.25rem;
}

.login-logo p {
    font-size: 0.85rem;
    color:     var(--color-text-muted);
    margin:    0;
}

/* ─── Settings Tabs ─────────────────────────────────────────── */
.tabs {
    display:       flex;
    gap:           0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    overflow-x:    auto;
}

.tab-btn {
    padding:     0.625rem 1.25rem;
    border:      none;
    background:  none;
    cursor:      pointer;
    font-family: var(--font-ui);
    font-size:   0.875rem;
    font-weight: 500;
    color:       var(--color-text-muted);
    border-bottom: 2px solid transparent;
    white-space:  nowrap;
    transition:   all 0.15s;
}

.tab-btn:hover { color: var(--color-primary); }

.tab-btn.active {
    color:        var(--color-primary);
    border-color: var(--color-primary);
    font-weight:  600;
}

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

/* ─── Section Divider ───────────────────────────────────────── */
.section-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
}

/* ─── Color Swatch ──────────────────────────────────────────── */
.color-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-field input[type="color"] {
    width:  40px;
    height: 38px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    cursor: pointer;
    padding: 2px;
    background: var(--color-input-bg);
}

.color-field .form-control {
    flex: 1;
}

/* ─── Utility Classes ───────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger  { color: var(--color-danger); }
.text-accent  { color: var(--color-accent); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.full-width { width: 100%; }

/* ─── Mobile Responsiveness (768px breakpoint) ───────────────── */
@media (max-width: 768px) {
    /* Sidebar becomes a slide-over on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay behind open sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }

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

    /* Main area takes full width on mobile */
    .main-area {
        margin-left: 0;
    }

    /* Show hamburger button */
    .sidebar-toggle {
        display: block;
    }

    /* Stack form rows on mobile */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* KPI grid: 2 columns on mobile */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Page padding reduction */
    .page-content {
        padding: 1rem;
    }

    /* Topbar */
    .topbar {
        padding: 0 1rem;
    }

    /* Login card */
    .login-card {
        padding: 1.75rem 1.25rem;
    }

    /* Modal full-screen on mobile */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        max-width: 100%;
        border-radius: var(--radius-card) var(--radius-card) 0 0;
        max-height: 85vh;
    }
}

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