:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0f0ed;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #74736e;
  --accent: #2a78d6;
  --on-accent: #ffffff;
  --grid: #e8e7e2;
  --weekend: rgba(0, 0, 0, .035);
  --good: #0f7b3f;  --good-bg: #e6f4ea;
  --warn: #9a5b00;  --warn-bg: #fdf1dc;
  --bad: #c62828;   --bad-bg: #fde8e7;
  --info: #2a5fa8;  --info-bg: #e7f0fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #242422;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9a998f;
    --accent: #3987e5;
    --on-accent: #ffffff;
    --grid: #2b2b28;
    --weekend: rgba(255, 255, 255, .03);
    --good: #6fd08f;  --good-bg: #17301f;
    --warn: #f2b65a;  --warn-bg: #33270f;
    --bad: #ff8a80;   --bad-bg: #3a1a18;
    --info: #8ab8f2;  --info-bg: #172638;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2 { margin: 0; }
h1 small, h2 small { font-weight: 400; color: var(--muted); font-size: .8em; margin-left: 4px; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.neg { color: var(--bad) !important; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  line-height: 1.4;
}
button:hover:not(:disabled) { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.danger { color: var(--bad); }
button.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
button.armed:hover { background: var(--bad); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 상단 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 16px; white-space: nowrap; }
.brand span { font-weight: 500; color: var(--muted); }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--text-2);
  white-space: nowrap; font-weight: 500;
}
.tabs a:hover { background: var(--surface-2); }
.tabs a.active { background: var(--text); color: var(--surface); font-weight: 700; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 20px 60px; display: flex; flex-direction: column; gap: 16px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { margin: 4px 0 0; color: var(--text-2); width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.card > h2, .card-head h2 { font-size: 15px; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 0; }
.card-head + * { margin-top: 12px; }
.card.alert.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: var(--bad-bg); }
.card.alert.bad h2 { color: var(--bad); display: flex; align-items: center; gap: 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty { color: var(--muted); margin: 4px 0; font-size: 13px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.actions.left { justify-content: flex-start; }
.actions.wrap { flex-wrap: wrap; }

/* ---------- 항목 행 ---------- */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border-left: 4px solid var(--c, var(--border));
}
.row.done .row-title { text-decoration: line-through; color: var(--muted); }
.row.done { opacity: .75; }
.check { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.row-main {
  all: unset; cursor: pointer; flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.row-main:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-main:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
.row-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; }
.row-meta i { font-style: normal; margin: 0 4px; opacity: .6; }
.kind { font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-2); }
.kind.event { background: var(--text); color: var(--surface); border-color: var(--text); }
.owner { color: var(--info); font-weight: 600; }
.today-h { color: var(--text); }
.dday { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.dday.soon { color: var(--warn); }
.dday.over { color: var(--bad); }

.status-select {
  font-size: 12px; padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; flex-shrink: 0;
}
.status-select.s-1 { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, var(--border)); }
.status-select.s-2 { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.status-select.s-3 { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }

/* ---------- 이번 주 ---------- */
.judgments { display: flex; flex-direction: column; gap: 8px; }
.judg { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; }
.judg-text { font-weight: 700; font-size: 15px; }
.judg-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.tone-icon {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; margin-top: 1px;
}
.judg.good { background: var(--good-bg); } .judg.good .tone-icon { background: var(--good); }
.judg.warn { background: var(--warn-bg); } .judg.warn .tone-icon { background: var(--warn); }
.judg.bad  { background: var(--bad-bg); }  .judg.bad .tone-icon,
.alert.bad .tone-icon { background: var(--bad); }
.judg.info { background: var(--info-bg); } .judg.info .tone-icon { background: var(--info); font-family: Georgia, serif; }
@media (prefers-color-scheme: dark) { .tone-icon { color: #111; } }

.week-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg i.dash { width: 16px; height: 0; border-top: 2px dashed var(--text-2); border-radius: 0; }

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--text-2); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis.strong { fill: var(--text); font-weight: 700; }
.chart .bar-total { fill: var(--text-2); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .cap { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .cap-label { fill: var(--text-2); font-weight: 600; }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: var(--surface-2); }

.table-view { margin-top: 10px; font-size: 12px; }
.table-view summary { cursor: pointer; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
thead th { color: var(--muted); font-weight: 600; }
tbody th { text-align: left; font-weight: 600; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  padding: 10px 12px; font-size: 12px; min-width: 180px;
}
.tt-head { font-weight: 700; margin-bottom: 6px; }
.tt-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--text-2); }
.tt-row i { width: 8px; height: 8px; border-radius: 2px; }
.tt-row b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.tt-row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 5px; }

.gauge-num { font-size: 13px; color: var(--text-2); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.gauge-num b { font-size: 26px; color: var(--text); }
.gauge { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.gauge span { display: block; height: 100%; border-radius: 5px; }
.stats { display: flex; flex-direction: column; gap: 10px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; }
.stat span { color: var(--text-2); }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }

.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-col { background: var(--surface-2); border-radius: 8px; padding: 8px; min-height: 90px; display: flex; flex-direction: column; gap: 5px; }
.day-col.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.day-col.is-past { opacity: .6; }
.day-head { font-weight: 700; font-size: 13px; }
.day-head span { font-weight: 400; color: var(--muted); }
.day-col .none { color: var(--muted); font-size: 12px; }
.due-chip {
  text-align: left; font-size: 12px; padding: 4px 6px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c);
  overflow-wrap: anywhere;
}
.due-chip.done { text-decoration: line-through; opacity: .55; }
.due-label { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.due-chip small { color: var(--info); }

.welcome h1 { font-size: 22px; margin-bottom: 8px; }
.welcome ol { margin: 10px 0 14px; padding-left: 20px; color: var(--text-2); }

/* ---------- 목록 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.toolbar select, .toolbar input[type="search"] {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.toolbar input[type="search"] { flex: 1; min-width: 180px; max-width: 320px; margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; }
.chips button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chips button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.check-label input { accent-color: var(--accent); }
.group.bad h2 { color: var(--bad); }

/* ---------- 타임라인 ---------- */
.tl-card { padding: 0; overflow: hidden; }
.tl-scroll { overflow-x: auto; }
.tl { min-width: 900px; }
.tl-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); border-bottom: 1px solid var(--border); min-height: 40px; }
.tl-row:last-child { border-bottom: 0; }
.tl-header { position: sticky; top: 0; background: var(--surface); }
.tl-label {
  all: unset; cursor: pointer; box-sizing: border-box;
  padding: 6px 12px; border-right: 1px solid var(--border); border-left: 4px solid var(--c, transparent);
  display: flex; flex-direction: column; justify-content: center; min-width: 0;
}
.tl-label span { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label:hover span { text-decoration: underline; }
.tl-label:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-label.head { cursor: default; font-weight: 700; color: var(--muted); font-size: 12px; }
.tl-track {
  position: relative;
  background-image: linear-gradient(90deg, transparent 71.43%, var(--weekend) 71.43%);
  background-size: calc(100% / 6) 100%;
}
.tl-header .tl-track { display: grid; grid-template-columns: repeat(6, 1fr); background: none; }
.tl-week { border-left: 1px solid var(--border); padding: 6px 0 4px; }
.tl-week b { display: block; font-size: 12px; padding-left: 6px; }
.tl-days { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.tl-days .we { opacity: .6; }
.tl-body { position: relative; }
.tl-body::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 2px; pointer-events: none;
  left: calc(220px + (100% - 220px) * var(--today));
  background: var(--bad); opacity: .7;
}
.tl-track .empty { padding: 10px; }
.tl-bar, .tl-dot, .tl-client { position: absolute; top: 50%; background: var(--c); }
.tl-bar { height: 14px; margin-top: -7px; border-radius: 4px; min-width: 6px; }
.tl-bar.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-dot { width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.tl-client { width: 10px; height: 10px; margin-top: -5px; transform: rotate(45deg); background: var(--surface); border: 2px solid var(--c); }
.tl-bar.done, .tl-dot.done { opacity: .35; }
.tl-track button.tl-bar, .tl-track button.tl-dot { border: 0; padding: 0; cursor: pointer; }
.tl-track button.tl-bar:hover, .tl-track button.tl-dot:hover { background: var(--c); filter: brightness(1.15); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--c); z-index: 1; }
.tl-track button.tl-bar:focus-visible, .tl-track button.tl-dot:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tl-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.tl-legend .sample { position: static; display: inline-block; margin: 0 0 0 6px; --c: var(--text-2); vertical-align: middle; }
.tl-legend .tl-bar.sample { width: 18px; height: 8px; }
.tl-legend .tl-client.sample { transform: rotate(45deg); }

/* ---------- 프로젝트 ---------- */
.page-head > button { align-self: center; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.project-card {
  text-align: left; display: flex; flex-direction: column; gap: 6px;
  border-top: 4px solid var(--c); position: relative; padding: 14px 16px;
}
.project-card:hover { background: var(--surface-2) !important; }
.project-card.on { box-shadow: 0 0 0 2px var(--accent); }
.project-card.done { opacity: .6; }
.pc-area { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.pc-area i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pc-name { font-weight: 700; font-size: 16px; padding-right: 50px; }
.pc-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; border: 1px solid var(--border); }
.pc-progress span { display: block; height: 100%; background: var(--c); }
.pc-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pc-goal { font-size: 12px; color: var(--muted); }
.pc-status { position: absolute; top: 12px; right: 12px; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.done-list { margin-top: 10px; }
.done-list summary { cursor: pointer; color: var(--muted); margin-bottom: 6px; }

/* ---------- 설정 ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.field.inline { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; flex-direction: row; }
.field.inline span { flex: 1; min-width: 180px; color: var(--text-2); font-weight: 400; font-size: 14px; }
.field.inline input { width: 80px; }
.budget-summary { display: flex; gap: 12px; margin: 6px 0 8px; }
.budget-summary div { flex: 1; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; }
.budget-summary span { font-size: 12px; color: var(--muted); }
.budget-summary b { font-size: 20px; font-variant-numeric: tabular-nums; }
.area-table { display: flex; flex-direction: column; gap: 6px; }
.area-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 120px 96px; gap: 8px; align-items: center; }
.area-row.head { font-size: 12px; color: var(--muted); }
.area-row input[type="color"] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.area-row input[type="number"] { width: 70px; }
.badge-role { font-size: 11px; color: var(--muted); text-align: center; }
.small-btn { padding: 4px 8px; font-size: 12px; }

/* ---------- 입력 공통 ---------- */
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select, textarea {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- 대화상자 ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { font-size: 17px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field select { width: 100%; }
.frow { display: flex; gap: 10px; }
.task-only, .event-only { display: flex; flex-direction: column; gap: 12px; }
[hidden] { display: none !important; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-weight: 700; }
.seg small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.seg input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.weekday-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-pick label { position: relative; cursor: pointer; }
.weekday-pick input { position: absolute; opacity: 0; }
.weekday-pick span { display: inline-flex; width: 36px; height: 34px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; }
.weekday-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.weekday-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-note { margin: 0; font-size: 12px; color: var(--info); background: var(--info-bg); padding: 8px 10px; border-radius: 8px; }
dialog .actions .danger { margin-right: auto; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .week-grid, .cols, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  main > * { min-width: 0; }
  .span-2 { grid-column: auto; }
  .week-days { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; }
  #addBtn { margin-left: auto; }
  main { padding: 14px 16px 60px; }
  .row { flex-wrap: wrap; }
  .row-main { flex-basis: calc(100% - 40px); }
  .row .dday { margin-left: 27px; }
  .row .status-select { margin-left: auto; }
  .frow { flex-direction: column; }
  .area-row { grid-template-columns: 40px minmax(0, 1fr) 90px; }
  .area-row > :last-child { grid-column: 2 / -1; justify-self: start; }
  .area-row.head > :last-child { display: none; }
  .toolbar input[type="search"] { max-width: none; margin-left: 0; }
  .tl-legend { margin-left: 0; }
}

/* ---------- 대시보드 ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.kpi.bad .kpi-value, .kpi.bad .kpi-note { color: var(--bad); }
.kpi.warn .kpi-note { color: var(--warn); }
.kpi.good .kpi-note { color: var(--good); }
.judgments.compact { padding: 10px; gap: 6px; }
.judgments.compact .judg { padding: 7px 10px; }
.judgments.compact .judg-text { font-size: 14px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.more-link { font-size: 12px; text-decoration: none; color: var(--muted); }
.more-link:hover { color: var(--accent); }
.sub-h { font-size: 12px; color: var(--muted); margin: 10px 0 6px; font-weight: 700; }
.card-head + .sub-h { margin-top: 4px; }
.sub-h.bad { color: var(--bad); }
.minis { display: flex; flex-direction: column; gap: 4px; }
.mini {
  display: flex; align-items: center; gap: 8px; text-align: left; width: 100%;
  padding: 6px 8px; border: 0; border-left: 3px solid var(--c); border-radius: 6px; background: var(--surface-2);
}
.mini.done .mini-title { text-decoration: line-through; color: var(--muted); }
.mini-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-right { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; font-variant-numeric: tabular-nums; }
.due-tag { font-size: 10.5px; font-weight: 700; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; color: var(--text-2); }
.proj-mini { display: flex; flex-direction: column; gap: 6px; }
.pm { display: flex; flex-direction: column; gap: 4px; text-align: left; border-left: 3px solid var(--c); padding: 8px 10px; background: var(--surface-2); border-top: 0; border-right: 0; border-bottom: 0; }
.pm-top { display: flex; justify-content: space-between; gap: 8px; }
.pm-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-pct { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.pm .pc-progress { margin-top: 0; background: var(--surface); }
.pm-meta { font-size: 11.5px; color: var(--muted); }
@media (max-width: 1000px) { .dash-grid, .dash-grid.three { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 클라우드 · 로그인 · 홈 화면 앱 ---------- */
.topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.sync-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync-status[data-state="saving"] { color: var(--info); }
.sync-status[data-state="error"] { color: var(--bad); font-weight: 600; }
.auth-screen {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.auth-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px;
}
.auth-card .brand { font-size: 20px; }
.auth-card input { width: 100%; }
.auth-card input[type="email"], .auth-card input[type="password"] { padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.auth-msg { margin: 0; min-height: 1em; font-size: 13px; color: var(--bad); }
.auth-card .primary { padding: 10px; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 13px; }
.link-btn:hover:not(:disabled) { background: none; text-decoration: underline; }
@media (max-width: 640px) { .sync-status { order: 2; } }
