/* ===== Treasury panel — "Statement" theme =====
   A private-bank statement rendered for screen: white paper, navy ink, one blue
   accent, hairline rules carrying the structure.

   Token NAMES are unchanged from the previous dark theme on purpose — every
   page reads them, so re-theming is a change of values, not a rename. The
   semantic names (--profit / --loss / --amber) still mean gain, loss and hold;
   they are simply no longer neon. */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:wght@500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #FFFFFF;
    --panel: #FFFFFF;
    --panel-2: #FFFFFF;
    --wash: #F4F8FC;          /* tinted fill for insets and table heads */
    --line: #E2EAF3;
    --ink: #0B2038;           /* the near-navy of the reference wordmark */
    --muted: #5C7186;
    --info: #1B7FC4;          /* the accent bar's blue — links, live state */
    --info-deep: #12568F;
    --info-wash: #EAF3FB;
    --profit: #0B7A57;
    --profit-dim: #6FA893;
    --amber: #9A6700;
    --loss: #B3261E;
    --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --display: 'IBM Plex Serif', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding-bottom: 3rem;
    -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; border-radius: 4px; }

/* ---------- Ticker tape ---------- */
.ticker {
    width: 100%; border-bottom: 1px solid var(--line);
    background: var(--wash);
    overflow: hidden; white-space: nowrap;
    font-family: var(--mono); font-size: .78rem; letter-spacing: .04em;
}
.ticker__track { display: inline-block; padding: .55rem 0; animation: marquee 32s linear infinite; }
.ticker__track span { padding: 0 1.6rem; color: var(--muted); }
.ticker__track b { color: var(--profit); font-weight: 600; }
.ticker__track .dn { color: var(--loss); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Top bar ---------- */
.topbar {
    width: 100%; max-width: 1000px; padding: 1.1rem 1.25rem;
    display: flex; justify-content: space-between; align-items: center;
}
.brand { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; font-size: 1.15rem; display: flex; align-items: center; gap: .55rem; }
.brand .mark { width: 4px; height: 22px; border-radius: 2px; background: var(--info); display: inline-block; }
.brand .brand-name { color: var(--ink); }
.brand small { color: var(--muted); font-weight: 500; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); }
/* A logo is art, not a boxed thumbnail: no plaque, no radius, no crop — just
   let it run to its own width at a fixed cap height so it optically matches the
   typeset lockup it replaces. */
.brand .brand-logo { height: 32px; width: auto; max-width: 210px; display: block; }
/* Standing alone, the logo carries the brand, so the panel label needs a rule
   of its own to read as a separate word rather than part of the mark. */
.brand.has-logo { gap: .75rem; }
.brand.has-logo small { padding-left: .75rem; border-left: 1px solid var(--line); line-height: 1.6; }
input[type=file] { display: block; width: 100%; color: var(--muted); font-family: var(--mono); font-size: .82rem; margin-top: .2rem; }
input[type=file]::file-selector-button { margin-right: .8rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: var(--wash); color: var(--ink); font-family: var(--sans); font-size: .8rem; cursor: pointer; }
.nav { display: flex; align-items: center; gap: 1rem; }
.nav .who { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.nav a { color: var(--muted); text-decoration: none; font-size: .85rem; }
.nav a:hover { color: var(--ink); }
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--ink); }
button.green { background: var(--info); color: #fff; }

/* ---------- Cards / panels ---------- */
.wrap { width: 100%; max-width: 1000px; padding: 0 1.25rem; }
.card {
    background: var(--panel);
    border: 1px solid var(--line); border-radius: 10px;
    padding: 1.4rem; margin-bottom: 1.1rem;
}
.card.narrow { max-width: 420px; margin: 12vh auto 0; box-shadow: 0 1px 2px rgba(11,32,56,.04), 0 12px 32px rgba(11,32,56,.06); }
h1 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; margin-bottom: 1rem; letter-spacing: -.01em; }
h2 { font-family: var(--sans); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; font-weight: 600; }

/* ---------- Hero: the balance readout ----------
   The accent bar is the page's one signature. It marks a figure the reader can
   rebuild from the transactions themselves, so it is never applied decoratively
   — see .recon__row.total and .verify in dashboard.css for its other two uses. */
.hero { position: relative; }
.hero__grid { display: none; }
.hero__head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
.hero__label { font-family: var(--sans); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.live { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; color: var(--info); display: flex; align-items: center; gap: .45rem; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--info); }

.readout {
    position: relative; margin: 1rem 0 .3rem; padding-left: 1.1rem;
    font-family: var(--display); font-weight: 600; line-height: 1;
    color: var(--ink); font-variant-numeric: tabular-nums;
}
.readout::before {
    content: ''; position: absolute; left: 0; top: .08em; bottom: .18em;
    width: 3px; border-radius: 2px; background: var(--info);
}
.readout .int { font-size: clamp(2.8rem, 10vw, 5rem); letter-spacing: -.02em; }
.readout .dec { font-size: clamp(1.3rem, 4.5vw, 2.2rem); color: var(--muted); }
.readout .unit { font-family: var(--sans); font-weight: 500; font-size: .85rem; color: var(--muted); letter-spacing: .1em; margin-left: .55rem; vertical-align: super; }
.rate { position: relative; font-family: var(--mono); font-size: .82rem; color: var(--profit); display: inline-flex; align-items: center; gap: .4rem; }
.rate .arrow { color: var(--profit); }

.meta { position: relative; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.meta .k { font-family: var(--sans); font-size: .7rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.meta .v { font-family: var(--mono); font-size: .9rem; color: var(--ink); }

/* ---------- Forms ---------- */
.redeem { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-top: 1.3rem; }
.field { flex: 1; min-width: 200px; }
label { display: block; font-family: var(--sans); font-weight: 600; font-size: .7rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .45rem; }
input[type=text], input[type=password], input[type=number], input[type=url], select {
    width: 100%; padding: .75rem .85rem; border-radius: 7px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-family: var(--mono); font-size: .95rem;
}
input::placeholder { color: #9BAABB; }
select {
    appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 1.1rem center, right .85rem center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
select option { background: #fff; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px var(--info-wash); }

button {
    padding: .72rem 1.4rem; border: 1px solid transparent; border-radius: 7px; cursor: pointer;
    font-family: var(--sans); font-weight: 600; font-size: .9rem; letter-spacing: .005em;
    background: var(--info); color: #fff;
    transition: background .15s, border-color .15s, color .15s;
}
button:hover { background: var(--info-deep); }
button:active { transform: translateY(1px); }
button.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
button.ghost:hover { background: var(--wash); border-color: var(--info); color: var(--info-deep); }
button.small { padding: .45rem .9rem; font-size: .8rem; border-radius: 6px; }
button.danger { background: var(--loss); color: #fff; }
button.danger:hover { background: #8E1D17; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: var(--info); }
button.ghost:disabled:hover { background: #fff; }

/* ---------- Alerts ---------- */
.err, .ok { border-radius: 7px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .88rem; border-left: 3px solid; }
.err { background: #FDF3F2; border-color: var(--loss); color: #8E1D17; }
.ok  { background: #EFF8F4; border-color: var(--profit); color: #0A5C42; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--sans); color: var(--muted); font-weight: 600; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
td { font-family: var(--mono); color: var(--ink); }
td.amt { color: var(--ink); font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--wash); }
tr:last-child td { border-bottom: 0; }

.tag { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: 4px; font-size: .7rem; font-weight: 600; font-family: var(--sans); letter-spacing: .02em; }
.tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.pending    { background: #FDF6E7; color: var(--amber); }
.tag.processing { background: var(--info-wash); color: var(--info-deep); }
.tag.sent       { background: #EFF8F4; color: var(--profit); }
.tag.failed     { background: #FDF3F2; color: var(--loss); }

.muted { color: var(--muted); font-size: .85rem; }
code { font-family: var(--mono); background: var(--wash); border: 1px solid var(--line); padding: .1rem .4rem; border-radius: 4px; font-size: .8rem; word-break: break-all; }
a.link, a { color: var(--info-deep); text-decoration: none; }
a.link:hover, a:hover { text-decoration: underline; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ---------- Login/register ---------- */
.balance { font-family: var(--display); font-weight: 600; font-size: 2rem; color: var(--ink); font-variant-numeric: tabular-nums; margin: .5rem 0; }

/* ---------- Admin console ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.05rem;
}
.stat::after { display: none; }
.stat .k { font-family: var(--sans); font-weight: 600; font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--mono); font-weight: 600; font-size: 1.5rem; margin-top: .4rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat .sub { font-family: var(--sans); font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.stat.accent { border-left: 3px solid var(--info); }
.stat.accent .v { color: var(--ink); }
.stat.warn   .v { color: var(--amber); }
.stat.info   .v { color: var(--info-deep); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.1rem; }
.grid2 .card { margin-bottom: 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.sec-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.sec-head h2 { margin: 0; }
.count-badge { font-family: var(--mono); font-size: .7rem; padding: .1rem .45rem; border-radius: 4px;
    background: var(--wash); border: 1px solid var(--line); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.chip { font-family: var(--mono); font-size: .72rem; padding: .26rem .55rem; border-radius: 5px;
    background: var(--wash); border: 1px solid var(--line); color: var(--ink); }
.chip b { color: var(--info-deep); font-weight: 600; }
.chip.off b { color: var(--muted); }

.btnrow { display: flex; gap: .4rem; flex-wrap: wrap; }
.swapmeta { font-family: var(--sans); font-size: .75rem; line-height: 1.55; color: var(--muted); }
.notice { display: flex; align-items: center; gap: .6rem; font-size: .84rem;
    background: #FDF6E7; border-left: 3px solid var(--amber); color: #7A5200;
    padding: .7rem .9rem; border-radius: 7px; margin-bottom: 1.1rem; }
.notice .d { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }

@media (max-width: 560px) {
    .topbar { flex-direction: column; gap: .6rem; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    .ticker__track { animation: none; }
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
