/* ===================================================================
   RE:MATE 웹 — 디자인 시스템
   색은 앱(lib/theme.dart)의 AppColors 를 그대로 옮겨, 웹과 앱이
   한 제품으로 보이게 한다. 장식(글로우·그라데이션)은 쓰지 않고
   여백·괘선·활자 위계로만 구조를 만든다.
   =================================================================== */

:root {
  /* 앱과 동일한 값 */
  --primary:      #2450A8;
  --primary-dark: #1A3C80;
  --primary-soft: #EDF1FA;
  --ink:          #191D26;
  --sub:          #6A7181;
  --line:         #E5E8EF;
  --bg:           #F6F7FA;
  --card:         #FFFFFF;
  --danger:       #C73E4E;
  --danger-soft:  #FBEDEF;
  --ok:           #1E7F53;
  --ok-soft:      #E9F5EF;

  /* 어두운 화면용 (운영자 도구·헤더) */
  --dark:      #12161F;
  --dark-2:    #191E2A;
  --dark-3:    #212836;
  --dark-line: #2C3444;
  --dark-text: #E8EBF2;
  --dark-sub:  #939BAE;

  /* 의미 토큰 */
  --surface:   var(--card);
  --surface-2: #FAFBFD;
  --text:      var(--ink);
  --text-dim:  var(--sub);
  --border:    var(--line);
  --accent:    var(--primary);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --gutter: clamp(18px, 4vw, 40px);
  --maxw: 1120px;
  --measure: 60ch;

  --sans: "Pretendard", -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
          system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0F131C;
    --surface:    #171C27;
    --surface-2:  #1C2230;
    --text:       #E8EBF2;
    --text-dim:   #949CAF;
    --border:     #272E3D;
    --accent:     #6D93E4;
    --primary-soft: #1B2438;
    --ok-soft:    #14291F;
    --danger-soft:#2B181C;
    --card:       #171C27;
  }
}
:root[data-theme="dark"] {
  --bg: #0F131C; --surface: #171C27; --surface-2: #1C2230;
  --text: #E8EBF2; --text-dim: #949CAF; --border: #272E3D;
  --accent: #6D93E4; --primary-soft: #1B2438;
  --ok-soft: #14291F; --danger-soft: #2B181C; --card: #171C27;
}
:root[data-theme="light"] {
  --bg: #F6F7FA; --surface: #FFFFFF; --surface-2: #FAFBFD;
  --text: #191D26; --text-dim: #6A7181; --border: #E5E8EF;
  --accent: #2450A8; --primary-soft: #EDF1FA;
  --ok-soft: #E9F5EF; --danger-soft: #FBEDEF; --card: #FFFFFF;
}

/* ─── 기본 ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.62;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;      /* 한국어는 어절 단위로 끊는다 */
  overflow-wrap: break-word;
}

h1,h2,h3,h4 {
  margin: 0; font-weight: 700;
  letter-spacing: -0.028em; line-height: 1.28;
  word-break: keep-all;
}
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

:where(a,button,input,select,textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* ─── 레이아웃 ─────────────────────────────────────────────── */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 640px; margin-inline: auto; padding-inline: var(--gutter); }

.stack { display: flex; flex-direction: column; }
.g2{gap:8px}.g3{gap:12px}.g4{gap:16px}.g5{gap:24px}.g6{gap:32px}.g7{gap:48px}

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); }

.sec { padding-block: clamp(44px, 6vw, 76px); }

/* ─── 활자 ─────────────────────────────────────────────────── */
.t-xl { font-size: clamp(1.85rem, 4.2vw, 2.9rem); font-weight: 800; letter-spacing: -0.038em; line-height: 1.16; }
.t-lg { font-size: clamp(1.32rem, 2.6vw, 1.7rem); font-weight: 750; letter-spacing: -0.032em; }
.t-md { font-size: 1.04rem; font-weight: 700; letter-spacing: -0.022em; }
.t-sm { font-size: .93rem; }

.lede { font-size: 1.02rem; color: var(--text-dim); line-height: 1.75; max-width: var(--measure); }
.body { font-size: .94rem; color: var(--text-dim); line-height: 1.75; max-width: var(--measure); }
.small{ font-size: .83rem; color: var(--text-dim); line-height: 1.6; }
.tiny { font-size: .76rem; color: var(--text-dim); }

.n { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.strong { color: var(--text); font-weight: 700; }

/* 상단 라벨은 섹션을 분류할 때만 쓴다 (남발 금지) */
.kicker {
  font-size: .76rem; font-weight: 700; letter-spacing: .02em;
  color: var(--text-dim);
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ─── 로고 ─────────────────────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 9px; }
.logo img {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  border: 1px solid rgba(0,0,0,.06);
}
.logo b { font-size: 1rem; font-weight: 800; letter-spacing: -0.04em; }
.logo b i { font-style: normal; color: var(--accent); }
.logo--dark b { color: #fff; }
.logo--dark b i { color: #93A9DA; }

/* ─── 버튼 ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font: inherit; font-size: .92rem; font-weight: 650;
  letter-spacing: -0.018em;
  cursor: pointer; white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 22px; font-size: .97rem; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
@media (prefers-color-scheme: dark) { .btn--primary { color: #0F131C; } }
:root[data-theme="dark"] .btn--primary { color: #0F131C; }
:root[data-theme="light"] .btn--primary { color: #fff; }

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--text-dim); }

.btn--onDark { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }
.btn--onDark:hover { background: rgba(255,255,255,.14); }

.btn--danger { background: var(--danger-soft); color: var(--danger); }

/* ─── 면 ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: clamp(20px, 3vw, 30px);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-sm);
  font-size: .77rem; font-weight: 650;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.tag--pri { background: var(--primary-soft); border-color: transparent; color: var(--accent); }
.tag--ok  { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tag--dan { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.stack > .tag, .stack > .kicker { align-self: flex-start; }

hr.rule { height:1px; background: var(--border); border:0; margin:0; }

/* ─── 폼 ───────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: .84rem; font-weight: 650; }
.hint { font-size: .79rem; color: var(--text-dim); }

.input, .textarea, .select {
  font: inherit; font-size: .95rem;
  padding: 11px 13px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color .14s ease;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--text-dim) 60%, transparent); }

.input--code {
  text-align: center; font-size: 1.32rem; font-weight: 700;
  letter-spacing: .3em; text-indent: .3em;
  font-variant-numeric: tabular-nums; padding-block: 15px;
}

.switch {
  position: relative; width: 42px; height: 24px; flex: none;
  border-radius: 999px; border: none; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--text-dim) 32%, transparent);
  transition: background .16s ease;
}
.switch::after {
  content:""; position:absolute; top:3px; left:3px;
  width:18px; height:18px; border-radius:999px; background:#fff;
  transition: transform .18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* ─── 목록 · 표 ────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; }
.rows > * { padding-block: 12px; border-bottom: 1px solid var(--border); }
.rows > *:last-child { border-bottom: 0; }

.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: .9rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
th { font-size: .77rem; font-weight: 650; color: var(--text-dim); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

/* ─── 지표 ─────────────────────────────────────────────────── */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b {
  font-size: clamp(1.4rem, 2.6vw, 1.75rem); font-weight: 750;
  letter-spacing: -.035em; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.stat b em { font-style: normal; font-size: .92rem; font-weight: 650; margin-left: 1px; }
.stat span { font-size: .82rem; font-weight: 600; }
.stat small { font-size: .75rem; color: var(--text-dim); }

.bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar > i { display:block; height:100%; border-radius:3px; background: var(--accent); }

/* ─── 알림 ─────────────────────────────────────────────────── */
.msg { font-size: .87rem; padding: 11px 13px; border-radius: var(--r); display: none; }
.msg[data-on="true"] { display: block; }
.msg--err { background: var(--danger-soft); color: var(--danger); }
.msg--ok  { background: var(--ok-soft); color: var(--ok); }

.note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 13px 15px;
}

/* ─── 공용 헤더 ────────────────────────────────────────────── */
.head {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 40;
}
.head__in { display:flex; align-items:center; justify-content:space-between; gap:16px; height:60px; }
.head__nav { display:flex; gap:20px; font-size:.89rem; font-weight:600; color: var(--text-dim); }
.head__nav a:hover { color: var(--text); }
.head__nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 820px) { .head__nav { display:none; } }

/* 운영자 화면은 어두운 크롬으로 개인 화면과 확실히 구분한다 */
.head--op { background: var(--dark); border-bottom-color: var(--dark-line); }
.head--op .head__nav { color: var(--dark-sub); }
.head--op .head__nav a:hover, .head--op .head__nav a[aria-current="page"] { color: #fff; }
.head--op .btn--ghost { color: var(--dark-text); border-color: var(--dark-line); }
.head--op .btn--ghost:hover { background: var(--dark-3); }

.foot { border-top: 1px solid var(--border); padding-block: 26px 40px; margin-top: 60px; }
.foot__nav { display:flex; gap:18px; flex-wrap:wrap; font-size:.85rem; color: var(--text-dim); }
.foot__nav a:hover { color: var(--text); }

.hide { display: none !important; }
