/* AgroFlow Terminal — base: reset, shell layout, components, motion (SHARED)
   View-specific styles live in static/css/views/<id>.css scoped under .view-<id>. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-ui); font-size: var(--fs); line-height: var(--lh); color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg, canvas { display: block; max-width: 100%; }
canvas { max-width: none; }
table { border-collapse: collapse; border-spacing: 0; }
kbd { font-family: var(--font-mono); font-size: 10px; }
code, .mono, .num, .tbl td.num, .tbl th.num, .kpi .val, .price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
::selection { background: rgba(var(--accent-rgb), .3); }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .7); outline-offset: 2px; border-radius: var(--r-sm); }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); background-clip: padding-box; border: 2px solid transparent; }
[data-theme="light"] * { scrollbar-color: rgba(15,23,42,.2) transparent; }
[data-theme="light"] *::-webkit-scrollbar-thumb { background: rgba(15,23,42,.18); background-clip: padding-box; border: 2px solid transparent; }

/* ---------- background: layered radial gradients + aurora ---------- */
.bg-fx {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1200px 600px at 8% -10%, rgba(var(--accent-rgb), .10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(var(--info-rgb), .08), transparent 60%),
    radial-gradient(800px 600px at 60% 110%, rgba(var(--up-rgb), .06), transparent 60%),
    var(--bg);
}
.bg-fx::before, .bg-fx::after {
  content: ""; position: absolute; width: 60vw; height: 60vw; border-radius: 50%; filter: blur(80px); opacity: .18;
  background: conic-gradient(from 0deg, rgba(var(--accent-rgb), .9), rgba(var(--info-rgb), .6), rgba(var(--up-rgb), .6), rgba(var(--accent-rgb), .9));
  animation: aurora 40s linear infinite;
}
.bg-fx::before { top: -30vw; left: -20vw; }
.bg-fx::after { bottom: -35vw; right: -20vw; animation-direction: reverse; animation-duration: 55s; opacity: .12; }
[data-theme="light"] .bg-fx::before, [data-theme="light"] .bg-fx::after { opacity: .10; }
@keyframes aurora { from { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(1.15); } to { transform: rotate(360deg) scale(1); } }

/* ---------- app shell ---------- */
body.app { overflow: hidden; height: 100vh; height: 100dvh; }
.shell {
  position: relative; z-index: 1; height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto var(--header-h) var(--ticker-h) 1fr var(--footer-h);
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "banner banner" "header header" "ticker ticker" "sidebar main" "footer footer";
  transition: grid-template-columns var(--dur) var(--ease);
}
body.sidebar-collapsed .shell { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.demo-banner {
  grid-area: banner; display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  padding: 6px var(--sp-4); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .02em;
  background: var(--grad); color: var(--accent-ink);
}
.demo-banner a { text-decoration: underline; }

/* header */
.hdr {
  grid-area: header; display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-3) 0 var(--sp-4);
  background: var(--panel); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: calc(var(--sidebar-w) - var(--sp-4)); }
.brand img, .brand svg { width: 28px; height: 28px; }
.brand .name { font-weight: 700; font-size: var(--fs-md); letter-spacing: -.01em; }
.brand .name span { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .tag { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); margin-left: 4px; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; }
.hdr-mid { flex: 1; display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hdr-right { display: flex; align-items: center; gap: var(--sp-2); }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; color: var(--text-2); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 0 rgba(var(--up-rgb), .5); }
.live.on .dot { background: var(--up); animation: livepulse 1.8s ease-out infinite; }
.live.on { color: var(--up); }
.live.idle .dot { background: var(--text-2); }
.live.idle { color: var(--text-2); }
.live.off .dot { background: var(--down); }
.live.off { color: var(--down); }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(var(--up-rgb), .55); } 70% { box-shadow: 0 0 0 7px rgba(var(--up-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--up-rgb), 0); } }

.mkt-state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; border: 1px solid var(--border-strong); color: var(--text-2); white-space: nowrap; }
.mkt-state.open { color: var(--up); border-color: rgba(var(--up-rgb), .4); background: rgba(var(--up-rgb), .08); }
.mkt-state.pre { color: var(--warn); border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .08); }
.mkt-state.closed { color: var(--text-3); }
.mkt-state small { font-weight: 500; color: var(--text-3); letter-spacing: 0; }

.clocks { display: flex; gap: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.clocks b { color: var(--text-3); font-weight: 600; margin-right: 4px; }

.btn-cmd { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 10px; border-radius: var(--r); border: 1px solid var(--border-strong); background: rgba(255,255,255,.03); color: var(--text-2); font-size: var(--fs-sm); transition: border-color var(--dur-fast), background var(--dur-fast); }
.btn-cmd:hover { border-color: var(--border-glow); color: var(--text); background: rgba(255,255,255,.05); }
.btn-cmd kbd { padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-3); }
.btn-cmd svg { width: 14px; height: 14px; }

.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 4px; border-radius: var(--r-pill); border: 1px solid transparent; transition: border-color var(--dur-fast), background var(--dur-fast); }
.user-btn:hover, .user-menu.open .user-btn { border-color: var(--border-strong); background: rgba(255,255,255,.04); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--grad); }
.user-btn .uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.user-dd { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 6px; border-radius: var(--r-lg); background: var(--panel-2); backdrop-filter: blur(var(--blur)); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--dur-fast), transform var(--dur-fast); z-index: 60; }
.user-menu.open .user-dd { opacity: 1; transform: none; pointer-events: auto; }
.user-dd .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dd .who b { display: block; font-size: var(--fs-sm); }
.user-dd .who span { font-size: var(--fs-xs); color: var(--text-3); }
.user-dd a, .user-dd button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); text-align: left; }
.user-dd a:hover, .user-dd button:hover { background: rgba(255,255,255,.06); color: var(--text); }
.user-dd svg { width: 14px; height: 14px; }
.plan-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(var(--accent-rgb), .15); color: var(--accent); letter-spacing: .04em; }

/* ticker tape */
.ticker { grid-area: ticker; position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.ticker::before, .ticker::after { content: ""; position: absolute; top: 0; bottom: 0; width: 48px; z-index: 2; pointer-events: none; }
.ticker::before { left: 0; background: linear-gradient(90deg, var(--bg-2), transparent); }
.ticker::after { right: 0; background: linear-gradient(270deg, var(--bg-2), transparent); }
.tape { display: flex; width: max-content; height: var(--ticker-h); align-items: center; animation: marquee 60s linear infinite; will-change: transform; }
.ticker:hover .tape { animation-play-state: paused; }
.tape-item { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; height: 100%; border-right: 1px solid var(--border); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; transition: background var(--dur-fast); }
.tape-item:hover { background: rgba(255,255,255,.04); }
.tape-item .sym { font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.tape-item .nm { color: var(--text-3); font-size: var(--fs-xs); }
.tape-item .px { font-family: var(--font-mono); font-variant-numeric: tabular-nums; padding: 1px 4px; border-radius: 4px; }
.tape-item .pc { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.tape-item.empty .px { color: var(--text-3); }
@keyframes marquee { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

/* sidebar */
.sidebar { grid-area: sidebar; position: relative; overflow: hidden auto; padding: 8px 8px; border-right: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
.nav-indicator { position: absolute; left: 0; width: 3px; height: 20px; border-radius: 3px; background: var(--grad); top: 0; transform: translateY(0); transition: transform var(--dur) var(--ease), opacity var(--dur); opacity: 0; box-shadow: 0 0 12px rgba(var(--accent-rgb), .6); }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast); }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-item.active { background: rgba(var(--accent-rgb), .10); color: var(--text); }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item kbd { color: var(--text-3); padding: 1px 4px; border: 1px solid var(--border); border-radius: 4px; }
.nav-sep { height: 1px; margin: 6px 8px; background: var(--border); }
.sidebar-foot { position: sticky; bottom: 0; padding-top: 8px; margin-top: 8px; }
.sidebar-toggle { display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-3); font-size: var(--fs-xs); }
.sidebar-toggle:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidebar-toggle svg { width: 15px; height: 15px; transition: transform var(--dur) var(--ease); }
body.sidebar-collapsed .sidebar { padding: 8px 6px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-item .label, body.sidebar-collapsed .nav-item kbd, body.sidebar-collapsed .sidebar-toggle span { display: none; }
body.sidebar-collapsed .sidebar-toggle { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
body.sidebar-collapsed .brand .name, body.sidebar-collapsed .brand .tag { display: none; }
body.sidebar-collapsed .brand { min-width: calc(var(--sidebar-w-collapsed) - var(--sp-4)); }

/* main + views */
.main { grid-area: main; position: relative; overflow: auto; padding: var(--sp-3); min-width: 0; }
.view { display: none; min-height: 100%; }
/* a view module may set its own display (flex/grid) on .view-<id>; this keeps inactive views hidden regardless */
.view:not(.active) { display: none !important; }
.view.active { display: block; animation: view-enter var(--dur) var(--ease) both; }
@keyframes view-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.view-head h1 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.view-head .sub { color: var(--text-3); font-size: var(--fs-sm); }
.view-head .spacer, .spacer { flex: 1; }
.toolbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* footer / status bar */
.statusbar { grid-area: footer; display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); border-top: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(var(--blur)); white-space: nowrap; overflow: hidden; }
.statusbar .src-chips { display: flex; gap: 4px; }
.src-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--border); color: var(--text-3); }
.src-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); }
.src-chip.ok { color: var(--up); border-color: rgba(var(--up-rgb), .3); }
.src-chip.ok::before { background: var(--up); }
.src-chip.err { color: var(--down); border-color: rgba(var(--down-rgb), .3); }
.src-chip.err::before { background: var(--down); }
.statusbar .ticks { font-family: var(--font-mono); color: var(--text-2); }
.statusbar .ticks b { color: var(--accent); font-weight: 700; }
.statusbar .sources { color: var(--text-3); }
.statusbar .ver { margin-left: auto; font-family: var(--font-mono); }

/* ---------- panels ---------- */
.panel { position: relative; background: var(--panel); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur); min-width: 0; }
.panel.lift:hover, .card.lift:hover { transform: translateY(-1px); border-color: var(--border-glow); box-shadow: var(--shadow), 0 0 0 1px rgba(var(--accent-rgb), .12); }
.panel-head { display: flex; align-items: center; gap: var(--sp-2); padding: 8px 12px; border-bottom: 1px solid var(--border); min-height: 36px; }
.panel-head h3, .panel-head .title { font-size: var(--fs-sm); font-weight: 600; letter-spacing: .01em; }
.panel-head .code { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; background: rgba(var(--accent-rgb), .12); color: var(--accent); text-transform: uppercase; }
.panel-head .spacer { flex: 1; }
.panel-head .meta { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); }
.panel-body { padding: 12px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 8px 12px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-3); transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur); }

/* ---------- grids ---------- */
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.mt { margin-top: var(--sp-3); } .mb { margin-bottom: var(--sp-3); }
.muted { color: var(--text-3); } .dim { color: var(--text-2); }
.small { font-size: var(--fs-xs); }
.up { color: var(--up) !important; } .down { color: var(--down) !important; } .flat { color: var(--flat) !important; }
.accent { color: var(--accent); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; max-height: 100%; }
.tbl { width: 100%; font-size: var(--fs-sm); }
.tbl th, .tbl td { height: var(--row-h); padding: 0 var(--cell-px); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-solid); color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; cursor: default; user-select: none; }
.tbl thead th.sortable { cursor: pointer; }
.tbl thead th.sortable:hover { color: var(--text); }
.tbl thead th .sort::after { content: "↕"; margin-left: 4px; opacity: .5; }
.tbl thead th.asc .sort::after { content: "↑"; opacity: 1; color: var(--accent); }
.tbl thead th.desc .sort::after { content: "↓"; opacity: 1; color: var(--accent); }
.tbl tbody tr { transition: background var(--dur-fast); }
.tbl.zebra tbody tr:nth-child(even) { background: rgba(255,255,255,.015); }
.tbl tbody tr:hover { background: rgba(255,255,255,.045); }
.tbl tbody tr.selected { background: rgba(var(--accent-rgb), .10); box-shadow: inset 2px 0 0 var(--accent); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl td.sym { font-weight: 700; font-family: var(--font-mono); letter-spacing: .02em; }
.tbl td.dim { color: var(--text-3); }
.tbl tr.group-row td { background: var(--bg-3); color: var(--accent); font-weight: 700; font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; }

/* row flash (bg pulse + text color) */
@keyframes flash-up { 0% { background-color: rgba(var(--up-rgb), .35); color: var(--up); } 100% { background-color: transparent; } }
@keyframes flash-down { 0% { background-color: rgba(var(--down-rgb), .35); color: var(--down); } 100% { background-color: transparent; } }
.flash-up { animation: flash-up var(--flash-ms) ease-out; }
.flash-down { animation: flash-down var(--flash-ms) ease-out; }
tr.flash-up > td { animation: flash-up var(--flash-ms) ease-out; }
tr.flash-down > td { animation: flash-down var(--flash-ms) ease-out; }
@keyframes roll { 0% { opacity: 0; transform: translateY(-40%); filter: blur(1px); } 100% { opacity: 1; transform: none; filter: none; } }
.roll { display: inline-block; animation: roll 260ms var(--ease-out); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: rgba(255,255,255,.04); color: var(--text); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur); }
.btn:hover { background: rgba(255,255,255,.08); border-color: var(--border-glow); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--grad); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 16px rgba(var(--accent-rgb), .25); }
.btn.primary:hover { box-shadow: 0 6px 24px rgba(var(--accent-rgb), .4); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(255,255,255,.06); color: var(--text); }
.btn.danger { color: var(--down); border-color: rgba(var(--down-rgb), .35); }
.btn.danger:hover { background: rgba(var(--down-rgb), .12); }
.btn.sm { height: 26px; padding: 0 9px; font-size: var(--fs-xs); }
.btn.lg { height: 42px; padding: 0 22px; font-size: var(--fs-md); border-radius: var(--r); }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* chips (toggle filters) */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); background: transparent; cursor: pointer; user-select: none; transition: all var(--dur-fast); }
.chip:hover { color: var(--text); border-color: var(--border-glow); }
.chip.active, .chip[aria-pressed="true"] { background: rgba(var(--accent-rgb), .16); color: var(--accent); border-color: rgba(var(--accent-rgb), .5); }
.chip .cnt { font-family: var(--font-mono); opacity: .7; }
.chip.up.active { background: rgba(var(--up-rgb), .14); color: var(--up); border-color: rgba(var(--up-rgb), .4); }
.chip.down.active { background: rgba(var(--down-rgb), .14); color: var(--down); border-color: rgba(var(--down-rgb), .4); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs .tab { position: relative; height: 34px; padding: 0 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur-fast); }
.tabs .tab:hover { color: var(--text-2); }
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs.pill { border: 0; gap: 4px; padding: 3px; background: rgba(255,255,255,.04); border-radius: var(--r-sm); width: max-content; }
.tabs.pill .tab { height: 26px; border: 0; margin: 0; border-radius: 5px; }
.tabs.pill .tab.active { background: var(--panel-solid); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: view-enter var(--dur) var(--ease) both; }

/* forms */
.input, .select, .textarea { height: 32px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: rgba(0,0,0,.25); color: var(--text); font-size: var(--fs-sm); outline: none; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); min-width: 0; }
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] .textarea { background: #fff; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.input::placeholder { color: var(--text-3); }
.input.sm, .select.sm { height: 26px; font-size: var(--fs-xs); padding: 0 8px; }
.select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%; background-size: 4px 4px; background-repeat: no-repeat; }
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); letter-spacing: .03em; text-transform: uppercase; }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.form-row { display: flex; gap: var(--sp-2); align-items: flex-end; flex-wrap: wrap; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid var(--border-strong); position: relative; transition: background var(--dur-fast); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur) var(--ease), background var(--dur-fast); }
.switch input:checked + .track { background: rgba(var(--accent-rgb), .35); border-color: rgba(var(--accent-rgb), .5); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--accent); }
.search { position: relative; }
.search .input { padding-left: 28px; width: 100%; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--text-3); pointer-events: none; }

/* KPI */
.kpi { padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); min-width: 0; }
.kpi .label { font-size: 10.5px; font-weight: 600; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.kpi .val { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; margin-top: 2px; line-height: 1.2; }
.kpi .val.big { font-size: var(--fs-2xl); }
.kpi .delta { font-family: var(--font-mono); font-size: var(--fs-xs); margin-top: 2px; }
.kpi .sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--border-strong); color: var(--text-2); }
.badge.up { border-color: rgba(var(--up-rgb), .4); background: rgba(var(--up-rgb), .1); }
.badge.down { border-color: rgba(var(--down-rgb), .4); background: rgba(var(--down-rgb), .1); }
.badge.warn { color: var(--warn); border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .1); }
.badge.info { color: var(--info); border-color: rgba(var(--info-rgb), .4); background: rgba(var(--info-rgb), .1); }
.badge.accent { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .1); }
.badge-src { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: var(--text-inverse); background: var(--text-3); cursor: help; }
.badge-src.tv { background: #2962ff; color: #fff; }
.badge-src.yh, .badge-src.yhc { background: #6f42c1; color: #fff; }
.badge-src.aw { background: #0ea5a5; color: #fff; }
.badge-src.bcb { background: #1b6b2f; color: #fff; }
.badge-src.fr { background: #0b5fff; color: #fff; }
.sent { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--flat); }
.sent.bullish { background: var(--up); } .sent.bearish { background: var(--down); }

/* skeleton */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.05); border-radius: var(--r-sm); min-height: 12px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton.line { height: 12px; margin: 6px 0; }
.skeleton.block { height: 120px; }
.skeleton-rows { padding: 8px 12px; }
.skeleton-rows .skeleton.line:nth-child(odd) { width: 92%; } .skeleton-rows .skeleton.line:nth-child(even) { width: 70%; }

/* empty / error states */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.empty svg { width: 28px; height: 28px; opacity: .5; }
.empty.error { color: var(--down); }
.empty .btn { margin-top: 4px; }
.notice { padding: 8px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); border: 1px solid var(--border-strong); background: rgba(255,255,255,.03); }
.notice.warn { border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .08); color: var(--warn); }
.notice.err { border-color: rgba(var(--down-rgb), .4); background: rgba(var(--down-rgb), .08); color: var(--down); }
.notice.ok { border-color: rgba(var(--up-rgb), .4); background: rgba(var(--up-rgb), .08); color: var(--up); }
.notice.info { border-color: rgba(var(--info-rgb), .4); background: rgba(var(--info-rgb), .08); color: var(--info); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: calc(var(--footer-h) + 12px); z-index: 900; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: 380px; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--panel-2); backdrop-filter: blur(var(--blur)); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); animation: toast-in var(--dur-slow) var(--ease-out); border-left: 3px solid var(--info); }
.toast.ok { border-left-color: var(--up); } .toast.warn { border-left-color: var(--warn); } .toast.err { border-left-color: var(--down); } .toast.info { border-left-color: var(--info); }
.toast .msg { flex: 1; }
.toast .msg b { display: block; }
.toast .x { color: var(--text-3); font-size: 16px; line-height: 1; }
.toast .x:hover { color: var(--text); }
.toast.out { animation: toast-out var(--dur) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 800; display: none; }
.modal-root.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 8, .6); backdrop-filter: blur(4px); animation: fade-in var(--dur) both; }
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: modal-in var(--dur-slow) var(--ease-out) both; }
.modal.xl { width: min(1240px, calc(100vw - 32px)); }
.modal.lg { width: min(880px, calc(100vw - 32px)); }
.modal.sm { width: min(400px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: var(--fs-md); font-weight: 700; flex: 1; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- command palette ---------- */
.cmdk-root { position: fixed; inset: 0; z-index: 850; display: none; }
.cmdk-root.open { display: block; }
.cmdk-root .modal-backdrop { background: rgba(3,5,8,.5); }
.cmdk { position: absolute; left: 50%; top: 12vh; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), var(--glow-accent); overflow: hidden; animation: cmdk-in var(--dur-slow) var(--ease-out) both; }
@keyframes cmdk-in { from { opacity: 0; transform: translate(-50%, -8px) scale(.98); } to { opacity: 1; transform: translateX(-50%); } }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 16px; height: 16px; color: var(--text-3); }
.cmdk-input input { flex: 1; height: 48px; background: transparent; border: 0; outline: none; font-size: var(--fs-md); color: var(--text); }
.cmdk-input kbd { padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-3); }
.cmdk-list { max-height: 50vh; overflow: auto; padding: 6px; }
.cmdk-group { padding: 8px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
.cmdk-item svg { width: 15px; height: 15px; flex: none; opacity: .8; }
.cmdk-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cmdk-item .lbl mark { background: transparent; color: var(--accent); font-weight: 700; }
.cmdk-item .hint { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); }
.cmdk-item.active { background: rgba(var(--accent-rgb), .12); }
.cmdk-item .px { font-family: var(--font-mono); font-size: var(--fs-xs); }
.cmdk-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.cmdk-foot kbd { padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; margin-right: 4px; }

/* ---------- context menu ---------- */
.ctx-menu { position: fixed; z-index: 870; min-width: 200px; padding: 5px; border-radius: var(--r); background: var(--panel-2); backdrop-filter: blur(var(--blur)); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: fade-in var(--dur-fast) both; }
.ctx-menu .item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); text-align: left; }
.ctx-menu .item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.ctx-menu .item svg { width: 14px; height: 14px; }
.ctx-menu .sep { height: 1px; margin: 4px 6px; background: var(--border); }
.ctx-menu .head { padding: 6px 10px 4px; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; color: var(--accent); }

/* ---------- chart helpers ---------- */
.chart-box { position: relative; width: 100%; height: 260px; min-height: 120px; }
.chart-box canvas { width: 100%; height: 100%; }
.chart-box.sm { height: 160px; } .chart-box.lg { height: 380px; }
.af-tooltip { position: absolute; z-index: 5; pointer-events: none; padding: 6px 9px; border-radius: var(--r-sm); background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-family: var(--font-mono); font-size: 11px; color: var(--text); white-space: nowrap; opacity: 0; transition: opacity var(--dur-fast); }
.af-tooltip.show { opacity: 1; }
.af-tooltip .t { color: var(--text-3); margin-bottom: 2px; font-size: 10px; }
.af-tooltip .s { display: flex; align-items: center; gap: 6px; }
.af-tooltip .s i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.spark { width: 60px; height: 18px; }

/* ---------- misc animations ---------- */
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.fade-in { animation: fade-in var(--dur) both; }
.slide-in { animation: view-enter var(--dur) var(--ease) both; }
.new-item { animation: new-item 1.2s var(--ease-out) both; }
@keyframes new-item { 0% { background: rgba(var(--accent-rgb), .25); transform: translateY(-4px); opacity: 0; } 30% { opacity: 1; transform: none; } 100% { background: transparent; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.count-up { transition: color var(--dur); }

/* ---------- responsive ---------- */
/* The header is the one row that cannot wrap, so every part of it has to be allowed to shrink. */
.hdr { min-width: 0; overflow: hidden; }
.hdr > * { min-width: 0; }
.brand { min-width: 0; overflow: hidden; }
.hdr-right { flex: 0 0 auto; }

@media (max-width: 1100px) {
  .clocks { display: none; }
  .brand .tag { display: none; }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .nav-item .label, .nav-item kbd, .sidebar-toggle span { display: none; }
  .nav-item, .sidebar-toggle { justify-content: center; padding: 0; }
  .brand .name { display: none; }
  .brand { min-width: 0; }
  .user-btn .uname { display: none; }
}
@media (max-width: 720px) {
  /* The session state also sits at the top of the markets table and in every summary, so the header
     keeps only what is unique to it: connection, search and the account. */
  .mkt-state { display: none; }
  .btn-cmd kbd { display: none; }
  .btn-cmd span { display: none; }
  .btn-cmd { padding: 0 9px; }
  .live .t { display: none; }
  .main { padding: var(--sp-2); }
  .statusbar { gap: var(--sp-2); padding: 0 var(--sp-2); }
  .statusbar .sources, .statusbar .ver { display: none; }
  .view-head h1 { font-size: var(--fs-md); }
  .panel-body { padding: 10px; }
}
/* ---------- phone shell ---------- */
.nav-open-btn, .nav-backdrop { display: none; }
@media (max-width: 720px) {
  .shell, body.sidebar-collapsed .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "banner" "header" "ticker" "main" "footer";
  }
  .hdr { padding: 0 var(--sp-2); gap: var(--sp-2); }
  .brand { min-width: 0; }
  .nav-open-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 38px; height: 38px; margin-right: 2px; border-radius: var(--r-sm); color: var(--text);
  }
  .nav-open-btn:active { background: rgba(255,255,255,.08); }
  .nav-open-btn svg { width: 22px; height: 22px; }
  .sidebar {
    position: fixed; z-index: 900; top: 0; left: 0; bottom: 0; width: min(280px, 82vw);
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
    background: var(--panel-solid); border-right: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
    transform: translateX(-104%); transition: transform var(--dur) var(--ease-out); visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 899; background: rgba(0,0,0,.55); }
  .nav-backdrop[hidden] { display: none; }
  /* the drawer has room for words: undo the icon-only rail of narrow desktops */
  .sidebar .nav-item .label, .sidebar .sidebar-toggle span { display: inline; }
  .sidebar .nav-item kbd { display: none; }
  .sidebar .nav-item, .sidebar .sidebar-toggle { justify-content: flex-start; padding: 0 12px; }
  .sidebar .nav-item { height: 44px; font-size: var(--fs-md); }
  .sidebar .sidebar-toggle span { display: none; }
  .sidebar .sidebar-toggle::after { content: "Fechar menu"; }
  .statusbar { padding-bottom: env(safe-area-inset-bottom); }
  .statusbar #priced-count { display: none; }
  /* iOS zooms the whole page into any field under 16px when it is tapped */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px; }
  .modal, .modal.xl, .modal.lg, .modal.sm { max-height: calc(100dvh - 24px); width: calc(100vw - 16px); }
  .chip { min-height: 30px; }
  .tab { min-height: 38px; }
  /* the 16px rule above loses to .select.sm/.input.sm (two classes): iOS would still zoom on those */
  .select, .select.sm, .input.sm { font-size: 16px; }
  .input.sm, .select.sm { height: 34px; }
  .btn.sm { height: 32px; }
  /* a row of tabs wider than the phone scrolls inside itself instead of pushing the page sideways */
  .tabs:not(.pill) { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs:not(.pill)::-webkit-scrollbar { display: none; }
  .tabs:not(.pill) .tab { flex: none; white-space: nowrap; }
  .tabs.pill { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .badge, .panel-head .code { font-size: 11px; }
  .tbl thead th { font-size: 11px; }
}

@media (max-width: 480px) {
  .demo-banner { font-size: var(--fs-xs); }
  .toasts { left: var(--sp-2); right: var(--sp-2); }
}

/* ---------- interaction polish (shared) ---------- */
/* Panels answer the pointer. No transform by default: shifting a dense table under the cursor is annoying,
   so plain panels only brighten their edge and the .lift class keeps the movement for card layouts. */
.panel:hover { border-color: var(--border-strong); }
.panel:focus-within { border-color: var(--border-glow); }

/* A view's top-level blocks come in one after another, which reads as the screen assembling itself instead
   of appearing all at once. Capped at six steps so navigation never feels slow. */
.view.active > * { animation: view-enter var(--dur) var(--ease-out) both; }
.view.active > *:nth-child(1) { animation-delay: 0ms; }
.view.active > *:nth-child(2) { animation-delay: 40ms; }
.view.active > *:nth-child(3) { animation-delay: 80ms; }
.view.active > *:nth-child(4) { animation-delay: 120ms; }
.view.active > *:nth-child(5) { animation-delay: 160ms; }
.view.active > *:nth-child(n+6) { animation-delay: 190ms; }

/* Hovering a row marks it in the gutter, the way a terminal cursor does, so the eye keeps its place while
   scanning a wide table of numbers. */
.tbl tbody tr.clickable { transition: background var(--dur-fast), box-shadow var(--dur-fast); }
.tbl tbody tr.clickable:hover { box-shadow: inset 2px 0 0 rgba(var(--accent-rgb), .55); }
.tbl tbody tr.selected:hover { box-shadow: inset 2px 0 0 var(--accent); }

/* Pressed feedback on the small controls, which are the ones clicked most. */
.chip:active, .tab:active, .btn-cmd:active, .toggle:active { transform: translateY(1px); }
.chip, .tab { transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .tape { animation: none !important; }
  .bg-fx::before, .bg-fx::after { animation: none !important; }
  .live.on .dot { animation: none !important; box-shadow: 0 0 0 3px rgba(var(--up-rgb), .3); }
  .flash-up, tr.flash-up > td { background-color: rgba(var(--up-rgb), .25) !important; animation: none !important; }
  .flash-down, tr.flash-down > td { background-color: rgba(var(--down-rgb), .25) !important; animation: none !important; }
}

/* ---------- Leaflet: darken light raster tiles to match the terminal ---------- */
.leaflet-dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.55); }
[data-theme="light"] .leaflet-dark-tiles .leaflet-tile-pane { filter: none; }
.leaflet-container { background: var(--bg-3); font: var(--fs-xs) var(--font-ui); }
.leaflet-control-attribution { background: rgba(0, 0, 0, .45) !important; color: var(--text-3) !important; font-size: 9.5px !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
[data-theme="light"] .leaflet-control-attribution { background: rgba(255, 255, 255, .7) !important; }
.leaflet-bar a { background: var(--panel-solid) !important; color: var(--text) !important; border-color: var(--border-strong) !important; }
.leaflet-bar a:hover { background: var(--bg-3) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel-solid) !important; color: var(--text) !important; border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 10px 12px !important; font-size: var(--fs-sm); }
