:root {
  --bg: #f2f6f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(16, 43, 51, 0.18);
  --text: #0d2128;
  --muted: #4d6770;
  --ok: #0f9d58;
  --bad: #c0392b;
  --accent: #1f7a8c;
  --shadow: 0 12px 28px rgba(7, 32, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 15%, #d8f2ea, transparent 42%),
    radial-gradient(circle at 85% 20%, #e9f4ff, transparent 45%),
    linear-gradient(180deg, #f6fbfc, #edf5f7 70%);
}

.refresh-fab {
  position: fixed;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  border: 1px solid rgba(31, 122, 140, 0.28);
  background: linear-gradient(180deg, #effafd, #d8eef5);
  color: var(--text);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(7, 32, 40, 0.16);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.refresh-fab:hover {
  transform: translateY(calc(-50% - 1px));
  box-shadow: 0 14px 30px rgba(7, 32, 40, 0.2);
}

.refresh-fab:disabled {
  cursor: wait;
  opacity: 0.7;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: radial-gradient(circle at 1px 1px, #78a6b3 1px, transparent 0);
  background-size: 20px 20px;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1200px, 94vw);
  margin: 2rem auto 3rem;
  display: grid;
  gap: 1.25rem;
}

.hero {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0.35rem 0 0.75rem;
  line-height: 1.15;
}

.hero-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: #f8fcfe;
  font-size: 0.86rem;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  margin-bottom: 0.8rem;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.tabs-shell {
  padding: 0.65rem 0.75rem;
}

.tablist {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  border: 1px solid rgba(18, 60, 73, 0.2);
  background: #f5fbfd;
  color: var(--text);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.tab-btn:hover {
  background: #e9f5f9;
  transform: translateY(-1px);
}

.tab-btn:focus-visible {
  outline: 3px solid rgba(31, 122, 140, 0.36);
  outline-offset: 2px;
}

.tab-btn.is-active {
  border-color: rgba(31, 122, 140, 0.45);
  background: linear-gradient(180deg, #dbf1f8, #cdeaf3);
  box-shadow: inset 0 -1px 0 rgba(13, 33, 40, 0.15);
}

.tab-panel {
  animation: panel-fade-in 170ms ease;
}

.tab-panel.is-hidden {
  display: none;
}

.subtabs-shell {
  margin: 0 0 1rem;
}

.subtablist {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.subtab-btn {
  border: 1px solid rgba(18, 60, 73, 0.16);
  background: #f7fbfc;
  color: var(--text);
  border-radius: 999px;
  padding: 0.42rem 0.82rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.subtab-btn.is-active {
  border-color: rgba(31, 122, 140, 0.42);
  background: linear-gradient(180deg, #d8f0f7, #cbe7f1);
}

.korea-subtab-panel.is-hidden {
  display: none;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid rgba(18, 60, 73, 0.14);
  background: #f4fafb;
}

.signal-pill.hot {
  color: #a43712;
  background: #fff1ea;
  border-color: rgba(192, 93, 33, 0.22);
}

.signal-pill.warm {
  color: #795400;
  background: #fff8e8;
  border-color: rgba(177, 132, 19, 0.24);
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.stat-card {
  border: 1px solid rgba(18, 60, 73, 0.14);
  border-radius: 12px;
  background: #f7fcfd;
  padding: 0.65rem 0.75rem;
}

.stat-card h3 {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  margin: 0.35rem 0 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 500;
}

.mini-list {
  margin: 0;
  padding-left: 1.1rem;
}

.mini-list li {
  margin: 0.22rem 0;
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(18, 60, 73, 0.12);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(18, 60, 73, 0.1);
  padding: 0.45rem 0.55rem;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #e8f2f5;
  font-weight: 600;
}

.numeric {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-align: right;
}

.pos {
  color: var(--ok);
  font-weight: 600;
}

.neg {
  color: var(--bad);
  font-weight: 600;
}

.neutral {
  color: var(--muted);
}

.subsection {
  margin: 1rem 0;
  padding: 0.8rem;
  border: 1px solid rgba(18, 60, 73, 0.12);
  border-radius: 12px;
  background: #f8fbfc;
}

.subsection h4 {
  margin: 0 0 0.5rem;
}

.transcript-summary-grid {
  margin-bottom: 1rem;
}

.transcript-card {
  border: 1px solid rgba(18, 60, 73, 0.12);
  border-radius: 14px;
  background: #f8fbfc;
  padding: 0.95rem;
  margin: 0 0 1rem;
}

.transcript-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.transcript-card-head h3 {
  margin: 0;
}

.transcript-card-head p {
  margin: 0.25rem 0 0;
}

.transcript-scorebox {
  text-align: right;
}

.score-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #e6f4f7;
  border: 1px solid rgba(31, 122, 140, 0.2);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;
}

.score-sub {
  margin-top: 0.35rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.transcript-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.transcript-metrics div {
  border: 1px solid rgba(18, 60, 73, 0.12);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #ffffff;
}

.transcript-metrics span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.22rem;
}

.transcript-metrics strong {
  display: block;
}

.transcript-priority-block {
  margin-bottom: 0.95rem;
}

.transcript-section-head {
  margin-bottom: 0.65rem;
}

.transcript-section-head h4 {
  margin: 0 0 0.2rem;
}

.transcript-section-head p {
  margin: 0;
  color: var(--muted);
}

.issue-card-grid {
  display: grid;
  gap: 0.75rem;
}

.issue-card {
  border: 1px solid rgba(18, 60, 73, 0.12);
  border-radius: 12px;
  background: #ffffff;
  padding: 0.8rem;
}

.issue-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.issue-card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.issue-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.77rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid rgba(18, 60, 73, 0.12);
}

.issue-badge.topic {
  background: #e6f4f7;
}

.issue-badge.directness {
  background: #eef5e8;
}

.issue-badge.status {
  background: #f9efe4;
}

.issue-analyst {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.issue-copy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.issue-copy section {
  border: 1px solid rgba(18, 60, 73, 0.08);
  border-radius: 10px;
  padding: 0.65rem;
  background: #fbfdfe;
}

.issue-copy h5 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.issue-copy p {
  margin: 0;
  line-height: 1.5;
}

.issue-evidence {
  margin-top: 0.65rem;
  border-top: 1px solid rgba(18, 60, 73, 0.08);
  padding-top: 0.55rem;
}

.issue-evidence summary,
.transcript-detail-block summary {
  cursor: pointer;
  font-weight: 600;
}

.issue-evidence p {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

.transcript-copy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.transcript-copy-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.transcript-copy section {
  border: 1px solid rgba(18, 60, 73, 0.1);
  border-radius: 10px;
  padding: 0.7rem;
  background: #ffffff;
}

.transcript-copy h4 {
  margin: 0 0 0.45rem;
}

.transcript-copy p {
  margin: 0;
  line-height: 1.5;
}

.transcript-detail-block {
  margin-top: 0.25rem;
}

.transcript-detail-block .transcript-copy {
  margin-top: 0.75rem;
}

.placeholder {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.alert {
  background: #fff2f0;
  border-color: #ffb0a8;
}

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

  .grid.two-col {
    grid-template-columns: 1fr;
  }

  .transcript-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transcript-copy {
    grid-template-columns: 1fr;
  }

  .issue-card-head {
    flex-direction: column;
  }

  .issue-copy {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 560px;
  }
}

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

  .refresh-fab {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    transform: none;
  }

  .refresh-fab:hover {
    transform: translateY(-1px);
  }
}
