/* =============================================================================
 * app.css — 청산포털 화면 스타일
 * 규칙: 넓은 면은 화이트/뉴트럴(--bg-secondary)+1px 보더, 보라(#49317B)는
 *       활성/아이콘/버튼/숫자 강조 등 작은 면적에만. 위계는 여백·타이포·보더로.
 * ========================================================================== */
:root { --side-w: 264px; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg-secondary); color: var(--text-primary);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }
.muted { color: var(--text-tertiary); font-size: 13px; font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* ── 앱 셸 ───────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  background: var(--surface-default); border-right: 1px solid var(--border-default);
  display: flex; flex-direction: column; gap: 2px; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side__logo { padding: 6px 10px 2px; }
.side__logo img { height: 20px; width: auto; display: block; }
.side__portal {
  padding: 0 10px 18px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--mira-brand-primary);
}
.side__group {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--text-tertiary);
  text-transform: uppercase; padding: 12px 10px 6px;
}
.nav {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 600;
  border-left: 3px solid transparent; transition: background .15s, color .15s;
}
.nav:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nav--active { color: var(--mira-brand-primary); border-left-color: var(--mira-brand-primary); background: var(--bg-secondary); }
.nav__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__pct { font-size: 11px; font-weight: 700; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.side__foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px;
  border-top: 1px solid var(--border-subtle);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--mira-brand-primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex: none;
}
.side__me { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side__me b { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__me span { font-size: 11px; color: var(--text-tertiary); }
.iconbtn {
  width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--surface-default); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.iconbtn:hover { background: var(--bg-secondary); color: var(--mira-brand-primary); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 32px; background: var(--surface-default); border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; z-index: 5;
}
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-secondary); font-weight: 600; }
.crumb__sep { color: var(--text-disabled); }
.crumb__i:last-child { color: var(--text-primary); }
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: var(--mira-brand-primary); background: var(--bg-secondary); border: 1px solid var(--border-default);
  padding: 6px 12px; border-radius: var(--radius-pill);
}
.sync-chip .ic { width: 15px; height: 15px; }
.content { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; max-width: 1240px; }

.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--text-tertiary); font-size: 14px; }

/* ── 패널 ────────────────────────────────────────────────────────── */
.panel { background: var(--surface-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border-subtle); }
.panel__head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel__head h3 .ic { width: 18px; height: 18px; color: var(--mira-brand-primary); }

/* ── 로그인 ──────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 40px 20px; }
.auth__card {
  width: 100%; max-width: 420px; background: var(--surface-default); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md); padding: 40px 36px; text-align: center;
}
.auth__logo { height: 24px; width: auto; }
.auth__portal { margin-top: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--mira-brand-primary); }
.auth__title { margin: 18px 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.auth__sub { margin: 0 0 22px; font-size: 13.5px; line-height: 1.6; color: var(--text-tertiary); }
.auth__form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth__form .mira-btn { justify-content: center; gap: 8px; }
.auth__msg { margin-top: 16px; font-size: 13px; line-height: 1.55; border-radius: var(--radius-md); display: none; text-align: left; }
.auth__msg.is-err, .auth__msg.is-ok { display: flex; gap: 10px; padding: 14px; }
.auth__msg .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.auth__msg.is-err { background: #FBEEEE; color: var(--text-danger); border: 1px solid #F0D4D4; }
.auth__msg.is-ok { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border-default); flex-direction: column; }
.auth__msg.is-ok > .ic { color: var(--text-success); }
.auth__msg.is-ok b { color: var(--text-primary); display: block; }
.auth__msg.is-ok span { display: block; margin-top: 4px; color: var(--text-tertiary); font-size: 12.5px; }
.auth__hint { margin-top: 20px; font-size: 12px; color: var(--text-tertiary); }
.auth__hint code { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: var(--text-secondary); }
/* 미라 직원 — 회사 구글 계정(GWS) 로그인 */
.auth__sep { margin: 24px 0 14px; display: flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); }
.auth__sep::before, .auth__sep::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }
.auth__gws {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--surface-default); border: 1px solid var(--border-default); color: var(--text-primary);
  font-size: 13.5px; font-weight: 700; padding: 11px; border-radius: var(--radius-md); cursor: pointer; font-family: inherit;
}
.auth__gws:hover { background: var(--bg-secondary); border-color: var(--border-strong); }
.gws-g {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: conic-gradient(#EA4335 0 25%, #FBBC05 0 50%, #34A853 0 75%, #4285F4 0);
}
.auth__gwsnote { margin-top: 8px; font-size: 11.5px; color: var(--text-tertiary); line-height: 1.5; }
.auth__foot { font-size: 12px; color: var(--text-tertiary); }

/* ── 조합 목록 카드 ──────────────────────────────────────────────── */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.fcard {
  background: var(--surface-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: box-shadow .15s, border-color .15s, transform .1s;
}
.fcard:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-2px); }
.fcard__top { display: flex; align-items: center; justify-content: space-between; }
.fcard__code { font-size: 12px; font-weight: 700; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.fcard__name { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.fcard__meta { font-size: 12.5px; color: var(--text-tertiary); }
.fcard__foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.fcard__foot .ic { width: 14px; height: 14px; }

/* progress bar */
.prog { display: flex; flex-direction: column; gap: 7px; }
.prog__bar { height: 8px; background: var(--bg-tertiary); border-radius: var(--radius-pill); overflow: hidden; }
.prog__bar span { display: block; height: 100%; background: var(--mira-brand-primary); border-radius: var(--radius-pill); }
.prog__row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.prog__row span { color: var(--text-secondary); font-weight: 600; }
.prog__row b { color: var(--mira-brand-primary); font-variant-numeric: tabular-nums; }

/* ── 대시보드 헤더 ───────────────────────────────────────────────── */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.dash-head__code { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-tertiary); }
.dash-head__code .ic { width: 16px; height: 16px; color: var(--mira-brand-primary); }
.dash-head h1 { margin: 8px 0 6px; font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.dash-head p { margin: 0; font-size: 13px; color: var(--text-tertiary); }
.dash-head__prog { display: flex; align-items: center; gap: 16px; }
.dash-head__prog-c { display: flex; flex-direction: column; }
.dash-head__prog-c b { font-size: 15px; font-variant-numeric: tabular-nums; }
.dash-head__prog-c span { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.ring {
  --p: 0; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--mira-brand-primary) calc(var(--p) * 1%), var(--bg-tertiary) 0);
}
.ring span {
  width: 56px; height: 56px; border-radius: 50%; background: var(--surface-default);
  display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--mira-brand-primary); font-variant-numeric: tabular-nums;
}

/* ── 단계 트랙 ───────────────────────────────────────────────────── */
.track { display: flex; align-items: stretch; gap: 6px; padding: 20px; overflow-x: auto; }
.track__seg { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; min-width: 190px; background: var(--bg-secondary); }
.track__seg-h { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 10px; }
.track__pills { display: flex; flex-direction: column; gap: 7px; }
.track__arrow { display: flex; align-items: center; color: var(--text-disabled); }
.track__arrow .ic { width: 18px; height: 18px; }
.pill {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; line-height: 1.35;
  padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface-default); color: var(--text-secondary);
}
.pill__ic { width: 14px; height: 14px; flex: none; }
.pill.is-done { color: var(--mira-brand-primary); border-color: var(--border-brand); }
.pill.is-done .pill__ic { color: var(--mira-brand-primary); }
.pill.is-ing {
  color: #fff; background: var(--mira-brand-primary); border-color: var(--mira-brand-primary); font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.pill.is-wait { color: var(--text-tertiary); border-style: dashed; }

/* ── 카테고리 탭 ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 2단 레이아웃 ────────────────────────────────────────────────── */
.cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* 미팅 */
.meet-list { display: flex; flex-direction: column; }
.meet { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.meet:last-child { border-bottom: none; }
.meet.is-soon { background: var(--bg-secondary); }
.meet__b { min-width: 0; }
.meet__t { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meet__c { font-size: 13px; color: var(--text-secondary); margin: 3px 0 6px; line-height: 1.5; }
.meet__a { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); }
.meet__a .ic { width: 14px; height: 14px; }

/* 타임라인 */
.timeline { padding: 8px 18px 14px; }
.tl { display: grid; grid-template-columns: 74px 16px 1fr; gap: 0; }
.tl__date { font-size: 12px; font-weight: 700; color: var(--text-tertiary); padding-top: 14px; font-variant-numeric: tabular-nums; text-align: right; padding-right: 12px; }
.tl__dot { position: relative; }
.tl__dot::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--border-subtle); transform: translateX(-50%); }
.tl__dot::after { content: ""; position: absolute; left: 50%; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--mira-brand-primary); border: 2px solid var(--surface-default); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--border-subtle); }
.tl:first-child .tl__dot::before { top: 14px; }
.tl:last-child .tl__dot::before { bottom: auto; height: 14px; }
.tl__b { padding: 12px 0 16px 6px; min-width: 0; }
.tl__h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl__h b { font-size: 14px; font-weight: 700; }
.tl__b p { margin: 6px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.tl__att { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tl__att a { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--mira-brand-primary); border: 1px solid var(--border-brand); border-radius: var(--radius-sm); padding: 4px 9px; }
.tl__att a:hover { background: var(--bg-secondary); }
.tl__att-ic { width: 14px; height: 14px; }
.tl__foot { margin-top: 8px; font-size: 11.5px; color: var(--text-tertiary); }

/* 문서함 */
.doclist { display: flex; flex-direction: column; padding: 6px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-md); color: var(--text-secondary); }
.doc:hover { background: var(--bg-secondary); }
.doc .ic { width: 18px; height: 18px; color: var(--mira-brand-primary); }
.doc__n { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc__dl { color: var(--text-tertiary) !important; width: 16px !important; height: 16px !important; }

/* ── KPI (관리) ──────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--surface-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { font-size: 12.5px; color: var(--text-tertiary); font-weight: 600; }
.kpi__icon { width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: center; color: var(--mira-brand-primary); flex: none; }
.kpi__icon .ic { width: 18px; height: 18px; }
.kpi__value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* ── 관리 표/노트 ────────────────────────────────────────────────── */
.admin-note { display: flex; gap: 12px; padding: 14px 16px; background: var(--bg-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-md); font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.admin-note .ic { width: 18px; height: 18px; color: var(--mira-brand-primary); flex: none; margin-top: 1px; }
.admin-note b { color: var(--text-primary); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-tertiary); padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); }
.tbl td { padding: 13px 18px; font-size: 13.5px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-secondary); }

/* 재무성 표 — 금액 우측정렬·합계행·손익 색 */
.tbl-wrap { overflow-x: auto; }
.tbl th.n, .tbl td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.trow-total td { font-weight: 700; background: var(--bg-secondary); border-top: 1px solid var(--border-default); }
.tbl tr.trow-total:hover td { background: var(--bg-secondary); }
.pl-pos { color: var(--text-success); }
.pl-neg { color: var(--text-danger); }
.meet__title { font-size: 13.5px; font-weight: 700; margin: 2px 0 0; }

/* ── 빈 상태 ─────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 80px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ic { width: 40px; height: 40px; color: var(--text-disabled); }
.empty h2 { margin: 8px 0 0; font-size: 18px; }
.empty p { margin: 0 0 16px; color: var(--text-tertiary); font-size: 14px; }

/* ── 반응형 ──────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .cols { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 20px; }
  .topbar { padding: 14px 20px; }
}

/* ── 상단바 우측 · 리포트 출력 버튼 ──────────────────────────────── */
.topbar__right { display: flex; align-items: center; gap: 10px; }
.rep-open {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  color: #fff; background: var(--mira-brand-primary); border: 1px solid var(--mira-brand-primary);
  border-radius: var(--radius-pill); padding: 7px 14px; cursor: pointer;
}
.rep-open:hover { background: var(--mira-brand-primary-strong); }
.rep-open .ic { width: 15px; height: 15px; }

/* ── 리포트 (인쇄 / PDF 저장) ────────────────────────────────────── */
.rep-tools {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--surface-default); border-bottom: 1px solid var(--border-default);
}
.report {
  max-width: 820px; margin: 24px auto 60px; background: #fff; color: #171719;
  padding: 40px 44px; border: 1px solid var(--border-default); border-radius: 8px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rep-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 2px solid var(--mira-brand-primary); }
.rep-logo { height: 22px; width: auto; }
.rep-h-t { display: flex; flex-direction: column; }
.rep-h-t b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.rep-h-t span { font-size: 11.5px; color: #70737C; margin-top: 2px; }
.rep-h-d { margin-left: auto; font-size: 11.5px; color: #70737C; font-variant-numeric: tabular-nums; }
.rep-title { margin: 22px 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.rep-meta { font-size: 12px; color: #5A5C63; line-height: 1.6; }
.rep-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 6px; }
.rep-box { border: 1px solid var(--border-default); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.rep-box-l { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #70737C; }
.rep-box-v { font-size: 16px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.rep-box-s { font-size: 11px; color: #70737C; font-variant-numeric: tabular-nums; }
.rep-sec { margin-top: 26px; }
.rep-sec-h { font-size: 14px; font-weight: 800; margin: 0 0 8px; padding-left: 9px; border-left: 3px solid var(--mira-brand-primary); }
.rtbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rtbl th { text-align: left; background: var(--bg-secondary); color: #5A5C63; font-weight: 700; font-size: 10.5px; padding: 7px 9px; border: 1px solid var(--border-default); }
.rtbl td { padding: 6px 9px; border: 1px solid var(--border-subtle); vertical-align: top; }
.rtbl .rc { text-align: center; white-space: nowrap; }
.rtbl .rn { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rtbl .rsm { font-size: 10.5px; color: #5A5C63; }
.rtbl .rsub { font-size: 10.5px; color: #5A5C63; margin-top: 2px; line-height: 1.5; }
.rtbl tr.rtot td { font-weight: 800; background: var(--bg-secondary); }
.rtbl .st-is-done { color: var(--mira-brand-primary); font-weight: 700; }
.rtbl .st-is-ing { color: #9C5800; font-weight: 800; }
.rtbl .st-is-wait { color: #989BA2; }
.rep-foot { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--border-default); font-size: 10.5px; color: #70737C; line-height: 1.6; }
@media (max-width: 720px) { .rep-sum { grid-template-columns: 1fr 1fr; } .report { padding: 24px 18px; } }

@media print {
  .rep-tools { display: none !important; }
  body { background: #fff !important; }
  .report { margin: 0; border: none; border-radius: 0; max-width: none; padding: 0; }
  .rep-sec { break-inside: auto; }
  .rtbl thead { display: table-header-group; }
  .rtbl tr { break-inside: avoid; }
  @page { size: A4; margin: 14mm; }
}
