:root{
  --navy:#061a33; --ink:#07182f; --blue:#17385f; --muted:#64748b;
  --line:#e5eaf1; --strong:#d4dce8; --gold:#d69a2d; --gold2:#b87916;
  --green:#07975f; --red:#d94a4a; --bg:#f6f7f9; --soft:#fff8ec;
  --shadow:0 16px 38px rgba(18,36,65,.08); --sidebar:220px; --topbar:78px;
  --font-display:Georgia,"Times New Roman",serif;
  --font-body:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
html[data-font="modern"]{
  --font-display:'Poppins',system-ui,sans-serif;
  --font-body:'Inter',system-ui,-apple-system,"Segoe UI",sans-serif;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:var(--font-body);color:var(--ink);background:linear-gradient(180deg,#fff,#f4f6f9)}
button,input,select,textarea{font-family:inherit}
.app{display:grid;grid-template-columns:var(--sidebar) 1fr;min-height:100vh}
.sidebar{position:sticky;top:0;height:100vh;background:rgba(255,255,255,.94);border-right:1px solid var(--line);display:flex;flex-direction:column;z-index:20}
.brand{height:var(--topbar);display:grid;place-items:center;background:linear-gradient(135deg,#051324,#0b203d 72%,#061427)}
.crest{width:58px;height:58px;border:2px solid var(--gold);border-radius:50%;display:grid;place-items:center;color:var(--gold);font:800 24px var(--font-display);box-shadow:inset 0 0 0 4px rgba(214,154,45,.12);position:relative}
/* Brand mark inside the crest / auth crest. The logo art is navy-on-white, so it fills the circle
   as a white disc inside the gold ring — a navy mark on the dark sidebar would be invisible. */
.crest img,.login-crest img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}
.crest:before{content:"";position:absolute;width:76px;height:76px;border:1px solid rgba(214,154,45,.35);border-radius:50%}
.nav{padding:24px 14px;display:grid;gap:8px}
.nav a{border:0;text-decoration:none;background:transparent;color:var(--blue);border-radius:12px;padding:13px 14px;text-align:left;font-weight:850;display:flex;gap:12px;align-items:center;cursor:pointer;transition:.18s}
.nav a:hover{background:#fff7e8;transform:translateX(2px)}
.nav a.active{background:linear-gradient(90deg,#fff4df,rgba(255,248,236,.45));color:#9b650a;box-shadow:inset 3px 0 0 var(--gold)}
.nav svg{width:21px;height:21px}
.sidebar-footer{margin-top:auto;padding:14px}
.support-card{border:1px solid #eedfbf;background:linear-gradient(180deg,#fffdf8,#fff7e8);border-radius:14px;padding:14px;box-shadow:var(--shadow);margin-bottom:18px}
.support-card b{display:block;font-size:14px}.support-card span{display:block;color:var(--muted);font-size:12px;margin:4px 0 12px}
.foot{font-size:11px;color:#8190a6;line-height:1.45}
.main{min-width:0}.topbar{position:sticky;top:0;height:var(--topbar);z-index:10;background:rgba(255,255,255,.92);backdrop-filter:blur(16px);border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 28px}
.top-left,.top-right{display:flex;gap:14px;align-items:center}
.chip{height:42px;min-width:142px;border:1px solid var(--line);background:#fff;border-radius:12px;padding:0 16px;display:flex;align-items:center;justify-content:center;gap:9px;font-weight:850;font-size:14px}
.dot{width:10px;height:10px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px rgba(11,159,101,.12)}
.dot.red{background:var(--red);box-shadow:0 0 0 4px rgba(217,74,74,.15)}
.dot.amber{background:var(--gold);box-shadow:0 0 0 4px rgba(214,154,45,.15)}
.profile{height:54px;min-width:230px;border:1px solid var(--line);background:#fff;border-radius:14px;padding:0 14px;display:flex;gap:12px;align-items:center}
.profile>div{min-width:0}
.avatar{width:34px;height:34px;border-radius:50%;background:rgba(214,154,45,.12);color:var(--gold2);display:grid;place-items:center;font-weight:900;flex:0 0 auto}
.profile b{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}.profile small{color:var(--muted);font-size:12px}
.content{padding:22px 24px 50px;min-height:calc(100vh - var(--topbar))}
.section{scroll-margin-top:94px;margin-bottom:34px}.page-section{display:none}.page-section.active{display:block}
.page-title{display:flex;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
h1,h2,h3,p{margin:0}
h1{font:700 34px/1.05 var(--font-display);color:#071a37;letter-spacing:-.03em}
h2{font:700 25px/1.1 var(--font-display);color:#071a37;letter-spacing:-.03em}
h3{font:700 18px/1.1 var(--font-display);color:#071a37}
.subtitle{color:#63738b;font-size:14px;line-height:1.45;margin-top:8px}
.card{background:rgba(255,255,255,.95);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow)}
.panel{padding:18px}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.select-lite,select,input,textarea{width:100%;border:1px solid var(--strong);background:#fff;border-radius:12px;padding:12px 14px;font-size:14px;font-weight:750;color:var(--ink)}
textarea{min-height:62px;resize:vertical}
label{display:block;color:#60718b;text-transform:uppercase;font-weight:900;letter-spacing:.05em;font-size:12px;margin-bottom:10px}
.gold-btn{border:0;background:linear-gradient(135deg,#dfa83c,#bb7917);color:#fff;border-radius:10px;padding:11px 14px;font-weight:900;cursor:pointer;box-shadow:0 10px 20px rgba(184,121,22,.22)}
.ghost-btn{border:1px solid var(--strong);background:#fff;border-radius:10px;padding:10px 13px;font-weight:850;cursor:pointer}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(190px,1fr));gap:14px;margin-bottom:18px}
.kpi{min-height:118px;padding:16px;display:grid;grid-template-columns:auto 1fr;gap:14px;position:relative;overflow:hidden}
.kpi-icon{width:38px;height:38px;border-radius:50%;background:#f8f3e6;color:var(--gold);display:grid;place-items:center}
.kpi small{display:block;color:#71809a;text-transform:uppercase;letter-spacing:.04em;font-size:11px;line-height:1.2;font-weight:900;margin-bottom:8px}
.kpi strong{display:block;font-size:19px;color:#0a2141}.change{display:inline-block;margin-top:10px;color:var(--green);font-size:11px;font-weight:900}
.sparkline{position:absolute;right:12px;bottom:12px;width:70px;height:32px}
.layout-two{display:grid;grid-template-columns:1.15fr .85fr;gap:18px}
.layout-table-right{display:grid;grid-template-columns:1.2fr .8fr;gap:18px}
.right-stack{display:grid;gap:18px;align-content:start}
/* grid items default to min-width:auto and refuse to shrink below their content — allow all layout grids' children to shrink so nothing forces horizontal overflow */
.layout-two>*,.layout-table-right>*,.right-stack>*,.client-preview-grid>*,.calc-shell>*,.editor-grid>*,.models>*,.form-grid>*,.filters-row>*,.summary-cards>*,.kpi-grid>*,.distribution>*,.trade-summary>*,.stats>*,.calendar-summary>*,.preview-kpis>*,.wallet-grid>*{min-width:0}
.chart{width:100%;height:300px;display:block}
.badge{display:inline-flex;align-items:center;justify-content:center;padding:8px 12px;border-radius:999px;background:#f6efdf;color:#ba7b17;font-size:12px;font-weight:900}
.badge.green{background:#e7f6ee;color:var(--green)}.badge.red{background:#fdeaea;color:var(--red)}
.editor-grid{display:grid;grid-template-columns:1fr 1.1fr;gap:14px;margin-bottom:18px}
.target-switch{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border:1px solid var(--line);border-radius:12px;background:#fff}
.target-switch button{border:0;background:transparent;color:var(--muted);border-radius:9px;padding:10px 12px;font-weight:900;cursor:pointer}
.target-switch button.active{background:linear-gradient(135deg,#fff7e6,#fffbf2);color:#9b650a;box-shadow:inset 0 0 0 1px #eedfbf}
.helper{font-size:12px;color:var(--muted);line-height:1.5;margin-top:8px}
.distribution{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}
.input-wrap{position:relative}.suffix{position:absolute;right:14px;top:50%;transform:translateY(-50%);color:#75849a;font-weight:900}
input[type=range]{width:100%;padding:0;appearance:none;height:8px;background:#383838;border-radius:99px;border:0;margin-top:14px}
input[type=range]::-webkit-slider-thumb{appearance:none;width:20px;height:20px;border-radius:50%;background:var(--gold);border:0;box-shadow:0 2px 8px rgba(0,0,0,.18);cursor:pointer}
.range-foot{display:flex;justify-content:space-between;color:#6c7b90;font-size:12px;font-weight:900;margin-top:10px}
.rule-box{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:center;border:1px solid #eedfbf;background:linear-gradient(180deg,#fffdf7,#fff8eb);border-radius:16px;padding:18px}
.rule-box p{color:#596b84;font-size:14px;line-height:1.45}.rule-box b{color:#c17e12}
.big-icon{width:26px;height:26px;color:var(--gold)}
table{width:100%;border-collapse:collapse;font-size:14px}th,td{padding:16px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
/* EA Status: divider between one client's master/slave pair and the next client's.
   Needs a per-theme colour — a dark navy line vanishes on the dark background. */
tr.ea-group-start > td{border-top:3px solid rgba(20,40,80,.22)}
html[data-theme="dark"] tr.ea-group-start > td{border-top-color:rgba(255,255,255,.34)}
th{color:#6d7d92;text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:900}td{color:#102948;font-weight:780}
.table-scroll{overflow-x:auto}.subtext{display:block;color:#7a899f;font-size:12px;font-weight:700;margin-top:3px}
.id-cell{display:flex;align-items:center;gap:12px}.mini-avatar{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#f5ecda;color:#b87916;font-size:12px;font-weight:900;flex:0 0 auto}
.table-footer{display:flex;justify-content:space-between;align-items:center;color:#6c7c92;font-size:13px;font-weight:750;padding-top:16px}.pages{display:flex;gap:8px;align-items:center}.page-dot{width:30px;height:30px;border-radius:10px;display:grid;place-items:center}.page-dot.active{background:#f7f0df;color:#b87a18}
.pos{color:var(--green)!important}.neg{color:var(--red)!important}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.wide{grid-column:1/-1}.action-row{display:flex;justify-content:flex-end;gap:10px;margin-top:16px;flex-wrap:wrap}
.summary-cards{display:grid;grid-template-columns:1fr 1fr;gap:12px}.summary-cards.three{grid-template-columns:repeat(3,1fr)}
.mini-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:#fff}.mini-card small{display:block;color:#70809a;text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:900;margin-bottom:10px}.mini-card strong{display:block;font-size:18px;margin-bottom:8px;color:#071f3f}
.create-list{display:grid;gap:8px;margin-top:12px}.create-item{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--line);border-radius:12px;padding:10px 12px;background:#fff}.create-item b{font-size:13px}.create-item small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.filters-row{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}
.filters-row.wallet-cols{grid-template-columns:320px 1fr}
.head-select{min-width:300px}
.client-preview-grid{display:grid;grid-template-columns:1fr .95fr;gap:18px}.preview-kpis{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-bottom:16px}
.preview-kpi{border:1px solid var(--line);border-radius:16px;background:#fff;padding:16px;min-height:114px}.preview-kpi small{display:block;color:#6f8097;text-transform:uppercase;font-size:11px;font-weight:900;letter-spacing:.04em;margin-bottom:9px}.preview-kpi strong{display:block;font-size:26px;color:#071f3f}
.preview-note{border:1px solid #eedfbf;background:linear-gradient(180deg,#fffdf7,#fff8eb);border-radius:16px;padding:16px;color:#8a5a0a;font-weight:750;font-size:13px}
.calendar-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.icon-btn{width:38px;height:38px;border-radius:10px;border:1px solid var(--strong);background:#fff;font-weight:900;cursor:pointer}
.calendar-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:16px}.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}.day-name{padding:0 4px 6px;font-size:11px;font-weight:900;letter-spacing:.05em;text-transform:uppercase;color:#7b899f}
.cal-cell{min-height:84px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:10px;display:flex;flex-direction:column;gap:8px;box-shadow:0 8px 24px rgba(18,36,65,.05)}.cal-cell.empty{min-height:50px;background:transparent;border-style:dashed;box-shadow:none;opacity:.45}.cal-cell.positive{background:linear-gradient(180deg,#fff,#fffaf0);border-color:#efddb4}.cal-cell.negative{background:linear-gradient(180deg,#fff,#fdf2f2);border-color:#f3c4c4}.cal-cell.negative .cal-amount{color:var(--red)}.cal-cell.today{box-shadow:inset 0 0 0 2px rgba(214,154,45,.3),0 8px 24px rgba(18,36,65,.05)}
.calendar-grid>*{min-width:0}
.cal-day{font-size:13px;font-weight:900;color:var(--blue)}.cal-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#8c98ac;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cal-amount{margin-top:auto;font-size:15px;font-weight:900;color:var(--green);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wallet-shell{background:#fff;border:1px solid var(--line);color:#22314a;border-radius:20px;padding:22px;box-shadow:var(--shadow)}
.wallet-top{display:flex;justify-content:space-between;gap:18px;margin-bottom:18px}.wallet-shell h2,.wallet-shell h3{color:var(--blue);font-family:inherit;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.wallet-shell h2{font-size:20px}.wallet-subtitle{color:#6b7a90;margin-top:8px;font-size:14px}.wallet-total{text-align:right}.wallet-total small{display:block;color:#8593a6;text-transform:uppercase;letter-spacing:.15em;font-size:11px}.wallet-total strong{display:block;font-size:22px;color:var(--blue);margin-top:8px}
.wallet-card{border:1px solid var(--line);background:#f8fafc;border-radius:16px;padding:18px;margin-bottom:18px}.wallet-grid{display:grid;grid-template-columns:1fr 170px;gap:14px}.wallet-line{border:1px solid var(--line);border-radius:12px;background:#fff;padding:14px}.wallet-line label{color:#6b7a90;letter-spacing:.12em}.wallet-line strong{display:block;color:var(--blue);font-size:15px;word-break:break-all}.wallet-pill{display:inline-block;border:1px solid var(--line);color:#6b7a90;border-radius:999px;padding:2px 8px;font-size:11px;margin-left:8px}.wallet-button{border:1px solid var(--gold);background:var(--gold);color:#3a2a00;border-radius:10px;padding:10px 14px;cursor:pointer;font-weight:800}.wallet-button:hover{filter:brightness(.97)}.wallet-actions{display:flex;justify-content:flex-end;margin-top:10px}.wallet-empty{border:1px solid var(--line);border-radius:14px;padding:26px;color:#6b7a90;text-align:center;background:#f8fafc}
.trade-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}.trade-card{border:1px solid var(--line);border-radius:15px;padding:16px;background:#fff}.trade-card small{display:block;text-transform:uppercase;font-size:11px;font-weight:900;letter-spacing:.04em;color:#70819a;margin-bottom:10px}.trade-card strong{display:block;font-size:22px;color:#081f3e}
.calc-shell{display:grid;grid-template-columns:300px 1fr;gap:18px}.calc-panel h3{font-family:var(--font-display);font-size:20px}.pair-line{display:grid;grid-template-columns:1fr 100px 70px 32px;gap:6px;margin-bottom:8px;align-items:center}.xbtn{background:#ffe9e9;color:var(--red);border:1px solid #ffd0d0;border-radius:8px;height:32px;min-width:32px;padding:0 8px;font-weight:900;cursor:pointer}.xbtn:hover{background:#ffd6d6}.addbtn{background:#fff8ec;color:#9b650a;border:1px solid #eedfbf;border-radius:12px;padding:10px;font-weight:900;cursor:pointer;width:100%}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:14px}.stat{text-align:center}.stat-v{font-size:22px;font-weight:900;color:var(--gold)}.stat-l{text-transform:uppercase;color:#70819a;font-size:11px;font-weight:900;margin-top:4px}
.models{display:grid;grid-template-columns:1fr 1fr;gap:14px}.model h4{font:700 19px var(--font-display);display:flex;justify-content:space-between;gap:10px;margin-bottom:10px}.model h4 span{font:900 11px var(--font-body);background:#fff8ec;color:#9b650a;border:1px solid #eedfbf;border-radius:999px;padding:5px 8px;text-transform:uppercase}
.r{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding:8px 0;font-size:13px}.r span:first-child{color:#53637a}.r span:last-child{text-align:right;font-weight:850}.final{border-top:2px solid #eedfbf;margin-top:8px;padding-top:9px}
.delta{background:linear-gradient(90deg,rgba(214,154,45,.08),#fff8ec);border:1px solid #eedfbf;border-radius:16px;padding:16px;display:flex;justify-content:space-between;margin:14px 0}
.calc-chart{height:330px;background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px;margin-bottom:14px;box-shadow:var(--shadow)}.chart-area{height:250px;display:flex;align-items:flex-end;gap:10px;padding:0 4px}.month-group{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:40px}.bar-wrap{display:flex;align-items:flex-end;gap:4px;width:100%;justify-content:center;height:230px}.bar{width:46%;border-radius:7px 7px 0 0;min-height:30px;position:relative}.bar.no-reinvest{background:linear-gradient(to top,#98a4b4,#c7ced8)}.bar.compound{background:linear-gradient(to top,#b87916,#d69a2d)}.bar-val{position:absolute;top:-24px;left:50%;transform:translateX(-50%);font-size:11px;font-weight:800;background:#fff;border:1px solid var(--line);border-radius:6px;padding:2px 6px;white-space:nowrap}.bar-label{font-size:11px;color:#64748b}
.broker-tag{font-size:11px;padding:3px 7px;border-radius:999px;background:#fff8ec;color:#9b650a;border:1px solid #eedfbf;font-weight:900}.best{color:var(--gold2)!important;font-weight:900}.worst{color:var(--red)!important}
.toast{position:fixed;right:22px;bottom:22px;background:#081e3c;color:#fff;padding:14px 18px;border-radius:12px;font-size:14px;font-weight:800;opacity:0;pointer-events:none;transform:translateY(8px);transition:.22s;z-index:200}.toast.show{opacity:1;transform:translateY(0)}
.role-switch-top{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:4px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:13px;
  background:#f2f5f9;
  min-width:310px;
}
.role-switch-top button{
  border:0;
  border-radius:10px;
  background:transparent;
  color:#64748b;
  font-weight:900;
  padding:10px 14px;
  cursor:pointer;
}
.role-switch-top button.active{
  background:#fff;
  color:#9b650a;
  box-shadow:0 8px 18px rgba(18,36,65,.08);
}
.ib-section{display:none}
.ib-section.active{display:block}

.client-section{display:none}
.client-section.active{display:block}
.client-notification-strip{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:16px;
  border:1px solid var(--line);
  border-radius:20px;
  background:#fff;
  padding:18px;
  box-shadow:var(--shadow);
  margin:18px 0;
}
.telegram-circle{
  width:44px;
  height:44px;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:#0d2a50;
  color:#fff;
  font-weight:900;
}
.client-wallet-note{
  border:1px solid #eedfbf;
  background:linear-gradient(180deg,#fffdf7,#fff8eb);
  border-radius:16px;
  padding:16px;
  color:#8a5a0a;
  font-weight:750;
}

.referral-box{
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  align-items:end;
  border:1px solid #eedfbf;
  background:linear-gradient(180deg,#fffdf7,#fff8eb);
  border-radius:18px;
  padding:18px;
  margin-top:18px;
}
.referral-box label{margin-bottom:8px}
.referral-box input{margin:0}
.network-tree{
  display:grid;
  gap:12px;
}
.network-node{
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  padding:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.network-node .left{
  display:flex;
  align-items:center;
  gap:12px;
}
.network-children{
  margin-left:34px;
  display:grid;
  gap:10px;
}
.notification-list{
  display:grid;
  gap:12px;
}
.notification-card{
  border:1px solid var(--line);
  background:#fff;
  border-radius:16px;
  padding:16px;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:14px;
}
.notification-card.unread{
  border-color:var(--gold);
  border-left:4px solid var(--gold);
  background:linear-gradient(180deg,#fffdf9,#fff8ec);
}
/* read = muted grey dot; unread = gold, glowing. The dot is the read/unread tell. */
.notification-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  background:#c3ccd8;
  box-shadow:none;
}
.notification-card.unread .notification-dot{
  background:var(--gold);
  box-shadow:0 0 0 5px rgba(214,154,45,.14);
}
.notification-card.unread b{color:var(--gold)}
/* count bubble on the sidebar "Notifications" link */
.nav-badge{
  margin-left:auto;
  min-width:20px;
  height:20px;
  padding:0 6px;
  border-radius:999px;
  background:#d94a4a;
  color:#fff;
  font-size:11px;
  font-weight:900;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}
.wallet-history{
  margin-top:18px;
}

/* ============ show-password eye ============ */
.pw-wrap{position:relative}
.pw-wrap>input{padding-right:44px}
.pw-eye{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:32px;height:32px;display:grid;place-items:center;border:0;background:transparent;color:#8493a8;cursor:pointer;border-radius:8px;padding:0}
.pw-eye:hover{color:var(--gold2);background:rgba(214,154,45,.1)}
.pw-eye.on{color:var(--gold2)}

/* ============ positions (trades) view ============ */
.pos-group{border:1px solid var(--line);border-radius:16px;background:#fff;margin-bottom:12px;overflow:hidden;box-shadow:0 8px 24px rgba(18,36,65,.05)}
.pos-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;cursor:pointer;background:#fbfcfe;flex-wrap:wrap}
.pos-head .who{font-weight:900;font-size:15px;color:#0a2141;display:flex;align-items:center;gap:10px}
.pos-head .who .caret{color:#94a3b8;transition:.15s}
.pos-group.collapsed .caret{transform:rotate(-90deg)}
.pos-group.collapsed .pos-body{display:none}
.pos-right{display:flex;gap:18px;align-items:center;flex-wrap:wrap;font-size:12px;font-weight:800;color:#6c7c92}
.pos-net{font-size:16px;font-weight:900}
.pos-body{padding:6px 16px 14px}
.pos-acct{display:grid;grid-template-columns:1fr auto auto auto;gap:14px;padding:9px 0;border-bottom:1px dashed var(--line);font-size:13px;align-items:center}
.pos-acct .lbl{color:#6c7c92;font-weight:900;text-transform:uppercase;font-size:11px;letter-spacing:.03em}
.pos-acct .num{font-weight:850;color:#0a2141;white-space:nowrap}
.pos-pair{display:grid;grid-template-columns:1fr auto auto auto;gap:14px;padding:9px 0;font-weight:800;font-size:13px;color:#102948;align-items:center}
.pos-pair .sym{display:flex;align-items:center;gap:8px}
.pos-empty{padding:10px 0;color:#7a899f;font-size:13px}
/* ===== Partners & Clients cards ===== */
.ib-cards{display:grid;gap:10px}
.ib-card{border:1px solid var(--line);border-radius:14px;background:#fff;padding:14px 16px}
.ib-card-top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.ib-card-top .id-cell b{font-size:14px}
.ib-card-meta{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.share-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.share-chip{flex:1 1 120px;min-width:110px;border:1px solid var(--line);border-radius:11px;padding:9px 12px;background:#fbfcfe;display:flex;flex-direction:column;gap:2px}
.share-chip b{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.03em;color:#70819a}
.share-chip span{font-size:15px;font-weight:850}
.share-chip small{color:#8493a8;font-size:11px;font-weight:800}
.ticket-list{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.ticket-item{border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:#fbfcfe}
.ticket-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.ticket-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;flex-wrap:wrap}
.ticket-acts{display:flex;gap:8px}
.ticket-acts .ghost-btn,.ticket-acts .gold-btn{padding:6px 10px;font-size:12px}
.ticket-reply{margin-top:8px;padding:8px 10px;border-left:3px solid var(--gold);background:rgba(214,154,45,.08);border-radius:0 8px 8px 0;font-size:13px}
.ticket-reply b{font-size:11px;text-transform:uppercase;letter-spacing:.03em;color:var(--gold)}
.ticket-answer{margin-top:8px}
.ticket-answer textarea{width:100%;min-height:44px}
html[data-theme="dark"] .ticket-item{background:#0e1727;border-color:var(--line)}
html[data-theme="dark"] .ticket-reply{background:rgba(214,154,45,.12)}
.exc-block{margin-top:16px;padding-top:16px;border-top:1px solid var(--line)}
.exc-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px;margin-top:8px}
.exc-grid input{width:100%}
.exc-total{margin:10px 0;font-size:13px;font-weight:800;color:#60718b}
.exc-total b{color:var(--gold)}
.exc-total.bad b{color:#d94a4a}
.dist-rules{display:flex;flex-direction:column;gap:10px}
.dist-rule{border:1px solid var(--line);border-radius:14px;padding:12px 14px;background:#fbfcfe}
.dist-rule-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.dist-rule-head b{font-size:13px;font-weight:900}
html[data-theme="dark"] .dist-rule{background:#0e1727;border-color:var(--line)}
.ib-card.ib-totals{background:#f7f9fc;border-style:dashed}
html[data-theme="dark"] .ib-card{background:#141f33;border-color:var(--line)}
html[data-theme="dark"] .share-chip{background:#0e1727;border-color:var(--line)}
html[data-theme="dark"] .ib-card.ib-totals{background:#0e1727}
.pref-row{display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid var(--line);border-radius:12px;background:#fff;cursor:pointer}
.pref-row input{width:auto;margin:2px 0 0}
.pref-row b{display:block;font-size:13px}.pref-row small{display:block;color:var(--muted);font-size:12px;margin-top:2px}
html[data-theme="dark"] .pref-row{background:#141f33;border-color:var(--line)}
.dd-warn{display:inline-flex;align-items:center;gap:3px;color:var(--red);font-size:12px;font-weight:900;cursor:help;line-height:1}
.dd-warn.last{background:var(--red);color:#fff;padding:2px 7px;border-radius:999px;animation:ddpulse 1.3s ease-in-out infinite}
@keyframes ddpulse{0%,100%{opacity:1}50%{opacity:.55}}
.pos-group.dd{border-color:#f3c4c4}
.pos-group.dd .pos-head{background:linear-gradient(180deg,#fff,#fdf2f2)}
html[data-theme="dark"] .pos-group.dd{border-color:#5a3030}
html[data-theme="dark"] .pos-group.dd .pos-head{background:linear-gradient(180deg,#1c1114,#26181a)}

/* ============ RESPONSIVE LAYER ============ */
/* Very large desktops: keep content readable, don't stretch edge-to-edge */
@media(min-width:1900px){.content{max-width:1680px;margin:0 auto}}

/* Large desktop → laptop: 4-up KPIs become 2-up, model cards stack */
@media(max-width:1500px){.kpi-grid{grid-template-columns:repeat(2,1fr)}.models{grid-template-columns:1fr}}

/* Laptop / small desktop: side-by-side layouts stack, 4-up summaries become 2-up */
@media(max-width:1250px){
  .layout-two,.layout-table-right,.client-preview-grid,.calc-shell{grid-template-columns:1fr}
  .trade-summary,.stats,.distribution{grid-template-columns:repeat(2,1fr)}
}

/* Tablet / mobile: single column app, sidebar becomes a sticky horizontal nav */
@media(max-width:1000px){
  body{overflow-x:hidden}
  .app{grid-template-columns:1fr}
  .sidebar{position:sticky;top:0;height:auto;min-width:0;flex-direction:row;align-items:stretch;border-right:0;border-bottom:1px solid var(--line);box-shadow:0 8px 24px rgba(18,36,65,.06)}
  .brand{height:auto;min-height:54px;flex:0 0 60px}
  .crest{width:36px;height:36px;font-size:15px;border-width:1.5px}
  .crest:before{display:none}
  .nav{display:flex;align-items:center;overflow-x:auto;padding:8px 10px;gap:6px;flex:1;min-width:0;width:0;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .nav::-webkit-scrollbar{display:none}
  .nav a{flex:0 0 auto;padding:9px 12px;font-size:13px;gap:8px;white-space:nowrap}
  .nav a:hover{transform:none}
  .nav svg{width:18px;height:18px}
  .sidebar-footer{display:none}
  .topbar{position:static;height:auto;min-height:0;flex-wrap:wrap;gap:10px;padding:12px 16px}
  .top-left,.top-right{flex-wrap:wrap;gap:8px}
  .chip{height:36px;min-width:0;padding:0 12px;font-size:13px}
  .profile{height:auto;min-width:0;padding:8px 12px;flex:1}
  .content{padding:16px 14px 44px}
  .section{scroll-margin-top:150px}
  h1{font-size:26px}h2{font-size:21px}
  .role-switch-top{min-width:0;width:100%}
  .head-select{min-width:0;width:100%}
  .editor-grid,.form-grid,.filters-row,.filters-row.wallet-cols,.distribution,.wallet-grid,.referral-box{grid-template-columns:1fr}
  .summary-cards{grid-template-columns:1fr 1fr}
  .wallet-top{flex-direction:column}.wallet-total{text-align:left}
  th,td{padding:12px 9px;font-size:13px}
  .table-footer{flex-wrap:wrap;gap:10px}
  .chart-area{overflow-x:auto;padding-bottom:8px}
  .network-children{margin-left:16px}
  .calendar-grid{gap:5px}
  .cal-cell{min-height:60px;padding:6px;gap:4px;border-radius:9px;box-shadow:none}
  .cal-cell.empty{min-height:34px}
  .cal-label{display:none}
  .cal-day{font-size:11px}
  .cal-amount{font-size:clamp(9px,2.6vw,13px)}
  .day-name{font-size:9px;padding:0 2px 4px}
}

/* Phones */
@media(max-width:560px){
  .content{padding:14px 12px 40px}
  .panel{padding:14px}
  h1{font-size:23px}h2{font-size:19px}h3{font-size:16px}
  .top-left{display:none}
  .profile b{max-width:170px}
  .kpi-grid,.summary-cards,.summary-cards.three,.calendar-summary{grid-template-columns:1fr}
  .trade-summary,.stats{grid-template-columns:repeat(2,1fr)}
  .trade-card strong{font-size:18px}.stat-v{font-size:18px}
  .preview-kpi{min-height:0;padding:13px}.preview-kpi strong{font-size:20px}
  .chart{height:220px}
  .wallet-shell{padding:16px}
  .rule-box{grid-template-columns:auto 1fr;padding:14px}
  .client-notification-strip{grid-template-columns:auto 1fr;padding:14px}
  .pair-line{grid-template-columns:1fr 76px 56px 32px;gap:5px}
  th,td{padding:10px 8px;font-size:12.5px}
  .toast{left:14px;right:14px;bottom:14px}
}

/* ============ DARK THEME ============ */
html[data-theme="dark"]{
  --ink:#e7eef7; --muted:#9db0c8; --blue:#c7d6ea; --line:#26364d; --strong:#38496380;
  --bg:#0b1220; --soft:#1c1a10; --shadow:0 16px 38px rgba(0,0,0,.5);
}
html[data-theme="dark"] body{background:linear-gradient(180deg,#0b1220,#080d16);color:var(--ink)}
html[data-theme="dark"] .sidebar{background:rgba(14,21,36,.97)}
html[data-theme="dark"] .topbar{background:rgba(12,18,30,.92)}
html[data-theme="dark"] .card,html[data-theme="dark"] .kpi,html[data-theme="dark"] .preview-kpi,
html[data-theme="dark"] .chip,html[data-theme="dark"] .profile,html[data-theme="dark"] .mini-card,
html[data-theme="dark"] .trade-card,html[data-theme="dark"] .cal-cell,html[data-theme="dark"] .wallet-shell,
html[data-theme="dark"] .wallet-card,html[data-theme="dark"] .wallet-line,html[data-theme="dark"] .wallet-empty,
html[data-theme="dark"] .notification-card,html[data-theme="dark"] .create-item,html[data-theme="dark"] .network-node,
html[data-theme="dark"] .client-notification-strip,html[data-theme="dark"] .calc-chart,html[data-theme="dark"] .pos-group{
  background:#141f33;border-color:var(--line)}
/* the rule above outranks .notification-card.unread, so dark mode needs its own unread style —
   without this, unread and read notifications look identical on the dark theme. */
html[data-theme="dark"] .notification-card.unread{
  background:linear-gradient(180deg,#23304c,#1a2438);border-color:var(--gold);border-left:4px solid var(--gold)}
html[data-theme="dark"] .notification-dot{background:#41506a}
html[data-theme="dark"] .notification-card.unread .notification-dot{background:var(--gold)}
html[data-theme="dark"] .pos-head{background:#182339}
html[data-theme="dark"] .select-lite,html[data-theme="dark"] select,html[data-theme="dark"] input,html[data-theme="dark"] textarea{
  background:#0e1727;border-color:#33465f;color:var(--ink)}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#647890}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3{color:#eaf1fa}
html[data-theme="dark"] .kpi strong,html[data-theme="dark"] .mini-card strong,html[data-theme="dark"] .preview-kpi strong,
html[data-theme="dark"] .trade-card strong,html[data-theme="dark"] .pos-head .who,html[data-theme="dark"] .pos-acct .num,
html[data-theme="dark"] .pos-pair,html[data-theme="dark"] .cal-day{color:#eef4fc}
html[data-theme="dark"] td{color:#cdd9ea}
html[data-theme="dark"] th,html[data-theme="dark"] .pos-acct .lbl,html[data-theme="dark"] .pos-right,html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .helper,html[data-theme="dark"] .foot,html[data-theme="dark"] .kpi small,html[data-theme="dark"] .mini-card small,
html[data-theme="dark"] .subtext,html[data-theme="dark"] .pos-empty{color:#93a6bd}
html[data-theme="dark"] .ghost-btn,html[data-theme="dark"] .icon-btn{background:#141f33;color:var(--ink);border-color:#33465f}
html[data-theme="dark"] .chip,html[data-theme="dark"] .profile b,html[data-theme="dark"] .profile,html[data-theme="dark"] button.chip{color:#e7eef7}
html[data-theme="dark"] .chip .dot{box-shadow:0 0 0 4px rgba(11,159,101,.18)}
html[data-theme="dark"] .nav a{color:#b9c8dd}
html[data-theme="dark"] .nav a:hover{background:rgba(214,154,45,.12)}
html[data-theme="dark"] .nav a.active{background:linear-gradient(90deg,rgba(214,154,45,.20),rgba(214,154,45,.05));color:#e7b055}
html[data-theme="dark"] .badge{background:#2a2416;color:#e0b968}
html[data-theme="dark"] .badge.green{background:rgba(7,151,95,.2);color:#4fd6a0}
html[data-theme="dark"] .badge.red{background:rgba(217,74,74,.2);color:#ff8a8a}
html[data-theme="dark"] .broker-tag,html[data-theme="dark"] .model h4 span,html[data-theme="dark"] .addbtn{background:#2a2416;color:#e0b968;border-color:#4a3c1c}
html[data-theme="dark"] .xbtn{background:#2a1616;color:#ff8a8a;border-color:#5a3030}
html[data-theme="dark"] .role-switch-top,html[data-theme="dark"] .target-switch{background:#0e1727}
html[data-theme="dark"] .role-switch-top button.active,html[data-theme="dark"] .target-switch button.active{background:#1b2740;color:#e7b055}
html[data-theme="dark"] .cal-cell.positive{background:linear-gradient(180deg,#141f33,#152418);border-color:#2f4a34}
html[data-theme="dark"] .cal-cell.negative{background:linear-gradient(180deg,#141f33,#26181a);border-color:#5a3030}
html[data-theme="dark"] .bar-val{background:#141f33;border-color:var(--line);color:#e7eef7}
html[data-theme="dark"] .rule-box,html[data-theme="dark"] .preview-note,html[data-theme="dark"] .referral-box,
html[data-theme="dark"] .client-wallet-note,html[data-theme="dark"] .support-card{
  background:linear-gradient(180deg,#221b0e,#181206);border-color:#4a3c1c;color:#e5c98f}
html[data-theme="dark"] .rule-box p{color:#c7b48a}
html[data-theme="dark"] .wallet-line strong,html[data-theme="dark"] .wallet-total strong,html[data-theme="dark"] .wallet-shell h2,html[data-theme="dark"] .wallet-shell h3{color:#d7e3f2}
html[data-theme="dark"] .page-dot.active{background:#2a2416;color:#e0b968}

/* Request Access — "awaiting approval" queue (yellow, prominent) */
.approve-panel{border:1px solid #e7cf94;background:linear-gradient(180deg,#fffaf0,#fff3d9);border-radius:16px;padding:18px 18px 8px;margin-bottom:18px;box-shadow:0 8px 22px rgba(184,121,22,.10)}
.approve-panel.done{display:flex;align-items:center;gap:10px;padding:16px 18px;color:#6b7a90;background:#f4f7fb;border-color:var(--line);box-shadow:none;font-weight:600}
.approve-panel.done .approve-tick{color:var(--green);font-weight:900}
.approve-head h2{color:#9b650a;margin:0 0 4px}
.approve-head .subtitle{margin:0 0 12px}
.approve-row{display:flex;gap:14px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;border-top:1px solid #eeddb4;padding:12px 0}
.approve-info{min-width:220px;flex:1 1 340px}
.approve-info .who{font-weight:900;color:var(--ink,#1f2d3d)}
.approve-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
html[data-theme="dark"] .approve-panel{background:linear-gradient(180deg,#221b0e,#181206);border-color:#4a3c1c;box-shadow:none}
html[data-theme="dark"] .approve-panel.done{background:#0e1727;border-color:var(--line);color:#9fb0c6}
html[data-theme="dark"] .approve-head h2{color:#e0b968}
html[data-theme="dark"] .approve-row{border-top-color:#3a2f16}
html[data-theme="dark"] .approve-info .who{color:#d7e3f2}

/* Partners & Clients — "Direct Clients" / "Sub IB Structure" section headers */
.ib-group-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin:16px 2px 8px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.ib-group-head:first-child{margin-top:2px}
.ib-group-title{font-weight:900;font-size:12.5px;letter-spacing:.05em;text-transform:uppercase;color:var(--gold2)}
.ib-group-sub{font-size:11px;color:#6b7a90}
html[data-theme="dark"] .ib-group-title{color:#e0b968}
html[data-theme="dark"] .ib-group-sub{color:#9fb0c6}

/* Calculator projection disclaimer */
.calc-disclaimer{border:1px solid #e7cf94;background:linear-gradient(180deg,#fffaf0,#fff4d9);border-radius:12px;padding:12px 14px;margin:2px 0 14px;font-size:12.5px;line-height:1.5;color:#7a5a12}
html[data-theme="dark"] .calc-disclaimer{background:linear-gradient(180deg,#221b0e,#181206);border-color:#4a3c1c;color:#d9c48c}

/* ---- Notification matrix (mandatory vs optional, per channel) ---- */
.nm-sec{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin:14px 0 8px;font-weight:700}
.nm-sec:first-child{margin-top:0}
.nm-table{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.nm-row{display:grid;grid-template-columns:minmax(0,1fr) 104px 104px;align-items:center;gap:10px;padding:11px 14px;border-top:1px solid var(--line)}
.nm-row:first-child{border-top:0}
.nm-row>span:nth-child(2),.nm-row>span:nth-child(3){text-align:center}
.nm-row b{display:block;font-size:13px}
.nm-row small{display:block;color:var(--muted);font-size:12px;margin-top:2px;line-height:1.45}
.nm-row input{width:auto;margin:0;cursor:pointer}
.nm-head{background:var(--soft,#f6f7f9);font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);font-weight:700}
.nm-always{display:inline-block;font-size:11px;font-weight:700;line-height:1.2;padding:5px 9px;border-radius:999px;border:1px solid var(--line);color:var(--muted);background:var(--soft,#f6f7f9)}
html[data-theme="dark"] .nm-table{background:#0f1621}
html[data-theme="dark"] .nm-head{background:#131c29}
html[data-theme="dark"] .nm-always{background:#131c29;border-color:#24324a}
@media (max-width:620px){.nm-row{grid-template-columns:minmax(0,1fr) 64px 64px;padding:10px}}

/* ---- Profile dropdown (top-right) ---- */
.profile-wrap{position:relative}
.profile{display:flex;align-items:center;gap:12px;background:transparent;border:0;cursor:pointer;padding:4px 6px;border-radius:12px;color:inherit;font:inherit}
.profile:hover{background:rgba(125,138,160,.12)}
.profile .profile-id{text-align:left;line-height:1.2}
.profile .profile-id b{display:block;font-size:13px}
.profile .profile-id small{display:block;color:var(--muted);font-size:11px}
.profile-gear{color:#7d8aa0;font-size:16px;margin-left:2px}
.profile-menu{position:absolute;top:calc(100% + 10px);right:0;width:320px;max-width:88vw;max-height:78vh;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:0 18px 48px rgba(7,26,55,.22);padding:14px;z-index:120}
.profile-menu[hidden]{display:none}
.pm-id{display:flex;align-items:center;gap:12px;padding-bottom:12px;border-bottom:1px solid var(--line);margin-bottom:12px}
.pm-id .avatar{width:40px;height:40px;font-size:14px}
.pm-id-t b{display:block;font-size:14px}
.pm-id-t small{display:block;color:var(--muted);font-size:12px;word-break:break-all}
.pm-sec{padding:10px 0;border-bottom:1px solid var(--line)}
.pm-h{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:700;margin-bottom:8px}
.pm-sec input{width:100%;margin:0 0 8px;box-sizing:border-box}
.pm-sec .gold-btn,.pm-sec .ghost-btn{width:100%;text-align:center}
.pm-row{display:flex;justify-content:space-between;gap:12px;align-items:baseline;padding:4px 0;font-size:13px}
.pm-row small{color:var(--muted);font-size:12px}
.pm-row span{font-weight:600;text-align:right;word-break:break-all}
.pm-logout{display:block;text-align:center;margin-top:12px;padding:9px;border-radius:10px;color:#b4232a;font-weight:800;text-decoration:none;border:1px solid var(--line)}
.pm-logout:hover{background:rgba(180,35,42,.08)}
html[data-theme="dark"] .profile-menu{background:#0f1621;border-color:#24324a}
html[data-theme="dark"] .pm-logout{color:#ff8a8a}
@media (max-width:520px){.profile .profile-id{display:none}}

/* ---- Calendar cell: day's gross swap + running net (spread included) ---- */
.cal-line{display:flex;align-items:baseline;justify-content:space-between;gap:6px;line-height:1.15}
/* In the side-by-side layout the VALUE must never give up space — the caption yields first. Without
   this, flex shrank both equally and a 4-figure amount was silently ellipsised to "-$123…" while the
   word "Net" kept its full width. Bit at 1024px and at any width once the sidebar narrows the panel. */
.cal-line>.cal-k{flex:0 1 auto;min-width:0;overflow:hidden}
.cal-line>.cal-g,.cal-line>.cal-amount{flex:0 0 auto}
.cal-line+.cal-line{margin-top:auto}
.cal-k{font-size:9.5px;text-transform:uppercase;letter-spacing:.05em;font-weight:900;color:#98a3b6}
.cal-g{font-size:12px;font-weight:800;color:var(--green);white-space:nowrap}
.cal-cell .cal-amount{margin-top:0;font-size:14px}
.cal-cell.negative .cal-g{color:var(--green)}
/* WEEKEND: markets are shut, so Sat/Sun always read $0.00. In the normal green that looks like a
   real earning day; grey removes the false signal. Overrides the positive/negative tints too. */
.cal-cell.weekend{background:#f6f7f9;border-color:#e4e8ee;box-shadow:none}
.cal-cell.weekend .cal-day{color:#93a0b2}
.cal-cell.weekend .cal-k{color:#aab3c1}
.cal-cell.weekend .cal-g,.cal-cell.weekend .cal-amount{color:#93a0b2}
.cal-panel .day-name:nth-child(6),.cal-panel .day-name:nth-child(7){color:#a2adbc}
html[data-theme="dark"] .cal-k{color:#7f8da3}
html[data-theme="dark"] .cal-cell.weekend{background:#121a27;border-color:#23303f}
html[data-theme="dark"] .cal-cell.weekend .cal-day,
html[data-theme="dark"] .cal-cell.weekend .cal-g,
html[data-theme="dark"] .cal-cell.weekend .cal-amount{color:#6d7c90}
html[data-theme="dark"] .cal-cell.weekend .cal-k{color:#5d6b7e}
html[data-theme="dark"] .cal-panel .calendar-grid::-webkit-scrollbar-track{background:rgba(255,255,255,.07)}
html[data-theme="dark"] .cal-panel .calendar-grid::-webkit-scrollbar-thumb{background:rgba(255,255,255,.3)}
@media (max-width:620px){
  .cal-k{display:none}
  .cal-line{justify-content:flex-end}
  .cal-g{font-size:clamp(8px,2.3vw,11px)}
  .cal-cell .cal-amount{font-size:clamp(9px,2.6vw,13px)}
}

/* ---- Full-width calendar: bigger, readable cells (was cramped in a half-width column) ---- */
.cal-panel .calendar-grid{gap:10px}
.cal-panel .cal-cell{min-height:110px;padding:12px 14px;gap:6px}
.cal-panel .cal-day{font-size:16px}
.cal-panel .cal-k{font-size:11px}
.cal-panel .cal-g{font-size:16px}
.cal-panel .cal-cell .cal-amount{font-size:19px}
.cal-panel .day-name{font-size:12px;padding:0 6px 8px}
.cal-panel .calendar-summary{grid-template-columns:repeat(3,minmax(0,320px));justify-content:start}
@media (max-width:900px){
  /* A 7-column money calendar cannot fit currency below ~900px: the columns collapse to ~68px while
     "-$121.10" needs ~60px of a ~52px content box, so the net was clipped to "-$…". Give the columns
     a readable MINIMUM and let the grid scroll horizontally inside its own panel; the page body never
     scrolls sideways. This must cover the whole range down from 900px — scoping it to <=620px only
     left 621-750px still clipping, which is exactly what a ~680px phone/webview showed. */
  .cal-panel .calendar-grid{
    grid-template-columns:repeat(7,minmax(84px,1fr));
    overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;
    padding-bottom:8px;scrollbar-width:thin;overscroll-behavior-x:contain}
  /* Visible handle: mobile hides overlay scrollbars until you swipe, so the grid otherwise just
     looks cropped and nobody discovers the rest of the week. */
  .cal-panel .calendar-grid::-webkit-scrollbar{height:6px}
  .cal-panel .calendar-grid::-webkit-scrollbar-track{background:rgba(18,36,65,.07);border-radius:4px}
  .cal-panel .calendar-grid::-webkit-scrollbar-thumb{background:rgba(18,36,65,.28);border-radius:4px}
  .cal-panel .cal-cell{min-height:84px;padding:8px}
  .cal-panel .cal-day{font-size:13px}
  .cal-panel .cal-g{font-size:13px}
  .cal-panel .cal-cell .cal-amount{font-size:15px}
  /* Stack the caption ABOVE the value from tablet down. Side by side, "Net" plus the gap eats ~30px
     of a ~74px cell, which silently clipped 4-figure amounts ("-$1234.56" rendered in 44px as
     "-$123…"). Stacked, the number gets the cell's full width. margin-top:auto is left alone so the
     net line still sits at the bottom of the cell. */
  .cal-panel .cal-k{display:block;font-size:9.5px;line-height:1.15;letter-spacing:.04em}
  .cal-panel .cal-line{display:block}
}
@media (max-width:620px){
  /* Phone tuning only — the minimum column width, horizontal scroll, scrollbar and caption stacking
     all come from the <=900px block above so the whole sub-900px range behaves the same. */
  .cal-panel .cal-cell{min-height:80px;padding:8px 7px}
  .cal-panel .cal-day{font-size:12px}
  .cal-panel .cal-g{font-size:12.5px}
  .cal-panel .cal-cell .cal-amount{font-size:13.5px}
  .cal-panel .cal-k{font-size:8.5px}
  .cal-panel .day-name{font-size:11px;padding:0 2px 6px}
  .cal-panel .calendar-summary{grid-template-columns:1fr}
}

/* ---- Admin support tickets grouped per client ---- */
.tk-group{border:1px solid var(--line);border-radius:14px;margin-bottom:10px;overflow:hidden;background:#fff}
.tk-group-head{width:100%;display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--soft,#f6f7f9);border:0;cursor:pointer;font:inherit;text-align:left;color:inherit}
.tk-group-head:hover{filter:brightness(.98)}
.tk-group-head b{flex:1;min-width:0;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tk-caret{color:var(--muted);font-size:12px;width:12px;flex:0 0 auto}
.tk-counts{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.tk-group-body{padding:10px 12px;display:grid;gap:10px}
/* MUST come after the display:grid above. An author `display` rule beats the browser's built-in
   [hidden]{display:none}, so without this the group never actually collapsed — the attribute
   toggled correctly but the panel stayed open. */
.tk-group-body[hidden]{display:none}
.tk-group-body .ticket-item{margin:0}
html[data-theme="dark"] .tk-group{background:#0f1621;border-color:#24324a}
html[data-theme="dark"] .tk-group-head{background:#131c29}

/* Calendar days outside the account's life (before it started, or still in the future). Showing
   "$0.00 / —" on those made an empty month read like rows of real zeros — clients found it
   confusing. Keep the date for grid alignment, drop the figures. */
.cal-cell.void{background:transparent;border-style:dashed;box-shadow:none;opacity:.35}
.cal-cell.void .cal-day{font-weight:700}
html[data-theme="dark"] .cal-cell.void{background:transparent}

/* ---- Credential rows: masked secret + eye reveal + copy (matches the reference panel) ---- */
.cred-block{border:1px solid var(--line);border-radius:12px;padding:10px 12px;margin-bottom:10px;background:#fff}
.cred-block:last-child{margin-bottom:0}
.cred-head{font-size:11px;letter-spacing:.06em;text-transform:uppercase;font-weight:900;color:var(--muted);margin-bottom:6px}
.cred-row{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--line)}
.cred-row:last-child{border-bottom:none}
.cred-key{font-size:11px;letter-spacing:.05em;text-transform:uppercase;font-weight:800;color:var(--muted);flex:0 0 auto}
.cred-vwrap{display:flex;align-items:center;gap:6px;min-width:0}
.cred-val{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;font-weight:700;color:var(--ink);text-align:right;word-break:break-all}
.cred-val.masked{letter-spacing:.2em;color:var(--muted)}
.btn-copy{padding:3px 8px;background:#fff;border:1px solid var(--strong);border-radius:8px;color:var(--blue);font-size:12px;line-height:1.3;cursor:pointer;flex:0 0 auto}
.btn-copy:hover{background:var(--soft)}
.btn-copy:active{transform:scale(.95)}
.pm-sec .cred-row{padding:4px 0}
html[data-theme="dark"] .cred-block{background:#0f1621;border-color:#24324a}
html[data-theme="dark"] .cred-val{color:#eef4fc}
html[data-theme="dark"] .btn-copy{background:#131c29;border-color:#24324a;color:#8ab4f8}
html[data-theme="dark"] .cred-row{border-bottom-color:#24324a}

/* Admin-only reserved block. Deliberately amber and deliberately loud: it is the one panel on the
   page holding a THIRD PARTY's name and broker-portal password, and it must never be mistaken for
   something safe to screen-share. Reads as a warning in both themes. */
.cred-block.reserved{border:1px solid #d9a227;background:#fffaf0}
.cred-block.reserved .res-head{display:flex;align-items:center;gap:8px;color:#8a5a00;font-size:11px}
.cred-block.reserved .res-edit{margin-left:auto;padding:2px 10px;font-size:11px;line-height:1.7}
.res-side{margin-top:8px}
.res-side-head{font-size:10px;letter-spacing:.08em;text-transform:uppercase;font-weight:800;color:#a4741a;margin-bottom:2px}
.cred-block.reserved .cred-row{border-bottom-color:#f0dfb8}
.cred-block.reserved .cred-key{color:#8a6a2a}
.cred-val.yes{color:#1a7f45}
.cred-val.no{color:#b23b3b}
.res-f{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:5px 0;border-bottom:1px solid #f0dfb8}
.res-f:last-child{border-bottom:none}
.res-f>span{font-size:12px;color:#8a6a2a;font-weight:700}
.res-f input[type=text],.res-f input:not([type]),.res-f input[type=password]{flex:1;max-width:60%;border:1px solid #e2cb92;border-radius:8px;padding:5px 8px;font-size:13px;background:#fff;color:var(--ink)}
.res-f input[type=checkbox]{width:16px;height:16px;accent-color:#d9a227}
.res-actions{display:flex;gap:8px;margin-top:10px;justify-content:flex-end}
html[data-theme="dark"] .cred-block.reserved{background:#241d0d;border-color:#7a5c15}
html[data-theme="dark"] .cred-block.reserved .res-head{color:#f0c64e}
html[data-theme="dark"] .res-side-head{color:#d6a939}
html[data-theme="dark"] .cred-block.reserved .cred-row{border-bottom-color:#4a3a12}
html[data-theme="dark"] .cred-block.reserved .cred-key{color:#c9a961}
html[data-theme="dark"] .res-f{border-bottom-color:#4a3a12}
html[data-theme="dark"] .res-f>span{color:#c9a961}
html[data-theme="dark"] .res-f input[type=text],html[data-theme="dark"] .res-f input:not([type]),html[data-theme="dark"] .res-f input[type=password]{background:#161d29;border-color:#4a3a12;color:#eef4fc}
html[data-theme="dark"] .cred-val.yes{color:#4ade80}
html[data-theme="dark"] .cred-val.no{color:#f87171}

/* ---- Per-client Telegram support groups (admin) ---- */
.tg-group{border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin-bottom:10px;background:#fff}
.tg-group-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.tg-group-head b{font-size:14px}
/* Create-a-panel bar + the per-panel remove control. */
.tg-newbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.tg-newbar select{max-width:340px;flex:1 1 220px}
.tg-rm{margin-left:auto;border:1px solid var(--line);background:transparent;color:var(--muted);border-radius:8px;
  width:26px;height:26px;line-height:1;cursor:pointer;font-size:13px;flex:none}
.tg-rm:hover{border-color:#b23b3b;color:#b23b3b}
html[data-theme="dark"] .tg-rm:hover{border-color:#f87171;color:#f87171}
.tg-mems{display:flex;flex-wrap:wrap;gap:8px}
.tg-mem{font-size:12px;padding:5px 10px;border-radius:999px;border:1px dashed var(--strong);color:var(--muted);background:var(--soft)}
.tg-mem.on{border-style:solid;border-color:#bfe6cf;background:#e7f6ee;color:var(--green)}
.tg-mem b{color:inherit}
html[data-theme="dark"] .tg-group{background:#0f1621;border-color:#24324a}
html[data-theme="dark"] .tg-mem{background:#131c29;border-color:#2a3a52}
html[data-theme="dark"] .tg-mem.on{background:#152418;border-color:#2f4a34;color:#5fd39a}

/* EA build column in the admin EA Status table. A stale EA keeps trading and reporting, so it looks
   fine — it has to be visually loud or nobody ever notices it needs replacing. */
.ea-stale{color:#b23b3b;font-weight:800;white-space:nowrap}
.ea-ok{color:var(--muted);white-space:nowrap}
html[data-theme="dark"] .ea-stale{color:#f87171}
