/* ===== Reset / base ===== */
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{min-height:100%;font-family:system-ui,-apple-system,Inter,Segoe UI,Roboto,Arial,sans-serif;color:#111;background:#fff}
a{color:#0d6efd;text-decoration:none}
a:hover{text-decoration:underline}

/* Containers used for data views (not the hero) */
.wrap{max-width:1200px;margin:0 auto;padding:16px}
.wrap-main{max-width:1200px;margin:0 auto;padding:16px}

/* ===== Sticky header (floats over hero) ===== */
.site-header{position:sticky;top:0;z-index:1000;background:rgba(255,255,255,.9);border-bottom:1px solid #e5e5e5;backdrop-filter:saturate(140%) blur(6px)}
.headrow{display:flex;align-items:center;gap:12px}
.brand{display:flex;align-items:center;gap:10px}
.brand-logo{width:28px;height:28px;border-radius:6px;object-fit:contain}
h1{font-size:18px;margin:0;font-weight:800}
.tabs{display:flex;gap:8px;margin-left:auto}
.tab{padding:8px 12px;border:1px solid #e5e5e5;border-radius:10px;background:#fff;color:#111;cursor:pointer}
.tab.active{background:#f5f7fb;border-color:#cfd3d7}

/* ===== Inputs / chips / buttons ===== */
input,button,select,textarea{font:inherit;color:#111}
input[type="search"],input[type="password"],input[type="text"],input[type="month"],input[type="number"],input[type="date"],select,textarea{
  padding:10px 12px;border:1px solid #dde1e5;border-radius:10px;background:#fff
}
.btn{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;border:1px solid #e5e5e5;color:#111;font-weight:600;background:#fff;cursor:pointer}
.btn.small{padding:6px 10px;font-size:12px}
.muted{color:#666}
.row{display:flex;gap:10px;flex-wrap:wrap}
.row>*{flex:1 1 220px}
.filters{display:flex;gap:8px;flex-wrap:wrap}
.chip{background:#fff;border:1px solid #dde1e5;color:#333;padding:7px 12px;border-radius:999px;font-size:12px;cursor:pointer}
.chip.active{border-color:#cbd5e1;background:#f0f3f6}

/* ===== Summary / cards / tables (unchanged from previous) ===== */
.summary{margin-top:12px;padding:12px;border:1px solid #e5e5e5;border-radius:14px;background:#fff}
.summary h2{margin:0 0 8px;font-size:14px;color:#222}
.summary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px}
.sumcard{border:1px solid #e5e5e5;border-radius:12px;padding:10px;background:#fff}
.sumtitle{font-weight:700;margin-bottom:6px;color:#111;font-size:13px}
.bar{height:10px;border:1px solid #e5e5e5;background:#fff;border-radius:999px;overflow:hidden}
.fill{height:100%;background:linear-gradient(90deg,#1e40af,#60a5fa)}
.barline{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px;margin:6px 0;font-size:12px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:14px;padding:16px 0}
.card{position:relative;background:#fff;border:2px solid #e8e8e8;border-radius:12px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,.04)}
.card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:6px;background:transparent}
.card.ok{border-color:#22c55e;box-shadow:0 0 0 3px #22c55e1f}
.card.ok::before{background:#16a34a}
.card.warn{border-color:#f59e0b;box-shadow:0 0 0 3px #f59e0b1f}
.card.warn::before{background:#d97706}
.card.none{border-color:#ef4444;box-shadow:0 0 0 3px #ef44441f}
.card.none::before{background:#dc2626}
.card-header{display:grid;grid-template-columns:1fr auto;gap:12px;align-items:center;padding:14px}
.title{font-weight:800;color:#111;display:flex;align-items:center;gap:6px}
.subtitle{font-size:12px;color:#555;margin-top:2px;display:flex;gap:8px;flex-wrap:wrap}
.chip-mini{font-size:11px;background:#fff;border:1px solid #e2e2e2;border-radius:999px;padding:3px 8px;color:#333}
.quick{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:10px}
.amt{font-size:12px;border:1px solid #eee;border-radius:8px;padding:6px 8px;background:#fff}
.total{margin-left:auto;font-weight:800;border:1px solid #eee;border-radius:8px;padding:6px 10px;background:#fff}
.statusline{display:flex;gap:8px;align-items:center;margin-top:8px;flex-wrap:wrap}
.badge{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:700;background:#fff;color:#111;border:2px solid #e2e2e2}
.badge.ok{border-color:#22c55e;color:#15803d;background:#dcfce7}
.badge.warn{border-color:#f59e0b;color:#a16207;background:#fff7ed}
.badge.none{border-color:#ef4444;color:#b91c1c;background:#fee2e2}
.chevbtn{margin-left:8px;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:8px;border:1px solid #ddd;background:#fff;cursor:pointer}
.chevbtn svg{width:18px;height:18px;color:#999;transition:transform .2s ease}
.card.open .chevbtn svg{transform:rotate(180deg)}
.divider{height:1px;background:#eee}
.body{padding:12px 14px 14px;display:none}
.card.open .body{display:block}
.rows{margin-top:4px;border-top:1px dashed #e6e6e6;padding-top:10px}
.contact,.address{margin-top:10px;border-top:1px dashed #e6e6e6;padding-top:10px;font-size:13px;color:#333}
.panel{border:1px solid #e8e8e8;border-radius:10px;background:#fff;padding:12px;margin-top:12px}
.toolbar{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-top:10px}
.table{width:100%;border-collapse:collapse;margin-top:8px}
.table th,.table td{border-bottom:1px dashed #e6e6e6;padding:10px 8px;text-align:left;font-size:13px}
.pill{display:inline-block;padding:2px 8px;border:2px solid #ddd;border-radius:999px;font-size:11px;background:#fff;color:#111}
.pill.green{border-color:#22c55e;background:#dcfce7}
.pill.orange{border-color:#f59e0b;background:#fff7ed}
.pill.red{border-color:#ef4444;background:#fee2e2}
.pill.gray{border-color:#cfcfcf;background:#fafafa}
.empty{padding:24px;text-align:center;color:#666}
.footer{padding:12px 16px 28px;color:#666;font-size:12px}

/* ===== Questions containment ===== */
.card .body .qblock{margin-top:12px;border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;background:#fafafa}
.card .body .qblock .qbar{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid #ececec;background:#fff;flex-wrap:wrap}
.card .body .qblock .qRows{padding:10px 12px;display:flex;flex-direction:column;gap:10px}
.card .body .qblock .qrow{display:flex;align-items:center;gap:10px}
.card .body .qblock .qrow>div:first-child{flex:2;min-width:160px;color:#222;word-break:break-word}
.card .body .qblock .qrow input,.card .body .qblock .qrow select{flex:1;min-width:160px;max-width:100%;width:100%;padding:10px;border:1px solid #cfd3d7;border-radius:8px;background:#fff;color:#111}
@media (max-width:680px){
  .card .body .qblock .qrow{flex-direction:column;align-items:stretch}
  .card .body .qblock .qrow>div:first-child{min-width:0}
  .card .body .qblock .qrow input,.card .body .qblock .qrow select{min-width:0}
}

/* ===== FULL-BLEED HERO (Admin + User) ===== */
.hero{position:relative;min-height:100vh;width:100%;display:grid;place-items:center;overflow:hidden}
.hero-waves{position:fixed;inset:0;z-index:-1;background:
  radial-gradient(1200px 600px at 50% -10%, #0f172a 0%, transparent 70%),
  radial-gradient(900px 500px at 50% 110%, #0f172a 0%, transparent 70%),
  #0b0f1a}
/* animated lines */
.hero-waves::before,.hero-waves::after{
  content:"";position:fixed;left:-10%;right:-10%;height:320px;z-index:-1;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'><path d='M0,60 C240,20 480,100 720,60 C960,20 1200,100 1440,60 L1440,120 L0,120 Z' fill='none' stroke='%231e90ff' stroke-opacity='0.25' stroke-width='2'/></svg>");
  background-repeat:repeat-x;background-size:960px 120px;filter:drop-shadow(0 0 8px rgba(30,144,255,.15));
  animation:waveMove 22s linear infinite;opacity:.65
}
.hero-waves::before{top:38%}
.hero-waves::after{top:58%;transform:scaleX(-1);animation-duration:28s;opacity:.35}
@keyframes waveMove{from{background-position:0 0}to{background-position:-960px 0}}
.hero-center{width:100%;display:grid;place-items:center;padding:24px}

/* shared login card */
.login-card{width:min(520px,92vw);background:#fff;color:#111;border:1px solid #e6ebf0;border-radius:18px;padding:20px 18px 18px;box-shadow:0 24px 80px rgba(0,0,0,.35);animation:cardIn .5s cubic-bezier(.2,.7,.2,1) both}
@keyframes cardIn{from{opacity:0;transform:translateY(18px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}
.login-logo{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.login-logo img{width:38px;height:38px;border-radius:10px;object-fit:cover}
.brandstack{line-height:1.1}.brandname{font-weight:800;letter-spacing:.2px}.brandtag{font-size:12px}
.login-heading{margin:6px 0 12px;text-align:center;font-size:18px;font-weight:800}
.field{display:block;margin:10px 0 4px}
.field-label{display:block;font-size:12px;color:#444;margin-bottom:6px}
.field-input{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;background:#fff;border:1px solid #dde1e5;border-radius:12px;padding:6px 8px 6px 10px}
.field-input input{border:0;outline:0;background:transparent;color:#111;padding:8px 4px;font-size:15px}
.iconbtn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:10px;border:1px solid #e6e6e6;background:#fff;color:#6b7280;cursor:pointer}
.iconbtn:hover{border-color:#cfd3d7;color:#374151}
.caps{margin-top:6px;font-size:12px}
.btn.cta{width:100%;margin-top:14px;padding:12px 14px;border-radius:999px;border:1px solid #0b5cab;background:linear-gradient(90deg,#0b5cab,#1786d0);color:#fff;font-weight:800;box-shadow:0 8px 26px rgba(23,134,208,.35);transition:transform .06s ease, box-shadow .15s ease, filter .15s ease}
.btn.cta:hover{box-shadow:0 10px 30px rgba(23,134,208,.45);filter:saturate(1.05)}
.btn.cta:active{transform:translateY(1px)}

/* ===== Dark toast ===== */
.no-scroll{overflow:hidden!important}
#toastOverlay{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.45);z-index:1200}
#toastOverlay.open{display:flex}
.toast-card{min-width:280px;max-width:86vw;background:#0f172a;color:#e5e7eb;border:1px solid #1f2937;border-radius:12px;padding:14px 16px;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.35);font-size:14px}
.toast-ok{border-color:rgba(22,163,74,.5)}
.toast-warn{border-color:rgba(245,158,11,.5)}
.toast-error{border-color:rgba(239,68,68,.55)}

/* (Email modal kept, but hidden by default) */
#emailModal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.5);z-index:1100}


/* Lock page only while a login hero is up */
body.lock-scroll {

  height: 100vh;
}

#emailModal.open{display:flex}
.email-card{width:min(720px,92vw);background:#0f172a;color:#e5e7eb;border:1px solid #1f2937;border-radius:12px;padding:16px}
.email-card h3{margin:0 0 8px;font-size:16px}
.email-row{display:grid;grid-template-columns:90px 1fr;gap:10px;margin:8px 0;align-items:center}
.email-row input,.email-row textarea{width:100%;padding:10px 12px;border-radius:10px;border:1px solid #1f2937;background:#0b1220;color:#e5e7eb}
.email-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
/* Add if not present */
html, body { height: 100%; }
.hero { min-height: 100vh; width: 100%; }

/* Logout tab look */
.tab.danger { border-color:#ffc3c3; color:#b91c1c; }
.tab.danger:hover { background:#fff5f5; }

/* --- Header height variable --- */
:root { --hdr: 64px; } /* tweak if your header is taller/shorter */

/* Make header fixed so it never scrolls */
.site-header{
  position: fixed;            /* was sticky */
  top: 0; left: 0; right: 0;
  height: var(--hdr);
  z-index: 1000;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid #e5e5e5;
  backdrop-filter: saturate(140%) blur(6px);
}

/* Push main down so it doesn't hide under fixed header */
main{ padding-top: var(--hdr); }

/* When a hero is visible, lock the page to a single viewport */
body.auth-mode{
  height: 100vh;
  overflow: hidden;           /* no document scroll */
}

/* Full-bleed hero sized to the viewport below the header */
.hero{
  position: relative;
  height: calc(100vh - var(--hdr)); /* exact viewport minus header */
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Background stays full-screen */
.hero-waves{
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 600px at 50% -10%, #0f172a 0%, transparent 70%),
    radial-gradient(900px 500px at 50% 110%, #0f172a 0%, transparent 70%),
    #0b0f1a;
}

/* Keep the card centered; if the screen is very small, let the CARD scroll, not the page */
.hero-center{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;                /* breathing space at tiny widths */
}

.login-card{
  width: min(520px, 92vw);
  max-height: min(520px, calc(100vh - var(--hdr) - 32px)); /* keep within viewport */
  overflow: auto;               /* internal scroll if needed */
  background: #fff;
  color: #111;
  border: 1px solid #e6ebf0;
  border-radius: 18px;
  padding: 20px 18px 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  animation: cardIn .5s cubic-bezier(.2,.7,.2,1) both;
}

/* Optional: make the tabs bar not wrap to a second line inside fixed header */
.headrow{ display:flex; align-items:center; gap:12px; height: 100%; }
.tabs{ margin-left:auto; display:flex; gap:8px; align-items:center; }

/* Lock page only while a login hero is up (you already have this; keep it) */
body.auth-mode {
  overflow: hidden;
  height: 100vh;
}

/* Back to top floating button */
#backToTop{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #dbe0e5;
  background: #ffffff;
  color: #111;
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, background .15s ease, border-color .15s ease;
  z-index: 900;
}
#backToTop:hover{
  background: #f7f9fb;
  border-color: #cfd6dd;
}
#backToTop.show{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

