:root {
  --bg: #0a0e15;
  --panel: #111723;
  --panel-2: #161e2d;
  --panel-3: #1c2638;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #e7ebf3;
  --muted: #8a94a8;
  --faint: #5b6578;
  --accent: #6d8cff;
  --accent-2: #4f6fe8;
  --up: #22c993;
  --down: #ff5d6c;
  --warn: #f5b642;
  --risk: #c084fc;
  --core: #6d8cff;
  --sleeve: #2dd4bf;
  --radius: 12px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-family: Inter, "SF Pro Text", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 13.5px; }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.num, td.n, .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { background: var(--panel-3); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 14px;
  cursor: pointer; font-weight: 550; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: #24304a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.buy { background: var(--up); border-color: var(--up); color: #04150f; }
.btn.sell { background: var(--down); border-color: var(--down); color: #1d0306; }
.btn.danger { color: var(--down); border-color: rgba(255, 93, 108, .4); background: rgba(255, 93, 108, .08); }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; }
.icon-btn { background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
input[type=text], input[type=password], input[type=number], input[type=email], select {
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 140, 255, .18); }
select { cursor: pointer; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
label.field > span.help { font-size: 11px; color: var(--faint); }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { background: transparent; border: 0; padding: 5px 9px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #2a3446; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- login ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(109,140,255,.16), transparent 60%),
              radial-gradient(900px 500px at 90% 90%, rgba(34,201,147,.10), transparent 60%), var(--bg); }
.login-card { width: 380px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px; padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-card p { margin: 0 0 6px; color: var(--muted); line-height: 1.5; }
.login-card .btn { padding: 10px; }
.error-text { color: var(--down); font-size: 12.5px; min-height: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: .2px; font-size: 16px; }
.logo-mark { width: 32px; height: 32px; display: block; flex: none; }

/* ---------- top bar ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--border);
  background: rgba(17, 23, 35, .9); backdrop-filter: blur(8px); flex: none; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: transparent; border: 0; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.tabs button:hover { color: var(--text); background: var(--panel-2); }
.tabs button.active { color: var(--text); background: var(--panel-3); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); letter-spacing: .3px; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.open .dot { background: var(--up); box-shadow: 0 0 0 3px rgba(34,201,147,.2); }
.mode.PAPER { color: var(--warn); border-color: rgba(245,182,66,.35); background: rgba(245,182,66,.08); }
.mode.DEMO { color: var(--sleeve); border-color: rgba(45,212,191,.35); background: rgba(45,212,191,.08); }
.mode.LIVE { color: #fff; background: var(--down); border-color: var(--down); }
.top-equity { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.top-equity small { color: var(--muted); font-size: 11px; }
.top-equity b { font-size: 15px; }
.btn.engine { display: inline-flex; align-items: center; gap: 8px; }
.btn.engine .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.btn.engine.on { border-color: rgba(34,201,147,.5); background: rgba(34,201,147,.1); }
.btn.engine.on .dot { background: var(--up); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,201,147,.6);} 100% { box-shadow: 0 0 0 8px rgba(34,201,147,0);} }
.banner { padding: 8px 16px; background: rgba(245,182,66,.1); color: var(--warn); border-bottom: 1px solid rgba(245,182,66,.25); font-size: 12.5px; }
.banner.err { background: rgba(255,93,108,.1); color: #ff8f9a; border-color: rgba(255,93,108,.25); }
.banner a { color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

main { flex: 1; min-height: 0; position: relative; }
.tab { display: none; height: 100%; }
.tab.active { display: flex; }
.scroll-page { overflow: auto; padding: 20px 24px 40px; flex-direction: column; gap: 18px; }
.scroll-page.active { display: flex; }

/* ---------- trade tab ---------- */
#tab-trade { min-height: 0; }
.watchlist { width: 340px; flex: none; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--panel); }
.wl-head { padding: 14px 14px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wl-head h3 { margin: 0; font-size: 14px; }
.wl-head form { display: flex; gap: 6px; }
.wl-head input { width: 120px; text-transform: uppercase; padding: 6px 9px; }
.wl-cols { display: grid; grid-template-columns: 96px 1fr 92px; padding: 0 14px 6px; color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.wl-cols span:last-child { text-align: right; }
#wl-list { list-style: none; margin: 0; padding: 0 6px 10px; overflow: auto; flex: 1; }
.wl-row { position: relative; display: grid; grid-template-columns: 96px 1fr 92px; align-items: center; gap: 4px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.wl-row:hover { background: var(--panel-2); }
.wl-row.active { background: var(--panel-3); border-color: var(--border-2); }
.wl-sym { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wl-sym b { font-size: 13.5px; letter-spacing: .3px; }
.wl-sym .px { font-size: 12.5px; transition: color .4s; }
.wl-sym .chg { font-size: 11px; }
.wl-mini { height: 44px; width: 100%; position: relative; }
.wl-pl { text-align: right; display: flex; flex-direction: column; gap: 1px; }
.wl-pl b { font-size: 13px; }
.wl-pl span { font-size: 11.5px; }
.wl-pl small { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.wl-x { position: absolute; right: 2px; top: 2px; opacity: 0; border: 0; background: var(--panel-3); color: var(--muted); border-radius: 6px; width: 18px; height: 18px; line-height: 16px; cursor: pointer; font-size: 13px; padding: 0; }
.wl-row:hover .wl-x { opacity: 1; }
.flash-up { color: var(--up) !important; }
.flash-down { color: var(--down) !important; }
.pos-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 5px; vertical-align: middle; }

.chart-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel); }
.chart-symbol { font-size: 17px; font-weight: 750; margin-right: 4px; letter-spacing: .3px; display: flex; align-items: baseline; gap: 10px; }
.chart-symbol small { font-size: 13px; font-weight: 600; }
.tb-sep { width: 1px; height: 22px; background: var(--border-2); margin: 0 2px; }
.tool { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; height: 30px; padding: 0 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.tool:hover { color: var(--text); }
.tool.active { color: var(--text); border-color: var(--accent); background: rgba(109,140,255,.12); }
.chart-toolbar select { height: 30px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.dropdown { position: relative; }
.dropdown-panel { position: absolute; top: 36px; left: 0; z-index: 20; width: 300px; background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 4px; }
.ind-row { display: grid; grid-template-columns: 22px 10px 1fr auto; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; }
.ind-row:hover { background: var(--panel-3); }
.ind-row input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.ind-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.ind-row .params { display: flex; gap: 4px; }
.ind-row .params input { width: 46px; padding: 3px 5px; font-size: 12px; }
.chart-stack { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.chart-pane { position: relative; min-height: 0; }
.chart-pane.main { flex: 1; }
.chart-pane.sub { height: 120px; flex: none; border-top: 1px solid var(--border); }
.chart-pane.drawing { cursor: crosshair; }
.legend { position: absolute; left: 12px; top: 8px; z-index: 5; pointer-events: none; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(100% - 100px); }
.legend .lg-main { font-weight: 650; display: flex; gap: 10px; }
.legend .lg-main .k { color: var(--faint); margin-right: 3px; font-weight: 500; }
.legend .lg-ind { color: var(--muted); }
.legend .chip { display: inline-flex; align-items: center; gap: 5px; }
.legend .chip i { width: 8px; height: 2px; border-radius: 2px; display: inline-block; }
.sub-legend { font-size: 11px; color: var(--muted); font-weight: 600; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 4; pointer-events: none; }

.side-panel { width: 300px; flex: none; border-left: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.card h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; display: flex; justify-content: space-between; align-items: center; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.big-pl { font-size: 22px; font-weight: 750; margin: 2px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.big-pl small { font-size: 13px; font-weight: 600; }
.ticket { display: flex; flex-direction: column; gap: 10px; }
.ticket .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ticket .seg { width: 100%; }
.ticket .seg button { flex: 1; padding: 7px; font-size: 13px; }
.ticket .seg button.buy.active { background: var(--up); color: #04150f; }
.ticket .seg button.sell.active { background: var(--down); color: #1d0306; }
.ticket input { width: 100%; }
.ticket .est { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 7px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.mini-item > span:last-child { white-space: nowrap; flex: none; }
.mini-item .tag { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.empty { color: var(--faint); font-size: 12.5px; padding: 4px 0; }

/* chips/tags */
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; letter-spacing: .3px; text-transform: uppercase; background: var(--panel-3); color: var(--muted); }
.tag.buy, .tag.long { background: rgba(34,201,147,.14); color: var(--up); }
.tag.sell, .tag.short { background: rgba(255,93,108,.14); color: var(--down); }
.tag.hold { background: rgba(255,255,255,.05); color: var(--faint); }
.tag.core { background: rgba(109,140,255,.15); color: var(--core); }
.tag.sleeve { background: rgba(45,212,191,.13); color: var(--sleeve); }
.tag.high_risk { background: rgba(192,132,252,.15); color: var(--risk); }
.tag.manual { background: rgba(255,255,255,.06); color: var(--muted); }
.tag.status-filled { background: rgba(34,201,147,.12); color: var(--up); }
.tag.status-canceled, .tag.status-expired, .tag.status-rejected { background: rgba(255,255,255,.05); color: var(--faint); }
.tag.status-new, .tag.status-accepted, .tag.status-partially_filled, .tag.status-pending_new { background: rgba(245,182,66,.12); color: var(--warn); }
.tag.status-held { background: rgba(109,140,255,.1); color: var(--accent); }

/* ---------- pages ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; }
.tile b { display: block; font-size: 21px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 16px; }
.table-wrap { overflow: auto; max-height: 62vh; }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th { position: sticky; top: 0; background: var(--panel); text-align: left; color: var(--faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: default; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255,255,255,.02); }
td .sym { font-weight: 700; cursor: pointer; }
td .sym:hover { color: var(--accent); }
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.bucket { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden; }
.bucket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--accent)); }
.bucket h5 { margin: 0; font-size: 13px; display: flex; justify-content: space-between; }
.bucket .alloc { font-size: 20px; font-weight: 750; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--panel-3); border-radius: 8px; overflow: hidden; margin: 10px 0 8px; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 8px; transition: width .4s; }
.bucket .kv { font-size: 12px; }
.alloc-visual { display: flex; height: 12px; border-radius: 10px; overflow: hidden; gap: 2px; margin-top: 4px; }
.alloc-visual i { display: block; height: 100%; }
#equity-chart { height: 300px; position: relative; }

.bot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.bot-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bot-card.off { opacity: .55; }
.bot-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bot-card h4 { margin: 0; font-size: 14px; }
.bot-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.bot-card .params { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.sig-cell { display: flex; flex-direction: column; gap: 3px; }
.sig-cell small { color: var(--faint); font-size: 11px; }
.sig-cell .blocked { color: var(--warn); font-size: 10.5px; max-width: 160px; white-space: normal; }
.log { font-family: var(--mono); font-size: 12px; max-height: 360px; overflow: auto; }
.log div { padding: 6px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 200px 64px 1fr; gap: 10px; }
.log .lvl-trade { color: var(--accent); }
.log .lvl-error { color: var(--down); }
.log .lvl-warn { color: var(--warn); }
.log .t { color: var(--faint); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.section-title { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .7px; margin: 6px 0 -2px; grid-column: 1/-1; }
.live-warning { grid-column: 1/-1; background: rgba(255,93,108,.08); border: 1px solid rgba(255,93,108,.3); border-radius: 8px; padding: 10px; color: #ff9aa4; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.test-result { font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel-3); border: 1px solid var(--border-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px;
  max-width: 380px; box-shadow: 0 12px 30px rgba(0,0,0,.45); font-size: 12.8px; animation: slidein .2s ease-out; }
.toast.error { border-left-color: var(--down); }
.toast.ok { border-left-color: var(--up); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232d40; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1250px) { .side-panel { display: none; } }
@media (max-width: 900px) { .watchlist { width: 270px; } .wl-cols, .wl-row { grid-template-columns: 80px 1fr 80px; } .top-equity { display: none; } }

/* ---------- sign-in gate ---------- */
.login-card { width: 400px; max-width: calc(100vw - 32px); }
.auth-view { display: flex; flex-direction: column; gap: 13px; }
.auth-view h1 { margin: 6px 0 0; font-size: 22px; }
.auth-view p { margin: 0 0 4px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.auth-view input[type=text], .auth-view input[type=email], .auth-view input[type=password] { padding: 10px 12px; font-size: 14px; width: 100%; }
.auth-view .btn.primary { padding: 11px; font-size: 14px; }
.auth-view .btn[disabled] { opacity: .6; cursor: wait; }
.auth-row { display: flex; justify-content: space-between; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.caps { font-size: 11.5px; color: var(--warn); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-top: 2px; }
.auth-links a { color: var(--accent); cursor: pointer; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.ok-text { color: var(--up); font-size: 12.5px; }
.ok-text:empty, .error-text:empty { display: none; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 40px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; opacity: .55; font-size: 14px; }
.pw-eye:hover, .pw-eye.on { opacity: 1; }
.pw-meter { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin-top: -6px; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.code-input { letter-spacing: 10px; font-size: 20px !important; text-align: center; font-variant-numeric: tabular-nums; }
.tag.ok { background: rgba(34,201,147,.14); color: var(--up); }

.form-grid input, .form-grid select { width: 100%; }
.form-grid > * { min-width: 0; }

.auth-alt { text-align: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; margin-top: 2px; }
.auth-alt a { color: var(--accent); cursor: pointer; font-weight: 600; }
.check.top { align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.check.top input { margin-top: 2px; flex: none; }
.user-chip { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.user-chip b { color: var(--text); font-weight: 600; }
.members-panel { grid-column: 1 / -1; }
body:not(.is-admin) .admin-only { display: none !important; }
.tag.role-admin { background: rgba(245,182,66,.14); color: var(--warn); }
.tag.status-active { background: rgba(34,201,147,.12); color: var(--up); }
.tag.status-unverified { background: rgba(109,140,255,.12); color: var(--accent); }
.tag.status-disabled { background: rgba(255,93,108,.12); color: var(--down); }

.check.top a { color: var(--accent); }
.terms-summary { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 12.8px; color: var(--muted); }
.terms-summary b { color: var(--text); }
.terms-summary ul { margin: 6px 0 8px; padding-left: 18px; } .terms-summary li { margin: 3px 0; }
.terms-summary a { color: var(--accent); font-weight: 600; }
.legal-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); text-align: center; line-height: 1.5; }
.legal-foot a { color: var(--muted); }
.legal-link { font-size: 12px; color: var(--muted); text-decoration: none; }
.legal-link:hover { color: var(--text); }
.live-warning .check { color: #ffc2c8; font-size: 12.5px; }

.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand span { font-size: 16px; font-weight: 800; letter-spacing: .3px; }
.brand small { font-size: 10.5px; font-weight: 500; color: var(--muted); letter-spacing: .2px; margin-top: 2px; }

/* language picker */
.login-card { position: relative; }
.lang-select { height: 30px; padding: 0 8px; font-size: 12px; background: var(--panel-2); border-radius: 8px; }
.login-lang { position: absolute; top: 28px; right: 28px; max-width: 150px; }
.top-lang { max-width: 130px; }
html[lang="ja"] body, html[lang="zh-CN"] body { font-family: Inter, "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", sans-serif; }

/* keep the top bar on one line in longer languages */
.topbar { gap: 14px; }
.tabs button, .pill, .brand small, .top-equity small, .btn.engine, .legal-link, .user-chip { white-space: nowrap; }
.tabs button { padding: 8px 11px; }
.top-right { gap: 10px; min-width: 0; }
.top-lang { max-width: 112px; }
.auth-links a { white-space: nowrap; }
@media (max-width: 1500px) { .top-equity small:last-child { display: none; } }
@media (max-width: 1380px) { .legal-link { display: none; } .topbar .brand small { display: none; } }

/* quick sign-in */
.social-box { display: flex; flex-direction: column; gap: 10px; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 10px;
  font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: filter .15s; }
.social-btn:hover { filter: brightness(0.96); }
.social-btn svg { width: 18px; height: 18px; flex: none; }
.social-btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; font-family: Roboto, Inter, sans-serif; }
.social-btn.apple { background: #000; color: #fff; border-color: #333; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 2px 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border-2); }
.id-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2); margin-bottom: 8px; }
.id-row .who { display: flex; align-items: center; gap: 10px; }
.id-row svg { width: 18px; height: 18px; }
.oauth-prov { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; background: var(--panel-2); }
.oauth-prov h4 { margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.oauth-prov textarea { width: 100%; min-height: 90px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px;
  color: var(--text); font-family: var(--mono); font-size: 11.5px; padding: 8px; resize: vertical; }
.copy-field { display: flex; gap: 6px; } .copy-field input { flex: 1; font-family: var(--mono); font-size: 12px; }

a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.oauth-prov h4 svg { width: 18px; height: 18px; flex: none; }
.oauth-prov h4 .apple-ico, .oauth-prov h4 svg path[fill='currentColor'] { color: var(--text); }

.wordmark { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; font-size: 17px; letter-spacing: -0.4px; }
.wordmark em { font-style: normal; color: var(--up); }
