:root {
    color-scheme: light dark;
    --bg: #0f1115;
    --panel: #171a21;
    --text: #e6e8ec;
    --muted: #9aa1ac;
    --accent: #5b9dff;
    --error: #ff6b6b;
    --ok: #4ade80;
    --warn: #fbbf24;
    --border: #262a33;

    --blue: #5b9dff;
    --purple: #a78bfa;
    --green: #4ade80;
    --orange: #fb923c;
    --teal: #2dd4bf;
    --pink: #f472b6;
    --yellow: #facc15;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

main {
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    overflow-x: auto;
}

.panel h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--error); }

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }

.stat-sub {
    font-size: 0.85rem;
    color: var(--muted);
}

.svc-up { color: var(--ok); }
.svc-down { color: var(--error); }

/* Today's Briefing — mirrors the same daily Telegram message as cards */
.briefing h2 {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.briefing-date { font-size: 0.85rem; font-weight: 400; }

.briefing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.briefing-card {
    background: #0d0f13;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    height: 150px;
    display: flex;
    flex-direction: column;
}

.briefing-card h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--accent);
    flex-shrink: 0;
}

.briefing-card p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Site list */
.site-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem 1.5rem;
}

@media (max-width: 700px) {
    .site-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .site-list { grid-template-columns: 1fr; }
}

.site-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    min-width: 0;
}

.site-row a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-row a { color: var(--text); text-decoration: none; }
.site-row a:hover { text-decoration: underline; }

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-up { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-down { background: var(--error); box-shadow: 0 0 6px var(--error); }
.dot-pending { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* Link grid */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: #0b0d11;
    min-height: 100px;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.tile-label { font-size: 1.15rem; font-weight: 700; }
.tile-desc { font-size: 0.85rem; opacity: 0.85; }

.tile-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(11, 13, 17, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.tile-blue { background: var(--blue); }
.tile-purple { background: var(--purple); }
.tile-green { background: var(--green); }
.tile-orange { background: var(--orange); }
.tile-teal { background: var(--teal); }
.tile-pink { background: var(--pink); }
.tile-yellow { background: var(--yellow); }

/* Login page (matches am./journal.) */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: min(320px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.login-card input {
    padding: 0.6rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #0d0f13;
    color: var(--text);
    font-size: 1rem;
}

.login-card button {
    padding: 0.6rem;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #0b0d11;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}
