:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #1b1f24;
    --muted: #5b6673;
    --accent: #0a5bd3;
    --border: #d8dde3;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

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

.brand { font-weight: 700; font-size: 1.15rem; color: var(--accent); text-decoration: none; }
.topbar-nav { display: flex; align-items: center; gap: 0.75rem; }
.whoami { color: var(--muted); font-size: 0.9rem; }

.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1rem 0;
}
.card.narrow { max-width: 360px; }

label { display: block; margin: 0.6rem 0; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.btn, button.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
}
.linkbtn {
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.logout-form { display: inline; margin: 0; }

.messages { list-style: none; padding: 0; }
.message { padding: 0.6rem 0.8rem; border-radius: 8px; background: #eef3fb; margin-bottom: 0.5rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); }
.table th { background: #eef1f5; font-size: 0.85rem; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table caption { caption-side: bottom; text-align: left; padding: 0.55rem 0.7rem; }
code { background: #eef1f5; padding: 0.15rem 0.35rem; border-radius: 6px; word-break: break-all; }

@media (max-width: 560px) {
    .page-head { flex-direction: column; align-items: flex-start; }
    .table { display: block; overflow-x: auto; }
    .content { padding: 0.75rem; }
    .topbar { padding: 0.6rem 0.75rem; }
    .card.narrow { max-width: 100%; }
}

.head-actions { display: flex; align-items: center; gap: 0.75rem; }
.searchbar { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.searchbar input { max-width: 420px; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; color: var(--muted); }
.btn.danger { background: #c0392b; }
.flags { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; }
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.nav-list { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.meta-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
.meta-grid dt { color: var(--muted); }
.meta-grid dd { margin: 0; }
.timeline { list-style: none; padding: 0; }
.timeline li { border-left: 2px solid var(--border); padding: 0 0 0.75rem 0.75rem; }
.muted { color: var(--muted); font-size: 0.85rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; }

.bell { position: relative; text-decoration: none; font-size: 1.1rem; }
.bell .badge { position: absolute; top: -6px; right: -10px; background: #c0392b; color: #fff; border-radius: 10px; font-size: 0.7rem; padding: 0 5px; }
.notif-list { list-style: none; padding: 0; }
.notif-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; }
.notif-list li.unread { font-weight: 600; }

.label-sheet { display: flex; flex-wrap: wrap; gap: 1rem; }
.label { display: flex; gap: 0.75rem; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; width: 300px; background: #fff; }
.label-text { display: flex; flex-direction: column; gap: 0.2rem; }
@media print { .no-print, .topbar { display: none; } .label { break-inside: avoid; } }

.monitor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.monitor { display: flex; gap: 0.6rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; }
.monitor-dot { width: 12px; height: 12px; border-radius: 50%; background: #9aa5b1; flex: none; }
.monitor-body { flex: 1; }
.status-up .monitor-dot { background: #1e9e55; }
.status-degraded .monitor-dot { background: #e0a800; }
.status-down .monitor-dot { background: #c0392b; }
.status-off .monitor-dot { background: #8a94a3; }
td.status-up { color: #1e9e55; }
td.status-degraded { color: #a07800; font-weight: 600; }
td.status-down { color: #c0392b; font-weight: 600; }
td.status-off { color: var(--muted); }
.top-internet { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.top-internet h4 { margin: 0.25rem 0; }
.top-internet ol { margin: 0; padding-left: 1.4rem; }
.action-not_delivered { color: #c0392b; }
.secret { background: #11141a; color: #d7f5e1; padding: 0.6rem; border-radius: 8px; }
.failed { color: #c0392b; }
.table tr.low td { background: #fdeeee; }
.article-img { max-width: 100%; border-radius: 8px; margin: 0.5rem 0; }
.article-list { list-style: none; padding: 0; }
.article-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.snippet-list { list-style: none; padding: 0; }
.snippet-list li { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; margin-bottom: 0.6rem; background: #fff; }
.snippet-list li.pinned { border-color: var(--accent); }
.snippet-text { white-space: pre-wrap; margin: 0 0 0.3rem; font-family: ui-monospace, monospace; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.dash-grid section ul { list-style: none; padding: 0; margin: 0; }
.dash-grid section li { padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.topbar-search input { padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; width: 160px; }
@media (max-width: 560px) { .topbar-search { display: none; } }

.site-footer { padding: 1rem; text-align: center; }
.credit { color: var(--muted); font-size: 0.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-logo { height: 28px; width: auto; }
.login-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); }
.brand-previews { display: flex; flex-wrap: wrap; gap: 1rem; }
.brand-previews figure { margin: 0; }
.brand-preview { display: block; max-height: 64px; max-width: 160px; }
.brand-form input[type="checkbox"] { width: auto; }

/* The PC page's charts (monitoring/charts.py). */
.chart-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-grid { stroke: var(--border); stroke-dasharray: 4 4; }
.chart-axis { stroke: var(--muted); }
.chart-label { fill: var(--muted); font-size: 12px; }
.chart-legend { display: flex; gap: 1rem; margin: 0 0 0.5rem; padding: 0; list-style: none; font-size: 0.9rem; }
.chart-legend li::before { content: ""; display: inline-block; width: 0.9rem; height: 3px; margin-right: 0.35rem; vertical-align: middle; background: currentColor; }
.line-cpu, .line-disk, .line-sent { stroke: var(--accent); color: var(--accent); }
.line-memory { stroke: #b4529b; color: #b4529b; }
.line-received { stroke: #1e9e55; color: #1e9e55; }
dd.status-up { color: #1e9e55; }
dd.status-degraded { color: #b07f00; }
dd.status-down { color: #c0392b; font-weight: 600; }
.sensor-warning { color: #a07800; font-weight: 600; }
dd.status-off { color: var(--muted); }
