/* ============================================================
   COFRE DOP — "The Vault"
   Institutional security aesthetic.
   Midnight ink · brass accents · parchment text.
   Type: Fraunces (display) · IBM Plex Sans (UI) · IBM Plex Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,500&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Ink surfaces */
    --ink-900: #0a0e0d;
    --ink-850: #0c1110;
    --ink-800: #0f1514;
    --ink-700: #141c1a;
    --ink-600: #1b2421;
    --ink-550: #212d29;

    /* Hairlines */
    --line: rgba(236, 231, 218, 0.07);
    --line-strong: rgba(236, 231, 218, 0.13);
    --line-brass: rgba(205, 163, 73, 0.22);

    /* Brass — the vault metal */
    --brass: #cda349;
    --brass-bright: #e6c578;
    --brass-deep: #9a7a30;
    --brass-soft: rgba(205, 163, 73, 0.14);
    --brass-glow: rgba(205, 163, 73, 0.28);
    --brass-gradient: linear-gradient(145deg, #e6c578 0%, #cda349 42%, #a07f33 100%);

    /* Secure states */
    --emerald: #5fb893;
    --emerald-bg: rgba(95, 184, 147, 0.12);
    --emerald-line: rgba(95, 184, 147, 0.28);
    --danger: #d4615a;
    --danger-bg: rgba(212, 97, 90, 0.12);
    --danger-line: rgba(212, 97, 90, 0.32);
    --amber: #d99a3c;
    --amber-bg: rgba(217, 154, 60, 0.12);

    /* Text — parchment */
    --text: #ece7da;
    --text-dim: #9ba29a;
    --text-mute: #6b746e;

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 18px 48px -18px rgba(0, 0, 0, 0.72);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.8);

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --t-fast: 0.18s var(--ease);
    --t: 0.3s var(--ease);

    --sidebar-width: 272px;
    --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--ink-900);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
    font-weight: 400;
    letter-spacing: 0.005em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
}

/* Fine grain over the whole surface */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; color: inherit; }

::selection { background: var(--brass-soft); color: var(--brass-bright); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 99px; border: 3px solid var(--ink-900); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-550); }

/* ---------- Animations ---------- */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes sealIn {
    from { opacity: 0; transform: scale(0.94) rotate(-6deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-container { display: flex; width: 100%; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background:
        linear-gradient(180deg, var(--ink-850) 0%, var(--ink-900) 100%);
    border-right: 1px solid var(--line);
    padding: 2rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}
/* thin brass thread down the sidebar edge */
.sidebar::after {
    content: "";
    position: absolute;
    top: 0; right: -1px; width: 1px; height: 100%;
    background: linear-gradient(180deg, transparent, var(--line-brass) 18%, var(--line-brass) 82%, transparent);
    opacity: 0.7;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.25rem 0.5rem 0;
    margin-bottom: 2.75rem;
}

/* Brass seal logo */
.brand-logo {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brass-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 1.35rem;
    color: #2a200c;
    position: relative;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.5),
        inset 0 -2px 3px rgba(0, 0, 0, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.4);
}
.brand-logo::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(42, 32, 12, 0.4);
}

.brand-name {
    font-family: 'Fraunces', serif;
    font-size: 1.32rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
    line-height: 1.05;
}
.brand-tag {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--brass);
    margin-top: 3px;
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-mute);
    padding: 0 0.85rem;
    margin-bottom: 0.85rem;
}

.sidebar-menu { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.72rem 0.85rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    position: relative;
    transition: color var(--t-fast), background var(--t-fast);
}
.menu-item a svg { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.8; transition: var(--t-fast); }
.menu-item a:hover { color: var(--text); background: rgba(236, 231, 218, 0.035); }
.menu-item a:hover svg { opacity: 1; }

.menu-item.active a {
    color: var(--text);
    background: linear-gradient(90deg, var(--brass-soft), transparent 88%);
}
.menu-item.active a svg { color: var(--brass); opacity: 1; }
.menu-item.active a::before {
    content: "";
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--brass-gradient);
    box-shadow: 0 0 10px var(--brass-glow);
}

.sidebar-footer { margin-top: auto; padding-top: 1.5rem; }
.sidebar-footer::before {
    content: "";
    display: block;
    height: 1px;
    background: var(--line);
    margin-bottom: 1.25rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0 0.4rem;
    margin-bottom: 1rem;
}
.user-avatar {
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 50%;
    background: var(--ink-600);
    border: 1px solid var(--line-brass);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Fraunces', serif;
    font-weight: 600; font-size: 0.95rem;
    color: var(--brass);
    text-transform: uppercase;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-email {
    font-size: 0.82rem; font-weight: 500; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--brass); margin-top: 1px;
}

.btn-logout {
    display: flex; align-items: center; justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text-dim);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.84rem; font-weight: 500;
    transition: var(--t-fast);
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { border-color: var(--danger-line); color: var(--danger); background: var(--danger-bg); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    width: calc(100% - var(--sidebar-width));
    padding: 3rem 3.25rem;
    min-height: 100vh;
    /* faint vault-floor vignette */
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(205, 163, 73, 0.045) 0%, transparent 42%),
        radial-gradient(100% 70% at 0% 100%, rgba(95, 184, 147, 0.03) 0%, transparent 45%);
    animation: rise 0.5s var(--ease);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 2.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
    position: relative;
}
.header-container::after {
    content: "";
    position: absolute;
    bottom: -1px; left: 0;
    width: 64px; height: 2px;
    background: var(--brass-gradient);
}

.eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--brass);
    margin-bottom: 0.6rem;
    display: flex; align-items: center; gap: 0.6rem;
}
.eyebrow::before {
    content: ""; width: 18px; height: 1px; background: var(--brass); opacity: 0.6;
}

.page-title {
    font-family: 'Fraunces', serif;
    font-size: 2.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.05;
    color: var(--text);
}
.page-subtitle {
    font-size: 0.92rem;
    color: var(--text-dim);
    margin-top: 0.55rem;
    max-width: 60ch;
}

/* status chip in header */
.server-status {
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-size: 0.8rem; color: var(--text-dim);
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--ink-800);
    white-space: nowrap;
}
.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-bg);
    position: relative;
}
.status-dot::after {
    content: ""; position: absolute; inset: -3px; border-radius: 50%;
    border: 1px solid var(--emerald); opacity: 0.4;
    animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(2.2); opacity: 0; } }

/* ============================================================
   PANELS / CARDS
   ============================================================ */
.panel, .glass-card {
    background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}
/* top hairline highlight for depth */
.panel::before, .glass-card::before {
    content: "";
    position: absolute;
    top: 0; left: 1px; right: 1px; height: 1px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, transparent, rgba(236, 231, 218, 0.09), transparent);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

/* Stat cards */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.7rem 1.6rem;
    overflow: hidden;
    transition: border-color var(--t-fast), transform var(--t-fast);
}
.stat-card:hover { border-color: var(--line-brass); transform: translateY(-3px); }
.stat-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.7rem;
}
.stat-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.stat-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--brass);
    background: var(--brass-soft);
    border: 1px solid var(--line-brass);
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-value {
    font-family: 'Fraunces', serif;
    font-size: 2.9rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-desc { font-size: 0.78rem; color: var(--text-mute); margin-top: 0.35rem; }

/* Panel header (titles inside panels) */
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; margin-bottom: 1.5rem;
}
.panel-title {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem; font-weight: 600;
    color: var(--text);
    display: flex; align-items: center; gap: 0.65rem;
}
.panel-title svg { width: 18px; height: 18px; color: var(--brass); }
.panel-meta { font-family: 'IBM Plex Mono', monospace; font-size: 0.74rem; color: var(--text-mute); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.66rem 1.25rem;
    border-radius: 10px;
    font-size: 0.86rem; font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--t-fast);
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--brass-gradient);
    color: #2a200c;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px -6px var(--brass-glow);
}
.btn-primary:hover {
    filter: brightness(1.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 26px -6px var(--brass-glow);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }

.btn-secondary {
    background: var(--ink-700);
    color: var(--text);
    border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--ink-600); border-color: var(--line-brass); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-line);
}
.btn-danger:hover { background: rgba(212, 97, 90, 0.2); }

.btn-sm { padding: 0.42rem 0.85rem; font-size: 0.76rem; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-container { width: 100%; overflow-x: auto; }

.sleek-table { width: 100%; border-collapse: collapse; text-align: left; }

.sleek-table th {
    padding: 0.85rem 1.1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-mute);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
.sleek-table td {
    padding: 1rem 1.1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: middle;
}
.sleek-table tbody tr { transition: background var(--t-fast); }
.sleek-table tbody tr:hover { background: rgba(205, 163, 73, 0.035); }
.sleek-table tr:last-child td { border-bottom: none; }

.cell-mono { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; color: var(--text-dim); }
.cell-strong { font-weight: 500; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.26rem 0.62rem;
    border-radius: 99px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem; font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-warning { background: var(--amber-bg); color: var(--amber); border-color: rgba(217, 154, 60, 0.3); }
.badge-info { background: var(--brass-soft); color: var(--brass); border-color: var(--line-brass); }
.badge-info::before, .badge-warning::before { background: currentColor; }

/* ============================================================
   SECRETS
   ============================================================ */
.secret-key-cell {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    color: var(--brass);
    letter-spacing: 0.01em;
}
.secret-value-wrapper { display: flex; align-items: center; gap: 0.5rem; }
.secret-value-field {
    font-family: 'IBM Plex Mono', monospace;
    background: var(--ink-900);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    color: var(--text);
    letter-spacing: 0.06em;
    min-width: 150px;
    user-select: all;
    display: inline-block;
}
.secret-actions { display: flex; gap: 0.4rem; }

.action-icon-btn {
    background: var(--ink-700);
    border: 1px solid var(--line-strong);
    color: var(--text-dim);
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--t-fast);
}
.action-icon-btn svg { width: 16px; height: 16px; }
.action-icon-btn:hover { color: var(--brass); border-color: var(--line-brass); background: var(--brass-soft); }

/* empty states */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-mute);
}
.empty-state .empty-icon {
    width: 64px; height: 64px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--ink-700);
    border: 1px solid var(--line);
    color: var(--brass);
}
.empty-state .empty-icon svg { width: 28px; height: 28px; }
.empty-state p { font-size: 0.95rem; color: var(--text-dim); }
.empty-state .empty-hint { font-size: 0.82rem; color: var(--text-mute); margin-top: 0.5rem; }

/* ============================================================
   SEARCH
   ============================================================ */
.search-container { display: flex; gap: 1rem; margin-bottom: 1.6rem; }
.search-wrapper { position: relative; flex-grow: 1; }
.search-input { width: 100%; padding-left: 2.75rem; }
.search-icon {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-mute); pointer-events: none; display: flex;
}
.search-icon svg { width: 17px; height: 17px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.3rem; }
.form-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--text-dim);
}
.form-input {
    background: var(--ink-900);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: var(--text);
    font-size: 0.9rem;
    transition: var(--t-fast);
    width: 100%;
}
.form-input:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px var(--brass-soft);
    background: var(--ink-850);
}
.form-input::placeholder { color: var(--text-mute); }
textarea.form-input { resize: none; line-height: 1.55; }

.form-checkbox {
    display: flex; align-items: flex-start; gap: 0.7rem;
    padding: 0.9rem 1rem;
    background: var(--ink-900);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 0.5rem 0 1.3rem;
    cursor: pointer;
}
.form-checkbox input { width: 17px; height: 17px; margin-top: 2px; cursor: pointer; accent-color: var(--brass); flex-shrink: 0; }
.form-checkbox label { font-size: 0.84rem; color: var(--text-dim); cursor: pointer; user-select: none; line-height: 1.45; }

.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.75rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(6, 9, 8, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 500; padding: 1.5rem;
    opacity: 0; pointer-events: none;
    transition: opacity var(--t);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content {
    background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    width: 100%; max-width: 480px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96) translateY(8px);
    transition: transform var(--t);
    position: relative;
    overflow: hidden;
}
.modal-content::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--brass-gradient);
}
.modal-overlay.active .modal-content { transform: scale(1) translateY(0); }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.6rem;
}
.modal-title {
    font-family: 'Fraunces', serif;
    font-size: 1.32rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.6rem;
}
.modal-title svg { width: 20px; height: 20px; color: var(--brass); }
.btn-close {
    background: var(--ink-700); border: 1px solid var(--line);
    width: 32px; height: 32px; border-radius: 8px;
    color: var(--text-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--t-fast);
}
.btn-close svg { width: 16px; height: 16px; }
.btn-close:hover { color: var(--text); border-color: var(--line-strong); background: var(--ink-600); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
    position: fixed; bottom: 1.75rem; right: 1.75rem;
    z-index: 1000;
    display: flex; flex-direction: column; gap: 0.7rem;
}
.toast {
    background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--brass);
    color: var(--text);
    padding: 0.9rem 1.25rem;
    border-radius: 10px;
    font-size: 0.86rem; font-weight: 500;
    box-shadow: var(--shadow-md);
    display: flex; align-items: center; gap: 0.7rem;
    min-width: 260px;
    animation: slideIn 0.4s var(--ease) forwards;
}
.toast svg { width: 17px; height: 17px; color: var(--brass); flex-shrink: 0; }
.toast-error { border-left-color: var(--danger); }
.toast-error svg { color: var(--danger); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-messages { margin-bottom: 1.75rem; display: flex; flex-direction: column; gap: 0.7rem; }
.flash-message {
    padding: 0.9rem 1.15rem;
    border-radius: 10px;
    font-size: 0.86rem; font-weight: 500;
    display: flex; align-items: center; gap: 0.65rem;
    border: 1px solid transparent;
}
.flash-message svg { width: 17px; height: 17px; flex-shrink: 0; }
.flash-success { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-line); }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

/* ============================================================
   LOGIN — The Vault Door
   ============================================================ */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(60% 60% at 50% 0%, rgba(205, 163, 73, 0.08) 0%, transparent 55%),
        radial-gradient(70% 80% at 50% 120%, rgba(95, 184, 147, 0.05) 0%, transparent 50%),
        var(--ink-900);
}
/* guilloché certificate rings behind the card */
.login-body::before {
    content: "";
    position: absolute;
    width: 720px; height: 720px;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle at center, transparent 0 11px, rgba(205, 163, 73, 0.05) 11px 12px);
    -webkit-mask-image: radial-gradient(circle at center, #000 30%, transparent 72%);
    mask-image: radial-gradient(circle at center, #000 30%, transparent 72%);
    opacity: 0.7;
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 100%; max-width: 430px;
    background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    padding: 2.75rem 2.5rem 2.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    animation: rise 0.6s var(--ease);
}
.login-card::before {
    content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-brass), transparent);
}

.login-header { text-align: center; margin-bottom: 2rem; }

/* Combination-lock dial */
.vault-dial {
    width: 92px; height: 92px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    position: relative;
    background:
        radial-gradient(circle at 50% 38%, #1d2623, #0c1110 70%);
    border: 1px solid var(--line-brass);
    box-shadow:
        inset 0 2px 8px rgba(0, 0, 0, 0.6),
        0 8px 24px -8px rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    animation: sealIn 0.7s var(--ease);
}
/* tick ring */
.vault-dial::before {
    content: "";
    position: absolute; inset: 7px;
    border-radius: 50%;
    background:
        repeating-conic-gradient(from 0deg,
            var(--brass) 0deg 1deg, transparent 1deg 9deg);
    -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%, #000 70%, transparent 71%);
    mask: radial-gradient(circle, transparent 60%, #000 61%, #000 70%, transparent 71%);
    opacity: 0.55;
}
.vault-dial .dial-core {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--brass-gradient);
    display: flex; align-items: center; justify-content: center;
    color: #2a200c;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), inset 0 -2px 4px rgba(0,0,0,0.4);
}
.vault-dial .dial-core svg { width: 24px; height: 24px; }

.login-header h1 {
    font-family: 'Fraunces', serif;
    font-size: 1.85rem; font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}
.login-header p {
    color: var(--text-dim);
    font-size: 0.88rem;
}
.login-brand-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.62rem; letter-spacing: 0.32em; text-transform: uppercase;
    color: var(--brass); display: block; margin-bottom: 0.9rem;
}

.input-with-icon { position: relative; }
.input-with-icon .field-icon {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-mute); display: flex; pointer-events: none;
}
.input-with-icon .field-icon svg { width: 17px; height: 17px; }
.input-with-icon .form-input { padding-left: 2.75rem; }

.login-footer {
    margin-top: 1.75rem;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    color: var(--text-mute);
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.login-footer svg { width: 13px; height: 13px; color: var(--emerald); }

/* ============================================================
   API DOCS
   ============================================================ */
.doc-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.doc-columns .panel { margin-bottom: 0; }

/* Endpoint hero */
.endpoint-hero { margin-bottom: 1.5rem; }
.endpoint-line {
    display: flex; align-items: center; gap: 0.85rem;
    flex-wrap: wrap;
}
.method-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.74rem; font-weight: 600;
    letter-spacing: 0.08em;
    padding: 0.38rem 0.7rem;
    border-radius: 7px;
    background: var(--brass-gradient);
    color: #2a200c;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.endpoint-path {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--ink-900);
    border: 1px solid var(--line);
    padding: 0.42rem 0.85rem;
    border-radius: 8px;
    flex-grow: 1;
    overflow-x: auto;
    white-space: nowrap;
}
.endpoint-note { font-size: 0.84rem; color: var(--text-dim); margin-top: 1rem; }
.endpoint-note strong { color: var(--brass); font-weight: 600; }

/* Steps */
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 1.1rem; }
.steps li {
    counter-increment: step;
    position: relative;
    padding-left: 2.85rem;
    font-size: 0.88rem;
    color: var(--text-dim);
    line-height: 1.6;
}
.steps li::before {
    content: counter(step);
    position: absolute; left: 0; top: -0.1rem;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Fraunces', serif;
    font-weight: 600; font-size: 0.9rem;
    color: var(--brass);
    background: var(--brass-soft);
    border: 1px solid var(--line-brass);
}
.steps strong { color: var(--text); font-weight: 600; }
.steps em { color: var(--brass); font-style: normal; }

/* Inline code */
code:not(.endpoint-path):not(.cell-mono) {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.84em;
    background: var(--ink-900);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0.08em 0.4em;
    color: var(--brass);
}

/* Code blocks with tabs */
.code-tabs {
    display: flex; align-items: center; gap: 0.3rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.code-tab {
    background: none; border: none;
    color: var(--text-dim);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem; font-weight: 500;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--t-fast);
}
.code-tab:hover { color: var(--text); }
.code-tab.active { color: var(--brass); border-bottom-color: var(--brass); }
.code-copy-btn {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 0.45rem;
    background: var(--ink-700);
    border: 1px solid var(--line-strong);
    color: var(--text-dim);
    font-size: 0.75rem; font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--t-fast);
}
.code-copy-btn svg { width: 14px; height: 14px; }
.code-copy-btn:hover { color: var(--brass); border-color: var(--line-brass); background: var(--brass-soft); }

.code-pane { display: none; }
.code-pane.active { display: block; }
.code-pane pre {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--ink-900);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
}
.static-code pre { margin: 0; }

/* Callout */
.doc-callout {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 1.1rem 1.35rem;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--brass-soft), transparent 80%);
    border: 1px solid var(--line-brass);
    font-size: 0.86rem;
    color: var(--text-dim);
}
.doc-callout svg { width: 22px; height: 22px; color: var(--brass); flex-shrink: 0; }
.doc-callout a { color: var(--brass); font-weight: 600; border-bottom: 1px solid var(--line-brass); }
.doc-callout a:hover { color: var(--brass-bright); }

@media (max-width: 920px) {
    .doc-columns { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
    .main-content { padding: 2rem 1.5rem; }
    .page-title { font-size: 1.9rem; }
}
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar {
        position: relative; width: 100%; height: auto;
        flex-direction: row; align-items: center;
        padding: 1rem 1.25rem;
        border-right: none; border-bottom: 1px solid var(--line);
        gap: 1rem; flex-wrap: wrap;
    }
    .sidebar::after { display: none; }
    .sidebar-brand { margin-bottom: 0; }
    .nav-label { display: none; }
    .sidebar nav { flex-grow: 1; }
    .sidebar-menu { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
    .menu-item a span:not(.icon) { display: none; }
    .menu-item a { padding: 0.6rem; }
    .sidebar-footer { margin-top: 0; padding-top: 0; }
    .sidebar-footer::before { display: none; }
    .user-info { display: none; }
    .main-content { margin-left: 0; width: 100%; }
    .header-container { flex-direction: column; align-items: flex-start; }
    .search-container { flex-direction: column; }
    .btn { width: 100%; }
}
