:root {
  --ink: #17243a;
  --muted: #68758a;
  --line: #dbe3ee;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --navy: #14283f;
  --blue: #2f67e8;
  --blue-soft: #eaf0ff;
  --green: #16966f;
  --green-soft: #e7f7f1;
  --amber: #c67a12;
  --amber-soft: #fff3dc;
  --red: #c84b54;
  --red-soft: #fff0f1;
  --shadow: 0 10px 32px rgba(29, 50, 79, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 84px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 12px; background: var(--navy); color: #fff; display: flex; flex-direction: column; align-items: center; z-index: 5; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: #fff; color: var(--navy); font-weight: 900; letter-spacing: -.04em; }
.sidebar nav { margin-top: 34px; display: grid; gap: 9px; width: 100%; }
.nav-button { width: 100%; min-height: 58px; border: 0; border-radius: 12px; color: #b9c7d8; background: transparent; display: grid; place-items: center; gap: 2px; transition: .2s ease; }
.nav-button span { font-size: 21px; line-height: 1; }
.nav-button small { font-size: 11px; }
.nav-button:hover, .nav-button:focus-visible, .nav-button.active { color: #fff; background: rgba(255,255,255,.12); outline: none; }
.nav-button.subtle { margin-top: auto; }

.main-content { min-width: 0; padding: 34px clamp(20px, 4vw, 62px) 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(23px, 3vw, 34px); letter-spacing: -.045em; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.demo-badge, .status, .closure-pill, .project-code { display: inline-flex; align-items: center; border-radius: 999px; font-weight: 750; }
.demo-badge { padding: 9px 12px; background: var(--amber-soft); color: #986011; font-size: 12px; }
.project-strip { margin-top: 28px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.82); display: flex; align-items: center; justify-content: space-between; gap: 14px; box-shadow: var(--shadow); }
.project-strip > div:first-child { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.project-code { padding: 5px 9px; background: var(--blue-soft); color: var(--blue); font-size: 11px; }
.muted { color: var(--muted); font-size: 13px; }
.closure-pill { padding: 8px 12px; background: var(--amber-soft); color: var(--amber); font-size: 12px; white-space: nowrap; }
.closure-pill.pass { background: var(--green-soft); color: var(--green); }

.metric-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 122px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.metric-card .label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin-top: 13px; font-size: 28px; letter-spacing: -.04em; }
.metric-card .hint { margin-top: 6px; color: var(--muted); font-size: 12px; }
.metric-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }

.workspace { min-height: 480px; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(290px, .75fr); gap: 16px; }
.panel-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { min-width: 0; }
.panel-header { padding: 19px 21px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border-bottom: 1px solid #edf1f6; }
.panel-header h2, .panel-header h3 { margin: 0; letter-spacing: -.03em; }
.panel-header h2 { font-size: 18px; }
.panel-header h3 { font-size: 16px; }
.panel-header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.panel-body { padding: 20px 21px; }
.stack { display: grid; gap: 12px; }
.list-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.list-card header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.list-card h3, .list-card h4, .list-card p { margin: 0; }
.list-card h3 { font-size: 15px; }
.list-card h4 { font-size: 13px; }
.list-card p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status { padding: 5px 8px; font-size: 10px; white-space: nowrap; }
.status.open, .status.blocked { background: var(--red-soft); color: var(--red); }
.status.review, .status.pending { background: var(--amber-soft); color: var(--amber); }
.status.pass, .status.closed, .status.approved { background: var(--green-soft); color: var(--green); }
.status.info { background: var(--blue-soft); color: var(--blue); }

.button { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 800; transition: transform .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.button.warning { background: var(--amber); }
.button.success { background: var(--green); }
.button.danger { background: var(--red); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }

.progress-track { width: 100%; height: 8px; overflow: hidden; background: #edf1f6; border-radius: 999px; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #7399f6); }
.timeline { position: relative; display: grid; gap: 15px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 7px; bottom: 7px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding-left: 29px; }
.timeline-item::before { content: ""; position: absolute; left: 3px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); }
.timeline-item strong { display: block; font-size: 13px; }
.timeline-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

textarea, input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; }
textarea:focus, input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.callout { padding: 14px 15px; border-left: 4px solid var(--blue); border-radius: 10px; background: var(--blue-soft); color: #38516f; font-size: 13px; line-height: 1.55; }
.callout.warning { border-color: var(--amber); background: var(--amber-soft); }
.callout.success { border-color: var(--green); background: var(--green-soft); }
.source-quote { margin: 0; padding: 17px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; color: #4d5c70; font-size: 13px; line-height: 1.65; }
.tag-row { margin-top: 10px; display: flex; gap: 7px; flex-wrap: wrap; }
.tag { padding: 5px 8px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 700; }

.trace-table { width: 100%; border-collapse: collapse; min-width: 770px; }
.table-wrap { overflow-x: auto; }
.trace-table th { padding: 11px 12px; color: var(--muted); background: #f7f9fc; font-size: 11px; text-align: left; border-bottom: 1px solid var(--line); }
.trace-table td { padding: 13px 12px; font-size: 12px; vertical-align: top; border-bottom: 1px solid #edf1f6; }
.trace-table tr:last-child td { border-bottom: 0; }
.trace-table strong { font-size: 12px; }
.trace-table small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }

.report-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.report-card strong { display: block; margin-bottom: 7px; font-size: 14px; }
.report-card p { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 11px; color: #fff; background: var(--navy); box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .25s ease; z-index: 20; font-size: 13px; }
.toast.show { transform: translateY(0); opacity: 1; }
footer { padding: 18px 2px 0; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .panel-grid.equal { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: auto; bottom: 0; width: 100%; height: 68px; padding: 6px 8px; flex-direction: row; z-index: 10; }
  .brand-mark, .nav-button.subtle { display: none; }
  .sidebar nav { margin: 0; width: 100%; grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .nav-button { min-height: 54px; }
  .nav-button span { font-size: 17px; }
  .main-content { padding: 22px 14px 86px; }
  .topbar, .project-strip { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 110px; padding: 14px; }
  .metric-card strong { font-size: 23px; }
  .form-grid, .report-actions { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

