/* ── Base ─────────────────────────────────────────────────────────────────── */
:root {
    --bg: #f8f9fa;
    --card-bg: #fff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --critical: #dc3545;
    --major: #fd7e14;
    --minor: #ffc107;
    --info: #0dcaf0;
    --ok: #198754;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

a { color: inherit; text-decoration: none; }

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
    background: #1a1a2e;
    color: #fff;
    padding: 1rem 0;
}

header h1 { font-size: 1.3rem; font-weight: 600; }
header h1 a { color: #fff; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #664d03;
}

/* ── Status banner ───────────────────────────────────────────────────────── */
.status-banner {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.status-banner.all-ok {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.status-banner.has-incidents {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.status-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.status-banner h2 { font-size: 1.4rem; }
.status-banner p { margin-top: 0.25rem; color: inherit; opacity: 0.85; }

/* ── Incidents ───────────────────────────────────────────────────────────── */
.incidents-section { margin: 1.5rem 0; }
.incidents-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.incident-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.incident-card.severity-critical { border-left-color: var(--critical); }
.incident-card.severity-major { border-left-color: var(--major); }
.incident-card.severity-minor { border-left-color: var(--minor); }
.incident-card.severity-info { border-left-color: var(--info); }
.incident-card.resolved { opacity: 0.7; }

.incident-link { text-decoration: none; color: inherit; display: block; }
.incident-link .incident-card { transition: box-shadow 0.15s, transform 0.15s; cursor: pointer; }
.incident-link:hover .incident-card { box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-1px); }

.tag-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #6c757d;
    color: #fff;
    letter-spacing: 0.5px;
}

.incident-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.incident-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.severity-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
}

.severity-badge.critical { background: var(--critical); }
.severity-badge.major { background: var(--major); }
.severity-badge.minor { background: var(--minor); color: #333; }
.severity-badge.info { background: var(--info); color: #333; }

.source-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #e9ecef;
    color: var(--text-muted);
}

.status-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.status-label.investigating { color: var(--critical); }
.status-label.identified { color: var(--major); }
.status-label.monitoring { color: var(--minor); }
.status-label.resolved { color: var(--ok); }

.incident-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.last-updated {
    opacity: 0.7;
    font-style: italic;
}

.last-updated::before {
    content: "·";
    margin-right: 0.3rem;
}

.incident-description {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.resolved-section { opacity: 0.85; }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.5rem 0 1rem;
}

.admin-header h2 { font-size: 1.3rem; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary { background: #0d6efd; color: #fff; }
.btn-primary:hover { background: #0b5ed7; }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover { background: #bb2d3b; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.incident-form label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.incident-form input,
.incident-form textarea,
.incident-form select {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ── Updates timeline ────────────────────────────────────────────────────── */
.updates-timeline { margin: 1.5rem 0; }
.updates-timeline h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.update-entry {
    border-left: 2px solid var(--border);
    padding: 0.5rem 0 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.update-entry time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.update-entry p {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.admin-table th, .admin-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.admin-table th {
    font-weight: 600;
    background: var(--bg);
}

/* ── Add sub form ────────────────────────────────────────────────────────── */
.add-sub-form {
    margin-top: 1rem;
}

.add-sub-form summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.add-sub-form form {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: end;
}

.add-sub-form label {
    font-size: 0.8rem;
    font-weight: 600;
}

.add-sub-form input,
.add-sub-form select {
    display: block;
    width: 100%;
    padding: 0.4rem;
    margin-top: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.empty { color: var(--text-muted); font-style: italic; }

.tags-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0;
}
.tags-fieldset legend { font-size: 0.8rem; font-weight: 600; padding: 0 0.25rem; }
.tag-check { display: inline-flex; align-items: center; gap: 0.3rem; margin-right: 1rem; font-size: 0.85rem; cursor: pointer; }
.tag-check input { cursor: pointer; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .add-sub-form form { grid-template-columns: 1fr; }
}
