:root {
  color-scheme: light;
  --ink: #101c34;
  --muted: #6d7f9d;
  --faint: #98a7bf;
  --line: #e2e9f2;
  --canvas: #f4f7fb;
  --panel: #ffffff;
  --navy: #142139;
  --blue: #2c6bed;
  --blue-soft: #eaf2ff;
  --green: #07966f;
  --green-soft: #e8f8f1;
  --amber: #dc8100;
  --amber-soft: #fff5cf;
  --red: #df3d4c;
  --red-soft: #ffe8e8;
  --shadow: 0 10px 30px rgba(38, 58, 91, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 12%, rgba(44, 107, 237, 0.035), transparent 24rem),
    var(--canvas);
  color: var(--ink);
  font-family: "IBM Plex Sans KR", sans-serif;
  font-size: 14px;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 78px;
  padding: 14px 2.1vw;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(20, 33, 57, 0.1);
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-text { display: block; min-width: 0; }
.brand strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.04em; }
.brand small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2c6bed, #7b3fe4);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fc;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #384964;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover { background: #fff; transform: translateY(-1px); }
.nav-item.is-active { color: var(--blue); background: #fff; box-shadow: 0 2px 8px rgba(30, 56, 94, 0.1); }
.nav-item svg { width: 15px; height: 15px; }
.nav-item[hidden] { display: none; }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.ocr-link, .sync-pill, .date-pill, .icon-button, .users-button, .session-pill {
  min-height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.ocr-link {
  gap: 7px;
  padding: 0 16px;
  border: 1px solid #f1bf35;
  color: #9a5600;
  background: #fff3bd;
  text-decoration: none;
}
.ocr-link svg { width: 16px; }
.icon-button { width: 38px; padding: 0; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.icon-button svg { width: 17px; }
.icon-button:hover svg { transform: rotate(45deg); transition: transform 180ms ease; }
.sync-pill { padding: 0 13px; border: 1px solid #b7e4cd; background: #edf9f3; color: #16754a; font-size: 11px; }
.sync-pill.is-syncing { border-color: #bfd7ff; background: #eef5ff; color: #245ead; }
.sync-pill.is-offline { border-color: #f2c5c5; background: #fff0f0; color: #b33232; }
.date-pill { padding: 0 15px; background: #e9eef5; color: #475b78; font-size: 12px; }

.users-button {
  gap: 7px;
  padding: 0 16px;
  border: 1px solid #c4d4f6;
  background: linear-gradient(135deg, #eaf2ff, #f4f8ff);
  color: #1d4fbb;
  font-size: 12.5px;
  cursor: pointer;
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.users-button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(44, 107, 237, .18); }
.users-button svg { width: 16px; }
.users-button[hidden], .session-pill[hidden] { display: none; }

.session-pill {
  gap: 8px;
  padding: 0 6px 0 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: #384964;
  font-size: 12px;
}
.session-pill svg { width: 15px; color: var(--muted); }
.session-pill em { font-style: normal; font-weight: 700; white-space: nowrap; }
.logout-button {
  padding: 6px 11px;
  border: 0;
  border-radius: 999px;
  background: #f0f3f8;
  color: #5c6f8d;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.logout-button:hover { background: var(--red-soft); color: var(--red); }

.center-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; padding-bottom: 13px; border-bottom: 1px dashed var(--line); }
.center-filter label { color: #384964; font-size: 12.5px; font-weight: 700; }
.center-filter .filter-control { min-height: 38px; padding: 0 12px; }
.center-filter small { color: var(--faint); font-size: 11.5px; }

.page-shell { width: min(1360px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 72px; }
.view { animation: view-in 360ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-family: Manrope, sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(23px, 2vw, 30px); letter-spacing: -0.055em; }
.page-heading p, .section-head p { margin-bottom: 0; color: var(--muted); }
.heading-tools { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }

.query-panel, .panel, .metric-card, .customer-card, .hero-panel, .report-paper {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.query-panel { padding: 24px 30px; border-radius: var(--radius); margin-bottom: 26px; }
.query-caption { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.ai-tag { display: inline-grid; place-items: center; width: 30px; height: 23px; border-radius: 5px; color: #fff; background: #6659e8; font-family: Manrope, sans-serif; font-weight: 800; }
.query-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.query-input, .filter-control {
  border: 1px solid #d8e0ec;
  border-radius: 10px;
  background: #f8faff;
  color: var(--ink);
  outline: none;
}
.query-input { width: 100%; min-height: 52px; padding: 0 17px; font-size: 15px; }
.query-input:focus, .filter-control:focus { border-color: #87aaf7; box-shadow: 0 0 0 3px rgba(44,107,237,.1); }
.primary-button, .secondary-button {
  border-radius: 9px;
  padding: 0 20px;
  min-height: 40px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
.primary-button { color: #fff; background: var(--blue); }
.primary-button:hover { background: #1959d3; }
.secondary-button { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.query-row .primary-button { min-width: 78px; }
.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.chip { padding: 7px 13px; border: 1px solid #dce4ef; border-radius: 999px; background: #f8fafc; color: #536681; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: #a8bde8; color: var(--blue); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card { position: relative; min-height: 120px; padding: 19px 21px; border-radius: 12px; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone, var(--blue)); }
.metric-card.blue { --tone: var(--blue); }
.metric-card.green { --tone: var(--green); }
.metric-card.amber { --tone: var(--amber); }
.metric-card.red { --tone: var(--red); }
.metric-card.soft-blue { background: #e8f4ff; }
.metric-card.soft-green { background: #e3f9ec; }
.metric-card.soft-amber { background: #fff6d5; }
.metric-card.soft-red { background: #ffe9e9; }
.metric-label { color: #56708f; font-size: 12px; }
.metric-value { margin-top: 12px; font: 800 25px/1 Manrope, sans-serif; letter-spacing: -0.04em; }
.metric-unit { margin-left: 4px; color: #55708c; font: 600 12px/1 "IBM Plex Sans KR", sans-serif; }
.metric-note { margin-top: 11px; color: var(--muted); font-size: 11px; }

.content-grid { display: grid; grid-template-columns: .83fr 1.17fr; gap: 16px; margin-bottom: 24px; }
.panel { border-radius: var(--radius); padding: 24px; min-width: 0; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.section-head h2, .section-head h3 { margin-bottom: 4px; font-size: 16px; letter-spacing: -0.035em; }
.section-head small { color: var(--muted); }

.stock-list { display: grid; gap: 16px; }
.stock-row { display: grid; grid-template-columns: 80px 1fr 68px; align-items: center; gap: 12px; }
.stock-name { font-weight: 700; }
.bar-track { height: 19px; border-radius: 6px; background: #f0f3f8; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #397bf2, #2867e8); transform-origin: left; animation: grow 650ms ease both; }
@keyframes grow { from { transform: scaleX(0); } }
.stock-value { text-align: right; font: 700 13px Manrope, sans-serif; }
.stock-value small { display: block; margin-top: 2px; color: var(--muted); font: 400 9px "IBM Plex Sans KR", sans-serif; }

.chart-wrap { width: 100%; min-height: 300px; position: relative; }
.chart-wrap svg { width: 100%; height: 300px; overflow: visible; }
.chart-grid { stroke: #e6ecf4; stroke-dasharray: 4 5; }
.chart-label { fill: #7587a1; font-size: 10px; }
.chart-area { fill: rgba(7,150,111,.1); }
.chart-line { fill: none; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.legend { display: flex; justify-content: end; gap: 16px; color: var(--muted); font-size: 11px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; background: var(--legend); }

.table-panel { padding-bottom: 8px; }
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-control { min-height: 38px; padding: 0 12px; }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 11px 12px; color: #6c7c94; background: #f8fafc; font-size: 11px; text-align: left; }
.data-table td { padding: 13px 12px; border-top: 1px solid var(--line); font-size: 12px; }
.data-table tbody tr { cursor: pointer; transition: background 140ms ease; }
.data-table tbody tr:hover { background: #f8fbff; }
.number { font-family: Manrope, sans-serif; font-weight: 700; }
.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status.done { color: #087c5f; background: #dcf6ec; }
.status.pending { color: #ad6800; background: #fff1c1; }

.customer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.customer-toolbar label { color: var(--muted); font-size: 12px; }
.customer-toolbar select { margin-left: 8px; min-width: 280px; }
.customer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.customer-card { position: relative; padding: 17px 15px 14px; border-radius: 11px; border-left: 3px solid var(--amber); cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease; }
.customer-card:hover { transform: translateY(-2px); box-shadow: 0 15px 32px rgba(38,58,91,.12); }
.customer-card h3 { margin-bottom: 5px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-meta { min-height: 18px; color: var(--muted); font-size: 10px; }
.customer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.customer-stats div { padding: 9px 5px; border-radius: 7px; background: #f5f7fa; text-align: center; }
.customer-stats small { display: block; color: var(--muted); font-size: 9px; }
.customer-stats strong { display: block; margin-top: 5px; font: 700 13px Manrope, sans-serif; }
.outstanding { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 10px; border-radius: 7px; color: var(--amber); background: var(--amber-soft); font-size: 11px; }
.outstanding strong { font: 800 15px Manrope, sans-serif; }

.hero-panel { padding: 30px; border-radius: 14px; background: linear-gradient(125deg, #101b31, #1a2944); color: #fff; margin-bottom: 20px; box-shadow: 0 18px 40px rgba(16,27,49,.16); }
.hero-panel h2 { margin-bottom: 8px; font-size: 24px; }
.hero-panel p { color: #91add3; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; margin-top: 28px; }
.hero-stats strong { display: block; font: 800 23px Manrope, sans-serif; }
.hero-stats small { display: block; margin-top: 6px; color: #7d96bb; }

.driver-grid { display: grid; grid-template-columns: .84fr 1.16fr; gap: 16px; }
.rank-row.is-top { background: #fff8bf; }
.rank-badge { width: 23px; height: 23px; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; background: #9aabc2; font: 700 11px Manrope, sans-serif; }
.rank-badge.top { background: #f5b925; }
.score-track { display: inline-block; width: 70px; height: 5px; margin-right: 7px; vertical-align: middle; border-radius: 9px; background: #e8edf4; overflow: hidden; }
.score-track i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.driver-focus { min-height: 520px; }
.radar { width: min(420px, 88%); margin: 5px auto 20px; display: block; }
.radar-grid { fill: none; stroke: #dce4ef; }
.radar-shape { fill: rgba(44,107,237,.16); stroke: var(--blue); stroke-width: 2; }
.radar-dot { fill: var(--blue); }
.focus-note { padding: 16px; border-radius: 9px; background: #f6f8fb; color: #51627d; line-height: 1.7; }

.asset-summary { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.asset-summary .metric-card:first-child { grid-column: auto; }

.report-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.report-toolbar .left { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.report-paper { width: min(820px, 100%); margin: 0 auto; padding: 48px 52px; border-radius: 10px; }
.report-title { padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.report-title h1 { font-size: 23px; }
.report-section { margin-top: 27px; }
.report-section h2 { padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 14px; }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.report-kpi { padding: 14px; border-radius: 8px; background: #f4f7fb; }
.report-kpi small { color: var(--muted); }
.report-kpi strong { display: block; margin-top: 7px; font: 800 17px Manrope, sans-serif; }

.empty-state, .error-state { padding: 70px 20px; border: 1px dashed #ccd7e6; border-radius: 14px; background: rgba(255,255,255,.68); text-align: center; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 15px; color: var(--muted); }
.empty-state h2, .error-state h2 { margin-bottom: 8px; }
.empty-state p, .error-state p { color: var(--muted); }

.loading-state { display: grid; gap: 20px; }
.skeleton, .skeleton-grid i { display: block; border-radius: 12px; background: linear-gradient(90deg,#e9eef5 25%,#f6f8fb 50%,#e9eef5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton-title { width: 280px; height: 38px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.skeleton-grid i { height: 120px; }
.skeleton-panel { height: 420px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 340px; padding: 13px 17px; border-radius: 10px; color: #fff; background: var(--navy); box-shadow: 0 12px 30px rgba(16,28,52,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .customer-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .topbar { position: relative; display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .brand { flex: 1; }
  .brand small { display: none; }
  .top-actions .date-pill, .top-actions .icon-button { display: none; }
  .sync-pill { padding: 0 10px; font-size: 10px; }
  .ocr-link { padding: 0 12px; font-size: 12px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; justify-content: start; }
  .nav-item { flex: 0 0 auto; }
  .page-shell { width: min(100% - 24px, 1360px); padding-top: 22px; }
  .page-heading { align-items: start; }
  .metric-grid, .asset-summary { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .driver-grid { grid-template-columns: 1fr; }
  .customer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .report-paper { padding: 32px 26px; }
}

@media (max-width: 560px) {
  .brand strong { font-size: 15px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
  .brand-mark img { width: 29px; height: 29px; }
  .page-heading, .customer-toolbar, .report-toolbar { align-items: stretch; flex-direction: column; }
  .heading-tools { display: none; }
  .query-panel { padding: 18px; }
  .query-row { grid-template-columns: 1fr; }
  .metric-grid, .asset-summary, .customer-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .customer-toolbar select { min-width: 0; width: 100%; margin: 7px 0 0; }
  .hero-panel { padding: 23px; }
  .hero-stats { gap: 20px; }
  .report-kpis { grid-template-columns: repeat(2, 1fr); }
  .report-paper { padding: 28px 18px; }
  .panel { padding: 18px; }
}

@media print {
  body { background: #fff; }
  .topbar, .report-toolbar, .page-heading { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  .report-paper { width: 100%; padding: 20px; border: 0; box-shadow: none; }
}

/* 사용자 관리 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: start center;
  padding: 46px 20px;
  overflow-y: auto;
  background: rgba(16, 28, 52, .5);
  backdrop-filter: blur(3px);
  animation: view-in 220ms ease both;
}
.modal-card {
  width: min(880px, 100%);
  padding: 26px 28px 22px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(16, 28, 52, .3);
}
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 20px; }
.modal-head h2 { margin-bottom: 6px; font-size: 21px; letter-spacing: -.03em; }
.modal-head p { margin-bottom: 0; color: var(--muted); font-size: 12.5px; }
.modal-head .icon-button { width: 34px; min-height: 34px; font-size: 14px; color: var(--muted); }
.modal-head .icon-button:hover { background: var(--red-soft); color: var(--red); }

.user-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr .8fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8faff;
}
.user-form label { display: grid; gap: 6px; color: #384964; font-size: 11.5px; font-weight: 700; }
.user-form input, .user-form select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d8e0ec;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.user-form input:focus, .user-form select:focus { border-color: #87aaf7; box-shadow: 0 0 0 3px rgba(44,107,237,.1); }
.user-form-actions { display: flex; gap: 8px; }
.modal-table { max-height: 46vh; }
.modal-table .mono { font-family: Manrope, sans-serif; font-weight: 700; letter-spacing: .04em; }
.modal-table tr.is-editing { background: var(--blue-soft); }
.row-actions { display: flex; gap: 6px; }
.mini-button {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #4a5d7c;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.mini-button:hover { border-color: #b8cdf6; background: var(--blue-soft); color: var(--blue); }
.mini-button.is-danger:hover { border-color: #f2c5c5; background: var(--red-soft); color: var(--red); }
.modal-note { margin: 14px 0 0; color: var(--faint); font-size: 11.5px; }

@media (max-width: 780px) {
  .user-form { grid-template-columns: 1fr 1fr; }
  .user-form-actions { grid-column: 1 / -1; }
  .modal-backdrop { padding: 20px 12px; }
}

/* 월간 지표 · 임원 보고 대시보드 (다크 브리핑 보드)
   차트 색상은 dataviz 검증 통과 조합: 서피스 #111e34 기준 배송 #3987e5 / 회수 #199e70,
   순위 막대는 단일 색상 순차 램프, 심각도는 고정 status 팔레트만 사용합니다. */
.mx-shell {
  --mx-plane: #0a1322;
  --mx-surface: #111e34;
  --mx-raised: #16243d;
  --mx-line: #22304b;
  --mx-ink: #f4f8ff;
  --mx-ink-2: #b8c9e2;
  --mx-ink-3: #8ba0bd;
  position: relative;
  padding: 28px 30px 24px;
  border-radius: 20px;
  background:
    radial-gradient(1100px 340px at 10% -12%, rgba(57, 135, 229, .18), transparent 68%),
    radial-gradient(880px 300px at 94% -4%, rgba(25, 158, 112, .13), transparent 66%),
    var(--mx-plane);
  color: var(--mx-ink);
  box-shadow: 0 26px 64px rgba(10, 19, 34, .3);
}
.mx-shell h1, .mx-shell h2, .mx-shell h3 { margin: 0; letter-spacing: -.03em; }
.mx-shell p { margin: 0; }

.mx-topline { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--mx-line); }
.mx-brand { display: flex; align-items: center; gap: 14px; }
.mx-badge {
  padding: 6px 11px;
  border: 1px solid rgba(57, 135, 229, .5);
  border-radius: 7px;
  background: rgba(57, 135, 229, .14);
  color: #9cc3f5;
  font: 800 10.5px/1 Manrope, sans-serif;
  letter-spacing: .16em;
}
.mx-brand h1 { font-size: 25px; }
.mx-brand p { margin-top: 6px; color: var(--mx-ink-3); font-size: 12.5px; }

.mx-controls { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.mx-field { display: grid; gap: 5px; }
.mx-field span { color: var(--mx-ink-3); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.mx-field select {
  min-height: 40px;
  min-width: 148px;
  padding: 0 12px;
  border: 1px solid var(--mx-line);
  border-radius: 10px;
  background: var(--mx-raised);
  color: var(--mx-ink);
  outline: none;
}
.mx-field select:focus-visible { border-color: #3987e5; box-shadow: 0 0 0 3px rgba(57, 135, 229, .28); }
.mx-print {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(57, 135, 229, .55);
  border-radius: 10px;
  background: rgba(57, 135, 229, .18);
  color: #d8e8fd;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.mx-print:hover { background: rgba(57, 135, 229, .32); transform: translateY(-1px); }

/* KPI 카드 */
.mx-kpi-row { display: grid; grid-template-columns: 1.22fr 1fr 1fr; gap: 14px; margin: 20px 0 14px; }
.mx-card, .mx-panel {
  border: 1px solid var(--mx-line);
  border-radius: 14px;
  background: var(--mx-surface);
}
.mx-card { display: flex; flex-direction: column; gap: 11px; padding: 20px 22px; }
.mx-card.is-hero { background: linear-gradient(148deg, #16294a 0%, #111e34 62%); }
.mx-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mx-tag { color: #7f97ba; font: 800 10px/1 Manrope, sans-serif; letter-spacing: .14em; }
.mx-card h2 { color: var(--mx-ink-2); font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.mx-hero-value { font: 800 clamp(42px, 4.1vw, 56px)/1 Manrope, sans-serif; letter-spacing: -.045em; }
.mx-value { font: 800 33px/1 Manrope, sans-serif; letter-spacing: -.04em; }
.mx-unit { margin-left: 7px; color: var(--mx-ink-3); font: 600 13px/1 "IBM Plex Sans KR", sans-serif; letter-spacing: 0; }
.mx-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 4px; color: var(--mx-ink-3); font-size: 11.5px; }
.mx-spark { width: 132px; height: 34px; flex: 0 0 auto; }
.mx-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mx-split div { padding: 10px 12px; border-radius: 10px; background: var(--mx-raised); }
.mx-split small { color: var(--mx-ink-3); font-size: 10.5px; }
.mx-split strong { display: block; margin-top: 5px; font: 800 17px/1 Manrope, sans-serif; }
.mx-split i { margin-left: 3px; color: var(--mx-ink-3); font: 600 10.5px "IBM Plex Sans KR", sans-serif; font-style: normal; }

.mx-delta { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--mx-ink-2); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.mx-delta i { font-size: 9px; font-style: normal; }
.mx-delta.is-good { background: rgba(12, 163, 12, .16); color: #6fd46f; }
.mx-delta.is-bad { background: rgba(208, 59, 59, .18); color: #f0908f; }
.mx-delta.is-flat { color: var(--mx-ink-3); }

/* 미터 */
.mx-meter { display: grid; gap: 7px; }
.mx-meter-track { height: 8px; border-radius: 999px; background: #1d2f4e; background: color-mix(in oklab, var(--key, #3987e5) 24%, var(--mx-surface)); overflow: hidden; }
.mx-meter-track i { display: block; height: 100%; border-radius: inherit; background: var(--key, #3987e5); transform-origin: left; animation: grow 700ms cubic-bezier(.2,.8,.2,1) both; }
.mx-meter-label { color: var(--mx-ink-3); font-size: 11.5px; }
.mx-meter-label strong { color: var(--mx-ink); font-family: Manrope, sans-serif; }

/* 패널 · 그리드 */
.mx-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.mx-grid-main { grid-template-columns: 1.52fr 1fr; }
.mx-grid-sub { grid-template-columns: 1fr 1.16fr; }
.mx-panel { display: flex; flex-direction: column; padding: 20px 22px 22px; min-width: 0; }
.mx-panel-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.mx-panel-head h3 { font-size: 15px; }
.mx-panel-head p { margin-top: 5px; color: var(--mx-ink-3); font-size: 11.5px; }
.mx-legend { display: flex; gap: 13px; color: var(--mx-ink-2); font-size: 11.5px; white-space: nowrap; }
.mx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mx-legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--key); }

/* 차트 */
.mx-chart { width: 100%; }
.mx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.mx-gridline { stroke: var(--mx-line); stroke-width: 1; }
.mx-axis { fill: var(--mx-ink-3); font: 500 11px "IBM Plex Sans KR", sans-serif; font-variant-numeric: tabular-nums; }
.mx-area { fill: rgba(57, 135, 229, .1); }
.mx-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mx-end-label { fill: var(--mx-ink); font: 700 12px Manrope, sans-serif; }
.mx-cross-line { stroke: rgba(184, 201, 226, .45); stroke-width: 1; }
.mx-cross-dot { stroke: var(--mx-surface); stroke-width: 2.5; }
.mx-chart-rank svg { cursor: default; }
.mx-rank-name { fill: var(--mx-ink-2); font: 600 13px "IBM Plex Sans KR", sans-serif; }
.mx-rank-value { fill: var(--mx-ink); font: 700 13px Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.mx-rank-row:hover .mx-rank-name, .mx-rank-row:hover .mx-rank-value { fill: #fff; }
.mx-rank-row:hover path { filter: brightness(1.12); }

/* 게이지 · 타일 */
.mx-panel-quality { gap: 4px; }
.mx-gauge-wrap { display: grid; place-items: center; }
.mx-gauge { width: min(232px, 100%); height: auto; }
.mx-gauge-value { fill: var(--mx-ink); font: 800 38px Manrope, sans-serif; letter-spacing: -.04em; }
.mx-gauge-pct { font-size: 17px; fill: var(--mx-ink-3); }
.mx-gauge-cap { fill: var(--mx-ink-3); font: 500 12px "IBM Plex Sans KR", sans-serif; }
.mx-gauge-delta { margin: 4px 0 16px; color: var(--mx-ink-3); font-size: 11.5px; text-align: center; }
.mx-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: auto; }
.mx-tile { padding: 12px 13px; border-radius: 10px; background: var(--mx-raised); }
.mx-tile small { display: block; color: var(--mx-ink-3); font-size: 10.5px; }
.mx-tile strong { display: block; margin: 6px 0 4px; font: 800 19px/1 Manrope, sans-serif; }
.mx-tile span { color: #7f97ba; font-size: 10.5px; }

/* 표 */
.mx-table-wrap { overflow-x: auto; }
.mx-table { width: 100%; border-collapse: collapse; }
.mx-table caption { padding-bottom: 9px; color: var(--mx-ink-3); font-size: 11.5px; text-align: left; }
.mx-table th { padding: 9px 10px; border-bottom: 1px solid var(--mx-line); color: var(--mx-ink-3); font-size: 11px; font-weight: 600; text-align: left; white-space: nowrap; }
.mx-table td { padding: 11px 10px; border-bottom: 1px solid rgba(34, 48, 75, .7); color: var(--mx-ink-2); font-size: 12.5px; }
.mx-table tbody tr:last-child td { border-bottom: 0; }
.mx-table tbody tr:hover td { background: rgba(57, 135, 229, .08); color: var(--mx-ink); }
.mx-table td:first-child { color: var(--mx-ink); font-weight: 600; }
.mx-table .num { text-align: right; font-family: Manrope, sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-table .num.is-alert { color: #f0a982; }
.mx-table .rate { width: 148px; min-width: 128px; }
.mx-table .rate .mx-meter { gap: 5px; }
.mx-table .rate .mx-meter-label { font: 700 11.5px Manrope, sans-serif; color: var(--mx-ink-2); }

/* 리스크 목록 · 요약 */
.mx-risk { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.mx-risk li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 11px; background: var(--mx-raised); }
.mx-risk-rank { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(250, 178, 25, .16); color: #f5c65e; font: 800 12px Manrope, sans-serif; }
.mx-risk li:first-child .mx-risk-rank { background: rgba(208, 59, 59, .2); color: #f0908f; }
.mx-risk-body { display: grid; gap: 8px; min-width: 0; }
.mx-risk-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.mx-risk-name strong { font-size: 13.5px; }
.mx-risk-name small { color: var(--mx-ink-3); font-size: 10.5px; }
.mx-risk-value { text-align: right; font: 800 19px/1 Manrope, sans-serif; white-space: nowrap; }
.mx-risk-value i { margin-left: 3px; color: var(--mx-ink-3); font: 600 10.5px "IBM Plex Sans KR", sans-serif; font-style: normal; }
.mx-risk-value small { display: block; margin-top: 5px; color: var(--mx-ink-3); font: 500 10.5px "IBM Plex Sans KR", sans-serif; }
.mx-panel-brief { background: linear-gradient(160deg, #14243f 0%, #111e34 70%); }
.mx-brief { display: grid; gap: 11px; margin: 0; padding-left: 18px; color: var(--mx-ink-2); font-size: 12.5px; line-height: 1.72; }
.mx-brief li::marker { color: #6f8bb3; font-family: Manrope, sans-serif; font-weight: 700; }
.mx-brief strong { color: var(--mx-ink); }

.mx-empty { display: grid; gap: 7px; padding: 34px 18px; border: 1px dashed var(--mx-line); border-radius: 12px; color: var(--mx-ink-3); text-align: center; }
.mx-empty strong { color: var(--mx-ink-2); font-size: 13.5px; }
.mx-footnote { margin: 6px 0 0; color: #6d84a6; font-size: 11px; line-height: 1.65; }

.mx-data-view { margin-bottom: 14px; border: 1px solid var(--mx-line); border-radius: 12px; background: var(--mx-surface); }
.mx-data-view summary { padding: 13px 20px; color: var(--mx-ink-2); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.mx-data-view summary:hover { color: var(--mx-ink); }
.mx-data-view[open] summary { border-bottom: 1px solid var(--mx-line); }
.mx-data-view .mx-table-wrap { padding: 16px 20px 20px; }

/* 툴팁 */
.mx-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  display: grid;
  gap: 4px;
  min-width: 156px;
  padding: 11px 13px;
  border: 1px solid #2b3d5e;
  border-radius: 10px;
  background: rgba(9, 17, 30, .96);
  color: var(--mx-ink-2);
  font-size: 11.5px;
  box-shadow: 0 16px 34px rgba(5, 10, 20, .5);
  pointer-events: none;
}
.mx-tooltip[hidden] { display: none; }
.mx-tooltip strong { color: var(--mx-ink); font-size: 12.5px; }
.mx-tooltip span { display: flex; align-items: center; gap: 6px; }
.mx-tooltip span i { width: 8px; height: 8px; border-radius: 50%; background: var(--key); }
.mx-tooltip .mx-tip-note { padding-top: 3px; border-top: 1px solid #22304b; color: #8ba0bd; }

@media (max-width: 1180px) {
  .mx-kpi-row, .mx-grid-main, .mx-grid-sub { grid-template-columns: 1fr; }
  .mx-shell { padding: 24px 20px 20px; }
}

@media (max-width: 620px) {
  .mx-topline { align-items: stretch; }
  .mx-controls { width: 100%; }
  .mx-field, .mx-field select { width: 100%; min-width: 0; }
  .mx-print { width: 100%; }
  .mx-brand { align-items: start; }
  .mx-brand h1 { font-size: 21px; }
  .mx-tiles, .mx-split { grid-template-columns: 1fr; }
  .mx-card-foot { flex-direction: column; align-items: start; }
  .mx-risk li { grid-template-columns: 26px 1fr; }
  .mx-risk-value { grid-column: 2; text-align: left; }
}

@media print {
  .mx-shell {
    padding: 0;
    border-radius: 0;
    background: var(--mx-plane);
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .mx-controls, .mx-tooltip, .mx-data-view { display: none !important; }
  .mx-kpi-row, .mx-grid { gap: 10px; }
  .mx-card, .mx-panel, .mx-risk li { break-inside: avoid; }
  .mx-grid-main, .mx-grid-sub { grid-template-columns: 1fr 1fr; }
}
