:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-strong: #f7f9fc;
  --surface-glass: rgba(255, 255, 255, 0.78);
  --text: #172033;
  --muted: #657287;
  --subtle: #d7dfec;
  --line: #e3e9f2;
  --brand: #315fdc;
  --brand-dark: #244db7;
  --teal: #0d9488;
  --violet: #7c3aed;
  --amber: #b7791f;
  --red: #c24135;
  --green: #17803b;
  --ink-shadow: rgba(24, 32, 48, 0.12);
  --shadow: 0 24px 70px rgba(31, 42, 68, 0.12);
  --shadow-soft: 0 12px 32px rgba(31, 42, 68, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #0d1420;
  --surface: #151e2c;
  --surface-strong: #1b2738;
  --surface-glass: rgba(21, 30, 44, 0.82);
  --text: #eef4ff;
  --muted: #aab7c8;
  --subtle: #344255;
  --line: #29384d;
  --brand: #70a5ff;
  --brand-dark: #4c82e6;
  --teal: #36d4bd;
  --violet: #a78bfa;
  --amber: #f4bf45;
  --red: #fb7a7a;
  --green: #58d783;
  --ink-shadow: rgba(0, 0, 0, 0.28);
  --shadow: 0 28px 76px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(49, 95, 220, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 14%, rgba(13, 148, 136, 0.12), transparent 26rem),
    linear-gradient(145deg, var(--bg), var(--surface-strong));
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  width: min(1520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.sidebar,
.input-panel,
.summary-panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar {
  position: sticky;
  top: 22px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 44px);
  padding: 20px;
}

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

.brand-mark,
.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-mark svg,
.icon-button svg,
.primary-button svg,
.copy-button svg,
.export-button svg,
.nav-item svg {
  width: 20px;
  height: 20px;
}

.brand-mark {
  color: var(--brand);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 30px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.nav-item.is-active,
.nav-item:hover {
  background: color-mix(in srgb, var(--brand) 11%, transparent);
  color: var(--brand);
}

.history-block {
  display: grid;
  gap: 10px;
  margin-top: 32px;
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-card {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.history-card:hover,
.history-card.is-current {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.history-card span {
  font-weight: 900;
}

.history-card small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.main-shell {
  min-width: 0;
}

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

.toolbar,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.segment {
  min-width: 44px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.is-active {
  background: var(--brand);
  color: white;
}

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

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 16px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.78fr) minmax(520px, 1.22fr);
  gap: 18px;
  align-items: start;
}

.input-panel {
  padding: 20px;
}

.summary-panel {
  min-height: 720px;
  padding: 20px;
}

.panel-heading,
.summary-topline,
.card-header,
.transcript-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.card-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(30px, 3.4vw, 52px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.status-pill,
.confidence,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill {
  padding: 8px 10px;
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 32%, transparent);
  animation: pulse 1.8s infinite;
}

.transcript-shell {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.transcript-meta {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  display: block;
  width: 100%;
  min-height: 438px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 18px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.action-row {
  justify-content: space-between;
  margin-top: 16px;
}

.primary-button,
.ghost-button,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: var(--radius);
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  min-width: 190px;
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 28%, transparent);
}

.primary-button:hover,
.ghost-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.copy-button:active {
  transform: translateY(0);
}

.ghost-button,
.copy-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.ghost-button {
  padding: 0 16px;
}

.export-button {
  min-width: 178px;
}

.summary-topline {
  align-items: center;
  margin-bottom: 16px;
}

.confidence {
  padding: 9px 12px;
  background: var(--surface-strong);
  color: var(--muted);
}

.confidence strong {
  color: var(--brand);
}

.insight-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
  margin-bottom: 14px;
  animation: rise 340ms ease both;
}

.chart-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(145deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.chart-card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.donut-chart {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background:
    radial-gradient(circle, var(--surface) 0 49%, transparent 51%),
    conic-gradient(var(--red) 0 28%, var(--amber) 28% 62%, var(--teal) 62% 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent);
}

.donut-chart span {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  width: 130px;
  height: 82px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.bar-chart i {
  display: block;
  width: 18px;
  height: var(--h);
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--brand), var(--teal));
  animation: grow 620ms ease both;
}

.empty-state,
.loading-state {
  display: grid;
  place-items: center;
  min-height: 570px;
  border: 1px dashed var(--subtle);
  border-radius: var(--radius);
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  max-width: 460px;
  margin-top: 20px;
  color: var(--text);
}

.empty-state p {
  max-width: 430px;
  margin: 12px auto 0;
  line-height: 1.6;
}

.empty-visual {
  width: min(260px, 100%);
  color: var(--brand);
}

.empty-visual svg {
  width: 100%;
  filter: drop-shadow(0 18px 28px var(--ink-shadow));
}

.empty-visual rect {
  fill: var(--surface);
  stroke: var(--line);
}

.empty-visual path {
  stroke: color-mix(in srgb, var(--brand) 74%, var(--muted));
}

.empty-visual circle {
  fill: color-mix(in srgb, var(--teal) 16%, var(--surface));
  stroke: var(--teal);
}

.empty-visual .spark {
  stroke: var(--teal);
  stroke-dasharray: 6 8;
  animation: dash 3.2s linear infinite;
}

.loading-state {
  display: none;
  gap: 18px;
  overflow: hidden;
  font-weight: 900;
}

.loading-state h2 {
  margin-bottom: 8px;
  color: var(--text);
}

.loading-state p {
  margin-bottom: 0;
}

.ai-loader {
  position: relative;
  display: grid;
  place-items: center;
  width: 210px;
  height: 150px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.ai-loader span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand);
  animation: orbit 2.2s ease-in-out infinite;
}

.ai-loader span:nth-child(2) {
  background: var(--teal);
  animation-delay: -0.72s;
}

.ai-loader span:nth-child(3) {
  background: var(--violet);
  animation-delay: -1.44s;
}

.ai-loader svg {
  width: 160px;
  height: 100px;
  color: var(--brand);
}

.ai-loader path {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: draw 1.35s ease-in-out infinite alternate;
}

.ai-loader circle {
  fill: var(--teal);
  stroke: none;
  animation: glow 1.35s ease-in-out infinite alternate;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  animation: rise 340ms ease both;
}

.summary-card {
  min-height: 255px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card-header {
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.copy-button {
  height: 36px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 12px;
}

.copy-button.is-copied {
  color: var(--green);
}

.card-body {
  padding: 16px;
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.summary-item p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.owner {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.badge {
  padding: 5px 8px;
}

.badge.high {
  background: color-mix(in srgb, var(--red) 13%, transparent);
  color: var(--red);
}

.badge.medium {
  background: color-mix(in srgb, var(--amber) 15%, transparent);
  color: var(--amber);
}

.badge.low {
  background: color-mix(in srgb, var(--teal) 13%, transparent);
  color: var(--teal);
}

.is-hidden {
  display: none;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes orbit {
  0%,
  100% {
    transform: translate(-74px, -42px) scale(0.9);
  }
  33% {
    transform: translate(76px, -20px) scale(1.05);
  }
  66% {
    transform: translate(-12px, 48px) scale(0.95);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes glow {
  from {
    opacity: 0.55;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes grow {
  from {
    height: 12%;
  }
}

@keyframes dash {
  to {
    stroke-dashoffset: -56;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .history-block {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-label {
    grid-column: 1 / -1;
  }

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

  .summary-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .panel-heading,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .action-row {
    width: 100%;
  }

  .segmented {
    flex: 1;
  }

  .segment {
    flex: 1;
  }

  .icon-button {
    width: 44px;
  }

  .primary-button,
  .ghost-button,
  .export-button {
    width: 100%;
  }

  .metrics-strip,
  .history-block,
  .insight-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 340px;
  }
}
