:root {
  color-scheme: dark;
  --bg: #080c11;
  --panel: #11161f;
  --panel-2: #161d28;
  --panel-3: #0d1219;
  --ink: #f7fbff;
  --muted: #7f92b2;
  --line: #222b38;
  --accent: #00d19a;
  --accent-2: #00b7ff;
  --danger: #ff4778;
  --gain: #00d19a;
  --loss: #ff4778;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 1px solid #3a4353;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  min-height: 54px;
  padding: 0 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 500;
}

button:hover { border-color: #65758d; }
button.secondary { background: transparent; color: var(--ink); border-color: #3a4353; }
button.danger { color: var(--loss); border-color: rgba(255, 71, 120, 0.45); }
button.icon { width: 42px; padding: 0; min-height: 42px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1017;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
}

.combo-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.combo-add button {
  min-height: 42px;
}

textarea {
  resize: vertical;
  min-height: 86px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shell {
  min-height: 100vh;
}

aside {
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: #070b10;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
  font-weight: 500;
}

.brand {
  min-width: 360px;
}

.quote {
  margin: 9px 0 0;
  padding-top: 8px;
  border-top: 1px solid #0b7889;
  color: #c1ccd9;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.quote span {
  color: #00c8ff;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  margin-left: 12px;
}

.brand span { color: var(--muted); }

nav {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

nav button {
  min-width: 104px;
  background: #070b10;
  font-size: 14px;
}

nav button.active {
  border-color: #6b7280;
  background: #0d1118;
}

main {
  padding: 0;
  display: grid;
  gap: 0;
  align-content: start;
}

.topbar {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0;
  background: transparent;
  border-bottom: 0;
  padding: 0;
  pointer-events: none;
}

.topbar h2 {
  display: none;
}

.topbar .actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  pointer-events: auto;
}

.topbar .actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
}

.terminal-dashboard {
  height: calc(100vh - 88px);
  min-height: 0;
  display: grid;
  grid-template-rows: 64px 1fr;
  background: #101722;
  overflow: hidden;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(13, minmax(100px, 1fr));
  gap: 1px;
  background: #0b1017;
  border-bottom: 1px solid #0b1017;
}

.terminal-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  min-height: 0;
  overflow: hidden;
}

.terminal-table {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.analytics-rail {
  display: grid;
  grid-template-rows: auto;
  gap: 4px;
  background: #0b1017;
  border-left: 1px solid #0b1017;
  padding: 0;
  min-height: 0;
  overflow-y: auto;
}

.strategy-trigger-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.conviction-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.strategy-trigger-card {
  min-height: 118px;
  padding: 9px;
}

.strategy-trigger-card .rail-head {
  margin-bottom: 7px;
}

.strategy-trigger-card .rail-sort {
  width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-trigger-card .bar-list {
  gap: 7px;
}

.strategy-trigger-card .bar-label,
.strategy-trigger-card .bar-label strong {
  font-size: 8px;
}

.rail-card {
  background: #171e2a;
  border: 1px solid #111722;
  padding: 11px;
  min-height: 170px;
}

.rail-card.tall {
  min-height: 260px;
}

.rail-card.conviction-card {
  min-height: 120px;
}

.rail-card.conviction-card .rail-head {
  margin-bottom: 6px;
}

.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #b8c0cf;
  margin-bottom: 10px;
}

.rail-head h3 {
  margin: 0;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: #b8c0cf;
}

.rail-title-with-total {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rail-title-with-total span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-title-total {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 500;
}

.rail-sort {
  border: 0;
  border-radius: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #b8c0cf;
  font-size: 11px;
  font-weight: 400;
}

.rail-sort.rail-title-with-total {
  display: flex;
}

.rail-sort:hover {
  border: 0;
  color: var(--ink);
}

.rail-head span {
  font-size: 12px;
  color: #9aa6ba;
}

.view {
  display: none;
  gap: 24px;
}

.view.active { display: grid; }

.share-calculator {
  display: grid;
  gap: 10px;
  min-height: calc(100vh - 88px);
  padding: 12px;
  background: #101722;
  align-content: start;
}

.share-input-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) minmax(150px, 0.8fr);
  gap: 10px;
  align-items: end;
}

.share-input-grid label {
  grid-template-rows: auto 38px;
}

.share-input-grid input,
.share-input-grid select,
.share-limit-grid input {
  min-height: 38px;
  height: 38px;
}

.share-calculation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.share-side-stack {
  display: grid;
  gap: 10px;
}

.share-limit-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: end;
}

.share-output {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #0b1017;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.share-output strong {
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
}

.share-table-wrap {
  max-height: none;
}

.share-table th,
.share-table td {
  padding: 10px 14px;
}

.share-table td:nth-child(n+2) {
  text-align: right;
}

.share-table th:nth-child(n+2) {
  text-align: right;
}

.share-percent {
  color: #cde5c2;
  font-weight: 500;
}

.share-shares {
  color: var(--accent-2);
  font-weight: 500;
}

.share-atr-row {
  background: #111821 !important;
  border-top: 1px solid var(--line);
}

.share-atr-row td {
  font-weight: 500;
}

.share-atr-alert {
  color: var(--loss);
  background: rgba(255, 71, 120, 0.12);
}

.share-spacer-row {
  height: 22px;
  background: #101722 !important;
}

.share-spacer-row td {
  padding: 0;
}

.share-over-allocation td {
  background: rgba(255, 71, 120, 0.08);
}

.share-over-allocation .share-shares {
  color: var(--loss);
  background: rgba(255, 71, 120, 0.15);
}

.share-selected-allocation td {
  box-shadow: inset 0 1px rgba(0, 209, 154, 0.35), inset 0 -1px rgba(0, 209, 154, 0.35);
}

.panel {
  background: #171e2a;
  border: 0;
  border-radius: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 10px;
  border-bottom: 1px solid #111722;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-head h3 {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.panel-head h3 strong {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.panel-body { padding: 21px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

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

.metric {
  background: #171e2a;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(90px, 1fr);
  gap: 8px;
  min-height: 64px;
  align-items: center;
}

.terminal-stat {
  cursor: grab;
  user-select: none;
}

.terminal-stat.no-chart {
  grid-template-columns: 1fr;
}

.terminal-stat.no-chart .empty-spark {
  display: none;
}

.terminal-stat.no-chart strong {
  white-space: nowrap;
}

.terminal-stat.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.terminal-stat.drag-over {
  outline: 1px solid var(--accent);
  outline-offset: -2px;
  background: #1d2838;
}

.metric span {
  color: #b8c0cf;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.metric strong {
  color: #e8edf7;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.1;
  margin-top: 6px;
  display: block;
}

.metric strong.loss { color: var(--loss); }
.metric strong.gain { color: var(--gain); }
.metric strong.neutral { color: var(--muted); }

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

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(4, minmax(94px, 1fr)) repeat(2, minmax(105px, 0.9fr));
  gap: 6px;
  align-items: end;
}

.filters label {
  min-width: 0;
  font-size: 9px;
}

.filters input,
.filters select {
  min-height: 30px;
  height: 30px;
  padding: 4px 8px;
  font-size: 11px;
}

.terminal-table > .panel:first-child .panel-head {
  display: none;
}

.terminal-table > .panel:first-child .panel-body {
  padding: 5px 8px 6px;
}

.terminal-table > .panel:first-child {
  border-bottom: 1px solid #0b1017;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 0;
  padding: 10px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

#tradesTable tbody td {
  padding-top: 11px;
  padding-bottom: 11px;
}

#tradesTable tbody td:last-child button {
  min-height: 0;
  padding: 5px 9px;
  font-size: 11px;
}

.terminal-table > .panel:last-child {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.terminal-table > .panel:last-child .panel-head {
  position: relative;
  min-height: 30px;
  padding: 5px 9px;
}

.trades-head-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trades-head-pagination {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  min-height: 0;
  padding: 0;
  border-top: 0;
}

.terminal-table > .panel:last-child .table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

#tradesTable th {
  padding-top: 7px;
  padding-bottom: 7px;
}

#tradesTable .status-pill {
  padding: 4px 7px;
  font-size: 12px;
}

#tradesTable .side-pill {
  margin-top: 0;
  margin-bottom: 0;
  padding: 4px 9px;
  font-size: 13px;
}

th {
  color: #8f98aa;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #171e2a;
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 400;
}

.sort-head,
.month-sort-head,
.daily-sort-head,
.monster-sort-head,
.theme-sort-head {
  border: 0;
  border-radius: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-head:hover,
.month-sort-head:hover,
.daily-sort-head:hover,
.monster-sort-head:hover,
.theme-sort-head:hover {
  color: var(--ink);
  border: 0;
}

tbody tr:nth-child(odd) { background: #171e2a; }
tbody tr:nth-child(even) { background: #192638; }
tbody tr:hover { background: #203049; }

td { color: #b9c1ce; }
td strong, .ticker { color: var(--accent-2); font-weight: 500; }

.table-wrap {
  max-height: calc(100vh - 255px);
  overflow: auto;
}

.detail-trade-table table {
  table-layout: fixed;
}

.detail-trade-table th,
.detail-trade-table td {
  width: 16.66%;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px 10px;
  border-top: 1px solid #0b1017;
  color: var(--muted);
  font-size: 13px;
}

.pagination button {
  min-width: 58px;
  padding: 6px 10px;
}

.terminal-table .pagination {
  min-height: 28px;
  gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
}

.terminal-table .trades-head-pagination {
  min-height: 0;
  padding: 0;
}

.terminal-table .pagination button {
  min-width: 42px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.compact-table .table-wrap,
.compact-table { max-height: 360px; }

.daily-settings-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  align-items: start;
}

.daily-add-control {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-top: 23px;
}

.daily-add-control button {
  min-width: 150px;
  min-height: 42px;
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
}

.daily-data-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.daily-raw-panel,
.daily-twr-panel,
.daily-chart-placeholder {
  min-width: 0;
}

.daily-raw-panel {
  display: flex;
  flex-direction: column;
}

.daily-raw-panel .daily-data-table {
  flex: 1;
}

.daily-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
  min-height: 820px;
  min-width: 0;
}

.daily-twr-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.balance-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.balance-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.balance-chart-legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
}

.legend-deposit { background: #8f98aa; }
.legend-profit { background: var(--gain); }
.legend-loss { background: var(--loss); }

.daily-chart-wrap {
  position: relative;
  min-height: 0;
  padding: 7px;
  overflow: hidden;
}

#dailyTwrChart {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#dailyBalanceChart {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#tradePnlDistributionChart {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.graph-placeholder {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border: 1px dashed #2a3547;
  margin: 7px;
}

.daily-chart-grid .panel-head {
  padding: 7px 8px;
  min-height: 34px;
}

.daily-chart-grid .panel-head h3 {
  font-size: 10px;
}

.daily-chart-grid .balance-chart-legend {
  gap: 7px;
  font-size: 9px;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: none;
  width: 190px;
  padding: 9px 10px;
  border: 1px solid #354258;
  background: rgba(11, 16, 23, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font-size: 11px;
  pointer-events: none;
}

.chart-tooltip.show {
  display: grid;
  gap: 5px;
}

.chart-tooltip strong {
  color: var(--accent-2);
  font-weight: 500;
}

.chart-tooltip span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.chart-tooltip span i {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 6px;
  flex: 0 0 auto;
}

.chart-tooltip b {
  color: var(--ink);
  font-weight: 500;
}

.chart-tooltip b.gain { color: var(--gain); }
.chart-tooltip b.loss { color: var(--loss); }
.chart-tooltip b.neutral { color: var(--muted); }

.daily-data-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.daily-summary {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 13px;
}

.daily-summary strong {
  margin-left: 5px;
  font-size: 14px;
  font-weight: 500;
}

.daily-data-table {
  max-height: none;
}

.daily-data-table th,
.daily-data-table td {
  padding: 11px 14px;
}

.daily-data-table tbody td:first-child strong {
  color: var(--muted);
  font-weight: 500;
}

.net-worth-entry-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.45fr) minmax(170px, 0.55fr) auto;
  gap: 12px;
  align-items: end;
}

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

.net-worth-table-wrap {
  max-height: calc(100vh - 295px);
}

.net-worth-month-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 8px;
  border-top: 1px solid var(--line);
}

.net-worth-month-controls span {
  min-width: 180px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.net-worth-month-controls button {
  min-height: 0;
  padding: 4px 8px;
  font-size: 11px;
}

.net-worth-table th,
.net-worth-table td {
  padding: 7px 9px;
}

.net-worth-table input {
  min-width: 110px;
  min-height: 30px;
  padding: 4px 7px;
  border-radius: 5px;
  text-align: left;
}

.net-worth-account-name {
  min-width: 220px;
  white-space: normal;
}

.net-worth-total-row td {
  background: #101722;
  font-weight: 600;
  color: var(--ink);
}

.net-worth-chart-wrap {
  position: relative;
  min-height: 0;
  height: calc(100vh - 295px);
  max-height: 620px;
}

#netWorthChart {
  display: block;
  width: 100%;
  height: 100%;
}

.net-worth-tooltip {
  width: 250px;
}

.net-worth-tooltip span {
  align-items: center;
  justify-content: flex-start;
}

.net-worth-tooltip span b {
  margin-left: auto;
}

.daily-pagination {
  min-height: 48px;
}

.daily-goals-entry-panel {
  margin-bottom: 2px;
}

.daily-goals-entry-panel .panel-body {
  padding: 6px 10px;
}

.daily-goal-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 3px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.daily-goal-controls span {
  min-width: 205px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.daily-goal-controls button,
.daily-goal-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
}

.daily-goal-entry-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(170px, 0.55fr) minmax(280px, 1.4fr) auto;
  gap: 8px;
  align-items: end;
}

.daily-goal-entry-grid input,
.daily-goal-entry-grid select {
  min-height: 30px;
  padding: 5px 8px;
}

.daily-goal-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.daily-goal-template-panel {
  margin: 0 0 3px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.daily-goal-template-panel summary {
  cursor: pointer;
  padding: 4px 9px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 500;
}

.daily-goal-template-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(150px, 0.55fr) minmax(260px, 1.4fr) auto;
  gap: 8px;
  align-items: end;
  padding: 0 9px 7px;
}

.daily-goal-template-grid input,
.daily-goal-template-grid select {
  min-height: 30px;
  padding: 5px 8px;
}

.daily-goal-template-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.daily-goal-template-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
}

.daily-goal-template-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 9px 8px;
}

.daily-goal-template-empty,
.daily-goal-template-chip {
  color: var(--muted);
  font-size: 10px;
}

.daily-goal-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 5px;
  background: #0b1017;
}

.daily-goal-template-chip b {
  color: var(--ink);
  font-weight: 500;
}

.daily-goal-template-chip button {
  min-height: 0;
  padding: 0 4px;
  border-radius: 4px;
  color: var(--loss);
  font-size: 10px;
}

.daily-goals-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 6px;
  min-height: calc(100vh - 295px);
  height: auto;
}

.daily-goal-week {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.daily-goal-week-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.daily-goal-week-title strong {
  color: var(--accent-2);
  font-weight: 500;
}

.daily-goal-days {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  min-height: 0;
}

.daily-goal-day {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.daily-goal-day:last-child {
  border-right: 0;
}

.daily-goal-weekly-average {
  background: #0c121a;
  border-left: 1px solid #39475a;
}

.daily-goal-average-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px 5px;
}

.daily-goal-average-metric {
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(127, 146, 178, 0.18);
  color: var(--muted);
  font-size: 11px;
}

.daily-goal-average-metric strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.daily-goal-average-metric strong.readiness-green,
.daily-goal-average-metric strong.steps-green,
.daily-goal-average-metric strong.stress-green {
  color: var(--gain);
}

.daily-goal-average-metric strong.readiness-yellow {
  color: #f5c257;
}

.daily-goal-average-metric strong.readiness-red,
.daily-goal-average-metric strong.steps-red,
.daily-goal-average-metric strong.stress-red {
  color: var(--loss);
}

.daily-goal-average-metric strong.grade-a {
  color: var(--gain);
}

.daily-goal-average-metric strong.grade-b {
  color: #67b7ff;
}

.daily-goal-average-metric strong.grade-c {
  color: #f5c257;
}

.daily-goal-average-metric strong.grade-f {
  color: var(--loss);
}

.daily-goal-weekly-notes {
  display: grid;
  gap: 4px;
  padding-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.daily-goal-weekly-notes > span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.daily-goal-weekly-notes p {
  margin: 0;
  line-height: 1.35;
  white-space: normal;
}

.daily-goal-weekly-notes b {
  color: var(--accent-2);
  font-weight: 500;
}

.daily-goal-before-start {
  opacity: 0.38;
}

.daily-goal-before-start-message {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.daily-goal-day-head {
  min-height: 0;
  width: 100%;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font-size: 14px;
}

.daily-goal-day-head strong {
  color: var(--muted);
  font-weight: 500;
}

.daily-goal-day-type {
  min-height: 28px;
  padding: 3px 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #0b1017;
  color: var(--muted);
  font-size: 12px;
}

.daily-goal-task-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding: 3px;
}

.daily-goal-upper-tasks {
  min-height: 42px;
  flex: 0 0 auto;
  overflow: visible;
}

.daily-goal-lower-sections {
  margin-top: 0;
  padding-top: 30px;
}

.daily-goal-current-project {
  min-height: 36px;
  padding-top: 3px;
  border-top: 1px solid rgba(127, 146, 178, 0.18);
}

.daily-goal-current-project .daily-goal-section {
  margin-top: 0;
  text-align: left;
}

.daily-goal-note-section {
  flex: 0 0 auto;
  padding-top: 2px;
}

.daily-goal-note-section .daily-goal-section {
  text-align: left;
}

.daily-goal-note-section textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding: 3px 4px;
  border-radius: 4px;
  resize: none;
  font-size: 13px;
  line-height: 1.25;
}

.daily-goal-readiness-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px;
  gap: 3px;
  align-items: center;
  margin-bottom: 3px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(127, 146, 178, 0.18);
  color: var(--muted);
  font-size: 13px;
}

.daily-goal-readiness-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-goal-readiness-row input {
  min-height: 27px;
  padding: 3px 5px;
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
}

.daily-goal-readiness-row input.readiness-green {
  border-color: rgba(0, 209, 154, 0.55);
  color: var(--gain);
  background: rgba(0, 209, 154, 0.1);
}

.daily-goal-readiness-row input.readiness-yellow {
  border-color: rgba(245, 194, 87, 0.65);
  color: #f5c257;
  background: rgba(245, 194, 87, 0.11);
}

.daily-goal-readiness-row input.readiness-red {
  border-color: rgba(255, 71, 120, 0.58);
  color: var(--loss);
  background: rgba(255, 71, 120, 0.1);
}

.daily-goal-steps-row,
.daily-goal-stress-row,
.daily-goal-grade-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto;
  gap: 3px;
  align-items: center;
  margin-bottom: 3px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(127, 146, 178, 0.18);
  color: var(--muted);
  font-size: 13px;
}

.daily-goal-steps-row input,
.daily-goal-stress-row input {
  min-height: 27px;
  padding: 3px 5px;
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
}

.daily-goal-steps-row strong,
.daily-goal-stress-row strong,
.daily-goal-grade-row strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.daily-goal-grade-row small {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.daily-goal-grade-row strong.grade-a {
  color: var(--gain);
}

.daily-goal-grade-row strong.grade-b {
  color: #67b7ff;
}

.daily-goal-grade-row strong.grade-c {
  color: #f5c257;
}

.daily-goal-grade-row strong.grade-f {
  color: var(--loss);
}

.daily-goal-steps-row input.steps-green {
  border-color: rgba(0, 209, 154, 0.55);
  color: var(--gain);
  background: rgba(0, 209, 154, 0.1);
}

.daily-goal-steps-row input.steps-red {
  border-color: rgba(255, 71, 120, 0.58);
  color: var(--loss);
  background: rgba(255, 71, 120, 0.1);
}

.daily-goal-stress-row input.stress-red {
  border-color: rgba(255, 71, 120, 0.58);
  color: var(--loss);
  background: rgba(255, 71, 120, 0.1);
}

.daily-goal-stress-row input.stress-green {
  border-color: rgba(0, 209, 154, 0.55);
  color: var(--gain);
  background: rgba(0, 209, 154, 0.1);
}

.daily-goal-special-events-slot {
  display: grid;
  grid-auto-rows: 20px;
  gap: 1px;
  margin-bottom: 3px;
}

.daily-goal-special-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 3px;
  align-items: center;
  min-height: 20px;
  color: var(--loss);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
}

.daily-goal-special-event-empty {
  min-height: 20px;
}

.daily-goal-special-event span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-goal-special-event button {
  min-height: 0;
  padding: 1px 3px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
}

.daily-goal-section {
  margin: 3px 0 1px;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 600;
}

.daily-goal-section:first-child {
  margin-top: 0;
}

.daily-goal-task {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  gap: 3px;
  align-items: center;
  margin-bottom: 1px;
  color: #dce6f2;
  font-size: 13px;
  line-height: 1.25;
}

.daily-goal-task input {
  width: 15px;
  min-height: 15px;
  padding: 0;
  accent-color: var(--accent);
}

.daily-goal-task span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-goal-task.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.daily-goal-task.daily-goal-task-todo {
  color: #f5c257;
}

.daily-goal-task.daily-goal-task-todo input {
  accent-color: #f5c257;
}

.daily-goal-task button,
.daily-goal-empty {
  min-height: 0;
  padding: 1px 3px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
}

.daily-goal-empty {
  width: 100%;
  border-style: dashed;
  justify-content: center;
}

.monster-entry-grid {
  display: grid;
  grid-template-columns: minmax(82px, 0.36fr) minmax(88px, 0.38fr) minmax(120px, 0.52fr) minmax(180px, 1fr) minmax(260px, 1.6fr) minmax(160px, 0.75fr) auto;
  gap: 12px;
  align-items: end;
}

.monster-search-row {
  display: grid;
  grid-template-columns: 42px minmax(82px, 0.45fr) minmax(110px, 0.65fr) minmax(95px, 0.55fr) minmax(150px, 1fr) minmax(180px, 1.2fr) minmax(145px, 0.8fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px 14px 4px;
}

.monster-search-row select {
  min-height: 38px;
  height: 38px;
  padding: 5px 8px;
}

.monster-search-row > button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 11px;
}

.monster-search-row > .monster-random-button {
  width: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.monster-search-row > .monster-clear-button {
  min-width: 58px;
}

.theme-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.theme-entry-grid,
.setup-entry-grid {
  display: grid;
  gap: 12px;
  align-items: end;
}

.theme-entry-grid {
  grid-template-columns: minmax(80px, 0.28fr) minmax(180px, 0.9fr) minmax(180px, 0.9fr) auto;
}

.setup-entry-grid {
  grid-template-columns: minmax(120px, 0.6fr) minmax(105px, 0.45fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.theme-entry-actions,
.theme-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.theme-entry-actions button {
  min-height: 42px;
  white-space: nowrap;
}

.theme-setup-table-wrap {
  max-height: calc(100vh - 330px);
}

.setup-type-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  border-top: 1px solid var(--line);
}

.setup-type-pagination span {
  min-width: 140px;
  color: var(--text);
  font-size: 11px;
  text-align: center;
}

.setup-type-pagination button {
  min-height: 0;
  padding: 4px 8px;
  font-size: 11px;
}

.theme-row-actions button {
  min-height: 0;
  padding: 5px 9px;
}

.setup-section-row td {
  background: #050a0f;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  padding: 8px 10px;
}

.setup-trigger-cell {
  color: var(--text);
  font-weight: 500;
  vertical-align: top;
}

.theme-group-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  color: #071016;
  font-weight: 700;
}

.theme-group-a { background: #39ff14; }
.theme-group-b { background: #ffff00; }
.theme-group-c { background: #ffbd00; }
.theme-group-d { background: #ff1f1f; color: #fff; }

.theme-setup-text-cell {
  white-space: normal;
  min-width: 280px;
}

.monster-entry-actions,
.monster-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.monster-entry-actions button {
  min-height: 42px;
  white-space: nowrap;
}

.monster-table-panel {
  min-width: 0;
}

.monster-table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monster-table-tools button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.monster-table-wrap {
  max-height: calc(100vh - 270px);
}

#monsterMovesTable th,
#monsterMovesTable td {
  padding: 4px 7px;
  line-height: 1.2;
}

.monster-theme-cell {
  width: 100%;
  white-space: normal;
  min-width: 280px;
  color: inherit;
}

.monster-company-cell,
.monster-asset-cell {
  color: inherit;
}

.monster-study-check {
  width: 15px;
  height: 15px;
  accent-color: var(--gain);
}

.monster-row-number {
  width: 42px;
  color: var(--muted);
  text-align: center;
}

.monster-status-select {
  min-width: 142px;
  height: 36px;
  min-height: 36px;
  padding: 3px 10px;
}

.monster-actions button {
  height: 36px;
  min-height: 36px;
  padding: 3px 10px;
  font-size: 11px;
}

#monsterMovesTable td.monster-status-cell,
#monsterMovesTable td.monster-actions {
  vertical-align: middle;
}

.monster-status-cell,
.monster-actions {
  height: 44px;
}

.monster-pagination {
  min-height: 36px;
  padding: 6px 12px;
  justify-content: center;
}

.monster-pagination button {
  min-height: 0;
  padding: 5px 10px;
  font-size: 11px;
}

#monsterMovesTable tbody tr.monster-status-studied {
  background: rgba(0, 209, 154, 0.13);
}

#monsterMovesTable tbody tr.monster-status-incomplete {
  background: rgba(255, 203, 71, 0.14);
}

#monsterMovesTable tbody tr.monster-status-needs-data {
  background: rgba(74, 163, 255, 0.13);
}

#monsterMovesTable tbody tr.monster-status-unstudied {
  background: #171e2a;
}

#monsterMovesTable tbody tr.monster-random-target {
  outline: 2px solid #f5c257;
  outline-offset: -2px;
  background: rgba(245, 194, 87, 0.18);
}

#monsterMovesTable tbody tr:hover {
  filter: brightness(1.12);
}

.cash-flow-chips {
  justify-content: flex-start;
  margin-top: 18px;
  padding: 12px 0 0;
  border-bottom: 0;
  border-top: 1px solid var(--line);
}

.cash-flow-tag {
  color: var(--ink);
  background: #202b3b;
}

.daily-delete {
  min-height: 0;
  padding: 5px 9px;
  color: var(--loss);
  border-color: rgba(255, 77, 124, 0.35);
}

.daily-edit {
  min-height: 0;
  padding: 5px 9px;
  color: var(--accent);
  border-color: rgba(0, 209, 154, 0.35);
}

.daily-row-actions {
  display: flex;
  gap: 5px;
}

.pnl.gain, .gain { color: var(--gain); font-weight: 500; }
.pnl.loss, .loss { color: var(--loss); font-weight: 500; }
.pnl.neutral, .neutral { color: var(--muted); font-weight: 500; }

.tag, .side-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  background: rgba(0, 209, 154, 0.13);
  color: var(--accent);
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 500;
  margin: 2px 3px 2px 0;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-tag {
  min-height: 28px;
  border-radius: 5px;
  padding: 4px 8px;
  background: rgba(0, 209, 154, 0.12);
  color: var(--accent);
  border-color: rgba(0, 209, 154, 0.25);
  font-size: 11px;
}

.selected-tag span {
  color: #9aa6ba;
  margin-left: 5px;
}

.sync-status {
  margin: 0;
  color: #9aa6ba;
  font-size: 12px;
}

.sync-help {
  margin: 0;
  color: #9aa6ba;
  font-size: 12px;
}

.sync-status.gain {
  color: var(--gain);
}

.sync-status.loss {
  color: var(--loss);
}

.side-pill.short {
  color: var(--loss);
  background: rgba(255, 71, 120, 0.13);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.status-pill.win {
  background: #0ea5a3;
}

.status-pill.loss {
  background: #f05b91;
}

.status-pill.open {
  background: #facc15;
  color: #171e2a;
}

.status-pill.be {
  background: #6b7280;
  color: #f8fafc;
}

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

.chart {
  height: 300px;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}

.rail-chart {
  width: 100%;
  height: 180px;
  display: block;
}

.sparkline {
  width: 100%;
  height: 42px;
  display: block;
}

.empty-spark {
  min-height: 42px;
}

.win-loss {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.win-loss span {
  font-size: 13px;
}

.account-chart {
  height: 145px;
}

.rail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.rail-metrics span {
  display: block;
  color: #9aa6ba;
  font-size: 8px;
  text-transform: uppercase;
}

.rail-metrics strong {
  display: block;
  color: #e8edf7;
  margin-top: 3px;
  font-size: 13px;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  gap: 3px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #b8c0cf;
  font-size: 9px;
}

.bar-label strong {
  font-size: 9px;
}

.bar-track {
  height: 4px;
  background: #697281;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
}

.gain-bg { background: #009f98; }
.loss-bg { background: #f05b91; }
.neutral-bg { background: #6b7280; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--accent);
  color: #03100d;
  padding: 12px 15px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
  pointer-events: none;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  max-width: 1080px;
  width: calc(100vw - 30px);
  background: var(--panel);
  color: var(--ink);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }

.detail {
  display: grid;
  gap: 16px;
}

.detail dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0;
}

.detail dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail dd {
  margin: 5px 0 0;
  font-weight: 500;
  color: var(--ink);
}

.notes {
  white-space: pre-wrap;
  line-height: 1.5;
  color: #aab7cc;
}

.exit-editor {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-3);
}

.exit-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.exit-editor h4 {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
}

.month-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.month-controls strong {
  min-width: 90px;
  text-align: center;
  font-size: 16px;
}

.calendar-pair {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 16px;
}

.calendar-card h4 {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 6px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.calendar-card h4 span {
  grid-column: 2;
  text-align: center;
}

.calendar-card h4 strong {
  grid-column: 3;
  justify-self: end;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.exit-rows {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.entry-row,
.exit-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

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

.day-cell {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #151b26;
  padding: 3px;
  display: grid;
  align-content: space-between;
}

.day-cell.has-pnl {
  background: #111f25;
  border-color: #243847;
}

.day-cell.muted-cell {
  opacity: 0.35;
}

.day-cell .day {
  color: var(--muted);
  font-size: 11px;
}

.day-cell .value {
  font-weight: 500;
  font-size: 11px;
}

.day-cell small {
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .terminal-main { grid-template-columns: 1fr; }
  .analytics-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; border-left: 0; }
  .stat-strip { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .calendar-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-data-split { grid-template-columns: 1fr; }
  .net-worth-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .net-worth-split { grid-template-columns: 1fr; }
  .daily-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-goal-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-input-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .share-limit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .daily-goals-board { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
  .daily-goal-week { min-height: 280px; }
  .monster-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monster-search-row { grid-template-columns: 42px repeat(3, minmax(140px, 1fr)); }
  .theme-setup-layout { grid-template-columns: 1fr; }
  .theme-entry-grid, .setup-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  aside { align-items: flex-start; flex-direction: column; }
  nav { width: 100%; }
  nav button { flex: 1; min-width: 120px; }
  main { padding: 14px; }
  .topbar {
    position: static;
    margin: -6px 0 8px;
  }
  .topbar .actions {
    width: 100%;
  }
  .topbar .actions button {
    flex: 1;
  }
  .metric-grid, .grid, .grid.two, .filters, .detail dl, .entry-row, .exit-row { grid-template-columns: 1fr; }
  .actions { width: 100%; }
  .actions button { flex: 1; }
  .analytics-rail, .stat-strip, .calendar-pair { grid-template-columns: 1fr; }
  .daily-settings-grid { grid-template-columns: 1fr; }
  .net-worth-entry-grid { grid-template-columns: 1fr; }
  .daily-chart-grid { grid-template-columns: 1fr; }
  .daily-goal-entry-grid { grid-template-columns: 1fr; }
  .share-input-grid, .share-limit-grid, .share-calculation-grid { grid-template-columns: 1fr; }
  .daily-goal-controls { width: 100%; flex-wrap: wrap; justify-content: center; }
  .daily-goal-days { grid-template-columns: 1fr; }
  .daily-goal-day { border-right: 0; border-bottom: 1px solid var(--line); }
  .monster-entry-grid { grid-template-columns: 1fr; }
  .monster-search-row { grid-template-columns: 42px minmax(0, 1fr); }
  .theme-entry-grid, .setup-entry-grid { grid-template-columns: 1fr; }
  .month-controls strong { min-width: 170px; }
}
