:root {
  --bg: #030303;
  --card: #121110;
  --card-2: #1a1917;
  --ink: #f6f4f3;
  --muted: #8a8680;
  --line: #2a2724;
  --orange: #e85d04;
  --orange-deep: #c2410c;
  --green: #1a9365;
  --red: #e10f04;
  --yellow: #fe9e0a;
  --blue: #3b82f6;
  --cream: #f6f4f3;
  --ice: #7dd3fc;
  --ice-dim: rgba(125, 211, 252, 0.14);
  --radius: 28px;
  --font: "Segoe UI", "SF Pro Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 480px at 12% -20%, rgba(232, 93, 4, 0.16) 0%, transparent 55%),
    radial-gradient(1200px 600px at 80% -10%, #2a1408 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 22px;
  min-width: 0;
}

.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: conic-gradient(from 210deg, #22c55e, #86efac, #166534);
  display: inline-block;
  clip-path: polygon(15% 20%, 55% 20%, 85% 50%, 55% 80%, 15% 80%, 45% 50%);
}

.rate-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  margin-left: 4px;
  padding: 4px 10px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #161513;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
}

.rate-chip:hover {
  border-color: #3d3934;
}

.rate-pair {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.rate-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.rate-leg {
  display: flex;
  flex-direction: column;
}

.rate-leg span {
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.rate-leg strong {
  font-weight: 700;
}

.pill-nav {
  justify-self: center;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: #161513;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.tab,
.ghost,
.primary,
.danger,
.ranges button {
  font: inherit;
  cursor: pointer;
  border: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tab {
  background: transparent;
  color: var(--muted);
  padding: 10px 18px;
  border-radius: 999px;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--cream);
  color: #111;
  font-weight: 600;
}

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

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line) !important;
  border-radius: 999px;
  padding: 8px 14px;
}

.primary,
.danger {
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600;
}

.ghost:hover {
  color: var(--ink);
  border-color: #4a453f !important;
}

.primary {
  background: var(--orange);
  color: #fff;
}

.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.danger {
  background: #3a1210;
  color: #fecaca;
}

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

.small {
  font-size: 13px;
  line-height: 1.45;
}

.card {
  background: linear-gradient(180deg, #161513, var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: #3a3530;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.chart-card {
  background: linear-gradient(160deg, #f08a2a 0%, #e85d04 55%, #c2410c 100%);
  color: #fff;
  border: 0;
  padding: 16px 18px 14px;
  overflow: hidden;
}

.chart-card:hover {
  transform: none;
  border-color: transparent;
}

.panel {
  display: grid;
  gap: 18px;
}

.hero-grid,
.bottom-grid,
.ops-grid {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.4fr);
  align-items: stretch;
}

.hero-grid > .card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.chart-card .card-head {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.chart-card .chart-hint {
  flex-shrink: 0;
}

.bottom-grid {
  grid-template-columns: 1.1fr 0.8fr 1fr;
}

.ops-grid {
  grid-template-columns: minmax(300px, 380px) 1fr;
}

.op-menu {
  display: grid;
  gap: 8px;
}

.op-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  background: #1c1a18;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.op-choice:hover {
  background: #221f1c;
  border-color: #4a453f;
  transform: translateY(-1px);
}

.op-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #2a2724;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.op-choice-text {
  display: grid;
  gap: 2px;
}

.op-choice-text strong {
  font-size: 14px;
  letter-spacing: -0.02em;
}

.op-choice-text span {
  color: var(--muted);
  font-size: 12px;
}

.op-extra {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.op-extra-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.op-extra-item {
  background: linear-gradient(180deg, #1e1b18, #161412);
}

.op-extra-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fdba74;
  background: rgba(232, 93, 4, 0.12);
  border: 1px solid rgba(232, 93, 4, 0.28);
}

.op-extra-icon svg {
  width: 18px;
  height: 18px;
}

.op-extra-icon-danger {
  background: #3a1210;
  color: #fecaca;
}

.op-feedback {
  justify-self: start;
  margin-top: 4px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 2px;
}

.op-feedback span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.op-feedback:hover {
  color: #fdba74;
}

.remind-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.remind-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.remind-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.remind-day {
  min-width: 42px;
  padding: 8px 0;
  border-radius: 999px;
  border: 1px solid rgba(225, 15, 4, 0.28);
  background: rgba(225, 15, 4, 0.12);
  color: #f0a8a4;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.remind-day:hover {
  background: rgba(225, 15, 4, 0.2);
  border-color: rgba(225, 15, 4, 0.42);
}

.remind-day.is-on {
  color: #b6f0d0;
  background: rgba(26, 147, 101, 0.22);
  border-color: rgba(134, 239, 172, 0.38);
}

.remind-day.is-on:hover {
  background: rgba(26, 147, 101, 0.32);
  border-color: rgba(134, 239, 172, 0.5);
}

.remind-ok {
  margin: 0;
  color: #86efac;
  font-size: 13px;
}

.op-back {
  justify-self: start;
  padding: 6px 12px;
}

.op-step-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

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

h1,
h2 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.kpi {
  margin: 8px 0 18px;
}

.kpi strong {
  display: block;
  font-size: 34px;
  letter-spacing: -0.05em;
  font-weight: 700;
}

.kpi.tight {
  margin: 4px 0 0;
}

.kpi.tight strong {
  font-size: 28px;
}

.pill {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(26, 147, 101, 0.2);
  color: #4ade80;
  font-size: 13px;
  font-weight: 600;
}

.pill.down {
  background: rgba(225, 15, 4, 0.15);
  color: #fca5a5;
}

.pill.light {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini {
  background: #1c1a18;
  border-radius: 16px;
  padding: 12px;
  border-left: 3px solid var(--orange);
}

.mini .name {
  color: var(--muted);
  font-size: 12px;
}

.mini .val {
  font-weight: 650;
  margin-top: 4px;
}

.mini.is-frozen {
  border-left-color: var(--ice);
  background:
    linear-gradient(165deg, var(--ice-dim) 0%, transparent 46%),
    #171b1f;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.18);
}

.mini.is-frozen .name {
  color: #bae6fd;
}

.mini.is-frozen .val {
  color: #e0f2fe;
}

.frost-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.38);
  color: #e0f2fe;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.frost-tag::before {
  content: "❄";
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
}

.ranges {
  display: flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 4px;
  background: rgba(0, 0, 0, 0.18);
  padding: 4px;
  border-radius: 999px;
  position: relative;
  z-index: 3;
}

.ranges button {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  pointer-events: auto;
}

.ranges button:hover {
  color: #fff;
}

.ranges button.is-active {
  background: #fff;
  color: #111;
}

.chart-wrap {
  position: relative;
  height: 208px;
  margin-top: 8px;
}

.chart-card .chart-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.pnl-wrap,
.cum-wrap {
  height: 220px;
}

.pnl-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.pnl-pair > .card {
  min-width: 0;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.pnl-pair .chart-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
}

.pnl-pair .chart-hint {
  flex-shrink: 0;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(12, 11, 10, 0.94);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.chart-tooltip strong {
  display: block;
  font-size: 14px;
}

.chart-card .chart-tooltip {
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  border-color: transparent;
}

.chart-hint {
  min-height: 1.2em;
  font-size: 12px;
  opacity: 0.85;
  margin: 8px 0 0;
  transition: opacity 0.2s ease;
}

.watchlist {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.watchlist h2,
.watch-row {
  margin: 0;
}

.watch-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.watch-row.is-crowded {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  max-height: 488px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.watch-row.is-crowded::-webkit-scrollbar,
.alloc-list.is-crowded::-webkit-scrollbar,
.journal-wrap::-webkit-scrollbar {
  width: 8px;
}

.watch-row.is-crowded::-webkit-scrollbar-thumb,
.alloc-list.is-crowded::-webkit-scrollbar-thumb,
.journal-wrap::-webkit-scrollbar-thumb {
  background: #3a3530;
  border-radius: 999px;
}

.watch {
  position: relative;
  overflow: hidden;
  background: #1c1a18;
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
  min-height: 152px;
  isolation: isolate;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.28s ease,
    box-shadow 0.28s ease;
}

.watch:not(.is-frozen) {
  box-shadow: inset 3px 0 0 var(--bank, #a8a29e);
}

.watch-body {
  position: relative;
  z-index: 1;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.watch-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 28%, rgba(8, 7, 6, 0.94) 58%),
    radial-gradient(120% 80% at 50% 120%, rgba(232, 93, 4, 0.22), transparent 58%);
  opacity: 0;
  transform: translateY(12%);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.watch.is-frozen .watch-veil {
  background:
    linear-gradient(180deg, transparent 24%, rgba(6, 18, 28, 0.94) 56%),
    radial-gradient(120% 90% at 50% 120%, rgba(56, 189, 248, 0.28), transparent 60%);
}

.watch-actions {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  pointer-events: none;
}

.watch-act {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 0;
  border-radius: 10px;
  padding: 0 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.28s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s ease,
    filter 0.2s ease;
}

.watch-act svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
}

.watch-act span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-act:nth-child(1) {
  transition-delay: 0.02s;
}

.watch-act:nth-child(2) {
  transition-delay: 0.07s;
}

.watch-act:nth-child(3) {
  transition-delay: 0.12s;
}

.watch-act.details {
  background: rgba(42, 39, 36, 0.92);
  color: #f6f4f3;
  box-shadow: 0 0 0 1px rgba(246, 244, 243, 0.12);
}

.watch-act.fix {
  background: rgba(196, 90, 16, 0.62);
  color: #ffedd5;
  box-shadow: 0 0 0 1px rgba(253, 186, 116, 0.28);
}

.watch-act.frost {
  background: rgba(14, 116, 144, 0.55);
  color: #e0f2fe;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.25);
}

.watch-act.restore {
  background: rgba(22, 101, 52, 0.55);
  color: #bbf7d0;
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.22);
}

.watch-act.remove {
  background: #3a1210;
  color: #fecaca;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2);
}

.watch-act:hover {
  filter: brightness(1.12);
}

.watch .bal,
.watch .chg,
.watch .chg-cap {
  transition: opacity 0.25s ease;
}

.watch.is-open .bal,
.watch.is-open .chg,
.watch.is-open .chg-cap {
  opacity: 0;
}

.watch.is-open {
  transform: translateY(-2px);
  box-shadow:
    inset 3px 0 0 var(--bank, #a8a29e),
    0 16px 40px rgba(0, 0, 0, 0.35);
}

.watch.is-frozen.is-open {
  box-shadow: inset 3px 0 0 var(--ice), 0 16px 40px rgba(0, 0, 0, 0.35);
}

.watch.is-open .watch-body {
  transform: translateY(-6px);
}

.watch.is-open .watch-veil {
  opacity: 1;
  transform: translateY(0);
}

.watch.is-open .watch-act {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .watch:hover {
    transform: translateY(-2px);
    background: #221f1c;
  }

  .watch:hover .watch-body {
    transform: translateY(-6px);
  }

  .watch:hover .watch-veil {
    opacity: 1;
    transform: translateY(0);
  }

  .watch:hover .watch-act {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .watch:hover .bal,
  .watch:hover .chg,
  .watch:hover .chg-cap {
    opacity: 0;
  }
}

.watch .sym {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  min-width: 0;
}

.watch .bal {
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.watch.is-frozen {
  background:
    linear-gradient(180deg, var(--ice-dim), transparent 48%),
    #171b1f;
  box-shadow: inset 3px 0 0 var(--ice);
}

.watch.is-frozen .sym {
  color: #e0f2fe;
}

.watch.is-frozen .frost-tag {
  margin-top: 0;
}

.watch .chg {
  font-size: 12px;
  margin-top: 2px;
}

.watch .chg-cap {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
}

.watch .chg.up {
  color: #4ade80;
}

.watch .chg.down {
  color: #f87171;
}

.alloc-list.is-crowded {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.journal-wrap {
  max-height: min(62vh, 560px);
}

.journal-row.is-freeze td:nth-child(3) {
  color: #7dd3fc;
}

.journal-row.is-unfreeze td:nth-child(3) {
  color: #86efac;
}

.journal-row.is-archive td:nth-child(3) {
  color: #fca5a5;
}

.archive-card {
  margin-top: 0;
}

.alloc-row {
  display: grid;
  grid-template-columns: 88px 1fr 4.6em;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
}

.alloc-row > span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.alloc-row.is-frozen > span:first-child {
  color: #7dd3fc;
}

.alloc-row.is-frozen .bar > span {
  background: #38bdf8 !important;
  opacity: 0.72;
}

.bar {
  height: 18px;
  border-radius: 8px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.08) 6px,
    transparent 6px,
    transparent 12px
  );
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 8px;
  width: 0;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.io-card {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.io-card h2 {
  text-align: left;
}

.io-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.io-ring {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, #2a2724 0 100%);
  -webkit-mask-image: radial-gradient(farthest-side, transparent 64%, #000 65.5%);
  mask-image: radial-gradient(farthest-side, transparent 64%, #000 65.5%);
}

.io-ring:not(.is-empty) {
  background: conic-gradient(
    from -90deg,
    #22c55e 0 var(--in-pct, 0%),
    #e10f04 var(--in-pct, 0%) 100%
  );
}

.io-ring.is-in-only {
  background: conic-gradient(from -90deg, #22c55e 0 100%);
}

.io-ring.is-out-only {
  background: conic-gradient(from -90deg, #e10f04 0 100%);
}

.io-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  width: 100%;
}

.io-leg {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.io-leg > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.io-leg > span:first-child::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.io-leg.in > span:first-child::before {
  background: #22c55e;
}

.io-leg.out > span:first-child::before {
  background: #e10f04;
}

.io-leg strong {
  font-size: 20px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.io-leg .muted {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.io-leg.in strong {
  color: #4ade80;
}

.io-leg.out strong {
  color: #f87171;
}

.flow-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.flow-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 500;
}

.linkish {
  background: none;
  border: 0;
  color: #fdba74;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.error {
  color: #fca5a5;
  font-size: 13px;
}

dialog {
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  padding: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.card-sheet {
  max-width: min(560px, calc(100% - 24px));
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--card);
}

.card-sheet::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.sheet-card {
  display: grid;
}

.sheet-hero {
  position: relative;
  padding: 22px 22px 18px;
  isolation: isolate;
}

.sheet-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90% 80% at 0% 0%, var(--bank, #e85d04), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 55%);
  opacity: 0.34;
  pointer-events: none;
}

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

.sheet-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sheet-close {
  min-height: 32px;
  padding: 0 12px;
}

.sheet-hero h2 {
  margin: 10px 0 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.sheet-balance {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.sheet-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.sheet-kpis > div {
  background: rgba(8, 7, 6, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 10px 12px;
  min-width: 0;
}

.sheet-kpis span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.sheet-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.sheet-kpis .down {
  color: #fca5a5;
}

.sheet-kpis .up {
  color: #86efac;
}

.sheet-handle {
  display: none;
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 22px 16px;
}

.sheet-act {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: #1c1a18;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.sheet-act svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.sheet-act span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-act.is-primary {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #f08a2a, var(--orange));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(232, 93, 4, 0.28);
}

.sheet-act.is-frost {
  color: #e0f2fe;
  background: rgba(14, 116, 144, 0.28);
  border-color: rgba(125, 211, 252, 0.22);
}

.sheet-act.is-restore {
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.32);
  border-color: rgba(74, 222, 128, 0.22);
}

.sheet-act.is-danger {
  color: #fecaca;
  background: #3a1210;
  border-color: rgba(248, 113, 113, 0.22);
}

@media (hover: hover) and (pointer: fine) {
  .sheet-act:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
  }
}

.sheet-act:focus-visible {
  outline: 2px solid rgba(253, 186, 116, 0.7);
  outline-offset: 2px;
}

.sheet-body {
  padding: 0 22px 22px;
}

.sheet-body h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sheet-journal {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(42vh, 360px);
  overflow: auto;
}

.sheet-journal li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sheet-journal .sheet-op-title {
  font-weight: 650;
}

.sheet-journal .sheet-op-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.sheet-journal .sheet-op-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.sheet-journal .muted {
  padding: 8px 0 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .card-sheet[open] {
    animation: sheet-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-actions {
  display: flex;
  gap: 8px;
}

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

.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 40px 36px;
}

.login-card h1 {
  font-size: 28px;
}

.stat-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: -6px 0 0;
}

.stat-pill {
  background: #1c1a18;
  border-radius: 16px;
  padding: 10px 12px;
}

.stat-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.stat-pill.is-frozen {
  background:
    linear-gradient(165deg, var(--ice-dim) 0%, transparent 52%),
    #171b1f;
  box-shadow: inset 3px 0 0 var(--ice);
}

.stat-pill.is-frozen strong {
  color: #e0f2fe;
}

.chart-panel .card-head {
  flex-shrink: 0;
  min-height: 76px;
}

.chart-panel .kpi.tight {
  margin-top: 2px;
}

.chart-panel .kpi.tight strong {
  font-size: 24px;
}

.balance-from {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.balance-from strong {
  display: block;
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: #161513;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  cursor: default;
  user-select: none;
}

.balance-arrow {
  display: grid;
  place-items: center;
  color: #c4bfb8;
  margin: -2px 0;
}

.balance-arrow svg {
  width: 22px;
  height: 22px;
}

.flow-list strong.up {
  color: #4ade80;
}

.flow-list strong.down {
  color: #f87171;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini {
  animation: rise 0.45s ease both;
}

.kpi strong {
  transition: opacity 0.2s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .panel .card {
    animation: rise 0.55s ease both;
  }

  .hero-grid .card:nth-child(1) { animation-delay: 0.02s; }
  .hero-grid .card:nth-child(2) { animation-delay: 0.08s; }
  .pnl-pair .pnl-card { animation-delay: 0.1s; }
  .pnl-pair .cum-card { animation-delay: 0.14s; }
  .watchlist { animation-delay: 0.18s; }

  .login-card {
    animation: rise 0.5s ease both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .watch,
  .watch-act,
  .sheet-act,
  .sheet-card,
  .watch-body,
  .watch-veil,
  .tab,
  .ghost,
  .primary,
  .op-choice,
  .remind-day,
  .ranges button,
  .bar > span,
  .mini,
  .login-card {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1100px) {
  .hero-grid,
  .bottom-grid,
  .ops-grid,
  .topbar {
    grid-template-columns: 1fr;
  }

  .watch-row {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  }

  .watch-row.is-crowded {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  }

  .pill-nav {
    justify-self: stretch;
    overflow: auto;
  }
}

@media (max-width: 860px) {
  .pnl-pair {
    grid-template-columns: 1fr;
  }

  .pnl-pair .chart-wrap {
    min-height: 200px;
    height: 200px;
    flex: none;
  }
}

@media (max-width: 640px) {
  .card-sheet[open] {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
    max-height: min(94dvh, 100%);
  }

  .sheet-handle {
    display: block;
  }

  .sheet-hero {
    padding: 8px 18px 14px;
  }

  .sheet-hero h2 {
    font-size: 20px;
  }

  .sheet-balance {
    font-size: 24px;
  }

  .sheet-kpis {
    gap: 6px;
    margin-top: 14px;
  }

  .sheet-kpis > div {
    padding: 8px 10px;
  }

  .sheet-actions {
    padding: 0 18px 14px;
    gap: 8px;
  }

  .sheet-act {
    min-height: 46px;
    font-size: 12.5px;
  }

  .sheet-body {
    padding: 0 18px 18px;
  }

  .sheet-journal {
    max-height: min(34vh, 280px);
  }
}

@media (max-width: 380px) {
  .sheet-act span {
    font-size: 12px;
  }
}
