/* Palette and surfaces from NewRemnawaveShop's customer app. */
:root {
  color-scheme: dark;
  --bg: #03070b;
  --panel: #111820;
  --panel-2: #0b1118;
  --panel-3: #17212b;
  --line: rgba(255, 255, 255, .12);
  --ink: #f2f7f4;
  --muted: #a9b4b0;
  --accent: #00fe7a;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --gray: #59666e;
  --warning: #ffd166;
  --hover: rgba(255, 255, 255, .04);
  --sheen: linear-gradient(135deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --shadow: 0 18px 48px rgba(0, 0, 0, .22);
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { max-width: 1056px; margin: auto; padding: 0 40px; }
header { min-height: 70px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.header-inner { width: 100%; display: flex; align-items: center; gap: 10px; }
header img { display: block; flex-shrink: 0; }
header h1 { margin: 0; color: var(--accent); font: 850 15px var(--mono); }
main { padding: 18px 0 40px; }

.section-heading, .history-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.legend, .legend span, .history-caption { display: flex; align-items: center; gap: 7px; }
.legend { gap: 14px; color: var(--muted); font-size: 12px; }
.history-meta { margin: 10px 0; color: var(--muted); font-size: 11px; }
#updated, .strip-labels, .detail-time { font-variant-numeric: tabular-nums; }
.tag {
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 12%, var(--panel));
  color: var(--warning);
  white-space: nowrap;
}
.switch {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.switch button {
  min-height: 44px;
  padding: 6px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.switch button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
}

.region, .empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sheen), var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.region { margin-bottom: 10px; }
.region summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 11px 16px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  transition: background-color .16s ease;
}
.region summary::-webkit-details-marker { display: none; }
.region summary:focus-visible { outline-offset: -3px; }
.chevron {
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform .16s ease;
}
.region[open] .chevron { transform: rotate(45deg) translateY(-2px); }
.region-name { font-weight: 650; }
.region-count { padding: 1px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: 11px; }
.region-status, .node-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.region-status { margin-left: auto; }

.nodes { padding: 0 16px; }
.node { padding: 12px 0; border-top: 1px solid var(--line); }
.node-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 5px; font-size: 13px; }
.node-name { font-weight: 550; overflow-wrap: anywhere; }
.dot { display: inline-block; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; }
.up.dot, .cell.up { background: var(--green); }
.down.dot, .cell.down { background: var(--red); }
.unknown.dot, .cell.unknown { background-color: var(--gray); }
.strip-scroll { overflow-x: auto; padding: 4px 4px 7px; scrollbar-width: thin; }
.strip { display: grid; gap: 2px; min-width: 650px; }
.strip.daily { min-width: 0; gap: 4px; }
.cell { width: 100%; min-width: 0; height: 23px; padding: 0; border: 0; border-radius: 2px; position: relative; transition: filter .16s ease; }
.cell:focus-visible { z-index: 1; }
.cell.down::after { content: ""; position: absolute; height: 1px; background: var(--bg); inset: 50% 10% auto; transform: rotate(-45deg); }
.cell.unknown { background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(0, 0, 0, .18) 3px 4px); }
.strip-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

#groups[aria-busy="true"] { opacity: .72; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.error { color: var(--red); }
.empty .retry { margin-top: 12px; }
dialog {
  width: min(690px, calc(100% - 28px));
  max-height: 85vh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .46);
}
dialog::backdrop { background: rgba(0, 0, 0, .56); backdrop-filter: blur(10px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.close, .retry { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.close { width: 44px; flex-shrink: 0; font-size: 23px; }
.retry { padding: 8px 14px; color: var(--accent); }
.detail-time { margin: 16px 0 8px; font-size: 12px; }
.detail-note { color: var(--muted); font-size: 12px; }
.detail-note.error { color: var(--red); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
th, td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: var(--panel-2); color: var(--muted); font-weight: 550; }

@media (hover: hover) {
  .region summary:hover, .close:hover, .retry:hover { background-color: var(--hover); }
  .switch button:not([aria-pressed="true"]):hover { color: var(--ink); background-color: var(--hover); }
  .cell:hover { filter: brightness(1.3); }
}
@media (max-width: 640px) {
  .shell { padding: 0 18px; }
  header { min-height: 64px; }
  .legend { gap: 8px; }
  .legend span { gap: 4px; }
  .switch button { padding-inline: 9px; }
  .history-meta { font-size: 10px; }
  .region summary, .nodes { padding-inline: 12px; }
  .strip.daily { gap: 3px; }
  dialog { padding: 16px; border-radius: 16px; }
  th, td { padding-inline: 5px; }
  th:nth-child(3), td:nth-child(3) { white-space: normal; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
