:root {
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
  color: #11182f;
  background: #f7f7fc;
  line-height: 1.5;
  --navy: #11182f;
  --navy-2: #242d4d;
  --purple: #5b2fb5;
  --purple-deep: #421d8f;
  --purple-soft: #f0ebff;
  --blue: #286cb8;
  --blue-soft: #eaf2ff;
  --teal: #16834c;
  --amber: #c76a12;
  --red: #d63d4a;
  --green: #16834c;
  --border: #dde0ea;
  --muted: #697086;
  --surface: #ffffff;
  --warm: #f5f2fc;
  --shadow: 0 18px 50px rgba(17, 24, 47, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
.media-dialog { width: min(900px, 94vw); height: min(900px, 92dvh); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }
.media-dialog::backdrop { background: rgba(17,24,47,.6); }
.media-dialog button { display: block; margin: 0 0 12px auto; min-height: 44px; }
.media-dialog iframe, .media-dialog img { width: 100%; height: calc(100% - 60px); object-fit: contain; border: 0; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 76% 12%, #e8dfff 0, transparent 32%),
    linear-gradient(145deg, #fbfaff, #f2f3fa 65%);
}
.login-card {
  width: min(460px, 100%);
  padding: 42px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(17, 24, 47, .14);
}
.login-card img { max-width: 100%; object-fit: contain; }
.eyebrow { margin: 22px 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
h1 { margin: 0; font-size: clamp(25px, 3vw, 32px); letter-spacing: -.035em; }
.muted, .page-description { color: var(--muted); }
.login-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
label { display: grid; gap: 7px; margin-top: 18px; font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 13px;
  color: var(--navy);
  background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(91, 47, 181, .25);
  outline-offset: 2px;
}
.login-card form > button {
  width: 100%; min-height: 50px; margin-top: 24px; border: 0; border-radius: 12px;
  color: #fff; background: var(--purple); font-weight: 800;
}
.error { min-height: 23px; color: var(--red); font-size: 13px; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 24px 18px; color: #fff;
  background: linear-gradient(180deg, var(--navy), #21184a 70%, var(--purple-deep));
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 850; }
.brand small { display: block; color: #c9b8f7; font-size: 9px; letter-spacing: .18em; }
.nav-group { margin-top: 28px; }
.nav-group > span { display: block; padding: 0 12px 8px; color: #a9a7c7; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.nav-group a {
  display: flex; align-items: center; justify-content: space-between; min-height: 42px;
  margin: 3px 0; padding: 10px 12px; border-radius: 10px;
  color: #c9d6e1; text-decoration: none; font-size: 13px; font-weight: 700;
}
.nav-group a:hover, .nav-group a.active { color: #fff; background: rgba(255,255,255,.11); }
.nav-group a.active::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a98df4; }
.sidebar-footer { margin-top: auto; padding-top: 22px; display: grid; gap: 9px; }
.role-chip { color: #a9c3d7; font-size: 11px; }
.logout { min-height: 42px; border: 1px solid rgba(255,255,255,.13); border-radius: 10px; color: #fff; background: rgba(255,255,255,.06); font-weight: 700; }

.content { min-width: 0; padding: 34px clamp(22px, 4vw, 56px) 70px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar .eyebrow { margin: 0 0 4px; }
.page-description { margin: 7px 0 0; max-width: 760px; font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.admin-chip { padding: 10px 13px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 12px; }
.button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--purple); color: #fff; font-size: 12px; font-weight: 800; }
.button--secondary { border: 1px solid var(--border); background: #fff; color: var(--navy); }
.button--danger { background: #fff0ee; color: var(--red); }
.button--small { min-height: 32px; padding: 0 10px; border-radius: 8px; }
.button:disabled { opacity: .48; cursor: not-allowed; }

.notice { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #ecd49f; border-radius: 12px; background: #fff8e8; color: #704b13; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 13px; }
.metric, .panel {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 rgba(17,24,47,.03);
}
.metric { min-height: 128px; padding: 19px; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 9px; font-size: 28px; letter-spacing: -.04em; }
.metric small { display: block; margin-top: 5px; color: var(--blue); font-size: 11px; }
.panel { margin-top: 15px; padding: 20px; overflow: hidden; }
.panel--warm { background: var(--warm); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.case-builder {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: stretch;
  gap: 12px;
}
.case-builder > i {
  align-self: center;
  color: #9aa6af;
  font-size: 25px;
  font-style: normal;
  font-weight: 500;
}
.case-builder__step {
  position: relative;
  min-height: 220px;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 14px;
  background: #fff;
}
.case-builder__step--answer { border-top-color: #bd6a23; }
.case-builder__step--data { border-top-color: var(--green); }
.case-builder__step > span {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}
.case-builder__step--answer > span { color: #a95b1a; }
.case-builder__step--data > span { color: var(--green); }
.case-builder__step > strong {
  display: block;
  margin-top: 8px;
  font-size: 16px;
  letter-spacing: -.02em;
}
.case-builder__step ul {
  margin: 15px 0 18px;
  padding-left: 18px;
  color: #46586a;
  font-size: 12px;
  line-height: 1.8;
}
.case-builder__step small {
  position: absolute;
  right: 19px;
  bottom: 15px;
  left: 19px;
  padding-top: 10px;
  border-top: 1px solid #e7ebee;
  color: var(--muted);
  font-size: 9px;
}
.case-builder__rule {
  margin: 15px 0 0;
  padding: 13px 15px;
  border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0;
  color: #685022;
  background: #fff8e8;
  font-size: 12px;
}
.page-guide {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 20px;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(120deg, var(--navy), var(--purple-deep));
  box-shadow: var(--shadow);
}
.page-guide > span {
  color: #a9c9dd;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
}
.page-guide strong { display: block; font-size: 17px; }
.page-guide p { margin: 4px 0 0; color: #d5e2eb; font-size: 12px; }
.table-wrap { overflow: auto; margin: 0 -20px -20px; }
table { border-collapse: collapse; width: 100%; min-width: 940px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e7ecf0; text-align: left; vertical-align: middle; font-size: 12px; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f8fafb; font-weight: 750; }
td strong { font-weight: 800; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #edf1f4; color: #4d5d6c; font-size: 10px; font-weight: 800; }
.badge--good { background: #e5f3ea; color: var(--green); }
.badge--warn { background: #fff1d8; color: var(--amber); }
.badge--danger { background: #fae7e5; color: var(--red); }
.badge--info { background: var(--blue-soft); color: var(--blue); }
.empty, .loading, .page-error { padding: 76px 20px; text-align: center; color: var(--muted); }
.empty strong, .page-error strong { display: block; color: var(--navy); font-size: 17px; }
.empty p, .page-error p { margin: 6px auto 0; max-width: 500px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 170px; padding: 9px 11px; font-size: 12px; }
.truth-note { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.truth-note article { padding: 17px; border-radius: 12px; background: #eef5f8; }
.truth-note article:last-child { background: #f7efe4; }
.truth-note h3 { margin: 0 0 7px; font-size: 14px; }
.truth-note p { margin: 0; color: var(--muted); font-size: 12px; }
.action-dialog { width: min(560px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(17,24,47,.25); }
.action-dialog::backdrop { background: rgba(12,24,38,.48); backdrop-filter: blur(3px); }
.action-dialog form { padding: 26px; }
.action-dialog h2 { margin: 0; font-size: 20px; }
.action-dialog p { margin: 7px 0 18px; color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.case-compare-dialog { width: min(1320px, calc(100% - 40px)); max-height: calc(100vh - 40px); }
.case-compare { padding: 26px; }
.case-compare__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.case-compare__head > div > span { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.case-compare__head h2 { margin: 5px 0 0; font-size: 21px; }
.case-compare__head p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.case-compare__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.compare-column { overflow: hidden; border: 1px solid #dfe6ea; border-radius: 14px; background: #fbfcfc; }
.compare-column > header { padding: 13px 15px; border-top: 4px solid #65798a; background: #f3f6f7; }
.compare-column--ai > header { border-top-color: #bd6a23; background: #fff8ef; }
.compare-column--truth > header { border-top-color: var(--green); background: #eef7f1; }
.compare-column > header span { font-size: 13px; font-weight: 850; }
.compare-column dl { margin: 0; padding: 2px 15px 14px; }
.compare-column dl > div { padding: 12px 0; border-bottom: 1px solid #e7ecef; }
.compare-column dl > div:last-child { border-bottom: 0; }
.compare-column dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.compare-column dd { margin: 0; color: var(--navy); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .case-builder { grid-template-columns: 1fr; }
  .case-builder > i { display: none; }
  .case-compare__grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .workspace { display: block; }
  .sidebar { position: relative; height: auto; max-height: none; }
  .brand { margin-bottom: 4px; }
  #nav { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .nav-group { display: contents; }
  .nav-group > span { display: none; }
  .nav-group a { flex: 0 0 auto; background: rgba(255,255,255,.06); }
  .sidebar-footer { margin-top: 8px; padding-top: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .sidebar-footer .role-chip { overflow-wrap: anywhere; }
  .sidebar-footer .logout { min-height: 44px; padding-inline: 16px; }
  .content { padding: 24px 16px 60px; }
  .topbar { display: block; }
  .topbar-actions { margin-top: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 110px; }
  .truth-note { grid-template-columns: 1fr; }
  .page-guide { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 460px) {
  .login-card { padding: 30px 22px; }
  .metrics { grid-template-columns: 1fr; }
}

.restoration-dialog {width:min(1560px,96vw);max-width:96vw;}
.restoration-compare-grid {grid-template-columns:repeat(4,minmax(200px,1fr));}
.restoration-photo-row {display:flex;gap:16px;overflow:auto;padding:20px 0;}
.restoration-photo-row figure {margin:0;min-width:220px;max-width:300px;}
.restoration-photo-row img {width:100%;height:180px;object-fit:contain;background:#f4f1ed;border-radius:12px;}
.restoration-photo-row figcaption {padding:8px 0;font-weight:700;}
.restoration-photo-row button {font-size:12px;margin:4px 0;}
.restoration-attention {margin-bottom:24px;}
.restoration-feedback {color:#b42318;}
.pagination {display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;padding:20px;}
.pagination .button {min-height:44px;}
@media(max-width:1000px){.restoration-compare-grid{grid-template-columns:repeat(2,minmax(200px,1fr));}}
@media(max-width:600px){.restoration-compare-grid{grid-template-columns:1fr;}}
