:root {
  --bg: #080808;
  --bg2: #0d0d0d;
  --panel: #121212;
  --panel2: #191919;
  --border: #292929;
  --text: #e8e8e8;
  --muted: #858585;
  --accent: #c4c4c4;
  --accent2: #929292;
  --green: #718675;
  --amber: #a18d68;
  --red: #a16f6f;
  --shadow: 0 10px 30px rgba(0,0,0,.5);
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 15% -10%, #12233a 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 0%, #1a1430 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .95rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px;
  background: rgba(8, 11, 16, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.brand span.name { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--muted); font-size: .85rem; display: flex; gap: 14px; flex-wrap: wrap; }

main { max-width: 1380px; margin: 0 auto; padding: 22px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, 1fr); }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head .spacer { flex: 1; }
.panel-head .sub { color: var(--muted); font-size: .82rem; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 112px;
  position: relative;
  overflow: hidden;
}
.card .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.card .value { font-size: 1.55rem; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.card .foot { color: var(--muted); font-size: .8rem; margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; }
.card .spark { position: absolute; right: 0; bottom: 0; width: 120px; height: 46px; opacity: .5; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c12 { grid-column: span 12; }
@media (max-width: 1100px) { .c3 { grid-column: span 6; } .c4 { grid-column: span 6; } }
@media (max-width: 700px) { .c3, .c4, .c6 { grid-column: span 12; } main { padding: 14px; } }

.bar { height: 6px; background: #1b2634; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s ease; }
.bar.warn > i { background: linear-gradient(90deg, var(--amber), #ffcf70); }
.bar.bad > i { background: linear-gradient(90deg, var(--red), #ff8a80); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid var(--border); background: #0f1621; color: var(--muted); white-space: nowrap; }
.badge:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.online { color: #b6f3c1; border-color: rgba(63,185,80,.35); background: rgba(63,185,80,.1); }
.badge.online:before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge.degraded, .badge.starting { color: #ffe0a3; border-color: rgba(214,160,58,.35); background: rgba(214,160,58,.1); }
.badge.degraded:before, .badge.starting:before { background: var(--amber); }
.badge.offline, .badge.stopped { color: #ffb3ae; border-color: rgba(248,81,73,.35); background: rgba(248,81,73,.1); }
.badge.offline:before, .badge.stopped:before { background: var(--red); }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.service {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #0e1520;
}
.service .name { font-weight: 600; font-size: .9rem; }
.service .unit { color: var(--muted); font-size: .74rem; }
.service .spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; padding: 9px 8px; border-bottom: 1px solid var(--border); }
td { padding: 10px 8px; border-bottom: 1px solid rgba(34,48,68,.55); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(76,194,255,.03); }
.table-wrap { overflow-x: auto; }

button, .btn {
  appearance: none; border: 1px solid var(--border); background: #14202e; color: var(--text);
  padding: 8px 13px; border-radius: 9px; font: inherit; font-size: .86rem; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, transform .05s;
}
button:hover, .btn:hover { border-color: #35506d; background: #182739; text-decoration: none; }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #1d5f8a, #164a6d); border-color: #2b7cad; }
button.primary:hover { background: linear-gradient(180deg, #2370a0, #1a567e); }
button.danger { background: #3a1517; border-color: #6d2529; color: #ffb3ae; }
button.danger:hover { background: #4a1a1d; }
button.ghost { background: transparent; }
button.small { padding: 5px 9px; font-size: .78rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

input, select, textarea {
  background: #0b121b; border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font: inherit; font-size: .88rem; outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #2f6f99; box-shadow: 0 0 0 3px rgba(76,194,255,.1); }
label { display: block; color: var(--muted); font-size: .78rem; margin: 0 0 5px; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); background: #0e1520; margin-bottom: 8px; }
.alert .sev { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 999px; }
.alert.critical { border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.07); }
.alert.critical .sev { color: #ffb3ae; background: rgba(248,81,73,.15); }
.alert.warning { border-color: rgba(214,160,58,.35); background: rgba(214,160,58,.06); }
.alert.warning .sev { color: #ffe0a3; background: rgba(214,160,58,.14); }
.alert.info .sev { color: #a9d7ff; background: rgba(76,194,255,.12); }
.alert .title { font-weight: 600; }
.alert .detail { color: var(--muted); font-size: .84rem; }
.empty { color: var(--muted); padding: 16px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast .item { background: #13202e; border: 1px solid #2b4058; border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); font-size: .86rem; max-width: 360px; }
.toast .item.error { border-color: #6d2529; color: #ffb3ae; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 390px; background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
.auth-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-card .logo .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.auth-card h1 { font-size: 1.35rem; }
.auth-card .err { color: #ffb3ae; font-size: .85rem; min-height: 1.2em; margin-top: 8px; }

.hero { max-width: 980px; margin: 0 auto; padding: 46px 22px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.08; letter-spacing: -.03em; }
.hero .lead { color: var(--muted); font-size: 1.05rem; max-width: 700px; margin-top: 14px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 28px; }
.feature { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .88rem; margin: 0; }
.steps { counter-reset: s; display: grid; gap: 12px; margin-top: 18px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n { counter-increment: s; flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #142334; border: 1px solid #2b4058; font-size: .8rem; font-weight: 700; }
.step .n:before { content: counter(s); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: .88rem; }
.kv .k { color: var(--muted); }
.token-reveal { background: #071018; border: 1px dashed #2f6f99; border-radius: 10px; padding: 12px; margin-top: 12px; word-break: break-all; }
canvas.chart { width: 100%; height: 220px; display: block; }

.file-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.breadcrumb { color: var(--muted); font-size: .86rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-bottom: 1px solid rgba(34,48,68,.55); }
.file-row:hover { background: rgba(76,194,255,.03); }
.file-row .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); font-size: .8rem; width: 100px; text-align: right; }
.icon { width: 18px; height: 18px; display: inline-block; opacity: .8; }
.progress { height: 6px; background: #1b2634; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }

@media (max-width: 640px) {
  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar .meta { display: none; }
  .kv { grid-template-columns: 100px 1fr; }
  h1 { font-size: 1.4rem; }
}
