:root {
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  color: #17232c;
  background: #f5f7f6;
  font-synthesis: none;
  --ink: #17232c;
  --muted: #6f7c82;
  --line: #dfe5e3;
  --green: #1f6b55;
  --green-dark: #155441;
  --green-soft: #e8f3ee;
  --paper: #ffffff;
  --cream: #f8f5ed;
  --orange: #c9693a;
  --red: #b24c48;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f5f7f6; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
textarea { resize: vertical; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #102921; color: white; padding: 28px 18px 20px; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 34px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; background: #d9f3b2; color: #173f31; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.2px; }
.brand span { margin-top: 1px; font-size: 10px; color: #8eaaa0; letter-spacing: .5px; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { width: 100%; border: 0; border-radius: 9px; padding: 11px 12px; color: #a7bbb4; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(232, 243, 238, .12); }
.nav-item b { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 10px; background: rgba(255,255,255,.1); color: #cce0d8; font-size: 10px; text-align: center; }
.sidebar-note { margin-top: auto; padding: 16px 12px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.035); border-radius: 11px; display: flex; gap: 10px; color: #b8cec6; }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { color: #edf5f2; font-size: 12px; margin-bottom: 4px; }
.sidebar-note span { font-size: 10px; line-height: 1.55; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 18px 8px 0; margin-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #de8659; font-size: 10px; font-weight: 700; }
.user-card strong, .user-card span { display: block; font-size: 11px; }
.user-card span { color: #8eaaa0; margin-top: 2px; font-size: 9px; }

.main-shell { min-width: 0; }
.topbar { height: 81px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 8; }
.eyebrow { color: #769087; font-size: 8px; letter-spacing: 1.65px; font-weight: 700; }
.topbar h1 { font-size: 20px; letter-spacing: -.55px; margin: 3px 0 0; }
.system-status { padding: 7px 11px; border: 1px solid #dce8e3; border-radius: 18px; background: #f7faf9; color: #567066; font-size: 10px; font-weight: 600; }
.system-status i { width: 6px; height: 6px; margin-right: 6px; display: inline-block; border-radius: 50%; background: #4aa077; box-shadow: 0 0 0 3px #e3f2eb; }
.mobile-brand { display: none; }
.page-content { padding: 26px 30px 40px; max-width: 1500px; margin: 0 auto; }
.sample-strip { min-height: 65px; background: var(--cream); border: 1px solid #e7e0d1; border-radius: 12px; padding: 12px 14px 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.sample-strip > div:first-child strong, .sample-strip > div:first-child span { display: block; }
.sample-strip > div:first-child strong { font-size: 12px; color: #665b46; }
.sample-strip > div:first-child span { margin-top: 3px; font-size: 9px; color: #9a8d75; }
.sample-list { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.sample-chip { border: 1px solid #e1d9c8; background: white; color: #726853; padding: 6px 9px 6px 6px; border-radius: 20px; display: flex; gap: 6px; align-items: center; font-size: 9px; font-weight: 600; white-space: nowrap; }
.sample-chip > span { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: #efe7d7; font-size: 8px; }
.sample-chip.active { border-color: #7a998c; color: var(--green); box-shadow: inset 0 0 0 1px #7a998c; }
.sample-chip.active > span { background: var(--green); color: white; }

.workspace-grid { margin-top: 17px; display: grid; grid-template-columns: minmax(430px, .9fr) minmax(470px, 1.1fr); gap: 17px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 2px 8px rgba(24,47,38,.025); overflow: hidden; }
.panel-heading { min-height: 78px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8ecea; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.step { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 700; }
.panel-heading h2 { margin: 0; font-size: 13px; letter-spacing: -.2px; }
.panel-heading p { margin: 4px 0 0; color: #84908d; font-size: 9px; }
.structured-badge { border: 1px solid #dde9e4; border-radius: 12px; background: #f5faf8; padding: 4px 8px; color: #5c7b6f; font-size: 8px; }
.campaign-heading { border: 0; }
.form-body { padding: 18px 20px 4px; display: grid; gap: 13px; }
.field { display: grid; gap: 6px; color: #465650; font-size: 10px; font-weight: 600; }
.field input, .field textarea { width: 100%; border: 1px solid #dce3e0; border-radius: 7px; background: #fcfdfd; padding: 9px 11px; outline: 0; color: var(--ink); font-size: 11px; font-weight: 400; line-height: 1.6; transition: .18s ease; }
.field input { height: 36px; }
.field input:focus, .field textarea:focus, .dm-output:focus { border-color: #6a9b88; background: white; box-shadow: 0 0 0 3px rgba(52,120,94,.09); }
.field small { color: #9aa4a0; font-size: 8px; font-weight: 400; }
.section-divider { height: 7px; margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfb; }
.form-actions { padding: 17px 20px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.button { min-height: 35px; border-radius: 7px; border: 1px solid transparent; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 10px; font-weight: 700; transition: .17s ease; }
.button.primary { background: var(--green); color: white; box-shadow: 0 5px 12px rgba(31,107,85,.16); }
.button.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.button.secondary { border-color: #d9e0de; background: white; color: #53625d; }
.button.secondary:hover { border-color: #a8bbb4; background: #f8faf9; }
.button.quiet { background: transparent; color: #75827d; }

.result-panel { position: sticky; top: 98px; }
.result-heading { background: #fbfcfc; }
.result-body { min-height: 645px; }
.result-empty { min-height: 645px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; background: radial-gradient(circle at 50% 38%, #f5faf7 0, white 37%); }
.empty-orbit { width: 102px; height: 102px; border: 1px dashed #c7d9d2; border-radius: 50%; display: grid; place-items: center; margin-bottom: 21px; }
.empty-orbit > div { width: 57px; height: 57px; display: grid; place-items: center; border-radius: 17px; color: var(--green); background: var(--green-soft); transform: rotate(-5deg); }
.result-empty h2 { margin: 0 0 9px; font-size: 15px; }
.result-empty p { margin: 0; color: #84918c; font-size: 10px; line-height: 1.7; }
.empty-points { margin-top: 20px; display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.empty-points span { display: flex; align-items: center; gap: 4px; color: #668176; background: #f5f9f7; border: 1px solid #e2ebe7; padding: 5px 8px; border-radius: 14px; font-size: 8px; }

.result-success { padding: 18px 20px 20px; }
.result-topline { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; }
.result-topline > div { display: flex; align-items: center; gap: 7px; }
.result-topline strong { font-size: 11px; color: #245d49; }
.result-topline > div > span:last-child { font-size: 8px; color: #8b9893; }
.success-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #def0e7; color: var(--green); }
.icon-button { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--line); background: white; color: #65766f; display: grid; place-items: center; }
.icon-button:hover { color: var(--green); border-color: #a9c0b7; }
.dm-editor-label { display: flex; align-items: end; justify-content: space-between; margin-bottom: 7px; }
.dm-editor-label span { font-size: 10px; font-weight: 700; }
.dm-editor-label small { color: #9aa4a0; font-size: 8px; }
.dm-output { width: 100%; border: 1px solid #dce3e0; border-radius: 9px; background: #fcfdfd; padding: 15px; outline: 0; color: #24342e; font-size: 10px; line-height: 1.78; }
.evidence-card { margin-top: 12px; border: 1px solid #ded9c9; background: #fbf8ef; border-radius: 9px; padding: 13px 15px; }
.evidence-head { display: flex; align-items: center; justify-content: space-between; color: #7a6d51; }
.evidence-head > div { display: flex; align-items: center; gap: 6px; }
.evidence-head strong { font-size: 9px; }
.evidence-head > span { border-radius: 10px; background: #ece3d0; padding: 3px 7px; font-size: 8px; }
.evidence-card blockquote { margin: 10px 0 11px; padding-left: 10px; border-left: 2px solid #d5c49f; color: #5f5746; font-size: 10px; line-height: 1.6; }
.evidence-meta { padding-top: 9px; border-top: 1px solid #e9e1d2; display: flex; gap: 16px; flex-wrap: wrap; font-size: 8px; color: #928771; }
.evidence-meta b, .evidence-meta code { color: #615946; margin-left: 4px; }
.validation-card { margin-top: 12px; border: 1px solid #dce8e3; border-radius: 9px; overflow: hidden; }
.validation-card.failed { border-color: #e6c4c1; }
.validation-title { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; background: #f4f9f7; color: var(--green); }
.validation-card.failed .validation-title { color: var(--red); background: #fdf5f4; }
.validation-title > div { display: flex; align-items: center; gap: 6px; }
.validation-title strong { font-size: 9px; }
.validation-title > span { font-size: 8px; }
.validation-grid { display: grid; grid-template-columns: repeat(3, 1fr); padding: 9px 11px; gap: 5px 10px; }
.validation-item { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 3px; color: #718079; font-size: 8px; }
.validation-item.ok svg { color: var(--green); }
.validation-item.bad svg, .validation-item.bad b { color: var(--red); }
.validation-item b { color: #668176; font-size: 7px; }
.mismatch-list { padding: 2px 12px 9px; color: #8c4541; font-size: 8px; }
.mismatch-list p { margin: 6px 0; padding: 7px; border-radius: 5px; background: #fdf5f4; }
.mismatch-list code { font-size: 7px; font-weight: 700; }
.mismatch-list small { color: #a5726f; }
.result-actions { display: flex; justify-content: flex-end; margin-top: 13px; gap: 5px; }

.error-state { min-height: 645px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 38px; text-align: center; background: linear-gradient(180deg, #fff 0, #fffafa 100%); }
.error-icon { width: 51px; height: 51px; display: grid; place-items: center; color: var(--red); background: #f9e8e6; border-radius: 15px; margin-bottom: 14px; }
.error-kicker { font-size: 7px; font-weight: 700; letter-spacing: 1.5px; color: #b47a76; }
.error-state h2 { margin: 7px 0 6px; font-size: 15px; }
.error-state > p { max-width: 380px; margin: 0; color: #87918e; font-size: 9px; line-height: 1.65; }
.error-state code { color: #985b57; background: #f9eceb; padding: 2px 4px; border-radius: 3px; }
.error-list { width: 100%; display: grid; gap: 7px; margin: 19px 0 15px; text-align: left; }
.error-list > div { position: relative; border: 1px solid #ead1cf; border-radius: 8px; background: #fff; padding: 10px 12px; }
.error-list span { float: right; color: #a86965; font-family: monospace; font-size: 7px; }
.error-list strong { display: block; color: #854a46; font-size: 9px; }
.error-list p { margin: 4px 0; color: #775e5c; font-size: 9px; }
.error-list small { color: #ae918f; font-size: 7px; }

.history-page { max-width: 1240px; }
.history-summary { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: stretch; margin-bottom: 16px; }
.history-summary > div { min-height: 92px; background: white; border: 1px solid var(--line); border-radius: 11px; padding: 14px 17px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.history-summary span { color: #7b8883; font-size: 9px; font-weight: 600; }
.history-summary strong { grid-row: span 2; font-size: 28px; color: var(--green); }
.history-summary small { color: #9ba5a1; font-size: 8px; }
.history-summary > button { align-self: center; margin-left: 8px; }
.history-header { padding: 19px 22px; border-bottom: 1px solid var(--line); }
.history-header h2 { margin: 0; font-size: 13px; }
.history-header p { margin: 4px 0 0; color: #89948f; font-size: 9px; }
.history-list { display: grid; }
.history-row { min-height: 70px; border: 0; border-bottom: 1px solid #edf0ef; background: white; display: grid; grid-template-columns: 34px minmax(140px, 1fr) minmax(160px, 1fr) 100px 20px; align-items: center; gap: 11px; padding: 10px 20px; text-align: left; }
.history-row:hover { background: #fafcfb; }
.history-row:last-child { border-bottom: 0; }
.history-avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 700; }
.history-main strong, .history-main span, .history-evidence span, .history-evidence b { display: block; }
.history-main strong { font-size: 10px; }
.history-main span { margin-top: 3px; color: #84908b; font-size: 8px; }
.history-evidence span { color: #a0aaa6; font-size: 7px; }
.history-evidence b { margin-top: 2px; color: #62756e; font-size: 8px; }
.history-row time { color: #8d9894; font-size: 8px; }
.row-arrow { color: #a0aaa6; }
.history-empty { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #91a09a; }
.history-empty h3 { color: #495a54; font-size: 13px; margin: 14px 0 5px; }
.history-empty p { font-size: 9px; margin: 0 0 16px; }

#toast { position: fixed; left: 50%; bottom: 26px; z-index: 30; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; border-radius: 8px; background: #1c3029; color: white; padding: 10px 15px; font-size: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); transition: .2s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { padding-inline: 6px; justify-content: center; }
  .brand > div:last-child, .nav-item span, .nav-item b, .sidebar-note, .user-card > div:last-child { display: none; }
  .nav-item { justify-content: center; }
  .user-card { justify-content: center; }
  .workspace-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 70px; padding: 0 18px; }
  .mobile-brand { width: 34px; height: 34px; display: grid; place-items: center; margin-right: 10px; border: 0; border-radius: 9px; background: var(--green); color: white; }
  .topbar > div:nth-child(2) { margin-right: auto; }
  .system-status { font-size: 0; padding: 7px; }
  .system-status i { margin: 0; }
  .page-content { padding: 16px 12px 30px; }
  .sample-strip { align-items: flex-start; flex-direction: column; }
  .sample-list { justify-content: flex-start; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-heading { padding: 15px; }
  .form-body, .result-success { padding-left: 15px; padding-right: 15px; }
  .form-actions { padding: 15px; }
  .form-actions .button.primary { flex: 1; }
  .result-body, .result-empty, .error-state { min-height: 520px; }
  .validation-grid { grid-template-columns: repeat(2, 1fr); }
  .dm-editor-label small, .result-topline > div > span:last-child { display: none; }
  .history-summary { grid-template-columns: 1fr 1fr; }
  .history-summary > button { grid-column: span 2; margin: 0; }
  .history-row { grid-template-columns: 34px 1fr 20px; }
  .history-evidence, .history-row time { display: none; }
}
