/* OneHealth Brand Guidelines v2: palette only, Marcellus + Montserrat, thin lines, no shadows */
:root {
  --papyrus: #fff6e3;
  --golden-haze: #f0cd8c;
  --fall-leaf: #cda96c;
  --honey: #b28c4f;
  --sesame: #b6a186;
  --sepia: #72583f;
  --soil: #503728;
  --glass: rgba(255, 246, 227, 0.78);
  --line: rgba(114, 88, 63, 0.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--papyrus);
  color: var(--soil);
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  display: flex; flex-direction: column;
  min-height: 100vh;
}
h1, h2, h3 { font-family: Marcellus, serif; font-weight: 400; line-height: 0.9; margin: 0; }

/* header */
.bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.logo { height: 44px; width: auto; }
.title { flex: 1; min-width: 0; }
.title h1 { font-size: 28px; }
.sub { margin: 6px 0 0; color: var(--sepia); font-size: 13px; }
.views { display: flex; border: 1px solid var(--sepia); border-radius: 999px; overflow: hidden; }
.views button {
  font: 600 13px Montserrat, sans-serif; color: var(--sepia);
  background: transparent; border: 0; padding: 8px 16px; cursor: pointer;
}
.views button[aria-selected="true"] { background: var(--soil); color: var(--papyrus); }

.demo {
  margin: 10px 20px 0; padding: 8px 14px; border: 1px solid var(--honey); border-radius: 10px;
  color: var(--soil); font-size: 13px; background: rgba(240, 205, 140, 0.35);
}

/* summary chips */
.summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 6px;
  font-size: 13px; color: var(--soil); background: transparent; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--soil); background: rgba(240, 205, 140, 0.35); }
.chip b { font-weight: 600; }

/* status dots: shape + colour, never colour alone */
.dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font: 600 12px Montserrat, sans-serif; line-height: 1;
}
.s-working .dot, .dot.s-working { background: var(--honey); color: var(--papyrus); }
.s-idle .dot, .dot.s-idle { background: var(--golden-haze); color: var(--soil); }
.s-failed .dot, .dot.s-failed { background: var(--soil); color: var(--golden-haze); }
.s-off .dot, .dot.s-off { background: var(--papyrus); color: var(--sepia); border: 1px solid var(--sesame); }
.s-unmonitored .dot, .dot.s-unmonitored { background: transparent; color: var(--sepia); border: 1px dashed var(--sepia); }
.s-stale .dot, .dot.s-stale { background: var(--sesame); color: var(--soil); }

main { flex: 1; position: relative; min-height: 0; display: flex; }

/* 3D */
.view3d { position: relative; flex: 1; min-height: 520px; }
#scene { display: block; width: 100%; height: 100%; position: absolute; inset: 0; outline: none; }
.hint {
  position: absolute; left: 20px; bottom: 12px; margin: 0;
  font-size: 12px; color: var(--soil); background: var(--glass);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
}
.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -130%);
  background: var(--soil); color: var(--papyrus); padding: 5px 10px; border-radius: 8px;
  font-size: 12px; white-space: nowrap;
}

/* sound toggle */
.sound {
  position: absolute; right: 20px; bottom: 12px;
  font: 600 12px Montserrat, sans-serif; color: var(--soil); cursor: pointer;
  background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
}
.sound[aria-pressed="true"] { background: var(--soil); color: var(--papyrus); border-color: var(--soil); }
@media (max-width: 640px) { .sound { bottom: auto; top: 12px; right: 16px; } }

/* 2D map */
.view2d { flex: 1; padding: 0 20px 24px; overflow: auto; }
.sea {
  height: 56px; border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: var(--sepia); margin: 8px 0 0; position: relative;
}
.sea::after {
  content: ""; position: absolute; left: 50%; top: 18px; width: 34%; height: 2px; transform: translateX(-50%);
  background: var(--golden-haze); border-radius: 2px; opacity: .8;
}
.walk { height: 6px; margin: 14px 4px 16px; border-top: 1px solid var(--fall-leaf); border-bottom: 1px solid var(--fall-leaf); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.area {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 16px;
  background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.area.shared { background: rgba(240, 205, 140, 0.22); border-style: dashed; }
.area h2 { font-size: 22px; }
.area .meta { margin: 8px 0 12px; font-size: 12px; color: var(--sepia); }
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; border-top: 1px solid var(--line);
  padding: 8px 2px 2px; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.seat:first-child { border-top: 0; padding-top: 0; }
.seat .nm { flex: 1; min-width: 0; font-size: 14px; }
.seat .st { font-size: 12px; color: var(--sepia); white-space: nowrap; }
.seat:hover .nm, .seat:focus-visible .nm { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.new { font: 600 10px Montserrat, sans-serif; background: var(--soil); color: var(--golden-haze); border-radius: 4px; padding: 2px 5px; margin-left: 6px; }
.empty { font-size: 13px; color: var(--sepia); margin: 0; }

/* detail panel */
.panel {
  position: fixed; right: 16px; top: 84px; width: min(360px, calc(100vw - 32px));
  background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px; padding: 20px 20px 18px; z-index: 5;
}
.panel h2 { font-size: 26px; padding-right: 28px; }
.panel .state { display: flex; align-items: center; gap: 8px; margin: 12px 0 14px; font-weight: 600; font-size: 14px; }
.panel dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.panel dt { color: var(--sepia); }
.panel dd { margin: 0; }
.close {
  position: absolute; right: 12px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--soil); font-size: 20px; cursor: pointer;
}

.foot { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12px; }
.foot .mark { height: 20px; }
.foot span:nth-child(2) { font-family: Marcellus, serif; font-size: 15px; }
.muted { color: var(--sepia); margin-left: auto; }

@media (max-width: 640px) {
  .bar { padding: 10px 16px; gap: 10px; }
  .logo { height: 34px; }
  .title h1 { font-size: 22px; }
  .sub { display: none; }
  .summary, .view2d { padding-left: 16px; padding-right: 16px; }
  .demo { margin: 10px 16px 0; }
  .grid { grid-template-columns: 1fr; }
  .panel { top: auto; bottom: 12px; right: 16px; }
  .view3d { min-height: 420px; }
}
