/* ============================================
   CITIL LANDSCAPE OS — Design System
   Extracted from approved Stitch export
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Manrope:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');

/* ── Design Tokens ── */
:root {
    /* Surface & Background */
    --color-bg:              #F4F1EA;
    --color-canvas:          #F7F8F5;
    --color-surface:         #FFFFFF;
    --color-surface-dim:     #F5F6F2;
    --color-surface-hover:   #FAFBF9;

    /* Brand & Navigation */
    --color-brand:           #20372C;
    --color-brand-dark:      #17221D;
    --color-brand-light:     #263B32;
    --color-charcoal:        #111817;

    /* Text */
    --color-text-primary:    #17221D;
    --color-text-secondary:  #66706A;
    --color-text-muted:      #929994;

    /* Borders */
    --color-border:          #E4E6E1;
    --color-border-hover:    #C3C7C6;
    --color-divider:         #F0F2ED;

    /* Status */
    --color-success:         #20372C;
    --color-success-bg:      #E8EEEA;
    --color-success-border:  #C2D6CA;
    --color-warning:         #9A6418;
    --color-warning-bg:      #FFF7E8;
    --color-warning-border:  #EED9AE;
    --color-danger:          #B53A3A;
    --color-danger-bg:       #FFF0EF;
    --color-danger-border:   #F0CAC6;
    --color-error:           #ba1a1a;

    /* AI / Gold */
    --color-gold:            #A79262;
    --color-gold-dim:        #8C733E;

    /* Spacing */
    --space-2xs:  0.25rem;
    --space-xs:   0.5rem;
    --space-sm:   0.75rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2rem;
    --space-2xl:  3rem;
    --space-3xl:  4rem;

    /* Radius */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  10px;
    --radius-xl:  12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.02);
    --shadow-md:   0 4px 12px -2px rgba(17,24,23,0.06), 0 1px 2px 0 rgba(17,24,23,0.04);
    --shadow-lg:   0 12px 32px -8px rgba(17,24,23,0.06), 0 1px 2px 0 rgba(17,24,23,0.04);

    /* Sidebar */
    --sidebar-width: 240px;
    --topbar-height: 64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-text-primary);
    background-color: var(--color-canvas);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
input, button, textarea, select { font: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-hover); border-radius: var(--radius-full); }

/* ── Typography ── */
.font-display { font-family: 'Inter Tight', 'Space Grotesk', sans-serif; }
.font-body { font-family: 'Inter', 'Manrope', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

.text-display-xl { font-family: 'Inter Tight', sans-serif; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; text-transform: uppercase; }
.text-headline-lg { font-family: 'Inter Tight', sans-serif; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.text-headline-md { font-family: 'Inter Tight', sans-serif; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.text-headline-sm { font-family: 'Inter Tight', sans-serif; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; text-transform: uppercase; }
.text-editorial { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.text-body-lg { font-size: 16px; line-height: 26px; letter-spacing: -0.01em; }
.text-body-md { font-size: 14px; line-height: 22px; }
.text-body-sm { font-size: 12px; line-height: 18px; }
.text-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.text-tabular { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-surface-dim);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
    user-select: none;
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-brand-name {
    font-family: 'Inter Tight', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-brand-dark);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 9px;
    font-weight: 600;
    color: var(--color-text-secondary);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-version {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    background: var(--color-success-bg);
    color: var(--color-brand);
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: var(--space-xs) var(--space-md);
    display: block;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--space-xs); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px var(--space-xs);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover { background: #EAECE7; color: var(--color-text-primary); }

.sidebar-link.active {
    background: var(--color-success-bg);
    color: var(--color-brand);
    font-weight: 600;
    border-left-color: var(--color-brand);
    padding-left: 10px;
}

.sidebar-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.sidebar-link .material-symbols-outlined { font-size: 18px; }

.sidebar-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px var(--space-xs);
}

.sidebar-ai-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    background: var(--color-success-bg);
    color: var(--color-brand);
}

.sidebar-footer {
    padding: var(--space-xs);
    border-top: 1px solid var(--color-border);
    background: #EEF0EB;
    margin-top: auto;
}

.sidebar-user {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xs);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--color-brand-dark); }
.sidebar-user-role { font-size: 10px; color: var(--color-text-secondary); }

/* ── Top Bar ── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 40;
}

.topbar-search {
    position: relative;
    max-width: 480px;
    flex: 1;
}

.topbar-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-canvas);
    font-size: 13px;
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.topbar-search input:focus { border-color: var(--color-brand-dark); }

.topbar-search .material-symbols-outlined {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--color-text-secondary);
}

.topbar-actions { display: flex; align-items: center; gap: var(--space-md); }

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-canvas);
    padding: 2px;
    gap: 2px;
}

.lang-switcher a {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}

.lang-switcher a:hover { color: var(--color-text-primary); }

.lang-switcher a.active {
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Notification bell */
.topbar-notification {
    position: relative;
    padding: 8px;
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.topbar-notification:hover { background: var(--color-canvas); }

/* ── Main Content Area ── */
.main-wrapper {
    padding-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

.main-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-lg);
}

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

.card-padded { padding: var(--space-lg); }

.card:hover { border-color: var(--color-border-hover); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 var(--space-md);
    height: 40px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--color-brand-dark);
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-brand-dark); background: var(--color-canvas); }

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: none;
}
.btn-ghost:hover { color: var(--color-text-primary); }

.btn-danger {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}
.btn-danger:hover { background: var(--color-danger-bg); }

.btn-ai {
    background: var(--color-brand-light);
    color: #F4F1EA;
    border: 1px solid var(--color-gold);
}

.btn-sm { height: 36px; font-size: 12px; padding: 0 var(--space-sm); }

/* ── Form Inputs ── */
.form-group { margin-bottom: var(--space-lg); }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: 14px;
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--color-brand-dark);
    box-shadow: 0 0 0 1px var(--color-gold);
}

.form-input.error { border-color: var(--color-error); }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2366706A' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-error {
    font-size: 12px;
    color: var(--color-error);
    margin-top: var(--space-2xs);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }

/* ── Alerts ── */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.alert-success { background: var(--color-success-bg); color: var(--color-brand); border: 1px solid var(--color-success-border); }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.badge-success { background: rgba(32,55,44,0.1); color: var(--color-brand); border: 1px solid rgba(32,55,44,0.2); }
.badge-warning { background: rgba(154,100,24,0.08); color: var(--color-warning); border: 1px solid rgba(154,100,24,0.2); }
.badge-danger { background: rgba(181,58,58,0.08); color: var(--color-danger); border: 1px solid rgba(181,58,58,0.2); }
.badge-neutral { background: var(--color-canvas); color: var(--color-text-secondary); border: 1px solid var(--color-border); }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}
.data-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-divider);
    font-size: 13px;
}
.data-table tr:hover td { background: var(--color-surface-hover); }
.data-table .mono { font-family: 'JetBrains Mono', monospace; }
.data-table .text-right { text-align: right; }

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--color-text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    color: var(--color-border-hover);
    margin-bottom: var(--space-md);
}

.empty-state-title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

/* ── Settings Layout ── */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-xl); }

.settings-nav { display: flex; flex-direction: column; gap: 2px; }

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}

.settings-nav-link:hover { background: #EAECE7; color: var(--color-text-primary); }
.settings-nav-link.active { background: var(--color-success-bg); color: var(--color-brand); font-weight: 600; }
.settings-nav-link .material-symbols-outlined { font-size: 18px; }

.settings-panel { max-width: 680px; }
.settings-section { margin-bottom: var(--space-2xl); }
.settings-section-title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
    text-transform: uppercase;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--color-border);
}

/* ── Metric Cards ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.metric-card {
    padding: var(--space-lg);
    transition: background 0.15s;
}
.metric-card:hover { background: var(--color-surface-hover); }
.metric-card:not(:last-child) { border-right: 1px solid var(--color-border); }

.metric-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.metric-value {
    font-family: 'Inter Tight', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    margin-top: var(--space-md);
}

/* ── Login Page ── */
.login-page {
    display: flex;
    min-height: 100vh;
    background: var(--color-canvas);
}

.login-form-area {
    width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-3xl);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.login-visual-area {
    flex: 1;
    background: linear-gradient(135deg, #1a2f26 0%, #2d4a3d 50%, #3d5a4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-visual-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(167,146,98,0.15), transparent 70%);
}

.login-form-wrapper { max-width: 380px; width: 100%; }

.login-brand {
    margin-bottom: var(--space-2xl);
}

.login-welcome {
    font-family: 'Inter Tight', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    margin-bottom: var(--space-xl);
}

.login-secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: var(--space-xl);
}

.login-secure-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-brand);
}

/* ── Error Pages ── */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-xl);
    text-align: center;
}

.error-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 72px;
    font-weight: 700;
    color: var(--color-border-hover);
    margin-bottom: var(--space-md);
}

.error-title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.error-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xl);
}

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: var(--space-xs); justify-content: center; margin-top: var(--space-lg); }
.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}
.pagination a:hover { background: var(--color-border); color: var(--color-text-primary); }
.pagination .active { background: var(--color-brand); color: #fff; }

/* ── Utilities ── */
.sr-only { position: absolute; width: 1px; height: 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-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-xs { gap: var(--space-xs); }
.gap-md { gap: var(--space-md); }
.w-full { width: 100%; }

/* ── Password Toggle ── */
.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
}
.password-toggle:hover { color: var(--color-text-primary); }

/* ── Checkbox ── */
.checkbox-group { display: flex; align-items: center; gap: var(--space-xs); }
.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--color-border-hover);
    border-radius: 3px;
    accent-color: var(--color-brand-dark);
}
.checkbox-group label {
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .metric-card:nth-child(2) { border-right: none; }
    .metric-card:nth-child(1), .metric-card:nth-child(2) { border-bottom: 1px solid var(--color-border); }
    .settings-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .main-wrapper { padding-left: 0; }
    .login-page { flex-direction: column; }
    .login-form-area { width: 100%; padding: var(--space-xl); }
    .login-visual-area { display: none; }
    .metrics-grid { grid-template-columns: 1fr; }
    .metric-card:not(:last-child) { border-right: none; border-bottom: 1px solid var(--color-border); }
}
