/* Kian Mas HMCC — design system
   Palette sampled from demo.kianmas.com: deep green #053827,
   cream #FDF9F4, beige #F3EADF, gold #E6C483 / #BF9248. */

:root {
    --font-display: 'Cormorant SC', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-script: 'Alex Brush', 'Segoe Script', cursive;

    --green-950: #032f20;
    --green-900: #053827;
    --green-800: #06402d;
    --green-700: #0b4d3a;
    --green-600: #144c43;
    --green-100: #e4eee8;

    --gold: #bf9248;
    --gold-soft: #e6c483;
    --gold-pale: #f6eecf;

    --bg: #fdf9f4;
    --bg-soft: #f6efe5;
    --surface: #ffffff;
    --surface-2: #fffaf3;
    --surface-3: #f3eadf;
    --ink: #16241f;
    --ink-soft: #3f5349;
    --muted: #77877e;
    --line: #e8dccb;
    --line-strong: #d9c8b0;

    --success: #2f6b4f;
    --success-bg: #e7f1eb;
    --warning: #9a6c16;
    --warning-bg: #fbf1da;
    --danger: #84212f;
    --danger-bg: #f8e7e9;
    --info: #29675d;
    --info-bg: #e4eeec;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 4px 14px rgba(5, 56, 39, 0.05);
    --shadow: 0 18px 40px rgba(5, 56, 39, 0.08);
    --sidebar-width: 272px;
}

html[data-theme='dark'] {
    --bg: #0b1712;
    --bg-soft: #0e1d17;
    --surface: #12261f;
    --surface-2: #163029;
    --surface-3: #1b3a31;
    --ink: #eef3ef;
    --ink-soft: #c7d5cc;
    --muted: #93a79b;
    --line: #24423a;
    --line-strong: #2f5349;

    --green-100: #1b3a31;
    --success-bg: #173327;
    --warning-bg: #3a2d12;
    --danger-bg: #3a1a20;
    --info-bg: #163230;

    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; margin: 0; color: var(--ink); }

.icon { width: 19px; height: 19px; flex: 0 0 auto; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--green-900) 0%, var(--green-950) 100%);
    color: #f2f5f2;
    z-index: 40;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar-brand { padding: 20px 20px 14px; text-align: center; }

.brand-link { display: block; }

.brand-logo {
    width: 100%;
    max-width: 214px;
    background: var(--bg);
    border-radius: 14px;
    padding: 10px 12px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.brand-caption {
    margin: 12px 0 0;
    font-size: 10.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(230, 196, 131, 0.85);
}

.sidebar-nav { padding: 6px 14px 20px; flex: 1; min-height: 0; overflow-y: auto; }

.nav-label {
    margin: 20px 10px 8px;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 3px;
    border-radius: 11px;
    color: rgba(244, 248, 245, 0.82);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.is-active {
    background: rgba(230, 196, 131, 0.14);
    border-left-color: var(--gold-soft);
    color: var(--gold-pale);
}
.nav-item .icon { opacity: 0.9; }

.sidebar-footer {
    padding: 16px 22px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}
.sidebar-role { margin: 0 0 2px; color: rgba(255, 255, 255, 0.8); font-weight: 600; }
.sidebar-meta { margin: 0 0 6px; }
.sidebar-version { margin: 0; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(230, 196, 131, 0.5); }
.app-credit { margin: 6px 0 0; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.26); }

.app-main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-scope { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.topbar-scope .scope-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.topbar-scope strong { font-family: var(--font-display); font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.assignment-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.assignment-switch select {
    border: 0;
    background: transparent;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    padding: 0 20px 0 0;
    max-width: 340px;
    text-overflow: ellipsis;
}
.assignment-switch select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 640px) {
    .assignment-switch select { max-width: 190px; }
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--green-800); border-color: var(--line); }

.badge-dot {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--gold);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

html[data-theme='light'] .theme-icon-dark,
html[data-theme='dark'] .theme-icon-light { display: none; }
html[data-theme='dark'] .theme-icon-dark { display: inline-flex; }
html[data-theme='dark'] .theme-icon-light { display: none; }

.user-menu { position: relative; }
.user-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px 4px 4px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-3); border-color: var(--line); }
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--green-900);
    color: var(--gold-pale);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 250px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    z-index: 60;
}
.user-menu-email { margin: 0 0 2px; font-weight: 600; font-size: 13px; word-break: break-all; }
.user-menu-scope { margin: 0 0 12px; font-size: 12px; color: var(--muted); }

.content { padding: 30px 32px 60px; max-width: 1360px; width: 100%; margin: 0 auto; }

.sidebar-scrim { display: none; }

/* ---------- Page header ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-title { font-size: 32px; line-height: 1.1; }
.page-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; max-width: 640px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-cluster { display: inline-flex; flex-wrap: wrap; gap: 6px; }

.eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 700;
    margin: 0 0 6px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 11px;
    border: 1px solid transparent;
    background: var(--green-900);
    color: #fdf9f4;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    line-height: 1.2;
}
.btn:hover { background: var(--green-700); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }

.btn-accent { background: var(--gold); color: #2a1f0c; }
.btn-accent:hover { background: var(--gold-soft); color: #2a1f0c; }

.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--green-800); }
.btn-outline:hover { background: var(--gold-pale); border-color: var(--gold); color: var(--green-900); }
html[data-theme='dark'] .btn-outline { color: var(--gold-soft); }
html[data-theme='dark'] .btn-outline:hover { background: var(--surface-3); }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.btn-link { background: none; border: 0; color: var(--gold); font-weight: 600; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}
.card-title { font-size: 19px; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 22px; }
.card-body-tight { padding: 8px 22px 18px; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.stack-6 > * + * { margin-top: 6px; }
.stack-10 > * + * { margin-top: 10px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }

/* ---------- Stats ---------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.stat::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-soft), transparent);
    opacity: 0.9;
}
.stat-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-size: 34px; line-height: 1.05; margin: 10px 0 4px; color: var(--green-800); }
html[data-theme='dark'] .stat-value { color: var(--gold-pale); }
.stat-foot { font-size: 12px; color: var(--muted); margin: 0; }
.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--gold);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-neutral { background: var(--surface-3); color: var(--ink-soft); border-color: var(--line); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gold { background: var(--gold-pale); color: #7a5a1f; }
html[data-theme='dark'] .badge-gold { background: #3a2f18; color: var(--gold-soft); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid var(--line);
}
.chip-gold { background: var(--gold-pale); color: #7a5a1f; border-color: transparent; }
html[data-theme='dark'] .chip-gold { background: #3a2f18; color: var(--gold-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.table .muted { color: var(--muted); font-size: 12.5px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(191, 146, 72, 0.18);
}
.field textarea { min-height: 110px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger); }
.kpi-input { max-width: 160px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field input[type='file'] { padding: 8px; background: var(--surface-2); }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.form-actions .spacer { flex: 1; }

.inline-form { display: inline; }

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.filters .field { min-width: 180px; }
.filters .grow { flex: 1; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty .empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--gold);
}
.empty h3 { font-size: 20px; margin-bottom: 6px; color: var(--ink); }
.empty p { margin: 0 auto 18px; max-width: 420px; font-size: 13px; }

/* ---------- Calendar ---------- */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.cal-month { font-family: var(--font-display); font-size: 22px; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-content { background: var(--green-600); }
.dot-campaign { background: var(--gold); }
.dot-event { background: var(--info); }
.dot-promo { background: var(--danger); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--line);
}
.cal-dow {
    padding: 10px 12px;
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.cal-cell {
    min-height: 118px;
    padding: 8px 9px 10px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.is-blank { background: var(--surface-2); }
.cal-cell.is-today { background: color-mix(in srgb, var(--gold-pale) 55%, var(--surface)); }
html[data-theme='dark'] .cal-cell.is-today { background: var(--surface-3); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.cal-cell.is-today .cal-date { color: var(--gold); }
.cal-event {
    display: block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: var(--surface-3);
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid var(--green-600);
}
.cal-event:hover { color: var(--green-800); background: var(--gold-pale); }
html[data-theme='dark'] .cal-event:hover { color: var(--gold-pale); background: var(--surface-3); }
.cal-event.type-campaign { border-left-color: var(--gold); }
.cal-event.type-event { border-left-color: var(--info); }
.cal-event.type-promo { border-left-color: var(--danger); }
.cal-more { font-size: 10.5px; color: var(--muted); }

/* ---------- Asset grid ---------- */
.asset-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.asset-thumb {
    aspect-ratio: 4 / 3;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    color: var(--muted);
    overflow: hidden;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb .icon { width: 40px; height: 40px; }
.asset-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.asset-title { font-weight: 600; font-size: 14px; }
.asset-meta { font-size: 11.5px; color: var(--muted); }
.asset-actions { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; align-items: center; }

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 12%, rgba(230, 196, 131, 0.22), transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(5, 56, 39, 0.16), transparent 48%),
        var(--bg);
}
.auth-theme { position: fixed; top: 18px; right: 18px; z-index: 10; background: var(--surface); border-color: var(--line); }

.auth-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.auth-brand {
    position: relative;
    padding: 44px 42px;
    background: linear-gradient(160deg, var(--green-900), var(--green-950));
    color: #f7f4ee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 520px;
}
.auth-brand::after {
    content: '';
    position: absolute;
    inset: auto -40px -60px auto;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    border: 1px solid rgba(230, 196, 131, 0.25);
}
.auth-logo {
    width: 100%;
    max-width: 300px;
    background: var(--bg);
    padding: 14px 16px;
    border-radius: 16px;
}
.auth-tagline {
    font-family: var(--font-script);
    font-size: 38px;
    line-height: 1.1;
    color: var(--gold-soft);
    margin: 28px 0 8px;
}
.auth-brand-copy { font-size: 13px; color: rgba(255, 255, 255, 0.72); max-width: 320px; margin: 0; }
.auth-brand-foot { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(230, 196, 131, 0.65); }
.auth-credit.app-credit { margin-top: 14px; color: var(--muted); opacity: 0.6; }
.auth-form { padding: 46px 42px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { font-size: 30px; margin-bottom: 4px; }
.auth-form .auth-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .btn { margin-top: 8px; }
.auth-note { margin: 18px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.auth-flash { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 20; min-width: 320px; box-shadow: var(--shadow-sm); }

.setup-shell { width: min(880px, 100%); margin: 10px auto; }
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.setup-head { padding: 30px 36px 24px; background: linear-gradient(160deg, var(--green-900), var(--green-950)); color: #f7f4ee; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.setup-head img { width: 180px; background: var(--bg); padding: 9px 11px; border-radius: 12px; }
.setup-head h1 { color: #fff; font-size: 26px; margin-bottom: 4px; }
.setup-head p { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.7); }
.setup-body { padding: 30px 36px 36px; }
.setup-section { margin-bottom: 28px; }
.setup-section h2 { font-size: 19px; margin-bottom: 4px; }
.setup-section .section-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.setup-foot { margin-top: 8px; }

/* ---------- Misc ---------- */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 22px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-weight: 600; font-size: 13.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }

.divider { height: 1px; background: var(--line); border: 0; margin: 20px 0; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-700), var(--gold)); }
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 20px; }
.page-link {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12.5px;
}
.page-link.is-active { background: var(--green-900); color: #fff; border-color: var(--green-900); }
.page-link:hover { border-color: var(--gold); color: var(--gold); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}
.tab.is-active { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.tab:hover { border-color: var(--gold); color: var(--gold); }

.note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
}
.note .icon { color: var(--gold); width: 17px; height: 17px; margin-top: 1px; }

.brand-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, var(--green-900), var(--green-800));
    color: #f7f4ee;
    border: 1px solid rgba(230, 196, 131, 0.25);
}
.brand-strip img { width: 128px; background: var(--bg); border-radius: 10px; padding: 7px 9px; }
.brand-strip p { margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.75); }
.brand-strip strong { display: block; font-family: var(--font-display); font-size: 18px; color: #fff; }

/* ---------- Department workspaces ---------- */
.ws-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.ws-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; min-width: 0; }
.ws-card-head { display: flex; align-items: flex-start; gap: 14px; }
.ws-card-head .card-title { font-size: 18px; }
.ws-card-head .card-sub { line-height: 1.5; }
.ws-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.ws-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--success-bg);
    color: var(--success);
}
html[data-theme='dark'] .ws-icon { background: #173327; color: var(--gold-soft); }
.ws-icon .icon { width: 21px; height: 21px; }
.ws-icon-sm { width: 36px; height: 36px; border-radius: 10px; }
.ws-icon-sm .icon { width: 18px; height: 18px; }

.ws-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.ws-stats strong {
    display: block;
    font-family: var(--font-display);
    font-size: 22px;
    line-height: 1.1;
    color: var(--green-800);
}
html[data-theme='dark'] .ws-stats strong { color: var(--gold-pale); }
.ws-stats span { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ws-stats-wide { grid-column: span 2; }
.ws-stats-wide strong { font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink); }

.module-card .card-head { align-items: flex-start; padding: 16px 18px 12px; border-bottom: 0; }
.module-card .card-title { font-size: 17px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }

.chip-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.chip-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.chip-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.chip-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip-neutral { background: var(--surface-3); color: var(--ink-soft); }

.checklist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
}
.checklist-item form { display: flex; }
.check-toggle {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 1.5px solid var(--line-strong, var(--line));
    background: var(--surface);
    color: var(--success);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}
.check-toggle .icon { width: 14px; height: 14px; }
.checklist-item.is-done .check-toggle { background: var(--success-bg); border-color: var(--success); }
.checklist-item.is-done .check-label { text-decoration: line-through; color: var(--muted); }
.check-label { flex: 1; min-width: 0; font-size: 13.5px; }
.checklist-add { display: flex; gap: 8px; align-items: center; }
.checklist-add input { flex: 1; }

.ws-tabs { margin-bottom: 20px; }

.ws-detail { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

.nowrap { white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(0, 0, 0, 0.35); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(3, 20, 14, 0.45);
        z-index: 35;
    }
    .app-main { margin-left: 0; }
    .topbar { padding: 10px 18px; }
    .content { padding: 22px 18px 50px; }
    .topbar-menu { display: inline-flex; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { min-height: auto; padding: 30px; }
    .auth-brand .auth-tagline { font-size: 30px; margin: 18px 0 6px; }
    .auth-brand-foot { display: none; }
    .ws-detail { grid-template-columns: 1fr; }
}

@media (min-width: 1025px) {
    .topbar-menu { display: none; }
}

@media (max-width: 760px) {
    .page-title { font-size: 26px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .cal-grid { min-width: 720px; }
    .calendar-scroll { overflow-x: auto; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 10px; }
    .setup-body { padding: 22px 20px 30px; }
    .setup-head { padding: 24px 20px; }
    .user-meta { display: none; }
    .auth-form { padding: 32px 24px; }
    .content { padding: 18px 14px 44px; }
    .stat { padding: 16px; }
    .stat-value { font-size: 28px; }
    .card-head { flex-wrap: wrap; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters .field { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media print {
    @page { size: A4; margin: 12mm 10mm; }
    .sidebar,
    .topbar,
    .sidebar-scrim,
    .page-actions,
    .filters,
    .tabs,
    .pagination {
        display: none !important;
    }
    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .app-main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
    .table-wrap { overflow: visible; }
    .table thead { display: table-header-group; }
    .table tr { break-inside: avoid; }
    .table th, .table td { font-size: 11px; }
    .badge { border: 1px solid #999; }
    a { color: inherit; text-decoration: none; }
    h1, h2, h3 { break-after: avoid; }
    .page-head { margin-bottom: 12px; }
}
