/* Funding Radar — a navigator's logbook at night: ink surfaces, paper text, brass accent.
   Semantic colors: tide = you collect, reef = you pay. One accent (brass) for actions. */
:root {
  /* surfaces: same blue-ink hue, only lightness shifts */
  --ink-0: #0a0e15;
  --ink-1: #0e131c;
  --ink-2: #131a25;
  --ink-3: #19212e;
  --well: #080b11;

  /* text: warm paper */
  --paper: #ece6d9;
  --paper-2: #bdb6a8;
  --paper-3: #8a8477;
  --paper-4: #5d5850;

  /* lines: brass-tinted, low alpha */
  --line: rgba(214, 190, 140, 0.07);
  --line-2: rgba(214, 190, 140, 0.12);
  --line-3: rgba(214, 190, 140, 0.22);

  --brass: #c9a45c;
  --brass-hi: #dcbb78;
  --brass-soft: rgba(201, 164, 92, 0.12);

  --tide: #5cc39d;
  --tide-soft: rgba(92, 195, 157, 0.13);
  --reef: #e0735f;
  --reef-soft: rgba(224, 115, 95, 0.13);
  --fog: #7f93b0;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;

  --sans: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--ink-0);
  background-image: radial-gradient(1200px 500px at 85% -10%, rgba(201,164,92,.05), transparent 60%);
  color: var(--paper); font: 400 16px/1.5 var(--sans);
  font-feature-settings: "ss01";
}
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--paper-3); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(10,14,21,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar__inner { max-width: 1640px; margin: 0 auto; padding: var(--s-3) var(--s-5); display: flex; align-items: center; gap: var(--s-5); }
.brand { display: flex; align-items: center; gap: var(--s-2); text-decoration: none; font-weight: 700; letter-spacing: -.01em; font-size: 17px; }
.brand__mark { width: 26px; height: 26px; fill: none; stroke: var(--brass); stroke-width: 2.2; }
.brand__cross { stroke-width: 1.2; opacity: .45; }
.brand__needle { stroke: var(--paper); stroke-width: 2.4; stroke-linecap: round; transform-origin: 16px 16px; transition: transform .6s var(--ease); }
.brand:hover .brand__needle { transform: rotate(35deg); }
.tabs { display: flex; gap: var(--s-1); }
.tab { text-decoration: none; color: var(--paper-3); padding: 6px 12px; border-radius: var(--r-sm); font-weight: 500; font-size: 15px; transition: color .15s, background .15s; }
.tab:hover { color: var(--paper); }
.tab.is-active { color: var(--paper); background: var(--ink-2); box-shadow: inset 0 -2px 0 var(--brass); }
.tab--private::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); margin-right: 7px; vertical-align: 2px; }
.clocks { margin-left: auto; display: flex; gap: var(--s-4); align-items: center; font-family: var(--mono); font-size: 13px; }
.clock em { font-style: normal; color: var(--paper-4); margin-right: 6px; font-size: 11px; letter-spacing: .08em; }
.clock b { font-weight: 500; color: var(--paper-2); }
.clock--market { color: var(--paper-3); padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 99px; font-size: 12px; }
.clock--market.is-open { color: var(--tide); border-color: rgba(92,195,157,.3); }
.sync { display: flex; align-items: center; gap: var(--s-3); }
.sync__age { font-size: 13px; color: var(--paper-3); font-family: var(--mono); white-space: nowrap; }
.sync__age.is-stale { color: var(--reef); }

/* ---------- layout ---------- */
.page { flex: 1; width: 100%; max-width: 1640px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-7); }
.view__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-5); margin-bottom: var(--s-5); }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 var(--s-2); }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.lede { margin: 0; color: var(--paper-3); max-width: 720px; }
.section-title { margin: var(--s-6) 0 var(--s-3); font-size: 15px; text-transform: uppercase; letter-spacing: .09em; color: var(--paper-2); font-weight: 600; }
.section-title small { text-transform: none; letter-spacing: 0; color: var(--paper-4); font-weight: 400; margin-left: 8px; font-size: 14px; }
.head-actions { display: flex; gap: var(--s-2); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--ink-2); cursor: pointer; font-weight: 500; font-size: 15px; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--line-3); background: var(--ink-3); }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .link:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 14px; }
.btn--ghost { background: transparent; }
.btn--brass { background: var(--brass); color: #15110a; border-color: var(--brass); font-weight: 600; }
.btn--brass:hover { background: var(--brass-hi); border-color: var(--brass-hi); }
.btn--danger { background: transparent; color: var(--reef); border-color: rgba(224,115,95,.35); }
.btn--danger:hover { background: var(--reef-soft); }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--paper-3); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.link:hover { color: var(--paper); }
.count { font-family: var(--mono); font-size: 12px; color: var(--brass); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.field { display: inline-flex; align-items: center; gap: 8px; }
.field--search { position: relative; }
.field--search svg { position: absolute; left: 11px; width: 16px; height: 16px; fill: none; stroke: var(--paper-4); stroke-width: 1.8; }
input, select, textarea { background: var(--well); color: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-sm); font: 400 15px var(--sans); padding: 0 12px; height: 36px; }
textarea { height: auto; padding: 10px 12px; resize: vertical; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--paper-4); }
.field--search input { padding-left: 34px; width: 260px; }
.field--select span { color: var(--paper-3); font-size: 14px; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--paper-3) 50%), linear-gradient(135deg, var(--paper-3) 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=number] { font-family: var(--mono); }
input[type=datetime-local] { font-family: var(--mono); font-size: 14px; }
.field--stack { flex-direction: column; align-items: stretch; gap: 6px; }
.field--stack > span { font-size: 14px; color: var(--paper-3); }
.field--stack small { color: var(--paper-4); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 0 12px; height: 34px; cursor: pointer; color: var(--paper-3); font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.is-on { background: var(--ink-3); color: var(--paper); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--paper-2); user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle span { width: 30px; height: 18px; border-radius: 99px; background: var(--ink-3); border: 1px solid var(--line-2); position: relative; transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper-3); transition: transform .18s var(--ease), background .15s; }
.toggle input:checked + span { background: var(--brass-soft); border-color: rgba(201,164,92,.45); }
.toggle input:checked + span::after { transform: translateX(12px); background: var(--brass); }
.toggle input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }

.dropdown { position: relative; }
.dropdown__panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 250px; background: var(--ink-3); border: 1px solid var(--line-3); border-radius: var(--r-md); padding: var(--s-2); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.dropdown__panel label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 15px; }
.dropdown__panel label:hover { background: var(--ink-2); }
.dropdown__panel input { height: auto; accent-color: var(--brass); }
.dropdown__panel .dd-actions { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 8px 2px; font-size: 13px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--ink-1); }
.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th { position: sticky; top: 0; background: var(--ink-1); text-align: right; font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--paper-4); padding: 12px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.grid td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; }
.grid th.l, .grid td.l { text-align: left; }
.grid th:first-child, .grid td:first-child { padding-left: 16px; }
.grid th:last-child, .grid td:last-child { padding-right: 16px; }
.grid td.sans { font-family: var(--sans); font-size: 15px; }
.grid tbody tr.row { cursor: pointer; transition: background .12s; }
.grid tbody tr.row:hover { background: rgba(255,255,255,.018); }
.grid tbody tr.row.is-open { background: var(--ink-2); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th.hist { color: var(--paper-3); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: var(--s-3) var(--s-1); color: var(--paper-4); font-size: 14px; }
.empty { padding: var(--s-7) var(--s-4); text-align: center; color: var(--paper-3); font-family: var(--sans); }

.asset { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-weight: 600; font-size: 15px; }
.tag { font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--paper-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; }
.tag--closed { color: var(--fog); border-color: rgba(127,147,176,.35); }
.tag--swap { color: var(--brass); border-color: rgba(201,164,92,.35); }

.legs { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 14px; }
.venue { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--ink-3); border: 1px solid var(--line); color: var(--paper); }
.venue i { font-style: normal; font-family: var(--mono); font-size: 11px; font-weight: 600; }
.venue--long i { color: var(--tide); }
.venue--short i { color: var(--reef); }
.legs .arrow { color: var(--paper-4); }

.v-pos { color: var(--tide); }
.v-neg { color: var(--reef); }
.v-zero { color: var(--paper-3); }
.v-big { font-size: 16px; font-weight: 600; }
.v-partial { text-decoration: underline dashed var(--paper-4); text-underline-offset: 4px; }
.v-none { color: var(--paper-4); }

/* signature: balanza de patas */
.balance { display: block; width: 150px; height: 18px; }
.balance .axis { stroke: var(--line-3); stroke-width: 1; }
.balance .seg-l { opacity: .55; }
.balance .net { stroke: var(--paper); stroke-width: 2; }
.balance--lg { width: 100%; height: 34px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 6px 0 14px; }
.dot--pay { background: var(--reef); margin-left: 0; }
.dot--earn { background: var(--tide); }
.legend { color: var(--paper-4); font-size: 14px; margin: var(--s-2) 0 0; }

/* ---------- detail ---------- */
.detail-row > td { padding: 0 !important; background: var(--ink-2); white-space: normal; text-align: left; font-family: var(--sans); }
.detail { padding: var(--s-5); display: grid; gap: var(--s-5); animation: open .22s var(--ease); }
@keyframes open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-4); }
.detail__title { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.detail__title small { display: block; font-size: 15px; font-weight: 400; color: var(--paper-3); margin-top: 2px; }
.detail__cols { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: var(--s-4); }
.panel { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4); }
.panel h3 { margin: 0 0 var(--s-3); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--paper-3); font-weight: 600; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: var(--s-3); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--paper-2); }
.steps li::before { content: counter(s); font-family: var(--mono); font-size: 12px; color: var(--brass); border: 1px solid rgba(201,164,92,.4); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; margin-top: 1px; }
.steps b { color: var(--paper); font-weight: 600; }
.steps .warn { color: var(--fog); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--paper-3); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--line-2); padding-top: 8px; font-weight: 600; }
.sim-input { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s-3); }
.sim-input input { width: 130px; }
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: right; color: var(--paper-4); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
.mini td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mini th:first-child, .mini td:first-child { text-align: left; font-family: var(--sans); }
.mini tr.is-leg td:first-child { color: var(--brass); }
.chart-box { position: relative; height: 240px; }
.chart-note { font-size: 14px; color: var(--paper-4); margin: var(--s-2) 0 0; }
.oi-bar { display: grid; grid-template-columns: 130px 1fr 80px; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.oi-bar .track { height: 6px; background: var(--ink-3); border-radius: 3px; overflow: hidden; }
.oi-bar .fill { height: 100%; background: var(--paper-4); border-radius: 3px; }
.oi-bar.is-leg .fill { background: var(--brass); }
.oi-bar .val { font-family: var(--mono); text-align: right; color: var(--paper-2); }

/* ---------- matrix ---------- */
.matrix td.cell { font-size: 13px; }
.matrix td.cell span { display: inline-block; min-width: 64px; padding: 3px 6px; border-radius: 4px; }
.matrix td.asset-cell { font-family: var(--sans); font-weight: 600; text-align: left; position: sticky; left: 0; background: var(--ink-1); }
.matrix td.range { color: var(--brass); }

/* ---------- journal ---------- */
.ledger { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--ink-1); }
.ledger > div { padding: var(--s-4) var(--s-4); border-right: 1px solid var(--line); }
.ledger > div:last-child { border-right: 0; }
.ledger dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--paper-4); margin-bottom: 6px; }
.ledger dd { margin: 0; font-family: var(--mono); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ledger dd small { display: block; font-size: 12px; color: var(--paper-4); font-weight: 400; margin-top: 2px; font-family: var(--sans); }
.trades { display: grid; gap: var(--s-3); }
.trade { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-3); }
.trade__head { display: grid; grid-template-columns: 1fr auto; gap: var(--s-4); align-items: center; }
.trade__name { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.trade__meta { color: var(--paper-3); font-size: 14px; margin-top: 2px; }
.trade__nums { display: flex; gap: var(--s-5); text-align: right; }
.trade__nums div { display: grid; gap: 2px; }
.trade__nums em { font-style: normal; font-size: 12px; color: var(--paper-4); text-transform: uppercase; letter-spacing: .06em; }
.trade__nums b { font-family: var(--mono); font-weight: 500; font-size: 17px; }
.trade__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; font-size: 14px; color: var(--paper-3); }
.trade__actions { display: flex; gap: 6px; }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--reef-soft); color: var(--reef); }
.flag--info { background: var(--brass-soft); color: var(--brass-hi); }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.bars .oi-bar { grid-template-columns: 110px 1fr 90px; }
.watch { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.watch:last-of-type { margin-bottom: var(--s-3); }

/* ---------- modal ---------- */
.modal { border: 1px solid var(--line-3); border-radius: var(--r-lg); background: var(--ink-2); color: var(--paper); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.modal--wide { width: min(1080px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(4,6,10,.7); backdrop-filter: blur(3px); }
.modal__body { padding: var(--s-5); display: grid; gap: var(--s-4); max-height: calc(100vh - 64px); overflow: auto; }
.modal__body--narrow { max-width: 420px; }
.modal__body h2 { margin: 0; }
.modal__actions { display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; }
.modal__actions .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); }
.sub { margin: var(--s-2) 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--paper-3); }
.legs-edit { display: grid; gap: var(--s-2); }
.leg-edit { display: grid; grid-template-columns: 1.2fr 1fr .9fr repeat(4, 1fr) 36px; gap: 8px; align-items: end; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-1); }
.leg-edit .more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.leg-edit label span { font-size: 12px; }
.leg-edit input, .leg-edit select { width: 100%; height: 34px; font-size: 14px; }
.leg-edit .rm { height: 34px; width: 34px; justify-content: center; padding: 0; }
.form-error { color: var(--reef); margin: 0; font-size: 15px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink-3); border: 1px solid var(--line-3); padding: 10px 18px; border-radius: var(--r-md); font-size: 15px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ---------- numeric filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); margin: calc(-1 * var(--s-1)) 0 var(--s-4); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-1); }
.nf { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--paper-3); }
.nf input { width: 96px; height: 32px; font-size: 14px; }
.nf em { font-style: normal; color: var(--paper-4); }
.v-thin { opacity: .5; }

/* ---------- leg chips, logos, token icons ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; font-family: var(--sans); font-size: 13.5px; font-weight: 500; border: 1px solid; white-space: nowrap; }
.chip--long { color: var(--tide); background: var(--tide-soft); border-color: rgba(92,195,157,.35); }
.chip--short { color: var(--reef); background: var(--reef-soft); border-color: rgba(224,115,95,.35); }
.exlogo { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); padding: 1px; object-fit: contain; flex: none; }
.tokicon { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; background: var(--ink-3); }
.tokicon--letter { display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-0); background: hsl(var(--h, 40) 45% 68%); }
.th-dot { margin-right: 6px; }
.grid th .dot { margin: 0 6px 0 0; }
.simbtn { background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 9px; cursor: pointer; font: 500 14px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: auto; display: block; }
.simbtn small { font-size: 11px; color: var(--paper-4); margin-left: 2px; font-family: var(--sans); }
.simbtn:hover { border-color: var(--brass); background: var(--ink-3); }
.iconbtn { width: 32px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--ink-2); cursor: pointer; }
.iconbtn svg { width: 17px; height: 17px; fill: none; stroke: var(--paper-2); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn:hover { border-color: var(--brass); }
.iconbtn:hover svg { stroke: var(--brass-hi); }
.iconbtn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.simbtn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- chart modal ---------- */
.modal--chart { width: min(980px, calc(100vw - 32px)); }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-4); }
.chart-head h2 { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-3); }
.chart-head .seg button.is-on { background: var(--brass); color: #15110a; font-weight: 600; }
.cpanel { background: var(--ink-1); border: 1px solid var(--line); border-left: 3px solid var(--line-3); border-radius: var(--r-md); padding: var(--s-4); display: grid; gap: var(--s-2); }
.cpanel--tide { border-left-color: var(--tide); }
.cpanel--brass { border-left-color: var(--brass); }
.cpanel--fog { border-left-color: var(--fog); }
.cpanel--paper { border-left-color: var(--paper-3); }
.cpanel h3 { margin: 0; font-size: 16px; font-weight: 600; }
.cpanel p { margin: 0; color: var(--paper-2); font-size: 15px; }
.cpanel__sub { color: var(--paper-3) !important; font-size: 14px !important; }
.cpanel__lead { color: var(--paper) !important; }
.cpanel .warn { color: var(--fog); }
.cpanel .chart-box { background: var(--well); border-radius: var(--r-sm); padding: var(--s-2); height: 230px; }
.pills { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 12px; letter-spacing: .06em; color: var(--paper-3); font-weight: 600; }
.pill b { font-family: var(--mono); font-size: 14px; letter-spacing: 0; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--paper-3); }
.pill--long::before { background: var(--tide); }
.pill--short::before { background: var(--reef); }
.pill--net::before { background: var(--brass); }
.oicards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-2); }
.oicard { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--s-3); display: grid; gap: 6px; background: var(--ink-2); }
.oicard--long { border-color: rgba(92,195,157,.45); background: linear-gradient(var(--tide-soft), var(--tide-soft)), var(--ink-2); }
.oicard--short { border-color: rgba(224,115,95,.45); background: linear-gradient(var(--reef-soft), var(--reef-soft)), var(--ink-2); }
.oicard__top { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; }
.oicard__top em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; }
.oicard--long em { color: var(--tide); background: var(--tide-soft); }
.oicard--short em { color: var(--reef); background: var(--reef-soft); }
.oicard b { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.oicard .track { height: 4px; background: var(--ink-3); border-radius: 2px; overflow: hidden; }
.oicard .fill { height: 100%; background: var(--paper-4); }
.oicard--long .fill { background: var(--tide); }
.oicard--short .fill { background: var(--reef); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: var(--s-4) var(--s-5); display: flex; justify-content: space-between; gap: var(--s-4); color: var(--paper-4); font-size: 14px; max-width: 1640px; width: 100%; margin: 0 auto; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .detail__cols { grid-template-columns: 1fr; }
  .ledger { grid-template-columns: repeat(4, 1fr); }
  .ledger > div:nth-child(4) { border-right: 0; }
  .ledger > div:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .leg-edit { grid-template-columns: 1fr 1fr 1fr; }
  .leg-edit .more { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .bar__inner { flex-wrap: wrap; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
  .clocks { order: 3; margin-left: 0; width: 100%; }
  .sync { margin-left: auto; }
  .page { padding: var(--s-5) var(--s-4) var(--s-6); }
  .view__head { flex-direction: column; align-items: stretch; }
  .field--search input { width: 100%; }
  .field--search { width: 100%; }
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .trade__head { grid-template-columns: 1fr; }
  .trade__nums { justify-content: space-between; text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
  .foot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================================
   ESTILO 2 — refinements on top of the original palette (Estilo 1 is frozen in
   themes/estilo1.css). Same tokens and identity; more depth and reading comfort.
   ===================================================================================== */
.table-wrap, .panel, .trade, .pcard, .ledger__hero > div, .cpanel, .filters {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .028);
}
.bar { border-bottom-color: var(--line-2); }
.bar__inner { padding-top: 14px; padding-bottom: 14px; }

/* row focus: a thin brass rail instead of a flat background change */
.grid tbody tr.row td:first-child { transition: box-shadow .15s var(--ease); }
.grid tbody tr.row:hover td:first-child,
.grid tbody tr.row.is-open td:first-child { box-shadow: inset 2px 0 0 var(--brass); }
.grid tbody tr.row.is-open { background: var(--ink-2); }
.v-big { font-size: 17px; }

/* section titles read as ledger rulings */
.section-title { display: flex; align-items: baseline; gap: var(--s-3); }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(-4px); }

/* the radar header stays visible while scrolling a long table (wide screens only,
   where the table fits without horizontal scroll) */
@media (min-width: 1380px) {
  #view-radar .table-wrap { overflow: visible; }
  #radar-table thead th { position: sticky; top: 64px; z-index: 5; background: var(--ink-1); }
  #radar-table thead tr:first-child th { top: 64px; }
  #radar-table thead tr:nth-child(2) th { top: 90px; }
}

.pcard { background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); }
.pcard__v { font-size: 28px; }
.trade { padding: var(--s-5); }
.trade__name { font-size: 20px; }
