/* 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;
  min-width: 0;
  padding: 12px 6px;
  font-family: inherit;
  font-size: 0.75rem;
  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-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.dash__bar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.dash__view-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
}

.dash__view-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.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__tab.dash__tab--fall {
  color: #dc2626;
  font-weight: 700;
}

.dash__tab.dash__tab--fall:hover {
  color: #b91c1c;
}

.dash__tab.dash__tab--fall.active {
  color: #fff;
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.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__view-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.dash__view-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.dash__view-tab:hover {
  color: var(--ink-soft);
}

.dash__view-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.life-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  padding: 16px 20px 8px;
}

.life-cards__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
}

.life-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.life-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.life-card__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ok);
}

.life-card--danger .life-card__dot {
  background: var(--danger);
}

.life-card--warning .life-card__dot {
  background: var(--warn);
}

.life-card--sleep .life-card__dot {
  background: var(--sleep);
}

.life-card__name {
  flex: 1;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.life-card__status {
  font-size: 0.9375rem;
  font-weight: 700;
  flex-shrink: 0;
}

.life-card--normal .life-card__status {
  color: var(--ok);
}

.life-card--danger .life-card__status {
  color: var(--danger);
}

.life-card--warning .life-card__status {
  color: var(--warn);
}

.life-card--sleep .life-card__status {
  color: var(--sleep);
}

.life-card__phone {
  margin: 4px 0 0 24px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.life-card__inactive {
  margin: 10px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.45;
}

.life-card__event {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--ink);
  line-height: 1.45;
}

.life-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.life-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.life-card__btn {
  width: 100%;
}

.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-top {
    flex-direction: column;
    align-items: stretch;
  }

  .dash__meta {
    justify-content: flex-start;
  }

  .dash__view-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dash__view-tabs {
    width: 100%;
  }

  .dash__view-tab {
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    padding: 10px 8px;
  }

  .life-cards {
    grid-template-columns: 1fr;
    padding: 14px 16px 6px;
  }

  .session {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* 필터 탭(위험만·배터리) 선택 시 인라인 자동 음성 설정 */
.dash__auto-voice {
  padding: 14px 20px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.dash__auto-voice-panel {
  max-width: 720px;
}

.dash__auto-voice-head {
  margin-bottom: 12px;
}

.dash__auto-voice-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.dash__auto-voice-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.dash__auto-voice-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.dash__auto-voice-field {
  margin-bottom: 10px;
}

.dash__auto-voice-field--interval {
  max-width: 280px;
}

.dash__auto-voice-field-hint,
.auto-voice-panel__field-hint {
  margin: 4px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}

.dash__auto-voice-textarea {
  min-height: 64px;
  resize: vertical;
}

.dash__auto-voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.dash__auto-voice-status {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  min-height: 1.25em;
}

.dash__auto-voice-status--ok {
  color: #047857;
}

.dash__auto-voice-status--error {
  color: var(--danger);
}

/* 자동 음성 설정 (우측 상단) */
.dash__auto-voice--header-open {
  box-shadow: inset 0 3px 0 rgba(14, 165, 233, 0.55);
}

.dash__auto-voice--header-open .dash__auto-voice-panel + .dash__auto-voice-panel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line);
}

.auto-voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.38);
}

.auto-voice-panel {
  width: min(520px, 96vw);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--surface);
  border-radius: 14px;
  padding: 20px 22px 18px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--line);
}

.auto-voice-panel__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.auto-voice-panel__lead {
  margin: 0 0 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}

.auto-voice-panel__section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.auto-voice-panel__section:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}

.auto-voice-panel__section-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.auto-voice-panel__check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.auto-voice-panel__textarea {
  min-height: 72px;
  resize: vertical;
}

.auto-voice-panel__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* 활동 기록 모달 */
.activity-log-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.activity-log-overlay.hidden {
  display: none;
}

.activity-log-panel {
  width: min(520px, 96vw);
  max-height: min(88vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  padding: 16px 18px 14px;
}

.activity-log-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.activity-log-panel__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.activity-log-panel__sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.activity-log-loading {
  padding: 12px 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.activity-log-loading.hidden {
  display: none;
}

.activity-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  max-height: min(52vh, 420px);
}

.activity-log-list__empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.activity-log-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-log-item:last-child {
  border-bottom: none;
}

.activity-log-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--ok);
}

.activity-log-item__dot--danger {
  background: var(--danger);
}

.activity-log-item__dot--warn {
  background: var(--warn);
}

.activity-log-item__dot--muted {
  background: #94a3b8;
}

.activity-log-item__status {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink);
}

.activity-log-item__detail {
  grid-column: 2;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: -4px;
}

.activity-log-item__time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.activity-log-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.activity-log-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.dash__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* 보호자 역할 확인 (피보호자만 앱 등록 시) */
.guardian-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.guardian-confirm-overlay.hidden {
  display: none;
}

/* 낙상 의심 알림 팝업 */
.fall-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 10003;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(127, 29, 29, 0.42);
}

.fall-alert-overlay.hidden {
  display: none;
}

.fall-alert-panel {
  width: min(480px, 96vw);
  background: var(--surface);
  border-radius: 14px;
  border: 2px solid #fca5a5;
  box-shadow: 0 18px 48px rgba(127, 29, 29, 0.28);
  padding: 20px 22px 18px;
}

.fall-alert-panel__title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #b91c1c;
}

.fall-alert-panel__lead {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.fall-alert-panel__list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(40vh, 280px);
  overflow-y: auto;
}

.fall-alert-panel__list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 0.9375rem;
  color: var(--ink);
}

.fall-alert-panel__list strong {
  color: #991b1b;
}

.fall-alert-panel__list span {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.fall-alert-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.guardian-confirm-panel {
  width: min(440px, 96vw);
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  padding: 20px 22px 18px;
}

.guardian-confirm-panel__title {
  margin: 0 0 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.guardian-confirm-panel__lead {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.guardian-confirm-panel__question {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  color: var(--ink);
}

.guardian-confirm-panel__hint {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.guardian-confirm-panel__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 상세 현황 (앱 GuardianActivity 대응) */
.detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 20px 32px;
  width: 100%;
}

.detail__top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.detail__title-wrap {
  flex: 1;
  min-width: 0;
}

.detail__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.detail__subtitle {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.detail-status {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.detail-status__circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ok-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-status__circle--danger {
  background: var(--danger-bg);
}

.detail-status__circle--warn {
  background: var(--warn-bg);
}

.detail-status__circle--sleep {
  background: var(--sleep-bg);
}

.detail-status__icon {
  font-size: 2rem;
  line-height: 1;
}

.detail-status__label {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 700;
}

.detail-status__inactive {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.detail-status__meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.detail-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.detail-metric__k {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-metric__v {
  font-size: 1.0625rem;
  font-weight: 600;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.detail-card--warn {
  border-color: #fbbf24;
  background: var(--warn-bg);
}

.detail-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.detail-card__title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.detail-card__head .detail-card__title {
  margin-bottom: 0;
}

.detail-card__date {
  font-size: 0.75rem;
  color: var(--muted);
}

.detail-card__body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
}

.detail-report__body {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--ink-soft);
}

.detail-wake__hint {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.detail-wake__actions {
  display: flex;
  justify-content: flex-start;
}

.detail-wake__status {
  margin: 10px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.detail-wake__status--ok {
  color: var(--ok, #15803d);
}

.detail-wake__status--warn {
  color: var(--warn);
}

.detail-voice__input {
  width: 100%;
  margin-bottom: 8px;
  min-height: 64px;
  resize: vertical;
}

.detail-voice__actions {
  display: flex;
  justify-content: flex-end;
}

.detail-voice-disabled {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--warn);
}

.detail-activity-list {
  max-height: none;
  min-height: 0;
}

.detail-activity-meta {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.detail-activity-more,
.activity-log-more {
  width: 100%;
  margin-top: 8px;
}

.dash__link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}

.dash__link:hover {
  color: var(--accent-hover);
}

@media (max-width: 520px) {
  .detail-metrics {
    grid-template-columns: 1fr;
  }
}

/* iPhone 보호자 — 홈 화면 추가 안내 */
.iphone-banner {
  max-width: 960px;
  margin: 12px auto 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid #7dd3fc;
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.iphone-banner__title {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
  flex: 1 1 100%;
}

.iphone-banner__text {
  margin: 0;
  flex: 1 1 220px;
  font-size: 14px;
  color: var(--ink-soft);
}

.auth__hint--device {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--warn);
  line-height: 1.45;
}
