:root {
  --bg: #0c141c;
  --panel: #15202b;
  --panel-strong: #1a2733;
  --ink: #eef3f8;
  --muted: #9cafc1;
  --line: #2b3a49;
  --accent: #0082c9;
  --accent-soft: rgba(0, 130, 201, 0.2);
  --forest: #6fd58b;
  --forest-soft: rgba(111, 213, 139, 0.16);
  --gold: #64b6ff;
  --shadow: 0 14px 36px rgba(4, 10, 17, 0.34);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(0, 130, 201, 0.15), transparent 32%),
    linear-gradient(180deg, #111c27 0%, var(--bg) 28%, #0a1118 100%);
}

button,
input,
select {
  font: inherit;
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(1520px, calc(100vw - 24px));
  margin: 12px auto 32px;
  overflow-x: clip;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(21, 32, 43, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  font-weight: 600;
}

.hero h1,
.panel-header h2,
.widget-header h3,
.empty-state-card h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 22ch;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.3;
}

.hero-text {
  max-width: 62ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.hero-panel {
  display: grid;
  gap: 10px;
}

.dropzone,
.empty-state-card,
.panel,
.widget-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
}

.dropzone {
  min-height: 116px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  padding: 14px;
  background: rgba(0, 130, 201, 0.08);
  border-style: dashed;
  border-width: 1px;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(0, 130, 201, 0.14);
}

.dropzone strong {
  font-size: 0.94rem;
}

.dropzone > span:not(.primary-button) {
  color: var(--muted);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  text-decoration: none;
}

.primary-button {
  padding: 0.72rem 1.1rem;
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.secondary-button,
.config-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid var(--line);
}

.share-expiry-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0.42rem 0.5rem 0.42rem 0.82rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.86rem;
}

.share-expiry-control select {
  width: auto;
  min-height: 32px;
  padding: 4px 28px 4px 10px;
  border-radius: 999px;
  background: #111a22;
  font-size: 0.86rem;
}

.primary-button:hover,
.secondary-button:hover {
  transform: none;
  border-color: rgba(100, 182, 255, 0.55);
}

.hero-hints,
.toolbar,
.summary-grid,
.stats-row,
.list-grid,
.bar-row,
.column-row,
.filter-chip-row,
.table-meta {
  display: grid;
  gap: 12px;
}

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

.hero-hints > div,
.summary-card,
.filter-card,
.widget-chip,
.metric-card,
.table-meta {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.hero-hints > div {
  padding: 10px 12px;
}

.hint-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.hint-value {
  font-weight: 600;
}

.toolbar {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-top: 8px;
  position: relative;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dataset-meta {
  justify-self: end;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  margin-top: 20px;
}

.empty-state-card,
.panel {
  padding: 16px;
  box-shadow: var(--shadow);
}

.empty-state-card {
  max-width: 780px;
  margin: 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 12px;
  align-items: start;
}

.hidden {
  display: none !important;
}

.public-share .hero-panel,
.public-share .toolbar,
.public-share .sidebar,
.public-share #table-container,
.public-share .content > .panel:last-child {
  display: none !important;
}

.public-share .hero {
  grid-template-columns: 1fr;
}

.public-share .hero h1 {
  max-width: none;
}

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

.public-share .content > .panel:first-child > .panel-header {
  display: none;
}

.sidebar,
.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: 1.25rem;
}

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

.summary-card,
.metric-card {
  padding: 12px 14px;
}

.summary-label,
.metric-label,
.widget-subtitle,
.mini-label,
.legend-note {
  color: var(--muted);
}

.summary-value,
.metric-value {
  margin-top: 4px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.15;
}

.filters,
.column-controls,
.dashboard {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.dashboard {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.filter-card,
.column-row,
.widget-card {
  padding: 14px;
  min-width: 0;
}

.filter-card label,
.column-row label,
.column-row select,
.column-row input,
.filter-card input,
.filter-card select {
  display: block;
  width: 100%;
}

.filter-card label,
.column-row .control-label {
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.filter-grid,
.column-grid,
.stats-row {
  display: grid;
  gap: 8px;
}

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

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

.stats-row {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.widget-card {
  overflow: hidden;
}

.widget-card.wide {
  grid-column: span 2;
}

.widget-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  align-items: start;
  margin-bottom: 10px;
  min-width: 0;
}

.widget-header h3 {
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.widget-subtitle {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.widget-header > div:first-child,
.panel-header > div:first-child,
.summary-card,
.metric-card,
.filter-card,
.column-row {
  min-width: 0;
}

.widget-chip-row,
.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.widget-chip {
  padding: 0.26rem 0.58rem;
  font-size: 0.76rem;
}

.widget-chip.type {
  background: var(--accent-soft);
  color: var(--accent);
}

.widget-chip.confidence {
  background: var(--forest-soft);
  color: var(--forest);
}

.widget-display-toggle {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 10px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.display-toggle-button {
  border: 0;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
}

.display-toggle-button.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(100, 182, 255, 0.18);
}

.bar-chart,
.histogram,
.line-chart {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.bar-row {
  grid-template-columns: minmax(0, 1fr) 64px;
  grid-template-areas:
    "label label"
    "track value";
  align-items: start;
  gap: 6px 10px;
}

.bar-row .label {
  grid-area: label;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  line-height: 1.35;
}

.bar-track {
  grid-area: track;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #243242;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.bar-value {
  grid-area: value;
  align-self: center;
  min-width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.bar-swatch {
  display: inline-flex;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  vertical-align: middle;
}

.rating-bars .bar-row {
  grid-template-columns: 36px minmax(0, 1fr) 40px;
  grid-template-areas: none;
  align-items: center;
  gap: 12px;
}

.rating-bars .label {
  grid-area: auto;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rating-bars .bar-track {
  grid-area: auto;
  height: 22px;
}

.rating-bars .bar-fill {
  min-width: 0;
}

.rating-bars .bar-value {
  grid-area: auto;
  min-width: 40px;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.histogram {
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  align-items: end;
  min-height: 210px;
}

.histogram-bin {
  display: grid;
  gap: 8px;
  align-items: end;
}

.histogram-bar {
  min-height: 6px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, var(--accent), rgba(0, 130, 201, 0.28));
}

.histogram-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.line-chart {
  position: relative;
}

.line-chart svg {
  width: 100%;
  height: 180px;
  overflow: visible;
}

.line-chart-grid {
  stroke: rgba(156, 175, 193, 0.14);
  stroke-width: 1;
}

.line-chart .axis {
  stroke: #314252;
  stroke-width: 1;
}

.line-chart-y-label {
  fill: var(--muted);
  font-size: 0.78rem;
}

.line-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-chart .area {
  fill: rgba(0, 130, 201, 0.16);
}

.line-chart .point {
  fill: var(--accent);
}

.line-chart .point-hit {
  fill: transparent;
  cursor: pointer;
}

.line-chart-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 132px;
  padding: 8px 10px;
  border: 1px solid rgba(100, 182, 255, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(12, 20, 28, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.line-chart-tooltip strong {
  font-size: 0.84rem;
  line-height: 1.2;
}

.line-chart-tooltip span {
  color: var(--muted);
  font-size: 0.8rem;
}

.line-chart-legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.table-shell {
  overflow: auto;
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1d2a37;
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
}

tbody tr:nth-child(2n) {
  background: rgba(255, 255, 255, 0.02);
}

.token-list,
.sample-list,
.compact-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.sample-list-all {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sample-toggle-button {
  margin-top: 12px;
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: baseline;
  padding: 12px 14px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.word-cloud-item {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  line-height: 1;
  color: #dce7f3;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.word-cloud-item.noun {
  color: #9fd6ff;
}

.word-cloud-item.verb {
  color: #7dd8a7;
}

.word-cloud-item.adj {
  color: #b7c8ff;
}

.word-cloud-item small {
  color: var(--muted);
  font-size: 0.62em;
  font-weight: 700;
}

.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 130, 201, 0.16);
  margin: 0 8px 8px 0;
}

.token-pill small {
  color: var(--muted);
  font-size: 0.74rem;
}

.text-snippet,
.sample-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.free-text-answer {
  display: grid;
  gap: 10px;
}

.free-text-answer-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.free-text-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.icon-button:hover {
  border-color: rgba(100, 182, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.icon-button.danger:hover {
  border-color: rgba(255, 122, 122, 0.65);
}

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

.exporting-widgets .free-text-control,
.public-share .free-text-control {
  display: none !important;
}

.section-title {
  margin: 12px 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.mini-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-panel {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px dashed var(--line);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-row input[type="checkbox"] {
  width: auto;
  transform: scale(1.1);
}

.input-row {
  display: grid;
  gap: 6px;
  min-width: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111a22;
  color: var(--ink);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

select {
  appearance: auto;
  -webkit-appearance: auto;
}

input[type="date"],
input[type="time"] {
  padding: 10px 8px;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.caption {
  color: var(--muted);
  font-size: 0.85rem;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}

.pie-chart {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
}

.pie-chart svg {
  width: 100%;
  height: 100%;
}

.pie-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.pie-legend {
  display: grid;
  gap: 8px;
}

.pie-legend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.pie-label,
.pie-value {
  font-size: 0.9rem;
}

.pie-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1180px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .dataset-meta {
    justify-self: start;
  }

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

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

  .widget-card.wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    margin: 10px auto 36px;
  }

  .hero,
  .panel,
  .empty-state-card {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-hints,
  .summary-grid,
  .filter-grid,
  .column-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-group {
    width: 100%;
  }

  .secondary-button,
  .config-upload {
    flex: 1 1 auto;
  }
}

/* Presentation mode */
.presentation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  background: rgba(8, 14, 21, 0.97);
  backdrop-filter: blur(20px);
}

.presentation-overlay.hidden {
  display: none !important;
}

/* ── Toolbar menu ──────────────────────────────────────────── */
.menu-toggle {
  flex-shrink: 0;
}

.toolbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  z-index: 100;
  overflow: hidden;
  padding: 6px 0;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

/* ── Help overlay ─────────────────────────────────────────── */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 1rem;
}

.help-overlay.hidden {
  display: none !important;
}

.help-content {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  border-radius: 12px 12px 0 0;
}

.help-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.help-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
}

.help-close:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.help-body {
  padding: 1.25rem 1.5rem;
}

.help-steps {
  margin: 0;
  padding-left: 1.25rem;
}

.help-steps li {
  margin-bottom: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.help-steps li:last-child {
  margin-bottom: 0;
}

.help-steps strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.help-steps p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.help-note {
  margin: 1rem 0 0;
  padding: 0.875rem;
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.help-close {
  font-size: 1.25rem;
}

.presentation-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.presentation-counter {
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.presentation-close {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease;
}

.presentation-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.presentation-nav {
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 2.4rem;
  line-height: 1;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin: 0 12px;
  transition: background 140ms ease, opacity 140ms ease;
  flex-shrink: 0;
}

.presentation-nav:hover {
  background: rgba(255, 255, 255, 0.1);
}

.presentation-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

.presentation-nav:disabled:hover {
  background: rgba(255, 255, 255, 0.04);
}

.presentation-stage {
  justify-self: center;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.presentation-stage .widget-card {
  width: min(calc(100vw - 180px), 1200px);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
}

.presentation-stage .widget-card .widget-header h3 {
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
}

.presentation-stage .widget-card .metric-value {
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
}

.presentation-stage .widget-card .bar-row .bar-track {
  height: 18px;
}

.presentation-stage .widget-card .pie-chart {
  width: 240px;
  height: 240px;
}

.presentation-stage .widget-card .line-chart svg {
  height: 280px;
}

.presentation-stage .widget-card.wide {
  grid-column: span 1;
}

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

@media (max-width: 720px) {
  .presentation-nav {
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
    margin: 0 4px;
  }

  .presentation-stage {
    padding: 0 4px;
  }
}

/* Share dialog */
.share-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  align-items: center;
  justify-content: center;
  background: rgba(8, 14, 21, 0.87);
  backdrop-filter: blur(20px);
  padding: 24px;
}

.share-dialog-overlay.hidden {
  display: none !important;
}

.share-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.share-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.share-dialog-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.share-dialog-close {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease, color 140ms ease;
  flex-shrink: 0;
}

.share-dialog-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.share-dialog-body {
  padding: 24px;
}

.share-privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(111, 213, 139, 0.1);
  border: 1px solid rgba(111, 213, 139, 0.2);
  color: var(--forest);
  font-size: 0.88rem;
}

.share-privacy-note svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.share-link-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.share-link-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111a22;
  color: var(--ink);
  font-size: 0.88rem;
}

.share-link-input::placeholder {
  color: var(--muted);
}

.share-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 140ms ease, opacity 140ms ease;
}

.share-copy-button:hover {
  background: #0077b3;
}

.share-copy-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-copy-button svg {
  width: 18px;
  height: 18px;
}

.share-expiry-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Help button and overlay */
.help-button {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease, color 140ms ease;
  flex-shrink: 0;
}

.help-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  align-items: center;
  justify-content: center;
  background: rgba(8, 14, 21, 0.97);
  backdrop-filter: blur(20px);
  padding: 24px;
}

.help-overlay.hidden {
  display: none !important;
}

.help-content {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
}

.help-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.help-close {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease, color 140ms ease;
  flex-shrink: 0;
}

.help-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.help-body {
  padding: 24px;
}

.help-steps {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0 0 0 24px;
}

.help-screenshot {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.help-steps li {
  display: grid;
  gap: 6px;
}

.help-steps strong {
  color: var(--accent);
  font-weight: 600;
}

.help-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.help-note {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 130, 201, 0.1);
  border: 1px solid rgba(0, 130, 201, 0.2);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
