:root {
  color-scheme: dark;
  font-family: Geist, "Segoe UI", Tahoma, Arial, sans-serif;
  --bg: #0d1520;
  --panel: #151f2d;
  --line: #364657;
  --text: #f0f5fa;
  --muted: #a9b8ca;
  --cyan: #65e0ec;
  --green: #81e5a0;
  --amber: #ffd16d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: radial-gradient(ellipse at 88% 0, #172332 0, transparent 47%), var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
h1, h2, p { margin: 0; }
bdi, time, .metric-value, .metric-detail, .state-counts strong { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.good { color: var(--green); }
.warn { color: var(--amber); }
.neutral { color: var(--muted); }

.dashboard { max-width: 1600px; margin-inline: auto; padding: clamp(18px, 3vw, 42px); }
.masthead, .server-title, .header-tools, .metric-title, .panel-heading {
  display: flex;
  align-items: center;
}
.masthead { justify-content: space-between; gap: 20px; margin-block-end: 26px; }
.server-title, .header-tools { gap: 16px; }
.server-title h1 { font-size: clamp(1.6rem, 3.1vw, 2.5rem); line-height: 1.2; letter-spacing: -.02em; }
.server-name { display: block; color: var(--muted); font-size: 1.15rem; margin-top: 5px; font-weight: 650; }
.timestamp, .account-menu summary {
  background: #202c3b;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
}
.timestamp { display: grid; gap: 2px; line-height: 1.3; font-size: .83rem; }
.timestamp time { text-align: end; font-weight: 650; white-space: nowrap; }
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; white-space: nowrap; }
.account-actions {
  background: #202c3b;
  border: 1px solid var(--line);
  border-radius: 9px;
  z-index: 1;
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  width: max-content;
  overflow: hidden;
}
.account-actions a, .account-actions button {
  display: block;
  color: var(--text);
  text-align: start;
  text-decoration: none;
  padding: 10px 14px;
  width: 100%;
  background: transparent;
  border: 0;
}
.account-actions a:hover, .account-actions button:hover { background: #2b3a4d; }

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, #182333, var(--panel) 57%);
}
.metrics, .overview { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block-end: 18px; }
.metric { padding: clamp(15px, 2.3vw, 26px); }
.metric-title { gap: 12px; color: var(--text); }
.metric-title h2 { font-size: clamp(1.05rem, 1.8vw, 1.35rem); }
.metric-value { color: var(--cyan); font-size: clamp(2.55rem, 4.8vw, 4rem); font-weight: 750; line-height: 1.1; margin-block: 10px 4px; text-align: right; }
.metric-detail { color: var(--muted); font-weight: 600; text-align: right; }
progress {
  display: block;
  direction: ltr;
  appearance: none;
  width: 100%;
  height: 12px;
  margin-block-start: 19px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: #2a3a4d;
}
progress::-webkit-progress-bar { background: #2a3a4d; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--cyan); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--cyan); border-radius: 99px; }

.overview { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: stretch; }
.docker-panel, .host-panel { padding: clamp(13px, 1.8vw, 22px); min-width: 0; }
.panel-heading { justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 38px; }
.panel-heading h2 { font-size: clamp(1.2rem, 2vw, 1.65rem); font-weight: 700; }
.switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; font-size: .87rem; }
.switch button { background: transparent; border: 0; border-radius: 5px; color: var(--muted); padding: 5px 10px; }
.switch button[aria-pressed="true"] { background: #2a3b4d; color: var(--text); }
.state-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 19px 17px; }
.state-counts div {
  color: var(--cyan);
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  padding-inline: 4px;
  text-align: center;
  line-height: 1.1;
}
.state-counts div + div { border-inline-start: 1px solid var(--line); }
.state-counts div.good { color: var(--green); }
.state-counts div.warn { color: var(--amber); }
.state-counts strong { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.state-counts span { font-size: .94rem; font-weight: 650; }
.docker-note { font-size: .86rem; margin-block-end: 10px; }
.table-frame { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 10px 12px; text-align: center; border-block-end: 1px solid var(--line); }
th { background: #223041; color: #dce5ee; font-size: .9rem; }
th:first-child, td:first-child { width: 55%; text-align: start; overflow-wrap: anywhere; }
th:nth-child(2), td:nth-child(2) { width: 18%; }
td { line-height: 1.4; }
td:first-child { font-weight: 650; }
tbody tr:last-child td { border-block-end: 0; }
tbody tr:nth-child(even) { background: #121c28; }
.tag { display: inline-block; font-weight: 650; font-size: .84rem; border: 1px solid transparent; border-radius: 99px; padding: 2px 9px; }
.tag.good { background: #16342a; border-color: #29503e; }
.tag.warn { background: #392f1d; border-color: #5a4828; }
.tag.neutral { background: #223041; border-color: var(--line); }
.panel-footer { padding-block-start: 14px; }
.panel-footer:has([hidden]) { display: none; }
.text-button { padding: 2px 0; background: none; border: 0; color: var(--cyan); text-underline-offset: 4px; text-decoration: underline; font-weight: 650; }
.host-services { margin: 13px 0 0; padding: 0; list-style: none; }
.host-services li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; border-block-start: 1px solid var(--line); padding: 15px 0; }
.host-services li:last-child { border-block-end: 1px solid var(--line); }
.service-name { font-weight: 650; overflow-wrap: anywhere; }
.service-state { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; }
.service-state::before { content: ""; width: 8px; height: 8px; background: currentColor; border-radius: 50%; }
.empty { padding: 15px; color: var(--muted); text-align: center; }
.notice { padding: 10px 13px; border: 1px solid #66502f; background: #332919; border-radius: 8px; color: var(--amber); }
.feed-notice { margin-block-end: 16px; }

.glyph { color: #b3ebef; display: inline-block; position: relative; flex: none; width: 30px; height: 22px; border: 2px solid currentColor; border-radius: 4px; }
.glyph::before, .glyph::after { content: ""; position: absolute; }
.glyph-server { width: 44px; height: 36px; border-radius: 6px; }
.glyph-server::before { left: -2px; right: -2px; top: 50%; border-top: 2px solid currentColor; }
.glyph-server::after { inset-inline-end: 6px; width: 4px; height: 4px; background: currentColor; border-radius: 50%; top: 6px; box-shadow: 0 16px currentColor; }
.glyph-chip::before { inset: 5px; border: 1px solid currentColor; border-radius: 2px; }
.glyph-chip::after, .glyph-memory::after { height: 4px; inset-inline: 3px; bottom: -6px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px); }
.glyph-memory { height: 18px; }
.glyph-memory::before { inset: 3px; background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px); }
.glyph-disk::before { left: 2px; right: 2px; bottom: 5px; border-top: 1px solid currentColor; }
.glyph-disk::after { width: 3px; height: 3px; border-radius: 50%; background: currentColor; bottom: 1px; left: 4px; }

.auth-layout { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.auth-panel { width: min(100%, 420px); padding: clamp(20px, 5vw, 32px); }
.auth-brand { display: flex; gap: 11px; align-items: center; color: var(--cyan); font-weight: 700; margin-block-end: 22px; }
.auth-panel h1 { font-size: 1.65rem; margin-block-end: 8px; }
.auth-panel .notice { margin-block-start: 14px; }
.auth-form { margin-block-start: 22px; display: grid; gap: 8px; }
.auth-form label { font-weight: 650; margin-block-start: 4px; }
.auth-form input:not([type="hidden"]) { min-width: 0; padding: 9px 11px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; }
.primary { border: 0; padding: 9px 14px; border-radius: 8px; color: #081921; background: var(--cyan); font-weight: 750; margin-block-start: 10px; }
.auth-back { margin-block-start: 14px; }

@media (max-width: 820px) {
  .overview { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .masthead { align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-block-end: 16px; }
  .header-tools { width: 100%; justify-content: space-between; gap: 8px; }
  .metrics { grid-template-columns: 1fr; gap: 9px; }
  .metric { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
  .metric-value { margin: 0; font-size: 2.3rem; text-align: left; }
  .metric-detail { grid-column: 1 / -1; font-size: .91rem; }
  .metric progress { grid-column: 1 / -1; margin-block-start: 5px; height: 8px; }
  th, td { padding: 8px 4px; }
  .tag { font-size: .72rem; padding-inline: 5px; }
}
