/* ==========================================================================
   Promo Dashboard — clean, minimal design system
   ========================================================================== */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #f9fafb;
    --border: #e6e8ec;
    --border-strong: #d5d9e0;
    --text: #111827;
    --text-muted: #6b7280;
    --text-subtle: #9ca3af;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eef3ff;

    --success: #15803d;
    --success-soft: #ecfdf3;
    --info: #1d4ed8;
    --info-soft: #eff6ff;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fef2f2;
    --neutral-soft: #f3f4f6;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
    --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.18);
    --ring: 0 0 0 3px rgba(37, 99, 235, 0.16);

    --sidebar-width: 256px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   App shell + sidebar
   -------------------------------------------------------------------------- */

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    height: 64px;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-brand:hover { color: var(--text); }

.brand-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    font-size: 0.85rem;
}

.brand-text small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-section + .nav-section { margin-top: 1.25rem; }

.nav-label {
    padding: 0 0.75rem 0.4rem;
    color: var(--text-subtle);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link i { width: 18px; text-align: center; font-size: 0.95rem; }

.nav-link:hover { background: var(--surface-muted); color: var(--text); }

.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }

.nav-link .nav-external { margin-left: auto; font-size: 0.7rem; opacity: 0.6; }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
}

.avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user-meta strong { font-size: 0.875rem; font-weight: 600; }
.user-meta span { color: var(--text-muted); font-size: 0.78rem; }

.main {
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: none;
    align-items: center;
    gap: 0.75rem;
    height: 56px;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar .sidebar-brand { height: auto; padding: 0; border: 0; }

.content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2.25rem 3rem;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(17, 24, 39, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop.is-open { opacity: 1; visibility: visible; }
    .main { margin-left: 0; }
    .topbar { display: flex; }
    .content { padding: 1.5rem 1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    color: var(--text-subtle);
    font-size: 0.8rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb i { font-size: 0.6rem; }

.page-title { font-size: 1.5rem; }
.page-subtitle { margin-top: 0.3rem; color: var(--text-muted); }

.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

@media (max-width: 640px) {
    .page-header { align-items: stretch; flex-direction: column; }
    .page-title { font-size: 1.3rem; }
    .page-actions > .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 38px;
    padding: 0 0.95rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn i { font-size: 0.85em; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--surface-muted); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--neutral-soft); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }

.btn-block { width: 100%; height: 42px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
}

.btn-icon:hover { background: var(--neutral-soft); color: var(--text); }
.btn-icon.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title { font-size: 0.975rem; }
.card-subtitle { margin-top: 0.15rem; color: var(--text-muted); font-size: 0.85rem; }
.card-body { padding: 1.25rem; }
.card-link { font-size: 0.85rem; font-weight: 500; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat { padding: 1.1rem 1.25rem; }

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-size: 0.8rem;
}

.stat-value {
    margin-top: 0.6rem;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-foot { margin-top: 0.45rem; color: var(--text-subtle); font-size: 0.8rem; }

.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-neutral { background: var(--neutral-soft); color: var(--text-muted); }

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
    .stats-grid { gap: 0.75rem; }
    .stat { padding: 0.9rem 1rem; }
    .stat-value { font-size: 1.5rem; }
    .stat-foot { display: none; }
}

/* --------------------------------------------------------------------------
   Layout grids
   -------------------------------------------------------------------------- */

.grid-main-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.25rem;
    align-items: start;
}

.grid-main-aside > * { min-width: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }

@media (max-width: 1100px) { .grid-main-aside { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.code-chip {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Lists & tables
   -------------------------------------------------------------------------- */

.list-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.list-row:last-child { border-bottom: 0; }

.thumb {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--text-subtle);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.row-main { min-width: 0; flex: 1; }

.row-title {
    overflow: hidden;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.row-title a { color: var(--text); }
.row-title a:hover { color: var(--accent); }

.row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-muted); }

.cell-promo { display: flex; align-items: center; gap: 0.85rem; min-width: 220px; }
.cell-promo .row-main { max-width: 280px; }
.cell-period { display: grid; white-space: nowrap; line-height: 1.4; }
.cell-period small { color: var(--text-muted); font-size: 0.78rem; }

@media (min-width: 761px) and (max-width: 1320px) {
    .col-optional { display: none; }
}
.cell-desc {
    margin-top: 0.1rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cell-actions { width: 1%; white-space: nowrap; text-align: right; }
.cell-actions .actions { display: inline-flex; gap: 0.25rem; }
.cell-nowrap { white-space: nowrap; }

/* Table collapses into cards on small screens */
@media (max-width: 760px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { position: relative; padding: 1rem; border-bottom: 1px solid var(--border); }
    .table tbody tr:last-child { border-bottom: 0; }
    .table tbody tr:hover { background: transparent; }
    .table td, .table td:first-child, .table td:last-child { padding: 0; border: 0; }
    .table td + td { margin-top: 0.6rem; }
    .table td[data-label] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        font-size: 0.85rem;
    }
    .table td[data-label]::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.8rem;
    }
    .cell-promo { min-width: 0; padding-right: 4.75rem; }
    .cell-promo .row-main { max-width: none; }
    .cell-period { display: block; text-align: right; white-space: normal; }
    .cell-period small { font-size: inherit; color: inherit; }
    .cell-actions { position: absolute; top: 1rem; right: 0.75rem; width: auto; }
}

/* --------------------------------------------------------------------------
   Toolbar (search + filter)
   -------------------------------------------------------------------------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.search {
    position: relative;
    flex: 1 1 240px;
    max-width: 320px;
}

.search i {
    position: absolute;
    top: 50%;
    left: 0.8rem;
    transform: translateY(-50%);
    color: var(--text-subtle);
    font-size: 0.8rem;
    pointer-events: none;
}

.search .input { height: 36px; padding-left: 2.15rem; }

.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--neutral-soft);
    overflow-x: auto;
    max-width: 100%;
}

.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 30px;
    padding: 0 0.7rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.segmented button:hover { color: var(--text); }

.segmented button.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.segmented .count { color: var(--text-subtle); font-size: 0.75rem; }

@media (max-width: 640px) {
    .search { max-width: none; flex-basis: 100%; }
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.4rem; min-width: 0; }

.label { font-size: 0.85rem; font-weight: 500; }
.label .req { color: var(--danger); }

.hint { color: var(--text-muted); font-size: 0.8rem; }

.input {
    width: 100%;
    height: 40px;
    padding: 0 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder { color: var(--text-subtle); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

textarea.input { height: auto; min-height: 110px; padding: 0.65rem 0.8rem; resize: vertical; line-height: 1.5; }

.input-code { font-family: var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

@media (max-width: 560px) {
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; height: 42px; }
}

/* Dropzone / image upload */
.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.35rem;
    min-height: 170px;
    padding: 1.25rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }

.dropzone-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

.dropzone strong { color: var(--text); font-size: 0.875rem; font-weight: 500; }
.dropzone small { font-size: 0.775rem; }

.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

.image-preview {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.image-preview img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

.image-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.8rem;
}

.image-preview-bar span {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Alerts / flash
   -------------------------------------------------------------------------- */

.alert {
    display: flex;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.alert i { margin-top: 0.2rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { border-color: #bbf7d0; background: var(--success-soft); color: #166534; }
.alert-error { border-color: #fecaca; background: var(--danger-soft); color: #991b1b; }

.alert .alert-close {
    margin-left: auto;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
}

.alert .alert-close:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.empty {
    display: grid;
    justify-items: center;
    gap: 0.4rem;
    padding: 3rem 1.25rem;
    text-align: center;
}

.empty-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    margin-bottom: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text-muted);
}

.empty h3 { font-size: 0.95rem; }
.empty p { max-width: 340px; color: var(--text-muted); font-size: 0.875rem; }
.empty .btn { margin-top: 0.75rem; }

/* --------------------------------------------------------------------------
   Dashboard extras
   -------------------------------------------------------------------------- */

.status-bar {
    display: flex;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--neutral-soft);
}

.status-bar span { height: 100%; }
.status-bar .is-active { background: #22c55e; }
.status-bar .is-upcoming { background: #3b82f6; }
.status-bar .is-expired { background: #d1d5db; }

.legend { display: grid; gap: 0.6rem; margin-top: 1.1rem; }

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.legend-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-item strong { margin-left: auto; font-weight: 600; }

.quick-links { display: grid; }

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.quick-link:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.quick-link:hover { background: var(--surface-muted); color: var(--text); }
.quick-link .stat-icon { flex: 0 0 auto; }
.quick-link strong { display: block; font-size: 0.875rem; font-weight: 500; }
.quick-link span { color: var(--text-muted); font-size: 0.8rem; }
.quick-link .chev { margin-left: auto; color: var(--text-subtle); font-size: 0.7rem; }

.endpoint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.35rem 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.endpoint code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 0.78rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.modal-overlay.is-open { opacity: 1; visibility: visible; }

.modal {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.15s ease;
}

.modal-overlay.is-open .modal { transform: none; }

.modal-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
}

.modal h3 { font-size: 1.05rem; }
.modal p { margin-top: 0.4rem; color: var(--text-muted); font-size: 0.875rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

@media (max-width: 480px) {
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    background: var(--text);
    color: #fff;
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.toast.is-visible { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    background: var(--surface);
}

.auth-main {
    display: flex;
    flex-direction: column;
    padding: 2rem clamp(1.25rem, 5vw, 4rem);
}

.auth-main .sidebar-brand { height: auto; padding: 0; border: 0; }

.auth-card {
    width: 100%;
    max-width: 380px;
    margin: auto;
    padding: 2.5rem 0;
}

.auth-card h1 { font-size: 1.6rem; letter-spacing: -0.025em; }
.auth-card .lead { margin: 0.4rem 0 1.75rem; color: var(--text-muted); }

.auth-switch { margin-top: 1.5rem; color: var(--text-muted); font-size: 0.875rem; text-align: center; }
.auth-switch a { font-weight: 500; }

.auth-foot { color: var(--text-subtle); font-size: 0.8rem; }

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
    border-left: 1px solid var(--border);
    background:
        radial-gradient(circle at 1px 1px, #dfe3ea 1px, transparent 0) 0 0 / 22px 22px,
        var(--bg);
}

.auth-aside h2 { max-width: 420px; font-size: 1.5rem; letter-spacing: -0.025em; }
.auth-aside > div > p { max-width: 420px; margin-top: 0.6rem; color: var(--text-muted); }

.preview-card {
    max-width: 420px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.preview-card .list-row { padding: 0.75rem 1rem; }
.preview-card .thumb { width: 36px; height: 36px; border-radius: 8px; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

.btn-icon-sm { width: 28px; height: 28px; font-size: 0.8rem; }
.btn-icon.is-static, .btn-icon.is-static:hover { background: transparent; color: var(--text-subtle); cursor: default; }
.code-cell { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }

.auth-standalone { max-width: 520px; margin: 0 auto; padding: 15vh 1rem 2rem; }

.date-tile {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    text-align: center;
    line-height: 1.05;
}

.date-tile strong { font-size: 1rem; font-weight: 600; }
.date-tile span { color: var(--text-muted); font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.row-meta i { margin-right: 0.15rem; color: var(--text-subtle); font-size: 0.75em; }
.cell-desc i { margin-right: 0.2rem; color: var(--text-subtle); font-size: 0.85em; }
