/* ==========================================================================
   Doncomie Landlord — design system
   ========================================================================== */
:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --border: #e6e8ef;
    --border-strong: #d5d9e3;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8a94a6;

    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;

    --green: #059669;
    --green-50: #ecfdf5;
    --amber: #d97706;
    --amber-50: #fffbeb;
    --red: #dc2626;
    --red-600: #b91c1c;
    --red-50: #fef2f2;
    --sky: #0284c7;
    --sky-50: #f0f9ff;
    --violet: #7c3aed;
    --violet-50: #f5f3ff;

    --side-bg: #0b1120;
    --side-bg-2: #111a2e;
    --side-text: #94a3b8;
    --side-active: #ffffff;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, .18), 0 4px 8px -4px rgba(15, 23, 42, .08);
    --sidebar-w: 256px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
svg.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }

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

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
    color: var(--side-text);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 22px 18px;
    color: #fff;
}
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #ec4899 100%);
    box-shadow: 0 6px 16px -4px rgba(99, 102, 241, .6);
    color: #fff; font-weight: 800; font-size: 17px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--side-text); text-transform: uppercase; letter-spacing: .12em; margin-top: 3px; }

.sidebar__section { padding: 14px 14px 4px; }
.sidebar__label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #5b6b85; padding: 0 10px 8px; font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; margin-bottom: 2px;
    border-radius: 8px;
    color: var(--side-text); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.nav-link.is-active { background: rgba(99, 102, 241, .16); color: var(--side-active); box-shadow: inset 2px 0 0 #818cf8; }
.nav-link .icon { opacity: .9; }
.nav-link .count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: rgba(255, 255, 255, .08); color: #cbd5e1;
    border-radius: 999px; padding: 1px 8px;
}

.sidebar__footer { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.side-user__name { color: #e2e8f0; font-weight: 600; font-size: 13px; line-height: 1.2; }
.side-user__mail { font-size: 12px; color: var(--side-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.side-user form { margin-left: auto; }
.icon-btn-dark {
    background: transparent; border: 0; color: var(--side-text); cursor: pointer;
    width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
}
.icon-btn-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; }

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

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: 64px; padding: 0 32px;
    display: flex; align-items: center; gap: 16px;
    background: rgba(245, 246, 250, .85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar .topbar__menu { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; min-width: 0; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.crumbs .current { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.env-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-2);
    padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.env-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); }

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

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.backdrop { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    font: inherit; font-weight: 550; font-size: 14px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: #c4c9d6; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eceef4; color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-600); color: #fff; }
.btn-danger-soft { background: var(--red-50); color: var(--red); border-color: #fecaca; }
.btn-danger-soft:hover { background: #fee2e2; color: var(--red-600); }
.btn-warn-soft { background: var(--amber-50); color: #b45309; border-color: #fde68a; }
.btn-warn-soft:hover { background: #fef3c7; color: #92400e; }
.btn-success-soft { background: var(--green-50); color: var(--green); border-color: #a7f3d0; }
.btn-success-soft:hover { background: #d1fae5; color: #047857; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .7; pointer-events: none; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .icon { display: none; }
.icon-btn {
    width: 34px; height: 34px; display: inline-grid; place-items: center;
    border-radius: 8px; border: 1px solid transparent; background: transparent;
    color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: #eceef4; color: var(--text); }

.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 20px !important; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 650; }
.card-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; justify-content: flex-end; gap: 10px; }
.card-danger { border-color: #fecaca; }
.card-danger .card-head { border-bottom-color: #fee2e2; }
.card-danger .card-title { color: var(--red-600); }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 20px; }

/* ---------- Stat tiles ---------- */
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__label { color: var(--text-2); font-size: 13px; font-weight: 550; }
.stat__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.stat__value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat__meta { font-size: 12.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-sky { background: var(--sky-50); color: var(--sky); }
.tone-violet { background: var(--violet-50); color: var(--violet); }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-stat { padding: 18px 20px; border-right: 1px solid var(--border); }
.mini-stat:last-child { border-right: 0; }
.mini-stat__label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.mini-stat__value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mini-stat__hint { font-size: 12px; color: var(--text-3); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .05em;
    padding: 11px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

.tenant-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.tenant-cell__name { font-weight: 600; color: var(--text); }
.tenant-cell__name:hover { color: var(--brand); }
.tenant-cell__sub { font-size: 12.5px; color: var(--text-3); }

.avatar {
    width: 38px; height: 38px; border-radius: 10px;
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; letter-spacing: .02em;
}
.avatar-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 19px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 8px; font-size: 11.5px; }
.avatar-round { border-radius: 50%; }
.av-0 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.av-1 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.av-2 { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.av-3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.av-4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.av-5 { background: linear-gradient(135deg, #14b8a6, #22c55e); }

.domain-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-family: var(--mono); font-size: 12.5px; }
.domain-link:hover { color: var(--brand); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; line-height: 1;
    padding: 5px 9px; border-radius: 999px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-50); color: #047857; }
.badge-red { background: var(--red-50); color: var(--red-600); }
.badge-amber { background: var(--amber-50); color: #b45309; }
.badge-gray { background: #f1f3f7; color: var(--text-2); }
.badge-brand { background: var(--brand-50); color: var(--brand-600); }
.badge-violet { background: var(--violet-50); color: var(--violet); }
.badge-sky { background: var(--sky-50); color: var(--sky); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 2px; background: #eef0f5; padding: 3px; border-radius: 9px; }
.tab { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab .n { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; margin-left: auto; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 36px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.label .opt { color: var(--text-3); font-weight: 400; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.error { font-size: 12.5px; color: var(--red); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.input, .select, .textarea {
    width: 100%; height: 40px; padding: 0 12px;
    font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.input::placeholder, .textarea::placeholder { color: #a3acbd; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.is-invalid { border-color: #f87171 !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px #fee2e2 !important; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon {
    display: flex; align-items: center; padding: 0 12px;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-3); font-size: 13.5px; white-space: nowrap;
}
.input-pw { position: relative; }
.input-pw .input { padding-right: 42px; }
.input-pw button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); }

.form-section { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; padding: 26px 0; border-bottom: 1px solid var(--border); }
.form-section:first-child { padding-top: 0; }
.form-section:last-of-type { border-bottom: 0; }
.form-section__title { font-weight: 650; font-size: 15px; }
.form-section__desc { color: var(--text-2); font-size: 13.5px; margin-top: 6px; }

.plan-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-option { position: relative; cursor: pointer; }
.plan-option input { position: absolute; opacity: 0; }
.plan-option__card {
    border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px; background: var(--surface);
    transition: border-color .15s, box-shadow .15s, background .15s; height: 100%;
}
.plan-option__name { font-weight: 650; display: flex; align-items: center; justify-content: space-between; }
.plan-option__desc { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.plan-option__check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.plan-option input:checked + .plan-option__card { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); background: #fbfbff; }
.plan-option input:checked + .plan-option__card .plan-option__check { background: var(--brand); border-color: var(--brand); color: #fff; }
.plan-option input:focus-visible + .plan-option__card { box-shadow: 0 0 0 3px var(--brand-100); }

/* ---------- Detail lists ---------- */
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px 16px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; color: var(--text); word-break: break-word; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row__main { min-width: 0; flex: 1; }

/* ---------- Tenant hero ---------- */
.hero {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 24px; margin-bottom: 20px;
    background: radial-gradient(1200px 200px at 0% 0%, #eef2ff 0%, transparent 60%), var(--surface);
}
.hero__title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero__meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; color: var(--text-2); font-size: 13px; }
.hero__meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero__actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Alerts & toasts ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; font-size: 13.5px; border: 1px solid; margin-bottom: 20px; }
.alert .icon { margin-top: 1px; }
.alert-title { font-weight: 650; }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: #3730a3; }
.alert-warn { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.alert-danger { background: var(--red-50); border-color: #fecaca; color: #991b1b; }
.alert-success { background: var(--green-50); border-color: #a7f3d0; color: #065f46; }

.toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(400px, calc(100vw - 36px)); }
.toast {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 14px 14px 14px 16px; box-shadow: var(--shadow-lg);
    animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.is-leaving { animation: toast-out .2s ease forwards; }
.toast__icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast__body { flex: 1; font-size: 13.5px; color: var(--text); padding-top: 2px; }
.toast__close { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 6px; }
.toast__close:hover { color: var(--text); background: #f1f3f7; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.console {
    background: #0b1120; color: #cbd5e1; border-radius: 10px; padding: 14px 16px;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap;
    max-height: 260px; overflow: auto; margin-bottom: 20px;
}
.console__head { display: flex; align-items: center; gap: 8px; color: #64748b; margin-bottom: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown__menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
    min-width: 210px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
    display: none; text-align: left;
}
.dropdown.is-open .dropdown__menu { display: block; animation: toast-in .15s ease; }
.dropdown__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: 7px; border: 0; background: none;
    font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
}
.dropdown__item:hover { background: #f3f4f8; color: var(--text); }
.dropdown__item .icon { color: var(--text-3); }
.dropdown__item.is-danger { color: var(--red); }
.dropdown__item.is-danger .icon { color: var(--red); }
.dropdown__sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.is-open { display: flex; }
.modal__overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); animation: fade .2s ease; }
.modal__dialog {
    position: relative; width: 100%; max-width: 460px;
    background: var(--surface); border-radius: 16px; box-shadow: 0 24px 64px -12px rgba(15, 23, 42, .4);
    animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal__body { padding: 24px; }
.modal__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__text { color: var(--text-2); margin-top: 6px; font-size: 13.5px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Bars / chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 10px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bars__track { flex: 1; width: 100%; max-width: 40px; display: flex; align-items: flex-end; }
.bars__bar { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #818cf8, var(--brand)); min-height: 3px; position: relative; transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.bars__bar.is-zero { background: #e7e9f0; }
.bars__val { font-size: 12px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bars__label { font-size: 12px; color: var(--text-3); }

.meter { height: 6px; border-radius: 999px; background: #eef0f5; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #818cf8, var(--brand)); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty__icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.empty__title { font-size: 16px; font-weight: 650; }
.empty__text { color: var(--text-2); margin: 6px auto 18px; max-width: 380px; }

/* ---------- Copy chip ---------- */
.copy {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
    font-family: var(--mono); font-size: 12.5px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 7px; padding: 4px 4px 4px 10px; color: var(--text);
}
.copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 3px; border-radius: 5px; display: grid; place-items: center; }
.copy button:hover { color: var(--brand); background: var(--brand-50); }

.text-muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.fw-6 { font-weight: 600; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .ml-auto { margin-left: auto; }
.w-full { width: 100%; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth__aside {
    position: relative; overflow: hidden; color: #fff; padding: 48px;
    display: flex; flex-direction: column;
    background:
        radial-gradient(600px 400px at 10% 10%, rgba(99, 102, 241, .45), transparent 60%),
        radial-gradient(500px 400px at 90% 90%, rgba(236, 72, 153, .28), transparent 60%),
        linear-gradient(160deg, #0b1120 0%, #111a2e 100%);
}
.auth__aside::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__headline { margin-top: auto; max-width: 460px; }
.auth__headline h2 { font-size: 34px; line-height: 1.15; font-weight: 750; letter-spacing: -.03em; }
.auth__headline p { color: #a5b4cf; margin-top: 14px; font-size: 15px; }
.auth__features { margin-top: 28px; display: grid; gap: 12px; }
.auth__feature { display: flex; align-items: center; gap: 12px; color: #cbd5e1; font-size: 14px; }
.auth__feature .icon-wrap { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #a5b4fc; }
.auth__foot { margin-top: 48px; font-size: 12.5px; color: #64748b; }
.auth__main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth__card { width: 100%; max-width: 380px; }
.auth__card h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.auth__card .sub { color: var(--text-2); margin-top: 6px; margin-bottom: 28px; }

/* ---------- Suspended page ---------- */
.suspended { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 400px at 50% 0%, #eef2ff, transparent 70%), var(--bg); }
.suspended__card { max-width: 480px; text-align: center; padding: 40px 32px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .45); }
    .main { margin-left: 0; }
    .topbar .topbar__menu { display: inline-grid; }
    .form-section { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__aside { display: none; }
}
@media (max-width: 720px) {
    .content { padding: 20px 16px 40px; }
    .topbar { padding: 0 16px; }
    .env-pill { display: none; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mini-stat:nth-child(2n) { border-right: 0; }
    .mini-stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .form-row, .plan-options { grid-template-columns: minmax(0, 1fr); }
    .search { max-width: none; margin-left: 0; }
    .hero__actions { margin-left: 0; width: 100%; }
    .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .dl dd { margin-bottom: 10px; }
    .hide-sm { display: none; }
}
