:root {
    --bg: #111214;
    --bg-elevated: #1e1f22;
    --bg-elevated-2: #232428;
    --border: #2f3136;
    --text: #f2f3f5;
    --muted: #b5bac1;
    --muted-2: #949ba4;
    --link: #5865f2;
    --green: #3ba55c;
    --yellow: #faa61a;
    --orange: #f26522;
    --red: #ed4245;
    --blue: #5865f2;
    --shadow: 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 20px;
}
.page { min-height: 100vh; display: flex; flex-direction: column; }
main.container { flex: 1; padding-top: 24px; padding-bottom: 40px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(17,18,20,.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}
.brand {
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a { color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--text); text-decoration: none; }

.overall {
    display: flex;
    align-items: center;
    gap: 16px;
    background: color-mix(in srgb, var(--overall-color) 18%, var(--bg-elevated));
    border: 1px solid color-mix(in srgb, var(--overall-color) 40%, var(--border));
    border-radius: 14px;
    padding: 22px 24px;
    margin: 8px 0 28px;
}
.overall-icon {
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--overall-color);
    color: #fff; font-weight: 700; font-size: 1.2rem;
    flex: 0 0 auto;
}
.overall-text { font-size: 1.5rem; font-weight: 700; }

.section { margin: 28px 0; }
.section h2 { font-size: 1.2rem; margin: 0 0 14px; }

.component-group {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}
.component-group-title {
    padding: 14px 18px;
    font-weight: 700;
    background: var(--bg-elevated-2);
    border-bottom: 1px solid var(--border);
}
.component-list .component + .component { border-top: 1px solid var(--border); }
.component {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
}
.component-main { min-width: 0; }
.component-name { font-weight: 600; }
.component-desc { color: var(--muted-2); font-size: 0.92rem; margin-top: 2px; }
.component-status {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--status-color); font-weight: 600; white-space: nowrap;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--status-color); display: inline-block; }

.incidents { display: grid; gap: 14px; }
.incident-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}
.incident-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.incident-head h3 { margin: 0; font-size: 1.05rem; }
.incident-meta, .incident-time, .update-time { color: var(--muted-2); font-size: 0.9rem; }
.incident-message { margin: 8px 0; color: var(--muted); }
.updates { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 12px; }
.updates li { border-left: 2px solid #3a3d44; padding-left: 12px; }
.update-status { font-weight: 700; font-size: 0.92rem; margin-bottom: 2px; }
.update-message { color: var(--muted); }
.update-time { margin-top: 4px; }

.pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
    background: #2b2d31; color: var(--muted); border: 1px solid var(--border);
}
.pill.resolved { color: #b7e3c2; background: rgba(59,165,92,.15); border-color: rgba(59,165,92,.35); }
.pill.impact-critical, .pill.impact-major { color: #ffd0d2; background: rgba(237,66,69,.15); border-color: rgba(237,66,69,.35); }
.pill.impact-minor { color: #ffe2b8; background: rgba(250,166,26,.12); border-color: rgba(250,166,26,.35); }
.pill.impact-maintenance { color: #d7dcff; background: rgba(88,101,242,.15); border-color: rgba(88,101,242,.35); }

.empty {
    color: var(--muted-2);
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 18px;
}
.footer { color: var(--muted-2); font-size: 0.9rem; padding: 10px 20px 30px; }

/* Admin */
.admin-wrap { max-width: 1100px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
}
.panel h2, .panel h3 { margin-top: 0; }
.panel h2 { font-size: 1.1rem; margin-bottom: 12px; }
.panel h3 { font-size: 1rem; margin-bottom: 10px; }
.form-grid { display: grid; gap: 10px; }
label { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
input[type=text], input[type=number], input[type=url], select, textarea {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #3a3d44;
    background: #111214; color: var(--text); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(88,101,242,.5); border-color: #5865f2; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn, button.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 14px; border-radius: 8px; border: 1px solid #3a3d44;
    background: #2b2d31; color: var(--text); font-weight: 600; cursor: pointer;
}
.btn:hover, button.btn:hover { background: #35373c; text-decoration: none; }
.btn.primary { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.primary:hover { background: #4752c4; }
.btn.danger { background: rgba(237,66,69,.15); border-color: rgba(237,66,69,.4); color: #ffd0d2; }
.btn.small { padding: 6px 10px; font-size: 0.85rem; }
table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.admin-table th { color: var(--muted-2); font-size: 0.85rem; font-weight: 600; }
.muted { color: var(--muted-2); }
.notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--border); background: #232428; }
.notice.success { border-color: rgba(59,165,92,.4); background: rgba(59,165,92,.12); color: #c9efd4; }
.notice.error { border-color: rgba(237,66,69,.4); background: rgba(237,66,69,.12); color: #ffd0d2; }
.inline-form { display: inline; }
.checkbox-list { display: grid; gap: 6px; max-height: 180px; overflow: auto; padding: 8px; border: 1px solid #3a3d44; border-radius: 8px; background: #111214; }
.checkbox-list label { display: flex; gap: 8px; align-items: center; color: var(--text); }

@media (max-width: 720px) {
    .overall { padding: 18px; }
    .overall-text { font-size: 1.2rem; }
    .component { flex-direction: column; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; }
    .incident-head { flex-direction: column; align-items: flex-start; }
}
