:root {
  --navy-900: #0c4f74;
  --navy-800: #0f6189;
  --navy-700: #1678a7;
  --sky-200: #d8f1fb;
  --sky-100: #eef8fd;
  --safe: #18b26b;
  --safe-soft: #eaf8f1;
  --warn: #f7b731;
  --warn-soft: #fff6df;
  --danger: #ef4444;
  --danger-soft: #ffe8e8;
  --ink-900: #1c2a39;
  --ink-700: #556375;
  --ink-500: #94a3b8;
  --line: #dfe7ef;
  --line-strong: #cfd9e4;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-muted: #f2f6fb;
  --shadow: 0 16px 32px rgba(10, 38, 59, 0.08);
  --shadow-soft: 0 8px 18px rgba(10, 38, 59, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-w: 256px;
  --content-w: 985px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Noto Sans KR", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at top right, rgba(174, 230, 255, 0.35), transparent 28%),
    linear-gradient(180deg, #f5f8fc 0%, #edf2f8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 24px 16px 20px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(223, 231, 239, 0.8);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 18px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-copy strong {
  display: block;
  color: var(--navy-900);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-copy span {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 11px;
}

.sidebar__nav {
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  color: var(--ink-700);
  text-align: left;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
  background: rgba(12, 79, 116, 0.07);
  color: var(--navy-900);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(12, 79, 116, 0.12), rgba(12, 79, 116, 0.03));
  color: var(--navy-900);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 4px;
  height: 28px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: var(--navy-800);
}

.nav-item__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.nav-item__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-item__copy strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.nav-item__copy small {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 11px;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.status-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ink-500);
}

.status-card__dot.is-online {
  background: var(--safe);
  box-shadow: 0 0 0 5px rgba(24, 178, 107, 0.16);
}

.status-card__dot.is-offline {
  background: var(--ink-500);
  box-shadow: 0 0 0 5px rgba(148, 163, 184, 0.16);
}

.status-card strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.status-card span {
  display: block;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 11px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 24, 38, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 25;
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(223, 231, 239, 0.88);
}

.mobile-header__menu,
.mobile-header__title {
  color: var(--navy-900);
}

.mobile-header__menu svg {
  width: 22px;
  height: 22px;
  display: block;
}

.mobile-header__title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 24px 24px 36px;
}

.topbar,
.page-frame {
  width: min(100%, var(--content-w));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.alert-strip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(12, 79, 116, 0.08);
  color: var(--ink-700);
  box-shadow: var(--shadow-soft);
}

.alert-strip__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(223, 231, 239, 0.9);
  box-shadow: var(--shadow-soft);
}

.profile-chip__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.profile-chip__copy strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.profile-chip__copy span {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 11px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.page-frame {
  display: grid;
  gap: 16px;
}

.page-notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 4px;
  width: fit-content;
  min-height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(12, 79, 116, 0.08);
  color: var(--ink-700);
}

.page-notice__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 34px 38px;
  min-height: 105px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.3), transparent 22%),
    linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 55%, #1b8dc3 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -30px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hero-card__eyebrow {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-card h1 {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
}

.hero-card__text {
  margin-top: 10px;
  max-width: 440px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

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

.metric-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(223, 231, 239, 0.9);
  box-shadow: var(--shadow-soft);
}

.metric-card__label {
  display: block;
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card__value {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.metric-card--safe {
  background: linear-gradient(180deg, #fff 0%, var(--safe-soft) 100%);
}

.metric-card--warn {
  background: linear-gradient(180deg, #fff 0%, var(--warn-soft) 100%);
}

.metric-card--danger {
  background: linear-gradient(180deg, #fff 0%, var(--danger-soft) 100%);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 16px;
}

.panel-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(223, 231, 239, 0.92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(223, 231, 239, 0.78);
}

.panel-card__head--stack {
  align-items: stretch;
  flex-direction: column;
}

.panel-card__head h2 {
  font-size: 15px;
  font-weight: 800;
}

.panel-card__head span {
  color: var(--ink-500);
  font-size: 12px;
}

.guest-list {
  max-height: 328px;
  overflow: auto;
  padding: 10px 12px 14px;
}

.guest-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(223, 231, 239, 0.66);
  border-radius: 12px;
  transition: background-color 0.18s ease;
}

.guest-row:last-child {
  border-bottom: 0;
}

.guest-row:hover {
  background: var(--surface-soft);
}

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
}

.avatar-badge.is-alt {
  background: linear-gradient(135deg, #3f62cb, #6f8dff);
}

.avatar-badge.is-alt-2 {
  background: linear-gradient(135deg, #f25f9b, #ff8db4);
}

.avatar-badge.is-alt-3 {
  background: linear-gradient(135deg, #f59e0b, #f6c45f);
}

.avatar-badge.is-alt-4 {
  background: linear-gradient(135deg, #0ea271, #49cc9c);
}

.guest-row__copy strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.guest-row__copy span {
  display: block;
  margin-top: 5px;
  color: var(--ink-500);
  font-size: 11px;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.priority-pill.is-safe {
  background: var(--safe);
}

.priority-pill.is-warn {
  background: var(--warn);
}

.priority-pill.is-danger {
  background: var(--danger);
}

.priority-pill.is-offline {
  background: var(--ink-500);
}

.battery-meter {
  width: 30px;
  height: 16px;
  position: relative;
  border-radius: 4px;
  border: 1.5px solid var(--safe);
  padding: 2px;
}

.battery-meter::after {
  content: "";
  position: absolute;
  top: 4px;
  right: -4px;
  width: 3px;
  height: 6px;
  border-radius: 0 999px 999px 0;
  background: currentColor;
}

.battery-meter__fill {
  height: 100%;
  border-radius: 2px;
  background: var(--safe);
}

.battery-meter.is-warn {
  color: var(--warn);
  border-color: var(--warn);
}

.battery-meter.is-warn .battery-meter__fill {
  background: var(--warn);
}

.battery-meter.is-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.battery-meter.is-danger .battery-meter__fill {
  background: var(--danger);
}

.panel-card--map .panel-card__head,
.panel-card--mainmap .panel-card__head {
  align-items: center;
}

.panel-map {
  width: 100%;
  min-height: 326px;
}

.panel-map--large {
  min-height: 640px;
}

.ghost-button,
.tab-button,
.region-select {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.ghost-button:hover,
.tab-button:hover,
.region-select:hover {
  border-color: var(--navy-800);
  color: var(--navy-900);
}

.alert-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 276px;
  gap: 12px;
  overflow-x: auto;
  padding: 14px 16px 18px;
}

.alert-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(223, 231, 239, 0.9);
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.alert-card--danger {
  border-color: rgba(239, 68, 68, 0.28);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.06);
}

.alert-card__name {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
}

.alert-card__score {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
}

.alert-card__body {
  margin-top: 10px;
  min-height: 42px;
  color: var(--ink-700);
  line-height: 1.5;
}

.alert-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  color: var(--ink-500);
  font-size: 11px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title h1 {
  font-size: 22px;
  font-weight: 800;
}

.page-title p {
  margin-top: 6px;
  color: var(--ink-500);
  font-size: 13px;
}

.page-actions {
  display: flex;
  gap: 8px;
}

.live-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 361px;
  gap: 16px;
}

.live-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.empty-box {
  padding: 34px 20px;
  color: var(--ink-500);
  text-align: center;
  line-height: 1.6;
}

.selected-guest {
  padding: 18px;
  display: grid;
  gap: 18px;
}

.selected-guest__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-guest__copy strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.selected-guest__copy span {
  display: block;
  margin-top: 5px;
  color: var(--ink-500);
  font-size: 11px;
}

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

.vital-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-soft);
}

.vital-card__label {
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.vital-card__value {
  margin-top: 12px;
  font-size: 28px;
  font-weight: 800;
}

.vital-card__hint {
  margin-top: 8px;
  color: var(--ink-500);
  font-size: 11px;
}

.battery-box {
  padding: 18px;
}

.battery-box__empty {
  color: var(--ink-500);
  line-height: 1.6;
}

.battery-bar {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-soft);
}

.battery-bar__meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
}

.battery-bar__track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8f0;
}

.battery-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy-900), #17a2d8);
}

.guest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
}

.guest-chip {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink-900);
  transition: background-color 0.18s ease;
}

.guest-chip:hover {
  background: var(--sky-100);
}

.guest-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.guest-chip__dot.is-safe {
  background: var(--safe);
}

.guest-chip__dot.is-warn {
  background: var(--warn);
}

.guest-chip__dot.is-danger {
  background: var(--danger);
}

.guest-chip__dot.is-offline {
  background: var(--ink-500);
}

.guest-chip strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.guest-chip span {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 10px;
}

.guest-chip__score {
  font-size: 11px;
  font-weight: 700;
}

.incident-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
}

.incident-panel,
.incident-detail {
  min-height: 704px;
}

.tab-row {
  display: flex;
  gap: 8px;
}

.tab-button.is-active {
  border-color: var(--navy-800);
  color: #fff;
  background: var(--navy-800);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.search-field svg {
  width: 16px;
  height: 16px;
  color: var(--ink-500);
}

.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
}

.incident-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.incident-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.incident-item:hover {
  border-color: var(--line-strong);
}

.incident-item.is-selected {
  border-color: var(--navy-800);
  background: rgba(216, 241, 251, 0.6);
}

.incident-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.incident-item__id {
  font-size: 12px;
  font-weight: 800;
}

.incident-item__desc {
  margin-top: 10px;
  color: var(--ink-700);
  line-height: 1.5;
}

.incident-item__meta {
  margin-top: 12px;
  color: var(--ink-500);
  font-size: 11px;
}

.incident-detail__body {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.detail-block {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-block h3 {
  font-size: 13px;
  font-weight: 800;
}

.detail-block p,
.detail-block li {
  color: var(--ink-700);
  line-height: 1.6;
}

.detail-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 16px;
}

.device-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-soft);
}

.device-card__copy strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.device-card__copy span {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 11px;
}

.placeholder-card {
  display: grid;
  place-items: center;
  min-height: 240px;
  text-align: center;
  gap: 8px;
}

.placeholder-card p {
  max-width: 420px;
  color: var(--ink-500);
  line-height: 1.6;
}

.map-marker {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(10, 38, 59, 0.28);
}

.map-marker.is-safe {
  background: var(--safe);
}

.map-marker.is-warn {
  background: var(--warn);
}

.map-marker.is-danger {
  background: var(--danger);
}

.map-marker.is-offline {
  background: var(--ink-500);
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: "Inter", "Noto Sans KR", sans-serif;
  line-height: 1.6;
}

.empty-state-card {
  padding: 28px 18px;
  text-align: center;
  color: var(--ink-500);
  line-height: 1.6;
}

@media (max-width: 1200px) {
  .stats-grid,
  .dashboard-grid,
  .live-layout,
  .incident-layout {
    grid-template-columns: 1fr;
  }

  .guest-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
  }

  .main {
    margin-left: 0;
    padding: 12px 14px 28px;
  }

  .topbar {
    margin-top: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .alert-strip,
  .page-notice {
    width: 100%;
  }

  .hero-card {
    padding: 26px 24px;
  }

  .hero-card h1 {
    font-size: 21px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guest-grid {
    grid-template-columns: 1fr;
  }

  .device-grid {
    grid-template-columns: 1fr;
  }
}

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

  .alert-rail {
    grid-auto-columns: 240px;
  }
}
