﻿/* =========================================================================
   Trading Economics — Developer portal
   Design tokens + app shell + components. Light/dark via [data-theme].
   ========================================================================= */

:root {
    color-scheme: light;
    --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --radius: 8px;
    --radius-sm: 6px;
    --sidebar-w: 256px;
    --ease: cubic-bezier(.32, .72, 0, 1);

    --bg: #f7f8f9;
    --surface: #ffffff;
    --surface-2: #f7f8f9;
    --surface-hover: #f0f2f4;
    --border: #e3e5e8;
    --border-strong: #cfd3d8;
    --text: #111111;
    --text-muted: #5f6877;
    --text-subtle: #8a919c;

    --accent: #1f6fb2;
    --accent-hover: #195c94;
    --accent-soft: rgba(31, 111, 178, .09);
    --accent-text: #ffffff;

    --success: #188a4b;
    --success-soft: rgba(24, 138, 75, .11);
    --warning: #b86e00;
    --warning-soft: rgba(214, 135, 0, .13);
    --danger: #c9373c;
    --danger-soft: rgba(201, 55, 60, .09);

    --track: #e8eaed;

    --sidebar-bg: #ffffff;
    --sidebar-border: #e3e5e8;
    --sidebar-text: #4b5260;
    --sidebar-text-strong: #111111;
    --sidebar-hover: #f0f2f4;
    --sidebar-active: rgba(31, 111, 178, .09);
    --sidebar-accent: #1f6fb2;
    --sidebar-muted: #8a919c;
    --logo-trading: #333333;
    --logo-economics: #9aa3ad;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #111111;
        --surface: #181818;
        --surface-2: #1d1d1d;
        --surface-hover: #242424;
        --border: #2b2b2b;
        --border-strong: #3a3a3a;
        --text: #f5f5f5;
        --text-muted: #a3a3a3;
        --text-subtle: #7a7a7a;
        --accent: #3d8fd6;
        --accent-hover: #5ba2e0;
        --accent-soft: rgba(61, 143, 214, .15);
        --accent-text: #ffffff;
        --success: #3fbf78;
        --success-soft: rgba(63, 191, 120, .14);
        --warning: #f0a83a;
        --warning-soft: rgba(240, 168, 58, .14);
        --danger: #f0686c;
        --danger-soft: rgba(240, 104, 108, .14);
        --track: #2a2a2a;
        --sidebar-bg: #161616;
        --sidebar-border: #262626;
        --sidebar-text: #b5b5b5;
        --sidebar-text-strong: #ffffff;
        --sidebar-hover: #222222;
        --sidebar-active: rgba(61, 143, 214, .15);
        --sidebar-accent: #5ba2e0;
        --sidebar-muted: #777777;
        --logo-trading: #dddddd;
        --logo-economics: #858585;
        --shadow-sm: none;
        --shadow: none;
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111111;
    --surface: #181818;
    --surface-2: #1d1d1d;
    --surface-hover: #242424;
    --border: #2b2b2b;
    --border-strong: #3a3a3a;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-subtle: #7a7a7a;
    --accent: #3d8fd6;
    --accent-hover: #5ba2e0;
    --accent-soft: rgba(61, 143, 214, .15);
    --accent-text: #ffffff;
    --success: #3fbf78;
    --success-soft: rgba(63, 191, 120, .14);
    --warning: #f0a83a;
    --warning-soft: rgba(240, 168, 58, .14);
    --danger: #f0686c;
    --danger-soft: rgba(240, 104, 108, .14);
    --track: #2a2a2a;
    --sidebar-bg: #161616;
    --sidebar-border: #262626;
    --sidebar-text: #b5b5b5;
    --sidebar-text-strong: #ffffff;
    --sidebar-hover: #222222;
    --sidebar-active: rgba(61, 143, 214, .15);
    --sidebar-accent: #5ba2e0;
    --sidebar-muted: #777777;
    --logo-trading: #dddddd;
    --logo-economics: #858585;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

/* ---------- Base ---------- */
html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); text-decoration: none; }
hr { border-color: var(--border); }
code, kbd, pre, .mono { font-family: var(--font-mono); }
code { color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }

.material-icons-round, .material-icons { font-size: 20px; line-height: 1; vertical-align: middle; user-select: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    transform: translateX(0);
    overflow: hidden;
}

.sidebar-ready .app-sidebar { transition: transform .38s var(--ease), box-shadow .38s var(--ease); }
.sidebar-ready .app-main { transition: margin-left .38s var(--ease); }

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Desktop: collapsible */
body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .app-main { margin-left: 0; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(8, 10, 14, .45);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

/* Mobile: off-canvas */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
    body.sidebar-open .app-sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    body.sidebar-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-ready .app-sidebar, .sidebar-ready .app-main, .sidebar-backdrop { transition: none; }
}

/* ---------- Sidebar ---------- */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 18px 20px;
    min-width: 0;
}

.sidebar-brand { display: block; line-height: 0; }
.te-logo { width: 108px; height: auto; display: block; }
.te-logo__trading { fill: var(--logo-trading); stroke: var(--logo-trading); }
.te-logo__economics { fill: var(--logo-economics); stroke: var(--logo-economics); }

.sidebar-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sidebar-accent);
    background: var(--sidebar-active);
    border-radius: 999px;
    padding: 2px 7px;
    margin-top: 2px;
    white-space: nowrap;
}

.app-sidebar .sidebar-close { margin-left: auto; flex: 0 0 auto; width: 32px; height: 32px; color: var(--sidebar-text); display: none; }
.app-sidebar .sidebar-close:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
@media (max-width: 991.98px) { .app-sidebar .sidebar-close { display: inline-flex; } }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 6px 12px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.nav-link-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

.nav-link-item i { font-size: 20px; color: var(--sidebar-muted); transition: color .15s ease; }
.nav-link-item:hover i { color: var(--sidebar-text-strong); }
.nav-link-item .ext { margin-left: auto; font-size: 15px; opacity: 0; transition: opacity .15s ease; }
.nav-link-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.nav-link-item:hover .ext { opacity: 1; }

.nav-link-item.active { background: var(--sidebar-active); color: var(--sidebar-accent); font-weight: 600; }
.nav-link-item.active i { color: var(--sidebar-accent); }
.nav-link-item.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-accent);
}

.sidebar-footer { padding: 14px 16px 18px; border-top: 1px solid var(--sidebar-border); }

.theme-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--sidebar-hover);
    border: 1px solid var(--sidebar-border);
}

.theme-switch button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0 5px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--sidebar-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.theme-switch button i { font-size: 18px; }
.theme-switch button:hover { color: var(--sidebar-text-strong); }
.theme-switch button.active { background: var(--sidebar-bg); color: var(--sidebar-text-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--sidebar-border); }

/* ---------- Topbar / content / footer ---------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 20px 0 14px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }

.app-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1280px;
    padding: 28px 32px 40px;
}

@media (max-width: 575.98px) { .app-content { padding: 20px 16px 32px; } }

.app-footer {
    padding: 18px 32px 24px;
    color: var(--text-subtle);
    font-size: 12px;
}

/* ---------- Generic UI ---------- */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm i { font-size: 18px; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; margin: 0 0 4px; }
.page-header p { margin: 0; color: var(--text-muted); }

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    margin: 32px 0 12px;
    color: var(--text);
}

.section-title i { color: var(--text-subtle); font-size: 20px; }
.section-title .hint { font-weight: 400; color: var(--text-subtle); font-size: 13px; margin-left: 4px; }

.card-x {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-x-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.card-x-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-x-body { padding: 18px; }

.text-muted-x { color: var(--text-muted) !important; }
.text-subtle-x { color: var(--text-subtle) !important; }

/* Buttons */
.btn-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn-x i { font-size: 18px; }
.btn-x:disabled { opacity: .55; cursor: not-allowed; }
.btn-x.primary { background: var(--accent); color: var(--accent-text); }
.btn-x.primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--accent-text); }
.btn-x.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-x.secondary:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-x.danger { background: var(--danger); color: #fff; }
.btn-x.danger:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }
.btn-x.ghost { background: transparent; color: var(--text-muted); }
.btn-x.ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-x.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }

.spinner-x {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Pills / badges */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.pill.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.pill.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Inline alert */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.notice i { font-size: 19px; margin-top: 1px; }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.success { background: var(--success-soft); color: var(--success); }

/* Toast */
.toast-x {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #1b1f27;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .25s var(--ease);
}

.toast-x i { font-size: 18px; color: #6fd39b; }
.toast-x.show { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .toast-x { background: #e7e9ed; color: #0f1114; }
:root[data-theme="dark"] .toast-x i { color: #188a4b; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .toast-x { background: #e7e9ed; color: #0f1114; }
    :root:not([data-theme="light"]) .toast-x i { color: #188a4b; }
}

/* Switch */
.switch-x { position: relative; display: inline-flex; flex: 0 0 auto; width: 42px; height: 24px; margin: 0; cursor: pointer; }
.switch-x input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-x .track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background-color .2s ease;
}

.switch-x .track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .22s var(--ease);
}

.switch-x input:checked + .track { background: var(--accent); }
.switch-x input:checked + .track::after { transform: translateX(18px); }
.switch-x input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-x input:disabled + .track { opacity: .5; }

/* Segmented tabs */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.seg button {
    height: 28px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px var(--border); }

/* ---------- Bootstrap overrides (modals, tooltips, dropdowns) ---------- */
.modal-content {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.modal-header, .modal-footer { border-color: var(--border); }
.modal-header { padding: 18px 20px 6px; border-bottom: 0; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 8px 20px 18px; color: var(--text-muted); }
.modal-footer { padding: 12px 16px; gap: 8px; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.modal-footer > * { margin: 0; }
.modal-backdrop.show { opacity: .45; }

.tooltip-inner { background: #1b1f27; font-size: 12px; padding: 6px 9px; border-radius: 6px; max-width: 260px; }
.bs-tooltip-top .arrow::before { border-top-color: #1b1f27; }
.bs-tooltip-bottom .arrow::before { border-bottom-color: #1b1f27; }

/* ---------- Usage page ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

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

.stat-card { padding: 18px 20px; }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-label .info { font-size: 16px; color: var(--text-subtle); cursor: help; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--text-subtle); letter-spacing: 0; margin-left: 4px; }
.stat-sub { margin-top: 4px; font-size: 12.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.meter { height: 8px; margin-top: 14px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--success);
    transition: width 1.1s var(--ease);
}

.meter.warning > span { background: var(--warning); }
.meter.danger > span { background: var(--danger); }

.chart-card { margin-top: 16px; }
.chart-card .card-x-header { flex-wrap: wrap; }
.chart-box { height: 320px; padding: 8px 8px 4px; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-subtle); }

/* ---------- Keys page ---------- */
.keys-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.keys-table th {
    padding: 10px 18px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-subtle);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.keys-table th:first-child { border-top-left-radius: var(--radius); }
.keys-table th:last-child { border-top-right-radius: var(--radius); }
.keys-table td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.keys-table tbody tr:last-child td { border-bottom: 0; }
.keys-table tbody tr { transition: background-color .12s ease; }
.keys-table tbody tr:hover { background: var(--surface-2); }
.keys-table .col-date { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.keys-table .col-actions { text-align: right; white-space: nowrap; width: 1%; }

.key-field {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 3px 3px 3px 12px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.key-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    width: 29ch;
    margin-right: 6px;
}

@media (max-width: 767.98px) { .key-value { width: auto; flex: 1 1 auto; } }

.key-actions { display: inline-flex; align-items: center; gap: 2px; }

@media (max-width: 767.98px) {
    .keys-table thead { display: none; }
    .keys-table, .keys-table tbody, .keys-table tr, .keys-table td { display: block; width: 100%; }
    .keys-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
    .keys-table tbody tr:last-child { border-bottom: 0; }
    .keys-table td { padding: 0; border: 0; }
    .keys-table td.col-date { font-size: 12px; margin: 6px 0 4px 2px; }
    .keys-table td.col-actions { text-align: left; width: auto; }
    .key-field { display: flex; }
}

.empty-state { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 40px; color: var(--text-subtle); margin-bottom: 8px; }

/* ---------- Settings page ---------- */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 20px;
}

.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-row h3 { font-size: 14px; margin: 0 0 3px; }
.setting-row p { margin: 0; color: var(--text-muted); font-size: 13px; max-width: 560px; }
.setting-status { font-size: 12px; margin-top: 6px; min-height: 18px; }

/* ---------- Marketing (logged out / no API plan) ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    padding: 36px;
}

.hero h1 { font-size: 30px; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p { color: var(--text-muted); font-size: 15px; line-height: 1.65; margin: 0 0 22px; }
.hero img { width: 100%; height: auto; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 991.98px) {
    .hero { grid-template-columns: 1fr; padding: 24px; }
}

/* ---------- Home gateway tiles ---------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.section-title + .tile-grid { margin-top: 0; }
.page-header + .section-title { margin-top: 8px; }

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px 20px;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .2s ease, transform .2s var(--ease);
}

.tile:hover {
    color: var(--text);
    border-color: var(--border-strong);
    box-shadow: 0 6px 20px rgba(16, 24, 40, .08);
    transform: translateY(-2px);
}

.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
}

.tile-icon i { font-size: 20px; }

.tile-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
}

.tile-arrow {
    margin-left: auto;
    font-size: 18px !important;
    color: var(--text-subtle);
    transition: transform .2s var(--ease), color .15s ease;
}

.tile:hover .tile-arrow { color: var(--accent); transform: translateX(3px); }
.tile[target="_blank"]:hover .tile-arrow { transform: translate(2px, -2px); }

.tile-desc { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

.tile-metric .tile-head { display: flex; flex-direction: column; }
.tile-metric .tile-head .tile-icon { margin-bottom: 12px; }
.tile-value {
    margin-top: 6px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.tile-metric .meter { margin-top: 10px; height: 6px; }
