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

:root {
    color-scheme: dark;
    --bg:       #0B0915;
    --surface:  #121023;
    --surface2: #1B1933;
    --border:   #2D2A4A;
    --text:     #EDE9FF;
    --muted:    #8B85B5;
    --accent:   #7B5EFD;
    --green:    #22C55E;
    --yellow:   #EAB308;
    --red:      #EF4444;
    --blue:     #60A5FA;
}

body {
    font-family: 'Geist', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 48px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 20px;
    z-index: 200;
}

.sidebar {
    position: fixed; top: 48px; left: 0; bottom: 0; width: 196px;
    background: var(--bg); border-right: 1px solid var(--border);
    padding: 20px 8px; overflow-y: auto; z-index: 100;
}

.main {
    margin-left: 196px;
    margin-right: 320px;
    margin-top: 48px;
    padding: 24px 32px 60px;
}

.content { max-width: 1080px; display: flex; flex-direction: column; gap: 20px; }

.rail-right {
    position: fixed; top: 48px; right: 0; bottom: 0; width: 320px;
    background: var(--bg); border-left: 1px solid var(--border);
    padding: 16px 14px; overflow-y: auto; z-index: 100;
}
.rail-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 0 4px 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.rail-title { font-weight: 600; font-size: 13px; }
.rail-sub   { font-size: 11px; color: var(--muted); }
.rail-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; }
.incident-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

.incident {
    padding: 0; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); font-size: 12px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.incident:hover { border-color: var(--muted); }

.incident-card-link {
    display: block;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.incident-card-link:hover { background-color: var(--surface2); }
.incident-resolved { opacity: 0.65; }
.incident-major, .incident-critical { border-left: 3px solid var(--red); }
.incident-minor    { border-left: 3px solid var(--yellow); }
.incident-none     { border-left: 3px solid var(--green); }
.incident-maintenance { border-left: 3px solid var(--blue); }

.incident-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.incident-provider {
    font-size: 11px; color: var(--muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: .04em;
}
.incident-status {
    font-size: 10px; padding: 1px 6px; border-radius: 3px;
    background: var(--surface2); color: var(--muted); text-transform: lowercase;
}
.incident-status-resolved      { background: rgba(34,197,94,.15);  color: var(--green); }
.incident-status-investigating { background: rgba(239,68,68,.15);  color: var(--red); }
.incident-status-identified    { background: rgba(239,68,68,.15);  color: var(--red); }
.incident-status-monitoring    { background: rgba(234,179,8,.15);  color: var(--yellow); }
.incident-status-degraded      { background: rgba(234,179,8,.15);  color: var(--yellow); }
.incident-status-scheduled     { background: rgba(96,165,250,.15); color: var(--blue); }
.incident-status-in_progress   { background: rgba(96,165,250,.15); color: var(--blue); }
.incident-status-verifying     { background: rgba(96,165,250,.15); color: var(--blue); }
.incident-status-completed     { background: rgba(34,197,94,.15);  color: var(--green); }

.incident-title { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; line-height: 1.35; }
.incident-body  { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-bottom: 6px; }
.incident-foot  { display: flex; align-items: center; justify-content: space-between; }
.incident-time  { color: var(--muted); font-size: 10.5px; }
.incident-link  { font-size: 11px; color: var(--text); text-decoration: none; opacity: .7; }
.incident-link:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 1280px) {
    .main { margin-right: 0; }
    .rail-right {
        position: static; width: auto; border-left: none;
        border-top: 1px solid var(--border); margin-left: 196px;
    }
}
@media (max-width: 720px) {
    .sidebar { display: none; }
    .main { margin-left: 0; margin-right: 0; padding: 16px; }
    .rail-right { margin-left: 0; }
}

.topbar-brand {
    font-weight: 600; font-size: 14px;
    display: flex; align-items: center; gap: 10px;
}
.topbar-brand::before {
    content: ''; display: inline-block;
    width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
}
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 11px; color: var(--muted); }

.topbar-separator { margin: 0 4px; color: var(--border); }
.refresh-control { display: inline-flex; align-items: center; gap: 6px; }
.refresh-countdown { font-size: 11px; color: var(--muted); font-family: 'Geist Mono', monospace; text-align: right; }
.refresh-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'Geist Mono', monospace;
    font-size: 11px;
    padding: 2px 6px;
    cursor: pointer;
    outline: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.refresh-select:hover {
    background: var(--surface2);
    border-color: var(--muted);
}
.refresh-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #9b7ffe);
    z-index: 210;
    width: 0%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-section-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted);
    padding: 0 10px 8px; display: block;
}
.sidebar-link {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 5px;
    color: var(--muted); text-decoration: none;
    font-size: 13px; transition: background .1s, color .1s;
}
.sidebar-link:hover  { background: var(--surface); color: var(--text); }
.sidebar-link.active { background: var(--surface); color: var(--text); }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 12px 10px; }

@keyframes pulse-ok {
    0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,.15); }
    50%       { box-shadow: 0 0 0 5px rgba(34,197,94,.04); }
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-sm { width: 6px; height: 6px; }
.dot-ok   { background: var(--green);  box-shadow: 0 0 0 2px rgba(34,197,94,.15); animation: pulse-ok 2.4s ease-in-out infinite; }
.dot-warn { background: var(--yellow); box-shadow: 0 0 0 2px rgba(234,179,8,.15); }
.dot-err  { background: var(--red);    box-shadow: 0 0 0 2px rgba(239,68,68,.15); }
.dot-na   { background: #484f58; }

.badge {
    display: inline-block; padding: 1px 7px; border-radius: 4px;
    font-size: 10px; border: 1px solid transparent; white-space: nowrap;
    text-transform: uppercase; letter-spacing: .04em;
}
.badge-ok   { background: rgba(34,197,94,.1);  color: var(--green);  border-color: rgba(34,197,94,.25); }
.badge-warn { background: rgba(234,179,8,.1);  color: var(--yellow); border-color: rgba(234,179,8,.25); }
.badge-na   { background: rgba(45,42,74,.3);   color: var(--muted);  border-color: rgba(45,42,74,.5); }

.text-ok    { color: var(--green); }
.text-warn  { color: var(--yellow); }
.text-err   { color: var(--red); }
.text-muted { color: var(--muted); }
.text-xs    { font-size: 11px; }

.hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 22px;
    display: flex; align-items: center; gap: 16px;
}
.hero-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.hero-dot.ok   { background: var(--green);  box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.hero-dot.warn { background: var(--yellow); box-shadow: 0 0 0 4px rgba(234,179,8,.2); }
.hero-title { font-size: 18px; font-weight: 600; }
.hero-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero-stat  { margin-left: auto; text-align: right; }
.hero-stat-value { font-size: 20px; font-weight: 600; font-family: 'Geist Mono', monospace; }
.hero-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.timeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}
.timeline-title { font-size: 14px; font-weight: 600; }
.window-selector { display: inline-flex; align-items: center; gap: 8px; }
.window-label { font-size: 11px; color: var(--muted); }

button.window-btn {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font-family: 'Geist', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    line-height: 1.2;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    user-select: none;
}
button.window-btn::-moz-focus-inner { border: 0; padding: 0; }
button.window-btn:hover { color: var(--text); border-color: var(--muted); }
button.window-btn.active { background: var(--border); color: var(--text); border-color: var(--muted); }

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    margin-top: 4px;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.tiles-grid-priority { grid-template-columns: 1fr; }

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 10px;
    transition: border-color .15s, transform .1s;
    cursor: pointer;
    text-decoration: none; color: inherit;
}
.tile:hover { border-color: var(--muted); transform: translateY(-1px); }

.tile-head { display: flex; align-items: center; gap: 8px; }
.tile-name { font-weight: 600; font-size: 14px; }
.tile-badge { margin-left: auto; }

.tile-metric-block { display: flex; flex-direction: column; }
.tile-metric {
    font-family: 'Geist Mono', monospace;
    font-size: 22px; font-weight: 600;
    line-height: 1;
}
.tile-metric-total { color: var(--muted); font-weight: 400; font-size: 16px; }
.tile-metric-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

.tile-history { display: flex; gap: 1px; align-items: center; height: 14px; }
.tile-history-bar { width: 4px; height: 14px; border-radius: 1px; flex-shrink: 0; }
.tile-history-bar.ok   { background: rgba(34,197,94,.55); }
.tile-history-bar.warn { background: rgba(234,179,8,.55); }
.tile-history-bar.err  { background: rgba(239,68,68,.55); }
.tile-history-bar.na   { background: var(--border); }

.tile-footer {
    font-size: 10px; color: var(--muted); font-family: 'Geist Mono', monospace;
    margin-top: auto; padding-top: 4px;
}

.scalingo-card-link { display: block; text-decoration: none; color: inherit; }

.scalingo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
}
.card-header-left  { display: flex; align-items: center; gap: 8px; }
.card-header-right { display: flex; align-items: center; gap: 8px; }
.card-title        { font-weight: 600; font-size: 13px; }

.scalingo-body {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 0;
}

.scalingo-regions-wrap {
    padding: 14px 16px;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.scalingo-globals-wrap {
    padding: 14px 16px;
    display: flex; flex-direction: column;
}

.section-sublabel {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.scalingo-table-scroll { overflow-x: auto; }
.scalingo-table { width: 100%; border-collapse: collapse; }
.scalingo-table th {
    text-align: center;
    padding: 6px 6px 10px;
    font-weight: 500;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.25;
    border-bottom: 1px solid var(--border);
    vertical-align: bottom;
    max-width: 88px;
    min-width: 60px;
}
.scalingo-table th.region-col { width: 1%; }

.scalingo-table td {
    text-align: center;
    padding: 10px 6px;
    font-size: 13px;
    line-height: 1;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.scalingo-table td.region-col {
    text-align: left;
    padding: 10px 12px 10px 4px;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.scalingo-table tbody tr:last-child td { border-bottom: none; }
.scalingo-table tbody tr { transition: background .1s; }
.scalingo-table tbody tr:hover { background: var(--surface2); }

.cell-na { color: var(--muted); font-size: 13px; font-family: 'Geist Mono', monospace; }

.scalingo-globals { display: flex; flex-direction: column; gap: 8px; }
.scalingo-global-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color .1s, transform .1s;
}
.scalingo-global-card:hover { border-color: var(--muted); transform: translateY(-1px); }

.scalingo-global-icon { flex-shrink: 0; display: flex; align-items: center; }
.scalingo-global-info { min-width: 0; flex: 1; }
.scalingo-global-name {
    font-weight: 600; font-size: 12px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scalingo-global-status {
    font-size: 10px; color: var(--muted);
    font-family: 'Geist Mono', monospace;
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.empty-state { color: var(--muted); font-size: 11px; padding: 12px; text-align: center; }

.card-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}
.history-strip {
    display: flex; gap: 1px; align-items: center;
    height: 12px; margin-left: auto;
}
.history-bar { width: 4px; height: 12px; border-radius: 1px; flex-shrink: 0; }
.history-bar.ok   { background: rgba(34,197,94,.55); }
.history-bar.warn { background: rgba(234,179,8,.55); }
.history-bar.err  { background: rgba(239,68,68,.55); }

@media (max-width: 800px) {
    .scalingo-body { grid-template-columns: 1fr; }
    .scalingo-regions-wrap {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

.incidents {
    background: var(--surface);
    border: 1px solid rgba(234,179,8,.3);
    border-left: 3px solid var(--yellow);
    border-radius: 6px;
    overflow: hidden;
}
.incidents-header {
    padding: 10px 16px;
    background: rgba(234,179,8,.05);
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: var(--yellow);
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border);
}
.incidents-list { list-style: none; }
.incident-row { border-top: 1px solid var(--border); font-size: 12px; }
.incident-row:first-child { border-top: none; }

.incident-row-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    width: 100%;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.incident-row-link:hover { background-color: rgba(234,179,8,.08); }
.incident-service {
    font-size: 10px; padding: 2px 6px; border-radius: 3px;
    background: var(--surface2); color: var(--muted);
    font-family: 'Geist Mono', monospace; flex-shrink: 0;
}
.incident-name { flex: 1; color: var(--text); }
.incident-status { font-family: 'Geist Mono', monospace; font-size: 11px; }

.section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .1em; color: var(--muted);
    margin: 8px 0 -8px 4px;
}

details.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
details.detail-card > summary {
    padding: 11px 16px;
    cursor: pointer;
    list-style: none; user-select: none;
    display: flex; align-items: center; gap: 10px;
    transition: background .1s;
}
details.detail-card > summary::-webkit-details-marker { display: none; }
details.detail-card > summary:hover { background: var(--surface2); }
details.detail-card[open] > summary { border-bottom: 1px solid var(--border); }

.chevron { font-size: 8px; transition: transform .15s; color: var(--muted); }
details[open] > summary .chevron { transform: rotate(90deg); }

.detail-summary-title { font-weight: 600; font-size: 13px; }
.detail-summary-stats { margin-left: auto; font-size: 11px; color: var(--muted); font-family: 'Geist Mono', monospace; }

.detail-summary-external-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.detail-summary-external-link:hover { opacity: 1; color: var(--text); }

.component-group { padding: 0 16px; border-bottom: 1px solid var(--border); }
.component-group:last-child { border-bottom: none; }
.group-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted);
    padding: 10px 0 6px;
}
.component-row {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--border);
}
.component-row:first-of-type { border-top: none; }

.component-row-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.component-row-link:hover {
    background-color: var(--surface2);
    transform: translateX(2px);
}
.component-name   { color: var(--text); }
.component-status { font-size: 11px; display: flex; align-items: center; gap: 5px; }

details.subsection > summary {
    padding: 9px 16px; cursor: pointer; list-style: none;
    display: flex; align-items: center; gap: 8px;
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted);
    border-top: 1px solid var(--border);
}
details.subsection > summary::-webkit-details-marker { display: none; }
details.subsection > summary:hover { background: var(--surface2); }

.card-error { padding: 12px 16px; color: var(--red); font-size: 12px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
