:root {
  --bg: #f4efe7;
  --surface: rgba(255, 252, 246, 0.9);
  --surface-strong: #fffaf2;
  --surface-dark: #1f1a17;
  --text: #1f1a17;
  --muted: #6b5e54;
  --line: rgba(67, 52, 40, 0.14);
  --buy: #1e7a57;
  --buy-soft: rgba(30, 122, 87, 0.12);
  --sell: #b44b33;
  --sell-soft: rgba(180, 75, 51, 0.12);
  --nav-soft: rgba(255, 255, 255, 0.08);
  --page-radial: rgba(212, 151, 75, 0.24);
  --page-gradient-start: #f7f1e8;
  --page-gradient-end: #efe4d2;
  --sidebar-radial: rgba(212, 151, 75, 0.12);
  --sidebar-gradient-start: #201913;
  --sidebar-gradient-end: #2d221b;
  --sidebar-text: #fff8ef;
  --sidebar-muted: rgba(255, 248, 239, 0.62);
  --settings-surface: rgba(39, 31, 24, 0.98);
  --settings-border: rgba(255, 255, 255, 0.12);
  --table-bg: rgba(255, 250, 242, 0.84);
  --table-head: rgba(46, 32, 21, 0.06);
  --table-hover: rgba(255, 255, 255, 0.46);
  --dropdown-bg: rgba(255, 250, 242, 0.98);
  --dropdown-hover: rgba(46, 32, 21, 0.08);
  --shadow: 0 24px 48px rgba(62, 44, 30, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sidebar-open: 280px;
  --sidebar-closed: 84px;
}

:root[data-theme="forest"] {
  --bg: #eef3ec;
  --surface: rgba(244, 250, 244, 0.92);
  --surface-strong: #fbfef8;
  --text: #1b261c;
  --muted: #5d6f60;
  --line: rgba(52, 77, 56, 0.14);
  --buy: #2f7d4c;
  --sell: #b4583c;
  --page-radial: rgba(63, 132, 82, 0.18);
  --page-gradient-start: #eef5eb;
  --page-gradient-end: #dfe9dd;
  --sidebar-radial: rgba(88, 144, 96, 0.18);
  --sidebar-gradient-start: #162119;
  --sidebar-gradient-end: #243628;
  --sidebar-text: #f4fbf1;
  --sidebar-muted: rgba(244, 251, 241, 0.65);
  --settings-surface: rgba(27, 39, 30, 0.98);
  --table-bg: rgba(242, 248, 240, 0.88);
  --table-head: rgba(40, 66, 45, 0.08);
  --table-hover: rgba(255, 255, 255, 0.56);
  --dropdown-bg: rgba(246, 252, 245, 0.98);
  --dropdown-hover: rgba(40, 66, 45, 0.08);
}

:root[data-theme="ocean"] {
  --bg: #eaf2f5;
  --surface: rgba(245, 251, 253, 0.92);
  --surface-strong: #fbfeff;
  --text: #17252f;
  --muted: #58707c;
  --line: rgba(34, 87, 113, 0.14);
  --buy: #0d7c86;
  --sell: #d06744;
  --page-radial: rgba(54, 132, 160, 0.18);
  --page-gradient-start: #edf6f9;
  --page-gradient-end: #dceaf1;
  --sidebar-radial: rgba(73, 146, 175, 0.18);
  --sidebar-gradient-start: #12212a;
  --sidebar-gradient-end: #1d3441;
  --sidebar-text: #f2fbff;
  --sidebar-muted: rgba(242, 251, 255, 0.65);
  --settings-surface: rgba(20, 35, 43, 0.98);
  --table-bg: rgba(241, 249, 252, 0.88);
  --table-head: rgba(25, 66, 86, 0.08);
  --table-hover: rgba(255, 255, 255, 0.58);
  --dropdown-bg: rgba(243, 251, 254, 0.98);
  --dropdown-hover: rgba(25, 66, 86, 0.08);
}

:root[data-theme="graphite"] {
  --bg: #ebebea;
  --surface: rgba(250, 250, 248, 0.92);
  --surface-strong: #ffffff;
  --text: #242526;
  --muted: #66686b;
  --line: rgba(55, 57, 61, 0.14);
  --buy: #2d8a68;
  --sell: #c45b41;
  --page-radial: rgba(110, 114, 122, 0.14);
  --page-gradient-start: #f2f2f1;
  --page-gradient-end: #dfdfde;
  --sidebar-radial: rgba(133, 137, 146, 0.14);
  --sidebar-gradient-start: #1d1e21;
  --sidebar-gradient-end: #2b2d31;
  --sidebar-text: #f6f7f8;
  --sidebar-muted: rgba(246, 247, 248, 0.62);
  --settings-surface: rgba(34, 35, 38, 0.98);
  --table-bg: rgba(245, 245, 244, 0.9);
  --table-head: rgba(52, 54, 58, 0.08);
  --table-hover: rgba(255, 255, 255, 0.6);
  --dropdown-bg: rgba(248, 248, 247, 0.98);
  --dropdown-hover: rgba(52, 54, 58, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html[data-booting="true"] body {
  visibility: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--page-radial), transparent 30%),
    linear-gradient(180deg, var(--page-gradient-start) 0%, var(--page-gradient-end) 100%);
}

body.mobile-menu-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

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

.auth-card {
  width: min(520px, 100%);
  height: 620px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.auth-copy {
  display: grid;
  gap: 8px;
}

.auth-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.auth-text {
  margin: 0;
  color: var(--muted);
}

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

.auth-tab,
.auth-submit {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.auth-tab {
  min-height: 48px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.auth-tab.active {
  background: var(--surface-dark);
  color: #fff;
  border-color: transparent;
}

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

.auth-form-stage {
  min-height: 292px;
  display: grid;
  align-content: start;
}

.auth-submit {
  background: var(--surface-dark);
  color: #fff;
}

.auth-message {
  min-height: 20px;
  margin: 0;
}

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

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-closed) 1fr;
}

.app-shell.sidebar-open {
  grid-template-columns: var(--sidebar-closed) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-closed);
  background:
    radial-gradient(circle at top, var(--sidebar-radial), transparent 28%),
    linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
  color: var(--sidebar-text);
  padding: 0 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  z-index: 40;
  transition: width 0.22s ease, box-shadow 0.22s ease;
}

.sidebar:hover {
  width: var(--sidebar-open);
  box-shadow: 24px 0 48px rgba(24, 20, 16, 0.18);
}

.sidebar-nav {
  display: grid;
  gap: 0;
  margin-inline: -18px;
}

.sidebar-footer {
  margin-top: auto;
  margin-inline: -18px;
  padding-top: 18px;
}

.settings-link {
  margin-bottom: 0;
}

.settings-eyebrow {
  color: var(--muted);
  margin: 0;
}

.settings-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 0.92rem;
}

.theme-select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  padding: 16px 25px;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.nav-text {
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.18s ease, max-width 0.18s ease;
  max-width: 160px;
}

.nav-link:hover::before,
.nav-link.active::before {
  opacity: 1;
}

.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.nav-link > * {
  position: relative;
  z-index: 1;
}

.nav-icon {
  min-width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell.sidebar-collapsed .nav-text {
  max-width: 0;
  opacity: 0;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-text {
  max-width: 160px;
  opacity: 1;
}

.mobile-page-switcher,
.mobile-brand-title,
.mobile-sidebar-backdrop {
  display: none;
}

.mobile-page-switcher {
  position: absolute;
  top: 24px;
  left: 20px;
  min-width: 164px;
  height: 48px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  z-index: 90;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.mobile-page-switcher svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

body.mobile-menu-open .mobile-page-switcher svg {
  transform: rotate(180deg);
}

body.mobile-menu-open .mobile-page-switcher {
  color: var(--sidebar-text);
  background: transparent;
  box-shadow: none;
}

.mobile-brand-title {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 85;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
}

.mobile-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 69;
  border: 0;
  background: rgba(20, 17, 14, 0.46);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 14, 0.52);
  backdrop-filter: blur(4px);
}

.settings-modal-card {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100% - 32px));
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 30px 70px rgba(20, 17, 14, 0.28);
  display: grid;
  gap: 16px;
}

.modal-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.page-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
  min-width: 0;
}

.view-section {
  display: none;
  min-width: 0;
}

.view-section.active {
  display: block;
}

.panel h2,
.metric-card strong,
.welcome-name,
.market-name {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
}

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

.home-hero {
  display: grid;
  gap: 6px;
  max-width: 560px;
}

.home-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.05em;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 0.96;
  white-space: nowrap;
}

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

.welcome-card {
  min-width: 210px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: grid;
  gap: 4px;
  text-align: right;
}

.welcome-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.welcome-name {
  font-size: 1.15rem;
  line-height: 1.1;
}

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

.panel,
.metric-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 24px;
  margin-bottom: 24px;
  min-width: 0;
}

.helper-text,
.form-message,
.metric-label {
  color: var(--muted);
}

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

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

.metric-card {
  padding: 20px 22px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.metric-card.wide strong {
  font-size: 1.6rem;
}

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

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

.panel-heading.compact {
  margin-bottom: 14px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.report-filter {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.report-date-control {
  display: grid;
  min-width: 0;
}

.report-date-control .theme-select,
.report-date-control [data-report-date-input] {
  display: block;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.report-date-control input[type="date"],
.report-date-control input[type="month"] {
  padding-right: 12px;
  appearance: none;
  -webkit-appearance: none;
}

.report-date-control input[type="date"]::-webkit-calendar-picker-indicator,
.report-date-control input[type="month"]::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
  opacity: 0.8;
}

.report-grid-analytics {
  margin-bottom: 20px;
}

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

.report-insights-grid.single {
  grid-template-columns: 1fr;
  margin-bottom: 18px;
}

.report-chart-card,
.report-notes-card {
  margin-bottom: 0;
}

.report-bar-chart {
  min-height: 250px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0 4px;
}

.report-bar-axis {
  height: 220px;
  position: relative;
  color: var(--muted);
  font-size: 0.78rem;
}

.report-bar-axis-line {
  position: absolute;
  right: 0;
  width: 16px;
  border-top: 1px solid rgba(107, 94, 84, 0.24);
}

.report-bar-axis-line.top {
  top: 0;
}

.report-bar-axis-line.middle {
  top: 50%;
}

.report-bar-axis-line.bottom {
  bottom: 0;
}

.report-bar-axis-label {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
}

.report-bar-axis-label.top {
  top: 0;
  transform: none;
}

.report-bar-axis-label.middle {
  top: 50%;
}

.report-bar-axis-label.bottom {
  bottom: 0;
  transform: none;
}

.report-bar-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.report-bar-chart-inner {
  min-width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.report-bar-item {
  flex: 0 0 var(--report-bar-width, 54px);
  display: grid;
  gap: 10px;
  justify-items: center;
}

.report-bar-track {
  width: 100%;
  height: 220px;
  position: relative;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.28);
  padding: 12px 10px;
}

.report-bar-track::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 1px;
  background: rgba(107, 94, 84, 0.24);
}

.report-bar-track:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(31, 26, 23, 0.92);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  z-index: 2;
}

.report-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  width: 100%;
  width: calc(100% - 20px);
  min-height: 8px;
}

.report-bar.positive {
  bottom: 50%;
  border-radius: 8px;
}

.report-bar.negative {
  top: 50%;
  border-radius: 8px;
}

.report-bar.positive {
  background: linear-gradient(180deg, rgba(30, 122, 87, 0.72), rgba(30, 122, 87, 1));
}

.report-bar.negative {
  background: linear-gradient(180deg, rgba(180, 75, 51, 0.68), rgba(180, 75, 51, 1));
}

.report-bar-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.report-symbol-list {
  display: grid;
  gap: 12px;
}

.report-symbol-row {
  display: grid;
  grid-template-columns: minmax(0, 180px) 1fr auto auto;
  gap: 12px;
  align-items: center;
}

.report-symbol-meta {
  min-width: 0;
}

.report-symbol-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.report-symbol-fill {
  height: 100%;
  border-radius: inherit;
}

.report-symbol-fill.positive {
  background: linear-gradient(90deg, rgba(30, 122, 87, 0.55), rgba(30, 122, 87, 1));
}

.report-symbol-fill.negative {
  background: linear-gradient(90deg, rgba(180, 75, 51, 0.55), rgba(180, 75, 51, 1));
}

.report-symbol-value,
.report-symbol-percent {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 700;
}

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

.report-insight-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.22);
}

.report-insight-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

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

.market-toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.range-field {
  display: grid;
  gap: 8px;
  min-width: 210px;
  color: var(--muted);
  font-size: 0.92rem;
}

.market-search-field {
  min-width: 280px;
}

.market-search-input {
  width: 100%;
}

.market-table {
  min-width: 920px;
}

.market-name-cell {
  min-width: 240px;
}

.market-filter-header {
  position: relative;
}

.market-header-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sort-button,
.filter-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.sort-button {
  opacity: 0.6;
  transition: opacity 0.18s ease;
}

.sort-button:hover,
.sort-button.active {
  opacity: 1;
}

.sort-arrows {
  display: inline-block;
  min-width: 18px;
  letter-spacing: -0.08em;
}

.filter-button {
  font-weight: 600;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  min-width: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.filter-option input {
  accent-color: var(--buy);
}

.market-name {
  display: block;
  font-size: 1.05rem;
  line-height: 1.1;
}

.market-symbol {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sparkline {
  width: 150px;
  height: 46px;
  display: block;
}

.sparkline polyline {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.price-cell,
.change-cell {
  font-variant-numeric: tabular-nums;
}

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

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

.change-flat {
  color: var(--muted);
}

.favorite-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.32);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.favorite-button.active {
  color: #d7a11d;
  background: rgba(215, 161, 29, 0.14);
  border-color: rgba(215, 161, 29, 0.26);
}

@keyframes loadingPulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.32);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}

.embedded-panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.22);
  min-width: 0;
}

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

.embedded-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
  font-size: 1.1rem;
}

.badge {
  background: rgba(34, 26, 21, 0.07);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.table-pagination .ghost-button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.form-panel {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.trade-form {
  display: grid;
  grid-template-columns: 2.2fr repeat(3, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: start;
}

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

.field-group label {
  font-weight: 600;
}

.field-group input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.field-group input:focus {
  border-color: rgba(34, 26, 21, 0.36);
  transform: translateY(-1px);
}

.symbol-group {
  position: relative;
  padding-bottom: 24px;
}

.helper-text {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  position: absolute;
  left: 0;
  top: calc(100% - 18px);
}

.combobox {
  position: relative;
}

.combo-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.options-list {
  position: absolute;
  z-index: 999;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--dropdown-bg);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
  display: none;
}

.options-list.open {
  display: block;
}

.option-item {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.option-item:hover {
  background: var(--dropdown-hover);
}

.option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}

.option-bottom {
  font-size: 0.9rem;
  color: var(--muted);
}

.action-group {
  display: flex;
  gap: 12px;
  align-self: start;
  padding-top: 34px;
}

.action-button {
  border: 0;
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  min-width: 96px;
  transition: transform 0.2s ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.buy-button {
  background: var(--buy);
  color: #fff;
}

.sell-button {
  background: var(--sell);
  color: #fff;
}

.form-message {
  min-height: 24px;
  margin: 14px 0 0;
}

.form-message.success {
  color: var(--buy);
}

.form-message.error {
  color: var(--sell);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
  background: var(--table-bg);
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  background: var(--table-head);
  font-size: 0.9rem;
}

tbody tr:hover {
  background: var(--table-hover);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(46, 32, 21, 0.08);
}

.chip.buy {
  background: var(--buy-soft);
  color: var(--buy);
}

.chip.sell {
  background: var(--sell-soft);
  color: var(--sell);
}

.delete-button {
  border: 1px solid rgba(180, 75, 51, 0.2);
  background: rgba(180, 75, 51, 0.1);
  color: var(--sell);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.delete-button:hover {
  background: rgba(180, 75, 51, 0.16);
}

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

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 24px);
    padding: 72px 18px 24px;
    border-radius: 0 0 24px 24px;
    transform: translateY(calc(-100% - 24px));
    box-shadow: none;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
  }

  .sidebar:hover {
    width: 100%;
    box-shadow: none;
  }

  .app-shell.sidebar-collapsed .nav-text {
    max-width: 160px;
    opacity: 1;
  }

  .mobile-page-switcher,
  .mobile-brand-title,
  .mobile-sidebar-backdrop {
    display: flex;
  }

  body.mobile-menu-open .mobile-brand-title {
    color: var(--sidebar-text);
  }

  .app-shell.mobile-sidebar-open .sidebar {
    transform: translateY(0);
    box-shadow: 0 24px 48px rgba(24, 20, 16, 0.24);
    z-index: 80;
  }

  .app-shell.mobile-sidebar-open .mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .page-shell {
    padding-top: 20px;
  }

  .view-section:not([data-view="home"]) {
    padding-top: 60px;
  }
}

@media (max-width: 1024px) {
  .metrics-grid,
  .trade-form {
    grid-template-columns: 1fr;
  }

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

  .report-filters,
  .report-insights-grid,
  .report-insight-cards {
    grid-template-columns: 1fr;
  }

  .report-filter,
  .report-date-control {
    width: 100%;
  }

  .report-filter .theme-select,
  .report-date-control .theme-select,
  .report-date-control [data-report-date-input] {
    width: 100%;
    max-width: 100%;
  }

  .home-topbar-actions,
  .market-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .market-toolbar-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .home-topbar {
    align-items: flex-start;
    flex-direction: row;
    justify-content: flex-end;
  }

  .home-topbar-actions {
    width: auto;
  }

  .welcome-card {
    width: auto;
    text-align: right;
  }

  .action-group {
    padding-top: 0;
  }

  .action-button {
    flex: 1;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .mobile-page-switcher {
    top: 26px;
  }

  .mobile-brand-title {
    font-size: 0.94rem;
    top: 38px;
  }

  .home-topbar {
    margin-top: 0;
    margin-bottom: 18px;
    min-height: 48px;
    padding-top: 16px;
  }

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

  .panel-actions {
    width: 100%;
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
  }

  .panel-actions .ghost-button {
    width: auto;
    max-width: 100%;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .panel-actions .badge {
    width: auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    text-align: right;
    font-size: 0.78rem;
  }

  .panel h2,
  .embedded-title {
    font-size: 1rem;
  }

  .eyebrow {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
  }

  .theme-select,
  .field-group input,
  .auth-tab,
  .auth-submit {
    font-size: 0.94rem;
  }

  .report-grid {
    gap: 12px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-label {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .metric-card strong,
  .metric-card.wide strong {
    margin-top: 8px;
    font-size: 1.18rem;
    line-height: 1.15;
  }

  .home-hero {
    display: none;
  }

  .view-section[data-view="fifo-transactions"] .panel-heading h2 {
    white-space: nowrap;
    font-size: 0.96rem;
  }

  table {
    font-size: 0.84rem;
  }

  .table-pagination {
    justify-content: space-between;
    gap: 8px;
  }

  .table-pagination .ghost-button {
    padding: 8px 10px;
  }

  th,
  td {
    padding: 12px 10px;
  }

  .market-name {
    font-size: 0.96rem;
  }

  .market-symbol,
  .helper-text,
  .form-message,
  .badge {
    font-size: 0.82rem;
  }

  .home-topbar-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 16px;
  }

  .view-section:not([data-view="home"]) {
    padding-top: 68px;
  }

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

  .panel {
    padding: 18px;
  }

  .report-symbol-row {
    grid-template-columns: 1fr;
  }
}
