/* ============================================================
   ARON 컨트롤타워 — 컴포넌트
   Apple News / App Store / iOS 설정 화면 문법을 따른다.
   ============================================================ */

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

/* display를 지정한 요소(.row 등)에도 hidden이 먹히게 한다 */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg-grouped);   /* 위로 당겨도 흰 여백이 안 보이게 */
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  color: var(--label);
  background: var(--bg-grouped);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* 노치 영역은 body가 아니라 내비게이션 바가 덮는다 (아래 .nav 참조).
     그래야 스크롤할 때 내용이 노치 뒤로 지나가고 반투명 바가 그 위를 가린다 */
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------
   앱 셸
   ------------------------------------------------------------ */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--sp-6));
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  animation: screen-in var(--dur) var(--ease);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------
   내비게이션 바 — 큰 제목 (Apple News 방식)
   ------------------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  /* 상태바·노치 높이만큼 바를 위로 연장 — Apple News와 같은 동작 */
  padding-top: max(env(safe-area-inset-top), 10px);
  background: var(--material-bar);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 0.5px solid transparent;
  transition: border-color var(--dur-fast) var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--separator); }

.nav__compact {
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--margin);
  position: relative;
}
.nav__compact-title {
  font-size: var(--t-headline);
  font-weight: var(--w-semibold);
  letter-spacing: var(--ls-headline);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.nav.is-scrolled .nav__compact-title { opacity: 1; }

.nav__action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: var(--sp-2);
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--label);
}
.nav__action--left  { left: calc(var(--margin) - var(--sp-2)); }
.nav__action--right { right: calc(var(--margin) - var(--sp-2)); }
.nav__action:active { opacity: 0.4; }

.nav__large {
  /* 제목 위로 여백을 준다. 애플은 큰 제목 주변을 넉넉하게 둔다 */
  padding: var(--sp-3) var(--margin) var(--sp-5);
}
.nav__large-title {
  font-size: var(--t-large-title);
  line-height: var(--lh-large-title);
  letter-spacing: var(--ls-large-title);
  font-weight: var(--w-bold);
  margin: 0;
}
.nav__large-sub {
  font-size: var(--t-large-title);
  line-height: var(--lh-large-title);
  letter-spacing: var(--ls-large-title);
  font-weight: var(--w-bold);
  color: var(--label-tertiary);
  margin: 0;
}

/* ------------------------------------------------------------
   섹션
   ------------------------------------------------------------ */

/* 제목 바로 밑에 내용이 달라붙으면 답답하다.
   내비게이션 다음에 무엇이 오든 숨 쉴 공간을 준다.
   선택자를 .screen > 로 시작하는 이유: 뒤에 오는 .group·.card 규칙이
   margin을 다시 0으로 덮어쓰기 때문에 우선순위를 높여야 한다. */
.screen > .nav + * { margin-top: var(--sp-5); }

.section { margin-top: var(--sp-6); }
.section + .section { margin-top: var(--sp-6); }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 var(--margin) var(--sp-2);
}
.section__title {
  font-size: var(--t-title2);
  line-height: var(--lh-title2);
  letter-spacing: var(--ls-title2);
  font-weight: var(--w-bold);
  margin: 0;
}
.section__more {
  font-size: var(--t-subhead);
  font-weight: var(--w-regular);
  color: var(--label-secondary);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.section__more:active { opacity: 0.4; }

/* 설정 화면식 작은 회색 머리글 */
.group__head {
  font-size: var(--t-footnote);
  line-height: var(--lh-footnote);
  color: var(--label-secondary);
  padding: 0 calc(var(--margin) + var(--sp-4)) var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.group__foot {
  font-size: var(--t-footnote);
  line-height: var(--lh-footnote);
  color: var(--label-secondary);
  padding: var(--sp-2) calc(var(--margin) + var(--sp-4)) 0;
}

/* NYTimes식 굵은 가로 구분선 */
.rule {
  height: 1px;
  background: var(--rule);
  margin: var(--sp-5) var(--margin) var(--sp-4);
}
.rule--thick { height: 2px; }

/* ------------------------------------------------------------
   inset grouped 목록 — iOS 설정 화면의 그 구조
   ------------------------------------------------------------ */
.group {
  background: var(--bg-card);
  border-radius: var(--r-md);
  margin: 0 var(--margin);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;                 /* 애플 최소 터치 영역 */
  padding: var(--sp-3) var(--sp-4);
  position: relative;
  background: var(--bg-card);
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--label);
}
.row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: var(--sp-4);                /* 왼쪽을 띄운 구분선 */
  right: 0;
  bottom: 0;
  height: 0.5px;
  background: var(--separator);
}
.row--has-icon:not(:last-child)::after { left: 56px; }
.row:active { background: var(--fill); }
.row--static { cursor: default; }
.row--static:active { background: var(--bg-card); }

.row__icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  color: var(--label);
}
.row__icon svg { width: 22px; height: 22px; }

.row__body { flex: 1; min-width: 0; }

.row__title {
  display: block;                   /* 제목과 부제목은 반드시 줄을 나눈다 */
  font-size: var(--t-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  /* 긴 제목은 두 줄까지만 — 세 줄부터는 목록이 읽히지 않는다 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row__title--strong { font-weight: var(--w-semibold); }

.row__sub {
  display: block;
  font-size: var(--t-footnote);
  line-height: var(--lh-footnote);
  color: var(--label-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__value {
  font-size: var(--t-body);
  color: var(--label-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row__value--strong {
  color: var(--label);
  font-weight: var(--w-semibold);
}

.row__chevron {
  width: 8px;
  height: 13px;
  flex: 0 0 8px;
  color: var(--label-tertiary);
}

/* ------------------------------------------------------------
   대형 카드 — App Store Today 방식
   눈썹(작은 회색 대문자) → 굵은 제목 → 회색 설명
   ------------------------------------------------------------ */
.card {
  display: block;
  width: calc(100% - var(--margin) * 2);
  margin: 0 var(--margin);
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  text-align: left;
  border: 0;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease);
}
.card:active { transform: scale(0.98); }

.card__eyebrow {
  font-size: var(--t-caption1);
  line-height: var(--lh-caption1);
  font-weight: var(--w-semibold);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label-secondary);
  margin: 0 0 var(--sp-1);
}
.card__title {
  font-size: var(--t-title2);
  line-height: var(--lh-title2);
  letter-spacing: var(--ls-title2);
  font-weight: var(--w-bold);
  margin: 0;
}
.card__body {
  font-size: var(--t-subhead);
  line-height: var(--lh-subhead);
  color: var(--label-secondary);
  margin: var(--sp-2) 0 0;
}
.card--inverse {
  background: var(--inverse-bg);
  color: var(--inverse-label);
}
.card--inverse .card__eyebrow,
.card--inverse .card__body { color: rgba(255,255,255,0.7); }
:root[data-theme="dark"] .card--inverse .card__eyebrow,
:root[data-theme="dark"] .card--inverse .card__body { color: rgba(0,0,0,0.6); }

/* ------------------------------------------------------------
   금액 표시 — 장부의 핵심. 자릿수가 흔들리면 안 된다.
   ------------------------------------------------------------ */
.amount {
  font-variant-numeric: tabular-nums;
  font-feature-settings: var(--num);
  letter-spacing: -0.02em;
}
.amount--display {
  font-size: var(--t-large-title);
  line-height: var(--lh-large-title);
  font-weight: var(--w-bold);
}
.amount--out::before { content: "−"; }
.amount--in::before  { content: "+"; }

/* ------------------------------------------------------------
   배지 · 칩
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--t-caption1);
  line-height: 1;
  font-weight: var(--w-semibold);
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: var(--fill-strong);
  color: var(--label);
  white-space: nowrap;
}
.badge--urgent {
  background: var(--inverse-bg);
  color: var(--inverse-label);
}
.badge--quiet {
  background: transparent;
  color: var(--label-secondary);
  padding-left: 0;
  padding-right: 0;
}

.chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-1) var(--margin) var(--sp-3);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font-size: var(--t-subhead);
  font-weight: var(--w-medium);
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--fill);
  border: 0;
  color: var(--label);
  cursor: pointer;
}
.chip[aria-selected="true"] {
  background: var(--inverse-bg);
  color: var(--inverse-label);
}

/* ------------------------------------------------------------
   버튼
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-lg);
  border: 0;
  font-size: var(--t-body);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease);
}
.btn:active { opacity: 0.6; }
.btn--filled { background: var(--inverse-bg); color: var(--inverse-label); }
.btn--tinted { background: var(--fill-strong); color: var(--label); }
.btn--plain  { background: none; color: var(--label); padding: 0; min-height: 0; }
.btn--block  { width: 100%; }
.btn:disabled { opacity: 0.3; cursor: default; }

/* ------------------------------------------------------------
   탭 바 — 떠 있는 형태 (Apple News / App Store)
   ------------------------------------------------------------ */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--material-bar);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-bar);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--label-tertiary);
  transition: color var(--dur-fast) var(--ease);
}
.tab[aria-current="page"] { color: var(--label); }
.tab svg { width: 26px; height: 26px; }
.tab__label {
  font-size: 10px;
  line-height: 12px;
  font-weight: var(--w-medium);
  letter-spacing: 0.06px;
}

/* ------------------------------------------------------------
   시트 (하단에서 올라오는 창)
   ------------------------------------------------------------ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.sheet-backdrop.is-open { opacity: 1; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  background: var(--bg-grouped);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: none; }

.sheet__grabber {
  width: 36px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--label-quaternary);
  margin: var(--sp-2) auto var(--sp-1);
  flex: 0 0 auto;
}
.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--margin) var(--sp-3);
  flex: 0 0 auto;
}
.sheet__title {
  font-size: var(--t-headline);
  font-weight: var(--w-semibold);
  margin: 0;
}
.sheet__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-6);
}

/* ------------------------------------------------------------
   입력
   ------------------------------------------------------------ */
.field {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-card);
  position: relative;
}
.field:not(:last-child)::after {
  content: "";
  position: absolute;
  left: var(--sp-4); right: 0; bottom: 0;
  height: 0.5px;
  background: var(--separator);
}
.field__label {
  font-size: var(--t-body);
  flex: 0 0 88px;
  color: var(--label);
}
.field input,
.field select,
.field textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: var(--t-body);
  padding: var(--sp-2) 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.field textarea { text-align: left; resize: vertical; min-height: 66px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--label-tertiary); }

/* ------------------------------------------------------------
   빈 상태 · 로딩
   ------------------------------------------------------------ */
.empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--label-secondary);
}
.empty__title {
  font-size: var(--t-headline);
  font-weight: var(--w-semibold);
  color: var(--label);
  margin: 0 0 var(--sp-1);
}
.empty__body {
  font-size: var(--t-subhead);
  line-height: var(--lh-subhead);
  margin: 0;
}

.skeleton {
  background: var(--fill);
  border-radius: var(--r-sm);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------
   동기화 표시 — 드라이브 반영 상태
   ------------------------------------------------------------ */
.syncbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-size: var(--t-caption1);
  color: var(--label-secondary);
  padding: var(--sp-2) var(--margin);
}
.syncbar__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--label-tertiary);
}
.syncbar__dot--live { background: var(--label); }
.syncbar__dot--pending { animation: pulse 1.2s ease-in-out infinite; }

/* ------------------------------------------------------------
   아이패드 — 여백을 넓히되 구조는 그대로
   ------------------------------------------------------------ */
@media (min-width: 768px) {
  :root { --margin: 24px; }
  .nav__large { padding-top: var(--sp-3); }
}

/* ------------------------------------------------------------
   뒤로가기
   ------------------------------------------------------------ */
.nav__backlink {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--t-body);
  color: var(--label-secondary);
  margin-bottom: var(--sp-1);
}
.nav__backlink svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------
   채팅 — 앱 안에서 매니저와 대화
   ------------------------------------------------------------ */
.chat {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom));
}
.chat__log {
  flex: 1;
  padding: var(--sp-4) var(--margin) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: var(--r-xl);
  font-size: var(--t-body);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  animation: bubble-in 220ms var(--ease);
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(4px); } }
.bubble--me {
  align-self: flex-end;
  background: var(--inverse-bg);
  color: var(--inverse-label);
  border-bottom-right-radius: var(--r-sm);
}
.bubble--them {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--label);
  border-bottom-left-radius: var(--r-sm);
}
.bubble__time {
  display: block;
  font-size: var(--t-caption2);
  opacity: 0.5;
  margin-top: 5px;
}
.bubble--typing { display: flex; gap: 4px; align-items: center; }
.bubble--typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--label-tertiary);
  animation: typing 1.2s infinite;
}
.bubble--typing i:nth-child(2) { animation-delay: 0.18s; }
.bubble--typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing { 0%,60%,100% { opacity: 0.25; } 30% { opacity: 1; } }

.composer {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
  padding: var(--sp-2) var(--margin);
  background: var(--material-bar);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-top: 0.5px solid var(--separator);
}
.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 9px 14px;
  border: 0.5px solid var(--separator);
  border-radius: var(--r-xl);
  background: var(--bg-card);
  font-size: var(--t-body);
  line-height: 1.4;
  resize: none;
  outline: none;
}
.composer__send {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border: 0;
  border-radius: 50%;
  background: var(--inverse-bg);
  color: var(--inverse-label);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.composer__send svg { width: 19px; height: 19px; }
.composer__send:disabled { opacity: 0.25; }

/* ------------------------------------------------------------
   절차 튜토리얼
   ------------------------------------------------------------ */
.step {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-card);
  position: relative;
  width: 100%;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--label);
}
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 56px; right: 0; bottom: 0;
  height: 0.5px; background: var(--separator);
}
.step__mark {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  border: 1.6px solid var(--label-tertiary);
  display: grid; place-items: center;
  font-size: var(--t-footnote);
  font-weight: var(--w-semibold);
  color: var(--label-secondary);
}
.step[aria-checked="true"] .step__mark {
  background: var(--inverse-bg);
  border-color: var(--inverse-bg);
  color: var(--inverse-label);
}
.step[aria-checked="true"] .step__title {
  color: var(--label-tertiary);
  text-decoration: line-through;
}
.step__title { font-size: var(--t-body); font-weight: var(--w-medium); }
.step__items {
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-footnote);
  line-height: 1.65;
  color: var(--label-secondary);
}
.step__items li { padding-left: 12px; position: relative; }
.step__items li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 3px; height: 3px; border-radius: 50%; background: var(--label-tertiary);
}

.progress {
  height: 3px;
  background: var(--fill-strong);
  border-radius: var(--r-pill);
  margin: 0 var(--margin) var(--sp-4);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--label);
  border-radius: var(--r-pill);
  transition: width var(--dur) var(--ease);
}

/* ------------------------------------------------------------
   초안 편집
   ------------------------------------------------------------ */
.editor {
  width: calc(100% - var(--margin) * 2);
  margin: 0 var(--margin);
  min-height: 46dvh;
  padding: var(--sp-4);
  border: 0.5px solid var(--separator);
  border-radius: var(--r-md);
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  color: var(--label);
}
.toolbar {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--margin) 0;
}
.toolbar .btn { flex: 1; }


/* ------------------------------------------------------------
   마크다운 표시 — 절차서 본문·매니저 답변
   ------------------------------------------------------------ */
.md {
  font-size: var(--t-subhead);
  line-height: 1.7;
  color: var(--label);
  white-space: normal;
  word-break: break-word;
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 6px 0; }
.md h1, .md h2, .md h3 {
  font-size: var(--t-callout);
  font-weight: var(--w-bold);
  margin: 14px 0 6px;
}
.md ul { margin: 6px 0; padding-left: 18px; }
.md li { margin: 3px 0; }
.md blockquote {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 2px solid var(--separator-opaque);
  color: var(--label-secondary);
}
.md code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--fill);
  border-radius: 5px;
  padding: 1px 5px;
}
.md hr { border: 0; height: 0.5px; background: var(--separator); margin: 12px 0; }
.md__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.md table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: var(--t-footnote);
}
.md th, .md td {
  border: 0.5px solid var(--separator);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
.md th { background: var(--fill); font-weight: var(--w-semibold); white-space: nowrap; }

/* ------------------------------------------------------------
   캘린더 — 마감 월별 보기
   ------------------------------------------------------------ */
.cal {
  margin: 0 var(--margin);
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.cal__title {
  font-size: var(--t-headline);
  font-weight: var(--w-semibold);
  margin: 0;
}
.cal__btn {
  width: 40px; height: 40px;
  border: 0; background: none;
  color: var(--label);
  display: grid; place-items: center;
  cursor: pointer;
  border-radius: 50%;
}
.cal__btn:active { background: var(--fill); }
.cal__btn svg { width: 16px; height: 16px; }
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  text-align: center;
}
.cal__dow {
  font-size: var(--t-caption2);
  color: var(--label-tertiary);
  padding: 4px 0 6px;
  font-weight: var(--w-medium);
}
.cal__day {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-subhead);
  font-variant-numeric: tabular-nums;
  color: var(--label);
}
.cal__num {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.cal__day--today .cal__num {
  background: var(--inverse-bg);
  color: var(--inverse-label);
  font-weight: var(--w-semibold);
}
.cal__day--has::after {
  content: "";
  position: absolute;
  bottom: 1px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--label);
}
.cal__day--today.cal__day--has::after { bottom: -1px; }

/* ------------------------------------------------------------
   초안 읽기 — 제출 서류처럼 보이게
   ------------------------------------------------------------ */
.paper {
  margin: 0 var(--margin);
  padding: var(--sp-5) var(--sp-4);
  background: var(--bg-card);
  border-radius: var(--r-md);
}
.paper .md { font-size: var(--t-body); line-height: 1.8; }
.paper .md h3 {
  font-size: var(--t-title3);
  text-align: center;
  letter-spacing: 4px;
  text-indent: 4px;   /* 자간의 끝 여백 보정 */
  margin: 0 0 var(--sp-5);
}
.paper .md table { font-size: var(--t-subhead); }
.toolbar .btn svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------
   로그인 — 기기당 한 번
   ------------------------------------------------------------ */
.login {
  min-height: 82dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
}
.login__mark {
  font-size: var(--t-large-title);
  font-weight: var(--w-heavy);
  letter-spacing: 6px;
  /* 자간은 마지막 글자 뒤에도 붙는다. 가운데 정렬이면 그만큼 왼쪽으로 밀리므로
     같은 값만큼 안쪽으로 들여 보정한다. */
  text-indent: 6px;
  margin-bottom: var(--sp-1);
}
.login__sub {
  font-size: var(--t-subhead);
  color: var(--label-secondary);
  margin: 0 0 var(--sp-8);
}
.login__form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.login__form input {
  height: 48px;
  padding: 0 var(--sp-4);
  border: 0.5px solid var(--separator);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  font-size: var(--t-body);
  text-align: center;
  outline: none;
  color: var(--label);
}
.login__form input:focus { border-color: var(--label-tertiary); }
.login__msg {
  font-size: var(--t-footnote);
  color: var(--label-secondary);
  margin: var(--sp-4) 0 0;
  max-width: 320px;
  line-height: 1.5;
}

/* ------------------------------------------------------------
   채팅 첨부
   ------------------------------------------------------------ */
.composer__clip {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border: 0;
  border-radius: 50%;
  background: var(--fill-strong);
  color: var(--label);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.composer__clip svg { width: 20px; height: 20px; }
.composer__clip:active { opacity: 0.6; }

.attbar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 54px);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--margin);
  background: var(--material-bar);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.attbar__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: var(--t-footnote);
  padding: 6px 8px 6px 12px;
  border-radius: var(--r-pill);
  background: var(--fill-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attbar__item button {
  border: 0; background: none; color: var(--label-secondary);
  padding: 0; display: grid; place-items: center; cursor: pointer;
}
.attbar__item svg { width: 14px; height: 14px; }

/* 말풍선 안의 첨부 */
.att__wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.att {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  background: var(--fill);
  color: inherit;
  text-decoration: none;
}
.bubble--me .att { background: rgba(255,255,255,0.16); }
:root[data-theme="dark"] .bubble--me .att { background: rgba(0,0,0,0.10); }
.att:active { opacity: 0.6; }
.att__icon { flex: 0 0 22px; display: grid; place-items: center; }
.att__icon svg { width: 20px; height: 20px; }
.att__body { min-width: 0; display: flex; flex-direction: column; }
.att__name {
  font-size: var(--t-subhead);
  font-weight: var(--w-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att__meta { font-size: var(--t-caption2); opacity: 0.65; }

.att--img { padding: 0; background: none; display: block; }
.att--img img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--r-md);
  object-fit: cover;
}

/* ------------------------------------------------------------
   알림 띠
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: var(--margin); right: var(--margin);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  border: 0.5px solid var(--separator);
  text-align: left;
  cursor: pointer;
  max-width: var(--content-max);
  margin: 0 auto;
  transform: translateY(-140%);
  transition: transform var(--dur) var(--ease);
}
.toast.is-open { transform: none; }
.toast__title {
  font-size: var(--t-subhead);
  font-weight: var(--w-semibold);
  color: var(--label);
}
.toast__body {
  font-size: var(--t-footnote);
  color: var(--label-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
