/* ==========================================================================
   NIVA Design System — tokens, layout, components
   Light default; dark theme via [data-theme="dark"] on <html>
   ========================================================================== */

:root {
    /* Brand */
    --green-50: #f0f9f2;
    --green-100: #dcf2e3;
    --green-200: #bbe4c9;
    --green-300: #8dcfa6;
    --green-400: #5ab37d;
    --green-500: #37965f;
    --green-600: #28794b;
    --green-700: #22613e;
    --green-800: #1e4d33;
    --green-900: #1a402b;

    /* Semantic */
    --primary: var(--green-600);
    --primary-hover: var(--green-700);
    --primary-soft: var(--green-100);
    --primary-soft-text: var(--green-800);

    --danger: #c0392b;
    --danger-soft: #fdecea;
    --warning: #b7791f;
    --warning-soft: #fef3e0;
    --info: #2563eb;
    --info-soft: #e8f0fe;
    --success: var(--green-600);
    --success-soft: var(--green-100);

    /* Neutrals (light) */
    --bg: #f5f6f4;
    --surface: #ffffff;
    --surface-2: #fafbfa;
    --surface-3: #f0f2ef;
    --border: #e2e5e0;
    --border-strong: #ccd1cb;
    --text: #1d2420;
    --text-2: #4a554d;
    --text-3: #7a867d;

    /* Shape & depth */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgb(20 30 24 / 0.06);
    --shadow: 0 2px 8px rgb(20 30 24 / 0.07), 0 1px 2px rgb(20 30 24 / 0.05);
    --shadow-lg: 0 12px 32px rgb(20 30 24 / 0.14);
    --ring: 0 0 0 3px rgb(40 121 75 / 0.18);

    /* Typography */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

    /* Layout */
    --sidebar-w: 248px;
    --topbar-h: 56px;
    --bottombar-h: 60px;
    --content-max: 1180px;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #111512;
    --surface: #1a1f1b;
    --surface-2: #20261f;
    --surface-3: #272e26;
    --border: #2e362e;
    --border-strong: #3d463c;
    --text: #e8ece8;
    --text-2: #b3bdb2;
    --text-3: #7f8a7e;
    --primary-soft: #1e3327;
    --primary-soft-text: #a9d6bc;
    --danger-soft: #3a2320;
    --warning-soft: #372d1a;
    --info-soft: #1d2c47;
    --success-soft: #1e3327;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 2px 8px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.55);
    --ring: 0 0 0 3px rgb(90 179 125 / 0.25);

    color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; }
img, svg { display: inline-block; vertical-align: middle; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 40;
    transition: transform 0.22s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.sidebar-brand svg { color: var(--primary); }
.sidebar-brand .tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-top: 2px;
    display: block;
}
.sidebar-org {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sidebar-org span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.nav-section { margin: 14px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    margin: 1px 0;
    border-radius: 9px;
    color: var(--text-2);
    font-weight: 500;
}
.nav-link svg { flex-shrink: 0; opacity: 0.75; }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 650; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-footer .grow { flex: 1; min-width: 0; }
.sidebar-footer .email { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    display: none;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .brand { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }

.content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.bottombar {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    height: var(--bottombar-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
    align-items: stretch;
}
.bottombar a, .bottombar .fab-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
}
.bottombar a.active { color: var(--primary); }
.bottombar a:hover { text-decoration: none; color: var(--text); }
.fab {
    width: 52px;
    height: 52px;
    margin-top: -26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    border: none;
}
.fab:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }

.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.4);
    z-index: 35;
}

/* ---------- Page patterns ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; }
.page-header .sub { color: var(--text-3); margin-top: 4px; font-size: 14px; }
.page-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-head h2 { font-size: 16px; }
.card-body { padding: 20px; }
.card-narrow { max-width: 560px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    user-select: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a93226; color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.55; pointer-events: none; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field .error-text { font-size: 12px; color: var(--danger); margin-top: 5px; }

.input, .select, .textarea {
    width: 100%;
    padding: 11px 13px;
    min-height: 44px;
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 90px; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a867d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
}
.input[type="date"] { min-height: 44px; }
.input-sm { padding: 7px 10px; min-height: 36px; font-size: 14px; }
.input-inline { width: auto; }

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.rowlink { color: var(--text); font-weight: 600; }

/* ---------- Badge / chip ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--primary-soft-text); }
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.badge-yellow { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-blue { background: var(--info-soft); color: var(--info); }

/* ---------- Stat cards ---------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 13px; color: var(--text-3); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-2);
}
.empty .empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--text); }
.empty p { max-width: 380px; margin: 0 auto 18px; font-size: 14px; color: var(--text-3); }

/* ---------- Alerts / toasts ---------- */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid transparent;
    margin-bottom: 16px;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgb(192 57 43 / 0.25); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgb(37 99 235 / 0.2); }
.alert-warn { background: var(--warning-soft); color: var(--warning); border-color: rgb(183 121 31 / 0.25); }
.alert-success { background: var(--success-soft); color: var(--primary-soft-text); border-color: rgb(40 121 75 / 0.25); }

.toasts {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 32px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    animation: toast-in 0.25s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast .close { margin-left: auto; color: var(--text-3); cursor: pointer; background: none; border: none; padding: 0; font-size: 16px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: all 0.3s ease; }

.banner {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.banner-warn { background: var(--warning-soft); color: var(--warning); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-info { background: var(--info-soft); color: var(--info); }

/* ---------- Wizard ---------- */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.wizard-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-3);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface);
}
.wizard-step .num {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.wizard-step.active { border-color: var(--primary); color: var(--primary-soft-text); background: var(--primary-soft); }
.wizard-step.active .num { background: var(--primary); color: #fff; }
.wizard-step.done { color: var(--text-2); }
.wizard-step.done .num { background: var(--green-200); color: var(--green-800); }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; animation: pane-in 0.2s ease; }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Type picker (big touch targets) ---------- */
.type-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.type-picker label { cursor: pointer; }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    min-height: 84px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface);
    transition: all 0.15s ease;
}
.type-tile svg { color: var(--text-3); }
.type-picker input:checked + .type-tile {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-soft-text);
}
.type-picker input:checked + .type-tile svg { color: var(--primary); }
.type-picker input:focus-visible + .type-tile { box-shadow: var(--ring); }

/* ---------- Resource rows ---------- */
.res-row {
    display: grid;
    grid-template-columns: 130px 1fr 100px 90px 110px 40px;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    margin-bottom: 8px;
}
.res-row .input, .res-row .select { min-height: 40px; padding: 8px 10px; font-size: 14px; }

/* ---------- Checklist ---------- */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 14px;
}
.check-item .check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-strong);
    color: transparent;
}
.check-item.done .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.check-item.done { color: var(--text-3); }
.check-item.done .lbl { text-decoration: line-through; }
.check-item:not(.done) { font-weight: 550; }

/* ---------- Plan cards ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}
.plan-card.current { border-color: var(--primary); }
.plan-card .flag {
    position: absolute;
    top: -11px;
    left: 20px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
}
.plan-card .price { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.plan-card .price small { font-size: 13px; font-weight: 500; color: var(--text-3); }
.plan-card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; color: var(--text-2); }
.plan-card ul li { display: flex; gap: 8px; align-items: flex-start; }
.plan-card ul li svg { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.plan-card ul li.off { color: var(--text-3); }
.plan-card ul li.off svg { color: var(--border-strong); }

/* ---------- Misc ---------- */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-soft-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.link-list { display: flex; flex-direction: column; }
.link-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    font-weight: 550;
}
.link-list a:last-child { border-bottom: none; }
.link-list a:hover { background: var(--surface-2); text-decoration: none; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 550; }

.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .logo {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 15px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .backdrop.show { display: block; }
    .topbar { display: flex; }
    .bottombar { display: flex; }
    .main { margin-left: 0; padding-bottom: var(--bottombar-h); }
    .content { padding: 20px 16px 80px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .res-row { grid-template-columns: 1fr 1fr; }
    .res-row .res-kind { grid-column: 1 / -1; }
    .form-row { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dt { margin-top: 10px; }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 21px; }
    .wizard-step .txt { display: none; }
    .wizard-step { justify-content: center; }
    .type-picker { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Landing ---------- */
.landing { background: var(--bg); color: var(--text); }
.land-inner { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.land-nav { border-bottom: 1px solid var(--border); background: var(--surface); }
.land-nav .land-inner { padding-top: 12px; padding-bottom: 12px; }
.land-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--primary); }
.land-hero { text-align: center; padding: 84px 20px 64px; }
.land-hero h1 { font-size: 42px; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.land-sub { font-size: 18px; color: var(--muted); margin-top: 18px; }
.land-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding-bottom: 56px; }
.land-feat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.land-feat h3 { font-size: 15px; margin: 12px 0 6px; }
.land-feat p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.land-feat-icon { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.land-plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding-bottom: 64px; }
.land-plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.land-plan-hl { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.land-plan-name { font-weight: 650; font-size: 15px; }
.land-plan-price { font-size: 26px; font-weight: 700; }
.land-plan-price .muted { font-size: 14px; font-weight: 400; }
.land-plan ul { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.land-plan ul li::before { content: '✓'; color: var(--primary); margin-right: 7px; font-weight: 600; }
.land-footer { border-top: 1px solid var(--border); padding: 24px 0; }
@media (max-width: 900px) {
    .land-features, .land-plans { grid-template-columns: repeat(2, 1fr); }
    .land-hero h1 { font-size: 30px; }
}
@media (max-width: 560px) {
    .land-features, .land-plans { grid-template-columns: 1fr; }
    .land-hero { padding: 56px 20px 44px; }
}

/* ---------- Notifications bell ---------- */
.bell-wrap { position: relative; }
.bell-dot { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }


/* Locale switcher */
.locale-switch {
    appearance: none;
    background: var(--surface-2, var(--bg-soft, transparent));
    border: 1px solid var(--border, #d8ddd8);
    border-radius: 8px;
    color: var(--text-2, var(--muted, #5a665c));
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    cursor: pointer;
    flex: 0 0 auto;
}
.locale-switch:hover { border-color: var(--border-strong, #9aa79d); }