:root {
  --bg: #f4efe7;
  --panel: #fffdf8;
  --ink: #1d1814;
  --muted: #6a6058;
  --line: #dbcdbf;
  --accent: #cc5f2f;
  --accent-soft: #f6e2d4;
}

body[data-theme='slate'] {
  --bg: #e9edf3;
  --panel: #f8fbff;
  --ink: #1d2a39;
  --muted: #526274;
  --line: #c9d4e1;
  --accent: #3567a7;
  --accent-soft: #dce7f8;
}

body[data-theme='emerald'] {
  --bg: #edf5ef;
  --panel: #fbfffc;
  --ink: #1b2e25;
  --muted: #4f665b;
  --line: #cadbcf;
  --accent: #237a57;
  --accent-soft: #d8f0e5;
}

body[data-theme='midnight'] {
  --bg: #0f141b;
  --panel: #121b25;
  --ink: #e7eef7;
  --muted: #9cb0c7;
  --line: #27384a;
  --accent: #4ea2ff;
  --accent-soft: #1f3148;
}

body[data-theme='noir'] {
  --bg: #141214;
  --panel: #1a171a;
  --ink: #f2edf3;
  --muted: #b6aeb8;
  --line: #332f34;
  --accent: #ff8a5b;
  --accent-soft: #3b2922;
}

body[data-theme='midnight'] .panel,
body[data-theme='midnight'] .metric-card,
body[data-theme='midnight'] .service-link,
body[data-theme='midnight'] .quick-links a,
body[data-theme='midnight'] #themeSelect,
body[data-theme='midnight'] .svc-metrics span {
  background: #162230;
  color: var(--ink);
  border-color: #2b3f54;
}

body[data-theme='midnight'] .service-link .desc,
body[data-theme='midnight'] .meta,
body[data-theme='midnight'] .label,
body[data-theme='midnight'] .status-line,
body[data-theme='midnight'] .theme-row label,
body[data-theme='midnight'] .eyebrow,
body[data-theme='midnight'] #pageSubtitle {
  color: #b7c8db;
}

body[data-theme='noir'] .panel,
body[data-theme='noir'] .metric-card,
body[data-theme='noir'] .service-link,
body[data-theme='noir'] .quick-links a,
body[data-theme='noir'] #themeSelect,
body[data-theme='noir'] .svc-metrics span {
  background: #221f23;
  color: var(--ink);
  border-color: #3b353c;
}

body[data-theme='noir'] .service-link .desc,
body[data-theme='noir'] .meta,
body[data-theme='noir'] .label,
body[data-theme='noir'] .status-line,
body[data-theme='noir'] .theme-row label,
body[data-theme='noir'] .eyebrow,
body[data-theme='noir'] #pageSubtitle {
  color: #cbc2cd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 10%, #ffe7c8 0%, transparent 35%), var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
}

.bg-shape {
  position: fixed;
  right: -120px;
  top: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7b267, #f4845f);
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}

.bg-shape.two {
  left: -160px;
  bottom: -160px;
  right: auto;
  top: auto;
  background: linear-gradient(135deg, #ffd6a7, #f6bd60);
  opacity: 0.25;
}

.layout {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(620px, 2fr);
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #fffefb, var(--panel));
  box-shadow: 0 10px 24px rgba(37, 22, 12, 0.06);
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.section-head p {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.monitoring {
  position: sticky;
  top: 12px;
  align-self: start;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fff, #fff8f2);
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.value {
  margin: 6px 0 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.6rem;
  font-weight: 600;
}

.value.small {
  font-size: 0.95rem;
}

.meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.status-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-calendar {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  background: linear-gradient(180deg, #fff, #fff9f3);
}

.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cal-title {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal-weekdays div {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
}

.cal-day {
  text-align: center;
  font-size: 0.73rem;
  border: 1px solid #e7ddcf;
  border-radius: 8px;
  padding: 4px 0;
  background: #fff;
}

.cal-day.muted {
  opacity: 0.35;
}

.cal-day.today {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.right-col {
  display: grid;
  gap: 10px;
  align-content: start;
}

.masthead {
  position: sticky;
  top: 12px;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.api-health {
  margin-top: 7px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.api-health.ok {
  color: #1f7a46;
}

.api-health.warn {
  color: #996700;
}

.api-health.down {
  color: #9e3434;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#pageTitle {
  margin: 3px 0 2px;
  font-size: 1.7rem;
}

#pageSubtitle {
  margin: 0;
  color: var(--muted);
}

.quick-links {
  margin-top: 9px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-row label {
  font-size: 0.78rem;
  color: var(--muted);
}

#themeSelect {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.8rem;
}

.quick-links a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.83rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 10px;
}

.section-panel {
  padding: 10px;
}

.links {
  display: grid;
  gap: 7px;
}

.links.compact {
  gap: 6px;
}

.service-link {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: linear-gradient(180deg, #fff, #fff9f5);
  transition: transform 120ms ease, border-color 120ms ease;
  display: block;
}

.service-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.service-link .title {
  font-weight: 600;
  font-size: 0.93rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.service-link .desc {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.svc-metrics {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.svc-metrics span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  background: rgba(255, 255, 255, 0.55);
}

.svc-extra {
  margin-top: 5px;
  font-size: 0.76rem;
  color: var(--ink);
  border: 1px dashed color-mix(in srgb, var(--line) 80%, var(--accent) 20%);
  border-radius: 8px;
  padding: 4px 7px;
  background: var(--accent-soft);
  font-weight: 600;
}

.svc-extra.ok {
  border-style: solid;
  border-color: #7fc59c;
  background: #ebfff2;
  color: #1f7a46;
}

.svc-extra.warn {
  border-style: solid;
  border-color: #e2c789;
  background: #fff8e8;
  color: #996700;
}

.svc-extra.down {
  border-style: solid;
  border-color: #e4a4a4;
  background: #fff0f0;
  color: #9e3434;
}

body[data-theme='midnight'] .inline-calendar,
body[data-theme='noir'] .inline-calendar {
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme='midnight'] .cal-day,
body[data-theme='noir'] .cal-day {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}

body[data-theme='midnight'] .cal-weekdays div,
body[data-theme='noir'] .cal-weekdays div,
body[data-theme='midnight'] .cal-head,
body[data-theme='noir'] .cal-head {
  color: var(--ink);
}

body[data-theme='midnight'] .cal-day.today,
body[data-theme='noir'] .cal-day.today {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
  color: var(--ink) !important;
}

body[data-theme='midnight'] .svc-extra.ok,
body[data-theme='noir'] .svc-extra.ok {
  background: rgba(56, 140, 89, 0.24);
  border-color: rgba(103, 190, 141, 0.7);
  color: #c9f1da;
}

body[data-theme='midnight'] .svc-extra.warn,
body[data-theme='noir'] .svc-extra.warn {
  background: rgba(161, 121, 44, 0.24);
  border-color: rgba(207, 170, 94, 0.7);
  color: #ffe7ba;
}

body[data-theme='midnight'] .svc-extra.down,
body[data-theme='noir'] .svc-extra.down {
  background: rgba(137, 57, 57, 0.28);
  border-color: rgba(195, 101, 101, 0.7);
  color: #ffd3d3;
}

.svc-badge {
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}

.svc-badge.running {
  border-color: #7fc59c;
  background: #ebfff2;
  color: #1f7a46;
}

.svc-badge.stopped,
.svc-badge.error,
.svc-badge.exited {
  border-color: #e4a4a4;
  background: #fff0f0;
  color: #9e3434;
}

@media (max-width: 950px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .monitoring {
    position: static;
  }
  .masthead {
    position: static;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
}
