/* ════════════════════════════════════════════════════
   기자 김연지 — 내부 운영 도구(ERP) 스타일
   3색 팔레트 + Pretendard. CLAUDE.md 디자인 시스템 준수.
════════════════════════════════════════════════════ */
:root {
  --accent: #FF4B35;
  --dark: #0a0a0a;
  --bg: #ffffff;
  --muted: #6b6b6b;
  --card: #f3f3f6;
  --line: #e6e6ea;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(10, 10, 10, .06), 0 8px 24px rgba(10, 10, 10, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--dark);
  letter-spacing: -0.02em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ── 전체 상태 화면(로딩/로그인/대기) ── */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.gate-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.gate-card .mark {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 28px;
}
.gate-card .mark b { color: var(--accent); }
.gate-card h1 { font-size: 26px; font-weight: 800; margin: 0 0 12px; }
.gate-card p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 28px; }
.gate-card .email { color: var(--dark); font-weight: 600; }

/* ── 버튼 ── */
.btn {
  border: 1px solid var(--dark);
  background: var(--dark);
  color: #fff;
  padding: 13px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { opacity: .9; }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--dark); border-color: var(--line); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--accent); border-color: var(--accent); }

/* ── 앱 레이아웃 ── */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .brand { font-size: 18px; font-weight: 800; padding: 0 10px 24px; }
.sidebar .brand b { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  text-decoration: none; color: var(--muted);
  font-size: 15px; font-weight: 600;
}
.nav a:hover { background: var(--card); color: var(--dark); }
.nav a.active { background: var(--dark); color: #fff; }
.nav a .ic { width: 18px; text-align: center; }
.sidebar .foot { margin-top: auto; padding: 12px 10px 0; font-size: 13px; color: var(--muted); }
.sidebar .foot .who { font-weight: 600; color: var(--dark); }
.sidebar .foot button { margin-top: 10px; background: none; border: none; color: var(--muted); padding: 0; font-size: 13px; }
.sidebar .foot button:hover { color: var(--accent); }

.main { padding: 36px 44px; max-width: 1100px; }
.view { display: none; }
.view.active { display: block; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 28px; font-weight: 800; margin: 0; }
.page-head h2 .bar { color: var(--accent); margin-right: 8px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; }

/* ── 카드/통계 ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 22px 20px;
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -0.03em; }
.stat .value.accent { color: var(--accent); }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel h3 { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.panel h3 .bar { color: var(--accent); margin-right: 6px; }

/* ── 테이블 ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card); color: var(--muted); }
.amount.income { color: #0a0a0a; font-weight: 700; }
.amount.expense { color: var(--accent); font-weight: 700; }
.row-actions button { background: none; border: none; color: var(--muted); font-size: 13px; padding: 2px 6px; }
.row-actions button:hover { color: var(--accent); }

/* ── 폼 ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-items: end; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--dark);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--dark); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; }

/* ── 칸반 ── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--card); border-radius: var(--radius); padding: 14px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-weight: 700; font-size: 14px; }
.col-head .count { color: var(--muted); font-size: 12px; font-weight: 600; }
.col-list { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard .t { font-weight: 600; font-size: 14px; }
.kcard .meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kcard .due.soon { color: var(--accent); font-weight: 600; }
.sortable-ghost { opacity: .4; }

/* ── 타임라인 ── */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl-row .tl-title { font-weight: 600; font-size: 14px; }
.tl-row .tl-bar-wrap { position: relative; height: 24px; background: var(--card); border-radius: 999px; }
.tl-row .tl-bar { position: absolute; height: 24px; border-radius: 999px; background: var(--dark); }
.tl-row .tl-bar.accent { background: var(--accent); }

/* ── 캘린더 ── */
.cal-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.cal-empty p { margin: 4px 0; }

/* ── 일정 아젠다 ── */
.agenda { display: flex; flex-direction: column; gap: 22px; }
.agenda-day { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.agenda-date { font-weight: 700; font-size: 14px; color: var(--dark); padding-top: 6px; }
.agenda-item { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.agenda-item:last-child { border-bottom: none; }
.agenda-time { min-width: 56px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.agenda-title { font-weight: 600; }
.agenda-loc { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .agenda-day { grid-template-columns: 1fr; gap: 6px; }
}

/* ── 월별 그리드 ── */
.viewtoggle { display: inline-flex; gap: 4px; }
.cal-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cal-month-label { font-weight: 800; font-size: 18px; min-width: 130px; text-align: center; letter-spacing: -0.03em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-wd { padding: 8px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--card); }
.cal-wd.sun, .cal-daynum.sun { color: var(--accent); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 6px 8px; overflow: hidden; }
.cal-cell.dim { background: #fafafb; }
.cal-cell.dim .cal-daynum { color: #c4c4cc; }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--dark); display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-bottom: 4px; }
.cal-cell.today .cal-daynum { background: var(--accent); color: #fff; border-radius: 999px; }
.cal-ev { font-size: 11px; line-height: 1.5; background: var(--card); border-radius: 5px; padding: 1px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.cal-ev .t { color: var(--accent); font-weight: 700; }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 3px; }
@media (max-width: 640px) {
  .cal-cell { min-height: 64px; }
  .cal-ev { font-size: 10px; }
}

/* ── 멤버 관리 ── */
.member-row .st { font-weight: 600; }
.member-row .st.approved { color: #0a0a0a; }
.member-row .st.pending { color: var(--accent); }

/* ── 모달 ── */
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,10,.4); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 28px; max-width: 460px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 18px; font-size: 18px; }
.modal .form-grid { grid-template-columns: 1fr 1fr; }
.modal .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ── 토스트/메시지 ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 60; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); font-size: 14px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0 10px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 24px 18px; }
}
