:root{
  --bg:#f4f7fb;
  --card:#ffffff;
  --stroke:#e6ecf5;
  --stroke2:#d6dfef;
  --text:#0f172a;
  --mut:#667085;
  --blue:#2b7cff;
  --blue2:#1e63e9;
  --shadow:0 10px 30px rgba(15,23,42,.08);
  --shadow2:0 6px 18px rgba(15,23,42,.08);
  --r:14px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background:var(--bg);
}

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:#fff;
  border-bottom:1px solid var(--stroke);
  display:grid;
  grid-template-columns: 280px 1fr auto;
  gap:16px;
  align-items:center;
  padding:14px 18px;
}

.brand{ display:flex; align-items:center; gap:10px; }
.logo{
  width:34px; height:34px;
  display:grid; place-items:center;
  border-radius:10px;
  border:1px solid var(--stroke2);
  background:#f7faff;
}
.title{ font-weight:800; font-size:18px; }

.search{
  width:100%;
  max-width:640px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  outline:none;
  background:#fff;
}
.search:focus{ border-color:rgba(43,124,255,.55); box-shadow:0 0 0 4px rgba(43,124,255,.12); }
.search::placeholder{ color:#98a2b3; }

.tabs{
  display:flex;
  gap:8px;
  padding:6px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:#fff;
}
.tab{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid transparent;
  background:transparent;
  cursor:pointer;
  font-weight:650;
  color:#344054;
  font-size:13px;
}
.tab.active{
  background:#eef5ff;
  border-color:#cfe1ff;
  color:#1d4ed8;
}

.shell{
  max-width:1200px;
  margin:0 auto;
  padding:18px;
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:18px;
}

.sidebar{ position:sticky; top:76px; align-self:start; }
.panel{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--r);
  box-shadow:var(--shadow2);
  overflow:hidden;
  margin-bottom:12px;
}
.panel.collapsed{ opacity:.9; }
.panel-h{
  padding:12px 14px;
  font-weight:800;
  font-size:13px;
  color:#344054;
  border-bottom:1px solid var(--stroke);
  background:#fbfcff;
}

.nav{ display:flex; flex-direction:column; padding:10px; gap:6px; }
.navlink{
  text-decoration:none;
  padding:10px 10px;
  border-radius:12px;
  color:#344054;
  border:1px solid transparent;
}
.navlink:hover{ background:#f2f6ff; border-color:#e3ecff; }
.navlink.active{
  position:relative;
  background:#f2f6ff;
  border-color:#e3ecff;
  font-weight:750;
}
.navlink.active::before{
  content:"";
  position:absolute;
  left:-10px;
  top:8px;
  bottom:8px;
  width:3px;
  border-radius:3px;
  background:var(--blue);
}

/* active nav item from active.js */
.navlink.current{
  background:#1d4ed8;
  color:#fff;
  font-weight:900;
  border-color:#1d4ed8;
}
.navlink.current::before{ background:#1d4ed8; }

.main{
  display:grid;
  grid-template-columns: 1fr 280px;
  gap:16px;
  align-items:start;
}

.actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-bottom:10px;
}

.btn{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:#fff;
  cursor:pointer;
  font-weight:700;
  color:#344054;
}
.btn:hover{ background:#f7f9ff; }

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px 16px;
  margin-bottom:14px;
}
.card.accent{
  border-color:#cfe1ff;
  box-shadow:0 12px 30px rgba(43,124,255,.12);
}
.card-title{
  font-size:18px;
  font-weight:850;
  margin:0 0 10px;
  color:#0f172a;
}
.card.active{
  background:#1d4ed8;
  color:#fff;
  border-color:#1d4ed8;
}
.card.active .card-title,
.card.active .para,
.card.active .bullets,
.card.active .mini-v,
.card.active .mini-k,
.card.active .quote,
.card.active .italic{
  color:#fff;
}

.bullets{
  margin:8px 0 0 18px;
  color:#344054;
  line-height:1.7;
}

.para{ margin:10px 0 0; color:#344054; line-height:1.55; }
.italic{ font-style:italic; color:#475467; }

.quote{
  font-weight:800;
  color:#0f172a;
  margin:4px 0 8px;
}

.mini{
  margin-top:12px;
  border:1px solid var(--stroke);
  background:#f8fafc;
  border-radius:12px;
  overflow:hidden;
}
.mini-row{
  display:grid;
  grid-template-columns: 130px 1fr;
  gap:10px;
  padding:10px 12px;
  border-top:1px solid var(--stroke);
}
.mini-row:first-child{ border-top:0; }
.mini-k{ font-weight:800; color:#344054; }
.mini-v{ color:#344054; }

.quicklines{
  position:sticky;
  top:76px;
  background:linear-gradient(180deg, #1e3a8a, #1d4ed8);
  border-radius:16px;
  padding:12px;
  box-shadow:0 18px 40px rgba(30,64,175,.18);
  color:#fff;
}
.ql-h{
  font-weight:900;
  padding:6px 8px 10px;
}
.ql{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.08);
  color:#fff;
  cursor:pointer;
  margin-bottom:10px;
}
.ql:hover{ background:rgba(255,255,255,.14); }
.ql-hint{
  font-size:12px;
  opacity:.85;
  padding:2px 8px 6px;
}

/* OBJECTION GRID */
.ob-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin-top:12px;
}
.ob-card{
  border:1px solid var(--stroke);
  background:#f8fafc;
  border-radius:12px;
  padding:12px 12px;
}
.ob-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.ob-title{
  font-weight:900;
  color:#0f172a;
  line-height:1.2;
}
.ob-chip{
  font-size:11px;
  font-weight:800;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #dbe7ff;
  background:#eef5ff;
  color:#1d4ed8;
  white-space:nowrap;
}
.ob-label{
  font-size:11px;
  font-weight:900;
  color:#667085;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-top:8px;
}
.ob-say{
  margin-top:6px;
  padding:10px 10px;
  border-radius:12px;
  border:1px dashed #cfe1ff;
  background:#ffffff;
  color:#344054;
  line-height:1.45;
}

@media (max-width: 980px){
  .topbar{ grid-template-columns: 1fr; }
  .shell{ grid-template-columns: 1fr; }
  .sidebar{ position:relative; top:auto; }
  .main{ grid-template-columns: 1fr; }
  .rightbar{ order:-1; }
  .ob-grid{ grid-template-columns: 1fr; }
}
@media print{
  .topbar,.sidebar,.actions,.rightbar{ display:none !important; }
  body{ background:#fff; }
  .card{ box-shadow:none; }
}

/* LAYOUT FIX OVERRIDE */
.shell{
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 18px !important;
  grid-template-columns: 300px 1fr !important;
}

.main{
  grid-template-columns: 1fr 320px !important;
}

.sidebar{
  position: sticky !important;
  top: 76px !important;
}

.search{
  max-width: 720px !important;
}

@media (max-width: 980px){
  .shell{ grid-template-columns: 1fr !important; }
  .main{ grid-template-columns: 1fr !important; }
}

/* ACTIVE CARD CONTRAST FIX */
.card.active .mini{
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.22) !important;
}
.card.active .mini-row{
  border-top-color: rgba(255,255,255,.18) !important;
}
.card.active .mini-k{
  color: rgba(255,255,255,.95) !important;
}
.card.active .mini-v{
  color: rgba(255,255,255,.95) !important;
}
.card.active .mini-row *{
  color: rgba(255,255,255,.95) !important;
}

/* if any nested boxes exist inside an active card, keep them readable */
.card.active .ob-card,
.card.active .ob-say{
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.22) !important;
}
.card.active .ob-title,
.card.active .ob-label,
.card.active .ob-say{
  color: rgba(255,255,255,.95) !important;
}
.card.active .ob-chip{
  background: rgba(255,255,255,.18) !important;
  border-color: rgba(255,255,255,.25) !important;
  color: #fff !important;
}

/* TOPBAR ALWAYS ON TOP */
.topbar{
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
}
.card,
.quicklines,
.sidebar,
.panel{
  position: relative;
  z-index: 1;
}

/* FIXED TOPBAR (NEVER DISAPPEARS) */
.topbar{
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  z-index: 999999 !important;
}
.shell{
  margin-top: 86px !important;
}
