:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --soft: #eef2f7;
  --line: rgba(17, 24, 39, 0.08);
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.06);
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fff7ed;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(37, 99, 235, 0.10), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(16, 185, 129, 0.10), transparent 26%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 46%, #f2f4f8 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), transparent 55%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
.shell { width: min(1440px, calc(100vw - 36px)); margin: 0 auto; padding: 22px 0 34px; position: relative; z-index: 1; }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px 12px 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.25);
  position: sticky;
  top: 14px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.logo {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-weight: 860;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.18);
}
.brand strong { display: block; font-size: 15px; letter-spacing: -0.02em; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.nav-links { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 999px;
  color: #475569;
  font-size: 13px;
  font-weight: 760;
}
.nav-link.active, .nav-link:hover { background: #111827; color: #fff; }
.nav-meta { color: var(--muted); font-size: 12px; white-space: nowrap; padding-right: 8px; }

.hero {
  margin-top: 22px;
  padding: clamp(26px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.70)),
    radial-gradient(circle at 85% 22%, rgba(37, 99, 235, 0.12), transparent 28%);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(16, 185, 129, 0.10));
  filter: blur(2px);
}
.hero > * { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 13px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { max-width: 850px; font-size: clamp(34px, 5vw, 70px); line-height: 0.98; letter-spacing: -0.07em; font-weight: 880; }
.hero p.lead { max-width: 760px; margin-top: 18px; color: #475569; font-size: clamp(15px, 1.6vw, 19px); line-height: 1.72; }
.hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}
.btn.primary { background: #111827; color: #fff; border-color: #111827; }
.btn.danger { color: var(--bad); background: var(--bad-soft); border-color: rgba(220, 38, 38, 0.18); }
.btn:hover { transform: translateY(-1px); }

.grid { display: grid; gap: 14px; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr); margin-top: 16px; align-items: start; }
.turtle-grid { grid-template-columns: minmax(0, 1.35fr) minmax(380px, 0.65fr); margin-top: 16px; align-items: stretch; }
.pi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; }
.two-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.2);
  padding: 20px;
  overflow: hidden;
}
.card.solid { background: var(--surface-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2 { font-size: 17px; letter-spacing: -0.025em; }
.card h3 { font-size: 15px; letter-spacing: -0.02em; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.55; }
.badge, .pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 820;
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  white-space: nowrap;
}
.badge.ok, .pill.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(5, 150, 105, 0.18); }
.badge.warn, .pill.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(217, 119, 6, 0.18); }
.badge.bad, .pill.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(220, 38, 38, 0.18); }
.badge.neutral, .pill.neutral { color: #475569; background: #f8fafc; }

.metric { display: grid; gap: 8px; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 760; text-transform: uppercase; letter-spacing: 0.08em; }
.metric strong { font-size: clamp(26px, 4vw, 42px); letter-spacing: -0.06em; line-height: 0.95; }
.metric small { color: var(--muted); font-size: 12px; }
.metric-card { min-height: 160px; display: grid; align-content: space-between; }
.value-row { display: flex; align-items: baseline; gap: 7px; }
.value-row strong { font-size: clamp(30px, 4vw, 52px); letter-spacing: -0.07em; }
.value-row span { color: var(--muted); font-size: 14px; font-weight: 760; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); font-weight: 820; background: #f9fafb; }
tr:last-child td { border-bottom: none; }
.state-chip { display: inline-flex; min-height: 28px; align-items: center; border-radius: 999px; padding: 0 10px; font-size: 12px; font-weight: 800; background: #f1f5f9; color: #475569; }
.state-chip.ok { background: var(--ok-soft); color: var(--ok); }
.state-chip.warn { background: var(--warn-soft); color: var(--warn); }
.state-chip.bad { background: var(--bad-soft); color: var(--bad); }
.state-chip.blue { background: var(--accent-soft); color: var(--accent); }

.video-panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: #0f172a;
  position: relative;
}
.video-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 760;
}
.video-stack { display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 12px; }
.kv span { color: var(--muted); font-size: 13px; }
.kv strong { overflow-wrap: anywhere; font-size: 13px; }
.object-list { display: grid; gap: 10px; max-height: 380px; overflow: auto; }
.object-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.object-row strong { display: block; font-size: 14px; }
.object-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed rgba(17,24,39,0.14); border-radius: 16px; background: rgba(255,255,255,0.58); }

.gauge {
  --value: 0;
  width: 142px;
  height: 142px;
  margin: 8px auto 12px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(#111827 calc(var(--value) * 1%), #eef2f7 0);
}
.gauge-inner { width: 104px; height: 104px; border-radius: 999px; background: #fff; display: grid; place-items: center; align-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.gauge-inner strong { font-size: 26px; letter-spacing: -0.05em; }
.gauge-inner span { color: var(--muted); font-size: 12px; font-weight: 760; }
.chart { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: 18px; background: #fff; display: block; }
.list { display: grid; gap: 10px; }
.list-row { padding: 13px 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-row span { color: var(--muted); font-size: 13px; }
.list-row strong { font-size: 14px; }

.footer-note { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }
.raw { max-height: 260px; overflow: auto; padding: 14px; border-radius: 16px; background: #0f172a; color: #dbeafe; font-size: 12px; line-height: 1.55; }

@media (max-width: 1120px) {
  .cards-3, .cards-4, .dashboard-grid, .turtle-grid, .pi-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .turtle-grid { align-items: stretch; }
}
@media (max-width: 760px) {
  .shell { width: min(100vw - 20px, 1440px); padding-top: 10px; }
  .nav { border-radius: 24px; align-items: flex-start; flex-direction: column; padding: 14px; position: static; }
  .brand { min-width: 0; }
  .nav-links { justify-content: flex-start; }
  .nav-meta { padding: 0 0 0 4px; }
  .cards-3, .cards-4, .dashboard-grid, .turtle-grid, .pi-grid, .two-grid { grid-template-columns: 1fr; }
  .hero { margin-top: 12px; border-radius: 24px; }
  .kv { grid-template-columns: 1fr; }
}

/* TurtleBot 4-camera layout */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-content: start;
}

.camera-grid .video-panel {
  min-width: 0;
}

.camera-grid .video-frame {
  aspect-ratio: 16 / 9;
}

@media (max-width: 760px) {
  .camera-grid {
    grid-template-columns: 1fr;
  }
}

.grid {
  display: grid;
  gap: 22px;
}

.cards-4 + .main-grid,
.cards-3 + .two-grid,
.pi-grid + .main-grid,
.turtle-grid + .card {
  margin-top: 24px;
}

.page-head {
  margin-top: 30px;
}

.actions {
  margin-bottom: 50px;
}

.page-head + .grid {
  margin-top: 50px;
}