:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #17202a;
  --muted: #647282;
  --border: #d9e0e7;
  --accent: #1d7a8c;
  --accent-strong: #145f70;
  --positive: #16844a;
  --negative: #c4403a;
  --warning: #c47c1e;
  --shadow: 0 14px 32px rgba(27, 39, 51, 0.08);
}

.dark-mode {
  color-scheme: dark;
  --bg: #101418;
  --surface: #171d23;
  --surface-2: #202832;
  --text: #e8edf2;
  --muted: #9aa8b5;
  --border: #2f3a45;
  --accent: #45a7b9;
  --accent-strong: #73c7d3;
  --positive: #52c47d;
  --negative: #f06a61;
  --warning: #f0b35b;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(100%, 400px); display: grid; gap: 18px; padding: 32px; }
.login-panel h1, .login-panel p { margin: 0; }
.login-panel label { display: grid; gap: 6px; }
.login-error { color: var(--negative); }

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

input,
select,
textarea {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  min-width: 0;
}

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

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 30px;
}

.topbar p,
.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  pointer-events: none;
}

.panel-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  cursor: default;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2 {
  font-size: 18px;
}

.status-pill {
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.busy {
  color: var(--warning);
}

.status-pill.ready {
  color: var(--positive);
}

.add-form,
.settings-form {
  display: grid;
  gap: 8px;
}

.add-form {
  grid-template-columns: minmax(190px, 1.6fr) minmax(120px, 0.9fr) minmax(100px, 0.7fr) minmax(84px, 0.5fr) auto;
  align-items: start;
  margin-bottom: 14px;
}

.company-search-field,
.alert-default-field {
  position: relative;
  min-width: 0;
}

.company-search-field > input,
.alert-default-field > input {
  width: 100%;
}

.company-search-results {
  position: absolute;
  z-index: 35;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, 360px);
  max-width: min(520px, calc(100vw - 48px));
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 5px;
}

.company-search-option {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(130px, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  text-align: left;
}

.company-search-option:hover,
.company-search-option.active {
  background: var(--surface-2);
  color: var(--text);
}

.company-search-option span,
.company-search-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-search-option small {
  color: var(--muted);
  font-size: 11px;
}

.company-search-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 13px;
}

.company-search-status .loading-spinner {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
}

.alert-default-field {
  display: grid;
  gap: 2px;
}

.form-field-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

.settings-form {
  grid-template-columns: 1fr;
  gap: 14px;
}

.settings-form label,
.settings-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.settings-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.settings-section h3 {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.settings-section.has-unsaved-changes {
  border-color: color-mix(in srgb, var(--warning) 68%, var(--border));
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--warning) 78%, transparent);
}

.settings-section.has-unsaved-changes h3::after {
  content: "Edited";
  display: inline-block;
  margin-left: 8px;
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border));
  border-radius: 999px;
  color: var(--warning);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.prompts-section label,
.settings-help {
  grid-column: 1 / -1;
}

.prompt-macros code {
  display: inline-block;
  margin: 2px 2px 0 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--accent-strong);
  padding: 2px 4px;
  font-size: 10px;
}

.settings-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  min-height: auto;
}

.secret-status {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
}

.digest-test-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.digest-test-control .secret-status {
  flex: 1 1 auto;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
}

.watchlist-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.watchlist-panel thead th {
  position: sticky;
  z-index: 6;
  top: 0;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 9px 6px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.watchlist-panel th:nth-child(1),
.watchlist-panel td:nth-child(1) {
  width: 94px;
  max-width: 110px;
}

.watchlist-panel th:nth-child(2),
.watchlist-panel td:nth-child(2) {
  min-width: 90px;
  max-width: 150px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.watchlist-panel th:nth-child(6),
.watchlist-panel td:nth-child(6),
.watchlist-panel th:nth-child(7),
.watchlist-panel td:nth-child(7) {
  min-width: 84px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.column-heading {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.column-info {
  position: relative;
  display: inline-flex;
  text-transform: none;
}

.column-info-trigger {
  display: inline-grid;
  place-items: center;
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.column-info-trigger:hover,
.column-info-trigger:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.column-info-content {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: 50%;
  width: 230px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  text-transform: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.column-info:hover .column-info-content,
.column-info:focus-within .column-info-content,
.column-info[data-open="true"] .column-info-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

tr {
  transition: background 0.15s ease;
}

tbody tr:hover,
tbody tr.selected {
  background: var(--surface-2);
}

tbody tr.alerted {
  box-shadow: inset 4px 0 0 var(--warning);
}

.ticker-button {
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  min-height: 0;
  font-weight: 700;
}

.ticker-group-tags {
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 130px;
  margin-top: 4px;
}

.ticker-group-tag {
  max-width: 70px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-group-tag.more {
  flex: none;
  color: var(--accent-strong);
}

.watch-value {
  display: grid;
  gap: 2px;
}

.watch-value strong {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.watch-value-meta,
.missing-value {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.financial-value {
  font-size: 12px;
  font-weight: 700;
}

.stale-badge {
  display: inline-block;
  margin-left: 3px;
  border-radius: 999px;
  padding: 1px 4px;
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.remove-button {
  background: transparent;
  color: var(--negative);
  padding: 0 6px;
  min-height: 30px;
}

.inline-number,
.inline-select {
  width: 66px;
  min-height: 32px;
}

.inline-select {
  width: 132px;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.segmented button {
  min-height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--text);
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.chart-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

#priceChart {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.alerts-list,
.suggestions-content {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.insights-content {
  border-bottom: 1px solid var(--border);
  max-height: 52%;
  overflow: auto;
  padding: 12px 16px 16px;
}

.insights-run-status {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.insights-run-status span,
.insight-card small {
  color: var(--muted);
}

.insight-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.insight-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.insight-card-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.insight-label {
  font-size: 0.88rem;
  margin: 5px 0;
}

.insight-events {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 6px;
}

.insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.insight-report {
  margin-top: 12px;
}

.insight-report summary {
  cursor: pointer;
  font-weight: 700;
}

.alerts-list {
  align-content: start;
  grid-auto-rows: max-content;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.alerts-heading {
  position: sticky;
  z-index: 20;
  top: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 10px 0;
}

.alert-item {
  align-self: start;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  border-left: 4px solid var(--warning);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.alert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.alert-head strong {
  min-width: 0;
  font-size: 13px;
}

.secondary-button,
.dismiss-button {
  background: var(--surface-2);
  color: var(--text);
}

.secondary-button {
  min-height: 38px;
  white-space: nowrap;
}

.dismiss-button {
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.secondary-button:hover,
.dismiss-button:hover {
  background: var(--border);
  color: var(--text);
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.rule-badge,
.delivery-badge {
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}

.delivery-sent {
  color: var(--positive);
}

.delivery-failed {
  color: var(--negative);
}

.delivery-deferred,
.delivery-pending {
  color: var(--warning);
}

.group-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-chip { min-height: 30px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.group-chip.active { background: var(--accent); color: white; }
.group-summary { border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.group-editor-panel { width: min(900px, 100%); }
.group-editor-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.group-editor-list { display: grid; gap: 6px; margin-top: 10px; }
.group-editor-list button { text-align: left; background: var(--surface-2); color: var(--text); }
.group-editor-list button.active { border-color: var(--accent); }
.group-members { border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
#groupMemberChoices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tg-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 50%;
  padding: 0;
  box-shadow: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.tg-toggle:hover {
  border-color: #229ed9;
}

.tg-toggle.on {
  color: #168dcc;
  border-color: rgba(34, 158, 217, 0.35);
  background: rgba(34, 158, 217, 0.08);
}

.tg-toggle.off {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-2);
  box-shadow: none;
}

.tg-toggle-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.tg-toggle.off .tg-toggle-icon {
  opacity: 0.7;
}

.tg-toggle-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-weight: 700;
  text-transform: uppercase;
}

.tg-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #229ed9;
  box-shadow: none;
}

.tg-toggle.off .tg-status-dot {
  background: var(--muted);
  box-shadow: none;
  opacity: 0.55;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ticker-details-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0;
}

.ticker-details-button:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--accent-strong);
}

.ticker-details-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.source-badge { background: var(--accent-soft, var(--surface)); }

.alert-editor-panel {
  width: min(1040px, 100%);
}

.ticker-details-overview {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.ticker-details-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticker-details-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.ticker-details-heading > span {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.ticker-detail-symbol {
  color: var(--accent-strong);
  font-weight: 800;
}

.ticker-details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ticker-detail {
  display: grid;
  gap: 2px;
  min-width: 0;
  border-radius: 5px;
  background: var(--surface);
  padding: 7px 8px;
}

.ticker-detail span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.ticker-detail strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-fundamentals {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.fundamentals-header,
.fundamentals-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fundamentals-header h3,
.fundamentals-section-heading h3 {
  margin: 0 0 2px;
}

.fundamentals-header span,
.fundamentals-section-heading span,
.fundamentals-section-heading small {
  color: var(--muted);
  font-size: 12px;
}

.fundamental-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  font-size: 12px;
  font-weight: 700;
}

.fundamentals-disclaimer {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.fundamental-categories {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.fundamental-category,
.fundamental-metric {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 7px;
  background: var(--surface-2);
}

.fundamental-category {
  display: grid;
  gap: 3px;
  padding: 9px;
}

.fundamental-category span {
  color: var(--muted);
  font-size: 11px;
}

.fundamental-category strong {
  font-size: 12px;
}

.status-typical { color: var(--positive); }
.status-attention { color: var(--warning); }
.status-concern { color: var(--negative); }
.status-informational { color: var(--accent-strong); }
.status-unavailable { color: var(--muted); }
.fundamental-category.status-typical,
.fundamental-metric.status-typical { border-left-color: var(--positive); }
.fundamental-category.status-attention,
.fundamental-metric.status-attention { border-left-color: var(--warning); }
.fundamental-category.status-concern,
.fundamental-metric.status-concern { border-left-color: var(--negative); }
.fundamental-category.status-informational,
.fundamental-metric.status-informational { border-left-color: var(--accent); }
.fundamental-category.status-unavailable,
.fundamental-metric.status-unavailable { border-left-color: var(--muted); }

.fundamental-groups {
  display: grid;
  gap: 7px;
}

.fundamental-group {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.fundamental-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  cursor: pointer;
  font-weight: 750;
}

.fundamental-group summary small {
  color: var(--muted);
  font-weight: 500;
}

.fundamental-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  border-top: 1px solid var(--border);
  padding: 8px;
}

.fundamental-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 9px;
  color: var(--text);
}

.fundamental-metric > span,
.fundamental-metric small,
.fundamental-metric em {
  color: var(--muted);
  font-size: 11px;
}

.fundamental-metric small {
  text-align: right;
}

.fundamental-metric p,
.fundamental-metric em {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  line-height: 1.35;
}

.fundamental-metric em {
  font-style: normal;
}

.fundamental-analysis {
  display: grid;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.analysis-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.analysis-sections > div {
  border-radius: 6px;
  background: var(--surface);
  padding: 9px;
}

.analysis-sections p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.analysis-stale-note {
  border-left: 4px solid var(--warning);
  border-radius: 5px;
  background: var(--surface);
  padding: 8px 10px;
  color: var(--warning);
  font-size: 12px;
}

.fundamentals-loading,
.fundamentals-empty {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
}

.fundamentals-empty {
  flex-wrap: wrap;
}

.fundamentals-empty span {
  flex: 1 1 360px;
}

.alert-time {
  color: var(--muted);
  font-size: 11px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.alert-up {
  border-left-color: var(--positive);
}

.alert-down {
  border-left-color: var(--negative);
}

.suggestions-table th,
.suggestions-table td {
  padding: 8px 6px;
}

.suggestions-content {
  overflow: auto;
  min-width: 0;
}

.suggestions-heading {
  margin: 8px 0 0;
  font-size: 14px;
}

.analysis-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.analysis-toolbar h3 {
  margin: 0;
}

.detailed-analysis {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  overflow: hidden;
}

.detailed-analysis-list {
  display: grid;
  gap: 6px;
}

.detailed-analysis summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
}

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

.detailed-analysis summary > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.detailed-analysis summary small {
  color: var(--muted);
  font-size: 11px;
}

.analysis-summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-toggle-label::before {
  content: "Show";
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.detailed-analysis[open] .details-toggle-label::before {
  content: "Hide";
}

.detailed-analysis-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}

.markdown-viewer {
  white-space: normal;
}

.markdown-viewer > :first-child {
  margin-top: 0;
}

.markdown-viewer > :last-child {
  margin-bottom: 0;
}

.markdown-viewer h1,
.markdown-viewer h2,
.markdown-viewer h3,
.markdown-viewer h4,
.markdown-viewer h5,
.markdown-viewer h6 {
  color: var(--text);
  line-height: 1.25;
  margin: 1.15em 0 0.45em;
}

.markdown-viewer h1 {
  font-size: 1.45rem;
}

.markdown-viewer h2 {
  border-bottom: 1px solid var(--border);
  font-size: 1.2rem;
  padding-bottom: 0.25em;
}

.markdown-viewer h3 {
  font-size: 1.02rem;
}

.markdown-viewer h4,
.markdown-viewer h5,
.markdown-viewer h6 {
  font-size: 0.92rem;
}

.markdown-viewer p {
  margin: 0.5em 0;
}

.markdown-viewer ul,
.markdown-viewer ol {
  margin: 0.45em 0 0.8em;
  padding-left: 1.6rem;
}

.markdown-viewer li + li {
  margin-top: 0.28em;
}

.markdown-viewer blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  margin: 0.8em 0;
  padding: 0.25em 0 0.25em 0.8em;
}

.markdown-viewer code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.08em 0.3em;
}

.markdown-viewer pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  max-width: 100%;
  overflow: auto;
  padding: 10px;
}

.markdown-viewer pre code {
  background: none;
  border: 0;
  padding: 0;
}

.markdown-viewer a {
  color: var(--accent-strong);
}

.markdown-viewer hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1em 0;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.markdown-viewer table {
  border-collapse: collapse;
  margin: 0.8em 0;
  width: 100%;
}

.markdown-viewer th,
.markdown-viewer td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.markdown-viewer th {
  background: var(--surface-2);
}

[data-research-panel="reports"] .detailed-analysis-text {
  height: clamp(440px, 60vh, 900px);
  max-height: none;
  min-height: 300px;
  resize: vertical;
}

.analysis-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 7px;
  background: var(--surface-2);
  padding: 9px 11px;
}

.analysis-progress > span:last-child {
  display: grid;
  gap: 2px;
}

.analysis-progress small {
  color: var(--muted);
}

.loading-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.suggestions-table input[type="checkbox"] {
  min-height: auto;
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
}

.research-history {
  display: grid;
  gap: 6px;
}

.research-history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.flag {
  color: var(--warning);
  font-weight: 700;
}

.ai-summary {
  white-space: pre-wrap;
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px 12px;
}

.empty-state {
  color: var(--muted);
}

.error-box {
  margin: 0 0 14px;
  border: 1px solid var(--negative);
  color: var(--negative);
  border-radius: 6px;
  padding: 10px 12px;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(880px, calc(100vh - 40px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.settings-dirty-notice {
  margin-right: auto;
  color: var(--warning);
  font-size: 12px;
}

@media (max-width: 1020px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: 0;
    overflow: visible;
  }

  .watchlist-panel,
  .chart-panel,
  .alerts-panel,
  .suggestions-panel {
    position: static !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    resize: none;
  }

  .alerts-panel {
    max-height: none;
  }

  .alerts-list {
    flex: none;
    max-height: 360px;
    overflow-y: auto;
  }

  .suggestions-content {
    max-height: 520px;
  }

  .panel-heading {
    cursor: default;
    touch-action: auto;
  }

  .add-form,
  .settings-section {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 640px) {
  .group-editor-layout { grid-template-columns: 1fr; }
  #groupMemberChoices { grid-template-columns: 1fr 1fr; }
  .ticker-details-grid { grid-template-columns: 1fr 1fr; }
  .fundamental-categories,
  .fundamental-metrics,
  .analysis-sections { grid-template-columns: 1fr; }
  .fundamentals-header,
  .fundamentals-section-heading { align-items: flex-start; flex-direction: column; }
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .add-form,
  .settings-section {
    grid-template-columns: 1fr;
  }

  #priceChart {
    height: 300px;
  }
}

/* Focused routed workspace */
.app-shell {
  max-width: 1540px;
}

.primary-nav {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 6px 18px rgba(27, 39, 51, 0.05);
  padding: 5px;
  backdrop-filter: blur(12px);
}

.primary-nav-link {
  border-radius: 7px;
  color: var(--muted);
  padding: 9px 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.primary-nav-link:hover,
.primary-nav-link.active {
  background: var(--surface-2);
  color: var(--accent-strong);
}

.app-main {
  width: 100%;
  padding-top: 18px;
}

.app-view {
  min-width: 0;
}

.view-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.view-heading {
  margin-bottom: 16px;
}

.view-heading h2,
.section-heading h3 {
  margin: 0;
}

.view-heading p,
.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.surface {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(580px, 1.35fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.watchlist-surface,
.company-detail-surface {
  display: grid;
  gap: 14px;
}

.watchlist-surface .add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.watchlist-surface .add-form > .company-search-field:first-child {
  flex: 2 1 210px;
}

.watchlist-surface .add-form > .company-search-field:nth-child(2) {
  flex: 1.4 1 155px;
}

.watchlist-surface .add-form > input[name="market"] {
  flex: 1 1 105px;
}

.watchlist-surface .add-form > .alert-default-field {
  flex: 1 1 125px;
}

.watchlist-surface .add-form > button {
  flex: 0 0 84px;
  min-width: 84px;
}

.company-detail-surface {
  position: sticky;
  top: 76px;
}

.company-detail-surface .chart-wrap {
  height: clamp(310px, 43vh, 540px);
}

.ticker-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.ticker-summary > div {
  display: grid;
  gap: 3px;
}

.ticker-summary > div:last-child {
  text-align: right;
}

.ticker-summary span {
  color: var(--muted);
  font-size: 12px;
}

.watchlist-cards,
#mobileAddCompanyBtn {
  display: none;
}

.subnav,
.settings-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
  margin-bottom: 14px;
}

.subnav button,
.settings-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  background: var(--surface-2);
  color: var(--muted);
}

.subnav button[aria-selected="true"],
.settings-tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}

.insights-section,
.suggestions-content {
  min-height: 180px;
}

.suggestions-content {
  max-height: none;
  overflow: visible;
}

.explanation-banner,
.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.explanation-banner strong {
  flex: 0 0 auto;
  color: var(--accent-strong);
}

.warning-banner {
  align-items: center;
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
  background: color-mix(in srgb, var(--warning) 9%, var(--surface));
  color: var(--warning);
}

.warning-banner.hidden {
  display: none;
}

.warning-banner > span:nth-child(2) {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
}

.warning-banner small {
  color: var(--muted);
}

.warning-banner button {
  flex: 0 0 auto;
}

.warning-icon {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 24px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
}

.link-button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

.filing-legend {
  margin-left: auto;
  position: relative;
}

.filing-legend > summary {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent-strong);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  list-style: none;
  width: 26px;
}

.filing-legend > summary::-webkit-details-marker {
  display: none;
}

.filing-legend > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 24%);
  display: grid;
  gap: 7px;
  padding: 13px;
  position: absolute;
  right: 0;
  top: 32px;
  width: min(430px, calc(100vw - 48px));
  z-index: 8;
}

.filing-legend p,
.filing-legend small {
  color: var(--muted);
  margin: 0;
}

.insight-card {
  padding: 0;
  overflow: hidden;
}

.insight-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.insight-card[open] {
  grid-column: 1 / -1;
}

.insight-card > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px;
}

.insight-card > summary > span:first-child {
  display: grid;
  gap: 3px;
}

.insight-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}

.insight-detail p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.factor-row,
.insight-event {
  display: grid;
  grid-template-columns: minmax(120px, auto) auto 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
}

.insight-event {
  grid-template-columns: 1fr;
}

.insight-event a {
  color: var(--text);
}

.sec-analysis-block {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 9px;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
}

.sec-analysis-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.sec-analysis-heading > span {
  display: grid;
  gap: 2px;
}

.sec-analysis-requirement {
  color: var(--warning) !important;
}

.sec-analysis-report {
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sec-analysis-report > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 12px;
}

.sec-analysis-sources {
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px 12px 0;
}

.sec-analysis-coverage {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  padding: 9px 12px;
}

.sec-analysis-coverage + .sec-analysis-sources {
  border-top: 0;
}

.sec-analysis-sources a {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 11px;
  padding: 3px 7px;
  text-decoration: none;
}

.insight-card:not([open]) .insight-detail {
  display: none;
}

.action-menu {
  display: inline-block;
  position: relative;
  min-width: 84px;
}

.action-menu summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent-strong);
  font-weight: 700;
  list-style: none;
}

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

.action-menu summary::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
}

.action-menu[open] summary::after {
  content: "▴";
}

.action-menu > div {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + 4px);
  display: grid;
  width: 120px;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 5px;
}

.action-menu button {
  min-height: 30px;
  text-align: left;
}

.insight-ideas-table {
  table-layout: auto;
}

.insight-ideas-table .idea-company {
  min-width: 145px;
}

.insight-ideas-table .idea-reason {
  width: 100%;
  white-space: normal;
}

.insight-ideas-table .idea-financial {
  min-width: 105px;
}

.insight-ideas-table .actions-column,
.insight-ideas-table .insight-actions {
  width: 100px;
  text-align: right;
  vertical-align: middle;
}

.idea-state-badge {
  display: inline-block;
  margin-left: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--positive) 14%, var(--surface));
  color: var(--positive);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}

.research-source-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.research-source-controls label {
  color: var(--muted);
  font-size: 12px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.alerts-list {
  max-height: none;
  overflow: visible;
  padding: 16px;
}

.feedback-toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 28px));
  border: 1px solid color-mix(in srgb, var(--positive) 55%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 11px 14px;
  font-size: 13px;
}

@media (min-width: 900px) {
  .alerts-list {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 10px;
  }
}

.alert-item {
  max-height: none;
  overflow: visible;
}

.settings-tabs {
  position: sticky;
  z-index: 4;
  top: -18px;
  margin: -2px -2px 14px;
  background: var(--surface);
  padding: 4px 2px 8px;
}

.settings-tabbed-form .modal-actions {
  position: sticky;
  z-index: 4;
  bottom: -18px;
  margin: 0 -18px -18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 18px;
}

.shadow-mode-explanation {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.mobile-detail-chart {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.mobile-detail-chart h3 {
  margin: 0;
  font-size: 15px;
}

#detailsPriceChart {
  display: block;
  width: 100%;
  height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 1020px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .company-detail-surface {
    position: static;
  }

  .desktop-watchlist {
    overflow-x: auto;
  }
}

@media (max-width: 700px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .app-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    margin-bottom: 12px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar p {
    display: none;
  }

  .primary-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-width: 1px 0 0;
    border-radius: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  }

  .primary-nav-link {
    padding: 10px 3px;
    text-align: center;
    font-size: 12px;
  }

  .app-main {
    padding-top: 6px;
  }

  .view-heading,
  .section-heading,
  .alerts-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .view-heading h2 {
    font-size: 22px;
  }

  .view-heading p {
    font-size: 13px;
  }

  .surface {
    padding: 12px;
  }

  #mobileAddCompanyBtn {
    display: inline-block;
  }

  .watchlist-surface .add-form {
    display: none;
  }

  .watchlist-surface .add-form.mobile-open {
    display: grid;
    grid-template-columns: 1fr;
  }

  .desktop-watchlist,
  .company-detail-surface {
    display: none;
  }

  .watchlist-cards {
    display: grid;
    gap: 8px;
  }

  .watchlist-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title price" "age price";
    gap: 5px 12px;
    width: 100%;
    min-height: 72px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 11px 12px;
    text-align: left;
  }

  .watchlist-card.selected {
    border-color: var(--accent);
  }

  .watchlist-card-title {
    grid-area: title;
    display: grid;
    min-width: 0;
  }

  .watchlist-card-title small,
  .watchlist-card-age {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .watchlist-card-price {
    grid-area: price;
    display: grid;
    align-content: center;
    text-align: right;
  }

  .watchlist-card-age {
    grid-area: age;
    font-size: 11px;
  }

  .research-source-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .research-source-controls label {
    grid-column: 1 / -1;
  }

  .explanation-banner {
    display: grid;
  }

  .warning-banner {
    align-items: start;
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .warning-banner button {
    grid-column: 1 / -1;
  }

  .factor-row {
    grid-template-columns: 1fr auto;
  }

  .factor-row small {
    grid-column: 1 / -1;
  }

  .modal {
    padding: 0;
  }

  .modal-panel,
  .alert-editor-panel {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 14px;
  }

  .settings-tabs {
    top: -14px;
  }

  .settings-tabbed-form .modal-actions {
    bottom: -14px;
    margin: 0 -14px -14px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .settings-section {
    grid-template-columns: 1fr;
  }

  .alerts-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .alerts-toolbar select {
    flex: 1 1 120px;
  }

  .insight-ideas-table .idea-confidence,
  .insight-ideas-table .idea-financial,
  .insight-ideas-table .idea-reason {
    display: none;
  }

  .insight-ideas-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .alerts-heading {
    top: 0;
  }

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

  .insight-detail {
    grid-template-columns: 1fr;
  }

  .sec-analysis-heading {
    align-items: stretch;
    display: grid;
  }

  [data-research-panel="reports"] .detailed-analysis-text {
    height: 55vh;
    min-height: 280px;
  }

  .feedback-toast {
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}
