/* bartOS shared shell styles. Tools bring their own styles for their content. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1a1d21;
    --muted: #6b7280;
    --border: #e2e4e9;
    --accent: #2563eb;
    --ok: #15803d;
    --bad: #b91c1c;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --surface: #1e2126;
        --text: #e7e9ec;
        --muted: #9aa1ab;
        --border: #33373e;
        --accent: #60a5fa;
        --ok: #4ade80;
        --bad: #f87171;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

/* ---- Top bar ---- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.brand span { color: var(--accent); }

.tool-switch {
    margin-left: auto;
    max-width: 16rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
}

.topbar-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.topbar-link:hover { color: var(--text); }

/* ---- Pages ---- */

.page {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.page-footer {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

/* ---- Dashboard ---- */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.tool-card:hover { border-color: var(--accent); }

.tool-icon { font-size: 1.6rem; }
.tool-name { font-weight: 600; }
.tool-desc { font-size: 0.85rem; color: var(--muted); }

/* ---- Auth / setup ---- */

.centered-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 24rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.auth-card h1 { margin: 0; font-size: 1.4rem; }

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card input {
    padding: 0.5rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

button {
    padding: 0.55rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover { filter: brightness(1.1); }

.error { color: var(--bad); margin: 0; font-size: 0.9rem; }

/* ---- Glyph keypad (login challenge) ---- */

.server-clock {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
}

.server-clock strong { color: var(--text); font-weight: 600; }

.glyph-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.tile {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color 0.1s;
}

.tile:hover { border-color: var(--muted); filter: none; }
.tile.picked { border-color: var(--accent); }
.tile svg { width: 74%; height: 74%; display: block; }

.tile .badge {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.seq-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    min-height: 2.4rem;
}

.seq-slot {
    width: 2.2rem;
    height: 2.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    display: grid;
    place-items: center;
}

.seq-slot svg { width: 70%; height: 70%; }

.seq-clear {
    background: transparent;
    color: var(--muted);
    border: none;
    font-size: 0.8rem;
    padding: 0.25rem;
}

.seq-clear:hover { filter: none; color: var(--text); }

.snippet {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---- Health ---- */

.checklist {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.checklist li span { color: var(--muted); text-align: right; }
.checklist li.ok strong { color: var(--ok); }
.checklist li.bad strong { color: var(--bad); }

.notice { padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.9rem; }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.notice.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
