/* HCMG ERP — 교회 연합 재정 시스템. 차분하고 신뢰감 있는 톤(회사 대시보드 느낌 지양), 360px 모바일 우선 반응형. */
:root {
  --navy: #1B3168; --navy-dark: #142450; --navy-tint: #eef1f8;
  --ink: #1f2937; --muted: #6b7280; --line: #e2e5ea; --bg: #f5f6f8;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --err: #b91c1c; --err-bg: #fee2e2;
  --focus: #2563eb;
  --radius: 10px;
  --topbar-h: 56px; --bottomnav-h: 60px; --actbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #3b5aa6; --navy-dark: #1B3168; --navy-tint: #1a2540;
    --ink: #e5e7eb; --muted: #9aa3b2; --line: #2a3040; --bg: #12151c;
    --ok: #4ade80; --ok-bg: #103322; --warn: #fbbf24; --warn-bg: #3a2a0c; --err: #f87171; --err-bg: #3a1414;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--navy); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px;
}
.muted { color: var(--muted); font-size: 0.9em; }
.inline { display: inline; }
button.link, .link-reset { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; }
button.link { text-decoration: underline; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 100; border-radius: 0 0 6px 0; }
.skip-link:focus { left: 0; }
ul, ol { word-break: keep-all; }

/* ============ 상단바 ============ */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  background: var(--navy-dark); color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.hamburger { display: none; background: none; border: 0; padding: 8px; margin: -8px 0 -8px -6px; cursor: pointer; }
.hamburger span { display: block; width: 20px; height: 2px; background: #fff; margin: 4px 0; border-radius: 1px; }
.brand { color: #fff; font-weight: 700; font-size: 1.05em; text-decoration: none; letter-spacing: 0.2px; white-space: nowrap; }
.topbar-ledger { display: flex; align-items: center; gap: 8px; font-size: 0.88em; background: rgba(255,255,255,0.12); border-radius: 999px; padding: 5px 12px 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-ledger .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.topbar-ledger-ent { color: rgba(255,255,255,0.75); }
.topbar-ledger-ent::before { content: " · "; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-link { position: relative; color: #fff; text-decoration: none; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; }
.icon-link:hover, .icon-link:focus-visible { background: rgba(255,255,255,0.14); }
.badge { background: #dc2626; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 0.72em; font-weight: 700; line-height: 1.5; }
.badge-dot { position: absolute; top: 2px; right: 2px; min-width: 16px; text-align: center; }

/* ============ 레이아웃: 데스크톱 사이드바 / 모바일 하단탭 ============ */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidenav {
  width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 8px; gap: 2px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidenav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 0.96em; position: relative;
}
.sidenav-item svg { flex: none; color: var(--muted); }
.sidenav-item:hover { background: var(--navy-tint); }
.sidenav-item[data-nav-active], .sidenav-item.active { background: var(--navy-tint); color: var(--navy); font-weight: 600; }
.sidenav-item[data-nav-active] svg, .sidenav-item.active svg { color: var(--navy); }
.sidenav-badge { margin-left: auto; }
.sidenav-sep { border-top: 1px solid var(--line); margin: 8px 4px; }
.sidenav-logout button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font-size: 0.96em; color: var(--ink); }
.sidenav-scrim { display: none; }
.page { flex: 1; min-width: 0; max-width: 1100px; margin: 0 auto; padding: 20px 20px 32px; width: 100%; }
.page-title { font-size: 1.35em; margin: 0 0 16px; color: var(--navy-dark); }
.bottomnav { display: none; }

@media (max-width: 880px) {
  .hamburger { display: block; }
  .sidenav {
    position: fixed; left: 0; top: 0; height: 100%; z-index: 60; width: 260px; max-width: 82vw;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    padding-top: calc(var(--topbar-h) + 12px);
  }
  .sidenav.open { transform: translateX(0); }
  .sidenav-scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 55; }
  .page { padding: 14px 14px calc(var(--bottomnav-h) + 20px); }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottomnav-h); z-index: 40;
    background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  }
  .bottomnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 0.72em; padding: 6px 0; position: relative; min-height: 44px;
  }
  .bottomnav-item svg { color: var(--muted); }
  .bottomnav-item[data-nav-active] { color: var(--navy); font-weight: 600; }
  .bottomnav-item[data-nav-active] svg { color: var(--navy); }
  .bottomnav-badge { position: absolute; top: 2px; right: 22%; margin-left: 0; }
  body:has(.actbar) .bottomnav { display: none; }
}
@media (min-width: 881px) {
  .topbar-ledger-ent { display: inline; }
}

/* ============ 카드·타일·그리드 ============ */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 1.05em; margin: 0 0 14px; color: var(--navy-dark); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; min-height: 44px; }
.tile:hover, .tile:focus-visible { border-color: var(--navy); box-shadow: 0 2px 8px rgba(27,49,104,0.08); }
.tile strong { display: block; color: var(--navy-dark); margin-bottom: 4px; font-size: 1.02em; }
.tile-note { cursor: default; background: #f8fafc; }
.tile-note:hover { border-color: var(--line); box-shadow: none; }
.section-head { font-size: 0.95em; color: var(--muted); font-weight: 700; margin: 20px 0 10px; text-transform: none; }
.section-head:first-child { margin-top: 0; }
.ledger-tile-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.home-recent-list { list-style: none; padding: 0; margin: 0; }
.home-recent-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.home-recent-list li:last-child { border-bottom: 0; }
.home-recent-list li > a { flex: 1; min-width: 140px; }
.home-recent-list form { margin: 0; }

/* ============ 폼 ============ */
.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-row label { font-weight: 600; font-size: 0.92em; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=password], .form-row input[type=number], .form-row input[type=datetime-local],
.form-row select, .form-row textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); min-height: 44px; }
.form-row textarea { min-height: 80px; }
.form-row.has-error input, .form-row.has-error select, .form-row.has-error textarea { border-color: var(--err); background: var(--err-bg); }
.field-error { color: var(--err); font-size: 0.85em; font-weight: 600; }
.help { color: var(--muted); font-size: 0.85em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--navy-tint); }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.danger:hover { background: #991b1b; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.85em; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-camera { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 12px 20px; font-size: 1.02em; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.93em; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
table.list th { background: #f8fafc; font-weight: 600; color: var(--ink); }
table.list.sticky-head thead th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 var(--line); }
.masked { color: var(--muted); font-style: italic; }
.masked::after { content: " (마스킹)"; font-size: 0.85em; }
table.list td.wrap, table.list th.wrap { white-space: normal; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tfoot th, table.list tr.total-row td, table.list tr.total-row th { background: var(--navy-tint); font-weight: 700; }

/* 상태 배지 */
.status { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.83em; font-weight: 600; background: #eef2ff; color: var(--navy); white-space: nowrap; }
.status.off { background: #f3f4f6; color: var(--muted); }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.err { background: var(--err-bg); color: var(--err); }

/* 메시지·빈 상태 */
.msg { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; font-size: 0.95em; }
.msg.err { background: var(--err-bg); color: var(--err); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.info { background: var(--navy-tint); color: var(--navy-dark); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state svg { color: var(--line); margin-bottom: 12px; }
.empty-state p { margin: 0; }

/* 권한 매트릭스 */
.matrix { font-size: 0.85em; }
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 8px 5px; }
.matrix td.cell { text-align: center; cursor: default; }
.cell-g { background: var(--ok-bg); font-weight: 700; color: var(--ok); }
.cell-i { background: var(--navy-tint); color: var(--navy); }
.matrix td.scope { white-space: nowrap; }
.matrix .scope-head { position: sticky; left: 0; background: #fff; z-index: 2; }
.matrix thead .scope-head { background: #f8fafc; z-index: 3; }
.indent-1 { padding-left: 22px !important; }
.indent-2 { padding-left: 38px !important; }
.indent-3 { padding-left: 54px !important; }

/* ============ 인증 화면 ============ */
.auth-body { background: linear-gradient(160deg, var(--navy-dark), var(--navy)); min-height: 100vh; display: flex; }
.auth-card { max-width: 420px; width: 100%; margin: auto; background: #fff; border-radius: 14px; padding: 32px 26px; box-shadow: 0 12px 32px rgba(0,0,0,0.25); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 700; }
.brand-title { font-size: 1.2em; margin: 0; color: var(--navy-dark); }
.auth-card .page-title { font-size: 1.1em; margin: 4px 0 18px; color: var(--ink); }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 0.9em; gap: 12px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .auth-card { margin: 16px; padding: 24px 20px; }
  table.list th, table.list td { padding: 7px 8px; }
}

/* 전표 폼: 장부 재확인 배너의 점, 줄 카드형 입력(모바일 세로 스택 → 데스크톱 2열) */
.ledger-recheck .dot, .save-recheck .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.save-recheck { border: 1px solid var(--navy); }
.line-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.line-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; }
.line-card legend { font-weight: 700; color: var(--navy-dark); padding: 0 4px; font-size: 0.9em; }
.line-card .form-row { margin-bottom: 10px; }
.line-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.account-help { margin-top: -2px; margin-bottom: 6px; }
@media (min-width: 700px) {
  .line-grid { grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
  .line-memo { grid-column: 1 / -1; }
}

/* 재정 화면 보조 */
.print-head { display: none; }
input[type=date], input[type=month], input[type=number], input[type=file] { padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; max-width: 100%; min-height: 44px; }
.actions select, .actions input[type=text] { padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; max-width: 100%; min-height: 44px; }

/* 필터: 모바일 접기/펼치기 */
.filter-card { padding: 14px 16px; }
.filter-toggle { display: none; }
.filter-body { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
@media (max-width: 700px) {
  .filter-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0;
    padding: 4px 0; font: inherit; font-weight: 600; color: var(--navy-dark); cursor: pointer; min-height: 44px;
  }
  .filter-toggle .chev { transition: transform 0.15s; }
  .filter-card.open .filter-toggle .chev { transform: rotate(180deg); }
  .filter-body { display: none; flex-direction: column; align-items: stretch; margin-top: 10px; }
  .filter-card.open .filter-body { display: flex; }
  .filter-body select, .filter-body input, .filter-body .btn, .filter-body a.btn { width: 100%; }
}

/* 목록: 모바일에서 표 → 카드 전환 (data-label로 헤더 표시) */
@media (max-width: 700px) {
  table.list.responsive-cards thead { position: absolute; left: -9999px; top: -9999px; }
  table.list.responsive-cards, table.list.responsive-cards tbody, table.list.responsive-cards tr, table.list.responsive-cards td { display: block; width: 100%; }
  table.list.responsive-cards tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 12px; background: #fff; }
  table.list.responsive-cards td { border-bottom: 1px solid var(--line); padding: 8px 0; white-space: normal; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; text-align: right; }
  table.list.responsive-cards td:last-child { border-bottom: 0; }
  table.list.responsive-cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; flex: none; }
}

/* ============ 인쇄: 보고서 본문만, 머리글(장부·기간·출력자) 표시, A4 세로 ============ */
@media print {
  @page { size: A4 portrait; margin: 14mm 10mm; }
  .topbar, .sidenav, .bottomnav, .sidenav-scrim, .no-print, .ledgerbar, .paging, .btn, form.actions, .actbar { display: none !important; }
  .print-head { display: block; font-weight: 700; margin-bottom: 10px; font-size: 13px; border-bottom: 2px solid #000; padding-bottom: 6px; }
  body { background: #fff; font-size: 11px; color: #000; }
  .shell { display: block; }
  .page { max-width: none; padding: 0; margin: 0; }
  .card { border: 0; padding: 0; margin-bottom: 10px; break-inside: avoid; }
  .grid { display: block; }
  table.list th, table.list td { padding: 3px 5px; border-bottom: 1px solid #999; white-space: normal; }
  table.list.responsive-cards, table.list.responsive-cards thead, table.list.responsive-cards tr, table.list.responsive-cards td { position: static; display: table-row-group; width: auto; }
  table.list.responsive-cards thead { display: table-header-group; }
  table.list.responsive-cards tr { display: table-row; }
  table.list.responsive-cards td { display: table-cell; text-align: left; }
  table.list.responsive-cards td::before { content: none; }
  a { color: inherit; text-decoration: none; }
  .status { border: 1px solid #999; background: none !important; color: #000 !important; }
}

/* ============ 결재(모바일 우선, 360px 단일 열) ============ */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; text-align: center; padding: 11px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); white-space: nowrap; font-size: 0.95em; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.doclist { display: flex; flex-direction: column; gap: 10px; }
.doc { display: block; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--navy); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.doc:hover, .doc:focus-visible { box-shadow: 0 2px 8px rgba(27,49,104,0.08); }
.doc-top { font-size: 0.85em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-title { font-weight: 600; font-size: 1.05em; margin: 0 0 4px; }
.doc-meta { color: var(--muted); font-size: 0.85em; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 14px 0; }
.kpi div { background: #f8fafc; border-radius: 8px; padding: 10px 12px; }
.kpi span { display: block; font-size: 0.8em; color: var(--muted); }
.kpi strong { font-size: 1.1em; font-variant-numeric: tabular-nums; }
.err-text { color: var(--err); }
tr.me td { background: #fffbeb; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { max-width: 160px; font-size: 0.85em; }
.thumb img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 4px; cursor: zoom-in; }
.comments { list-style: none; padding: 0; margin: 0 0 12px; }
.comments li { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* 하단 고정 결재 처리 바 */
.actbar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 8px rgba(0,0,0,0.1); z-index: 50; }
.actbar-inner { display: flex; gap: 8px; align-items: center; max-width: 1100px; margin: 0 auto; }
.actbar-inner input { flex: 1; min-width: 80px; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; min-height: 44px; }
.actbar .btn { white-space: nowrap; }
.act-msg { max-width: 1100px; margin: 4px auto 0; font-size: 0.85em; min-height: 1.2em; }
body:has(.actbar) .page { padding-bottom: calc(var(--actbar-h) + 24px); }
body:has(.actbar) .bottomnav { display: none; }

/* 이미지 라이트박스(확대·핀치) */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 85vh; object-fit: contain; touch-action: pinch-zoom; }

/* 로딩 스피너(이중 탭 방지 시 버튼 내부 표시) */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.secondary .spinner { border-color: rgba(27,49,104,0.25); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 토스트 */
.toast-wrap { position: fixed; left: 50%; bottom: calc(var(--actbar-h) + 16px); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 0.9em; box-shadow: 0 4px 12px rgba(0,0,0,0.25); text-align: center; animation: toast-in 0.15s ease; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 881px) { .toast-wrap { bottom: 24px; } }

/* ============ 캘린더(cal, 5차 배치) ============ */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: 0.88em; min-height: 36px; }
.chip.active { border-color: var(--navy); background: var(--navy-tint); color: var(--navy); font-weight: 600; }
.chip .dot, .dot-inline { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-inline { margin-right: 6px; vertical-align: middle; }
.cal-card { padding: 12px; }
.cal-hint { margin: 10px 0 0; }
#calendar { font-size: 0.92em; }
.fc .fc-toolbar-title { font-size: 1.15em; color: var(--navy-dark); }
.fc .fc-button-primary { background: #fff; border-color: var(--line); color: var(--navy); text-transform: none; }
.fc .fc-button-primary:not(:disabled):hover, .fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.fc .fc-daygrid-day.fc-day-today, .fc .fc-timegrid-col.fc-day-today { background: var(--navy-tint); }
.fc-event-busy { border-style: dashed !important; opacity: 0.8; }
.fc-event-done { text-decoration: line-through; opacity: 0.6; }
.fc-holiday { opacity: 0.55; }
.fc .fc-day-sun a, .fc .fc-day-sun .fc-col-header-cell-cushion { color: var(--err); }
.fc .fc-day-sat a, .fc .fc-day-sat .fc-col-header-cell-cushion { color: var(--navy); }
@media (max-width: 880px) {
  .fc .fc-toolbar { flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-title { font-size: 1em; }
  .fc .fc-button { padding: 6px 8px; font-size: 0.85em; }
}
.doc-masked { border-left-style: dashed; opacity: 0.8; }
.dow-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 0.9em; min-height: 36px; }
.tasklist { list-style: none; padding: 0; margin: 0; }
.tasklist .task { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tasklist .task:last-child { border-bottom: 0; }
.tasklist .task-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.tasklist .task.overdue strong { color: var(--err); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0 0; }
.week-board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.week-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.week-day.today { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy-tint); }
.week-day h3 { font-size: 0.92em; margin: 0 0 8px; color: var(--navy-dark); display: flex; justify-content: space-between; }
.task-card { border: 1px solid var(--line); border-left: 5px solid var(--navy); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 0.9em; }
.task-card.done { opacity: 0.6; } .task-card.done .task-title { text-decoration: line-through; }
.task-card.canceled { opacity: 0.5; }
.task-card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 0.85em; margin-bottom: 4px; }
.task-title { font-weight: 600; }
.task-desc { white-space: pre-wrap; }
.task-empty { margin: 0; }
.task-edit { margin-top: 6px; width: 100%; }
.task-edit summary { cursor: pointer; font-size: 0.85em; }
.task-edit-body { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.task-edit-body input[type=text], .task-edit-body input[type=date], .task-edit-body select { padding: 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; min-height: 38px; width: 100%; }
@media (max-width: 880px) { .week-board { grid-template-columns: 1fr; } .week-day { min-height: 0; } }
.report-md { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; white-space: pre; overflow: auto; }
.shift-grid th, .shift-grid td { vertical-align: top; min-width: 96px; }
.shift-grid th.today, .shift-cell.today { background: var(--navy-tint); }
.shift-cell.off { background: #f3f4f6; color: var(--muted); text-align: center; }
.shift-cell.me { box-shadow: inset 3px 0 0 var(--ok); }
.shift-edit summary { cursor: pointer; font-size: 0.82em; color: var(--navy); }
.shift-edit form { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.shift-edit select, .shift-edit input { padding: 6px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; min-height: 36px; width: 100%; }
