:root{
  --bg:#0B1220;
  --nav:#0F172A;
  --card:#111C33;
  --card2:#0E1A30;
  --border:#22304D;
  --text:#E8EEF9;
  --text2:#A9B7D0;
  --muted:#6F83A8;

  --success:#22C55E;
  --warn:#F59E0B;
  --danger:#EF4444;
  --accent:#7C3AED;

  --radius:16px;
  --radius2:12px;
  --shadow:0 10px 25px rgba(0,0,0,.35);

  --container:1200px;
  --gap:24px;
  --h-nav:72px;
  --h-topbar:64px;
  --w-sidebar:264px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue";
  background:var(--bg);
  color:var(--text);
}

a{color:inherit;text-decoration:none}
button{font:inherit}
img{max-width:100%;display:block}

.container{max-width:var(--container); margin:0 auto; padding:0 24px;}
.row{display:flex; gap:var(--gap);}
.col{flex:1}
.grid{display:grid; gap:var(--gap);}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr));}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr));}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr));}
@media(max-width:1100px){
  .grid-4{grid-template-columns:repeat(2,minmax(0,1fr));}
  .grid-3{grid-template-columns:repeat(1,minmax(0,1fr));}
  .row{flex-direction:column;}
}

.h1{font-size:36px;line-height:44px;font-weight:650;margin:0 0 12px}
.h2{font-size:24px;line-height:32px;font-weight:650;margin:0 0 12px}
.h3{font-size:18px;line-height:26px;font-weight:650;margin:0 0 8px}
.p{font-size:14px;line-height:22px;color:var(--text2);margin:0 0 12px}
.small{font-size:12px;line-height:18px;color:var(--muted)}
.kbd{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono"; padding:2px 6px; border:1px solid var(--border); border-radius:8px; background:rgba(255,255,255,.04); color:var(--text2)}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.card.pad{padding:24px;}
.card.pad16{padding:16px;}
.card2{background:var(--card2); border:1px solid var(--border); border-radius:var(--radius);}

.hr{height:1px;background:var(--border); margin:16px 0}

.nav{
  position:sticky; top:0; z-index:10;
  height:var(--h-nav);
  background:var(--nav);
  border-bottom:1px solid var(--border);
}
.nav-inner{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:750;
  letter-spacing:.2px;
}
.logo{
  width:28px;height:28px;border-radius:10px;
  background:linear-gradient(135deg, var(--accent), rgba(124,58,237,.25));
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 8px 20px rgba(124,58,237,.2);
}
.nav-links{display:flex; align-items:center; gap:16px; color:var(--text2)}
.nav-links a{padding:10px 10px; border-radius:10px;}
.nav-links a:hover{background:rgba(255,255,255,.04); color:var(--text)}

.btn{
  height:44px;
  padding:0 16px;
  border-radius:var(--radius2);
  border:1px solid var(--border);
  background:transparent;
  color:var(--text);
  display:inline-flex; align-items:center; justify-content:center;
  gap:10px;
  cursor:pointer;
}
.btn:hover{background:rgba(255,255,255,.04)}
.btn.primary{
  border-color:transparent;
  background:var(--accent);
}
.btn.primary:hover{filter:brightness(1.06)}
.btn.secondary{height:40px}
.btn.danger{background:var(--danger); border-color:transparent}
.btn.ghost{border-color:transparent;background:rgba(255,255,255,.05)}
.btn.block{width:100%}
.btn:disabled{opacity:.5; cursor:not-allowed}

.input{
  width:100%;
  height:44px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}
.input:focus{border-color:rgba(124,58,237,.7); box-shadow:0 0 0 4px rgba(124,58,237,.18)}
.label{font-size:12px;color:var(--text2); margin:0 0 6px}
.form-row{display:flex; flex-direction:column; gap:8px; margin:0 0 14px}
.checkbox{display:flex; align-items:flex-start; gap:10px; color:var(--text2); font-size:12px; line-height:18px}
.checkbox input{margin-top:2px}

.pill{
  display:inline-flex; align-items:center; justify-content:center;
  height:28px; padding:0 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  color:var(--text2);
  font-size:12px;
}
.pill.success{border-color:rgba(34,197,94,.4); color:#b8f7cc; background:rgba(34,197,94,.08)}
.pill.warn{border-color:rgba(245,158,11,.4); color:#ffe3aa; background:rgba(245,158,11,.08)}
.pill.danger{border-color:rgba(239,68,68,.4); color:#ffc5c5; background:rgba(239,68,68,.08)}
.pill.accent{border-color:rgba(124,58,237,.5); color:#e7dbff; background:rgba(124,58,237,.12)}

.table{width:100%; border-collapse:separate; border-spacing:0; overflow:hidden; border-radius:14px; border:1px solid var(--border);}
.table th,.table td{padding:12px 12px; font-size:12px; color:var(--text2); border-bottom:1px solid rgba(34,48,77,.6);}
.table th{background:rgba(255,255,255,.03); color:var(--muted); text-align:left; font-weight:650;}
.table tr:last-child td{border-bottom:none;}
.table td strong{color:var(--text)}

.hero{
  padding:64px 0 40px;
}
.hero-grid{
  display:grid;
  grid-template-columns:7fr 5fr;
  gap:var(--gap);
  align-items:start;
}
@media(max-width:1100px){ .hero-grid{grid-template-columns:1fr;} }

.mock{
  height:360px;
  background:linear-gradient(135deg, rgba(124,58,237,.18), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.08);
  border-radius:var(--radius);
  padding:16px;
}

.auth-wrap{
  min-height:calc(100vh - var(--h-nav));
  display:flex; align-items:center; justify-content:center;
  padding:40px 24px;
}
.auth-card{width:420px; padding:24px;}
.auth-footer{margin-top:12px; text-align:center; color:var(--muted); font-size:12px}
.auth-footer a{color:var(--text2); text-decoration:underline}

.wizard-wrap{min-height:100vh;}
.wizard-top{
  height:64px; display:flex; align-items:center;
  background:var(--nav); border-bottom:1px solid var(--border);
}
.steps{display:flex; gap:10px; color:var(--muted); font-size:12px}
.step{padding:8px 10px; border-radius:999px; border:1px solid rgba(34,48,77,.8); background:rgba(255,255,255,.02)}
.step.active{color:var(--text); border-color:rgba(124,58,237,.6); background:rgba(124,58,237,.10)}
.wizard-main{max-width:720px; margin:0 auto; padding:28px 24px 48px;}
.wizard-actions{display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:18px}
.linkbtn{border:none;background:none;color:var(--text2);cursor:pointer;padding:10px 0}
.linkbtn:hover{color:var(--text); text-decoration:underline}

.toggle{
  width:52px;height:30px;border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  position:relative;
  cursor:pointer;
}
.toggle::after{
  content:"";
  width:24px;height:24px;border-radius:999px;
  background:rgba(255,255,255,.85);
  position:absolute; top:2px; left:2px;
  transition:.18s ease;
}
.toggle.on{background:rgba(124,58,237,.35); border-color:rgba(124,58,237,.6)}
.toggle.on::after{left:26px; background:white}

.app-shell{
  display:grid;
  grid-template-columns:var(--w-sidebar) 1fr;
  min-height:100vh;
}
.sidebar{
  background:var(--nav);
  border-right:1px solid var(--border);
  padding:16px;
}
.side-brand{height:56px; display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:12px;}
.navitem{
  height:44px; display:flex; align-items:center;
  padding:0 12px; border-radius:12px;
  color:var(--text2); cursor:pointer;
}
.navitem:hover{background:rgba(255,255,255,.04); color:var(--text)}
.navitem.active{background:rgba(124,58,237,.12); color:var(--text); border:1px solid rgba(124,58,237,.35)}
.topbar{
  height:var(--h-topbar);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 24px;
  border-bottom:1px solid var(--border);
  background:rgba(15,23,42,.35);
  backdrop-filter: blur(10px);
}
.topbar-right{display:flex; align-items:center; gap:10px}
.page{padding:24px; max-width:var(--container); margin:0 auto;}
.page-title{margin:0; font-size:18px; font-weight:650}

.toast{
  position:fixed; top:18px; right:18px; z-index:50;
  width:360px; padding:14px;
  border-radius:14px; border:1px solid var(--border);
  background:rgba(17,28,51,.95);
  box-shadow:var(--shadow);
  display:none;
}
.toast.show{display:block}
.toast .t{font-weight:650; margin:0 0 4px; font-size:14px}
.toast .b{margin:0; font-size:12px; color:var(--text2)}

.modal-backdrop{
  position:fixed; inset:0; z-index:60;
  background:rgba(0,0,0,.55);
  display:none;
  align-items:center; justify-content:center;
  padding:24px;
}
.modal-backdrop.show{display:flex}
.modal{
  width:min(560px, 100%);
  padding:18px;
  border-radius:16px;
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
}
.modal h3{margin:0 0 8px}
.modal p{margin:0 0 12px; color:var(--text2); font-size:14px; line-height:22px}
.modal .actions{display:flex; gap:12px; justify-content:flex-end; margin-top:10px}

.badge-row{display:flex; gap:8px; flex-wrap:wrap}

/* ===== Trade Log tab pills (Orders / Positions / Exits) ===== */
.pill[data-tlog-tab]{
  cursor: pointer;
  user-select: none;
}

.pill[data-tlog-tab]:hover{
  opacity: 0.92;
}

.pill[data-tlog-tab]:active{
  transform: translateY(1px);
}

.pill[data-tlog-tab]:focus{
  outline: none;
}

.pill[data-tlog-tab]:focus-visible{
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}

/* --- Fix Windows/Chrome select dropdown option visibility --- */
select.input { color-scheme: dark; }
select.input option { color: #111; background: #fff; }

/* MOBILE_DASHBOARD_FIX_V1_2026-03-08 */
@media (max-width: 768px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 12px 16px;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page {
    padding: 16px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .page-title {
    font-size: 16px;
    line-height: 22px;
  }

  .h1 {
    font-size: 28px;
    line-height: 34px;
  }

  .h2 {
    font-size: 22px;
    line-height: 28px;
  }

  .h3 {
    font-size: 16px;
    line-height: 22px;
  }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .card.pad,
  .card.pad16 {
    padding: 16px;
  }

  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table th,
  .table td {
    white-space: nowrap;
  }

  .pill,
  .btn {
    max-width: 100%;
  }

  .small,
  .p,
  .h1,
  .h2,
  .h3,
  .page-title,
  .stat-account-value,
  .stat-buying-power {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
