/* ============================================================
   SecMon — dashboard stylesheet
   Aesthetic: clean ops console. Mono for data, serif accents.
   ============================================================ */

:root {
    --bg:           #0f1115;
    --bg-panel:     #171a21;
    --bg-elev:      #1e222b;
    --bg-hover:     #252a35;
    --border:       #2a2f3a;
    --border-soft:  #23272f;
    --text:         #e6e8ec;
    --text-dim:     #9aa3b2;
    --text-muted:   #6c7485;
    --accent:       #7dd3fc;       /* calm cyan */
    --accent-dim:   #164e63;
    --ok:           #4ade80;
    --warn:         #fbbf24;
    --red:          #f87171;
    --red-bg:       #3b1414;
    --crit:         #ef4444;
    --crit-bg:      #450a0a;

    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

/* ---------- Nav ---------- */
.topnav {
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #12141a 0%, #0f1115 100%);
    position: sticky; top: 0; z-index: 10;
}
.topnav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.01em;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(74,222,128,0.12);
}
.brand-name { font-weight: 500; }
.topnav-links {
    display: flex; gap: 22px; margin-left: 18px; flex: 1;
}
.topnav-links a {
    color: var(--text-dim);
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
}
.topnav-links a:hover { color: var(--text); text-decoration: none; }
.topnav-links a.active { color: var(--text); border-bottom-color: var(--accent); }
.topnav-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }

/* ---------- Page container ---------- */
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-soft);
}
.page-header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 28px;
    letter-spacing: -0.01em;
}
.page-header .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- Stat strip ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.stat {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 14px 16px;
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 500;
    color: var(--text);
}
.stat.alert { border-color: var(--red); background: linear-gradient(180deg, var(--red-bg) 0%, var(--bg-panel) 100%); }
.stat.alert .stat-value { color: var(--red); }
.stat.crit { border-color: var(--crit); background: linear-gradient(180deg, var(--crit-bg) 0%, var(--bg-panel) 100%); }
.stat.crit .stat-value { color: var(--crit); }

/* ---------- Tables ---------- */
.table-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    overflow: hidden;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
}
table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num { font-family: var(--font-mono); text-align: right; }
table.data td.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- Pills ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: var(--bg-elev);
    color: var(--text-dim);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.pill.ok { color: var(--ok); background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.2); }
.pill.red { color: var(--red); background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); }
.pill.warn { color: var(--warn); background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.25); }
.pill.crit {
    color: #fff;
    background: var(--crit);
    border-color: var(--crit);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.pill-dot::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}

.tag-add { color: var(--ok); }
.tag-mod { color: var(--warn); }
.tag-rem { color: var(--red); }

/* ---------- Row-level status ---------- */
tr.row-red td:first-child {
    box-shadow: inset 3px 0 0 var(--red);
}
tr.row-crit td:first-child {
    box-shadow: inset 3px 0 0 var(--crit);
}

/* ---------- Forms & buttons ---------- */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 22px;
    margin-bottom: 18px;
}
.card h2 {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
}
label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="email"], textarea, select {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125,211,252,0.15);
}
textarea { font-family: var(--font-mono); font-size: 12.5px; min-height: 90px; }
.form-row { margin-bottom: 16px; }
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 5px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #061017;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform .1s, background .15s;
}
.btn:hover { background: #a5e3fd; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-dim);
}
.btn-ghost:hover { background: var(--bg-elev); color: var(--text); }
.btn-danger { border-color: var(--red); background: var(--red); color: #fff; }
.btn-danger:hover { background: #fca5a5; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
    background: var(--bg-panel);
    margin-bottom: 18px;
    font-size: 13.5px;
}
.alert.err { border-color: var(--red); background: var(--red-bg); }
.alert.ok { border-color: var(--ok); background: rgba(74,222,128,0.08); }

/* ---------- Code snippet ---------- */
pre.code {
    background: #0a0c11;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: #d4d4d4;
    white-space: pre;
}
.code-tab-bar {
    display: flex;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    justify-content: space-between;
    align-items: center;
}
.code-tab-bar + pre.code { border-radius: 0 0 4px 4px; margin-top: 0; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #1a1d28 0%, #0f1115 70%);
}
.login-card {
    width: 380px;
    padding: 36px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.login-card h1 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- File path display ---------- */
.path {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text);
    word-break: break-all;
}

/* ---------- Expandable rows ---------- */
details { cursor: pointer; }
details summary { list-style: none; outline: none; }
details summary::-webkit-details-marker { display: none; }

/* ---------- Footer ---------- */
.foot {
    max-width: 1400px;
    margin: 40px auto 20px;
    padding: 0 28px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Utility ---------- */
.flex { display: flex; gap: 10px; align-items: center; }
.gap-sm { gap: 6px; }
.gap-md { gap: 14px; }
.space-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mb-0 { margin-bottom: 0; }
.mb-md { margin-bottom: 18px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.small { font-size: 12px; }

hr { border: none; border-top: 1px solid var(--border-soft); margin: 20px 0; }

/* Responsive */
@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .page { padding: 18px; }
    .topnav-inner { padding: 12px 18px; gap: 14px; }
    .topnav-links { margin-left: 0; }
}
