/* Dashboard skin */

:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #edf2f7;
  --line: #d8e2ed;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #315cf6;
  --blue-2: #1d4ed8;
  --green: #0f766e;
  --amber: #d97706;
  --red: #dc2626;
  --purple: #6d28d9;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0, #eef3f7 360px),
    var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Segoe UI", Arial, "Malgun Gothic", sans-serif;
}

.app-header {
  min-height: 92px;
  padding: 14px 28px;
  background: linear-gradient(115deg, #eef6ff 0%, #dbeaff 58%, #eef7ff 100%);
  color: #0b0b0b;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 26px rgba(15, 42, 74, 0.14);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-block > div:last-child {
  min-width: 0;
}

.brand-mark {
  display: flex;
  flex: 0 0 96px;
  width: 96px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.brand-logo {
  display: block;
  width: 86px;
  height: 42px;
  object-fit: contain;
}

.app-header .eyebrow {
  color: #9fb4ce;
}

.app-header h1 {
  color: #1b3a86;
  font-size: 24px;
}

.header-subtitle {
  margin: 5px 0 0;
  color: #44658f;
  font-size: 12.5px;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.header-tools .context-pill {
  flex: 0 0 auto;
  max-width: none;
  padding-block: 6px;
  line-height: 1.35;
  white-space: nowrap;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 440px;
  min-width: 320px;
}

.global-search-icon {
  position: absolute;
  left: 12px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #537092;
  pointer-events: none;
}

.global-search-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.global-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 46px 9px 38px;
  border: 1px solid rgba(27, 58, 134, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f2a4a;
  box-shadow: 0 5px 14px rgba(27, 58, 134, 0.08);
}

.global-search input::placeholder {
  color: #71849c;
}

.global-search input:focus {
  border-color: #315cf6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(49, 92, 246, 0.12);
  outline: 0;
}

.global-search-clear {
  position: absolute;
  right: 10px;
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #e7edf5;
  color: #334155;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.version-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #315cf6;
  color: #fff;
  font-size: 13px;
  vertical-align: middle;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nav-link {
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #3b568f;
  cursor: pointer;
  font-weight: 800;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(27, 58, 134, 0.08);
  color: #1b3a86;
  border-bottom-color: #1b3a86;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(27, 58, 134, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: #1b3a86;
  font-weight: 800;
  white-space: nowrap;
}

.layout {
  grid-template-columns: minmax(310px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 92px);
}

.controls-panel {
  top: 92px;
  height: calc(100vh - 92px);
  padding: 20px 18px;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.content {
  padding: 24px 28px 42px;
}

.panel-section {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.panel-section:first-child {
  padding-top: 16px;
}

.panel-section:last-child {
  margin-bottom: 0;
}

.section-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--blue-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.link-button {
  min-height: 30px;
  border: 0;
  background: none;
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.button,
.preset,
.tab {
  border-radius: 8px;
  font-weight: 800;
}

.button {
  min-height: 40px;
  padding: 8px 12px;
}

.button.secondary {
  background: #f8fafc;
}

.button:hover,
.preset:hover,
.tab:hover {
  border-color: #9aabc0;
}

.preset {
  background: #f8fafc;
}

.preset.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 10px;
}

.group-heading h3 {
  margin: 0;
  font-size: 14px;
}

.metric-chip {
  border-radius: 8px;
}

.slider-list {
  gap: 12px;
}

.slider-row {
  padding: 12px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fbfdff;
}

.slider-row .subtle {
  font-size: 12px;
}

.slider-row.changed .slider-value {
  color: var(--amber);
}

.field-label {
  margin-top: 12px;
}

.text-input,
.select-input {
  border-radius: 8px;
  background: #fff;
}

.field-help {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
}

.savings-box {
  border-radius: 8px;
  background: #f8fbff;
}

.small-strong {
  font-size: 16px !important;
}

.warning-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.5;
}

.result-panel {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.result-head .eyebrow {
  margin-bottom: 6px;
  color: var(--blue-2);
}

.result-head h2 {
  margin-bottom: 6px;
  font-size: 26px;
}

.result-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.header-actions {
  justify-content: flex-end;
  min-width: 280px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

.summary-cell {
  position: relative;
  min-height: 132px;
  padding: 16px;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: none;
}

.summary-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #eaf0ff;
  color: var(--blue-2);
}

.summary-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.summary-cell .label {
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.summary-cell .value {
  margin-top: 8px;
  color: #0b1324;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
}

.summary-cell .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tone-red .summary-icon {
  background: #fff1f2;
  color: var(--red);
}

.tone-amber .summary-icon {
  background: #fff7ed;
  color: var(--amber);
}

.tone-violet .summary-icon {
  background: #f5f3ff;
  color: var(--purple);
}

.tone-green .summary-icon {
  background: #ecfdf5;
  color: var(--green);
}

.tone-slate .summary-icon {
  background: #f1f5f9;
  color: #475569;
}

.notice-band {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-left: 5px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
}

.workbench {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 10px 12px 0;
  background: #f8fafc;
}

.tab {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #475569;
  text-align: center;
}

.tab.active {
  background: transparent;
  color: var(--blue-2);
  border-bottom-color: var(--blue);
}

.tab-label-short {
  display: none;
}

.tab-view {
  padding: 18px;
}

.table-toolbar {
  align-items: center;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.select-input.compact {
  width: auto;
  min-height: 34px;
  padding: 4px 8px;
}

.table-wrap {
  max-height: calc(100vh - 300px);
  border-radius: 8px;
  background: #fff;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  box-shadow: inset 0 0 0 1px rgba(216, 226, 237, 0.25);
}

.table-wrap:focus-visible {
  outline-color: rgba(49, 92, 246, 0.48);
}

table {
  min-width: 1200px;
}

th {
  background: #eaf1f9;
  color: #334155;
  font-weight: 900;
  box-shadow: inset 0 -1px 0 #cfdbe8;
}

th,
td {
  padding: 10px 12px;
}

tbody tr:hover td {
  background: #f8fbff;
}

.tab-view .table-wrap > table > tbody > tr:nth-child(even):not(.is-deleted) > td {
  background: #fbfdff;
}

.tab-view .table-wrap > table > tbody > tr[role="button"]:focus-visible {
  outline: 3px solid rgba(49, 92, 246, 0.28);
  outline-offset: -3px;
}

.tab-view .table-wrap > table > tbody > tr[role="button"]:focus-visible > td,
.tab-view .table-wrap > table > tbody > tr[role="button"]:hover > td {
  background: #f0f6ff;
}

/* 긴 표를 옆으로 움직여도 행의 기준 열을 놓치지 않게 첫 열을 고정한다. */
.tab-view .table-wrap > table > thead > tr > th:first-child,
.tab-view .table-wrap > table > tbody > tr > td:first-child {
  position: sticky;
  left: 0;
}

.tab-view .table-wrap > table > thead > tr > th:first-child {
  z-index: 3;
}

.tab-view .table-wrap > table > tbody > tr > td:first-child {
  z-index: 1;
  background: #fff;
  box-shadow: 1px 0 0 #dbe4ef, 8px 0 14px -14px rgba(15, 23, 42, 0.7);
}

.tab-view .table-wrap > table > tbody > tr:nth-child(even):not(.is-deleted) > td:first-child {
  background: #fbfdff;
}

.tab-view .table-wrap > table > tbody > tr:hover > td:first-child,
.tab-view .table-wrap > table > tbody > tr:focus-visible > td:first-child {
  background: #f0f6ff;
}

.empty-row {
  cursor: default;
}

.empty-row td,
.empty-row:hover td {
  position: static !important;
  padding: 42px 18px !important;
  background: #fff !important;
  color: #64748b;
  text-align: center;
}

.empty-row strong {
  display: block;
  margin-bottom: 5px;
  color: #334155;
  font-size: 14px;
}

tbody tr.is-deleted td {
  background: #fff5f5;
}

tbody tr.is-deleted .name-cell {
  color: #9b2c2c;
  text-decoration: line-through;
}

.name-cell strong {
  display: block;
  line-height: 1.45;
}

.dim {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.score-mini {
  display: block;
  width: 68px;
  height: 5px;
  margin-top: 5px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}

.score-mini > span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.bar {
  display: inline-block;
  width: 90px;
  height: 7px;
  margin-right: 6px;
  border-radius: 4px;
  background: #e2e8f0;
  vertical-align: middle;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.pill {
  min-height: 24px;
  border-radius: 8px;
}

.decision {
  border-radius: 8px;
}

.decision.excluded {
  background: #94a3b8;
}

/* 검토 방향 색: 통합 계열(빨강·주황·황토) / 연계(보라) / 확대(파랑) / 공유·광역(청록·남색) / 유지(초록) */
.decision.realign {
  background: #c2410c;
}

.decision.merge {
  background: #a16207;
}

.decision.link {
  background: var(--purple);
}

.decision.benchmark {
  background: #0e7490;
}

.decision.regional {
  background: #4338ca;
}

.tab-note .decision,
.pill-row .decision,
.peer-list .decision {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11px;
}

/* 요약 카드: 누르면 해당 목록으로 이동 */
button.summary-cell {
  width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
}

.summary-cell.clickable {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.summary-cell.clickable:hover,
.summary-cell.clickable:focus-visible {
  border-color: #9db4f5;
  box-shadow: 0 6px 18px rgba(49, 92, 246, 0.12);
}

.tone-orange .summary-icon {
  background: #fff3eb;
  color: #c2410c;
}

.tone-indigo .summary-icon {
  background: #eef0ff;
  color: #4338ca;
}

/* 관계별 검토 방향 매트릭스 */
.matrix-block {
  margin-top: 18px;
}

.matrix-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.matrix-head h3 {
  margin: 0;
  font-size: 17px;
}

.matrix-wrap {
  max-height: none;
}

.direction-matrix {
  min-width: 760px;
  table-layout: fixed;
}

.direction-matrix th:first-child {
  width: 150px;
}

.direction-matrix tbody th {
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  text-align: left;
  vertical-align: middle;
}

.direction-matrix td {
  vertical-align: middle;
}

.direction-matrix tbody tr {
  cursor: default;
}

.direction-matrix tbody tr:hover td {
  background: transparent;
}

.matrix-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.matrix-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.matrix-btn strong {
  white-space: nowrap;
}

.matrix-btn:hover,
.matrix-btn:focus-visible {
  border-color: #9db4f5;
  background: #f8fbff;
}

/* 다른 시·군 유사사업 탭 */
.tab-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  line-height: 1.7;
}

.vary-flag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
}

/* 상세 패널 */
.direction-box {
  padding: 12px 14px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f8fbff;
}

.direction-box p {
  margin: 6px 0;
}

.note-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #334155;
  font-size: 13px;
  line-height: 1.6;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 12px;
}

.compare-table td {
  vertical-align: top;
}

.text-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.method-grid article.wide {
  grid-column: 1 / -1;
}

.method-grid article.wide .breakdown td {
  vertical-align: top;
}

.verdict-text.reduce {
  color: var(--red);
  font-weight: 900;
}

.verdict-text.monitor {
  color: var(--amber);
  font-weight: 900;
}

.breakdown {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.breakdown th,
.breakdown td {
  padding: 7px 9px;
  font-size: 12px;
}

.breakdown tbody tr {
  cursor: default;
}

.breakdown .axis-row td {
  background: #f1f5f9;
  font-weight: 900;
}

.formula {
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a5f;
  font-family: Consolas, "Malgun Gothic", monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.method-grid {
  gap: 12px;
}

.method-grid article {
  border-radius: 8px;
  background: #fbfdff;
}

.project-card {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.project-card.is-deleted {
  border-color: #fecaca;
  background: #fff5f5;
}

.toggle-delete {
  margin-top: 8px;
}

.toggle-delete.on {
  border-color: var(--red);
  background: #fff1f2;
  color: var(--red);
  font-weight: 800;
}

.peer-list {
  padding-left: 18px;
  line-height: 1.6;
}

.peer-list li {
  margin-bottom: 8px;
}

.peer-list button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.kv {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 5px 10px;
  font-size: 13px;
  line-height: 1.5;
}

.kv dt {
  color: var(--muted);
  font-weight: 800;
}

.kv dd {
  margin: 0;
}

.detail-panel {
  top: 92px;
  height: calc(100vh - 92px);
}

.icon-button {
  border-radius: 0;
}

.method-view h3 {
  margin-top: 4px;
}

.method-view table {
  min-width: 0;
}

.method-view tbody tr {
  cursor: default;
}

th,
.nowrap,
.decision {
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-header {
    position: static;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .header-tools {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .global-search {
    flex: 1 1 340px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-head {
    flex-direction: column;
  }

  .header-actions {
    min-width: 0;
    justify-content: flex-start;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .app-header {
    padding: 16px;
  }

  .brand-block {
    align-items: flex-start;
    width: 100%;
  }

  .brand-mark {
    width: 82px;
    height: 46px;
    flex-basis: 82px;
  }

  .brand-logo {
    width: 74px;
    height: 36px;
  }

  .app-header h1 {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .context-pill,
  .nav-link {
    min-height: 34px;
  }

  .header-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .global-search {
    flex-basis: auto;
    width: 100%;
    min-width: 0;
  }

  .scope-badge {
    display: block;
    width: max-content;
    max-width: 100%;
    margin-top: 4px;
    font-size: 11px;
  }

  .content {
    padding: 14px;
  }

  .result-panel {
    padding: 16px;
  }

  .result-head h2 {
    font-size: 22px;
  }

  .summary-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .method-view,
  #methodContent,
  .method-grid,
  .method-grid article {
    min-width: 0;
  }

  .method-view .formula,
  .method-view .breakdown td {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .method-view .breakdown {
    table-layout: fixed;
  }

  .method-view .breakdown td {
    white-space: normal;
  }

  .toolbar-right,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .select-input.compact {
    width: 100%;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .tabs {
    padding-top: 6px;
  }

  .tab {
    min-height: 42px;
    padding-inline: 12px;
  }
}

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

/* 장애인 사업 제외 데이터셋판 표시 */
.scope-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff2cc;
  color: #7f6000;
  font-size: 0.55em;
  font-weight: 700;
  vertical-align: middle;
}

/* 항상 적용되는 높음 판정 규칙 */
.fixed-rule-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.custom-settings-panel[hidden],
.custom-setting-view[hidden] {
  display: none;
}

.fixed-rule-list p {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d8e2ed;
  border-radius: 8px;
  background: #f5f9ff;
}

.fixed-rule-list strong {
  color: #233b58;
  font-size: 12px;
  line-height: 1.35;
}

.fixed-rule-list span {
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

/* ── 화면 틀: 왼쪽 고정 메뉴 + 오른쪽만 스크롤 ───────────────────── */
.layout {
  grid-template-columns: 312px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.side-label {
  margin: 0 0 6px;
  padding: 0 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.side-nav {
  flex: 0 0 auto;
  padding: 16px 12px 12px;
  border-bottom: 1px solid var(--line);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.side-link:hover {
  background: #eef3fb;
}

.side-link.active {
  border-left-color: var(--blue);
  background: #e6edff;
  color: var(--blue-2);
}

.side-icon {
  display: inline-grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
}

.side-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.side-text {
  flex: 1 1 auto;
}

.side-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.side-count:empty {
  display: none;
}

.side-link-accent .side-count {
  background: #dcfce7;
  color: #166534;
}

.side-settings {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 12px 16px;
  overflow-y: auto;
}

.side-acc {
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.side-acc > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  color: #0f172a;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.side-acc > summary::-webkit-details-marker {
  display: none;
}

.side-acc > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.side-acc[open] > summary::after {
  transform: rotate(-135deg);
}

.side-acc[open] > summary {
  border-bottom: 1px solid #e6edf5;
  color: var(--blue-2);
}

.acc-badge:empty {
  display: none;
}

.acc-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 800;
}

.acc-body {
  padding: 4px 12px 14px;
}

.acc-actions {
  display: flex;
  justify-content: flex-end;
}

.acc-body .slider-row {
  padding: 10px;
}

.acc-body > .field-label:first-child {
  margin-top: 8px;
}

/* 좁은 화면 전용 메뉴 버튼·닫기 버튼·배경 (넓은 화면에서는 숨김) */
.savings-bar .sb-menu {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.savings-bar .sb-menu svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.side-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.side-backdrop[hidden] {
  display: none;
}

.sidebar {
  position: relative;
}

/* 넓은 화면: 머리말은 위에 고정, 왼쪽 메뉴도 고정, 오른쪽(.content)만 스크롤 */
@media (min-width: 1101px) {
  html,
  body {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-header {
    position: relative;
    flex: 0 0 auto;
  }

  .layout {
    flex: 1 1 auto;
    min-height: 0;
  }

  .sidebar {
    height: 100%;
    overflow: hidden;
  }

  .content {
    height: 100%;
    overflow-y: auto;
    padding-top: 0;
  }

  .detail-panel {
    top: var(--header-h, 92px);
    height: calc(100vh - var(--header-h, 92px));
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  /* 좁은 화면: 왼쪽 메뉴는 숨겨 두고, 맨 위 막대의 ☰ 버튼을 누르면 왼쪽에서 밀려 나온다 */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(320px, 86vw);
    height: 100%;
    overflow: hidden;
    box-shadow: 12px 0 28px rgba(15, 23, 42, 0.2);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 200ms ease, visibility 0s linear 200ms;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 200ms ease;
  }

  body.menu-open {
    overflow: hidden;
  }

  .side-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.45);
  }

  .side-close {
    display: inline-grid;
  }

  .savings-bar .sb-menu {
    display: inline-flex;
  }

  .content {
    padding-top: 0;
  }

  .detail-panel {
    top: 0;
    height: 100vh;
  }
}

/* ── 늘 보이는 삭제 선택 · 절감 예산 막대 (오른쪽 맨 위에 붙음) ─────────── */
.savings-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  min-height: 50px;
  margin: 0 -28px 20px;
  padding: 8px 28px;
  border-bottom: 1px solid #d8e1ea;
  background: rgba(238, 244, 248, 0.97);
  color: #334155;
  font-size: 13px;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.09);
}

.savings-bar .sb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  white-space: nowrap;
}

.savings-bar .sb-label,
.savings-bar .sb-sub {
  color: #64748b;
  font-size: 12px;
}

.savings-bar strong {
  color: #0f172a;
  font-size: 18px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.savings-bar .sb-main strong {
  color: #15803d;
  font-size: 18px;
}

.savings-bar .sb-rec {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid #bbdfc7;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.savings-bar .sb-rec:hover {
  background: #dcfce7;
}

.savings-bar .sb-rec strong {
  color: #15803d;
}

.savings-bar .sb-warn {
  padding: 2px 8px;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  background: #fff1f2;
  color: #9f1239;
  font-weight: 700;
}

.savings-bar .sb-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.savings-bar .sb-btn {
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
}

.savings-bar .sb-btn:hover:not([disabled]) {
  background: #e2e8f0;
}

.savings-bar .sb-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.savings-bar.flash .sb-main strong {
  animation: sb-flash 700ms ease;
}

@keyframes sb-flash {
  0% { color: #b45309; text-shadow: 0 0 10px rgba(245, 158, 11, 0.35); }
  100% { color: #15803d; text-shadow: none; }
}

@media (max-width: 700px) {
  .savings-bar {
    margin: 0 -14px 14px;
    padding: 6px 14px;
    gap: 4px 14px;
  }

  .savings-bar .sb-actions {
    margin-left: 0;
  }
}

/* ── 절감 추천 탭 ─────────────────────────────────────────────── */
.tab.tab-accent {
  color: #475569;
}

.tab.tab-accent.active {
  color: #166534;
  border-bottom-color: #16a34a;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.scenario-card {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scenario-card:hover {
  border-color: #9db4f5;
}

.scenario-card.active {
  border: 2px solid #16a34a;
  padding: 13px;
  background: #f0fdf4;
}

.scenario-card .sc-label {
  font-weight: 900;
}

.scenario-card .sc-amount {
  color: #0b1324;
  font-size: 24px;
  font-weight: 900;
}

.scenario-card .sc-pct {
  color: #15803d;
  font-weight: 800;
}

.scenario-card .sc-desc,
.scenario-card .sc-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scenario-meter {
  display: block;
  height: 6px;
  margin: 2px 0;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}

.scenario-meter > span {
  display: block;
  height: 100%;
  background: #16a34a;
}

.rec-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.rec-controls .rc-item {
  display: grid;
  align-content: start;
  gap: 4px;
  font-size: 13px;
}

.rec-controls .rc-head {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}

.rec-controls .rc-head output {
  color: #15803d;
}

.rec-controls .subtle {
  font-size: 12px;
}

.rec-controls input[type="range"] {
  accent-color: #16a34a;
}

.rec-controls input[type="range"]:disabled {
  opacity: 0.4;
}

.rec-controls .rc-checks {
  display: grid;
  align-content: start;
  gap: 6px;
}

.rec-controls .check-row {
  margin-top: 0;
}

.rec-breakdown {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.rec-box h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.rec-box .breakdown {
  margin-top: 0;
}

.rec-box .breakdown tbody tr {
  cursor: default;
}

.rec-box .breakdown tbody tr[data-rec-city] {
  cursor: pointer;
}

.rec-city-wrap {
  max-height: 248px;
  overflow: auto;
  border-radius: 8px;
}

.rec-list-head {
  margin-top: 4px;
}

.rate-cell {
  min-width: 96px;
}

.rate-bar {
  display: block;
  width: 80px;
  height: 6px;
  margin-top: 4px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}

.rate-bar > span {
  display: block;
  height: 100%;
  background: #16a34a;
}

.rate-bar.full > span {
  background: var(--red);
}

.save-amount {
  color: #166534;
  font-weight: 900;
  white-space: nowrap;
}

.full-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .rec-breakdown {
    grid-template-columns: 1fr;
  }
}

/* ── 폰 크기: 머리말 줄바꿈, 막대는 핵심 숫자만 ─────────────────── */
@media (max-width: 1100px) {
  .side-nav {
    padding-top: 52px;
  }
}

@media (max-width: 700px) {
  .app-header h1 {
    line-height: 1.35;
  }

  .scope-badge {
    display: block;
    width: max-content;
    max-width: 100%;
    margin-left: 0;
    margin-top: 4px;
    font-size: 11px;
  }

  .context-pill {
    min-height: 0;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .savings-bar .sb-sub,
  .savings-bar .sb-actions {
    display: none;
  }
}

/* ── 가중치: 프리셋 4개는 늘 보이고 세부 막대만 접기 ─────────────── */
.side-card {
  margin-bottom: 6px;
  padding: 10px 12px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.side-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #0f172a;
  font-weight: 800;
}

.side-card-head .link-button {
  min-height: 24px;
  margin-left: auto;
  padding: 0;
}

.side-card .preset-grid {
  gap: 6px;
  margin-bottom: 8px;
}

.side-card .preset {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12.5px;
}

.side-card.custom-mode {
  padding-bottom: 0;
  overflow: hidden;
}

.side-card.custom-mode .preset-grid {
  margin-bottom: 10px;
}

.custom-settings-panel {
  margin: 0 -12px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.custom-setting-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.18fr;
  border-bottom: 1px solid var(--line);
  background: #eef4fb;
}

.custom-setting-tab {
  min-width: 0;
  min-height: 42px;
  padding: 6px 3px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #52657c;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
}

.custom-setting-tab:last-child {
  border-right: 0;
}

.custom-setting-tab:hover {
  background: #e4edfa;
  color: var(--blue-2);
}

.custom-setting-tab.active {
  box-shadow: inset 0 -3px 0 var(--blue);
  background: #fff;
  color: var(--blue);
}

.custom-setting-tab:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.custom-setting-view {
  padding: 12px;
  background: #fff;
}

.custom-setting-view .group-heading:first-child {
  margin-top: 4px;
}

/* ── 검토 결과 요약: 작은 카드 4열, 통합 다운로드 메뉴 ─────────────── */
.header-actions {
  position: relative;
  min-width: 0;
  gap: 6px;
}

.header-actions .button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.download-menu {
  position: relative;
}

.download-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.download-trigger svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.download-trigger .download-chevron {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.download-trigger[aria-expanded="true"] .download-chevron {
  transform: rotate(180deg);
}

.download-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 380px;
  padding: 16px;
  border: 1px solid #cbd8e6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
  text-align: left;
}

.download-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: #0f2742;
  font-size: 15px;
}

.download-close {
  display: inline-grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.download-close:hover,
.download-close:focus-visible {
  background: #eef3f8;
  color: #0f2742;
}

.download-fieldset {
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.download-fieldset legend {
  margin-bottom: 7px;
  color: #52657a;
  font-size: 12px;
  font-weight: 800;
}

.download-format-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.download-data-options {
  display: grid;
  gap: 7px;
}

.download-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #d8e2ed;
  border-radius: 9px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.download-option:hover {
  border-color: #9fb3c8;
  background: #f3f7fb;
}

.download-option:has(input:checked) {
  border-color: #315cf6;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #315cf6;
}

.download-option input {
  flex: 0 0 auto;
  margin: 0;
  accent-color: #315cf6;
}

.download-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.download-option strong {
  color: #0f2742;
  font-size: 13px;
  line-height: 1.25;
}

.download-option small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.download-confirm.button {
  width: 100%;
  min-height: 38px;
  background: #315cf6;
  color: #fff;
  font-size: 13px;
}

.download-confirm.button:hover,
.download-confirm.button:focus-visible {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

@media (max-width: 700px) {
  .download-panel {
    right: auto;
    left: 0;
    width: min(380px, calc(100vw - 48px));
  }
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-cell {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  min-height: 0;
  padding: 12px 14px;
}

.summary-icon {
  grid-row: span 3;
  width: 32px;
  height: 32px;
  margin: 2px 0 0;
}

.summary-icon svg {
  width: 18px;
  height: 18px;
}

.summary-cell .value {
  margin-top: 2px;
  font-size: 20px;
}

.summary-cell .sub {
  margin-top: 2px;
  font-size: 11.5px;
}

@media (max-width: 760px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 사업별 추천: 삭제 칸은 줄이는 사업 바로 왼쪽, 줄이는/남기는 사업 구분 ── */
.rec-hint {
  margin: -2px 0 10px;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.6;
}

.hint-cut {
  color: #b91c1c;
}

.hint-keep {
  color: #15803d;
}

.role-tag {
  display: inline-block;
  margin-bottom: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.role-tag.cut {
  background: #fee2e2;
  color: #991b1b;
}

.role-tag.keep {
  background: #dcfce7;
  color: #166534;
}

.keep-cell strong {
  display: block;
  color: #334155;
  font-weight: 700;
  line-height: 1.45;
}

.cut-label {
  min-width: 36px;
  white-space: nowrap;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.select-all {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.rec-reason {
  min-width: 190px;
}

#recommendView .name-cell,
#recommendView .keep-cell {
  min-width: 220px;
}

/* 절감 추천: 시·군 선택(이 탭에서만 적용) */
.rec-box .breakdown tbody tr.active td {
  background: #dcfce7;
  font-weight: 800;
}

.rec-city-chip {
  padding: 3px 10px;
  border: 1px solid #86efac;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.rec-city-chip:hover {
  background: #dcfce7;
}

/* 목록 위 '적용 중인 필터' 줄 */
.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid #fde68a;
  background: #fffbeb;
  font-size: 12.5px;
}

.active-filters[hidden] {
  display: none;
}

.af-label {
  margin-right: 4px;
  color: #92400e;
  font-weight: 900;
}

.af-chip {
  padding: 3px 10px;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  background: #fff;
  color: #78350f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.af-chip:hover {
  border-color: #f59e0b;
  background: #fef3c7;
}

.af-all {
  margin-left: auto;
  padding: 4px 12px;
  border: 0;
  border-radius: 6px;
  background: #b45309;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.af-all:hover {
  background: #92400e;
}

/* 관계별 검토 방향: 중복 후보쌍 탭 맨 위 */
#pairsView .matrix-block {
  margin: 0 0 18px;
}

.matrix-btn.active {
  border-color: var(--blue);
  background: #eef3ff;
  box-shadow: inset 0 0 0 1px var(--blue);
}

/* 중복 후보쌍: 관계별 하위 탭과 탭 맨 위 검토 방향 필터 버튼 */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 10px;
  background: #eef2f7;
}

.subtab {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.subtab:hover {
  background: #e2e8f0;
}

.subtab.active {
  background: #fff;
  color: var(--blue-2);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.subtab-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
}

.subtab.active .subtab-count {
  background: #e6edff;
  color: var(--blue-2);
}

.scope-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.scope-btn:hover {
  border-color: #9db4f5;
  background: #f8fbff;
}

.scope-btn.active {
  border-color: var(--blue);
  background: #eef3ff;
  box-shadow: inset 0 0 0 1px var(--blue);
}

@media (max-width: 700px) {
  .subtab {
    flex-basis: 100%;
  }
}

/* ── 사업별 검토 결과 4가지 색: 확대(청록) · 통합(노랑) · 축소(주황) · 유지·모니터링(회청) ── */
:root {
  --dec-expand: #1f6f78;
  --dec-integrate: #f2b544;
  --dec-shrink: #f26b3a;
  --dec-keep: #c8d6d6;
  --dec-ink: #12343b;
  --sb-light: #edf3f3;
}

.decision.expand { background: var(--dec-expand); color: #fff; }
.decision.integrate { background: var(--dec-integrate); color: var(--dec-ink); }
.decision.shrink { background: var(--dec-shrink); color: #fff; }
.decision.keep { background: var(--dec-keep); color: var(--dec-ink); }

/* 검토 결과 요약: 왼쪽 큰 카드 3개 + 오른쪽 2×2 */
.summary-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2.4fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.sb-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 16px 22px;
  border: 0;
  border-radius: 10px;
  color: var(--dec-ink);
  font: inherit;
  text-align: left;
}

.sb-big {
  width: 100%;
  height: 192px;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 1px solid #dce7e7;
  background: var(--sb-light);
  text-align: center;
}

.sb-big-savings {
  border: 2px solid #ef4444;
  background: #fff7f7;
}

.sb-big-savings .sb-value {
  color: #b42318;
}

.sb-icon {
  display: inline-grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
}

.sb-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sb-big .sb-icon {
  margin-bottom: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.sb-big-savings .sb-icon { color: #dc2626; }
.sb-big-projects .sb-icon { color: #2563eb; }
.sb-big-budget .sb-icon { color: #0f766e; }

.sb-label {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.sb-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.15;
}

.sb-big .sb-value {
  margin-top: 14px;
  font-size: 32px;
}

.sb-value small {
  font-size: 15px;
  font-weight: 800;
  opacity: 0.85;
}

.summary-board .sb-label {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.summary-board .sb-value {
  font-size: 22px;
}

.summary-board .sb-big .sb-value {
  margin-top: 10px;
  font-size: 27px;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.sb-sub {
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.85;
}

.sb-decision {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  box-shadow: inset 0 0 0 0 transparent;
  transition: transform 0.12s, box-shadow 0.12s;
}

.sb-decision .sb-icon {
  flex-basis: 30px;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.22);
}

.sb-decision .sb-value {
  flex: 0 0 auto;
  font-weight: 700;
}

.sb-decision .sb-label {
  flex: 1 1 auto;
  font-size: 18px;
}

.sb-decisions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.sb-decision:hover,
.sb-decision:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}

.sb-decision.active {
  box-shadow: inset 0 0 0 3px var(--dec-ink);
}

.sb-expand { background: var(--dec-expand); color: #fff; }
.sb-integrate { background: var(--dec-integrate); }
.sb-shrink { background: var(--dec-shrink); color: #fff; }
.sb-keep { background: var(--dec-keep); }

.sb-expand.active,
.sb-shrink.active {
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px var(--dec-ink);
}

@media (max-width: 1280px) {
  .summary-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 900px;
    margin-inline: auto;
    gap: 10px;
  }

  .summary-board .sb-big { padding: 18px; }
  .summary-board .sb-big .sb-value { font-size: 24px; }
  .summary-board .sb-decision { padding: 12px 16px; }

  .sb-big {
    height: 160px;
  }

  .sb-decisions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(74px, auto);
    gap: 10px;
  }

  .sb-decision {
    min-height: 74px;
  }
}

/* 고정 메뉴가 남아 있는 중간 폭에서는 네 장을 한 줄에 억지로 넣지 않는다. */
@media (min-width: 1101px) and (max-width: 1280px) {
  .sb-decisions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(74px, auto));
  }
}

@media (max-width: 820px) {
  .summary-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
    margin-inline: auto;
    gap: 10px;
  }

  .sb-big {
    width: 100%;
    height: 148px;
  }

  .sb-big:nth-child(3) {
    grid-column: 1 / -1;
    height: 130px;
  }

  .sb-decisions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sb-decision {
    min-height: 66px;
  }
}

@media (max-width: 420px) {
  .summary-board .sb-label { font-size: 14px; }
  .summary-board .sb-value { font-size: 18px; }
  .summary-board .sb-big .sb-value { font-size: 22px; margin-top: 6px; }
  .summary-board .sb-decision {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 2px 8px;
    min-height: 72px;
    padding: 10px;
  }
  .summary-board .sb-decision .sb-icon { flex-basis: 26px; width: 26px; height: 26px; }
  .summary-board .sb-decision .sb-icon svg { width: 16px; height: 16px; }
  .summary-board .sb-decision .sb-icon {
    grid-column: 1;
    grid-row: 1 / 3;
  }
  .summary-board .sb-decision .sb-label,
  .summary-board .sb-decision .sb-value {
    grid-column: 2;
    justify-self: start;
  }
  .summary-board .sb-decision .sb-label {
    grid-row: 1;
    white-space: nowrap;
  }
  .summary-board .sb-decision .sb-value {
    grid-row: 2;
  }
  .sb-sub { font-size: 11px; }
}

@media (max-width: 500px) {
  .tab-label-full {
    display: none;
  }

  .tab-label-short {
    display: inline;
  }

  .tab {
    padding-inline: 4px;
    font-size: 12px;
  }
}

/* 절감 추천 탭: 처음 보는 사용자용 단계형 화면 */
.rec-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.rec-eyebrow {
  margin: 0 0 4px;
  color: #15803d;
  font-size: 12px;
  font-weight: 800;
}

#recHeadline {
  margin: 0;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 700;
}

#recHeadline .rec-big {
  color: #15803d;
  font-size: 26px;
  font-weight: 900;
}

.rec-sub {
  margin: 6px 0 0;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.6;
}

.rec-how {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

.rec-how li {
  display: grid;
  gap: 4px;
  padding: 12px 14px 12px 44px;
  position: relative;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  counter-increment: how;
}

.rec-how li::before {
  content: counter(how);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.rec-how li strong {
  color: #0f172a;
}

.rec-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 10px;
  font-size: 17px;
}

.rec-list-head .rec-step {
  margin: 0;
}

.rec-step-no {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #15803d;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  flex: none;
}

.sc-badge {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  vertical-align: 2px;
}

.scenario-card .sc-desc {
  color: #475569;
  line-height: 1.55;
}

.rec-more {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rec-more > summary {
  padding: 10px 14px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.rec-more[open] > summary {
  border-bottom: 1px solid #e6edf5;
}

.rec-more-body {
  padding: 12px 14px;
}

.rec-more-body .rec-controls {
  margin-bottom: 10px;
}

.rec-expand {
  margin-top: 18px;
}

.rec-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.rec-flow-card {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rec-flow-card:hover {
  border-color: #9db4f5;
}

.rec-flow-card .rf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rec-flow-card .rf-amount {
  color: #15803d;
  font-size: 22px;
  font-weight: 900;
}

.rec-flow-card.no-save {
  background: #f8fafc;
}

.rec-flow-card.no-save .rf-amount {
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
}

.rec-flow-card .rf-body {
  color: #475569;
  font-size: 12.5px;
  line-height: 1.55;
}

.rec-table .rec-reason {
  min-width: 280px;
  line-height: 1.55;
}

.rec-table .rate-cell .save-amount {
  display: block;
  font-size: 15px;
}

@media (max-width: 900px) {
  .rec-how,
  .rec-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .rec-hero {
    flex-direction: column;
  }
}

/* 절감 추천 표는 화면 폭 안에 들어오게(삭제 선택 칸까지 보이게) */
#recommendView .rec-table,
#recommendView .rec-expand table {
  min-width: 0;
  width: 100%;
}

#recommendView .rec-table .name-cell {
  min-width: 300px;
  width: 36%;
}

#recommendView .rec-table .rec-reason {
  min-width: 220px;
}


/* 절감 추천: 핵심 금액·안 선택·추천 목록을 먼저 보이는 압축형 구성 */
.rec-top {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 2fr);
  align-items: stretch;
  gap: 12px;
  margin-bottom: 10px;
}

.rec-top .rec-hero {
  min-height: 126px;
  margin: 0;
  padding: 15px 17px;
}

.rec-top .rec-hero .button {
  flex: none;
  padding: 7px 10px;
  font-size: 12px;
}

#recHeadline {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

#recHeadline .rec-big {
  font-size: 30px;
  line-height: 1.1;
}

.rec-sub {
  margin-top: 8px;
  line-height: 1.45;
}

.rec-scenario-panel {
  min-width: 0;
  padding: 12px 14px 13px;
  margin-bottom: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #f8fafc;
}

.rec-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.rec-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.rec-section-head > span {
  color: var(--muted);
  font-size: 11.5px;
}

.rec-scenario-panel .scenario-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.rec-scenario-panel .scenario-card {
  gap: 2px;
  min-height: 82px;
  padding: 10px 11px;
}

.rec-scenario-panel .scenario-card.active {
  padding: 9px 10px;
}

.rec-scenario-panel .scenario-card .sc-label {
  font-size: 13px;
}

.rec-scenario-panel .scenario-card .sc-amount {
  font-size: 20px;
  line-height: 1.25;
}

.rec-scenario-panel .scenario-card .sc-pct {
  font-size: 11.5px;
}

.rec-scenario-panel .scenario-card .sc-desc {
  font-size: 11px;
  line-height: 1.3;
}

.rec-custom-panel {
  margin: 10px -14px -13px;
  padding: 14px;
  border-top: 1px solid #cbd5e1;
  border-radius: 0 0 10px 10px;
  background: #fff;
}

.rec-custom-panel .rec-controls {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.rec-custom-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.rec-city-detail {
  margin-bottom: 12px;
}

.rec-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.rec-tools .rec-more {
  margin: 0;
}

.rec-tools .rec-more > summary {
  padding: 9px 12px;
}

.rec-flow-head {
  margin-top: 2px;
}

.rec-flow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.rec-flow-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 10px 12px;
}

.rec-flow-card .rf-head {
  grid-column: 1;
}

.rec-flow-card .rf-amount {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 19px;
}

.rec-flow-card .rf-body {
  grid-column: 1;
  font-size: 11.5px;
  line-height: 1.35;
}

.rec-no-save {
  grid-column: 1 / -1;
  margin: -1px 2px 0;
  color: var(--muted);
  font-size: 11.5px;
}

.rec-list-head {
  min-height: 34px;
  margin-top: 4px;
}

.rec-list-head h3 {
  margin: 0;
  font-size: 15px;
}

#recommendView .rec-table .rec-partner {
  min-width: 200px;
  width: 28%;
  line-height: 1.35;
}

#recommendView .rec-table .rec-partner strong,
#recommendView .rec-table .rec-partner .dim {
  display: block;
}

.rec-guide {
  margin-top: 14px;
}

.rec-guide .rec-how {
  margin: 0;
}

@media (max-width: 1100px) {
  .rec-top {
    grid-template-columns: minmax(0, 1fr);
  }

  .rec-top .rec-hero {
    min-height: 0;
  }
}

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

@media (max-width: 700px) {
  .rec-scenario-panel .scenario-grid,
  .rec-tools,
  .rec-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .rec-section-head > span {
    display: none;
  }

  .rec-flow-card .rf-amount {
    font-size: 17px;
  }
}

/* 판정·검토 태그: 요약 카드와 어울리는 낮은 채도의 배경 + 진한 글자 */
.decision {
  border: 1px solid transparent;
  box-shadow: none;
}

.decision.reduce {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.decision.integrate,
.decision.merge {
  border-color: #f3d18a;
  background: #fff7e6;
  color: #854d0e;
}

.decision.shrink,
.decision.realign {
  border-color: #fdcbb6;
  background: #fff1eb;
  color: #9a3412;
}

.decision.expand,
.decision.benchmark {
  border-color: #b8dddd;
  background: #eaf7f7;
  color: #155e66;
}

.decision.link,
.decision.standardize {
  border-color: #ded3f5;
  background: #f5f1ff;
  color: #5b3e96;
}

.decision.regional {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.decision.monitor {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.decision.keep {
  border-color: #d5e1e1;
  background: #f1f5f5;
  color: #3f5f63;
}

.decision.check,
.decision.excluded {
  border-color: #d8e1ea;
  background: #f1f5f9;
  color: #475569;
}

/* 분석 결과 요약의 4개 판정 카드도 태그와 같은 파스텔 팔레트 사용 */
.sb-expand {
  border: 1px solid #b8dddd;
  background: #eaf7f7;
  color: #155e66;
}

.sb-integrate {
  border: 1px solid #f3d18a;
  background: #fff7e6;
  color: #854d0e;
}

.sb-shrink {
  border: 1px solid #fdcbb6;
  background: #fff1eb;
  color: #9a3412;
}

.sb-keep {
  border: 1px solid #d5e1e1;
  background: #f1f5f5;
  color: #3f5f63;
}

.sb-decision .sb-icon {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.sb-decision.active,
.sb-expand.active,
.sb-shrink.active {
  box-shadow: inset 0 0 0 2px currentColor;
}

