/*
  기본 틀과 공용 클래스 (모듈 계약 4.1, 4.2)
  * 공용 클래스: .card .btn .btn-primary .btn-secondary .btn-danger .btn-block .field .field-label
    .field-help .chip .empty-state .toast. 다른 모듈은 자기 접두어(fse-, ins-) 클래스만 새로 만듦.
  * 앱 내부 클래스는 접두어 없이 쓰되 위 공용 이름과 겹치지 않게 함.
*/

@font-face {
  font-family: "Material Icons Round";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("fonts/material-icons-round.woff2") format("woff2");
}

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

html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; height: auto; display: block; }
/* 글 속 링크는 먹색 + 밑줄로 알아보게 함(단추/카드 링크는 각자 밑줄을 뺌) */
a { color: var(--c-text); text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--c-accent); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 아이콘 글꼴: <span class="mi" aria-hidden="true">description</span> */
.mi {
  font-family: "Material Icons Round";
  font-weight: normal;
  font-style: normal;
  font-size: 1.4em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  flex: none;
  user-select: none;
}

.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--c-muted); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.hidden, [hidden] { display: none !important; }

/* ───────── 틀: 상단 막대 / 옆 막대 / 하단 탭 막대 ───────── */
.app-shell { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--topbar-h);
  padding: 0 var(--space-3);
  padding-top: env(safe-area-inset-top);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.topbar-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-left: calc(-1 * var(--space-2));
  border-radius: 50%;
  color: var(--c-text); text-decoration: none;
}
.topbar-back:active { background: var(--c-surface-3); }
.topbar-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 화면 글씨 크기 3단 선택 */
.fontscale {
  display: inline-flex;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--c-surface-3);
  padding: 3px;
}
.fontscale button {
  min-width: 46px;
  height: 44px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-muted);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.fontscale button[data-scale="1"] { font-size: 15px; }
.fontscale button[data-scale="1.15"] { font-size: 19px; }
.fontscale button[data-scale="1.3"] { font-size: 23px; }
.fontscale button[aria-pressed="true"] {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 1px 3px rgba(18, 18, 20, 0.16);
}
/* 화면 색 테마 고르기: 견본 상자는 data-theme으로 그 테마의 토큰 값을 받아 그림 */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); gap: var(--space-2); }
.theme-opt {
  display: flex; flex-direction: column; gap: 6px;
  min-height: var(--touch);
  padding: 6px 6px 8px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.theme-opt[aria-checked="true"] { border-color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-text); }
.theme-opt[aria-checked="true"] .theme-name::after { content: "사용 중"; display: block; color: var(--c-muted); font-size: 0.85em; font-weight: 600; }
.theme-swatch {
  display: flex; align-items: center; gap: 5px;
  height: 40px; padding: 5px;
  border-radius: 8px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
}
.theme-swatch .sw-hero { flex: 1; align-self: stretch; border-radius: 5px; background: var(--c-hero); }
.theme-swatch .sw-accent { width: 18px; height: 18px; border-radius: 50%; background: var(--c-accent); box-shadow: inset 0 0 0 1.5px var(--c-fab-edge); flex: none; }
.theme-swatch .sw-primary { width: 18px; height: 18px; border-radius: 5px; background: var(--c-primary); flex: none; }
.theme-name { padding: 0 2px; line-height: 1.3; }
.theme-default {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--c-surface-3); color: var(--c-muted); font-size: 0.8em; font-weight: 700; vertical-align: 1px;
}

/* 설정 시트: 화면 색 / 글씨 크기 / 계정 묶음 */
.settings-group + .settings-group { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--c-border); }
.settings-title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--fs-base); font-weight: 800; }
.settings-title .mi { font-size: 1.25em; color: var(--c-muted); }
.settings-group .field-help { margin-top: var(--space-2); }
.fontscale-wide { display: flex; width: 100%; }
.fontscale-wide button { flex: 1; height: var(--touch); }

.main {
  padding: var(--space-4);
  padding-bottom: calc(var(--tabbar-h) + var(--space-6) + env(safe-area-inset-bottom));
}
.page { max-width: var(--content-max); margin: 0 auto; }
.page-wide { max-width: 1120px; margin: 0 auto; }

.sidebar { display: none; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.tab {
  -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: 6px 2px;
  border: 0; background: none;
  color: var(--c-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tab .mi { font-size: 28px; border-radius: 999px; padding: 2px 14px; }
.tab[aria-current="page"] { color: var(--c-text); font-weight: 800; }
.tab[aria-current="page"] .mi {
  background: var(--c-accent-soft);
  color: var(--c-accent-ink);
}

/* 새 문서: 탭 막대 위로 솟은 큰 노란 둥근 버튼(장비 노랑, 먹색 아이콘) */
.tab-new { color: var(--c-text); justify-content: flex-end; padding-bottom: 8px; }
.tab-new-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  margin-top: -26px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-contrast);
  box-shadow: inset 0 0 0 2px var(--c-fab-edge), 0 6px 16px -4px rgba(18, 18, 20, .35), 0 0 0 5px var(--c-surface);
}
.tab-new .tab-new-circle .mi { font-size: 32px; background: none !important; padding: 0 !important; color: inherit !important; }
.tab-new:active .tab-new-circle { transform: scale(.96); }
.tab-new[aria-current="page"] { color: var(--c-text); }

/* 저장 막대가 있는 화면: 하단 탭 막대를 숨기고 행동 막대를 아래에 고정 */
body.has-action-bar .tabbar { display: none; }
body.has-action-bar .main { padding-bottom: calc(96px + var(--space-6) + env(safe-area-inset-bottom)); }

.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 31;
  background: var(--c-surface);
  box-shadow: 0 -1px 0 var(--c-border), 0 -8px 24px -12px rgba(18, 18, 20, 0.18);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
}
.action-bar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* 넓은 화면: 왼쪽 옆 막대, 하단 탭 숨김 */
@media (min-width: 960px) {
  .app-shell.with-nav { padding-left: var(--sidebar-w); }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w);
    z-index: 32;
    padding: var(--space-4) var(--space-3);
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3) var(--space-5);
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--c-text);
    text-decoration: none;
  }
  .sidebar-brand img { width: 36px; height: 36px; border-radius: 9px; }
  .side-link {
    display: flex; align-items: center; gap: var(--space-3);
    min-height: var(--touch);
    padding: 0 var(--space-3);
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--c-text);
    font-weight: 600;
    text-decoration: none;
    border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
  }
  .side-link .mi { color: var(--c-muted); }
  .side-link:hover { background: var(--c-surface-2); }
  .side-link[aria-current="page"] {
    background: var(--c-surface-2);
    color: var(--c-text);
    font-weight: 800;
  }
  .side-link[aria-current="page"] .mi { color: var(--c-accent-ink); }
  .sidebar-foot { margin-top: auto; border-top: 1px solid var(--c-border); padding-top: var(--space-3); }
  .sidebar-user { padding: 0 var(--space-3) var(--space-2); color: var(--c-muted); font-size: var(--fs-sm); }
  .tabbar { display: none; }
  .main { padding: var(--space-5) var(--space-6) var(--space-6); }
  body.has-action-bar .main { padding-bottom: calc(110px + var(--space-6)); }
  .with-nav .action-bar { left: var(--sidebar-w); }
  .topbar { padding: 0 var(--space-6); }
}

/* ───────── 공용 부품 ───────── */
/* 카드: 테두리 한 줄로만 가장자리를 처리(그림자와 겹쳐 쓰지 않음) */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.card + .card, .stack > * + * { margin-top: var(--space-4); }
.card-title {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.card-title .mi { color: var(--c-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 var(--space-4);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--c-surface-2); }
.btn:active { transform: translateY(1px); background: var(--c-surface-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-contrast); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-primary:active { background: var(--c-primary); }
/* 보조 단추: 흰 면 + 진한 테두리. 회색 바탕 위에서도 단추로 보이게 함 */
.btn-secondary { background: var(--c-surface); border-color: var(--c-border-strong); color: var(--c-text); }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-contrast); }
.btn-accent:hover, .btn-accent:active { background: var(--c-accent); filter: brightness(1.05); }
.btn-danger { background: var(--c-surface); border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger-soft); }
.btn-danger.btn-solid { background: var(--c-danger); color: var(--c-danger-contrast); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-text); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 60px; font-size: var(--fs-lg); }
.btn .spinner { width: 1.1em; height: 1.1em; }

.spinner {
  display: inline-block;
  width: 1.2em; height: 1.2em;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 입력 칸 */
.field { margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-weight: 700;
}
.field-optional { font-weight: 500; color: var(--c-muted); font-size: var(--fs-sm); }
.field-help { margin-top: var(--space-1); color: var(--c-muted); font-size: var(--fs-sm); }
.field-error {
  display: flex; align-items: flex-start; gap: var(--space-1);
  margin-top: var(--space-2);
  color: var(--c-danger);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.field-error .mi { font-size: 1.25em; }
.field.is-invalid .field-label { color: var(--c-danger); }
.field.is-invalid .input { border-color: var(--c-danger); box-shadow: 0 0 0 1px var(--c-danger); }

.input,
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field input[type="time"], .field input[type="search"],
.field input[type="number"], .field input[type="tel"], .field select, .field textarea {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 10px var(--space-3);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  transition: border-color .15s, box-shadow .15s;
  color: var(--c-text);
  font-size: var(--fs-input);
  line-height: 1.35;
  appearance: none;
  -webkit-appearance: none;
}
.field textarea { min-height: 7.5em; resize: vertical; }
.field input[type="date"], .field input[type="time"] { font-variant-numeric: tabular-nums; }
.field input::placeholder, .field textarea::placeholder { color: var(--c-muted); opacity: .8; }
.field select {
  padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%),
                    linear-gradient(135deg, var(--c-muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-text);
  box-shadow: 0 0 0 4px var(--c-ring);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.field-row > .field { margin-bottom: 0; }
.field-row + .field, .field-row + .field-row { margin-top: var(--space-4); }
.input-with-btn { position: relative; }
.input-with-btn .input, .input-with-btn input { padding-right: 56px; }
.input-with-btn .input-btn {
  position: absolute; top: 2px; right: 2px;
  width: 48px; height: calc(100% - 4px);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--c-muted); cursor: pointer; border-radius: var(--radius-sm);
}

/* 두세 개 중 하나 고르기(당일/익일 등) */
.segmented {
  display: flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--radius);
  background: var(--c-surface-3);
  border: 0;
}
.segmented button {
  flex: 1;
  min-height: calc(var(--touch) - 8px);
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: var(--c-muted);
  font-weight: 700;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 1px 3px rgba(18, 18, 20, 0.16);
}

/* 켜고 끄는 스위치 */
.switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  cursor: pointer;
}
.switch-text { flex: 1; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  flex: none;
  width: 60px; height: 34px;
  border-radius: 999px;
  background: var(--c-border-strong);
  transition: background-color .15s;
}
.switch-track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--c-success); }
.switch input:checked + .switch-track::after { transform: translateX(26px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--c-focus); outline-offset: 2px; }

/* 칩 */
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  flex: none;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background-color .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--c-text);
  border-color: var(--c-text);
  color: var(--c-surface);
}

/* 빈 상태 */
.empty-state {
  max-width: 460px;
  margin: var(--space-6) auto;
  padding: var(--space-5) var(--space-4);
  text-align: center;
}
.empty-state .empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--c-surface-3);
  color: var(--c-text);
  margin-bottom: var(--space-4);
}
.empty-state .empty-icon .mi { font-size: 40px; }
.empty-state h2 { font-size: var(--fs-lg); margin-bottom: var(--space-2); }
.empty-state p { color: var(--c-muted); margin-bottom: var(--space-5); }

/* 알림(토스트) */
.toast-region {
  position: fixed;
  z-index: 60;
  left: var(--space-3); right: var(--space-3);
  top: calc(var(--topbar-h) + var(--space-2) + env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--space-3);
  width: 100%;
  max-width: 560px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--c-text);
  color: var(--c-surface);
  box-shadow: var(--shadow-2);
  font-weight: 600;
  animation: toast-in .2s ease-out;
}
.toast .mi { margin-top: 1px; }
.toast { flex-wrap: wrap; }
.toast-msg { flex: 1 1 11em; min-width: 0; }
/* 글이 길고 되돌리기 단추가 있으면 단추 줄을 아래로 내려 글이 좁게 접히지 않게 함 */
.toast-actions { display: flex; gap: var(--space-1); flex: none; align-items: center; margin-left: auto; }
.toast button {
  min-height: 40px; min-width: 40px; padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit;
  font-weight: 800; cursor: pointer;
}
.toast .toast-undo { color: var(--c-accent); }
.toast-error { background: var(--c-danger); color: var(--c-danger-contrast); }
.toast-success .mi { color: #6fd39d; }
.toast-warning .mi { color: var(--c-accent); }
:root[data-mode="dark"] .toast-success .mi { color: var(--c-success); }
:root[data-mode="dark"] .toast-warning .mi { color: #8a5a00; }
:root[data-mode="dark"] .toast .toast-undo { color: #8a5a00; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 안내 띠 */
.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--c-surface-2);
  color: var(--c-text);
}
.notice .mi { color: var(--c-muted); }
.notice-warning { background: var(--c-warning-soft); }
.notice-warning .mi { color: var(--c-warning); }
.notice-danger { background: var(--c-danger-soft); }
.notice-danger .mi { color: var(--c-danger); }
.notice-success { background: var(--c-success-soft); }
.notice-success .mi { color: var(--c-success); }

/* 대화상자(확인/내 정보) */
dialog.sheet {
  width: 100%;
  max-width: 520px;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow-2);
  max-height: 90dvh;
}
dialog.sheet::backdrop { background: var(--c-overlay); }
dialog.sheet[open] { animation: sheet-up .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 24px; }
}
.sheet-body { padding: var(--space-5) var(--space-4) var(--space-4); }
.sheet-body h2 { font-size: var(--fs-xl); margin-bottom: var(--space-3); }
.sheet-body p { margin-bottom: var(--space-3); }
.sheet-actions {
  display: flex; flex-direction: column-reverse; gap: var(--space-2);
  padding: 0 var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
}
@media (min-width: 600px) {
  .sheet-actions { flex-direction: row; justify-content: flex-end; }
  .sheet-actions .btn { min-width: 140px; }
}
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--c-border); margin: var(--space-2) auto 0; }

/* 키와 값 */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0; }
.kv dt { color: var(--c-muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.kv dd.is-empty { color: var(--c-muted); font-weight: 400; }

/* ───────── 인증 화면 ───────── */
.auth-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}
.auth-top {
  display: flex; justify-content: flex-end; align-items: center;
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top));
}
.auth-main {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-3) var(--space-4) var(--space-6);
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--c-text);
  text-decoration: none;
}
.auth-brand img { width: 64px; height: 64px; border-radius: 16px; box-shadow: var(--shadow-1); }
.auth-card { width: 100%; max-width: 440px; padding: var(--space-5) var(--space-4); }
@media (min-width: 600px) { .auth-card { padding: var(--space-6); } }
.auth-card h1 { font-size: var(--fs-xl); margin-bottom: var(--space-2); }
.auth-card .lead { color: var(--c-muted); margin-bottom: var(--space-5); }
.auth-alt { margin-top: var(--space-5); text-align: center; color: var(--c-muted); }
.auth-alt a { font-weight: 700; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.label-row a { font-size: var(--fs-sm); font-weight: 700; }
.result-box {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--c-success-soft);
  text-align: center;
}
.result-box strong { display: block; font-size: var(--fs-xl); margin-top: var(--space-1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───────── 앱 설치 안내 띠(install.js가 브라우저 탭일 때만 보임) ───────── */
.install-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  max-width: var(--content-max); width: 100%;
  margin: 0 auto var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--c-primary);
  border-radius: var(--radius);
  background: var(--c-primary-soft);
}
.install-bar-icon { font-size: 32px; color: var(--c-primary); flex: none; }
.install-bar-text { flex: 1 1 10em; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-bar-text strong { font-size: var(--fs-lg); }
.install-bar-text span { font-size: var(--fs-sm); color: var(--c-muted); }
.install-bar-actions { display: flex; gap: var(--space-2); flex: 1 1 100%; }
.install-bar-actions .btn { flex: 1; }
@media (min-width: 600px) { .install-bar-actions { flex: none; } }
.install-steps { margin: 0 0 var(--space-4); padding-left: 1.4em; display: grid; gap: var(--space-2); font-size: var(--fs-base); }
.install-lead { margin: 0 0 var(--space-4); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--c-warning-soft); font-weight: 700; }
/* 설정: 밝게/어둡게 (글씨 크기 단추 모양을 그대로 씀) */
.mode-picker { margin-bottom: var(--space-3); }
.mode-picker button { font-size: var(--fs-base) !important; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mode-picker .mi { font-size: 20px; }

/* 기기별 자동 로그인: 로그인 화면 체크 상자와 로그인된 기기 목록 */
.remember-check { display: flex; gap: var(--space-3); align-items: flex-start; margin-top: var(--space-4); cursor: pointer; font-weight: 600; }
.remember-check input { width: 1.35rem; height: 1.35rem; margin: 0.1rem 0 0; accent-color: var(--c-primary); flex: none; }
.remember-check small { display: block; color: var(--c-muted); font-weight: 400; font-size: 0.875em; }
.device-list { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; gap: var(--space-3); }
.device-item { display: flex; gap: var(--space-3); align-items: center; }
.device-item > .mi { font-size: 1.75rem; color: var(--c-muted); }
.device-main { flex: 1; min-width: 0; }
.device-name { font-weight: 700; }
.device-meta { color: var(--c-muted); font-size: 0.875em; }
.device-here { display: inline-block; margin-left: var(--space-2); padding: 0 var(--space-2); border-radius: 999px; background: var(--c-primary); color: var(--c-primary-contrast); font-size: 0.75em; font-weight: 700; vertical-align: middle; }
