/* ========================================================================
   AssuredHub — Shared Styles
   Base theme preserved from v1 (navy/gold), extended for the full hub:
   sidebar nav, cards, progress bars, modals, badges, forms.
   ======================================================================== */

:root{
  --navy:#0f1e3d;
  --navy-2:#16294f;
  --blue:#2563eb;
  --gold:#f59e0b;
  --gold-light:#fbbf24;
  --white:#fff;
  --gray:#f8fafc;
  --gray-2:#f1f5f9;
  --border:#e2e8f0;
  --text:#1e293b;
  --muted:#64748b;
  --green:#10b981;
  --red:#ef4444;
  --radius:14px;
  --radius-sm:10px;
  --shadow:0 4px 16px rgba(15,30,61,0.06);
  --shadow-lg:0 24px 60px rgba(15,30,61,0.18);
}

*{box-sizing:border-box; margin:0; padding:0}
html,body{height:100%}
body{
  font-family:'Inter','Segoe UI',system-ui,-apple-system,sans-serif;
  background:var(--gray);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
a{color:inherit; text-decoration:none}
img{max-width:100%; display:block}
button{font-family:inherit; cursor:pointer}

/* ---------------------------------------------------------------------- */
/* Demo banner                                                             */
/* ---------------------------------------------------------------------- */
.demo-banner{
  position:fixed; top:0; left:0; right:0; z-index:9999;
  background:linear-gradient(90deg,var(--gold),var(--gold-light));
  color:#7c2d12; text-align:center; padding:7px 12px;
  font-size:12px; font-weight:700; letter-spacing:.5px;
  display:flex; align-items:center; justify-content:center; gap:6px;
  box-shadow:0 2px 8px rgba(245,158,11,.4);
}

/* ---------------------------------------------------------------------- */
/* Auth screens (login / register) — wave background                      */
/* ---------------------------------------------------------------------- */
.auth-wrap{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden;
  background:linear-gradient(160deg,var(--navy) 0%,var(--navy-2) 100%);
}
.auth-wrap canvas{position:absolute; inset:0; width:100%; height:100%}
.auth-logo{position:relative; z-index:2; text-align:center; margin-bottom:1.5rem}
.auth-logo img{height:64px; margin:0 auto; filter:brightness(0) invert(1)}
.auth-card{
  position:relative; z-index:2;
  width:100%; max-width:420px; margin:0 1.25rem;
  background:rgba(255,255,255,.97);
  border-radius:var(--radius);
  padding:2rem 1.75rem;
  box-shadow:var(--shadow-lg);
  backdrop-filter:blur(6px);
}
.auth-title{font-size:1.5rem; font-weight:800; color:var(--navy); margin-bottom:.25rem}
.auth-sub{font-size:.85rem; color:var(--muted); margin-bottom:1.5rem}
.auth-hint{font-size:.75rem; color:var(--muted); text-align:center; margin-top:1rem}
.auth-back{
  background:none; border:none; color:var(--blue); padding:0;
  margin-bottom:1rem; font-size:.85rem; font-weight:600;
  display:flex; align-items:center; gap:4px;
}

/* ---------------------------------------------------------------------- */
/* Form fields                                                             */
/* ---------------------------------------------------------------------- */
.field{margin-bottom:1rem}
.field label{
  display:block; font-size:.75rem; font-weight:700; color:var(--muted);
  text-transform:uppercase; letter-spacing:.05em; margin-bottom:.4rem;
}
.field input, .field select, .field textarea{
  width:100%; padding:.7rem .85rem; border:1.5px solid var(--border);
  border-radius:var(--radius-sm); font-size:.95rem; color:var(--text);
  background:var(--white); transition:border-color .15s;
  font-family:inherit;
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline:none; border-color:var(--blue);
}
.field textarea{resize:vertical; min-height:80px}
.field-row{display:flex; gap:.75rem}
.field-row .field{flex:1}

.check-row{display:flex; align-items:flex-start; gap:.6rem; margin-bottom:1rem}
.check-row input{width:auto; margin-top:3px; accent-color:var(--blue)}
.check-label{font-size:.82rem; color:var(--text); line-height:1.4}

.err-msg{
  display:none; align-items:center; gap:6px; color:var(--red);
  font-size:.82rem; font-weight:600; margin:.5rem 0 1rem; padding:.6rem .8rem;
  background:#fef2f2; border-radius:var(--radius-sm);
}
.err-msg.show{display:flex}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn{
  display:flex; align-items:center; justify-content:center; gap:.5rem;
  width:100%; padding:.85rem 1rem; border-radius:var(--radius-sm);
  font-size:.95rem; font-weight:700; border:none; transition:transform .1s, box-shadow .15s;
}
.btn:active{transform:scale(.985)}
.btn-primary{background:var(--navy); color:var(--white)}
.btn-primary:hover{box-shadow:0 6px 18px rgba(15,30,61,.25)}
.btn-secondary{background:var(--gray-2); color:var(--navy); margin-top:.6rem}
.btn-gold{background:var(--gold); color:#7c2d12}
.btn-outline{background:transparent; border:1.5px solid var(--border); color:var(--text)}
.btn-danger{background:#fef2f2; color:var(--red)}
.btn-sm{padding:.5rem .85rem; font-size:.82rem; width:auto}
.btn-block{width:100%}

/* ---------------------------------------------------------------------- */
/* App shell — sidebar (desktop) + bottom nav (mobile)                    */
/* ---------------------------------------------------------------------- */
.app-shell{display:flex; min-height:100vh}

.sidebar{
  width:230px; flex-shrink:0; background:var(--navy); color:var(--white);
  display:flex; flex-direction:column; padding:1.25rem 1rem;
  position:fixed; top:0; bottom:0; left:0; z-index:40;
  overflow-y:auto;
}
.sidebar-logo{display:flex; align-items:center; gap:10px; padding:.5rem .25rem 1.25rem}
.sidebar-logo img{height:30px; filter:brightness(0) invert(1)}
.sidebar-nav{display:flex; flex-direction:column; gap:.25rem; flex:1}
.side-link{
  display:flex; align-items:center; gap:.7rem; padding:.65rem .8rem;
  border-radius:var(--radius-sm); color:rgba(255,255,255,.7);
  font-size:.88rem; font-weight:600; border:none; background:none; text-align:left; width:100%;
  transition:background .12s, color .12s;
}
.side-link i{font-size:1.15rem; width:22px; text-align:center}
.side-link:hover{background:rgba(255,255,255,.06); color:var(--white)}
.side-link.active{background:var(--gold); color:#7c2d12}
.sidebar-foot{border-top:1px solid rgba(255,255,255,.1); padding-top:1rem; margin-top:1rem}

.main-area{flex:1; min-width:0; margin-left:230px; padding-bottom:90px}

/* Topbar inside main area */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem 1.5rem; background:var(--white); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:30;
}
.topbar h1{font-size:1.15rem; font-weight:800; color:var(--navy)}
.topbar-right{display:flex; align-items:center; gap:.6rem}
.icon-btn{
  width:40px; height:40px; border-radius:50%; border:1.5px solid var(--border);
  background:var(--white); display:flex; align-items:center; justify-content:center;
  font-size:1.1rem; color:var(--navy); position:relative;
}
.icon-btn .dot{
  position:absolute; top:7px; right:7px; width:8px; height:8px;
  border-radius:50%; background:var(--red); border:2px solid var(--white);
}
.user-chip{display:flex; align-items:center; gap:.5rem}
.user-avatar{
  width:36px; height:36px; border-radius:50%; background:var(--navy); color:var(--white);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:.85rem;
}
.user-chip-name{font-size:.85rem; font-weight:700; color:var(--text)}
.user-chip-role{font-size:.72rem; color:var(--muted)}

.page-body{padding:1.25rem 1.5rem 2rem}

/* Mobile bottom nav */
.bottom-nav{
  display:none; position:fixed; bottom:0; left:0; right:0; z-index:50;
  background:var(--white); border-top:1px solid var(--border);
  padding:.5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  box-shadow:0 -4px 16px rgba(0,0,0,.05);
}
.bottom-nav-scroll{display:flex; gap:.3rem; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none}
.bottom-nav-scroll::-webkit-scrollbar{display:none}
.bn-item{
  flex:0 0 auto; display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:.45rem .65rem; border-radius:10px; border:none; background:none;
  color:var(--muted); font-size:.66rem; font-weight:700; min-width:64px;
}
.bn-item i{font-size:1.25rem}
.bn-item.active{color:var(--navy); background:var(--gray-2)}
.bn-item.active i{color:var(--gold)}

/* ---------------------------------------------------------------------- */
/* Cards & grids                                                           */
/* ---------------------------------------------------------------------- */
.card{background:var(--white); border-radius:var(--radius); padding:1.1rem; box-shadow:var(--shadow)}
.card-row{display:flex; align-items:center; justify-content:space-between; margin-bottom:.5rem}
.card-title{font-size:.95rem; font-weight:800; color:var(--navy)}
.card-sub{font-size:.78rem; color:var(--muted)}

.grid{display:grid; gap:1rem}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
@media(max-width:980px){.grid-4{grid-template-columns:repeat(2,1fr)}.grid-3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr}}

.stat-card{
  background:var(--white); border-radius:var(--radius); padding:1.1rem;
  box-shadow:var(--shadow); display:flex; flex-direction:column; gap:.4rem;
}
.stat-icon{
  width:38px; height:38px; border-radius:10px; background:var(--gray-2);
  display:flex; align-items:center; justify-content:center; color:var(--blue); font-size:1.1rem;
}
.stat-val{font-size:1.5rem; font-weight:800; color:var(--navy)}
.stat-label{font-size:.78rem; color:var(--muted); font-weight:600}

/* Welcome / hero banner */
.hero-banner{
  background:linear-gradient(135deg,var(--navy) 0%, var(--navy-2) 100%);
  border-radius:var(--radius); padding:1.5rem; color:var(--white);
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  margin-bottom:1.25rem; flex-wrap:wrap;
}
.hero-banner h2{font-size:1.2rem; font-weight:800; margin-bottom:.2rem}
.hero-banner p{font-size:.82rem; opacity:.8}
.hero-badge{
  background:rgba(255,255,255,.1); border-radius:var(--radius-sm); padding:.6rem 1rem; text-align:center;
}
.hero-badge .lbl{font-size:.65rem; text-transform:uppercase; letter-spacing:.08em; opacity:.7}
.hero-badge .val{font-size:1.1rem; font-weight:800; color:var(--gold)}

/* ---------------------------------------------------------------------- */
/* Progress bars                                                           */
/* ---------------------------------------------------------------------- */
.progress-track{height:8px; background:var(--gray-2); border-radius:6px; overflow:hidden}
.progress-fill{height:100%; border-radius:6px; background:var(--blue); transition:width .4s ease}
.progress-fill.gold{background:var(--gold)}
.progress-fill.green{background:var(--green)}

.progress-track-lg{height:14px; background:var(--gray-2); border-radius:999px; overflow:hidden; position:relative}
.progress-fill-gradient{
  height:100%; border-radius:999px;
  background:linear-gradient(90deg, var(--blue), var(--green));
  transition:width .5s ease;
}
.chem-steps-row{display:flex; gap:.6rem; flex-wrap:wrap; margin-top:.85rem}
.chem-step-circle{
  display:flex; flex-direction:column; align-items:center; gap:4px; font-size:.7rem; color:var(--muted); font-weight:600;
  flex:1; min-width:64px; text-align:center;
}
.chem-step-circle .circle{
  width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:var(--gray-2); color:var(--muted); border:2px solid var(--border); transition:all .3s ease;
}
.chem-step-circle.done .circle{
  background:var(--green); color:#fff; border-color:var(--green);
}
.chem-step-circle.done{color:var(--navy)}
.progress-label{display:flex; justify-content:space-between; font-size:.75rem; color:var(--muted); margin-bottom:.35rem; font-weight:600}

/* 3-segment referral progress */
.seg-progress{display:flex; gap:4px; height:8px}
.seg-progress div{flex:1; border-radius:4px; background:var(--gray-2)}
.seg-progress div.done{background:var(--green)}
.seg-progress div.pending{background:var(--gold)}

/* ---------------------------------------------------------------------- */
/* Badges / pills / tags                                                   */
/* ---------------------------------------------------------------------- */
.pill{
  display:inline-flex; align-items:center; gap:5px; padding:.25rem .65rem;
  border-radius:999px; font-size:.72rem; font-weight:700;
}
.pill-green{background:#ecfdf5; color:var(--green)}
.pill-amber{background:#fffbeb; color:#b45309}
.pill-red{background:#fef2f2; color:var(--red)}
.pill-blue{background:#eff6ff; color:var(--blue)}
.pill-gray{background:var(--gray-2); color:var(--muted)}

.tag{
  display:inline-block; background:var(--gray-2); color:var(--muted);
  font-size:.7rem; font-weight:700; padding:.2rem .55rem; border-radius:6px;
}

/* ---------------------------------------------------------------------- */
/* Tables / lists                                                          */
/* ---------------------------------------------------------------------- */
.list{display:flex; flex-direction:column; gap:.6rem}
.list-item{
  background:var(--white); border-radius:var(--radius-sm); padding:.85rem 1rem;
  box-shadow:var(--shadow); display:flex; align-items:center; gap:.85rem;
}
.list-item-icon{
  width:40px; height:40px; border-radius:10px; background:var(--gray-2);
  display:flex; align-items:center; justify-content:center; color:var(--blue); flex-shrink:0; font-size:1.05rem;
}
.list-item-body{flex:1; min-width:0}
.list-item-title{font-size:.9rem; font-weight:700; color:var(--text)}
.list-item-sub{font-size:.76rem; color:var(--muted)}

table{width:100%; border-collapse:collapse; font-size:.85rem}
table th{
  text-align:left; padding:.6rem .75rem; font-size:.72rem; text-transform:uppercase;
  letter-spacing:.05em; color:var(--muted); border-bottom:2px solid var(--border); font-weight:700;
}
table td{padding:.65rem .75rem; border-bottom:1px solid var(--border); vertical-align:middle}
table tr:last-child td{border-bottom:none}
.table-wrap{background:var(--white); border-radius:var(--radius); box-shadow:var(--shadow); overflow-x:auto}

/* ---------------------------------------------------------------------- */
/* Tabs (sub-navigation within a page)                                     */
/* ---------------------------------------------------------------------- */
.subtabs{display:flex; gap:.4rem; overflow-x:auto; margin-bottom:1.1rem; padding-bottom:2px}
.subtab{
  padding:.55rem 1rem; border-radius:999px; background:var(--white); border:1.5px solid var(--border);
  color:var(--muted); font-size:.82rem; font-weight:700; white-space:nowrap; flex-shrink:0;
}
.subtab.active{background:var(--navy); color:var(--white); border-color:var(--navy)}

/* ---------------------------------------------------------------------- */
/* Modal                                                                   */
/* ---------------------------------------------------------------------- */
.modal-overlay{
  display:none; position:fixed; inset:0; background:rgba(15,30,61,.55); z-index:200;
  align-items:center; justify-content:center; padding:1rem; backdrop-filter:blur(2px);
}
.modal-overlay.show{display:flex}
.modal{
  background:var(--white); border-radius:var(--radius); width:100%; max-width:520px;
  max-height:88vh; overflow-y:auto; padding:1.5rem; box-shadow:var(--shadow-lg);
}
.modal-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem}
.modal-head h3{font-size:1.05rem; font-weight:800; color:var(--navy)}
.modal-close{background:none; border:none; font-size:1.3rem; color:var(--muted); line-height:1}

/* ---------------------------------------------------------------------- */
/* Toast                                                                   */
/* ---------------------------------------------------------------------- */
.toast{
  position:fixed; bottom:90px; left:50%; transform:translate(-50%,30px);
  background:var(--navy); color:var(--white); padding:.7rem 1.2rem; border-radius:999px;
  font-size:.85rem; font-weight:700; display:flex; align-items:center; gap:8px;
  opacity:0; transition:opacity .25s, transform .25s; z-index:300; box-shadow:var(--shadow-lg);
}
.toast.show{opacity:1; transform:translate(-50%,0)}
.toast i{color:var(--green)}
@media(min-width:769px){.toast{bottom:24px}}

/* ---------------------------------------------------------------------- */
/* Empty state                                                             */
/* ---------------------------------------------------------------------- */
.empty{
  text-align:center; padding:2.5rem 1rem; color:var(--muted);
}
.empty i{font-size:2rem; margin-bottom:.5rem; display:block; opacity:.4}
.empty p{font-size:.85rem}

/* ---------------------------------------------------------------------- */
/* Responsive: collapse sidebar to bottom nav on mobile                   */
/* ---------------------------------------------------------------------- */
@media(max-width:860px){
  .sidebar{display:none}
  .main-area{margin-left:0; padding-bottom:80px}
  .bottom-nav{display:block}
  .page-body{padding:1rem}
  .hero-banner{flex-direction:column; align-items:flex-start}
}

/* ---------------------------------------------------------------------- */
/* Utility classes                                                         */
/* ---------------------------------------------------------------------- */
.flex{display:flex}
.flex-col{display:flex; flex-direction:column}
.items-center{align-items:center}
.justify-between{justify-content:space-between}
.gap-1{gap:.5rem}
.gap-2{gap:1rem}
.mt-1{margin-top:.5rem}
.mt-2{margin-top:1rem}
.mb-1{margin-bottom:.5rem}
.mb-2{margin-bottom:1rem}
.text-muted{color:var(--muted)}
.text-sm{font-size:.82rem}
.text-center{text-align:center}
.w-full{width:100%}
.hide{display:none !important}
.section-title{font-size:1.05rem; font-weight:800; color:var(--navy); margin-bottom:.75rem}
.divider{height:1px; background:var(--border); margin:1.25rem 0}
