:root {
  --paper: #efe6d4;
  --paper-2: #f7f0e2;
  --ink: #1c1814;
  --muted: #6d6458;
  --rule: #cbbba0;
  --forest: #1f5a43;
  --forest-2: #163f30;
  --brick: #8d2e24;
  --brick-2: #6e211a;
  --gold: #a97828;
  --shadow: 0 18px 40px rgba(28, 24, 20, 0.08);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Figtree", "Helvetica Neue", sans-serif;
  --spine-width: 18px;
  --content-gutter: clamp(16px, 2vw, 36px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 20% -10%, #fff6e4, transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(28, 24, 20, 0.035) 32px
    ),
    var(--paper);
}

.spine {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--spine-width);
  background:
    linear-gradient(90deg, #4a1410, #8a2a22 40%, #5c1814);
  box-shadow: 4px 0 18px rgba(74, 20, 16, 0.18);
  z-index: 20;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 650;
  font-style: italic;
  letter-spacing: -0.03em;
  margin: 0;
}

.wordmark.small {
  font-size: 1.7rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 600;
}

.lede,
.muted,
.brand-sub {
  color: var(--muted);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px var(--content-gutter) 48px calc(var(--spine-width) + var(--content-gutter));
}

.auth-card,
.panel {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(440px, 100%);
  padding: 36px 32px;
}

.auth-card .wordmark {
  font-size: 3.4rem;
  line-height: 0.95;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 28px 0 20px;
  border-bottom: 1px solid var(--rule);
}

.tab,
.nav-link,
.btn.ghost {
  background: none;
  border: 0;
}

.tab {
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.is-active,
.nav-link.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  background: #fffdf8;
  border: 1px solid var(--rule);
  padding: 10px 12px;
  border-radius: 2px;
  font: inherit;
}

select {
  cursor: pointer;
}

input:focus,
select:focus {
  outline: 2px solid var(--forest);
  outline-offset: 1px;
}

.form-error {
  min-height: 1.2em;
  color: var(--brick);
  margin: 0;
  font-size: 0.9rem;
}

.btn {
  border: 1px solid var(--ink);
  padding: 10px 16px;
  background: transparent;
  border-radius: 2px;
}

.btn.primary {
  background: var(--forest);
  border-color: var(--forest-2);
  color: #f4efe4;
}

.btn.primary:hover {
  background: var(--forest-2);
}

.btn.danger,
.btn.subtle {
  background: transparent;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn.danger {
  border-color: var(--brick);
  color: var(--brick);
}

.btn.subtle {
  border-color: var(--rule);
  color: var(--muted);
}

.btn.subtle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

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

.app {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 22px var(--content-gutter) 64px calc(var(--spine-width) + var(--content-gutter));
}

main {
  width: 100%;
}

.view {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}

.brand-sub {
  display: block;
  font-size: 0.82rem;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.nav-link {
  padding: 0 0 10px;
  border-bottom: 2px solid transparent;
}

.nav a.nav-link {
  text-decoration: none;
  color: inherit;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
}

.profile-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.profile-link:hover {
  color: var(--forest);
}

.profile-panel + .profile-panel {
  margin-top: 18px;
}

#view-profile .profile-panel + .profile-panel {
  margin-top: 0;
}

.admin-table-panel + .admin-table-panel {
  margin-top: 18px;
}

.admin-actions {
  margin-top: 18px;
}

.admin-action-panel + .admin-action-panel {
  margin-top: 18px;
}

.admin-action-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-action-label {
  font-weight: 600;
}

.admin-action-form select {
  min-width: min(360px, 100%);
}

.admin-action-form input[type="date"] {
  min-width: 10.5rem;
}

.admin-slack-form textarea {
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 2px;
  flex: 1 1 280px;
  font: inherit;
  min-height: 2.75rem;
  min-width: min(480px, 100%);
  padding: 10px 12px;
  resize: vertical;
}

.admin-slack-form textarea:focus {
  outline: 2px solid var(--forest);
  outline-offset: 1px;
}

.admin-boi-sep {
  user-select: none;
}

.admin-action-status {
  margin: 10px 0 0;
  min-height: 1.25rem;
}

.admin-row-menu {
  position: relative;
}

.admin-row-menu-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 2px 8px;
}

.admin-row-menu-btn:hover {
  color: var(--forest);
}

.admin-row-menu-pop {
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: var(--shadow);
  display: none;
  min-width: 7rem;
  position: fixed;
  z-index: 200;
}

.admin-row-menu.is-open .admin-row-menu-pop {
  display: block;
}

.admin-table-wrap tbody tr.admin-row-menu-open {
  position: relative;
  z-index: 20;
}

.admin-table-wrap td.admin-actions-col {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  width: 3rem;
}

.admin-row-menu-pop button {
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 10px 14px;
  text-align: left;
  width: 100%;
}

.admin-row-menu-pop button:hover {
  background: var(--paper-2);
}

.admin-row-menu-pop button[data-admin-delete] {
  color: var(--brick);
}

.admin-modal {
  inset: 0;
  position: fixed;
  z-index: 100;
}

.admin-modal.hidden {
  display: none;
}

.admin-modal-backdrop {
  background: rgba(28, 24, 20, 0.35);
  inset: 0;
  position: absolute;
}

.admin-modal-panel {
  left: 50%;
  max-height: calc(100vh - 48px);
  max-width: min(560px, calc(100vw - 32px));
  overflow: auto;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  z-index: 1;
}

.admin-edit-form {
  display: grid;
  gap: 12px;
}

.admin-edit-field {
  display: grid;
  gap: 6px;
}

.admin-edit-field span {
  font-size: 0.86rem;
  font-weight: 600;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.admin-table-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.admin-table-toggle:hover .admin-table-title {
  color: var(--forest);
}

.admin-table-title {
  font-family: var(--serif);
  font-size: inherit;
  font-weight: 650;
}

.admin-table-chevron {
  color: var(--muted);
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
  width: 1rem;
}

.admin-table-chevron::before {
  content: "▾";
}

.admin-table-panel.is-collapsed .admin-table-chevron::before {
  content: "▸";
}

.admin-table-panel.is-collapsed .admin-table-body {
  display: none;
}

.admin-table-panel.is-collapsed .panel-head {
  margin-bottom: 0;
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.admin-table-wrap table {
  min-width: 560px;
}

.admin-table-wrap td {
  font-family: var(--mono);
  font-size: 0.82rem;
  max-width: min(420px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-pending {
  color: var(--warn, #b45309);
  font-weight: 600;
}

.admin-table-wrap td.admin-comment-col,
.admin-table-wrap td.admin-comment-col .admin-comment {
  font-family: var(--sans);
  white-space: normal;
  max-width: min(280px, 30vw);
  line-height: 1.35;
}

.profile-verification {
  margin: 0;
  font-size: 0.9rem;
}

.verification-badge {
  display: inline-block;
  font-size: 0.82rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.verification-badge.verified {
  background: #e8f5e9;
  color: #2e7d32;
}

.verification-badge.unverified {
  background: #fff3e0;
  color: #e65100;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h2,
.panel-head h3 {
  font-family: var(--serif);
  font-weight: 650;
  margin: 0;
}

.page-head h2 {
  font-size: 2.3rem;
}

.portfolio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 20px;
  margin-bottom: 16px;
  padding: 16px;
}

.totals {
  margin-bottom: 18px;
  width: 100%;
}

.totals-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.totals-table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.totals-table th,
.totals-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

.totals-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
  border-bottom: 1px solid var(--rule);
}

.totals-table thead th:first-child {
  text-align: left;
}

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

.totals-table tbody td {
  background: var(--paper-2);
  text-align: right;
}

.totals-table tbody td:first-child {
  text-align: left;
}

.totals-table tbody tr + tr td {
  border-top: 1px solid var(--rule);
}

.totals-table .currency-total__ccy {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.totals-col-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: right;
}

.totals-col-value {
  font-family: var(--mono);
  font-size: 1rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.totals-table .totals-col-value {
  display: block;
}

.currency-total--empty {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 11px 16px;
}

.panel {
  padding: 18px clamp(14px, 2vw, 22px) 8px;
  margin-bottom: 18px;
  width: 100%;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

th:has(.sort) {
  padding: 0;
}

.col-head {
  display: flex;
  align-items: stretch;
  min-height: 100%;
}

.col-head .sort {
  flex: 1 1 auto;
}

.col-filter {
  flex: 0 0 auto;
  width: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.col-filter:hover,
.col-filter.is-active {
  color: var(--ink);
  background: rgba(28, 24, 20, 0.06);
}

.col-filter.is-active {
  color: var(--gold);
}

th.num .col-head .sort {
  justify-content: flex-end;
}

.col-filter-popover {
  position: fixed;
  z-index: 40;
  min-width: 240px;
  max-width: 300px;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 28px rgba(28, 24, 20, 0.14);
  border-radius: 8px;
  padding: 10px;
}

.col-filter-popover-head {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.col-filter-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

.col-filter-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.col-filter-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px 0;
  margin-bottom: 10px;
}

.col-filter-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.88rem;
  cursor: pointer;
}

.col-filter-option:hover {
  background: rgba(28, 24, 20, 0.04);
}

.col-filter-option input {
  margin-top: 2px;
}

.col-filter-option span {
  flex: 1 1 auto;
  word-break: break-word;
}

.col-filter-empty {
  margin: 0;
  padding: 12px 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.col-filter-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: var(--forest-2);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkish:hover {
  color: var(--forest);
}

button.sort {
  width: 100%;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 10px 8px;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

th.num button.sort {
  justify-content: flex-end;
}

button.sort:hover {
  color: var(--ink);
  background: rgba(28, 24, 20, 0.04);
}

button.sort.is-active {
  color: var(--ink);
}

button.sort .arrow {
  font-size: 0.62rem;
  color: var(--gold);
}

.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--forest);
}

.neg {
  color: var(--brick);
}

.pill {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
}

.pill.buy {
  background: rgba(31, 90, 67, 0.12);
  color: var(--forest-2);
}

.pill.sell {
  background: rgba(141, 46, 36, 0.12);
  color: var(--brick);
}

.empty {
  padding: 28px 8px 24px;
  color: var(--muted);
}

.dot {
  color: var(--rule);
  padding: 0 2px;
}

/* Notes get a little more room than a normal column, but never stretch the table. */
.details {
  max-width: clamp(140px, 18vw, 320px);
}

td.details span {
  display: block;
  max-width: clamp(140px, 18vw, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.trade-page {
  display: grid;
  gap: 0;
  width: 100%;
  max-width: none;
}

.trade-form {
  display: grid;
  gap: 0;
  padding: 0;
  margin-bottom: 0;
}

.trade-import {
  margin-bottom: 0;
  padding-bottom: 20px;
}

.trade-import-lede {
  margin: 0 0 16px;
  line-height: 1.5;
}

.trade-import-lede code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(28, 24, 20, 0.06);
  padding: 1px 5px;
  border-radius: 2px;
}

.trade-import-body {
  display: grid;
  gap: 14px;
}

.trade-or {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.trade-or::before,
.trade-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.trade-section {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
  border-top: 1px solid var(--rule);
}

.trade-section:first-child {
  border-top: 0;
  padding-top: 24px;
}

.holding-summary .holding-option {
  margin: 0 0 12px;
  padding: 0 4px;
}

.trade-section-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.trade-form .form-error {
  padding: 0 24px;
}

.trade-form .form-actions {
  padding: 8px 24px 24px;
  border-top: 1px solid var(--rule);
}

.file-upload {
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  position: relative;
  cursor: pointer;
}

.file-upload-label {
  color: var(--ink);
}

.file-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-upload-name {
  display: block;
  padding: 10px 12px;
  background: #fffdf8;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
}

.file-upload:has(input:focus) .file-upload-name,
.file-upload-name:hover {
  border-color: var(--forest);
  color: var(--ink);
}

.import-errors {
  margin: 0 0 12px;
  padding-left: 1.2rem;
  color: var(--danger, #b42318);
}

.holding-row {
  cursor: pointer;
}

.holding-row:hover td {
  background: rgba(0, 0, 0, 0.03);
}

.holding-summary {
  margin-bottom: 18px;
}

#view-profile {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

#view-profile > .page-head {
  grid-column: 1 / -1;
}

.profile-panel {
  margin-bottom: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 16px clamp(16px, 3vw, 32px);
}

.detail-stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-stat__value {
  font-family: var(--mono);
  font-size: 1.05rem;
  margin-top: 4px;
}

.price-chart {
  margin-bottom: 18px;
}

.price-chart__svg {
  width: 100%;
  height: auto;
  display: block;
}

.price-chart__line {
  fill: none;
  stroke: var(--forest);
  stroke-width: 2;
}

.performance-toolbar {
  margin-bottom: 16px;
  padding: 16px;
}

.performance-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  align-items: flex-end;
}

.performance-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.performance-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.period-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-pill {
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  padding: 6px 12px;
  cursor: pointer;
}

.period-pill.is-active {
  border-color: var(--forest);
  background: rgba(31, 90, 67, 0.1);
  color: var(--forest-2);
  font-weight: 600;
}

.performance-select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  background: #fff;
  min-width: 180px;
}

.performance-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.performance-stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 108px;
  padding: 18px 20px;
  background: linear-gradient(145deg, #fffaf0 0%, var(--paper-2) 100%);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.performance-stat-card--pos {
  border-color: rgba(31, 90, 67, 0.22);
  background: linear-gradient(145deg, #f4fbf7 0%, #eef8f2 100%);
}

.performance-stat-card--neg {
  border-color: rgba(141, 46, 36, 0.22);
  background: linear-gradient(145deg, #fff7f5 0%, #fceeea 100%);
}

.performance-stat-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.performance-stat-card__value {
  font-family: var(--mono);
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.price-chart__dot {
  fill: var(--forest, #1f4d3a);
}

.price-chart__axis {
  stroke: var(--rule);
  stroke-width: 1;
}

.price-chart__tick {
  fill: var(--muted);
  font-size: 11px;
}

.price-chart__avg {
  stroke: #b07a00;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.price-chart__avg-label {
  fill: #b07a00;
  font-size: 10px;
}

.import-errors li + li {
  margin-top: 4px;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.action-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action {
  border: 1px solid var(--rule);
  padding: 14px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.25rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.action:hover:not(.is-on) {
  background: rgba(28, 24, 20, 0.04);
}

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

.action.buy.is-on {
  background: var(--forest);
  border-color: var(--forest-2);
  color: #f4efe4;
}

.action.sell.is-on {
  background: var(--brick);
  border-color: var(--brick-2);
  color: #f4efe4;
}

.instrument {
  border: 1px solid var(--rule);
  padding: 12px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.1rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.instrument:hover:not(.is-on) {
  background: rgba(28, 24, 20, 0.04);
}

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

.instrument.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #f4efe4;
}

.typeahead {
  position: relative;
}

.suggest {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fffdf8;
  border: 1px solid var(--ink);
  max-height: 260px;
  overflow: auto;
}

.suggest li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.suggest li:hover,
.suggest li.is-active {
  background: #efe4cc;
}

.suggest .code {
  font-family: var(--mono);
  font-weight: 500;
}

.suggest .name {
  color: var(--muted);
  font-size: 0.88rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-foot {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.92rem;
}

.auth-divider {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn.google {
  display: block;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--rule);
  background: #fff;
}

.email-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff8e6;
  border-bottom: 1px solid #ecdca0;
  font-size: 0.92rem;
}

.auth-foot a,
.rates-home {
  color: var(--forest);
  text-decoration: none;
}

.auth-foot a:hover,
.rates-home:hover {
  text-decoration: underline;
}

.rates-page .nav-link {
  text-decoration: none;
  color: inherit;
  padding: 0 0 10px;
  border-bottom: 2px solid transparent;
}

.rates-page .nav-link.is-active {
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.rates-note {
  margin: 0 0 20px;
}

.rates-note a {
  color: var(--forest);
}

.month-picker {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

.month-picker input[type="month"] {
  min-width: 11rem;
}

.rates-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.rates-chart {
  margin-bottom: 12px;
  padding-top: 4px;
}

.rates-panel .table-wrap {
  margin-top: 4px;
}

.rates-panel h3 .muted {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
}

.price-flag {
  color: var(--gold);
  cursor: help;
  margin-left: 2px;
  font-weight: 700;
}

.ticker {
  font-family: var(--mono);
  font-weight: 500;
}

.company {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (min-width: 1200px) {
  .trade-page {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .trade-page .trade-import {
    margin-bottom: 0;
  }

  .trade-page .trade-or {
    display: none;
  }

  .trade-page .trade-form {
    margin-bottom: 0;
  }

  #holding-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  #holding-detail > .price-chart,
  #holding-detail > .holding-summary {
    margin-bottom: 0;
  }

  #holding-detail > .panel:not(.price-chart):not(.holding-summary) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1400px) {
  .totals-table th:nth-child(2),
  .totals-table td:nth-child(2),
  .totals-table th:nth-child(3),
  .totals-table td:nth-child(3),
  .totals-table th:nth-child(4),
  .totals-table td:nth-child(4),
  .totals-table th:nth-child(5),
  .totals-table td:nth-child(5),
  .totals-table th:nth-child(6),
  .totals-table td:nth-child(6) {
    width: 14%;
  }

  .totals-table th:first-child,
  .totals-table td:first-child {
    width: 16%;
  }
}

@media (max-width: 1024px) {
  #view-profile {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    margin-bottom: 18px;
  }

  .profile-panel:last-child {
    margin-bottom: 0;
  }
}

@media (max-width: 820px) {
  :root {
    --spine-width: 12px;
  }

  .topbar {
    align-items: stretch;
  }

  .brand {
    flex: 1 1 100%;
  }

  .nav {
    order: 3;
    flex: 1 1 100%;
  }

  .account {
    order: 2;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head .btn {
    width: 100%;
    text-align: center;
  }

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

  .form-actions {
    flex-wrap: wrap;
  }

  .email-banner {
    flex-wrap: wrap;
    text-align: center;
    justify-content: center;
  }

  .totals-table {
    min-width: 36rem;
  }

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

  table {
    min-width: 560px;
    font-size: 0.88rem;
  }

  th,
  td {
    padding: 8px 6px;
  }
}

@media (max-width: 560px) {
  :root {
    --spine-width: 8px;
    --content-gutter: 12px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .auth-card .wordmark {
    font-size: 2.6rem;
  }

  .page-head h2 {
    font-size: 1.85rem;
  }

  .nav-link {
    font-size: 0.88rem;
    padding-bottom: 8px;
  }

  .action-toggle {
    grid-template-columns: 1fr;
  }

  .trade-section {
    padding: 16px 14px;
  }

  .trade-form .form-actions,
  .trade-form .form-error {
    padding-left: 14px;
    padding-right: 14px;
  }

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

  .performance-summary {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .totals-table {
    min-width: 30rem;
  }

  table {
    min-width: 480px;
  }
}

@media (max-width: 400px) {
  .tabs {
    grid-template-columns: 1fr;
  }

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