:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1d252c;
  --muted: #65717c;
  --line: #dce2e7;
  --line-strong: #c5ced6;
  --teal: #087f6f;
  --teal-dark: #075d55;
  --blue: #3563a7;
  --amber: #9a6409;
  --red: #a43b3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.analysis-shell {
  display: grid;
  gap: 18px;
  padding: 24px 32px 42px;
}

.analysis-topbar,
.filter-band,
.analysis-section,
.decision-panel,
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
}

.analysis-topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

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

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.sync-status,
.count-pill,
.status-pill {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 8px 10px;
  white-space: nowrap;
}

.sync-status {
  border: 1px solid var(--line);
  color: var(--muted);
}

.sync-status.is-online {
  background: #ecf6f4;
  border-color: #c7e6df;
  color: var(--teal-dark);
}

.sync-status.is-syncing {
  background: #fff7e6;
  border-color: #edd19a;
  color: #8a5b08;
}

.sync-status.is-error {
  background: #fff0f0;
  border-color: #f0c8c8;
  color: var(--red);
}

.sync-status.is-local {
  background: #f8fafb;
}

.ghost-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  font-size: 13px;
  font-weight: 760;
  height: 36px;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.ghost-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.filter-band {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px;
}

.filter-band[hidden] {
  display: none;
}

.control-group {
  display: grid;
  flex: 0 0 190px;
  gap: 6px;
}

.control-group label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.control-group select {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  height: 42px;
  padding: 0 12px;
  width: 100%;
}

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

.summary-card {
  display: grid;
  gap: 7px;
  min-height: 104px;
  padding: 16px;
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.summary-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.overview-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.overview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.overview-panel,
.pattern-panel {
  border: 1px solid var(--line);
  min-width: 0;
}

.overview-panel.is-wide {
  grid-column: 1 / -1;
}

.overview-panel header,
.pattern-panel header {
  align-items: center;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.overview-panel h3,
.pattern-panel h3 {
  font-size: 15px;
  line-height: 1.35;
}

.overview-panel header span,
.pattern-panel header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-stat-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
}

.task-stat-item {
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 11px;
}

.task-stat-item div:first-child {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-stat-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.task-stat-item span,
.task-stat-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-stat-meter {
  background: #eef1f4;
  height: 7px;
  overflow: hidden;
}

.task-stat-meter span {
  background: var(--teal);
  display: block;
  height: 100%;
}

.decision-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.decision-panel {
  min-width: 0;
}

.decision-panel header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.decision-panel header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.decision-list {
  display: grid;
  gap: 8px;
  max-height: 226px;
  overflow: auto;
  padding: 12px;
}

.decision-item {
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 5px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

button.decision-item {
  background: #ffffff;
  cursor: pointer;
  font: inherit;
}

button.decision-item:hover {
  border-color: var(--teal);
}

.decision-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.decision-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 22px 10px;
  text-align: center;
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.count-pill {
  background: #ecf6f4;
  color: var(--teal-dark);
  min-width: 52px;
  text-align: center;
}

.table-wrap {
  overflow: auto;
  padding: 18px;
}

.table-wrap.compact {
  padding: 0;
}

.case-table,
.difference-table,
.common-table,
.pattern-table,
.country-format-table,
.task-overview-table {
  border-collapse: collapse;
  width: 100%;
}

.case-table {
  min-width: 1420px;
}

.difference-table {
  min-width: 920px;
}

.common-table {
  min-width: 760px;
}

.pattern-table,
.country-format-table,
.task-overview-table {
  min-width: 1500px;
}

.case-table th,
.case-table td,
.difference-table th,
.difference-table td,
.common-table th,
.common-table td,
.pattern-table th,
.pattern-table td,
.country-format-table th,
.country-format-table td,
.task-overview-table th,
.task-overview-table td {
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.case-table th,
.difference-table th,
.common-table th,
.pattern-table th {
  background: #f8fafb;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.country-format-table th {
  background: #f8fafb;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.task-overview-table th {
  background: #f8fafb;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.task-overview-table tbody tr.has-attention {
  background: #fffaf0;
}

.task-overview-table tbody tr.is-clean {
  background: #f4faf8;
}

.metric-cell {
  display: grid;
  gap: 3px;
  min-width: 76px;
}

.metric-cell strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.metric-cell span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pattern-table th:first-child {
  min-width: 132px;
}

.pattern-table td {
  padding: 6px;
}

.pattern-empty {
  color: var(--muted);
  text-align: center;
}

.pattern-cell {
  background: #ffffff;
  border: 1px solid transparent;
  cursor: pointer;
  display: grid;
  gap: 5px;
  min-height: 66px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.pattern-cell:hover {
  border-color: var(--teal);
}

.pattern-cell span {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-self: start;
  line-height: 1;
  padding: 5px 7px;
}

.pattern-cell strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
}

.pattern-cell.is-same span {
  background: #ecf6f4;
  color: var(--teal-dark);
}

.pattern-cell.is-attribute span {
  background: #fff7e6;
  color: var(--amber);
}

.pattern-cell.is-different span {
  background: #fff0f0;
  color: var(--red);
}

.pattern-cell.is-insufficient span,
.pattern-cell.is-excluded span {
  background: #eef1f4;
  color: var(--muted);
}

.country-format-cell {
  min-width: 112px;
}

.country-format-cell strong {
  color: var(--ink);
  display: block;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 5px;
}

.country-format-cell span,
.country-format-cell em {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.country-format-cell.has-attention {
  background: #fffaf0;
}

.country-format-cell.is-clean {
  background: #f4faf8;
}

.case-table tbody tr {
  cursor: pointer;
}

.case-table tbody tr:hover,
.case-table tbody tr.is-selected {
  background: #f4faf8;
}

.case-name {
  color: var(--ink);
  font-weight: 760;
  line-height: 1.35;
}

.case-note,
.mini-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scope-cell {
  color: var(--muted);
  font-weight: 760;
  text-align: center;
  white-space: nowrap;
}

.scope-cell.is-active {
  color: var(--ink);
}

.scope-cell.is-muted {
  background: #f8fafb;
}

.status-pill {
  display: inline-flex;
}

.status-pill.is-same {
  background: #ecf6f4;
  color: var(--teal-dark);
}

.status-pill.is-attribute {
  background: #fff7e6;
  color: var(--amber);
}

.status-pill.is-different {
  background: #fff0f0;
  color: var(--red);
}

.status-pill.is-insufficient,
.status-pill.is-excluded {
  background: #eef1f4;
  color: var(--muted);
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

.detail-stat {
  background: #f8fafb;
  border: 1px solid var(--line);
  display: grid;
  gap: 5px;
  padding: 14px;
}

.detail-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-stat strong {
  font-size: 22px;
  line-height: 1;
}

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

.scope-card {
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 13px;
}

.scope-card.is-available {
  border-top: 4px solid var(--teal);
}

.scope-card.is-discussion {
  border-top: 4px solid var(--amber);
}

.scope-card.is-unavailable {
  background: #f8fafb;
  border-top: 4px solid var(--line-strong);
}

.scope-card h3 {
  font-size: 14px;
  line-height: 1.35;
}

.scope-card strong {
  font-size: 22px;
  line-height: 1;
}

.scope-card span,
.scope-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-block {
  display: grid;
  gap: 10px;
}

.detail-block h3 {
  font-size: 15px;
  line-height: 1.35;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span {
  background: #eef1f4;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  padding: 6px 8px;
}

.attribute-stack {
  display: grid;
  gap: 6px;
}

.attribute-line {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.attribute-line strong {
  color: var(--ink);
}

.explanation-box {
  background: #f8fafb;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 14px;
}

.explanation-box p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

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

@media (max-width: 720px) {
  .analysis-shell {
    padding: 18px;
  }

  .analysis-topbar,
  .section-heading {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .control-group {
    flex-basis: 100%;
  }

  .summary-grid,
  .decision-grid,
  .overview-grid,
  .detail-summary,
  .scope-grid {
    grid-template-columns: 1fr;
  }
}
