/* MAGNET Signal Licensing — admin panel
   Palette matches the MAGNET brand: gold + ink, red as the third accent. */

@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/vazir.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JBM"; src: url("/static/fonts/jbm-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JBM"; src: url("/static/fonts/jbm-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --gold: #C8912F;
  --gold-l: #E8C477;
  --gold-d: #8A5A1C;
  --gold-bg: #FBF5E8;
  --gold-line: #EBD9B4;
  --red: #C8302D;
  --red-bg: #FCEEEC;
  --red-line: #F1C9C7;
  --green: #217A4A;
  --green-bg: #E9F5EE;
  --ink: #121110;
  --ink2: #2A2723;
  --muted: #6F675C;
  --faint: #A39A8C;
  --line: #E7DFD0;
  --line2: #F0EAE0;
  --cream: #FAF7F1;
  --paper: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18,17,16,.04), 0 6px 20px -12px rgba(18,17,16,.12);
  --side: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink2);
  font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono, code { font-family: "JBM", ui-monospace, monospace; letter-spacing: -.2px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  background: var(--paper);
  border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 20px; border-bottom: 1px solid var(--line2); }
.brand img { width: 44px; height: auto; }
.brand b { display: block; font-size: 15px; font-weight: 800; letter-spacing: 3px; color: var(--ink); line-height: 1.2; }
.brand small { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 2px; color: var(--gold-d); margin-top: 2px; }
.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--cream); color: var(--ink); }
.nav a.on { background: var(--gold-bg); color: var(--ink); }
.nav a.on::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 3px; background: var(--gold);
}
.nav a.on svg.i { color: var(--gold-d); }
.nav .count { margin-inline-start: auto; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line2); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--gold-l), var(--gold));
  color: var(--ink); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; text-transform: uppercase;
}
.me b { display: block; font-size: 13px; color: var(--ink); line-height: 1.3; }
.me small { font-size: 11.5px; color: var(--muted); }
.side-actions { display: flex; gap: 6px; }
.side-actions a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--paper);
}
.side-actions a:hover { color: var(--ink); border-color: var(--faint); }
.side-actions a.out:hover { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.side-actions svg.i { width: 15px; height: 15px; }

.main { min-width: 0; padding: 30px 36px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 640px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }
[dir="rtl"] .crumb svg.i { transform: scaleX(-1); }

/* mobile top bar */
.topbar { display: none; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap; transition: filter .15s, background .15s, border-color .15s;
}
.btn svg.i { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-ink { background: var(--ink); color: var(--gold-l); }
.btn-ink:hover { background: var(--ink2); }
.btn-ghost { background: var(--paper); color: var(--ink2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--faint); color: var(--ink); }
.btn-danger { background: var(--paper); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 32px; padding: 0; }
form.inline { display: inline; margin: 0; }

/* ---------------- cards ---------------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 800; color: var(--ink); }
.card-head a.more { font-size: 12.5px; font-weight: 700; color: var(--gold-d); display: inline-flex; align-items: center; gap: 4px; }
.card-body { padding: 20px; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 18px 18px 16px; position: relative; overflow: hidden; }
.stat .ic {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--gold-bg); color: var(--gold-d); margin-bottom: 14px;
}
.stat .ic.dark { background: var(--ink); color: var(--gold-l); }
.stat .ic.green { background: var(--green-bg); color: var(--green); }
.stat .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat .val { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--faint); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th {
  text-align: start; font-size: 11.5px; font-weight: 700; color: var(--muted);
  padding: 11px 16px; background: #FCFAF6; border-bottom: 1px solid var(--line);
  white-space: nowrap; letter-spacing: .2px;
}
table.t td { padding: 13px 16px; border-bottom: 1px solid var(--line2); vertical-align: middle; font-size: 13.5px; }
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: #FDFBF7; }
table.t td.end, table.t th.end { text-align: end; }
table.t.tight td { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.cell-title { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg.i { width: 30px; height: 30px; color: var(--faint); margin-bottom: 8px; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-green { background: var(--green-bg); color: var(--green); }
.b-gray { background: #F3EFE8; color: var(--muted); }
.b-gold { background: var(--gold-bg); color: var(--gold-d); border-color: var(--gold-line); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-ink { background: var(--ink); color: var(--gold-l); }
.dir { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .5px; font-family: "JBM", monospace; }
.dir.buy { background: var(--green-bg); color: var(--green); }
.dir.sell { background: var(--red-bg); color: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.on { background: #2FB36B; box-shadow: 0 0 0 3px rgba(47,179,107,.18); }

.key {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; direction: ltr;
  font-family: "JBM", monospace; font-size: 12.5px; font-weight: 700; color: var(--ink);
  background: var(--cream); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px 4px 10px;
}
.copy {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer;
}
.copy:hover { background: var(--paper); color: var(--ink); }
.copy svg.i { width: 15px; height: 15px; }
.copy.done { color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--cream); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; }

/* ---------------- toolbar / filters ---------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tabs a:hover { background: var(--cream); color: var(--ink); }
.tabs a.on { background: var(--ink); color: var(--gold-l); }
.tabs a span { font-size: 11px; opacity: .7; }
.search { position: relative; }
.search svg.i { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input[type=search] { padding-inline-start: 36px; width: 260px; }

/* ---------------- forms ---------------- */
input[type=text], input[type=password], input[type=number], input[type=search], input[type=url], textarea, select {
  width: 100%; height: 40px; padding: 0 12px;
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,145,47,.16); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink2); }
.field .hint { font-size: 12px; color: var(--muted); }
.fields { display: grid; gap: 16px; }
.fields.two { grid-template-columns: 1fr 1fr; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; margin-top: 18px;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 0; background: linear-gradient(to top, var(--cream) 70%, rgba(250,247,241,0));
}
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink2); background: var(--gold-bg); border: 1px solid var(--gold-line); border-radius: 10px; padding: 10px 12px; }
.note svg.i { color: var(--gold-d); width: 16px; height: 16px; margin-top: 2px; }

/* switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); }
.switch b { font-size: 13px; color: var(--ink); display: block; }
.switch small { font-size: 12px; color: var(--muted); }
.tog { position: relative; width: 42px; height: 24px; flex: none; }
.tog input { opacity: 0; width: 0; height: 0; position: absolute; }
.tog span { position: absolute; inset: 0; background: #D9D1C3; border-radius: 999px; cursor: pointer; transition: background .15s; }
.tog span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tog input:checked + span { background: var(--gold); }
.tog input:checked + span::after { transform: translateX(18px); }
[dir="rtl"] .tog input:checked + span::after { transform: translateX(-18px); }
.tog input:focus-visible + span { box-shadow: 0 0 0 3px rgba(200,145,47,.25); }

/* channel picker */
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pick-head .sel { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pick { display: flex; flex-direction: column; gap: 8px; }
.pc { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); transition: border-color .15s, background .15s, box-shadow .15s; }
.pc.on { border-color: var(--gold); background: #FFFCF6; box-shadow: 0 0 0 3px rgba(200,145,47,.10); }
.pc-main { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; user-select: none; }
.pc-main input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #CFC5B4; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; transition: all .15s; }
.box svg { width: 13px; height: 13px; stroke: var(--ink); stroke-width: 3; fill: none; opacity: 0; }
.pc.on .box { background: var(--gold); border-color: var(--gold); }
.pc.on .box svg { opacity: 1; }
.pc-main input:focus-visible ~ .box { box-shadow: 0 0 0 3px rgba(200,145,47,.25); }
.pc-name { flex: 1; min-width: 0; }
.pc-name b { display: block; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name small { font-size: 11.5px; color: var(--muted); }
.pc-adv-btn { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; }
.pc-adv-btn:hover { color: var(--ink); background: var(--cream); }
.pc-adv-btn svg.i { width: 14px; height: 14px; transition: transform .15s; }
.pc.open .pc-adv-btn svg.i { transform: rotate(180deg); }
.pc:not(.on) .pc-adv-btn { visibility: hidden; }
.pc-adv { display: none; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 0 14px 14px; }
.pc.on.open .pc-adv { display: grid; }
.pc-adv label { font-size: 11.5px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }
.pc-adv input { height: 34px; font-size: 13px; }

/* detail view */
.key-hero {
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px 24px;
  position: relative; overflow: hidden; margin-bottom: 18px;
}
.key-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 0% 0%, rgba(200,145,47,.30), transparent 45%), radial-gradient(circle at 100% 100%, rgba(200,48,45,.22), transparent 45%); pointer-events: none; }
.key-hero > * { position: relative; }
.key-hero small { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--gold-l); }
.key-hero .big { display: flex; align-items: center; gap: 12px; margin: 8px 0 6px; flex-wrap: wrap; }
.key-hero .big code { font-size: 22px; font-weight: 700; direction: ltr; color: #fff; letter-spacing: .5px; }
.key-hero .copy { color: var(--gold-l); width: auto; height: 32px; padding: 0 12px; gap: 6px; border: 1px solid rgba(232,196,119,.35); border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 700; }
.key-hero .copy:hover { background: rgba(232,196,119,.12); color: #fff; }
.key-hero .copy.done { color: #8FD19E; border-color: rgba(143,209,158,.4); }
.key-hero p { margin: 0; font-size: 12.5px; color: #C9C1B2; }
.dl { display: grid; grid-template-columns: 1fr; }
.dl > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line2); }
.dl > div:last-child { border-bottom: none; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 700; color: var(--ink); text-align: end; font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line2); }
.kpis > div { padding: 16px 20px; border-inline-end: 1px solid var(--line2); }
.kpis > div:last-child { border-inline-end: none; }
.kpis small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.kpis b { display: block; font-size: 20px; color: var(--ink); font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpis b.pos { color: var(--green); } .kpis b.neg { color: var(--red); }
.danger { border-color: var(--red-line); }
.danger .card-head h2 { color: var(--red); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line2); }
.danger-row:last-child { border-bottom: none; }
.danger-row b { display: block; font-size: 13px; color: var(--ink); }
.danger-row small { font-size: 12px; color: var(--muted); }

/* channel rename inline */
.rename { display: flex; gap: 6px; align-items: center; }
.rename input { height: 34px; max-width: 240px; font-weight: 700; }
.rename .btn { opacity: 0; transition: opacity .15s; }
.rename:focus-within .btn { opacity: 1; }

/* users */
.user-access { display: flex; flex-direction: column; gap: 10px; }
.chan-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.cc { position: relative; }
.cc input { position: absolute; opacity: 0; }
.cc span { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .12s; }
.cc input:checked + span { background: var(--gold-bg); border-color: var(--gold); color: var(--ink); }
.cc input:focus-visible + span { box-shadow: 0 0 0 3px rgba(200,145,47,.25); }
.seg { display: inline-flex; background: var(--cream); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 7px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(18,17,16,.1); }

/* toast */
.toast {
  position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 16px 11px 14px; border-radius: 12px;
  display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); z-index: 50; animation: toast 3.2s ease forwards;
}
[dir="rtl"] .toast { transform: translateX(50%); }
.toast svg.i { color: #8FD19E; }
@keyframes toast { 0% { opacity: 0; translate: 0 10px; } 8%, 85% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 10px; visibility: hidden; } }

/* ---------------- login ---------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art {
  background: var(--ink); position: relative; overflow: hidden; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px;
}
.login-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 15% 10%, rgba(200,145,47,.35), transparent 45%), radial-gradient(circle at 90% 95%, rgba(200,48,45,.28), transparent 45%); }
.login-art > * { position: relative; }
.login-art .ring { position: absolute; border: 1px solid rgba(232,196,119,.14); border-radius: 50%; }
.login-art .top { display: flex; align-items: center; gap: 12px; }
.login-art .top img { width: 48px; }
.login-art .top b { font-size: 16px; letter-spacing: 3.5px; font-weight: 800; display: block; line-height: 1.2; }
.login-art .top small { font-size: 10px; letter-spacing: 2.5px; color: var(--gold-l); font-weight: 700; }
.login-art h2 { font-size: 34px; line-height: 1.25; font-weight: 900; margin: 0 0 12px; max-width: 420px; }
.login-art h2 em { font-style: normal; color: var(--gold-l); }
.login-art p { color: #C9C1B2; max-width: 400px; margin: 0; }
.login-art .feat { display: flex; gap: 22px; flex-wrap: wrap; font-size: 12.5px; color: #C9C1B2; }
.login-art .feat span { display: inline-flex; align-items: center; gap: 7px; }
.login-art .feat svg.i { color: var(--gold-l); width: 16px; height: 16px; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.login-lang { position: absolute; top: 24px; inset-inline-end: 24px; }
.login-box { width: 100%; max-width: 360px; }
.login-box img { width: 120px; display: block; margin-bottom: 22px; }
.login-box h1 { font-size: 24px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.login-box > p { color: var(--muted); margin: 0 0 24px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box .btn { height: 44px; margin-top: 6px; }
.alert { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.alert.err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar {
    display: block; position: sticky; top: 0; z-index: 20;
    background: var(--paper); border-bottom: 1px solid var(--line);
  }
  .tb-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px 4px; }
  .tb-brand { display: flex; align-items: center; gap: 8px; flex: none; }
  .tb-brand img { width: 30px; }
  .tb-brand b { font-size: 13px; font-weight: 800; letter-spacing: .14em; color: var(--ink); }
  .tb-me { flex: 1; min-width: 0; text-align: end; font-size: 12.5px; font-weight: 700; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tb-btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; min-width: 34px; justify-content: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; font-weight: 700; color: var(--ink2); flex: none; }
  .tb-btn svg.i { width: 16px; height: 16px; }
  .tb-nav { display: flex; gap: 4px; padding: 4px 10px 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tb-nav::-webkit-scrollbar { display: none; }
  .topbar a.tn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 8px 11px; border-radius: 9px; white-space: nowrap; flex: none; }
  .topbar a.tn svg.i { width: 15px; height: 15px; }
  .topbar a.tn.on { background: var(--gold-bg); color: var(--ink); }
  .main { padding: 20px 16px 50px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields.two { grid-template-columns: 1fr; }
  .pc-adv { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .search input[type=search] { width: 100%; }
  .search { flex: 1; }
  .kpis { grid-template-columns: 1fr; }
}
[hidden] { display: none !important; }


/* v8: broker-server required marker, channel profile, error toast */
.req { color: var(--red); font-weight: 800; }
.chan-checks.invalid { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 8px; }
.toast.err { background: var(--red); }
.toast.err svg.i { color: #fff; }
.prof-link { font-size: 12px; font-weight: 600; color: var(--gold-d); display: inline-block; margin-top: 4px; }
.prof-link:hover { text-decoration: underline; }
.stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .val.pos { color: var(--green); } .stat .val.neg { color: var(--red); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; background: var(--cream); border-radius: 3px; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--gold); border-radius: 3px; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }
@media (max-width: 900px) { .stats.stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* v9: channel performance */
.pl-cell { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.pl-cell b { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pl-cell b.pos { color: var(--green); } .pl-cell b.neg { color: var(--red); }
.pl-cell small { font-size: 11px; color: var(--muted); font-weight: 600; }
.curve-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: 13px; color: var(--ink); }
.curve-title .faint { font-size: 12px; }
svg.curve { width: 100%; height: 160px; display: block; }
svg.curve .zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
svg.curve .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.curve.up .ln { stroke: var(--green); } svg.curve.down .ln { stroke: var(--red); }
svg.curve .area { stroke: none; }
svg.curve.up .area { fill: var(--green); fill-opacity: .10; } svg.curve.down .area { fill: var(--red); fill-opacity: .10; }
.perf-base { font-size: 12px; padding-top: 0 !important; }
.perf-form { border-top: 1px solid var(--line2); }

/* ================= v10: UI polish ================= */
.small { font-size: 12px; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.btn-block { width: 100%; }
.empty.ok svg.i { color: var(--green); }

/* stat cards */
a.stat { display: block; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--gold-line); transform: translateY(-1px); box-shadow: 0 1px 2px rgba(18,17,16,.04), 0 10px 24px -14px rgba(18,17,16,.22); }
.stat .val .of { font-size: 15px; font-weight: 700; color: var(--faint); margin-inline-start: 4px; }
.stat .ic.red { background: var(--red-bg); color: var(--red); }
.stat.warn { border-color: var(--red-line); }

/* popover (add provider) */
details.pop { position: relative; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > summary { filter: brightness(.96); }
.pop-body {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30; width: 340px; max-width: calc(100vw - 32px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  box-shadow: 0 18px 40px -16px rgba(18,17,16,.35); display: flex; flex-direction: column; gap: 12px;
}

/* channels table */
table.ch-table td { padding-top: 12px; padding-bottom: 12px; }
tr.row-link { cursor: pointer; }
.ch-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ch-name > span:last-child { min-width: 0; }
.ch-name b { display: block; font-weight: 700; color: var(--ink); line-height: 1.35; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-name small { display: block; font-size: 11.5px; color: var(--muted); }
.ch-name:hover b { color: var(--gold-d); }
.ch-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--cream); border: 1px solid var(--line); color: var(--muted); }
.ch-ic svg.i { width: 16px; height: 16px; }
.ch-ic.master { background: var(--ink); border-color: var(--ink); color: var(--gold-l); }
.num-c { white-space: nowrap; }
.num-c b { display: block; font-size: 14px; font-weight: 800; color: var(--ink); }
.num-c small { display: block; font-size: 11px; color: var(--faint); }
b.pl { font-weight: 800; font-variant-numeric: tabular-nums; }
b.pl.pos { color: var(--green); } b.pl.neg { color: var(--red); }

/* dashboard */
.bars.tall { height: 150px; gap: 6px; }
.bars.tall .bar { position: relative; background: #F6F1E8; border-radius: 5px; }
.bars.tall .bar i { border-radius: 5px; background: linear-gradient(180deg, var(--gold-l), var(--gold)); }
.bars.tall .bar em { position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.bars-days { display: flex; gap: 6px; margin-top: 6px; }
.bars-days span { flex: 1; text-align: center; font-size: 10.5px; color: var(--faint); }
.alist { list-style: none; margin: 0; padding: 4px 0; }
.alist li a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; transition: background .12s; }
.alist li a:hover { background: #FDFBF7; }
.alist li + li a { border-top: 1px solid var(--line2); }
.atext { flex: 1; min-width: 0; }
.atext b { display: block; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atext small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aend { text-align: end; flex: none; }
.aend b { display: block; font-size: 13px; color: var(--ink); }
.aend small { display: block; font-size: 11.5px; color: var(--faint); }
.aic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; }
.aic svg.i { width: 15px; height: 15px; }
.aic.expired { background: var(--red-bg); color: var(--red); }
.aic.expiring { background: var(--gold-bg); color: var(--gold-d); }
.aic.offline { background: #F3EFE8; color: var(--muted); }

/* login */
.login-page { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--cream); }
.login-art { padding: 44px 56px; }
.login-art::before { background: none; }
.login-art .glow { position: absolute; inset: 0; background:
  radial-gradient(600px 400px at 10% 0%, rgba(200,145,47,.32), transparent 60%),
  radial-gradient(500px 380px at 100% 100%, rgba(200,48,45,.22), transparent 60%),
  linear-gradient(transparent 0 0); }
.login-art .glow::after { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(232,196,119,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(232,196,119,.06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(circle at 30% 40%, #000, transparent 75%); -webkit-mask-image: radial-gradient(circle at 30% 40%, #000, transparent 75%); }
.login-art .hero { max-width: 460px; }
.login-art .eyebrow { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-l); border: 1px solid rgba(232,196,119,.3); border-radius: 999px; padding: 4px 12px; margin-bottom: 18px; }
[dir="rtl"] .login-art .eyebrow { letter-spacing: 0; }
.login-art h2 { font-size: 36px; max-width: none; margin-bottom: 14px; }
.login-art h2 em { display: block; }
.login-art .hero > p { font-size: 15px; margin-bottom: 30px; }
.feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.feats li { display: flex; gap: 14px; align-items: flex-start; }
.feats li > span { width: 38px; height: 38px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(232,196,119,.1); border: 1px solid rgba(232,196,119,.22); color: var(--gold-l); }
.feats li > span svg.i { width: 17px; height: 17px; }
.feats b { display: block; font-size: 14px; color: #fff; }
.feats small { display: block; font-size: 12.5px; color: #A9A194; }
.login-art .foot { font-size: 11.5px; color: #7E776C; letter-spacing: 1px; }
.login-form-wrap { background: var(--cream); }
.login-box { max-width: 380px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 32px 30px; box-shadow: 0 1px 2px rgba(18,17,16,.04), 0 24px 50px -30px rgba(18,17,16,.35); }
.login-box .login-logo { width: 110px; margin-bottom: 20px; }
.login-box h1 { font-size: 22px; }
.login-box > p { margin-bottom: 22px; font-size: 13.5px; }
.login-box input { height: 44px; }
.pw { position: relative; }
.pw input { width: 100%; padding-inline-end: 64px; }
.pw-toggle { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; height: 32px; padding: 0 10px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.pw-toggle:hover { background: var(--cream); color: var(--ink); }
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line2); font-size: 12px; color: var(--muted); }
.login-note svg.i { width: 15px; height: 15px; color: var(--gold-d); }

@media (max-width: 1200px) {
  .login-art { padding: 36px 36px; }
  .login-art h2 { font-size: 30px; }
}
@media (max-width: 860px) {
  .hide-sm { display: none; }
  .ch-name b { max-width: 160px; }
  .login-box { border: none; box-shadow: none; background: transparent; padding: 0; }
  .login-form-wrap { padding-top: 70px; }
  .bars.tall .bar em { display: none; }
}
.shell > div { min-width: 0; }
@media (max-width: 860px) {
  .ch-table th:nth-child(4), .ch-table td:nth-child(4) { display: none; }
  table.ch-table th, table.ch-table td { padding-inline: 10px; }
  .ch-ic { display: none; }
  .dash-hide-sm { display: none; }
}
@media (max-width: 860px) {
  table.ch-table thead { display: none; }
  table.ch-table, table.ch-table tbody { display: block; }
  table.ch-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 14px; border-bottom: 1px solid var(--line2); }
  table.ch-table tr:last-child { border-bottom: none; }
  table.ch-table td { display: block; padding: 0 !important; border: none !important; }
  table.ch-table td:first-child { flex: 1 1 100%; }
  table.ch-table td:nth-child(2) { order: 2; }
  table.ch-table td:nth-child(3) { order: 3; }
  table.ch-table td:nth-child(5) { order: 4; }
  table.ch-table td.end { order: 5; margin-inline-start: auto; }
  .num-c b, .num-c small { display: inline; }
  .num-c small { margin-inline-start: 4px; }
  .ch-name b { max-width: 100%; }
  .kpis > div { border-inline-end: none; border-bottom: 1px solid var(--line2); }
  .input-row { flex-wrap: wrap; }
  .key { white-space: normal; word-break: break-all; }
}
.grid-2 > *, .form-grid > * { min-width: 0; }
@media (max-width: 1200px) { .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); } }
.card-head { flex-wrap: wrap; }

/* ================= v11: leaderboard + provider profiles ================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* segmented links (light, page head) */
.seg-links { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-links a { height: 30px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg-links a:hover { color: var(--ink); background: var(--cream); }
.seg-links a.on { background: var(--ink); color: var(--gold-l); }

/* period / mode switch on the ink hero */
.pseg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(244,239,230,.06); border: 1px solid rgba(232,196,119,.16); }
.pseg a, .pseg button { height: 28px; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 7px; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: #A9A194; cursor: pointer; white-space: nowrap; }
.pseg a:hover, .pseg button:hover { color: #F4EFE6; }
.pseg a.on, .pseg button.on { background: var(--gold); color: var(--ink); }
.pseg a:focus-visible, .pseg button:focus-visible, .seg-links a:focus-visible { outline: 2px solid var(--gold-l); outline-offset: 2px; }

/* the ink hero: race chart / balance chart */
.lb-hero, .pv-hero {
  background: var(--ink); color: #F4EFE6; border-radius: 18px; border: 1px solid #2A2723;
  padding: 22px 24px 16px; margin-bottom: 18px; position: relative;
  box-shadow: 0 24px 50px -32px rgba(18,17,16,.55);
}
.lb-hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.lb-hero-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: #fff; }
.lb-hero-head p { margin: 2px 0 0; font-size: 12.5px; color: #A9A194; }
.lb-chart { position: relative; width: 100%; min-height: 200px; }
.lbc-svg { display: block; overflow: visible; font-family: "Vazirmatn", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.lbc-hit { cursor: crosshair; }
.lbc-tip {
  position: absolute; z-index: 3; pointer-events: none; min-width: 150px;
  background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 10px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); font-size: 12px; direction: ltr;
}
.lbc-tip small { display: block; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.lbc-tip div { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.lbc-tip i { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(18,17,16,.25); }
.lbc-tip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.lbc-tip b { font-weight: 800; font-variant-numeric: tabular-nums; }
.lbc-tip em { font-style: normal; color: var(--muted); font-weight: 600; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.race-legend { list-style: none; margin: 10px 0 0; padding: 12px 0 0; border-top: 1px solid rgba(232,196,119,.12); display: flex; flex-wrap: wrap; gap: 6px 18px; counter-reset: rk; }
.race-legend li { counter-increment: rk; }
.race-legend a { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: #D9D2C5; }
.race-legend a::before { content: counter(rk); font-size: 11px; font-weight: 800; color: #7E776C; min-width: 8px; }
.race-legend a:hover { color: #fff; }
.race-legend i { width: 14px; height: 3px; border-radius: 2px; }
.lb-hero-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 46px 20px 40px; text-align: center; color: #A9A194; }
.lb-hero-empty svg.i { width: 34px; height: 34px; color: var(--gold); }
.lb-hero-empty p { margin: 0; max-width: 460px; font-size: 13.5px; }

/* rank medals */
.medal {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted);
  background: #F3EFE8; border: 1px solid var(--line);
}
.medal.m1 { background: radial-gradient(circle at 35% 30%, #F7DFA0, #C8912F 70%); color: var(--ink); border-color: #B47F25; box-shadow: 0 0 0 3px rgba(200,145,47,.18); }
.medal.m2 { background: radial-gradient(circle at 35% 30%, #F1F3F5, #A7AFB8 72%); color: var(--ink); border-color: #98A0A9; }
.medal.m3 { background: radial-gradient(circle at 35% 30%, #EFC5A2, #A86B3C 72%); color: #fff; border-color: #95602F; }
.medal.big { width: 54px; height: 54px; font-size: 22px; flex: none; }
.pv-hero .medal:not(.m1):not(.m2):not(.m3) { background: rgba(244,239,230,.06); border-color: rgba(232,196,119,.2); color: #D9D2C5; }

/* ranking table */
table.lb-table td { padding-top: 12px; padding-bottom: 12px; }
.lb-rank, .lb-rank-h { width: 52px; padding-inline-end: 0 !important; }
.lb-row:hover .ch-name b { color: var(--gold-d); }
.acct { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; margin-inline-start: 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; background: #F3EFE8; color: var(--muted); vertical-align: 1px; }
.acct.real { background: var(--green-bg); color: var(--green); }
.gcell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.gcell b { font-size: 15px; min-width: 70px; }
.gbar { flex: 1; height: 6px; border-radius: 3px; background: #F3EFE8; overflow: hidden; max-width: 90px; }
.gbar i { display: block; height: 100%; border-radius: 3px; }
.gbar.pos i { background: var(--green); }
.gbar.neg i { background: var(--red); }
.lb-quiet { display: block; font-size: 11px; margin-top: 2px; }
svg.spark { display: block; }
svg.spark .ln { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
svg.spark.up .ln { stroke: var(--green); } svg.spark.down .ln { stroke: var(--red); }
svg.spark .area { stroke: none; fill-opacity: .10; }
svg.spark.up .area { fill: var(--green); } svg.spark.down .area { fill: var(--red); }
.dd { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-unranked { margin-top: 18px; }
.lb-unranked .alist .badge { flex: none; }
.lb-method { display: flex; gap: 8px; align-items: flex-start; margin: 16px 2px 0; font-size: 12px; color: var(--muted); max-width: 760px; }
.lb-method svg.i { width: 15px; height: 15px; margin-top: 2px; color: var(--gold-d); }

/* provider page */
.pv-crumbs { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.pv-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.pv-id h1 { margin: 0; font-size: 26px; font-weight: 800; color: #fff; letter-spacing: -.3px; line-height: 1.25; overflow-wrap: anywhere; }
.pv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 11.5px; font-weight: 700; color: #D9D2C5; background: rgba(244,239,230,.06); border: 1px solid rgba(232,196,119,.14); white-space: nowrap; }
.tag svg.i { width: 13px; height: 13px; color: var(--gold-l); }
.tag.acct { margin: 0; height: 24px; }
.tag.acct.real { background: rgba(47,179,107,.14); color: #8FD19E; border-color: rgba(143,209,158,.25); }
.tag.acct.demo { color: #C9C1B2; }
.pv-figure { text-align: end; }
.pv-figure small { display: block; font-size: 12px; font-weight: 600; color: #A9A194; }
.pv-figure b { display: block; font-size: 44px; line-height: 1.1; font-weight: 900; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.pv-figure b.pos { color: var(--gold-l); } .pv-figure b.neg { color: #F08A86; }
.pv-figure span { font-size: 12.5px; color: #D9D2C5; font-weight: 600; }
.pv-chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 22px 0 8px; padding-top: 18px; border-top: 1px solid rgba(232,196,119,.12); }
.pv-balances { display: flex; gap: 28px; flex-wrap: wrap; }
.pv-balances small { display: block; font-size: 11.5px; color: #8F887C; font-weight: 600; }
.pv-balances b { display: block; font-size: 16px; font-weight: 800; color: #F4EFE6; font-variant-numeric: tabular-nums; }
.pv-balances b.pos { color: #8FD19E; } .pv-balances b.neg { color: #F08A86; }
.pv-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-kpis { margin-bottom: 18px; overflow: hidden; }
.pv-kpis .kpis:last-child { border-bottom: none; }
.kpis b .pos, .kpis b.pos { color: var(--green); } .kpis b .neg, .kpis b.neg { color: var(--red); }
.kpi-sub { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.pv-small-b { font-size: 16px !important; }
b.pl .pos { color: var(--green); } b.pl .neg { color: var(--red); }

.pv-extremes { display: grid; grid-template-columns: 1fr 1fr; }
.pv-ex { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.pv-ex + .pv-ex { border-inline-start: 1px solid var(--line2); }
.pv-ex > small { font-size: 12px; color: var(--muted); font-weight: 600; }
.pv-ex > b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pv-ex > b .pos { color: var(--green); } .pv-ex > b .neg { color: var(--red); }
.pv-ex-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.ladder-mini { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.pv-trades .ladder-mini { margin-top: 0; }
.leg { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .2px; }
.leg.tp { background: var(--green-bg); color: var(--green); }
.leg.sl { background: var(--red-bg); color: var(--red); }
.leg.manual { background: #F3EFE8; color: var(--muted); }
.leg.be { background: var(--gold-bg); color: var(--gold-d); box-shadow: inset 0 0 0 1px var(--gold-line); }
.leg.lock { background: var(--paper); color: var(--green); box-shadow: inset 0 0 0 1px #A8D3B9; }

/* TP ladder: one rung per target, SL at the bottom */
.ladder { display: flex; flex-direction: column; gap: 9px; }
.rung { display: grid; grid-template-columns: 128px 1fr 74px; align-items: center; gap: 12px; }
.rl { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.rb { height: 12px; border-radius: 6px; background: #F6F1E8; overflow: hidden; }
.rb i { display: block; height: 100%; border-radius: 6px; min-width: 3px; }
.rung.tp .rb i { background: var(--green); }
.rung.tp:nth-child(1) .rb i { background: #155C36; }
.rung.manual .rb i { background: var(--faint); }
.rung.lock .rb i { background: #8CC4A2; }
.rung.lock .rl { color: var(--green); }
.rung.be .rb i { background: var(--gold); }
.rung.be .rl { color: var(--gold-d); }
.rung.sl { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line); }
.rung.sl .rb i { background: var(--red); }
.rung.sl .rl { color: var(--red); }
.rn { text-align: end; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.rn small { font-weight: 600; color: var(--faint); margin-inline-start: 6px; font-size: 11.5px; }

/* monthly returns */
.months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mo { border-radius: 9px; padding: 9px 10px; display: flex; flex-direction: column; gap: 1px; }
.mo.pos { background: rgba(33,122,74,var(--a)); }
.mo.neg { background: rgba(200,48,45,var(--a)); }
.mo small { font-size: 11px; font-weight: 700; color: var(--ink2); opacity: .75; }
.mo b { font-size: 14px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* buy vs sell */
.sides { display: grid; grid-template-columns: 1fr 1fr; }
.side-b { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.side-b + .side-b { border-inline-start: 1px solid var(--line2); }
.side-b > b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.side-b > b .pos { color: var(--green); } .side-b > b .neg { color: var(--red); }
.side-b small { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }

@media (max-width: 1320px) { .lb-hide-md { display: none; } }

@media (max-width: 860px) {
  .lb-hide-sm { display: none; }
  .lb-hero, .pv-hero { padding: 18px 16px 12px; border-radius: 16px; }
  .pv-figure { text-align: start; }
  .pv-figure b { font-size: 36px; }
  .pv-id h1 { font-size: 21px; }
  .medal.big { width: 44px; height: 44px; font-size: 18px; }
  .gcell { min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; }
  .gbar { width: 70px; flex: none; }
  .months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rung { grid-template-columns: 104px 1fr 64px; gap: 8px; }
  .rl { font-size: 11.5px; }
  .pv-extremes, .sides { grid-template-columns: 1fr; }
  .pv-ex + .pv-ex, .side-b + .side-b { border-inline-start: none; border-top: 1px solid var(--line2); }
  .pv-kpis .kpis { grid-template-columns: 1fr 1fr; }
  .pv-kpis .kpis > div:nth-child(odd) { border-inline-end: 1px solid var(--line2); }
  .seg-links { width: 100%; overflow-x: auto; }
  table.lb-table th, table.lb-table td { padding-inline: 10px; }
  .lb-table .ch-ic { display: none; }
  .lb-table .ch-name b { max-width: 150px; }
  .lb-table .num-c small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* copy P/L row on the license page */
.kpis.kpis-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .kpis.kpis-3 { grid-template-columns: 1fr; } }


/* ---------------- users page ---------------- */
.uc-new { margin-bottom: 18px; }
.uc-new-body { padding: 20px; display: grid; gap: 18px; }
.uc-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.ulist { display: flex; flex-direction: column; }
.urow { border-bottom: 1px solid var(--line2); }
.urow:last-child { border-bottom: 0; }
.urow > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(0, 3fr) auto; align-items: center; gap: 18px; padding: 14px 20px; transition: background .12s; }
.urow > summary::-webkit-details-marker { display: none; }
.urow > summary:hover { background: var(--cream); }
.urow[open] > summary { background: var(--cream); border-bottom: 1px solid var(--line2); }
.u-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.u-id b { display: block; font-size: 14px; color: var(--ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-id small { font-size: 12px; color: var(--muted); }
.u-meta { display: grid; grid-template-columns: 70px minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1fr); gap: 16px; min-width: 0; }
.u-stat { min-width: 0; }
.u-stat small { display: block; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 3px; }
[dir="rtl"] .u-stat small { text-transform: none; letter-spacing: 0; }
.u-stat b { font-size: 13.5px; color: var(--ink); font-weight: 700; }
.u-srv { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px !important; }
.u-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.u-badges .badge { font-size: 11px; padding: 2px 8px; }
.u-act { width: 150px; display: flex; justify-content: flex-end; }
.u-act .btn { pointer-events: none; }
.uc-foot .hint { font-size: 12px; color: var(--muted); }
.u-act svg.i:last-child { transition: transform .15s; }
.urow[open] .u-act svg.i:last-child { transform: rotate(180deg); }
.u-body { padding: 20px; display: grid; gap: 18px; background: var(--paper); }
.u-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.uc-sec { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--cream); min-width: 0; }
.uc-sec-h b { display: block; font-size: 13px; color: var(--ink); }
.uc-sec-h small { font-size: 12px; color: var(--muted); }
.uc-sec .seg { align-self: flex-start; }
.prod-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prod { position: relative; cursor: pointer; }
.prod input { position: absolute; opacity: 0; }
.prod > span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 12px 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); transition: all .12s; position: relative; }
[dir="rtl"] .prod > span { padding: 12px 42px 12px 14px; }
.prod > span::before { content: ""; position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--faint); background: var(--paper); }
.prod input:checked + span { border-color: var(--gold); background: var(--gold-bg); box-shadow: 0 0 0 1px var(--gold) inset; }
.prod input:checked + span::before { background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23121110' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--gold); }
.prod input:focus-visible + span { box-shadow: 0 0 0 3px rgba(200,145,47,.25); }
.prod b { font-size: 13.5px; color: var(--ink); }
.prod small { font-size: 12px; color: var(--muted); }
.pick-box { display: flex; flex-direction: column; gap: 10px; }
.pick-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick-tools .pick-q { height: 32px; width: 180px; font-size: 12.5px; }
.pick-n { font-size: 12.5px; color: var(--muted); margin-inline-end: auto; }
.pick-n b { color: var(--ink); }
.lnk { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--gold-d); cursor: pointer; }
.lnk:hover { text-decoration: underline; }
.pick-list { max-height: 210px; overflow-y: auto; padding: 2px; }
.pick-list .cc[hidden] { display: none; }
.u-off { display: none; }
.is-off .seg, .is-off .pick-box { display: none; }
.is-off .u-off { display: flex; }
.uc-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.u-pw { width: 300px; max-width: 100%; }
.u-btns { display: flex; gap: 8px; align-items: center; }
@media (max-width: 1100px) {
  .urow > summary { grid-template-columns: 1fr auto; }
  .u-meta { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .u-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .prod-picks { grid-template-columns: 1fr; }
  .search input[type=search] { width: 100%; }
  .u-edit-l { display: none; }
}
[dir="rtl"] .u-srv { text-align: right; }

/* relay message templates (channel page) */
.tpl-wrap > summary { list-style: none; cursor: pointer; }
.tpl-wrap > summary::-webkit-details-marker { display: none; }
.tpl-wrap:not([open]) > summary { border-bottom: none; }
.tpl-form { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.tpl-form textarea { font-size: 13px; line-height: 1.7; unicode-bidi: plaintext; text-align: start; }


/* ================= v15: Persian-first mobile ================= */
input[type=date], input[type=datetime-local] {
  width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.key { white-space: nowrap; }
@media (max-width: 860px) {
  .page-head { flex-wrap: wrap; gap: 12px; }
  .page-head > .btn, .page-head > details.pop > summary.btn, .page-head > .head-actions { width: 100%; justify-content: center; }
  .page-head > details.pop { width: 100%; }
  details.pop { position: static; }
  .page-head { position: relative; }
  .pop-body { inset-inline: 0; width: auto; max-width: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; white-space: nowrap; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { min-width: 0; max-width: 100%; }
  .main { padding: 18px 14px 50px; }
  h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  table.t.t-cards thead { display: none; }
  table.t.t-cards, table.t.t-cards tbody, table.t.t-cards tr { display: block; width: 100%; }
  table.t.t-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line2); }
  table.t.t-cards tr:last-child { border-bottom: none; }
  table.t.t-cards td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 6px 0 !important; border: none !important; text-align: end; white-space: normal !important; min-width: 0;
  }
  table.t.t-cards td::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: start; }
  table.t.t-cards td[data-label=""]::before { content: none; }
  [dir=rtl] table.t.t-cards td.ltr, [dir=rtl] table.t.t-cards td.mono { flex-direction: row-reverse; }
  table.t.t-cards td:first-child { display: block; text-align: start; padding-bottom: 8px !important; }
  table.t.t-cards td:first-child::before { content: none; }
  table.t.t-cards td.end { justify-content: flex-end; padding-top: 10px !important; }
  table.t.t-cards td.end::before { content: none; }
  table.t.t-cards td .row-actions { width: 100%; justify-content: flex-end; }
  table.t.t-cards td .chips { justify-content: flex-end; }
  table.t.t-cards td > div[style*="text-align:start"], table.t.t-cards td .cell-sub { text-align: end !important; }
  table.t.t-cards .rename { display: flex; gap: 8px; width: 100%; }
  table.t.t-cards .rename input { flex: 1; min-width: 0; max-width: none; }
  table.t.t-cards .rename .btn { opacity: 1; }
  .kpis, .kpis.kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div { padding: 12px 14px; border-bottom: 1px solid var(--line2); }
  .kpis > div:nth-child(2n) { border-inline-end: none; }
  .kpis b { font-size: 17px; }
  .acct-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
  .lic-table td:first-child .cell-title { font-size: 15px; }
}

/* dashboard: connected real accounts */
.money { margin-bottom: 18px; }
.money-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 20px 18px; }
.money-grid > div { padding: 10px 14px 4px; }
.money-grid > div + div { border-inline-start: 1px solid var(--line, rgba(0,0,0,.08)); }
.money-grid small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.money-grid b { display: block; font-size: 21px; font-weight: 800; margin-top: 2px; }
.money-split { margin-bottom: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.money-split .t td, .money-split .t th { white-space: nowrap; }
@media (max-width: 860px) {
  .money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
  .money-grid > div:nth-child(odd) { border-inline-start: 0; }
  .money-split { grid-template-columns: 1fr; }
}
