/* The rolodex look: FreshBrew Labs visual system (dark, amber accent),
   ported from rolodex-web/style.css — one palette, ghost bordered buttons
   with amber primaries, panel cards, and the amber active-nav wash. */
:root {
    color-scheme: dark;
    --bg: #0e0e10;
    --panel: #18181b;
    --border: rgba(255, 255, 255, 0.06);
    --text: #f0efed;
    --muted: #8a8a8e;
    --accent: #d4872a;
    --accent-ink: #3f2a15;
    --danger: #e5484d;
    --ok: #4ade80;
    --warning: #facc15;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

::selection { background: var(--accent); color: #fff; }

/* Bare links take the accent and never underline; button-styled links
   (`.button`) override the color with the amber primary's espresso ink. */
a { color: var(--accent); text-decoration: none; }

#app { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
}

.sidebar-header { padding: 8px; }

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
}

.logo-icon { width: 24px; height: 24px; color: var(--accent); }

.sidebar-nav { flex: 1; margin-top: 24px; }

.nav-items { list-style: none; margin: 0; padding: 0; }

.nav-item { margin-bottom: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px 10px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }

/* A nav row's count: the 999px pill, filled so it reads as a number. On the
   active row it takes the amber tint, because white goes muddy on amber. */
.nav-badge {
    margin-left: auto;
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
}

/* The router marks the active link with aria-current="page"; the amber wash
   plus the inset 3px bar is the active-row mark. Placed after the hover rule
   so hovering the active row cannot wash the highlight out. */
.nav-link[aria-current="page"] {
    background: rgba(212, 135, 42, 0.14);
    box-shadow: inset 3px 0 0 var(--accent);
    color: var(--accent);
}

.nav-link[aria-current="page"]:hover { background: rgba(212, 135, 42, 0.2); }

/* Above the row's own amber wash at rest (0.14) and on hover (0.2), or the
   badge would vanish into the active row. */
.nav-link[aria-current="page"] .nav-badge {
    border-color: rgba(212, 135, 42, 0.4);
    background: rgba(212, 135, 42, 0.28);
    color: var(--accent);
}

.nav-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.sidebar-footer { margin-top: auto; }

.sidebar-divider { border-top: 1px solid var(--border); margin: 12px 0; }

/* ---- main ---- */
.main-content { flex: 1; overflow-y: auto; }

.main-inner { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

/* admin-style h1 */
h1 { margin: 0 0 24px; font-size: 24px; }

code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.muted { color: var(--muted); }

/* ---- cards ---- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

/* Auto-fit grid: 300px floor, reflows to page width. */
.card-row {
    margin-top: 24px;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

/* Cards are columns so the CTA sinks to the bottom and lines up across a
   row of differently-sized blurbs. */
.card-row .card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-row .card h2 {
    margin: 0;
    font-size: 16px;
}

.card-row .card p { margin: 0; }

.card-row .card .button {
    margin-top: auto;
    align-self: flex-start;
}

/* The hub's doors: the whole card is the link, so it keeps ink (not the
   global amber) and answers hover with a lift; the CTA is a chip pinned
   bottom-right, never full width, its arrow sliding into place. */
.login-card {
    color: inherit;
    transition:
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.login-card:hover {
    border-color: rgba(212, 135, 42, 0.45);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

.login-card code { white-space: nowrap; }

.card-cta {
    margin-top: auto;
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 14px;
}

.cta-arrow { transition: transform 0.15s ease; }

.login-card:hover .cta-arrow { transform: translateX(3px); }

/* ---- narrow auth pages ---- */
.narrow { max-width: 384px; }

/* ---- forms (the admin's .form) ---- */
form.stack { display: flex; flex-direction: column; gap: 16px; }

form.stack label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

/* form submit: primary action, amber color */
form.stack button[type="submit"] {
    align-self: flex-start;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus { border-color: var(--accent); outline: none; }

/* ---- buttons: ghost style; .button is amber primary ---- */
button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

a.button,
button.button {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

/* admin-style: colored text only, no boxes */
.error { color: var(--danger); font-size: 14px; margin: 4px 0; }
.notice { color: var(--ok); font-size: 14px; margin: 4px 0; }

/* ---- dev hint ---- */
.dev {
    background: rgba(212, 135, 42, 0.1);
    border: 1px solid rgba(212, 135, 42, 0.28);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 0 16px;
}

/* ---- healthcheck ---- */
.sidebar-healthcheck {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.healthcheck-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.healthcheck-dot.healthcheck-ok { background: var(--ok); }
.healthcheck-dot.healthcheck-error { background: var(--danger); }
.healthcheck-dot.healthcheck-warning { background: var(--warning); }
.healthcheck-dot.healthcheck-loading { background: var(--accent); }

.healthcheck-version { margin-left: auto; }

/* ---- status page ---- */
.status-rows {
    display: flex;
    flex-direction: column;
    margin: 16px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.status-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; }
.status-row + .status-row { border-top: 1px solid var(--border); }
.status-name { min-width: 110px; font-weight: 600; }
.status-text { color: var(--muted); }
.status-text.status-ok { color: var(--ok); }
.status-text.status-bad { color: var(--danger); }

/* ---- phones: sidebar → top bar, card grid keeps full width ---- */
@media (max-width: 720px) {
    #app { flex-direction: column; }

    .sidebar {
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav { flex: none; margin-top: 8px; }

    .nav-items { display: flex; flex-wrap: wrap; gap: 4px; }

    .nav-item { margin-bottom: 0; }

    .nav-link { width: auto; padding: 8px 12px; }

    .sidebar-footer { margin-top: 12px; }

    .main-inner { padding: 20px 14px; }
}
