:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #d8e0ea;
  --accent: #0f766e;
  --accent-dark: #0b5e59;
  --accent-soft: #e6f5f2;
  --blue: #3156d4;
  --blue-soft: #e9eeff;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ink: #111827;
  --shadow: 0 14px 34px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

button.danger.confirm,
button.danger:hover {
  background: var(--danger);
  color: #fff;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.ghost-button:hover {
  background: var(--surface-soft);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 251, 0.94);
  padding: 14px clamp(16px, 3vw, 34px);
  backdrop-filter: blur(10px);
}

.brand,
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.external-link {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  color: var(--blue);
  text-decoration: none;
}

.external-link img {
  width: 22px;
  height: 22px;
  display: block;
}

.brand {
  color: var(--text);
  font-size: 19px;
  font-weight: 900;
  text-decoration: none;
}

.brand-mark,
.login-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #7dd3fc;
  font-weight: 900;
}

nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

nav a {
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

nav a.active {
  background: var(--ink);
  color: #fff;
}

[hidden] {
  display: none !important;
}

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

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 22px auto 56px;
}

.top-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.status-pill,
.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.mysql,
.badge.ok,
.status-active {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.sqlite,
.status-processing,
.status-pending_review {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.error,
.status-error,
.status-excluded,
.status-deleted_by_user,
.danger-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.muted-badge {
  background: #eef2f6;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
}

.panel {
  margin-bottom: 18px;
  padding: clamp(16px, 2.4vw, 24px);
}

.market-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-shadow: var(--shadow);
}

.market-tab-buttons {
  display: inline-flex;
  gap: 6px;
}

.market-tabs button {
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
}

.market-tabs button:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.portfolio-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.portfolio-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px 28px;
  width: 100%;
}

.portfolio-totals span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: baseline;
  white-space: nowrap;
}

.portfolio-totals em {
  color: var(--muted);
  font-style: normal;
  text-align: left;
}

.portfolio-totals strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.portfolio-totals .fx-note {
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 4px 8px;
  color: var(--accent-dark);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.metrics,
.dashboard-grid {
  display: none;
}

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

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.reset-button {
  margin-left: auto;
  min-height: 36px;
}

.security-alert,
.alert-pulse {
  animation: securityPulse 0.9s ease-in-out infinite;
}

nav a.security-alert {
  border: 2px solid #dc2626;
  background: #fff7ed;
  color: #9a3412;
}

.security-alert-box {
  margin-bottom: 14px;
  border: 2px solid #dc2626;
  border-radius: 8px;
  background: #fff7ed;
  color: #7f1d1d;
  padding: 12px 14px;
  font-weight: 900;
  animation: securityGlow 0.9s ease-in-out infinite;
}

.lock-recovered-row {
  background: #fff7ed;
  animation: securityGlow 0.9s ease-in-out infinite;
}

.lock-recovered-row:hover {
  background: #ffedd5;
}

.security-note {
  color: #9a3412;
}

@keyframes securityPulse {
  0%,
  100% {
    border-color: #dc2626;
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(220, 38, 38, 0);
  }
  50% {
    border-color: #f59e0b;
    background: #fee2e2;
    color: #7f1d1d;
    filter: brightness(1.12);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.28);
  }
}

@keyframes securityGlow {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(220, 38, 38, 0), 0 0 0 rgba(220, 38, 38, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: inset 0 0 0 3px rgba(220, 38, 38, 0.72), 0 0 0 6px rgba(245, 158, 11, 0.22);
    filter: brightness(1.08);
  }
}

.donut-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: center;
  min-height: 210px;
}

.donut {
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: #fff;
}

.donut span,
.donut small {
  position: relative;
  z-index: 1;
}

.donut span {
  font-size: 34px;
  font-weight: 900;
}

.donut small {
  margin-top: 38px;
  margin-left: -24px;
  color: var(--muted);
  font-weight: 800;
}

.legend-list,
.bar-list {
  display: grid;
  gap: 12px;
}

.legend-list div,
.bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.legend-list i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-list div {
  justify-content: flex-start;
}

.legend-list strong {
  margin-left: auto;
}

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

.bar-track,
.weight-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}

.bar-track i,
.weight-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.activity-bars {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding-top: 8px;
}

.activity-legend {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.activity-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.activity-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.activity-plot {
  position: relative;
  min-height: 200px;
  padding: 8px 0 0 30px;
}

.activity-guides {
  position: absolute;
  inset: 8px 0 38px 0;
  pointer-events: none;
}

.activity-guides div {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px dashed #d7e0ea;
}

.activity-guides span {
  position: absolute;
  left: -18px;
  top: -9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  width: 16px;
}

.activity-columns {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  gap: 14px;
  min-height: 190px;
  height: 200px;
  padding-bottom: 38px;
}

.activity-column {
  position: relative;
  display: grid;
  flex: 1;
  min-width: 46px;
  height: 162px;
  align-items: end;
  justify-items: center;
  gap: 8px;
}

.activity-stack {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px 8px 2px 2px;
  background: #eef2f6;
}

.activity-stack i {
  display: block;
  width: 100%;
}

.activity-stack .buy {
  background: #dc2626;
}

.activity-stack .sell {
  background: #16a34a;
}

.activity-legend .buy {
  background: #dc2626;
}

.activity-legend .sell {
  background: #16a34a;
}

.activity-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 4;
  width: max-content;
  max-width: 180px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.activity-column:hover .activity-tooltip,
.activity-column:focus .activity-tooltip {
  opacity: 1;
}

.activity-column span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.activity-mobile-info {
  display: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.holding-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
}

.holding-card {
  display: grid;
  align-content: start;
  align-self: start;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.holding-card strong {
  font-size: 20px;
}

.holding-title,
.stock-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.holding-title strong,
.stock-line strong {
  font-size: 20px;
  line-height: 1.15;
}

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

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

.holding-meta b {
  font-variant-numeric: tabular-nums;
}

.holding-fifo {
  display: grid;
  gap: 8px;
  margin: 0;
}

.holding-fifo div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.holding-fifo dt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.holding-fifo dd {
  margin: 0;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.gain {
  color: var(--ok);
}

.loss {
  color: var(--danger);
}

.info-tip {
  position: relative;
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 999px;
  background: #e8eef7;
  color: #52637a;
  cursor: help;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.info-tip::after,
.info-tip::before {
  position: absolute;
  left: 50%;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.info-tip::before {
  content: "";
  bottom: calc(100% + 4px);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}

.info-tip::after {
  content: attr(data-tip);
  bottom: calc(100% + 14px);
  width: max-content;
  max-width: 230px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
}

.info-tip:hover::after,
.info-tip:hover::before,
.info-tip:focus::after,
.info-tip:focus::before {
  opacity: 1;
}

.lot-details {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.lot-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.fifo-toolbar {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.fifo-range {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fifo-range button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
}

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

.fifo-realized {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.lot-list {
  display: grid;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  gap: 6px;
  margin-top: 8px;
  padding-bottom: 2px;
}

.lot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  font-size: 12px;
}

.lot-row span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lot-row span:nth-child(4),
.lot-row span:nth-child(5) {
  grid-column: 1 / -1;
}

.lot-row.sell-event {
  background: #fff7f7;
}

.lot-row.buy-event {
  background: #f6fbf7;
}

.quote-footnote {
  min-height: 18px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.empty-visual {
  display: grid;
  min-height: 130px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.secondary-details {
  margin-top: 16px;
}

.secondary-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 900;
}

.recent-transactions-details {
  margin-top: 0;
}

.recent-transactions-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

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

.recent-transactions-summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  margin-top: 8px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--accent-dark);
  transition: transform 0.16s ease;
}

.recent-transactions-details[open] > .recent-transactions-summary::before {
  transform: rotate(90deg);
}

.recent-transactions-summary h2 {
  display: inline;
  margin: 0;
  margin-right: auto;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(140px, 0.55fr) minmax(180px, 0.7fr) minmax(240px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}

.upload-hint {
  margin: 10px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--amber);
  font-size: 13px;
  font-weight: 900;
}

.file-field {
  min-width: 0;
}

.result-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  border: 1px solid #b7e0da;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 12px;
  font-weight: 800;
}

.result-box.error {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

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

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid #e7edf4;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: #344054;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

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

tbody tr:hover {
  background: #fbfcff;
}

#transactions-body tr:nth-child(odd) {
  background: #ffffff;
}

#transactions-body tr:nth-child(even) {
  background: #f6f9fc;
}

#transactions-body tr:hover {
  background: #eef6ff;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.side-label {
  font-weight: 900;
}

.side-buy {
  color: #dc2626;
}

.side-sell {
  color: #16a34a;
}

.delta {
  color: var(--amber);
  font-weight: 900;
}

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

.adjust-form {
  display: grid;
  grid-template-columns: 110px minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 330px;
}

.adjust-form input {
  min-height: 34px;
}

.manual-holding-form {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(140px, 0.65fr) minmax(130px, 0.7fr) minmax(160px, 1fr) minmax(110px, 0.65fr) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.transaction-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.editor-actions,
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor-actions {
  grid-column: 1 / -1;
}

.row-actions {
  white-space: nowrap;
}

.transaction-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.transaction-market-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.transaction-market-tabs button {
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.transaction-market-tabs button:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.editing-row td {
  vertical-align: top;
}

.inline-field {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 2px 0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(49, 86, 212, 0.08)),
    var(--bg);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
}

.login-panel h1 {
  margin-bottom: 20px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-message {
  margin-top: 14px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px;
  font-weight: 800;
}

.login-footnote {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .site-header,
  .top-band,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .site-header,
  .top-band {
    align-items: start;
  }

  .metrics,
  .upload-form,
  .manual-holding-form,
  .transaction-editor,
  .donut-layout,
  .portfolio-row {
    grid-template-columns: 1fr;
  }

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

  .activity-bars {
    overflow-x: auto;
  }

  .activity-plot {
    min-width: 0;
  }

  .activity-columns {
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .activity-column {
    min-width: 58px;
  }

  .activity-mobile-info {
    display: block;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 20px, 1320px);
  }

  .lot-row {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .lot-row span {
    white-space: normal;
  }

  .lot-row .lot-date {
    grid-column: 1 / -1;
    font-weight: 900;
  }

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

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .adjust-form {
    grid-template-columns: 1fr;
    min-width: 220px;
  }
}
