:root {
  --bg: #0f131a;
  --surface: #171c24;
  --surface-strong: #1f2631;
  --surface-soft: #212b38;
  --accent: #59d2b5;
  --accent-2: #f2c94c;
  --text: #e9eef4;
  --muted: #9aa7b5;
  --danger: #ff6b6b;
  --shadow: rgba(10, 12, 18, 0.6);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0);
  background-size: 36px 36px, 120px 120px;
  background-position: 0 0, 10px 20px;
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 60px 12px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  background: linear-gradient(135deg, #4bd2b0, #4b7bd2);
  color: #0a0f14;
  font-weight: 700;
  border-radius: 16px;
  padding: 12px 14px;
  letter-spacing: 1px;
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.topbar-meta {
  text-align: right;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.nav-link {
  text-decoration: none;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(89, 210, 181, 0.18);
}

.meta-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meta-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--accent);
}

.layout {
  position: relative;
  z-index: 1;
  padding: 24px 60px 40px;
}

.hero {
  margin-bottom: 28px;
}

.hero-card {
  background: linear-gradient(135deg, rgba(41, 52, 69, 0.9), rgba(25, 31, 40, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  padding: 32px 36px;
  box-shadow: 0 24px 48px var(--shadow);
}

.hero-title {
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.metric {
  background: var(--surface-strong);
  border-radius: 16px;
  padding: 18px 20px;
}

.metric-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 26px;
  font-weight: 600;
}

.metric-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.hero-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.grid.single {
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 30px rgba(8, 10, 14, 0.4);
}

.card.wide {
  grid-column: span 2;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(89, 210, 181, 0.15);
  color: var(--accent);
}

.bar-chart {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  height: 160px;
}

.yearly-bar-chart {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  min-height: 200px;
  padding-top: 30px;
}

.year-bar-item {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
  min-height: 170px;
}

.cumulative-bar {
  min-height: 8px;
}

.cumulative-bar span {
  font-size: 11px;
  color: var(--text);
}

.year-bar-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.monthly-stack {
  display: grid;
  gap: 20px;
}

.monthly-row {
  display: grid;
  gap: 10px;
}

.monthly-row-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.bar {
  background: linear-gradient(180deg, rgba(89, 210, 181, 0.9), rgba(89, 210, 181, 0.2));
  border-radius: 8px;
  position: relative;
}

.bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.ticker-list,
.dividend-list {
  display: grid;
  gap: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table .right {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 16px 8px;
}

.form,
.form-inline {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  font-size: 12px;
  color: var(--muted);
}

.form-row input,
.form-row select {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.text-area {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  resize: vertical;
  min-height: 140px;
}

.form-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 18px 0;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.form-inline {
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  margin-top: 16px;
}

.forecast-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 4px;
}

.summary-pill {
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.summary-pill strong {
  color: var(--text);
  font-weight: 600;
  margin-left: 6px;
}

.parse-status {
  font-size: 12px;
  color: var(--muted);
}

.btn {
  background: var(--accent);
  color: #0a0f14;
  border: none;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn.secondary {
  background: rgba(89, 210, 181, 0.16);
  color: var(--accent);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(23, 28, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(89, 210, 181, 0.6);
  color: var(--accent);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.6);
  color: #ff9b9b;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.show {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.7);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  background: var(--surface);
  border-radius: 20px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 48px var(--shadow);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.preview-item {
  background: var(--surface-strong);
  border-radius: 12px;
  padding: 10px 12px;
}

.preview-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.preview-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.pl-positive {
  color: #ff6b6b;
}

.pl-negative {
  color: #4b7bd2;
}

@media (max-width: 820px) {
  .form-inline {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }
}

.ticker-item,
.dividend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border-radius: 12px;
}

.ticker-meta,
.dividend-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 220px;
}

.ticker-name,
.dividend-title {
  font-weight: 600;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.ticker-sub,
.dividend-sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ticker-value,
.dividend-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  flex-shrink: 0;
  text-align: right;
}

.line-chart {
  height: 200px;
  position: relative;
  background: var(--surface-soft);
  border-radius: 16px;
  overflow: hidden;
}

.line-path {
  position: absolute;
  inset: 0;
}

.line-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-text {
  color: var(--muted);
  font-size: 13px;
}

.footer {
  padding: 20px 60px 30px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  .topbar,
  .layout,
  .footer {
    padding-left: 24px;
    padding-right: 24px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card.wide {
    grid-column: span 1;
  }

  .hero-card {
    padding: 26px 24px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-top: 22px;
  }

  .brand {
    gap: 12px;
  }

  .brand-mark {
    border-radius: 12px;
    padding: 9px 11px;
    font-size: 13px;
  }

  .topbar-meta {
    text-align: left;
    display: grid;
    gap: 8px;
  }

  .nav {
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 0;
  }

  .nav-link {
    font-size: 11px;
    padding: 7px 10px;
  }

  .meta-label {
    font-size: 11px;
  }

  .meta-value {
    font-size: 12px;
  }

  .card {
    border-radius: 16px;
    padding: 16px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .chip {
    padding: 6px 9px;
    font-size: 11px;
  }

  .hero-card {
    padding: 20px 18px;
  }

  .hero-title {
    font-size: 15px;
  }

  .hero-metrics {
    gap: 12px;
    margin-top: 16px;
  }

  .metric {
    border-radius: 12px;
    padding: 14px;
  }

  .metric-value {
    font-size: 22px;
  }

  .form,
  .form-grid,
  .form-inline {
    gap: 10px;
  }

  .form-row input,
  .form-row select {
    min-height: 40px;
    font-size: 14px;
  }

  .text-area {
    min-height: 120px;
    font-size: 14px;
  }

  .forecast-summary {
    gap: 8px;
  }

  .summary-pill {
    width: 100%;
    border-radius: 12px;
    padding: 8px 10px;
    line-height: 1.4;
  }

  .bar-chart {
    gap: 4px;
    height: 140px;
  }

  .bar span {
    font-size: 9px;
    transform: translate(-50%, -4px);
  }

  .yearly-bar-chart {
    grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
    gap: 8px;
    min-height: 180px;
  }

  .year-bar-item {
    min-height: 150px;
  }

  .monthly-row-title {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .data-table {
    min-width: 620px;
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 9px 7px;
  }

  .ticker-item,
  .dividend-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .ticker-meta,
  .dividend-meta {
    flex: 1 1 160px;
  }

  .ticker-name,
  .dividend-title {
    font-size: 13px;
    line-height: 1.35;
  }

  .ticker-sub,
  .dividend-sub {
    font-size: 11px;
    line-height: 1.35;
    word-break: break-word;
  }

  .ticker-value,
  .dividend-value {
    font-size: 12px;
    margin-left: auto;
    max-width: 100%;
    white-space: nowrap;
  }

  .line-chart {
    height: 180px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .modal-card {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .footer {
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    padding-top: 16px;
  }
}

@media (max-width: 480px) {
  .topbar,
  .layout,
  .footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-link {
    text-align: center;
    padding: 8px 6px;
    font-size: 10px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  .hero-note {
    font-size: 12px;
    margin-top: 14px;
  }

  .card {
    padding: 14px;
  }

  .btn {
    width: 100%;
  }

  .header-actions .btn {
    width: auto;
    flex: 1 1 140px;
  }

  .form-row label {
    font-size: 11px;
  }

  .data-table {
    min-width: 560px;
    font-size: 11px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }

  .ticker-item,
  .dividend-item {
    padding: 9px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .ticker-meta,
  .dividend-meta {
    width: 100%;
    flex: 1 1 auto;
  }

  .ticker-value,
  .dividend-value {
    width: 100%;
    margin-left: 0;
    text-align: right;
    white-space: normal;
  }
}

/* Dividends page redesign (Stitch-inspired, scoped) */
body.stitch-theme {
  --dv-bg: #131f1c;
  --dv-surface: #1b2824;
  --dv-surface-accent: #23332f;
  --dv-border: rgba(91, 210, 182, 0.18);
  --dv-border-soft: rgba(91, 210, 182, 0.1);
  --dv-text: #ebf4f1;
  --dv-muted: #9db1aa;
  --dv-accent: #5bd2b6;
  --dv-accent-soft: rgba(91, 210, 182, 0.18);
  --dv-shadow: rgba(3, 10, 8, 0.5);
  font-family: "Inter", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--dv-text);
  background:
    radial-gradient(1200px 600px at 85% -5%, rgba(91, 210, 182, 0.12), transparent 55%),
    radial-gradient(900px 500px at -5% 10%, rgba(66, 102, 255, 0.12), transparent 60%),
    var(--dv-bg);
}

body.stitch-theme .bg-grid {
  opacity: 0.2;
  background-image:
    radial-gradient(rgba(91, 210, 182, 0.16) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 32px 32px, 130px 130px;
}

body.stitch-theme .topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 36px;
  margin: 0;
  background: rgba(19, 31, 28, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--dv-border-soft);
}

body.stitch-theme .brand {
  gap: 12px;
}

body.stitch-theme .brand-mark {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--dv-accent);
}

body.stitch-theme .brand-mark .material-icons {
  font-size: 21px;
  color: #0f1715;
}

body.stitch-theme .brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

body.stitch-theme .brand-subtitle {
  color: var(--dv-muted);
}

body.stitch-theme .topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

body.stitch-theme .nav {
  margin-bottom: 0;
  gap: 10px;
}

body.stitch-theme .nav-link {
  color: var(--dv-muted);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

body.stitch-theme .nav-link:hover {
  color: var(--dv-accent);
  border-color: var(--dv-border-soft);
}

body.stitch-theme .nav-link.active {
  color: var(--dv-accent);
  background: var(--dv-accent-soft);
  border-color: var(--dv-border);
}

body.stitch-theme .meta-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--dv-accent-soft);
  color: var(--dv-accent);
  border: 1px solid var(--dv-border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

body.stitch-theme .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--dv-accent);
  box-shadow: 0 0 0 0 rgba(91, 210, 182, 0.5);
  animation: dv-pulse 1.8s infinite;
}

@keyframes dv-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(91, 210, 182, 0.5);
  }
  80% {
    box-shadow: 0 0 0 8px rgba(91, 210, 182, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(91, 210, 182, 0);
  }
}

body.stitch-theme .meta-label {
  display: none;
}

body.stitch-theme .meta-value {
  color: #d4fbf2;
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
}

body.stitch-theme .layout {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 36px 36px;
}

body.stitch-theme .grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

body.stitch-theme .card,
body.stitch-theme .card.wide {
  grid-column: span 12;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--dv-border-soft);
  background: linear-gradient(165deg, rgba(35, 51, 47, 0.9), rgba(27, 40, 36, 0.95));
  box-shadow: 0 18px 44px var(--dv-shadow);
}

body.stitch-theme .parser-card {
  grid-column: span 5;
}

body.stitch-theme .forecast-card {
  grid-column: span 7;
}

body.stitch-theme .entry-card {
  grid-column: span 4;
}

body.stitch-theme .recent-card {
  grid-column: span 8;
}

body.stitch-theme .card-header {
  margin-bottom: 16px;
}

body.stitch-theme .header-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.stitch-theme .card-icon {
  color: var(--dv-accent);
  font-size: 20px;
}

body.stitch-theme .card-title {
  font-family: "Inter", "IBM Plex Sans", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

body.stitch-theme .card-subtitle {
  color: var(--dv-muted);
  font-size: 12px;
}

body.stitch-theme .chip {
  background: var(--dv-accent-soft);
  border: 1px solid var(--dv-border);
  color: var(--dv-accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}

body.stitch-theme .chip.secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--dv-muted);
}

body.stitch-theme .form-row label {
  color: #b8c8c3;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
}

body.stitch-theme .form-row input,
body.stitch-theme .form-row select,
body.stitch-theme .text-area {
  background: rgba(11, 20, 18, 0.55);
  border: 1px solid var(--dv-border-soft);
  color: #edf8f5;
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.stitch-theme .form-row input::placeholder,
body.stitch-theme .text-area::placeholder {
  color: #8da09a;
}

body.stitch-theme .form-row input:focus,
body.stitch-theme .form-row select:focus,
body.stitch-theme .text-area:focus {
  outline: none;
  border-color: var(--dv-accent);
  box-shadow: 0 0 0 3px rgba(91, 210, 182, 0.17);
}

body.stitch-theme .text-area {
  min-height: 180px;
  line-height: 1.5;
}

body.stitch-theme .form-inline {
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 0;
}

body.stitch-theme .parse-status {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #b3c2be;
  font-size: 12px;
}

body.stitch-theme .form-divider {
  background: var(--dv-border-soft);
}

body.stitch-theme .preview-grid {
  gap: 8px;
}

body.stitch-theme .preview-item {
  background: rgba(9, 16, 14, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.stitch-theme .preview-label {
  color: var(--dv-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.stitch-theme .preview-value {
  color: #e9f7f2;
}

body.stitch-theme .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.stitch-theme .btn {
  min-height: 42px;
  border-radius: 10px;
  background: var(--dv-accent);
  color: #0e1715;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.2s ease;
}

body.stitch-theme .btn:hover {
  box-shadow: 0 8px 20px rgba(91, 210, 182, 0.28);
}

body.stitch-theme .btn:active {
  transform: translateY(1px);
}

body.stitch-theme .btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--dv-muted);
}

body.stitch-theme .btn .material-icons {
  font-size: 18px;
}

body.stitch-theme .forecast-summary {
  margin-top: 14px;
  margin-bottom: 10px;
  gap: 8px;
}

body.stitch-theme .summary-pill {
  background: rgba(8, 14, 13, 0.56);
  border: 1px solid var(--dv-border-soft);
  color: var(--dv-muted);
}

body.stitch-theme .summary-pill strong {
  color: #f0fbf8;
}

body.stitch-theme .table-wrap {
  border: 1px solid var(--dv-border-soft);
  border-radius: 12px;
  overflow: auto;
}

body.stitch-theme .data-table {
  min-width: 720px;
  font-size: 12px;
}

body.stitch-theme .data-table th,
body.stitch-theme .data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 11px 10px;
}

body.stitch-theme .data-table th {
  color: #98aaa5;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: rgba(11, 20, 18, 0.55);
}

body.stitch-theme .data-table tbody tr:hover {
  background: rgba(91, 210, 182, 0.09);
}

body.stitch-theme .dividend-list {
  gap: 0;
  border: 1px solid var(--dv-border-soft);
  border-radius: 12px;
  overflow: hidden;
}

body.stitch-theme .dividend-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  background: rgba(10, 19, 17, 0.45);
  padding: 14px;
  align-items: center;
}

body.stitch-theme .dividend-item:last-child {
  border-bottom: none;
}

body.stitch-theme .dividend-title {
  color: #f2fcfa;
  font-weight: 700;
}

body.stitch-theme .dividend-sub {
  color: var(--dv-muted);
  font-size: 11px;
}

body.stitch-theme .dividend-value {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f2fcfa;
}

body.stitch-theme .dividend-amount {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

body.stitch-theme .icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #aab8b4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

body.stitch-theme .icon-btn .material-icons {
  font-size: 18px;
}

body.stitch-theme .icon-btn:hover {
  color: #ff9b9b;
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.12);
}

body.stitch-theme .empty-text,
body.stitch-theme .line-placeholder,
body.stitch-theme .table-empty {
  color: var(--dv-muted);
}

body.stitch-theme .toast {
  background: rgba(9, 16, 14, 0.95);
  border-color: var(--dv-border-soft);
  color: #e6f8f3;
}

body.stitch-theme .footer {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  color: #91a6a0;
  border-top: 1px solid var(--dv-border-soft);
  padding: 16px 36px 24px;
}

body.stitch-theme .mobile-fab,
body.stitch-theme .mobile-tabbar {
  display: none;
}

@media (max-width: 1320px) {
  body.stitch-theme .parser-card {
    grid-column: span 12;
  }

  body.stitch-theme .forecast-card {
    grid-column: span 12;
  }

  body.stitch-theme .entry-card {
    grid-column: span 5;
  }

  body.stitch-theme .recent-card {
    grid-column: span 7;
  }
}

@media (max-width: 1040px) {
  body.stitch-theme .entry-card,
  body.stitch-theme .recent-card {
    grid-column: span 12;
  }

  body.stitch-theme .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body.stitch-theme .topbar {
    padding: 14px 18px;
    gap: 12px;
  }

  body.stitch-theme .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

  body.stitch-theme .layout {
    padding: 16px 14px 24px;
  }

  body.stitch-theme .grid {
    gap: 14px;
  }

  body.stitch-theme .card {
    padding: 14px;
    border-radius: 14px;
  }

  body.stitch-theme .form-inline {
    grid-template-columns: 1fr;
  }

  body.stitch-theme .parse-status {
    width: 100%;
  }

  body.stitch-theme .preview-grid {
    grid-template-columns: 1fr;
  }

  body.stitch-theme .footer {
    padding: 14px;
    font-size: 11px;
  }
}

@media (max-width: 620px) {
  body.stitch-theme {
    padding-bottom: 78px;
  }

  body.stitch-theme .topbar {
    align-items: stretch;
  }

  body.stitch-theme .topbar-meta {
    display: grid;
    gap: 8px;
  }

  body.stitch-theme .brand-title {
    font-size: 18px;
  }

  body.stitch-theme .brand-subtitle {
    font-size: 11px;
  }

  body.stitch-theme .nav {
    display: none;
  }

  body.stitch-theme .nav-link {
    text-align: center;
    padding: 8px 6px;
    font-size: 11px;
  }

  body.stitch-theme .meta-live,
  body.stitch-theme .meta-value {
    justify-self: start;
  }

  body.stitch-theme .form-grid {
    grid-template-columns: 1fr;
  }

  body.stitch-theme .dividend-item {
    flex-direction: column;
    align-items: flex-start;
  }

  body.stitch-theme .dividend-value {
    width: 100%;
    justify-content: space-between;
  }

  body.stitch-theme .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(19, 31, 28, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--dv-border-soft);
  }

  body.stitch-theme .tab-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--dv-muted);
    font-size: 10px;
    font-weight: 600;
  }

  body.stitch-theme .tab-item .material-icons {
    font-size: 18px;
  }

  body.stitch-theme .tab-item.active {
    color: var(--dv-accent);
  }

  body.stitch-theme .tab-spacer,
  body.stitch-theme .mobile-tabbar .tab-item:last-child,
  body.stitch-theme .mobile-fab {
    display: none;
  }

}

/* Index page layout tuning */
body.index-page .dashboard-hero {
  border: 1px solid var(--dv-border-soft);
  border-radius: 16px;
  box-shadow: 0 18px 44px var(--dv-shadow);
  background: linear-gradient(165deg, rgba(35, 51, 47, 0.88), rgba(27, 40, 36, 0.94));
}

body.index-page .hero-title {
  color: #c6d5d0;
}

body.index-page .metric {
  background: rgba(9, 16, 14, 0.56);
  border: 1px solid var(--dv-border-soft);
}

body.index-page .metric-label,
body.index-page .metric-sub,
body.index-page .hero-note {
  color: var(--dv-muted);
}

body.index-page .dashboard-monthly,
body.index-page .dashboard-cumulative,
body.index-page .dashboard-positions,
body.index-page .dashboard-trend {
  grid-column: span 12;
}

body.index-page .dashboard-top-tickers,
body.index-page .dashboard-recent-dividends {
  grid-column: span 6;
}

/* Portfolio page layout tuning */
body.portfolio-page .cash-card,
body.portfolio-page .deposit-card,
body.portfolio-page .avg-card,
body.portfolio-page .qty-card {
  grid-column: span 3;
}

body.portfolio-page .trade-card,
body.portfolio-page .recent-trades-card {
  grid-column: span 6;
}

body.portfolio-page .recent-trades-card .dividend-list {
  min-height: 320px;
}

body.portfolio-page .modal-card .card-header {
  margin-bottom: 14px;
}

body.portfolio-page .modal-card .form-inline {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1320px) {
  body.portfolio-page .cash-card,
  body.portfolio-page .deposit-card,
  body.portfolio-page .avg-card,
  body.portfolio-page .qty-card {
    grid-column: span 6;
  }

  body.portfolio-page .trade-card,
  body.portfolio-page .recent-trades-card {
    grid-column: span 12;
  }
}

@media (max-width: 1040px) {
  body.index-page .dashboard-top-tickers,
  body.index-page .dashboard-recent-dividends,
  body.portfolio-page .cash-card,
  body.portfolio-page .deposit-card,
  body.portfolio-page .avg-card,
  body.portfolio-page .qty-card {
    grid-column: span 12;
  }
}

/* Recommendations page */
body.recommendations-page .recommendation-table {
  min-width: 980px;
}

body.recommendations-page .recommendation-table td:nth-child(8),
body.recommendations-page .recommendation-table td:nth-child(9) {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

