:root {
  --ink: #102a34;
  --muted: #68808a;
  --paper: #f4f7f5;
  --panel: #fbfcfa;
  --line: #d8e1de;
  --cobalt: #0755d9;
  --cobalt-deep: #063ca0;
  --mint: #31d69b;
  --mint-soft: #dff8ee;
  --amber: #ffb648;
  --amber-soft: #fff2dc;
  --coral: #f36f5d;
  --mono: "DM Mono", monospace;
  --sans: "IBM Plex Sans KR", sans-serif;
  --shadow: 0 22px 50px rgba(33, 69, 78, 0.09);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea { font: inherit; }
button { color: inherit; }

.skip-link { position: fixed; top: -80px; left: 20px; z-index: 999; background: #fff; padding: 12px 18px; border-radius: 8px; color: var(--cobalt); }
.skip-link:focus { top: 18px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.side-rail { position: fixed; inset: 0 auto 0 0; width: 246px; z-index: 20; display: flex; flex-direction: column; padding: 28px 18px 22px; color: white; overflow: hidden; background: var(--cobalt); }
.side-rail::before { content: ""; position: absolute; width: 260px; height: 260px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; left: -104px; bottom: 72px; box-shadow: 0 0 0 46px rgba(255,255,255,.035), 0 0 0 92px rgba(255,255,255,.025); }
.brand { position: relative; display: flex; gap: 13px; align-items: center; padding: 0 9px 30px; border-bottom: 1px solid rgba(255,255,255,.22); }
.brand-mark { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.62); border-radius: 50%; }
.brand-mark i:first-child, .brand-mark i:last-child { position: absolute; display: block; background: var(--mint); border-radius: 8px; }
.brand-mark i:first-child { width: 18px; height: 5px; }
.brand-mark i:last-child { width: 5px; height: 18px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy b { letter-spacing: .13em; font-size: 16px; }
.brand-copy small { margin-top: 7px; color: rgba(255,255,255,.63); font: 10px var(--mono); letter-spacing: .13em; }

.main-nav { position: relative; display: grid; gap: 5px; margin-top: 28px; }
.nav-item { border: 0; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 13px 12px; border-radius: 8px; background: transparent; color: rgba(255,255,255,.7); cursor: pointer; transition: .2s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.08); transform: translateX(2px); }
.nav-item.active { color: var(--ink); background: white; box-shadow: 0 9px 25px rgba(4, 42, 108, .25); }
.nav-index { font: 10px var(--mono); opacity: .6; }
.nav-item > span:nth-child(2) { font-size: 14px; font-weight: 600; }
.nav-item em { min-width: 22px; height: 22px; display: grid; place-items: center; font: normal 10px var(--mono); color: var(--ink); background: var(--amber); border-radius: 20px; }
.rail-footer { position: relative; margin-top: auto; display: grid; gap: 12px; }
.privacy-stamp { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; font: 10px var(--mono); letter-spacing: .08em; }
.privacy-stamp b { color: var(--mint); }
.connection-button { border: 0; display: flex; gap: 9px; align-items: center; width: 100%; padding: 11px 12px; color: white; background: rgba(0, 20, 70, .28); border-radius: 7px; cursor: pointer; font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(255,182,72,.12); }
.connection-button.connected .live-dot { background: var(--mint); animation: ping 2.4s infinite; }

.workspace { grid-column: 2; min-width: 0; padding: 0 42px 52px; }
.topbar { min-height: 108px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.eyebrow, .section-code { margin: 0 0 6px; color: var(--cobalt); font: 10px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 14px; }
#clock { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; transition: .2s; }
.icon-button:hover { border-color: var(--cobalt); color: var(--cobalt); }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.operator { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.operator > span { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 50%; font: 10px var(--mono); }
.operator div { display: flex; flex-direction: column; }
.operator b { font-size: 12px; }
.operator small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.view { display: none; padding-top: 34px; }
.view.active { display: block; }
.command-banner { position: relative; min-height: 246px; display: flex; align-items: center; overflow: hidden; padding: 42px 50px; color: white; background: var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.command-banner::before { content: ""; position: absolute; inset: 0; opacity: .32; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(90deg, black, transparent 65%); }
.command-banner::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--mint); }
.banner-copy { position: relative; z-index: 2; }
.banner-copy .section-code { color: var(--mint); }
.banner-copy h2 { margin: 0; font-size: clamp(28px, 3vw, 43px); line-height: 1.25; letter-spacing: -.055em; font-weight: 400; }
.banner-copy h2 strong { color: var(--mint); font-weight: 700; }
.banner-copy > p:last-child { margin: 18px 0 0; color: rgba(255,255,255,.62); font-size: 13px; }
.banner-watermark { position: absolute; right: -18px; bottom: -37px; color: rgba(255,255,255,.035); font: 700 clamp(84px, 12vw, 180px)/1 var(--sans); letter-spacing: -.08em; }
.pulse-orbit { position: absolute; right: 9%; width: 142px; height: 142px; display: grid; place-items: center; }
.pulse-orbit i { width: 19px; height: 19px; display: block; background: var(--mint); border-radius: 50%; box-shadow: 0 0 45px var(--mint); }
.pulse-orbit b { position: absolute; bottom: 4px; font: 9px var(--mono); color: var(--mint); letter-spacing: .2em; }
.orbit { position: absolute; border: 1px solid rgba(49,214,155,.35); border-radius: 50%; animation: orbitPulse 2.8s infinite ease-out; }
.orbit-a { inset: 22px; }
.orbit-b { inset: 0; animation-delay: .5s; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.metric-card { position: relative; min-height: 138px; display: flex; flex-direction: column; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.metric-card::before { content: ""; position: absolute; top: 0; right: 18px; width: 25px; height: 3px; background: var(--mint); }
.metric-card.attention::before { background: var(--amber); }
.metric-card > span { color: var(--muted); font-size: 12px; }
.metric-card strong { margin-top: auto; font: 500 34px var(--mono); letter-spacing: -.08em; }
.metric-card strong i { font-style: normal; }
.metric-card small { color: #91a2a8; font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 14px; margin-top: 14px; }
.panel { min-width: 0; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-header h3 { margin: 0; font-size: 16px; letter-spacing: -.025em; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 30px; font: 9px var(--mono); }
.status-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-chip.good { color: #05744e; background: var(--mint-soft); }
.flow-panel { min-height: 264px; }
.flow-track { display: flex; align-items: center; margin-top: 38px; }
.flow-node { flex: 0 0 auto; display: grid; gap: 2px; text-align: center; }
.flow-node i { width: 40px; height: 40px; display: grid; place-items: center; margin: 0 auto 9px; color: white; background: var(--cobalt); border-radius: 50%; box-shadow: 0 0 0 6px #e4ecfd; font: normal 10px var(--mono); }
.flow-node span { color: var(--muted); font: 9px var(--mono); }
.flow-node b { font-size: 11px; }
.flow-line { flex: 1; height: 1px; min-width: 18px; margin: -22px 8px 0; overflow: hidden; background: var(--line); }
.flow-line span { display: block; width: 42%; height: 100%; background: var(--mint); animation: flow 2.5s infinite linear; }
.sla-row { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; margin-top: 31px; color: var(--muted); font-size: 10px; }
.sla-row b { color: var(--ink); font: 11px var(--mono); }
.sla-bar { height: 4px; overflow: hidden; background: #e5ebe9; border-radius: 10px; }
.sla-bar i { display: block; height: 100%; background: var(--mint); }
.system-panel { min-height: 264px; }
.system-list { display: grid; margin-top: 19px; }
.system-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid #e8edeb; }
.system-row:first-child { border-top: 0; }
.system-row > i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft); }
.system-row.attention > i { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.system-row b { display: block; font-size: 11px; }
.system-row small { display: block; color: var(--muted); font-size: 9px; margin-top: 2px; }
.system-row > span { color: var(--muted); font: 9px var(--mono); }
.event-panel { min-height: 280px; }
.text-button { padding: 0; border: 0; color: var(--cobalt); background: transparent; cursor: pointer; font-size: 10px; }
.event-list { margin-top: 20px; }
.event-row { display: grid; grid-template-columns: 95px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid #e7edeb; }
.event-row time { color: var(--muted); font: 9px var(--mono); }
.event-row b { display: block; font-size: 11px; }
.event-row small { display: block; max-width: 240px; overflow: hidden; color: var(--muted); font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.event-row i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.quality-panel { position: relative; overflow: hidden; color: white; background: var(--cobalt); border-color: transparent; }
.quality-panel .section-code { color: rgba(255,255,255,.55); }
.quality-panel h3 { color: white; }
.quality-panel::after { content: "99"; position: absolute; right: -13px; bottom: -38px; color: rgba(255,255,255,.07); font: 700 170px/1 var(--mono); letter-spacing: -.16em; }
.quality-score { position: relative; z-index: 2; display: flex; flex-direction: column; margin-top: 21px; }
.quality-score span, .quality-score small { color: rgba(255,255,255,.62); font-size: 10px; }
.quality-score strong { margin: 5px 0 0; font: 500 48px var(--mono); letter-spacing: -.1em; }
.quality-score sup { font-size: 15px; }
.mini-bars { position: absolute; z-index: 2; display: flex; align-items: end; gap: 5px; right: 25px; top: 74px; width: 105px; height: 90px; }
.mini-bars i { flex: 1; height: var(--h); background: rgba(255,255,255,.22); border-radius: 3px 3px 0 0; }
.mini-bars i.now { background: var(--mint); }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 4px 0 28px; }
.page-intro h2 { margin: 0; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.055em; }
.page-intro > div > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { border: 0; min-height: 42px; padding: 0 18px; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 600; }
.primary-button { color: white; background: var(--cobalt); box-shadow: 0 8px 18px rgba(7,85,217,.18); }
.primary-button:hover { background: var(--cobalt-deep); }
.secondary-button { color: var(--ink); background: #e8efed; }
.split-tables { display: grid; gap: 14px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-header { padding: 22px 24px 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { color: var(--muted); background: #f0f4f2; font: 9px var(--mono); letter-spacing: .04em; text-align: left; }
th, td { height: 49px; padding: 0 24px; border-top: 1px solid var(--line); white-space: nowrap; }
td:first-child { font-family: var(--mono); }
.table-empty { color: var(--muted); text-align: center; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 30px; color: #16583f; background: var(--mint-soft); font: 9px var(--mono); }
.pill.hold, .pill.rejected, .pill.failed { color: #845409; background: var(--amber-soft); }
.pill.cancelled, .pill.superseded { color: #6b6871; background: #ecebee; }

.legend { display: flex; gap: 18px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.amber { background: var(--amber); }.dot.green { background: var(--mint); }
.mapping-list { display: grid; gap: 12px; }
.mapping-card { display: grid; grid-template-columns: 70px minmax(180px, .8fr) 1.4fr auto; align-items: center; gap: 25px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px; }
.mapping-card .queue-no { color: var(--muted); font: 10px var(--mono); }
.mapping-card h3 { margin: 0; font-size: 14px; }
.mapping-card p { margin: 5px 0 0; color: var(--muted); font: 9px var(--mono); }
.candidates { display: flex; gap: 7px; min-width: 0; }
.candidate { flex: 1; min-width: 0; padding: 9px 10px; background: #eef3f1; border-radius: 7px; }
.candidate b, .candidate small { overflow: hidden; display: block; text-overflow: ellipsis; white-space: nowrap; }
.candidate b { font: 9px var(--mono); }.candidate small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.empty-state { max-width: 520px; margin: 80px auto; text-align: center; }
.empty-state span { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto; border: 1px solid var(--mint); border-radius: 50%; color: #098458; font-size: 20px; }
.empty-state h3 { margin: 18px 0 6px; }.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.hash-seal { min-width: 150px; padding: 12px 16px; border: 1px dashed #82a59a; color: var(--muted); font: 9px var(--mono); transform: rotate(-2deg); }
.hash-seal span, .hash-seal b { display: block; }.hash-seal b { margin-top: 3px; color: #087f57; letter-spacing: .14em; }
.audit-panel { padding: 0; overflow: hidden; }
.audit-head, .audit-row { display: grid; grid-template-columns: 170px 1fr 1.4fr 1fr 100px; gap: 16px; align-items: center; padding: 0 24px; }
.audit-head { min-height: 42px; color: var(--muted); background: #edf2f0; font: 9px var(--mono); }
.audit-row { min-height: 56px; border-top: 1px solid var(--line); font-size: 10px; }
.audit-row time, .audit-row code { font: 9px var(--mono); color: var(--muted); }
.audit-row b { font-size: 11px; }.audit-row small { color: var(--muted); }

dialog { width: min(540px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 14px; color: var(--ink); background: var(--panel); box-shadow: 0 35px 100px rgba(10,34,43,.3); }
dialog::backdrop { background: rgba(13,39,48,.58); backdrop-filter: blur(4px); }
dialog form { position: relative; display: grid; gap: 16px; padding: 34px; }
dialog h2 { margin: -6px 0 0; font-size: 24px; letter-spacing: -.04em; }
.dialog-close { position: absolute; top: 16px; right: 18px; border: 0; color: var(--muted); background: transparent; font-size: 26px; cursor: pointer; }
.dialog-drug { margin: -5px 0 4px; padding: 12px; background: var(--amber-soft); border-radius: 7px; font-size: 12px; }
dialog label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 600; }
dialog input, dialog textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; outline: 0; resize: vertical; }
dialog input:focus, dialog textarea:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(7,85,217,.1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.form-help { margin: -5px 0 0; color: var(--muted); font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 380px; padding: 13px 17px; border-radius: 8px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #983c30; }

.reveal { animation: reveal .65s both cubic-bezier(.2,.7,.2,1); }
.delay-1 { animation-delay: .08s; }.delay-2 { animation-delay: .16s; }

@keyframes reveal { from { opacity: 0; transform: translateY(12px); } }
@keyframes flow { from { transform: translateX(-120%); } to { transform: translateX(340%); } }
@keyframes ping { 50% { box-shadow: 0 0 0 7px rgba(49,214,155,.08); } }
@keyframes orbitPulse { 0% { opacity: 0; transform: scale(.5); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .mapping-card { grid-template-columns: 55px 1fr auto; }
  .mapping-card .candidates { grid-column: 2 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .side-rail { position: sticky; top: 0; width: 100%; height: auto; padding: 12px 14px; flex-direction: row; align-items: center; box-shadow: 0 8px 20px rgba(7,61,159,.16); }
  .side-rail::before, .brand-copy, .privacy-stamp { display: none; }
  .brand { padding: 0 10px 0 0; border: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .main-nav { margin: 0; display: flex; flex: 1; overflow-x: auto; }
  .nav-item { width: auto; grid-template-columns: auto; padding: 10px 12px; white-space: nowrap; }
  .nav-index, .nav-item em { display: none; }
  .nav-item > span:nth-child(2) { font-size: 11px; }
  .rail-footer { margin: 0 0 0 8px; }
  .connection-button { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .connection-button span:last-child { display: none; }
  .workspace { padding: 0 16px 36px; }
  .topbar { min-height: 78px; }
  .top-actions #clock, .operator div { display: none; }
  .command-banner { min-height: 260px; padding: 34px 27px; align-items: flex-start; }
  .pulse-orbit { right: 7%; bottom: 18px; width: 100px; height: 100px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 118px; padding: 16px; }
  .flow-track { overflow-x: auto; padding-bottom: 12px; }
  .flow-line { min-width: 28px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .mapping-card { grid-template-columns: 42px 1fr; gap: 14px; }
  .mapping-card .primary-button { grid-column: 2; }
  .mapping-card .candidates { grid-column: 1 / -1; }
  .audit-head { display: none; }
  .audit-row { grid-template-columns: 1fr auto; gap: 7px; padding: 14px 17px; }
  .audit-row > *:nth-child(3), .audit-row > *:nth-child(4) { grid-column: 1; }
  .audit-row > *:last-child { grid-column: 2; grid-row: 1; }
}

@media (max-width: 440px) {
  .nav-item { padding-inline: 9px; }
  .nav-item > span:nth-child(2) { font-size: 10px; }
  .topbar h1 { font-size: 18px; }
  .operator { display: none; }
  .metric-card strong { font-size: 28px; }
  .sla-row { grid-template-columns: auto auto; }
  .sla-bar { grid-column: 1 / -1; }
  .candidates { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

