:root {
  color-scheme: light dark;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f7;
  --border: #d7dee8;
  --border-strong: #b8c2d1;

  --text: #172033;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-strong: #1d4ed8;

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);

  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.14);

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);

  --plot-line: #111827;
  --stick-line: #6b7280;
  --gauss-line: rgba(100, 116, 139, 0.45);
  --exp-line: rgba(107, 114, 128, 0.75);
  --exp-fill: rgba(107, 114, 128, 0.14);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --sidebar-width: 340px;

  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #111827;
    --surface-soft: #172033;
    --surface-muted: #1e293b;
    --border: #263244;
    --border-strong: #334155;

    --text: #e5e7eb;
    --text-muted: #a7b0c0;
    --text-soft: #7c8798;

    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.16);
    --accent-strong: #93c5fd;

    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);

    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);

    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.14);

    --plot-line: #f8fafc;
    --stick-line: #94a3b8;
    --gauss-line: rgba(148, 163, 184, 0.35);
    --exp-line: rgba(203, 213, 225, 0.7);
    --exp-fill: rgba(203, 213, 225, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

/* Layout */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}

.main {
  min-width: 0;
  padding: 18px 22px 28px;
}

/* Brand */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: white;
  font-weight: 850;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Sidebar controls */

.control-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.control-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.control-section h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

label,
.field-label {
  display: block;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.field > label,
.field > .field-label {
  margin-bottom: 6px;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.field-hint.no-margin {
  margin: 0;
}

.field-value {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.file-input {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.number-input,
.select-input,
.text-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

.number-input:focus,
.select-input:focus,
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.number-input.is-invalid {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface-soft));
}

.number-input.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* Collapsible sidebar sections */

details.control-section.sidebar-collapsible {
  padding: 0;
  overflow: hidden;
}

.sidebar-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.sidebar-summary::marker {
  content: "";
}

.sidebar-summary h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-summary::after {
  content: "▸";
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

details.control-section.sidebar-collapsible[open] > .sidebar-summary {
  border-bottom: 1px solid var(--border);
}

details.control-section.sidebar-collapsible[open] > .sidebar-summary::after {
  transform: rotate(90deg);
}

.sidebar-section-body {
  padding: 12px 14px 14px;
}

/* Segmented controls */

.segmented {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-muted);
}

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

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

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 8px;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-align: center;
  user-select: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.segmented label:not(:last-of-type) {
  border-right: 1px solid var(--border);
}

.segmented input:checked + label {
  color: white;
  background: var(--accent);
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  .segmented input:checked + label {
    color: #0f172a;
  }
}

/* Switches */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
}

.switch-text {
  min-width: 0;
}

.switch-title {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
}

.switch-subtitle {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border-strong);
  transition: 160ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
  transition: 160ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

/* Sliders */

.range-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  outline: none;
  accent-color: var(--accent);
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

.range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

.range-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.range-input:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
}

.range-input:disabled::-moz-range-thumb {
  cursor: not-allowed;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* Readouts */

.readout-box {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.readout-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.readout-row strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 750;
}

/* Status */

.status-card {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.status-dot.success {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

/* Buttons */

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-decoration: none;
  box-shadow: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.05s ease;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.btn.primary:hover {
  border-color: var(--accent-strong);
  color: white;
  background: var(--accent-strong);
}

.button-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-row.three .btn {
  padding-inline: 6px;
  font-size: 0.72rem;
}


@media (prefers-color-scheme: dark) {
  .btn.primary,
  .btn.primary:hover {
    color: #0f172a;
  }
}

.footer-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}


/* Topbar */

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

.page-title-group {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

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

/* Pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill.success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 32%, var(--border));
  background: var(--success-soft);
}

.pill.accent {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--accent-soft);
}

.file-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-header h2,
.collapsible-summary h2 {
  min-width: 0;
}

.panel-header .file-pill,
.collapsible-summary .file-pill {
  flex: 0 1 auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cards and plot */

.plot-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.plot-card {
  overflow: hidden;
  margin-bottom: 16px;
}

.plot-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.plot-header h2,
.panel-header h2 {
  margin: 0;
  font-size: 0.96rem;
}

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

/*
  The plot area no longer contains a static SVG mockup.
  It only hosts Plotly. Therefore no CSS background grid and no extra mockup padding.
*/
.plot-area {
  position: relative;
  width: 100%;
  height: 560px;
  min-height: 560px;
  padding: 0;
  background: var(--surface);
}

.plot {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.empty-plot-message {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}

/* Plotly modebar */

.js-plotly-plot .plotly .modebar {
  right: 10px;
  top: 8px;
}

.js-plotly-plot .plotly .modebar-btn {
  color: var(--text-muted) !important;
}

.js-plotly-plot .plotly .modebar-btn:hover {
  color: var(--accent-strong) !important;
}

/* Analysis panels */

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
  align-self: start;
}

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

.panel-body {
  padding: 14px 16px 16px;
}

/* Collapsible analysis panels */

details.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.collapsible-panel {
  min-width: 0;
  overflow: hidden;
}

.collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 13px 16px;
  border-bottom: none;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.collapsible-summary::marker {
  content: "";
}

.collapsible-summary h2 {
  margin: 0;
  font-size: 0.96rem;
}

.collapsible-summary .pill {
  margin-left: auto;
}

.collapsible-summary::after {
  content: "▸";
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.collapsible-panel[open] > .collapsible-summary {
  border-bottom: 1px solid var(--border);
}

.collapsible-panel[open] > .collapsible-summary::after {
  transform: rotate(90deg);
}

.metadata-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 14px;
  font-size: 0.84rem;
}

.metadata-key {
  color: var(--text-muted);
  font-weight: 700;
}

.metadata-value {
  color: var(--text);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--text-muted);
  background: var(--surface-soft);
  font-size: 0.74rem;
  /* text-transform: uppercase; */
  letter-spacing: 0.055em;
}

td {
  font-family: var(--font-mono);
}

tbody tr:last-child td {
  border-bottom: none;
}

tr.fosc-significant td {
  background: color-mix(in srgb, var(--warning-soft) 40%, transparent);
}

tr.fosc-significant td:first-child {
  border-left: 3px solid color-mix(in srgb, var(--warning) 65%, var(--border));
}

table[aria-label="Parsed UV-Vis transitions"] th:last-child,
#transitions-table-body td:last-child {
  text-align: right;
  white-space: normal;
  min-width: 260px;
  max-width: 640px;
  overflow-wrap: anywhere;
}

/* Empty states */

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Generic details */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}

.assignments-list details + details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 750;
  list-style-position: inside;
}

.details-content {
  padding: 0 12px 12px;
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.details-content pre {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Excited-state assignments */

.assignment-meta {
  margin-bottom: 14px;
}

.assignments-list {
  display: grid;
  gap: 10px;
}

.assignment-state-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}

.assignment-state-card summary {
  display: grid;
  grid-template-columns: minmax(90px, 0.45fr) minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  cursor: pointer;
  list-style-position: inside;
}

.assignment-state-card summary:hover {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.assignment-state-title {
  font-weight: 800;
  color: var(--text);
}

.assignment-state-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.assignment-state-main {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.assignment-state-body {
  padding: 0 12px 12px;
}

.assignment-state-body .table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.assignment-state-body table {
  font-size: 0.78rem;
}

.assignment-state-body td:nth-child(1),
.assignment-state-body th:nth-child(1),
.assignment-state-body td:nth-child(2),
.assignment-state-body th:nth-child(2) {
  text-align: left;
}

.assignment-summary-line {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.assignment-summary-line strong {
  color: var(--text);
}

.assignment-dim {
  color: var(--text-soft);
}

/* Toasts */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 50;
  pointer-events: none;
}

.toast {
  width: min(380px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-error {
  border-left-color: var(--danger);
}

/* Responsive layout */

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

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

  .brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .main {
    padding: 14px;
  }

  .sidebar {
    padding: 14px;
  }

  .sidebar-inner,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .plot-header,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .collapsible-summary {
    align-items: center;
  }

  .collapsible-summary h2 {
    min-width: 0;
  }

  .plot-area {
    height: 400px;
    min-height: 400px;
    padding: 0;
  }

  .plot {
    height: 100%;
    min-height: 100%;
  }

  .field-row,
  .button-row {
    grid-template-columns: 1fr;
  }

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

  .assignment-state-card summary {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}