/* VITAs 보호자 웹 — light, product-grade UI */
:root {
  --font: "Inter", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --canvas: #f1f5f9;
  --canvas-2: #e2e8f0;
  --accent: #0369a1;
  --accent-hover: #0284c7;
  --accent-soft: #e0f2fe;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #a16207;
  --warn-bg: #fffbeb;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --sleep: #475569;
  --sleep-bg: #f1f5f9;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 10px 20px -5px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(14, 165, 233, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(99, 102, 241, 0.06), transparent 45%);
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #0ea5e9 0%, #0369a1 100%);
  box-shadow: 0 2px 8px rgba(3, 105, 161, 0.35);
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.brand__name {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand__tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session__id {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 12px;
  background: var(--canvas);
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* Layout */
.layout {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* Auth */
.auth__grid {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 440px);
  gap: 40px;
  align-items: start;
}

.auth__intro {
  padding: 24px 8px 0 0;
}

.auth__intro-kicker {
  margin: 0 0 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth__intro-title {
  margin: 0 0 20px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.35;
  color: var(--ink);
}

.auth__intro-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 0;
  overflow: hidden;
}

.auth__tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.auth__tab {
  flex: 1;
  padding: 14px 12px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.auth__tab:hover {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
}

.auth__tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.auth__panel {
  padding: 28px 28px 32px;
}

.auth__heading {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth__lead {
  margin: 0 0 24px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.form-muted {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.form-field {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:hover {
  border-color: var(--muted);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-error {
  margin-top: 14px;
  min-height: 1.25em;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--danger);
}

.form-error.form-success {
  color: var(--ok);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.99);
}

.btn--block {
  width: 100%;
  margin-top: 8px;
  padding: 13px 18px;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(3, 105, 161, 0.25);
}

.btn--outline {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  padding: 8px 14px;
}

.btn--outline:hover {
  border-color: var(--muted);
  background: #f8fafc;
}

.btn--sm {
  font-size: 0.8125rem;
  padding: 7px 12px;
}

/* Dashboard */
.dash {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: dashIn 0.35s ease both;
}

@keyframes dashIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.dash__tabs {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--canvas);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.dash__tab {
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.dash__tab:hover {
  color: var(--ink-soft);
}

.dash__tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dash__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dash__badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #bae6fd;
}

.dash__time {
  font-size: 0.75rem;
  color: var(--muted);
}

.dash__table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}

.dash__legend {
  margin: 0;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.dash__legend-title {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
}

.dash__legend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash__legend-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  align-items: start;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.dash__legend-list .pill {
  margin-top: 1px;
  white-space: nowrap;
}

.dash__legend-text strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 640px) {
  .dash__legend-list li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dash__legend-list .pill {
    justify-self: start;
  }
}

.dash__error {
  padding: 0 20px 16px;
  margin-top: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.1s ease;
}

.data-table tbody tr:hover {
  background: #fafbfc;
}

.data-table td.table-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: normal;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #fde68a;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid #a7f3d0;
}

.pill.sleep {
  background: var(--sleep-bg);
  color: var(--sleep);
  border: 1px solid var(--line);
}

.site-footer {
  padding: 20px 24px 28px;
  text-align: center;
}

.site-footer p {
  margin: 0 auto;
  max-width: 720px;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

.site-footer__legal {
  margin: 10px auto 0;
  max-width: 720px;
}

.site-footer__link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
}

.site-footer__link:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .auth__grid {
    grid-template-columns: 1fr;
  }

  .auth__intro {
    display: none;
  }
}

@media (max-width: 640px) {
  .layout {
    padding: 20px 16px 32px;
  }

  .auth__panel {
    padding: 22px 18px 26px;
  }

  .dash__bar {
    flex-direction: column;
    align-items: stretch;
  }

  .dash__meta {
    justify-content: flex-start;
  }
}
