@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ══════════════════════════════════════════════
   파라곤 입주민 포털 — 디자인 시스템
   계산기의 골드를 밝은 배경용으로 재조정한 팔레트
   ══════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* ── 바탕 ── */
  --bg:          #f5f6f7;
  --surface:     #ffffff;
  --surface-2:   #fafbfc;
  --border:      #e2e5e9;
  --border-str:  #cfd4da;

  /* ── 글자 ── */
  --text:        #14171c;
  --text-sub:    #5a626d;
  --text-faint:  #949ba6;

  /* ── 액센트 (계산기 골드의 명도 대응값) ── */
  --gold:        #8a6d34;
  --gold-deep:   #6d5527;
  --gold-bg:     #f4efe3;
  --gold-br:     #ddd0ae;

  /* ── 의미 색 ── */
  --urgent:      #b8352f;  --urgent-bg: #fdecea;  --urgent-br: #f3c9c5;
  --warn:        #a85d17;  --warn-bg:   #fdf3e6;  --warn-br:   #f0d7b4;
  --ok:          #1f7a4d;  --ok-bg:     #e8f5ee;  --ok-br:     #bfe0cd;
  --info:        #1f5f9e;  --info-bg:   #e9f1fa;  --info-br:   #c2d8ee;

  /* ── 형태 ── */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --shadow:    0 1px 2px rgba(20,23,28,.05), 0 1px 3px rgba(20,23,28,.04);
  --shadow-md: 0 4px 12px rgba(20,23,28,.07), 0 2px 4px rgba(20,23,28,.04);
  --shadow-lg: 0 12px 32px rgba(20,23,28,.12);

  /* ── 글꼴 ── */
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --tabbar-h: 58px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

/* 숫자·날짜·코드는 모노로 — 기계가 계산한 값임을 형태로 구분 */
.mono, .amt, .date, .dday, .code {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

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

/* ══════════════ 상단바 ══════════════ */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.appbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.appbar-back {
  width: 32px; height: 32px;
  margin-left: -6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.appbar-back:hover { background: var(--bg); color: var(--text); }
.appbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.appbar-action:hover { background: var(--gold-bg); }

/* ══════════════ 페이지 컬럼 ══════════════ */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 32px;
}

.section {
  margin-bottom: 30px;
}
.section:last-child { margin-bottom: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-sub);
}
.section-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
}
.section-more:hover { color: var(--gold); }

/* ══════════════ 카드 ══════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }

.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--border); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  transition: background .12s;
}
a.row:hover, button.row:hover { background: var(--surface-2); }
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.row-chevron { color: var(--border-str); flex-shrink: 0; }

/* ══════════════ 배지 ══════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.badge-urgent { background: var(--urgent-bg); color: var(--urgent); border: 1px solid var(--urgent-br); }
.badge-warn   { background: var(--warn-bg);   color: var(--warn);   border: 1px solid var(--warn-br); }
.badge-ok     { background: var(--ok-bg);     color: var(--ok);     border: 1px solid var(--ok-br); }
.badge-info   { background: var(--info-bg);   color: var(--info);   border: 1px solid var(--info-br); }
.badge-gold   { background: var(--gold-bg);   color: var(--gold);   border: 1px solid var(--gold-br); }
.badge-mute   { background: var(--bg);        color: var(--text-faint); border: 1px solid var(--border); }

/* ══════════════ 버튼 ══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background .12s, border-color .12s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-deep); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-str); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--urgent-bg); color: var(--urgent); border-color: var(--urgent-br); }
.btn-danger:hover { background: #fbdedb; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ══════════════ 폼 ══════════════ */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-sub); }
.field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-str);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 15px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-bg);
}
.field::placeholder { color: var(--text-faint); }
textarea.field { resize: vertical; min-height: 120px; line-height: 1.7; }
.field-hint { font-size: 12px; color: var(--text-faint); }
.field-error { font-size: 12.5px; color: var(--urgent); font-weight: 600; }

/* ══════════════ 하단 탭바 ══════════════ */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: color .12s;
  position: relative;
}
.tab svg { width: 21px; height: 21px; }
.tab:hover { color: var(--text-sub); }
.tab.active { color: var(--gold); }
.tab-dot {
  position: absolute;
  top: 7px;
  left: 50%;
  margin-left: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--urgent);
  border: 1.5px solid var(--surface);
}

/* ══════════════ 빈 상태 ══════════════ */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-faint);
}
.empty-icon { font-size: 30px; margin-bottom: 10px; opacity: .55; }
.empty-text { font-size: 14px; }

/* ══════════════ 모달 ══════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20,23,28,.45);
  backdrop-filter: blur(2px);
}
.modal.show { display: flex; }
.modal-box {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: sheet-up .22s cubic-bezier(.32,.72,0,1);
}
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6; } }
@media (min-width: 561px) {
  .modal { align-items: center; padding: 20px; }
  .modal-box { border-radius: var(--r-lg); }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { flex: 1; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.4; }
.modal-x {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  font-size: 17px;
  flex-shrink: 0;
  margin: -4px -4px 0 0;
}
.modal-x:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 18px 20px 24px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.modal-foot .btn { flex: 1; }

/* 본문 텍스트 (공지 내용 등) */
.prose {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text-sub);
  white-space: pre-wrap;
  word-break: break-word;
}
.prose strong { color: var(--text); font-weight: 700; }

/* ══════════════ 토스트 ══════════════ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  background: var(--text);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ══════════════ 로딩 ══════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

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