:root {
  color-scheme: light;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-low: #f4f7ff;
  --surface-mid: #eef4ff;
  --surface-high: #dce9ff;
  --ink: #0b1c30;
  --muted: #45464d;
  --faint: #76777d;
  --line: #d7dce6;
  --line-strong: #b8c2d1;
  --primary: #0f172a;
  --primary-ink: #ffffff;
  --primary-soft: #e5edff;
  --control-primary: #0f172a;
  --control-primary-ink: #ffffff;
  --control-primary-border: #0f172a;
  --control-primary-hover: #1e293b;
  --accent: #b80938;
  --accent-soft: #fff0f3;
  --positive: #057a55;
  --positive-soft: #e7f7ef;
  --negative: #c92020;
  --negative-soft: #fff0ef;
  --warning: #b7791f;
  --warning-soft: #fff7e8;
  --focus: #233756;
  --radius: 8px;
  --radius-sm: 4px;
  --nav-width: 264px;
  --container: 1440px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --surface: #172033;
  --surface-low: #141d2c;
  --surface-mid: #1d2a3f;
  --surface-high: #24344d;
  --ink: #edf3ff;
  --muted: #b8c4d6;
  --faint: #8c9aaf;
  --line: #2d3b52;
  --line-strong: #41536f;
  --primary: #f8fafc;
  --primary-ink: #0b1220;
  --primary-soft: #202c42;
  --control-primary: #e31937;
  --control-primary-ink: #ffffff;
  --control-primary-border: #ff5b7c;
  --control-primary-hover: #c91430;
  --accent: #ff5b7c;
  --accent-soft: #3c1c27;
  --positive: #4ade80;
  --positive-soft: #143622;
  --negative: #fb7185;
  --negative-soft: #3d1820;
  --warning: #f6c96f;
  --warning-soft: #352819;
  --focus: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button,
label,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100vh;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.top-nav-inner,
.footer-inner {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 0 24px;
}

.top-nav-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000000;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: block;
  white-space: nowrap;
  font-size: 15px;
  line-height: 18px;
}

.brand-subtitle {
  display: block;
  color: var(--faint);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
}

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

.top-links {
  height: 56px;
}

.top-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.top-link:hover,
.top-link.is-active {
  color: var(--ink);
  background: var(--surface-mid);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-low);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
}

.language-option {
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  line-height: 24px;
  font-weight: 900;
  cursor: pointer;
}

.language-option.is-active {
  color: var(--control-primary-ink);
  background: var(--control-primary);
}

.app-main {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 32px 24px;
}

.upload-layout {
  min-height: calc(100vh - 113px);
  display: grid;
  align-content: center;
  gap: 22px;
}

.upload-hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

.upload-hero h1,
.page-title h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 32px);
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: 0;
}

.upload-hero p,
.page-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 24px;
}

.privacy-banner,
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-mid);
}

.privacy-banner .dropzone-icon {
  width: 44px;
  height: 44px;
  margin: 0;
  flex: 0 0 auto;
  font-size: 21px;
}

.privacy-banner strong,
.notice strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.privacy-banner p,
.notice p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 19px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  width: min(100%, 1080px);
  margin: 0 auto;
}

.upload-stack,
.side-stack {
  display: grid;
  gap: 16px;
}

.dropzone {
  min-height: 312px;
  display: grid;
  place-items: center;
  padding: 32px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--surface-mid);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 30px;
}

.dropzone h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
}

.dropzone p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.primary-button,
.secondary-button,
.quiet-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--control-primary-border);
  color: var(--control-primary-ink);
  background: var(--control-primary);
}

.primary-button:hover {
  background: var(--control-primary-hover);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}

.secondary-button:hover,
.quiet-button:hover {
  background: var(--surface-mid);
}

.quiet-button {
  color: var(--muted);
  background: transparent;
}

.danger-button {
  color: #ffffff;
  background: var(--accent);
}

.paste-panel,
.info-card,
.dashboard-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.paste-panel {
  overflow: hidden;
}

.paste-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.paste-panel summary:hover {
  background: var(--surface-low);
}

.paste-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

.paste-body textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 19px;
}

.paste-body textarea:focus,
.search-input:focus {
  outline: 2px solid transparent;
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

.info-card {
  padding: 18px;
}

.info-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 18px;
}

.info-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.info-card li + li {
  margin-top: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface-mid);
  font-size: 12px;
  font-weight: 700;
}

.error-banner {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 700;
}

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  color: var(--muted);
  font-size: 12px;
}

.footer-inner a {
  color: var(--ink);
  font-weight: 800;
}

.footer-inner a:hover {
  color: var(--accent);
}

.dashboard-shell {
  min-height: 100vh;
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--nav-width);
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--surface-low);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 4px 6px;
}

.side-brand .brand-title {
  color: var(--accent);
}

.side-nav-list {
  display: grid;
  gap: 4px;
}

.side-spacer {
  flex: 1;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover {
  color: var(--ink);
  background: var(--surface-high);
}

.nav-button.is-active {
  color: #ffffff;
  background: var(--accent);
}

.nav-button svg {
  flex: 0 0 auto;
}

.dashboard-main {
  min-height: 100vh;
  margin-left: var(--nav-width);
}

.mobile-bar {
  display: none;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.app-bar-title {
  font-size: 20px;
  font-weight: 800;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
}

.search-input {
  width: 280px;
  min-height: 34px;
  padding: 7px 10px 7px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
}

.dashboard-content {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 24px;
}

.content-stack {
  display: grid;
  gap: 16px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title h1 {
  font-size: clamp(24px, 3vw, 32px);
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-mid);
}

.segment {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.segment.is-active {
  color: var(--control-primary-ink);
  background: var(--control-primary);
}

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

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-12 {
  grid-column: span 12;
}

.kpi-card,
.dashboard-card,
.table-card {
  min-width: 0;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.kpi-card.is-featured {
  position: relative;
  overflow: hidden;
}

.kpi-card.is-featured::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.kpi-label,
.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 14px;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.kpi-foot {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12px;
  line-height: 16px;
}

.performance-kpi .kpi-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.performance-kpi .kpi-main {
  min-width: 0;
}

.performance-kpi .kpi-label {
  font-size: 13px;
  line-height: 18px;
}

.kpi-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 104px;
  padding-bottom: 2px;
  text-align: right;
}

.kpi-side span {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
}

.kpi-side strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-card {
  padding: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
}

.card-kicker {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-transform: none;
}

.daily-toolbar {
  display: flex;
  justify-content: flex-end;
}

.month-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.month-select {
  min-height: 34px;
  padding: 6px 34px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.daily-calendar-card,
.daily-trades-card {
  min-height: 430px;
}

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

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

.calendar-cell {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 74px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
}

.calendar-cell.is-positive {
  border-color: rgba(54, 211, 153, 0.34);
  background: rgba(54, 211, 153, var(--heat-alpha));
}

.calendar-cell.is-negative {
  border-color: rgba(255, 91, 124, 0.34);
  background: rgba(255, 91, 124, var(--heat-alpha));
}

.calendar-cell.is-empty {
  border-color: transparent;
  background: transparent;
}

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

.calendar-cell strong {
  justify-self: end;
  align-self: end;
  font-size: 12px;
  line-height: 16px;
}

.daily-trade-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10px, 1fr));
  align-items: end;
  gap: 4px;
  min-height: 210px;
  padding: 8px 2px 0;
  border-bottom: 1px solid var(--line);
}

.daily-bar-column {
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 6px;
  min-width: 0;
}

.daily-bar {
  width: min(100%, 16px);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--ink);
}

.daily-bar-column span {
  color: var(--muted);
  font-size: 10px;
  line-height: 12px;
  writing-mode: vertical-rl;
}

.daily-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.daily-stat {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
}

.daily-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.daily-stat strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 22px;
}

.metric-bars {
  display: grid;
  gap: 16px;
}

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

.bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 800;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-mid);
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--primary);
}

.bar-fill.accent {
  background: var(--accent);
}

.bar-fill.neutral {
  background: var(--faint);
}

.bar-fill.negative {
  background: var(--negative);
}

.table-card {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-mid);
}

.table-header h2,
.table-header h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-scroll {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: var(--ink);
}

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

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

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

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

.neutral {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.positive {
  border-color: rgba(5, 122, 85, 0.3);
  background: var(--positive-soft);
  color: var(--positive);
}

.pill.negative {
  border-color: rgba(201, 32, 32, 0.3);
  background: var(--negative-soft);
  color: var(--negative);
}

.pl-distribution {
  display: grid;
  gap: 14px;
}

.pl-total-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-low);
}

.pl-total-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pl-total-panel strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.pl-total-split {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.pl-total-split span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  white-space: nowrap;
}

.pl-total-split b {
  font-weight: 800;
}

.pl-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pl-category-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-low);
}

.pl-category-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.pl-category-head span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.pl-category-head strong {
  font-size: 14px;
  white-space: nowrap;
}

.pl-metric {
  display: grid;
  gap: 8px;
}

.pl-metric-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pl-metric-top span {
  white-space: nowrap;
}

.pl-metric-top strong {
  font-weight: 800;
  white-space: nowrap;
}

.pl-metric-track {
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.pl-metric-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.pl-metric-fill.is-positive {
  background: var(--positive);
}

.pl-metric-fill.is-negative {
  background: var(--negative);
}

.allocation-grid {
  display: grid;
  gap: 10px;
}

.allocation-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(140px, 2fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.mini-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-mid);
}

.mini-fill {
  height: 100%;
  background: var(--accent);
}

.allocation-pie {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 270px;
  padding: 6px 4px 4px;
}

.pie-visual {
  position: relative;
  width: 190px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--pie-gradient));
  box-shadow: inset 0 0 0 1px var(--line);
}

.pie-visual::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pie-visual span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 820;
}

.pie-legend {
  display: grid;
  gap: 10px;
}

.pie-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--surface-low);
  color: var(--muted);
  font-size: 13px;
}

.pie-legend-row strong,
.pie-legend-row .numeric {
  color: var(--ink);
}

.pie-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.pie-label i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.pie-total {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.position-chart-card {
  margin-top: 0;
}

.position-pie-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 320px;
  padding: 4px 0;
}

.asset-pie {
  width: min(320px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--position-pie-gradient));
  box-shadow: inset 0 0 0 1px var(--line);
}

.position-pie-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.position-pie-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-low);
  color: var(--muted);
  font-size: 13px;
}

.position-pie-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
}

.position-pie-label i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.position-pie-value {
  display: grid;
  justify-items: end;
  gap: 2px;
  white-space: nowrap;
}

.position-pie-value strong {
  color: var(--ink);
}

.position-pie-value span {
  color: var(--muted);
  font-size: 12px;
}

.chart-card {
  min-height: 282px;
}

.monthly-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 210px;
  padding: 12px 4px 0;
  border-bottom: 1px solid var(--line);
}

.chart-column {
  display: grid;
  align-content: end;
  gap: 4px;
  height: 190px;
}

.chart-bar {
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--primary);
}

.chart-bar.expense {
  background: var(--faint);
}

.chart-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.warning-list {
  display: grid;
  gap: 8px;
}

.warning-item {
  padding: 10px 12px;
  border: 1px solid rgba(183, 121, 31, 0.35);
  border-radius: var(--radius-sm);
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 13px;
  line-height: 19px;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  cursor: pointer;
}

.share-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(1120px, 100%);
  max-height: min(92vh, 920px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.share-header,
.share-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
}

.share-toolbar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
}

.share-preview {
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-mid);
}

.share-preview canvas {
  display: block;
  width: min(100%, 960px);
  height: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
}

.share-preview canvas[height="1728"] {
  width: min(100%, 430px);
}

.mobile-tabs {
  display: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .top-links {
    display: none;
  }

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

  .side-nav {
    display: none;
  }

  .dashboard-main {
    margin-left: 0;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-bar-main {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
  }

  .mobile-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 0 12px;
    border-top: 1px solid var(--line);
  }

  .mobile-tabs .nav-button {
    flex: 0 0 auto;
    width: auto;
    border-radius: 0;
    min-height: 44px;
    padding: 8px 10px;
    background: transparent;
  }

  .mobile-tabs .nav-button.is-active {
    color: var(--accent);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .app-bar {
    display: none;
  }

  .dashboard-content {
    padding: 16px;
  }

  .page-heading {
    display: grid;
  }

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

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-12 {
    grid-column: auto;
  }

  .allocation-pie {
    grid-template-columns: 1fr;
  }

  .position-pie-layout {
    grid-template-columns: 1fr;
  }

  .asset-pie {
    margin: 0 auto;
  }

  .daily-toolbar {
    justify-content: flex-start;
  }

  .daily-stat-grid {
    grid-template-columns: 1fr;
  }

  .pie-legend-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .search-input {
    width: min(100%, 260px);
  }

  .pl-category-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .top-nav-inner,
  .footer-inner {
    padding-inline: 16px;
  }

  .app-main {
    padding: 24px 16px;
  }

  .privacy-banner,
  .notice {
    width: 100%;
  }

  .dropzone {
    min-height: 260px;
    padding: 24px 18px;
  }

  .allocation-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .brand-subtitle {
    display: none;
  }

  .button-row {
    justify-content: stretch;
  }

  .button-row button,
  .button-row label {
    flex: 1;
  }

  .pl-total-panel {
    grid-template-columns: 1fr;
  }

  .pl-total-split {
    min-width: 0;
  }

  .pl-category-grid {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
}
