/* VTOffice — base styles. Single bundle, no preprocessor. */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:           #F4F5F7;
    --bg-card:      #FFFFFF;
    --bg-muted:     #F8F9FB;
    --bg-sidebar:   #FFFFFF;
    --bg-hover:     #F1F3F6;

    --border:       #E5E7EB;
    --border-soft:  #EEF0F4;

    --text:         #0F172A;
    --text-soft:    #334155;
    --text-muted:   #64748B;
    --text-faint:   #94A3B8;

    --primary:      #2563EB;
    --primary-600:  #1D4ED8;
    --primary-50:   #EFF6FF;
    --primary-grad: linear-gradient(135deg, #3B82F6 0%, #7C3AED 100%);

    --accent-green: #10B981;
    --accent-green-600: #059669;

    --danger:       #DC2626;
    --danger-50:    #FEF2F2;

    --warning:      #D97706;
    --warning-50:   #FFFBEB;

    --success:      #16A34A;
    --success-50:   #F0FDF4;

    --radius:       10px;
    --radius-lg:    14px;
    --radius-xl:    18px;
    --shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow:       0 4px 14px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-lg:    0 12px 32px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-primary: 0 4px 12px rgba(37, 99, 235, 0.22);
    --shadow-primary-hover: 0 6px 18px rgba(37, 99, 235, 0.30);

    --sidebar-w:    76px;
    --topbar-h:     60px;

    --ease:         cubic-bezier(.4, 0, .2, 1);
    --ease-out:     cubic-bezier(.16, 1, .3, 1);
    --ease-bounce:  cubic-bezier(.34, 1.56, .64, 1);
    --t-fast:       .12s;
    --t-base:       .18s;
    --t-slow:       .28s;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
                 Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --font-mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--primary-600); }

h1, h2, h3, h4 {
    margin: 0 0 .5rem 0;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.018em;
    line-height: 1.25;
}
h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.024em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
h4 { font-size: .9rem; font-weight: 600; }

p { margin: 0 0 .75rem 0; color: var(--text-soft); }

::selection { background: var(--primary-50); color: var(--primary-600); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Page enter animation ===== */
@keyframes vt-fade-up {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}
.content > * { animation: vt-fade-up var(--t-slow) var(--ease-out) both; }
.content > *:nth-child(1) { animation-delay: 0ms; }
.content > *:nth-child(2) { animation-delay: 30ms; }
.content > *:nth-child(3) { animation-delay: 60ms; }
.content > *:nth-child(4) { animation-delay: 90ms; }
.content > *:nth-child(5) { animation-delay: 120ms; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== App shell ===== */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.app-body {
    flex: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 0;
}

/* Topbar — spans full width across the top */
.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.025em;
    font-size: 1.1rem;
    text-decoration: none;
    transition: opacity var(--t-fast) var(--ease);
}
.topbar__brand:hover { opacity: .85; color: var(--text); }
.topbar__brand .logo-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--primary-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
.topbar__brand .logo-mark svg { width: 20px; height: 20px; }
.topbar__brand .wordmark {
    background: linear-gradient(135deg, #1F2937, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* Sidebar — sits below the topbar */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    height: calc(100vh - var(--topbar-h));
}
.sidebar__nav { padding: 14px 10px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }

.sidebar__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 9px 4px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 500;
    gap: 4px;
    border-radius: var(--radius);
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    text-align: center;
    position: relative;
    text-decoration: none;
}
.sidebar__link svg {
    width: 22px; height: 22px;
    transition: transform var(--t-base) var(--ease);
}
.sidebar__link:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.sidebar__link:hover svg { transform: scale(1.06); }
.sidebar__link:active { transform: scale(.97); }
.sidebar__link.is-active {
    color: var(--primary);
    background: var(--primary-50);
    font-weight: 600;
}
.sidebar__link.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* User dropdown menu */
.user-menu { position: relative; }
.user-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.user-menu__trigger:active { transform: scale(.97); }
.user-menu__trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
}
.user-menu__trigger[aria-expanded="true"] {
    background: var(--bg-hover);
    border-color: var(--border);
}
.user-menu__trigger .caret {
    width: 14px; height: 14px;
    color: var(--text-faint);
    transition: transform .15s;
}
.user-menu__trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }
@keyframes vt-dropdown-in {
    from { opacity: 0; transform: translateY(-6px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.user-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 100;
    transform-origin: top right;
}
.user-menu__panel.open {
    display: block;
    animation: vt-dropdown-in var(--t-base) var(--ease-out) both;
}
.user-menu__header {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 6px;
}
.user-menu__name {
    font-weight: 600;
    color: var(--text);
    font-size: .9rem;
    line-height: 1.3;
}
.user-menu__email {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-all;
}
.user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-soft);
    cursor: pointer;
    background: transparent;
    border: 0;
    font: inherit;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background .1s, color .1s;
}
.user-menu__item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.user-menu__item svg {
    width: 16px; height: 16px;
    color: var(--text-faint);
    flex-shrink: 0;
}
.user-menu__item.danger { color: var(--danger); }
.user-menu__item.danger svg { color: var(--danger); }
.user-menu__item.danger:hover { background: var(--danger-50); color: var(--danger); }
.user-menu__divider {
    height: 1px;
    background: var(--border-soft);
    margin: 4px 0;
}

/* Content */
.content {
    padding: 24px;
    flex: 1;
    min-width: 0;
}
.content__header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.content__header h1 { margin: 0; }
.content__header .subtitle {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: .9rem;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.card + .card { margin-top: 16px; }
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
}
.card__header h2, .card__header h3 { margin: 0; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: transform var(--t-base) var(--ease-out),
                box-shadow var(--t-base) var(--ease),
                border-color var(--t-fast) var(--ease);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border);
}
.feature-card__icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.feature-card__icon svg { width: 20px; height: 20px; }
.feature-card__icon.blue   { background: var(--primary-50); color: var(--primary); }
.feature-card__icon.green  { background: var(--success-50); color: var(--success); }
.feature-card__icon.amber  { background: var(--warning-50); color: var(--warning); }
.feature-card__icon.purple { background: #F5F3FF; color: #7C3AED; }
.feature-card__icon.rose   { background: #FFF1F2; color: #E11D48; }
.feature-card__icon.teal   { background: #ECFEFF; color: #0891B2; }

.feature-card h3 {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
}
.feature-card p {
    margin: 0;
    font-size: .85rem;
    color: var(--text-muted);
}

/* Stat */
.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat__label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 500;
}
.stat__value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}
.stat__delta { font-size: .8rem; }
.stat__delta.pos { color: var(--success); }
.stat__delta.neg { color: var(--danger); }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-soft);
    margin-bottom: 6px;
}
.form-control,
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=url], select, textarea {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font: inherit;
    color: var(--text);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
textarea { height: auto; padding: 10px 12px; min-height: 80px; }
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-error {
    font-size: .8rem;
    color: var(--danger);
    margin-top: 4px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.checkbox-row {
    display: flex; align-items: center; gap: 8px;
    user-select: none;
}
.checkbox-row input { width: 16px; height: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    letter-spacing: -0.005em;
    border: 0;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease),
                transform var(--t-fast) var(--ease),
                box-shadow var(--t-base) var(--ease);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    position: relative;
    overflow: hidden;
}
.btn:hover {
    background: var(--primary-600);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn:active { transform: translateY(0); transition-duration: .05s; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-primary); }

.btn-green {
    background: var(--accent-green);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-green:hover {
    background: var(--accent-green-600);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-ghost {
    background: var(--bg-card);
    color: var(--text-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-faint);
    box-shadow: var(--shadow-sm);
}
.btn-danger {
    background: var(--danger);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-danger:hover { background: #B91C1C; }
.btn-sm { height: 32px; padding: 0 12px; font-size: .82rem; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: .95rem; border-radius: 12px; }

/* Small icon-only button (used inside cards for Refresh actions) */
.btn-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
}
.btn-icon[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    margin-bottom: 16px;
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert--error   { background: var(--danger-50);  border-color: #FECACA; color: #991B1B; }
.alert--success { background: var(--success-50); border-color: #BBF7D0; color: #166534; }
.alert--warning { background: var(--warning-50); border-color: #FED7AA; color: #92400E; }
.alert--info    { background: var(--primary-50); border-color: #BFDBFE; color: #1E40AF; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.table th, table.table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
}
table.table thead th {
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: .72rem;
}
table.table tbody tr:hover { background: var(--bg-muted); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 500;
    background: var(--bg-muted);
    color: var(--text-soft);
}
.badge--green { background: var(--success-50); color: var(--success); }
.badge--red   { background: var(--danger-50);  color: var(--danger); }
.badge--blue  { background: var(--primary-50); color: var(--primary); }
.badge--amber { background: var(--warning-50); color: var(--warning); }

/* ===== Auth / Install pages ===== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(37, 99, 235, .08), transparent 50%),
        radial-gradient(900px 500px at 80% 110%, rgba(16, 185, 129, .08), transparent 50%),
        var(--bg);
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(15, 23, 42, .06);
    padding: 32px;
}
.auth-card .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}
.auth-card .brand .logo-mark {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--primary-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
.auth-card .brand strong {
    font-weight: 800;
    letter-spacing: -0.025em;
    font-size: 1.15rem;
}
.auth-card .brand strong { font-size: 1.1rem; letter-spacing: -.02em; }

.install-shell { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.install-steps {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
}
.install-steps .step {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}
.install-steps .step.done { background: var(--primary); }
.install-steps .step.current { background: var(--primary); }

.req-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.req-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.req-list li:last-child { border-bottom: 0; }
.req-list .label { font-weight: 500; color: var(--text-soft); }
.req-list .status.ok  { color: var(--success); }
.req-list .status.bad { color: var(--danger); }

/* ===== Utilities ===== */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.right { text-align: right; }
.center { text-align: center; }

/* Action bar */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

/* Code blocks */
pre.code {
    background: #0F172A;
    color: #E2E8F0;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .82rem;
    overflow-x: auto;
    line-height: 1.5;
}

/* ===== Metric strip (audit Overview top row) ===== */
.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 230px;
    transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.metric-card:hover { border-color: var(--border); box-shadow: var(--shadow); }
.metric-card--alert { min-height: auto; }
.metric-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.metric-card__title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.metric-card__delta { font-size: .7rem; color: var(--text-muted); }
.metric-card__big {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.metric-card__caption {
    color: var(--text-muted);
    font-size: .8rem;
    text-align: center;
    margin: 0;
}
.metric-card__legend {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: .8rem;
    color: var(--text-soft);
    margin-top: -4px;
}
.metric-card__legend > div {
    display: flex;
    align-items: center;
    gap: 6px;
}
.metric-card__legend > div .muted { margin-left: auto; }

/* Gauge — refined */
.gauge { position: relative; }
.gauge__svg { width: 100%; height: auto; max-width: 220px; display: block; margin: 0 auto; }
.gauge__value {
    position: absolute;
    left: 0; right: 0;
    top: 56%;
    transform: translateY(-50%);
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}
.gauge--lg .gauge__svg { max-width: 200px; }
.gauge--lg .gauge__value { font-size: 1.55rem; top: 62%; }

/* Compact bot list (in metric-strip card) */
.bot-list--compact {
    font-size: .82rem;
    margin: 0;
}
.bot-list--compact li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border-soft);
}
.bot-list--compact li:last-child { border-bottom: 0; }
.check {
    width: 18px; height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.check--ok  { background: var(--success-50); color: var(--success); }
.check--bad { background: var(--danger-50);  color: var(--danger); }

/* ===== Errors / Warnings + Top issues row ===== */
.errors-warnings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2.6fr;
    gap: 14px;
}

.top-issues-panel { display: flex; flex-direction: column; padding: 14px 16px; }
.top-issues-panel .card__header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}
.issue-strip {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}
.issue-strip li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-soft);
}
.issue-strip li:last-child { border-bottom: 0; }
.issue-strip__icon {
    width: 22px; height: 22px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.issue-strip__icon svg { width: 18px; height: 18px; }
.issue-strip__msg {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.issue-strip__fix {
    font-size: .75rem;
    color: var(--primary);
    flex-shrink: 0;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.issue-strip__count {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    text-decoration: none;
}

/* ===== Quick stats horizontal strip ===== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: var(--border-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.quick-stats > div {
    background: var(--bg-card);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.quick-stats__label {
    font-size: .68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
}
.quick-stats__value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== Filter chips (replaces old .tabs for inline filtering) ===== */
.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-soft);
    font-size: .82rem;
    transition: background .12s, color .12s, border-color .12s;
    text-decoration: none;
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.chip.is-active .muted { color: rgba(255, 255, 255, .8); }

/* ===== Audit tab nav (top of audit pages) ===== */
.audit-tabs {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ===== Charts (Statistics tab) ===== */
.chart-card { display: flex; flex-direction: column; gap: 8px; }
.chart-card__body {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
}
.donut { display: block; }
.histogram { display: block; width: 100%; height: auto; }
.chart-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .85rem;
}
.chart-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
}
.chart-legend .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.chart-legend .muted { margin-left: auto; }

/* ===== Compare strip ===== */
.compare-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 14px 18px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
}
.compare-strip__col { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.compare-strip__arrow {
    font-size: 1.4rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.compare-table tr td:first-child { font-weight: 500; }
.compare-table .right { font-variant-numeric: tabular-nums; }

/* ===== Audit-specific ===== */

.audit-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.audit-breadcrumb > span.muted {
    color: var(--text-faint);
    font-size: .9em;
    line-height: 1;
}
.audit-breadcrumb a {
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 6px;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.audit-breadcrumb a:hover {
    color: var(--primary);
    background: var(--primary-50);
}

.audit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.audit-card { display: flex; flex-direction: column; gap: 10px; }
.audit-card h3 { display: flex; align-items: center; gap: 6px; margin: 0; }

/* Progress bar */
.progress {
    height: 8px;
    background: var(--border-soft);
    border-radius: 4px;
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6366F1);
    transition: width .4s ease;
    border-radius: 4px;
}

/* Gauge */
.gauge { position: relative; text-align: center; }
.gauge__svg { width: 100%; height: auto; max-width: 200px; display: block; margin: 0 auto; }
.gauge__value {
    position: absolute;
    left: 0; right: 0;
    top: 55%;
    transform: translateY(-50%);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}

/* Crawled-pages bucket bar */
.bucket-bar {
    height: 10px;
    border-radius: 5px;
    background: var(--border-soft);
    overflow: hidden;
    display: flex;
    gap: 2px;
}
.bucket-bar__seg { height: 100%; }
.bucket-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    font-size: .85rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}
.bucket-list li {
    display: flex; align-items: center; gap: 6px;
    color: var(--text-soft);
}
.bucket-list li .muted { margin-left: auto; }
.bucket-list .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Bot list */
.bot-list { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.bot-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-soft);
}
.bot-list li:last-child { border-bottom: 0; }

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}
.tab {
    padding: 11px 16px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: .87rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--t-fast) var(--ease), border-color var(--t-base) var(--ease), background var(--t-fast) var(--ease);
    border-radius: 8px 8px 0 0;
    position: relative;
}
.tab:hover {
    color: var(--text);
    background: var(--bg-muted);
}
.tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Issues layout */
.issues-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
    align-items: start;
}
.issues-list { padding: 8px 8px 8px 8px; }
.issue-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-soft);
    transition: background .1s;
    text-decoration: none;
}
.issue-row:hover { background: var(--bg-hover); color: var(--text); }
.issue-row.is-active { background: var(--primary-50); color: var(--text); }
.issue-row__msg { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-row__count { font-size: .85rem; color: var(--text); flex-shrink: 0; }

.page-list { list-style: none; padding: 0; margin: 0; }
.page-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.page-list li:last-child { border-bottom: 0; }
.page-list__msg { font-size: .85rem; color: var(--text-soft); margin-bottom: 2px; }
.page-list__url { font-size: .8rem; color: var(--primary); font-family: var(--font-mono); word-break: break-all; }

/* Search bar (project page domain input) */
.search-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.search-bar__field {
    flex: 1;
    position: relative;
}
.search-bar__field svg {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-faint);
}
.search-bar__field input {
    padding-left: 38px;
}

/* ===== Sparklines + Deltas ===== */
.sparkline {
    display: block;
}
.sparkline--empty { opacity: .6; }
.sparkline-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.4;
    margin-left: 6px;
    vertical-align: middle;
}
.delta--pos { background: var(--success-50); color: var(--success); }
.delta--neg { background: var(--danger-50); color: var(--danger); }
.delta--neutral { background: var(--bg-muted); color: var(--text-muted); }

/* ===== Empty states ===== */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    background:
        radial-gradient(800px 400px at 50% 0%, rgba(37, 99, 235, .04), transparent 70%),
        var(--bg-card);
}
.empty-state__icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-50);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.empty-state__icon svg { width: 28px; height: 28px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { max-width: 540px; margin: 0 auto 8px; }
.empty-state__features {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.empty-state__features > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.empty-state__features strong {
    font-size: 1rem;
    color: var(--text);
}
.empty-state__features .muted {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ===== Clickable table rows ===== */
.row-link { cursor: pointer; }
.row-link:hover { background: var(--bg-hover); }
.row-link a { text-decoration: none; }

/* ===== Per-page issue blocks ===== */
.issue-block {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
}
.issue-block:last-child { border-bottom: 0; }
.issue-block__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.issue-block__guide {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--bg-muted);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}
.issue-block__guide p {
    color: var(--text-soft);
}

.issue-guide-card {
    border-left: 3px solid var(--primary);
    background: var(--primary-50);
}
.issue-guide-card h2 { color: var(--text); }
.issue-guide-card p { color: var(--text-soft); }

/* ===== Skeleton loader ===== */
.skeleton {
    display: inline-block;
    background: linear-gradient(90deg, var(--border-soft) 25%, var(--bg-hover) 37%, var(--border-soft) 63%);
    background-size: 400% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.4s ease infinite;
}
.skeleton--full { display: block; height: 14px; margin-bottom: 8px; }
.skeleton--h1   { display: block; height: 28px; width: 60%; margin-bottom: 12px; }
.skeleton--cwv {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.skeleton--cwv > span {
    height: 56px;
    background: linear-gradient(90deg, var(--border-soft) 25%, var(--bg-hover) 37%, var(--border-soft) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: var(--radius);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ===== Provider/Metric cards ===== */
.provider-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.provider-row__main { flex: 1; min-width: 240px; }
.provider-row__actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

.cwv-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 6px;
}
.cwv {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cwv__label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 500;
}
.cwv__value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.metric-status:empty { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .errors-warnings-grid { grid-template-columns: 1fr 1fr; }
    .errors-warnings-grid .top-issues-panel { grid-column: span 2; }
}
@media (max-width: 720px) {
    :root { --sidebar-w: 60px; }
    .form-row { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .auth-card { padding: 24px; }
    .issues-layout { grid-template-columns: 1fr; }
    .bucket-list { grid-template-columns: 1fr; }
    .cwv-grid { grid-template-columns: repeat(2, 1fr); }
    .provider-row__actions { width: 100%; align-items: stretch; }
    .metric-strip { grid-template-columns: 1fr; }
    .errors-warnings-grid { grid-template-columns: 1fr; }
    .errors-warnings-grid .top-issues-panel { grid-column: auto; }
    .chart-card__body { grid-template-columns: 1fr; }
    .compare-strip { flex-direction: column; align-items: flex-start; }
    .compare-strip__arrow { transform: rotate(90deg); }
}
