:root {
    --bg: #0f1115;
    --surface: #161a22;
    --surface-2: #1d222c;
    --border: #262c39;
    --text: #e6e9ef;
    --muted: #8a93a6;
    --primary: #4f8cff;
    --primary-2: #6aa0ff;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 6px 24px rgba(0,0,0,.25);
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(1200px 600px at 10% -10%, #1a2236 0%, transparent 60%),
                radial-gradient(1000px 500px at 110% 0%, #1c1730 0%, transparent 55%),
                var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

.container { max-width: 1180px; margin: 0 auto; padding: 24px; }

.topbar {
    background: rgba(15, 17, 21, .7);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px; max-width: 1180px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.brand-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--success); box-shadow: 0 0 10px var(--success);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.85); }
}

nav { display: flex; align-items: center; gap: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-actions { display: flex; align-items: center; gap: 12px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 720px){ .grid-3 { grid-template-columns: 1fr; } }

.stats .stat { padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 6px; }
.stat-up .stat-value { color: var(--success); }
.stat-down .stat-value { color: var(--danger); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: var(--surface-2); }

.row-name { font-weight: 600; }

code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 6px; border-radius: 6px; font-size: 12px;
}

.status-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--muted); box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}
.status-up   { background: var(--success); box-shadow: 0 0 12px rgba(34,197,94,.55); }
.status-down { background: var(--danger);  box-shadow: 0 0 12px rgba(239,68,68,.55); }
.status-pending { background: var(--warning); }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text);
    cursor: pointer; font-size: 13px; font-weight: 500;
    transition: transform .06s ease, background .2s ease, border-color .2s ease;
    text-decoration: none;
}
.btn:hover { background: #232938; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-secondary { background: var(--surface-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: transparent; color: #ff8a8a; border-color: #4b2230; }
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.icon-refresh::before {
    content: ""; display: inline-block; width: 14px; height: 14px;
    border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
}
.refreshing .icon-refresh::before { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; padding: 18px 20px;
}
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid textarea {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    padding: 9px 12px; border-radius: 8px; font: inherit; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-grid input:focus, .form-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,140,255,.25);
}
.span-2 { grid-column: span 2; }
@media (max-width: 720px){
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
}
.form-actions { display: flex; align-items: center; gap: 14px; }
.inline { display: inline; }

.empty { padding: 36px; text-align: center; color: var(--muted); }

.alert {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
    border: 1px solid var(--border); background: var(--surface);
}
.alert-success { border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); color: #b8f4ce; }
.alert-error   { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); color: #ffc7c7; }

.footer { text-align: center; padding: 24px 0 40px; }

/* Auth */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
}
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 4px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-card input {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    padding: 10px 12px; border-radius: 8px; font: inherit; outline: none;
}
.auth-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.55; }

/* Public status page */
.hero {
    padding: 28px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    transition: border-color .3s ease, background .3s ease;
}
.hero-status { display: flex; align-items: center; gap: 18px; }
.hero-icon {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; color: #fff;
    background: var(--muted);
    box-shadow: 0 0 0 6px rgba(255,255,255,.04);
}
.hero-title { font-size: 22px; font-weight: 700; }
.hero-sub   { margin-top: 2px; }
.hero-stats { display: flex; gap: 32px; }
.hero-stats .stat-value { font-size: 28px; font-weight: 700; }
.hero-stats .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

.state-up      { border-color: rgba(34,197,94,.35);  background: linear-gradient(180deg, rgba(34,197,94,.08), transparent); }
.state-up      .hero-icon { background: var(--success); box-shadow: 0 0 24px rgba(34,197,94,.45); }
.state-down    { border-color: rgba(239,68,68,.35);  background: linear-gradient(180deg, rgba(239,68,68,.10), transparent); }
.state-down    .hero-icon { background: var(--danger);  box-shadow: 0 0 24px rgba(239,68,68,.5); }
.state-partial { border-color: rgba(245,158,11,.4);  background: linear-gradient(180deg, rgba(245,158,11,.08), transparent); }
.state-partial .hero-icon { background: var(--warning); box-shadow: 0 0 24px rgba(245,158,11,.45); color: #1f1300; }
.state-unknown .hero-icon { background: var(--surface-2); color: var(--muted); }

.status-grid {
    display: grid; gap: 14px; padding: 18px 20px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.status-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: transform .12s ease, border-color .2s ease;
}
.status-card:hover { transform: translateY(-1px); border-color: #2f3647; }
.status-card-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.status-card-title { flex: 1; min-width: 0; }
.status-card-title .row-name { font-weight: 600; }
.status-card-title code { background: transparent; border: none; padding: 0; font-size: 12px; color: var(--muted); }

.status-badge {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .5px;
    border: 1px solid var(--border); color: var(--muted);
}
.badge-up   { color: #b8f4ce; border-color: rgba(34,197,94,.4);  background: rgba(34,197,94,.12); }
.badge-down { color: #ffc7c7; border-color: rgba(239,68,68,.4);  background: rgba(239,68,68,.12); }
.badge-pending { color: #fde68a; border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }

.status-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
    margin: 0; padding-top: 10px; border-top: 1px dashed var(--border);
}
.status-meta > div { min-width: 0; }
.status-meta dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.status-meta dd { margin: 0; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-meta div:nth-child(2) { grid-column: span 2; }

/* Vertical status list (UptimeRobot style) */
.status-list { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.status-row {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    transition: border-color .2s ease;
}
.status-row:hover { border-color: #2f3647; }
.row-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.row-info { flex: 1; min-width: 0; }
.row-info .row-name { font-weight: 600; font-size: 14px; }
.row-info code { background: transparent; border: none; padding: 0; font-size: 12px; color: var(--muted); }
.row-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.row-meta .uptime-cell { font-variant-numeric: tabular-nums; }

.uptime-bar { display: flex; gap: 2px; height: 16px; align-items: stretch; }
.uptime-bar .seg {
    flex: 1; min-width: 2px; border-radius: 2px;
    background: #2a3142; transition: transform .15s ease, opacity .15s ease;
    cursor: help;
}
.uptime-bar .seg:hover { transform: scaleY(1.15); opacity: .85; }
.seg-up    { background: linear-gradient(180deg, #34d27a, #1f9d56) !important; box-shadow: inset 0 -1px 0 rgba(0,0,0,.2); }
.seg-down  { background: linear-gradient(180deg, #ff6b6b, #c63838) !important; box-shadow: inset 0 -1px 0 rgba(0,0,0,.2); }
.seg-empty { background: #232938 !important; opacity: .55; }

.row-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px; gap: 12px; flex-wrap: wrap;
}
.last-outage.outage-active { color: #ffb3b3 !important; font-weight: 600; }
.dot-down {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); margin-right: 6px;
    box-shadow: 0 0 8px rgba(239,68,68,.7);
    animation: pulse 1.6s infinite;
}

@media (max-width: 640px) {
    .row-head { flex-wrap: wrap; }
    .row-meta { width: 100%; justify-content: space-between; margin-top: 6px; }
    .uptime-bar { height: 12px; }
    .uptime-bar .seg { min-width: 2px; }
}
