:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface-1: #17181b;
  --surface-2: #1e2024;
  --surface-3: #272a2f;
  --border: #2b2e34;
  --border-strong: #3a3e45;
  --text-primary: #f0efec;
  --text-secondary: #b4b3ab;
  --text-muted: #7d7c76;
  --accent: #c8f169;
  --accent-ink: #12160a;
  --squat: #3987e5;
  --bench: #d95926;
  --dead: #199e70;
  --neutral-series: #c3c2b7;
  --good: #4cc38a;
  --warn: #e5a50a;
  --bad: #e66767;
  --radius: 14px;
  --radius-sm: 9px;
  --nav-w: 236px;
  --tab-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100dvh; }
.sidenav {
  position: sticky; top: 0; height: 100dvh; width: var(--nav-w); flex: none;
  background: var(--surface-1); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: -0.5px; }
.brand-name { font-weight: 750; letter-spacing: 0.2px; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.nav-group { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-secondary); font-weight: 550; }
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-link.active { background: var(--surface-3); color: var(--text-primary); }
.nav-link.active svg { color: var(--accent); }
.sidenav-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 720; letter-spacing: -0.2px; }
.topbar .sub { font-size: 12.5px; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 24px 28px 48px; max-width: 1180px; }

.tabbar { display: none; }

@media (max-width: 899px) {
  .sidenav { display: none; }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); min-height: 56px; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 16px 14px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--text-primary); }
  .tabbar a.active svg { color: var(--accent); }
}

/* ---------- Building blocks ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1099px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) { .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 12px; } }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 680; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.section-title { font-size: 13px; font-weight: 650; color: var(--text-secondary); margin: 26px 2px 10px; letter-spacing: 0.2px; }
.section-title:first-child { margin-top: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #d6f784; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-danger { color: var(--bad); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn.on { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); font-size: 12px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.squat { background: var(--squat); } .dot.bench { background: var(--bench); } .dot.dead { background: var(--dead); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-2); outline: none; font-size: 15px;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-secondary); user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: transform .15s, background .15s; }
.toggle input:checked + .track { background: color-mix(in srgb, var(--accent) 30%, var(--surface-3)); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); background: var(--accent); }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; gap: 2px; }
.seg button, .seg a { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg .active { background: var(--surface-3); color: var(--text-primary); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }

/* ---------- Stat tiles ---------- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 740; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.stat-meta { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.delta-up { color: var(--good); } .delta-down { color: var(--bad); }
@media (max-width: 899px) { .stat-value { font-size: 25px; } .card { padding: 15px; } }

.hero {
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 55%), var(--surface-1);
  border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: grid; gap: 18px; grid-template-columns: 1fr auto; align-items: end;
}
.hero-eyebrow { font-size: 12.5px; font-weight: 650; color: var(--accent); letter-spacing: 0.4px; }
.hero h2 { margin: 6px 0 4px; font-size: 26px; letter-spacing: -0.6px; }
.hero p { margin: 0; color: var(--text-secondary); font-size: 14px; }
@media (max-width: 899px) { .hero { grid-template-columns: 1fr; padding: 18px; } .hero h2 { font-size: 22px; } }

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

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.list-item:first-child { border-top: 0; padding-top: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.client { background: #24364f; color: #9ec5f4; }
.avatar.coach { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--accent); }

/* ---------- Training ---------- */
.week-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.week-switch { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.week-switch .label { min-width: 92px; text-align: center; font-weight: 700; font-size: 15px; }
.day-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.day-tab { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 10px 10px 9px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; position: relative; min-width: 0; }
.day-tab .d { font-size: 12px; color: var(--text-muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.day-tab .t { font-size: 14px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-tab .lifts { display: flex; gap: 4px; height: 8px; }
.day-tab.active { border-color: var(--accent); background: var(--surface-2); }
.day-tab .done { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-left: auto; }
.day-tab .done svg { width: 11px; height: 11px; }
@media (max-width: 899px) { .day-tabs { gap: 6px; } .day-tab { padding: 8px 7px; } .day-tab .t { font-size: 12.5px; } }

.day-meta { display: grid; grid-template-columns: 1.3fr 1.6fr 1fr 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 899px) { .day-meta { grid-template-columns: 1fr 1fr; } .day-meta .span-2 { grid-column: span 2; } }

.ex-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; overflow: hidden; }
.ex-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; }
.ex-name { font-size: 15.5px; font-weight: 700; line-height: 1.3; word-break: keep-all; }
.ex-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.ex-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.ex-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--border-strong); flex: none; }
.ex-bar.squat { background: var(--squat); } .ex-bar.bench { background: var(--bench); } .ex-bar.dead { background: var(--dead); }

.sets { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sets th { white-space: nowrap; font-size: 11px; font-weight: 650; color: var(--text-muted); text-align: center; padding: 6px 4px; border-top: 1px solid var(--border); background: var(--surface-2); letter-spacing: 0.2px; }
.sets td { text-align: center; padding: 6px 4px; border-top: 1px solid var(--border); font-size: 14px; }
.sets th:first-child, .sets td:first-child { padding-left: 14px; width: 34px; }
.sets th:last-child, .sets td:last-child { padding-right: 14px; }
.sets .setno { color: var(--text-muted); font-weight: 650; font-size: 13px; }
.sets .target { color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.sets .rec { color: var(--text-secondary); white-space: nowrap; }
.rec-btn { border: 1px dashed var(--border-strong); background: transparent; border-radius: 7px; padding: 3px 7px; cursor: pointer; color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.rec-btn:hover { border-color: var(--accent); color: var(--accent); }
.sets .e1 { font-weight: 700; white-space: nowrap; }
.cell-input { width: 64px; height: 36px; text-align: center; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); outline: none; font-size: 15px; font-variant-numeric: tabular-nums; padding: 0 4px; }
.cell-input.sm { width: 50px; }
.cell-input.name { width: 100%; text-align: left; padding: 0 10px; font-weight: 650; }
.cell-input:focus { border-color: var(--accent); }
.cell-input.filled { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
tr.is-done td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
@media (max-width: 520px) {
  .sets th, .sets td { padding: 5px 2px; }
  .sets th:first-child, .sets td:first-child { padding-left: 10px; width: 24px; }
  .sets th:last-child, .sets td:last-child { padding-right: 10px; }
  .cell-input { width: 54px; height: 36px; font-size: 15px; }
  .cell-input.sm { width: 42px; }
  .sets .target { font-size: 12px; }
  .rec-btn { padding: 3px 4px; font-size: 12.5px; }
}
.row-tools { display: inline-flex; gap: 2px; }
.ex-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.summary-strip > div { background: var(--surface-1); padding: 12px 14px; }
.summary-strip .k { font-size: 11.5px; color: var(--text-muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.summary-strip .v { font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; margin-top: 2px; }
@media (max-width: 899px) { .summary-strip { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.edit-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); font-size: 13.5px; color: var(--text-secondary); margin-bottom: 14px; flex-wrap: wrap; }
.edit-banner b { color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13.5px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-weight: 650; font-size: 12px; text-align: right; padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data td { text-align: right; padding: 9px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tr:hover td { background: var(--surface-2); }
table.rpe td.hl { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text-primary); font-weight: 700; }
table.rpe td.cross { background: var(--surface-2); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .end-label { font-size: 11.5px; font-weight: 650; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 11px; font-size: 12.5px; min-width: 130px; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-variant-numeric: tabular-nums; }
.tooltip .tt-title { font-weight: 700; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); }
.tooltip .tt-row b { margin-left: auto; color: var(--text-primary); padding-left: 12px; font-weight: 650; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.box { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 12px; color: var(--text-muted); text-align: center; font-weight: 650; padding-bottom: 4px; }
.cal .dow.sun { color: var(--bad); }
.cal-day { min-height: 82px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border); padding: 7px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cal-day.out { opacity: .32; }
.cal-day.past .n { color: var(--text-muted); }
.cal-day.today { border-color: var(--accent); }
.cal-day .n { font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-day a.sess { display: block; font-size: 11.5px; line-height: 1.25; padding: 4px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-primary); font-weight: 600; }
.cal-day a.sess:hover { outline: 1px solid var(--accent); }
.cal-day a.sess .lifts { display: flex; gap: 3px; margin-top: 3px; }
@media (max-width: 899px) { .cal { gap: 3px; } .cal-day { min-height: 58px; padding: 5px; font-size: 12px; } .cal-day a.sess { font-size: 10px; padding: 3px 4px; } .cal-day a.sess .txt { display: none; } }

/* ---------- Misc ---------- */
.empty { padding: 36px 16px; text-align: center; color: var(--text-muted); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; background: var(--surface-3); border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; z-index: 60; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.save-state { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.more-list a { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-top: 1px solid var(--border); font-weight: 600; }
.more-list a:first-child { border-top: 0; }
.more-list a svg { width: 20px; height: 20px; color: var(--text-secondary); }
.more-list a .chev { margin-left: auto; color: var(--text-muted); }
.plate-viz { display: flex; align-items: center; gap: 3px; min-height: 120px; padding: 10px 0; overflow-x: auto; }
.plate-viz .bar { height: 14px; width: 60px; background: #8a8a86; border-radius: 3px; flex: none; }
.plate-viz .sleeve { height: 24px; width: 10px; background: #a8a8a3; border-radius: 2px; flex: none; }
.plate-viz .p { border-radius: 5px; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #111; writing-mode: vertical-rl; }
.q-card { border-top: 1px solid var(--border); padding: 16px 0; }
.q-card:first-child { border-top: 0; padding-top: 0; }
.q-title { font-weight: 650; margin-bottom: 10px; font-size: 14.5px; }
.attempts td.hl { color: var(--accent); font-weight: 750; }
.badge-warn { color: var(--warn); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13.5px; line-height: 1.55; }
.callout b { color: var(--text-primary); }
.comment-box { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.meet-grid { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.attempts th, .attempts td { padding: 8px 9px !important; }
.attempts .cell-input { width: 72px; }

.grid-home { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.day-tab .d { white-space: nowrap; }
@media (max-width: 899px) {
  .grid-home { grid-template-columns: minmax(0, 1fr); }
  .save-state span { display: none; }
  .day-tab .done { width: 14px; height: 14px; }
  .day-tab .d { font-size: 11px; gap: 3px; }
  .topbar .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.save-state[data-kind="busy"] i { background: var(--warn); }
.save-state[data-kind="err"] i { background: var(--bad); }

/* ---------- 데이터AI ---------- */
.ai-lock { max-width: 420px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 32px 22px; }
.ai-lock-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-3); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.ai-lock-icon svg { width: 24px; height: 24px; }
.ai-lock .input { text-align: center; }
.ai-pw-err { color: var(--bad); font-size: 13px; margin-top: 8px; }
.ai-d.good { color: var(--good); }
.ai-d.bad { color: var(--bad); }
.ai-grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.ai-sug .card-head { gap: 8px; flex-wrap: wrap; }
.ai-sug .card-title { flex: 1 1 200px; }
.ai-data { font-size: 13px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-variant-numeric: tabular-nums; }
.ai-body { color: var(--text-secondary); font-size: 14px; line-height: 1.65; margin: 12px 0 10px; }
.ai-body b { color: var(--text-primary); }
.ai-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-refs span { font-size: 11.5px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; cursor: help; }
.ai-reflist { margin: 12px 0 0; padding-left: 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.ai-reflist b { color: var(--text-primary); }
.ai-steps { color: var(--text-secondary); font-size: 14px; line-height: 1.7; padding-left: 20px; margin: 12px 0 0; }
.ai-steps a { color: var(--accent); }
.ai-steps code, .ai-msg code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.ai-chat { display: flex; flex-direction: column; padding: 0; height: calc(100dvh - 150px); min-height: 420px; overflow: hidden; }
.ai-chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ai-msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: min(760px, 92%); padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg p { margin: 0 0 8px; } .ai-msg p:last-child { margin-bottom: 0; }
.ai-msg h4 { margin: 12px 0 6px; font-size: 15px; } .ai-msg h4:first-child { margin-top: 0; }
.ai-msg ul, .ai-msg ol { margin: 4px 0 8px; padding-left: 20px; }
.ai-msg pre { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12.5px; }
.ai-msg .table-wrap { margin: 6px 0 10px; }
.ai-empty { margin: auto; text-align: center; max-width: 560px; }
.ai-quick { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.ai-quick .btn { height: auto; min-height: 36px; padding: 8px 12px; white-space: normal; text-align: left; justify-content: flex-start; }
.ai-compose { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); }
.ai-compose .textarea { min-height: 48px; max-height: 180px; flex: 1; }
.ai-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: ai-blink 1.2s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .2s; } .ai-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (max-width: 899px) {
  .ai-grid { grid-template-columns: 1fr; }
  .ai-chat { height: calc(100dvh - 190px - var(--tab-h)); }
}
.p4-wrap { margin-top: 28px; }
.p4-head { margin-bottom: 14px; }
.p4-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.p4-head .muted { font-size: 13.5px; line-height: 1.55; }
.p4-change { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.p4-num { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.p4-day .card-head { gap: 10px; flex-wrap: wrap; }
table.p4 th:first-child, table.p4 td:first-child { text-align: left; }
table.p4 td, table.p4 th { white-space: nowrap; }
table.p4 td { font-variant-numeric: tabular-nums; vertical-align: top; }
.p4-name { white-space: normal !important; min-width: 190px; max-width: 280px; }
.p4-name .dot { margin-right: 6px; vertical-align: 1px; }
.p4-kg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.p4-new td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.chip.p4-chip-new { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); height: 20px; font-size: 11px; }
.p4-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.p4-title h2 { margin: 0; }
.p4-done { display: flex; align-items: center; gap: 6px; margin: 6px 0 8px; font-size: 13.5px; color: var(--good); }
.p4-done svg { width: 16px; height: 16px; }
.p4-done a { color: var(--accent); text-decoration: underline; }
