:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #f4f1ff;
  --ink: #080b22;
  --muted: #667085;
  --line: #e4e7ec;
  --violet: #5b36f2;
  --violet-2: #8f5cf8;
  --green: #12b886;
  --orange: #f59f00;
  --blue: #2f80ed;
  --shadow: 0 16px 50px rgba(21, 28, 52, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 30% 10%, rgba(91, 54, 242, 0.08), transparent 28rem),
    radial-gradient(circle at 85% 20%, rgba(18, 184, 134, 0.08), transparent 26rem),
    var(--bg);
}

.mobile-appbar,
.bottom-nav,
.mobile-dashboard-intro,
.mobile-import-button,
.mobile-card-list {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 6px);
  align-items: end;
  gap: 3px;
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
}

.brand-mark span {
  display: block;
  width: 6px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 19px; }

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 38px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #273044;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: var(--violet);
  background: var(--surface-soft);
}

.icon {
  width: 22px;
  color: inherit;
  text-align: center;
}

.plan-box {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.plan-box span,
.plan-hint,
.metric-card span,
.price-label,
.eyebrow,
.helper-text {
  color: var(--muted);
  font-size: 13px;
}

.plan-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eef0f5;
}

.plan-toggle button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: #344054;
  background: transparent;
}

.plan-toggle button.active {
  color: white;
  background: var(--violet);
  box-shadow: 0 8px 18px rgba(91, 54, 242, 0.24);
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar-title {
  display: grid;
  gap: 14px;
}

.page-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  color: #475467;
}

.nav-arrow svg {
  display: block;
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-arrow:hover {
  color: var(--violet);
}

.topbar,
.section-heading,
.card-title-row,
.input-actions,
.export-actions,
.hero-actions,
.dialog-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar h1,
.section-heading h2,
.hero-copy h2,
.price-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--violet);
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions,
.export-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  border: 0;
  padding: 0 18px;
  color: white;
  background: linear-gradient(135deg, var(--violet), #6f3df4);
  box-shadow: 0 12px 24px rgba(91, 54, 242, 0.24);
}

.ghost-button {
  border: 1px solid var(--line);
  padding: 0 16px;
  color: #111827;
  background: white;
}

.ghost-button:hover,
.text-button:hover {
  border-color: rgba(91, 54, 242, 0.35);
  color: var(--violet);
}

.text-button {
  border: 0;
  padding: 0 8px;
  color: var(--violet);
  background: transparent;
}

.icon-only {
  width: 42px;
  padding: 0;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 5;
  width: min(280px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid rgba(91, 54, 242, 0.18);
  border-radius: 8px;
  color: #273044;
  background: white;
  box-shadow: 0 16px 34px rgba(21, 28, 52, 0.16);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.tooltip::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(91, 54, 242, 0.18);
  border-bottom: 1px solid rgba(91, 54, 242, 0.18);
  background: white;
  transform: rotate(45deg);
}

.tooltip-wrap:hover .tooltip,
.tooltip-wrap:focus-within .tooltip {
  opacity: 1;
  transform: translateY(0);
}

.plan-box .tooltip {
  left: 0;
  right: auto;
  width: 220px;
}

.plan-box .tooltip::after {
  right: auto;
  left: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.panel,
.metric-card,
.price-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.hero-panel,
.wide-panel {
  grid-column: 1 / -1;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1fr);
  gap: 28px;
  align-items: center;
}

.hero-copy h2 {
  max-width: 560px;
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.04;
}

.hero-copy h2::after {
  content: "";
  display: block;
  width: 220px;
  height: 3px;
  margin-top: 24px;
  background: linear-gradient(90deg, var(--violet), var(--blue));
}

.hero-copy p:not(.eyebrow) {
  max-width: 500px;
  color: #273044;
  font-size: 18px;
  line-height: 1.6;
}

.mini-chart-card,
.summary-card,
.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mini-chart-card {
  padding: 20px;
}

.card-title-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title-row span {
  color: var(--violet);
  font-size: 32px;
  font-weight: 800;
}

.metric-card {
  display: grid;
  gap: 10px;
  min-height: 138px;
  padding: 22px;
}

.metric-card strong {
  font-size: clamp(28px, 4vw, 42px);
}

.metric-card small {
  color: var(--green);
  font-weight: 700;
}

.metric-card.accent-green small { color: var(--green); }
.metric-card.accent-orange small { color: var(--orange); }

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.58fr) minmax(0, 1fr);
  gap: 18px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.text-field,
.data-row input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

.text-field:focus,
.data-row input:focus {
  outline: 3px solid rgba(91, 54, 242, 0.16);
  border-color: var(--violet);
}

.data-table {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.data-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(90px, 140px) 38px;
  gap: 8px;
  align-items: center;
}

.drag-handle {
  color: #98a2b3;
  text-align: center;
}

.delete-row {
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #667085;
  background: transparent;
}

.delete-row:hover {
  border-color: #ffd2d2;
  color: #d92d20;
  background: #fff5f5;
}

.input-actions {
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

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

.result-heading-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-edit-analysis-button {
  display: none;
}

.mobile-result-tools {
  display: none;
}

.mobile-edit-analysis-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.mobile-actions-jump-button span {
  display: block;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  transform: translateY(-2px);
}

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: var(--violet);
  border-color: var(--violet);
}

.result-content {
  display: none;
  margin-top: 18px;
}

.result-content.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: start;
}

.result-content[data-result-content="table"].active,
.result-content[data-result-content="insights"].active {
  display: block;
}

.chart {
  min-height: 260px;
}

.main-chart {
  min-height: 390px;
}

.compact-chart {
  min-height: 250px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  overflow: visible;
}

.axis-text,
.chart-label {
  fill: #475467;
  font-size: 14px;
  font-weight: 600;
}

.grid-line {
  stroke: #e9ecf2;
  stroke-width: 1;
}

.pareto-line {
  fill: none;
  stroke: var(--violet-2);
  stroke-width: 3;
}

.pareto-point {
  fill: var(--violet-2);
  stroke: white;
  stroke-width: 3;
}

.summary-card {
  padding: 18px;
}

.summary-card h3,
.insight-card h3 {
  margin: 0 0 14px;
}

.summary-card dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.summary-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary-card dt {
  color: var(--muted);
}

.summary-card dd {
  margin: 0;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #475467;
  background: #f8fafc;
  font-size: 13px;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.insight-card {
  max-width: 560px;
  padding: 24px;
}

.insight-card p {
  margin: 0;
  color: #273044;
  font-size: 20px;
  line-height: 1.5;
}

.spark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #fff4db;
}

.pricing-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 420px));
  justify-content: center;
  gap: 18px;
}

.price-card {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.pricing-heading {
  max-width: 720px;
  margin: 0 auto 22px;
  text-align: center;
}

.pricing-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
}

.pricing-heading p:not(.eyebrow),
.price-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.price-card.highlighted {
  border-color: rgba(91, 54, 242, 0.55);
  box-shadow: 0 20px 60px rgba(91, 54, 242, 0.16);
}

.price-card h2 {
  font-size: 42px;
}

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

.price-card ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.price-card li::before {
  content: "✓";
  margin-right: 10px;
  color: var(--violet);
  font-weight: 900;
}

dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 24px;
}

.dialog-card h2 {
  margin: 0 0 10px;
}

.dialog-card p {
  color: var(--muted);
  line-height: 1.5;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 10px;
}

.analysis-card-list {
  gap: 12px;
}

.analysis-item-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.analysis-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.analysis-item-head h3 {
  margin: 0;
  font-size: 16px;
}

.analysis-item-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.analysis-item-head strong {
  color: var(--violet);
  font-size: 20px;
}

.analysis-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.analysis-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.analysis-meta dt {
  color: var(--muted);
}

.analysis-meta dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.card-menu {
  position: relative;
}

.card-menu summary {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  list-style: none;
  color: #475467;
  background: white;
  font-weight: 900;
}

.card-menu summary::-webkit-details-marker {
  display: none;
}

.card-menu[open] summary {
  border-color: rgba(91, 54, 242, 0.22);
  color: var(--violet);
}

.card-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 120px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
  }

  .plan-box {
    margin-top: 18px;
  }

  .hero-panel,
  .builder-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    background: #f7f8fc;
  }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(228, 231, 236, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
  }

  .mobile-appbar .brand {
    font-size: 18px;
  }

  .mobile-page-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
  }

  .mobile-page-controls .nav-arrow {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 12px;
    color: #344054;
  }

  .mobile-page-controls .nav-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    stroke: none;
  }

  .mobile-nav-symbol {
    display: block;
    color: currentColor;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    transform: translateY(-1px);
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(228, 231, 236, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(16px);
  }

  .bottom-nav-item {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 58px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #667085;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
  }

  .bottom-nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .bottom-nav-item.active {
    color: var(--violet);
    background: var(--surface-soft);
  }

  .bottom-nav-primary {
    color: var(--violet);
    background: transparent;
    box-shadow: none;
  }

  .bottom-nav-primary .bottom-nav-icon {
    width: 36px;
    height: 36px;
    padding: 9px;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--violet), #6f3df4);
    box-shadow: 0 14px 26px rgba(91, 54, 242, 0.28);
  }

  .app-shell,
  .workspace,
  .view,
  .panel,
  .dashboard-grid,
  .wide-panel,
  .metric-card,
  .hero-panel,
  .hero-actions,
  .mini-chart-card,
  .builder-layout,
  .chart,
  .result-panel,
  .input-panel,
  .price-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .sidebar,
  .topbar {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .hero-panel > *,
  .builder-layout > *,
  .dashboard-grid > *,
  .result-content.active > * {
    min-width: 0;
    max-width: 100%;
  }

  .workspace {
    padding: 16px 16px 98px;
  }

  .topbar,
  .section-heading,
  .input-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-title {
    gap: 10px;
  }

  .topbar-actions,
  .hero-actions,
  .export-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
  }

  .topbar-actions > *,
  .hero-actions > *,
  .export-actions > * {
    width: 100%;
    min-width: 0;
  }

  .export-actions .tooltip-wrap {
    grid-column: 1 / -1;
  }

  .topbar-actions .ghost-button,
  .topbar-actions .primary-button,
  .hero-actions .ghost-button,
  .hero-actions .primary-button,
  .export-actions .ghost-button,
  .export-actions .primary-button {
    padding: 0 12px;
    font-size: 14px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .metric-card,
  .summary-card,
  .mini-chart-card,
  .insight-card,
  .price-card,
  .table-wrap,
  dialog {
    border-radius: 16px;
  }

  .primary-button,
  .ghost-button {
    min-height: 48px;
  }

  .text-field,
  .data-row input {
    min-height: 44px;
  }

  .mobile-dashboard-intro,
  .mobile-card-list,
  .mobile-import-button {
    display: block;
  }

  .mobile-dashboard-intro {
    display: grid;
    gap: 14px;
    grid-column: 1 / -1;
  }

  .mobile-dashboard-intro h2 {
    margin: 0;
    font-size: 42px;
    line-height: 1;
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  .mobile-dashboard-intro p:not(.eyebrow) {
    margin: 0;
    color: #273044;
    font-size: 16px;
    line-height: 1.5;
  }

  .mobile-dashboard-intro .hero-actions {
    grid-template-columns: 1fr;
  }

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

  .hero-panel,
  .wide-panel,
  .mobile-dashboard-intro {
    grid-column: 1 / -1;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero-copy {
    display: none;
  }

  .hero-copy h2 {
    max-width: none;
    font-size: clamp(24px, 9.2vw, 38px);
    line-height: 1.05;
  }

  .hero-copy h2::after {
    width: 140px;
    margin-top: 18px;
  }

  .hero-copy p:not(.eyebrow) {
    font-size: 16px;
    line-height: 1.45;
  }

  .mini-chart-card {
    padding: 16px;
    overflow: hidden;
  }

  .card-title-row span {
    font-size: 24px;
  }

  .metric-card {
    min-height: 124px;
    padding: 18px;
  }

  .metric-card strong {
    font-size: 32px;
  }

  .section-heading {
    gap: 12px;
    margin-bottom: 14px;
  }

  .input-panel .section-heading {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .input-panel .section-heading > div {
    min-width: 0;
  }

  #reset-button {
    flex: 0 0 48px;
    margin-left: auto;
  }

  .builder-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .mobile-import-button {
    width: 100%;
    margin-top: 14px;
  }

  .chart,
  .compact-chart,
  .main-chart {
    min-height: 300px;
    overflow: hidden;
  }

  .compact-chart {
    min-height: 300px;
    margin-top: -8px;
  }

  .main-chart {
    min-height: 360px;
    margin-top: -8px;
  }

  .chart svg {
    overflow: hidden;
  }

  .axis-text,
  .chart-label {
    font-size: 18px;
    font-weight: 700;
  }

  .data-row {
    grid-template-columns: 20px minmax(0, 1fr) 36px;
    grid-template-areas:
      "drag category delete"
      ". value .";
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  }

  .drag-handle {
    grid-area: drag;
    align-self: center;
  }

  .data-row [data-field="category"] {
    grid-area: category;
  }

  .data-row [data-field="value"] {
    grid-area: value;
  }

  .delete-row {
    grid-area: delete;
  }

  .result-content.active {
    grid-template-columns: 1fr;
  }

  #new-analysis-view:not(.mobile-result-mode) .result-panel {
    display: none;
  }

  #new-analysis-view.mobile-result-mode .input-panel {
    display: none;
  }

  #new-analysis-view.mobile-result-mode .result-panel {
    display: flex;
    flex-direction: column;
  }

  #new-analysis-view.mobile-result-mode .builder-layout {
    gap: 0;
  }

  #new-analysis-view.mobile-result-mode .section-heading {
    display: contents;
  }

  #new-analysis-view.mobile-result-mode .result-heading-main {
    order: 1;
    margin-bottom: 14px;
  }

  #new-analysis-view.mobile-result-mode .tabs {
    order: 2;
    margin-bottom: 16px;
  }

  #new-analysis-view.mobile-result-mode .result-content {
    order: 3;
    margin-top: 0;
  }

  #new-analysis-view.mobile-result-mode .export-actions {
    order: 4;
    margin-top: 16px;
  }

  .mobile-edit-analysis-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
  }

  .mobile-result-tools {
    display: grid;
    gap: 8px;
    flex: 0 0 auto;
  }

  .mobile-actions-jump-button {
    display: inline-grid;
    place-items: center;
  }

  .summary-card {
    order: 2;
  }

  .tabs {
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
  }

  .input-actions {
    position: static;
    padding-top: 12px;
    background: transparent;
  }

  .input-actions .text-button,
  .input-actions .primary-button {
    width: 100%;
  }

  .export-actions .tooltip-wrap {
    grid-column: 1 / -1;
  }

  .export-actions .tooltip-wrap .primary-button {
    width: 100%;
  }

  #dashboard-view .table-wrap,
  #history-view .table-wrap {
    display: none;
  }

  .mobile-card-list {
    display: grid;
  }

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

  .price-card button {
    width: 100%;
  }

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

@media (max-width: 500px) {
  .workspace {
    padding: 14px 14px 98px;
  }

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

  #new-analysis-view .builder-layout,
  #pricing-view .pricing-layout {
    grid-template-columns: 1fr;
  }

  #dashboard-view .metric-card {
    min-height: 118px;
    padding: 12px 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  }

  #dashboard-view .metric-card span,
  #dashboard-view .metric-card small {
    font-size: 11px;
    line-height: 1.25;
  }

  #dashboard-view .metric-card strong {
    margin: 10px 0 8px;
    font-size: 24px;
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .export-actions {
    grid-template-columns: 1fr;
  }

  .mobile-dashboard-intro h2 {
    font-size: 38px;
    line-height: 1;
  }

  .bottom-nav {
    padding-inline: 8px;
  }

  .bottom-nav-item {
    min-height: 56px;
    font-size: 10px;
  }

  .bottom-nav-primary .bottom-nav-icon {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 360px) {
  .mobile-dashboard-intro h2 {
    font-size: 35px;
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .tabs,
  .export-actions,
  .input-panel {
    display: none !important;
  }

  .app-shell,
  .builder-layout,
  .result-content.active {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}
