/* ============================================================
   Nexus Invoicing — standalone entry-page stylesheet
   (login / register / company setup)

   Self-contained: defines the theme tokens, base styles, the
   shared header, and the background canvas for these pages so
   they NO LONGER depend on main.css / main.js / Three.js.

   The tokens deliberately mirror main.css so the pages stay
   visually "related to the main ones" and remain dark/light
   aware.
   ============================================================ */

/* ============ THEME TOKENS (mirror main.css) ============ */
:root{
  --bg: #F6F9FC;
  --white-pure: #FFFFFF;
  --ink: #222B33;
  --ink-dim: rgba(34,43,51,0.62);
  --line: rgba(24,41,58,0.10);
  --blue: #1B6FB0;
  --blue-deep: #113F6E;
  --green: #3CAA50;
  --green-light: #63C978;
  --shadow: 0 20px 50px -20px rgba(17,63,110,0.25);
  --glow-blue: rgba(28,111,176,0.35);
  --glow-green: rgba(60,170,80,0.35);
  --surface: rgba(255,255,255,0.72);
  --surface-solid: #FFFFFF;
  --nav-bg: rgba(246,249,252,0.72);
  --nav-scrolled-bg: rgba(255,255,255,0.86);
  --input-bg: #F6F9FC;
  --badge-bg: rgba(60,170,80,0.14);
  --badge-due-bg: rgba(28,111,176,0.12);
}

html.dark{
  --bg: #0B0F14;
  --white-pure: #FFFFFF;
  --ink: #E8ECF1;
  --ink-dim: rgba(232,236,241,0.62);
  --line: rgba(255,255,255,0.08);
  --blue: #3B9EFF;
  --blue-deep: #6CB4FF;
  --green: #5EDB7A;
  --green-light: #8FF5A0;
  --shadow: 0 20px 50px -20px rgba(0,0,0,0.55);
  --glow-blue: rgba(59,158,255,0.25);
  --glow-green: rgba(94,219,122,0.25);
  --surface: rgba(26,31,46,0.72);
  --surface-solid: #1A1F2E;
  --nav-bg: rgba(11,15,20,0.72);
  --nav-scrolled-bg: rgba(26,31,46,0.86);
  --input-bg: #11151C;
  --badge-bg: rgba(94,219,122,0.14);
  --badge-due-bg: rgba(59,158,255,0.12);
}

/* ============ BASE ============ */
html, body{ transition: background-color .35s ease, color .35s ease; }
*{ box-sizing:border-box; margin:0; padding:0; }
html{ scroll-behavior:smooth; }
body{
  background:var(--bg);
  color:var(--ink);
  font-family:'Inter', sans-serif;
  overflow-x:hidden;
  position:relative;
  min-height:100vh;
  transition:background-color .35s ease, color .35s ease;
}
::selection{ background:var(--green); color:var(--white-pure); }
h1,h2,h3{ font-family:'Fraunces', serif; font-weight:600; letter-spacing:-0.01em; }
a{ color:inherit; text-decoration:none; }

/* ============ BACKGROUND CANVAS (driven by entry.js) ============ */
#bg-canvas{
  position:fixed; inset:0; width:100vw; height:100vh; z-index:0;
  pointer-events:none;
}

/* ============ PAGE SHELL (shared) ============ */
body .page{
  position:relative; z-index:1;
  width:100%; min-height:100vh;
  display:flex;
}
/* main that hosts the centered entry card (used by the auth layout) */
.entry-main{ width:100%; display:flex; justify-content:center; }

/* ============ HEADER ============ */
.entry-header{
  position:fixed; top:0; left:0; right:0; z-index:60;
  background:var(--nav-bg);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid transparent;
  transition:border-color .3s, background .3s, box-shadow .3s;
}
.entry-header.scrolled{
  border-bottom:1px solid var(--line);
  background:var(--nav-scrolled-bg);
  box-shadow:0 10px 30px -24px rgba(17,63,110,0.45);
}
.entry-header-inner{
  max-width:1180px; margin:0 auto;
  padding:0 32px;
  height:68px;
  display:flex; align-items:center; justify-content:space-between;
}
.entry-brand{
  display:flex; align-items:center; gap:11px;
  font-family:'Fraunces', serif; font-size:19px; font-weight:600;
  letter-spacing:-0.01em; color:var(--ink);
}
.entry-brand-mark{
  width:34px; height:34px; border-radius:9px; flex-shrink:0;
  background:linear-gradient(135deg, var(--blue), var(--green));
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 18px -8px var(--glow-blue);
  transition:transform .25s ease, box-shadow .25s ease;
}
.entry-brand:hover .entry-brand-mark{ transform:translateY(-1px) rotate(-3deg); box-shadow:0 10px 22px -8px var(--glow-green); }
.entry-brand-mark svg{ width:18px; height:18px; fill:none; stroke:var(--white-pure); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.entry-brand-accent{ color:var(--blue); }

.entry-nav{ display:flex; align-items:center; gap:8px; }
.entry-nav-link{
  padding:9px 16px; font-size:14px; font-weight:500; color:var(--ink-dim);
  border:1px solid transparent; border-radius:100px;
  transition:color .2s, background .2s, border-color .2s;
}
.entry-nav-link:hover{ color:var(--blue); background:var(--surface); border-color:var(--line); }

.entry-theme-toggle{
  width:40px; height:40px; border-radius:50%;
  border:1px solid var(--line); background:var(--surface);
  color:var(--ink); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.entry-theme-toggle:hover{ border-color:var(--blue); color:var(--blue); transform:translateY(-1px); box-shadow:0 8px 16px -10px var(--glow-blue); }
.entry-theme-toggle svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
/* sun shown in light mode, moon shown in dark mode */
html.dark .entry-theme-sun{ display:none; }
html:not(.dark) .entry-theme-moon{ display:none; }

/* ============ FOCUS ============ */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline:2px solid var(--blue); outline-offset:3px; border-radius:6px;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar{ width:10px; }
::-webkit-scrollbar-track{ background:var(--bg); }
::-webkit-scrollbar-thumb{ background:var(--line); border-radius:100px; }
::-webkit-scrollbar-thumb:hover{ background:var(--ink-dim); }

/* ============ RESPONSIVE HEADER ============ */
@media (max-width:760px){
  .entry-header-inner{ padding:0 20px; height:60px; }
  .entry-brand{ font-size:17px; }
  .entry-brand-mark{ width:30px; height:30px; border-radius:8px; }
  .entry-nav-link{ padding:8px 12px; }
  .entry-theme-toggle{ width:38px; height:38px; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .entry-header, .entry-brand-mark, .entry-theme-toggle{ transition:none !important; }
}

/* ============ VERIFY PAGE ============ */
.verify-page{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:104px 32px 48px;
  min-height:100vh;
}

.verify-card{
  width:100%;
  max-width:440px;
  background:var(--surface-solid);
  border:1px solid var(--line);
  border-radius:24px;
  box-shadow:0 50px 100px -40px rgba(17,63,110,0.35);
  padding:56px 48px;
  text-align:center;
}

/* ---- Icon ---- */
.verify-icon{
  width:68px; height:68px; border-radius:18px;
  background:linear-gradient(135deg, var(--blue), var(--green));
  display:inline-flex; align-items:center; justify-content:center;
  margin-bottom:28px;
  box-shadow:0 12px 28px -12px var(--glow-blue);
}
.verify-icon svg{ width:30px; height:30px; stroke:var(--white-pure); }

/* ---- Headings ---- */
.verify-card h1{
  font-family:'Fraunces', serif; font-size:30px; font-weight:600;
  color:var(--ink); margin-bottom:12px; letter-spacing:-0.02em;
  line-height:1.2;
}

.verify-subtitle{
  font-size:15px; color:var(--ink-dim); line-height:1.7;
  margin-bottom:32px; max-width:340px; margin-left:auto; margin-right:auto;
}

/* ---- Success alert ---- */
.verify-status{
  display:flex; align-items:center; gap:10px;
  background:var(--badge-bg); border-left:3px solid var(--green);
  color:var(--green); border-radius:10px; padding:12px 16px;
  font-size:13.5px; margin-bottom:24px; text-align:left;
  line-height:1.5;
}
.verify-status svg{ width:18px; height:18px; flex-shrink:0; }

/* ---- Buttons (shared) ---- */
.verify-btn{
  width:100%;
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  padding:14px 24px; border-radius:100px;
  font-size:14.5px; font-weight:600; font-family:'Inter', sans-serif;
  cursor:pointer; border:none;
  transition:transform .25s, box-shadow .25s, background .2s, color .2s, border-color .2s;
}
.verify-btn svg{ width:18px; height:18px; flex-shrink:0; }

/* ---- Primary button ---- */
.verify-btn-primary{
  color:var(--white-pure);
  background:linear-gradient(120deg, var(--blue-deep), var(--blue), var(--green));
  box-shadow:0 14px 30px -12px var(--glow-blue);
}
.verify-btn-primary:hover{
  transform:translateY(-2px);
  box-shadow:0 18px 36px -12px var(--glow-green);
}

/* ---- Ghost button ---- */
.verify-btn-ghost{
  color:var(--ink); background:var(--surface); border:1px solid var(--line);
}
.verify-btn-ghost:hover{
  background:var(--surface-solid); border-color:var(--blue); color:var(--blue);
}

/* ---- Divider ---- */
.verify-divider{
  display:flex; align-items:center; gap:14px;
  margin:18px 0;
  color:var(--ink-dim); font-size:12px; font-weight:500;
  text-transform:uppercase; letter-spacing:0.08em;
}
.verify-divider::before,
.verify-divider::after{
  content:''; flex:1; height:1px; background:var(--line);
}

/* ---- Footer ---- */
.verify-footer{
  margin-top:32px; padding-top:24px;
  border-top:1px solid var(--line);
}
.verify-link{
  display:inline-flex; align-items:center; gap:8px;
  color:var(--ink-dim); font-size:14px; font-weight:500;
  transition:color .2s, gap .2s;
}
.verify-link:hover{ color:var(--blue); gap:10px; }
.verify-link svg{ flex-shrink:0; width:16px; height:16px; }

/* ---- Responsive ---- */
@media (max-width:760px){
  .verify-page{ padding:80px 16px 40px; }
  .verify-card{ padding:40px 24px; border-radius:20px; }
  .verify-card h1{ font-size:24px; }
  .verify-subtitle{ font-size:14px; margin-bottom:26px; }
  .verify-icon{ width:56px; height:56px; border-radius:14px; margin-bottom:22px; }
  .verify-icon svg{ width:24px; height:24px; }
  .verify-btn{ padding:13px 20px; font-size:14px; }
  .verify-footer{ margin-top:26px; padding-top:20px; }
}

@media (prefers-reduced-motion: reduce){
  .verify-btn, .verify-link, .verify-icon{ transition:none !important; }
}

/* ============ MPESA PAYMENT PAGE ============ */
.mpesa-page{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:104px 32px 48px;
  min-height:100vh;
}

.mpesa-card{
  width:100%;
  max-width:520px;
  background:var(--surface-solid);
  border:1px solid var(--line);
  border-radius:24px;
  box-shadow:0 50px 100px -40px rgba(17,63,110,0.35);
  padding:56px 48px;
}

.mpesa-header{
  text-align:center;
  margin-bottom:32px;
}

.mpesa-icon{
  width:64px; height:64px; border-radius:16px;
  background:linear-gradient(135deg, var(--blue), var(--green));
  display:inline-flex; align-items:center; justify-content:center;
  margin-bottom:24px;
  box-shadow:0 8px 24px -8px var(--glow-blue);
}
.mpesa-icon svg{ width:36px; height:36px; }

.mpesa-header h1{
  font-family:'Fraunces', serif; font-size:28px; font-weight:600;
  color:var(--ink); margin-bottom:8px; letter-spacing:-0.01em;
}

.mpesa-subtitle{
  font-size:15px; color:var(--ink-dim); line-height:1.6;
}

.mpesa-body{
  margin-bottom:28px;
}

.mpesa-details{
  margin-bottom:24px;
}

.mpesa-detail-row{
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 0; border-bottom:1px solid var(--line);
}
.mpesa-detail-row:last-child{ border-bottom:none; }
.mpesa-detail-label{
  font-size:12px; font-weight:500; color:var(--ink-dim); text-transform:uppercase; letter-spacing:0.05em;
}
.mpesa-detail-value{
  font-size:14px; font-weight:600; color:var(--ink);
  background:var(--input-bg); padding:4px 12px; border-radius:6px;
}

.mpesa-conversion-notice{
  background:var(--input-bg); border-radius:10px; padding:14px; margin-top:16px;
  font-size:13px; color:var(--ink-dim); line-height:1.7;
}
.mpesa-conversion-notice strong{ display:block; color:var(--ink); margin-bottom:6px; font-weight:600; }

.mpesa-amount{
  text-align:center; padding:12px 0; border-bottom:1px solid var(--line); margin-bottom:20px;
}
.mpesa-amount-currency{
  font-size:13px; font-weight:600; color:var(--ink-dim); margin-bottom:4px;
}
.mpesa-amount-value{
  font-size:40px; font-weight:800; color:var(--ink); letter-spacing:-2px; line-height:1.1;
}
.mpesa-amount-decimals{
  font-size:24px; font-weight:600; color:var(--ink-dim);
}

.mpesa-badge{
  display:inline-block; margin-top:10px; padding:5px 14px; border-radius:100px;
  font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em;
}
.mpesa-badge-due{ background:var(--badge-bg); color:var(--green); }
.mpesa-badge-balance{ background:var(--badge-due-bg); color:var(--blue); }

.mpesa-meta{
  display:flex; gap:16px; justify-content:center; margin-bottom:24px;
  flex-wrap: wrap;
}
.mpesa-meta-item{ text-align:center; }
.mpesa-meta-label{
  font-size:10px; color:var(--ink-dim); font-weight:500; text-transform:uppercase; letter-spacing:0.06em;
}
.mpesa-meta-value{
  font-size:13px; font-weight:600; color:var(--ink); margin-top:3px;
}
.mpesa-status-paid{ color:var(--green); }
.mpesa-status-overdue{ color:#E2574C; }
.mpesa-status-partially_paid{ color:var(--blue); }
.mpesa-status-sent{ color:var(--blue); }
.mpesa-status-draft{ color:var(--ink-dim); }

.mpesa-field{ margin-bottom:20px; }
.mpesa-field-label{
  display:block; font-size:12.5px; font-weight:600; color:var(--ink); margin-bottom:8px;
}
.mpesa-field-hint{ font-weight:400; color:var(--ink-dim); font-size:12px; }

.mpesa-input-group{
  position:relative; display:flex; border:1.5px solid var(--line); border-radius:12px; overflow:hidden;
  background:var(--input-bg); transition:border-color .2s, box-shadow .2s;
}
.mpesa-input-group:focus-within{
  border-color:var(--blue); box-shadow:0 0 0 4px var(--glow-blue);
}
.mpesa-input-prefix{
  display:flex; align-items:center; padding:0 16px; background:var(--surface);
  font-size:13.5px; font-weight:600; color:var(--ink-dim); border-right:1.5px solid var(--line);
}
.mpesa-input-group input{
  flex:1; border:none; padding:14px 16px; font-size:14.5px; font-weight:500; color:var(--ink);
  outline:none; font-family:'Inter', sans-serif; background:transparent; width:100%;
}
.mpesa-input-group input::placeholder{ color:var(--ink-dim); opacity:.6; }

.mpesa-message{
  display:flex; align-items:flex-start; gap:10px;
  padding:14px 16px; border-radius:10px; font-size:13.5px; line-height:1.5;
}
.mpesa-message-error{
  background:#FEF2F2; color:#DC2626; border:1px solid #FECACA;
}
.mpesa-message-success{
  background:#F0FDF4; color:#059669; border:1px solid #BBF7D0; text-align:center;
}
.mpesa-message-success h3{ font-size:15px; font-weight:700; margin-bottom:6px; color:#059669; }
.mpesa-message-success p{ color:#6B7280; font-size:13px; }
.mpesa-success-icon{
  width:40px; height:40px; background:#DCFCE7; border-radius:50%;
  display:flex; align-items:center; justify-content:center; margin:0 auto 10px; flex-shrink:0;
}
.mpesa-success-icon svg{ width:20px; height:20px; color:#16A34A; }

.mpesa-loading{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:16px;
}
.mpesa-spinner{
  width:28px; height:28px; border:3px solid var(--line); border-top-color:var(--green);
  border-radius:50%; animation:mpesa-spin 0.8s linear infinite; margin-bottom:10px;
}
@keyframes mpesa-spin{ to{ transform:rotate(360deg); } }
.mpesa-loading p{ font-size:13px; color:var(--ink-dim); }

.mpesa-poll-result{ text-align:center; }
.mpesa-poll-emoji{ font-size:32px; margin-bottom:8px; }
.mpesa-poll-title{ font-size:16px; font-weight:700; color:var(--ink); margin-bottom:4px; }
.mpesa-poll-subtitle{ font-size:13px; color:var(--ink-dim); }

.mpesa-footer{
  margin-top:32px; padding-top:24px; border-top:1px solid var(--line); text-align:center;
}
.mpesa-trust-badges{
  display:flex; justify-content:center; gap:18px; margin-bottom:12px; flex-wrap:wrap;
}
.mpesa-trust-badges span{
  display:inline-flex; align-items:center; gap:7px;
  font-size:10.5px; color:var(--ink-dim); font-weight:500;
}
.mpesa-trust-badges svg{ width:12px; height:12px; color:var(--ink-dim); }
.mpesa-footer p{ font-size:11px; color:var(--ink-dim); }
.mpesa-footer strong{ color:var(--ink); }

@media (max-width:760px){
  .mpesa-page{ padding:80px 16px 40px; }
  .mpesa-card{ padding:40px 24px; border-radius:20px; }
  .mpesa-header h1{ font-size:24px; }
  .mpesa-icon{ width:56px; height:56px; border-radius:14px; margin-bottom:20px; }
  .mpesa-icon svg{ width:32px; height:32px; }
  .mpesa-amount-value{ font-size:34px; }
  .mpesa-amount-decimals{ font-size:20px; }
  .mpesa-trust-badges{ gap:12px; }
  .mpesa-trust-badges span{ font-size:10px; }
}