
:root{
  --royal-red:#b1001d;
  --fire:#ff4d00;
  --royal-blue:#1e4fd6;
  --sky:#37b5ff;
  --ash:#f2f4f7;
  --grey:#6b7280;
  --black:#0b0f19;
  --white:#ffffff;
  --card:#ffffff;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius:14px;
  --radius-lg:22px;
}

/* Dark theme overrides */
html[data-theme="dark"]{
  --ash:#0b0f19;
  --white:#0f172a;
  --card:#111827;
  --border:#243041;
  --grey:#9ca3af;
  --black:#f9fafb;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
html[data-theme="dark"] body{background:var(--ash); color:var(--black)}
html[data-theme="dark"] .topbar{background:linear-gradient(135deg,#0a1223,#0b3d91)}
html[data-theme="dark"] .searchbar{border-color:rgba(255,255,255,.08)}
html[data-theme="dark"] .searchbar input{background:transparent;color:var(--black)}
html[data-theme="dark"] .footer-nav{background:var(--card)}

/* Page header (inner pages) */
.pagebar{background:linear-gradient(135deg,#0b0f19,#101828); color:var(--white); border-bottom-left-radius:26px;border-bottom-right-radius:26px; box-shadow: var(--shadow);}
html[data-theme="dark"] .pagebar{background:linear-gradient(135deg,#0b0f19,#0b3d91)}
.pagebar-inner{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 0 10px 0;}
.backbtn{display:inline-flex; align-items:center; gap:6px; padding:10px 12px; border-radius:14px; background:rgba(255,255,255,.12); color:#fff; font-weight:900; font-size:13px;}
.backbtn span{display:inline}
.brandline{display:flex; align-items:center; gap:10px;}
.logo-badge{width:52px;height:52px;border-radius:50%;background:rgba(255,255,255,.18);display:flex;align-items:center;justify-content:center;}
.logo-badge img{width:30px;height:20px;object-fit:contain;background:#fff;border-radius:10px;padding:6px;}
.pagetitle{font-weight:1000; font-size:18px; line-height:1.1}
.pagesub{opacity:.9; font-size:12px; font-weight:800; margin-top:2px}

/* Better cards spacing on inner pages */
.card.pad{padding:16px}
.card + .card{margin-top:12px}

/* Responsive table wrapper */
.table-wrap{width:100%; overflow:auto; -webkit-overflow-scrolling:touch;}

/* Settings list */
.list{display:grid; gap:10px}
.list a,.list button{
  width:100%; text-align:left; display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 14px; border-radius:16px; border:1px solid var(--border); background:var(--card); cursor:pointer;
  font-weight:900;
}
.list small{display:block; color:var(--grey); font-weight:800; margin-top:4px}
.chev{color:var(--grey); font-weight:1000}

/* Auth improvements */
.auth-card .btn{width:100%; margin-top:12px; padding:14px 16px; border-radius:16px;}
.auth-card .row{display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:10px;}
.auth-card .row label{margin:0; font-weight:800; font-size:13px;}
.auth-card .toggle{display:flex; align-items:center; gap:8px; color:var(--grey); font-weight:800; font-size:13px;}

*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",Arial,sans-serif;color:var(--black);background:var(--ash)}
a{color:inherit;text-decoration:none}
.container{max-width:1080px;margin:0 auto;padding:18px}
.topbar{
  background:linear-gradient(135deg,var(--black),#121a2b);
  color:var(--white);
  padding:18px 18px 26px 18px;
  border-bottom-left-radius:28px;border-bottom-right-radius:28px;
  box-shadow: var(--shadow);
}
.topbar .row{display:flex;align-items:center;gap:12px}
.avatar{width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.18);display:flex;align-items:center;justify-content:center}
.hi{font-weight:700;font-size:20px;margin:0}
.sub{opacity:.9;margin:2px 0 0 0;font-size:14px}
.searchbar{
  display:flex;gap:0;margin-top:14px;background:var(--white);
  border-radius:14px;overflow:hidden;border:1px solid rgba(255,255,255,.2)
}
.searchbar input{
  flex:1;border:0;padding:14px 14px;font-size:16px;outline:none
}
.btn{
  border:0;cursor:pointer;padding:12px 16px;border-radius:12px;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  font-weight:700;
}
.btn-primary{background:var(--royal-blue);color:var(--white)}
.btn-fire{background:var(--fire);color:var(--white)}
.btn-red{background:var(--royal-red);color:var(--white)}
.btn-ghost{background:transparent;border:1px solid var(--border);color:var(--black)}
.searchbar .btn{border-radius:0;background:var(--sky);color:var(--black);min-width:110px;font-weight:800}
.card{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow: 0 10px 25px rgba(16,24,40,.04);
}
.wallet{
  margin-top:14px;padding:18px;display:flex;align-items:center;justify-content:space-between;gap:14px
}
.topbar .wallet{color:var(--black)}
.wallet .title{color:var(--grey);font-weight:700}
.wallet .amt{font-size:44px;font-weight:900;letter-spacing:-1px;margin-top:6px;color:var(--royal-blue)}
html[data-theme="dark"] .wallet .amt{color:#ffffff}
html[data-theme="dark"] .wallet .amt{color:#ffffff}
.badge{
  width:44px;height:44px;border-radius:12px;background:rgba(0,0,0,.06);
  display:flex;align-items:center;justify-content:center;font-weight:900;font-size:22px
}
.grid{
  margin-top:18px;
  display:grid;grid-template-columns:repeat(2, minmax(0,1fr));gap:14px;
}
.tile{padding:18px;border-radius:18px;border:1px solid var(--border);background:var(--white);min-height:134px}
.tile h3{margin:10px 0 8px 0;font-size:18px}
.tile p{margin:0;color:var(--grey);line-height:1.35}
.tile .icon{
  width:52px;height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;
  font-weight:900
}
.bg-sky{background:rgba(55,181,255,.16)}
.bg-red{background:rgba(177,0,29,.12)}
.bg-blue{background:rgba(30,79,214,.12)}
.bg-ash{background:rgba(107,114,128,.08)}
.bg-fire{background:rgba(255,77,0,.12)}
.section-title{margin:22px 0 10px 0;font-weight:900;font-size:18px}
.footer-nav{
  position:fixed;left:0;right:0;bottom:0;background:var(--white);
  border-top:1px solid var(--border);
  padding:10px 12px;display:flex;justify-content:space-around;gap:8px;
}
.footer-nav a{
  flex:1;text-align:center;padding:8px 6px;border-radius:12px;color:var(--grey);font-weight:800;font-size:12px;
}
.footer-nav a.active{color:var(--black);background:rgba(30,79,214,.10)}
.footer-spacer{height:148px}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}
.table th{background:rgba(242,244,247,.7);font-weight:900}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.input,select,textarea{
  width:100%;padding:12px 12px;border-radius:12px;border:1px solid var(--border);
  background:var(--white);outline:none;font-size:14px
}
.input-lg{padding:14px 14px;font-size:16px;border-radius:14px}
label{font-weight:800;font-size:13px;color:#111827;display:block;margin:10px 0 6px}
.alert{padding:12px 12px;border-radius:12px;margin:12px 0}
.alert-ok{background:rgba(16,185,129,.12);border:1px solid rgba(16,185,129,.35)}
.alert-err{background:rgba(239,68,68,.10);border:1px solid rgba(239,68,68,.35)}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.kpi{padding:14px;border-radius:16px;border:1px solid var(--border);background:var(--white)}
.kpi .k{color:var(--grey);font-weight:900;font-size:12px;text-transform:uppercase;letter-spacing:.04em}
.kpi .v{font-size:26px;font-weight:1000;margin-top:6px}
.kpi .s{margin-top:6px;color:var(--grey);font-size:12px}
.admin-shell{display:grid;grid-template-columns:260px 1fr;min-height:100vh}
.admin-side{
  background:linear-gradient(180deg,var(--black),#101828);
  color:var(--white);padding:18px;position:sticky;top:0;height:100vh
}
.brand{display:flex;align-items:center;gap:10px;margin-bottom:18px}
.brand img{width:38px;height:38px;border-radius:10px;background:var(--white);padding:6px}
.brand .t{font-weight:1000}
.side a{display:block;padding:10px 12px;border-radius:12px;color:rgba(255,255,255,.85);font-weight:900;font-size:13px;margin-bottom:6px}
.side a.active{background:rgba(55,181,255,.16);color:var(--white)}
.admin-main{padding:18px}
@media(max-width:960px){
  .admin-shell{grid-template-columns:1fr}
  .admin-side{height:auto;position:relative}
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* Modal */
.modal{ position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:9999; padding:18px; }
.modal-content{ max-width:520px; margin:40px auto; background:#fff; border-radius:18px; padding:16px; box-shadow:0 10px 30px rgba(0,0,0,.25); }
.tabs{ display:flex; gap:8px; }
.tab{ flex:1; padding:10px 12px; border-radius:12px; border:1px solid #e5e7eb; background:#f8fafc; font-weight:700; cursor:pointer; }
.tab.active{ background: #0b3d91; color:#fff; border-color:#0b3d91; }


/* Auth */
.auth-bg{background:linear-gradient(180deg,#0b0f19 0%, #1e4fd6 120%); min-height:100vh; display:flex; align-items:center; justify-content:center; padding:18px;}
.auth-card{width:100%; max-width:420px; background:#fff; border-radius:22px; padding:18px; box-shadow: var(--shadow);}
.auth-card label{display:block;margin:10px 0 6px;font-weight:700;}
.auth-card input{width:100%; padding:12px 12px; border:1px solid var(--border); border-radius:14px; outline:none;}
.muted{color:var(--grey); font-size:13px;}

/* ── Auth-page legal footer ───────────────────────────── */
.auth-legal-footer{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid var(--border);
  text-align:center;
}
.auth-legal-copy{
  font-size:11px;
  font-weight:800;
  color:var(--grey);
  letter-spacing:.02em;
  margin-bottom:6px;
}
.auth-legal-text{
  margin:0;
  font-size:10.5px;
  color:var(--grey);
  line-height:1.65;
}
.auth-legal-text a{
  color:var(--royal-blue);
  font-weight:900;
  text-decoration:underline;
  text-underline-offset:2px;
  text-decoration-thickness:1px;
  cursor:pointer;
  transition:opacity .15s;
}
.auth-legal-text a:hover{ opacity:.72; }
/* Grids */
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.grid3{display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px;}
@media(max-width:720px){ .grid2,.grid3{grid-template-columns:1fr;} }

/* Quote breakdown (Estimate / Invoice view) */
.quote-box{background:#f8fafc;padding:12px;border:1px solid var(--border);border-radius:14px}
.quote-line{display:flex;justify-content:space-between;gap:12px;padding:6px 0;font-weight:800}
.quote-line span{color:var(--grey);font-weight:800}
.quote-total{display:flex;justify-content:space-between;gap:12px;padding-top:10px;margin-top:8px;border-top:1px dashed var(--border);font-weight:1000}

/* Tables */
.table{width:100%; border-collapse:collapse; font-size:13px;}
.table th,.table td{padding:10px 8px; border-bottom:1px solid var(--border); text-align:left;}


/* Collapsible form sections (accordion) */
.acc{border:1px solid var(--border); border-radius: var(--radius); background:var(--card); box-shadow: none; overflow:hidden; margin:12px 0}
.acc > summary{list-style:none; cursor:pointer; padding:14px 14px; display:flex; align-items:center; justify-content:space-between; font-weight:900}
.acc > summary::-webkit-details-marker{display:none}
.acc > summary .sum-title{display:flex; gap:10px; align-items:center}
.acc > summary .badge{font-size:12px; padding:3px 8px; border-radius:999px; background:var(--ash); color:var(--grey); font-weight:800}
.acc[open] > summary{border-bottom:1px solid var(--border)}
.acc .acc-body{padding:14px}
.acc .acc-body .muted{margin-top:6px}

.footer-actions{position:fixed; left:0; right:0; bottom:64px; z-index:20; pointer-events:none}
.footer-actions .container{pointer-events:auto}

@media (min-width: 860px){
  .footer-actions{bottom:74px}
}


/* Shipment form enhancements */
.big-text{min-height:78px; resize:vertical; padding:12px 12px; line-height:1.35}
.quote-card{margin-top:12px;padding:12px;background:#f8fafc}
html[data-theme="dark"] .quote-card{background:#0b1220}
.quote-total{font-weight:1000;font-size:22px;margin-top:4px}
.chip{display:inline-block;margin-top:8px;padding:6px 10px;border-radius:999px;background:rgba(255,77,0,.12);color:var(--fire);font-weight:900;font-size:12px}

/* Professional form polish (Shipment) */
.form-shell{max-width:980px;margin:0 auto}
.card.pad{padding:18px}
.field{position:relative}
.field input,.field select,.field textarea{transition:border-color .15s ease, box-shadow .15s ease}
.field input:focus,.field select:focus,.field textarea:focus{border-color:rgba(30,79,214,.55); box-shadow:0 0 0 4px rgba(30,79,214,.14)}
.help{margin-top:6px;color:var(--grey);font-size:12px;font-weight:800}
.req{color:var(--royal-red)}

.quote-card{border:1px solid rgba(148,163,184,.45)}
.quote-card .muted{font-weight:900}
.quote-lines{margin-top:10px;border-top:1px dashed rgba(148,163,184,.55);padding-top:10px}
.quote-line{display:flex;justify-content:space-between;gap:10px;padding:6px 0;color:#0f172a;font-weight:900}
.quote-line span{color:var(--grey);font-weight:900}
html[data-theme="dark"] .quote-line{color:var(--black)}
.quote-line.total{border-top:1px solid var(--border); margin-top:8px; padding-top:10px; font-size:14px}

.agree{display:flex;align-items:flex-start;gap:10px;margin-top:14px;padding:12px;border-radius:16px;border:1px solid var(--border);background:rgba(2,6,23,.02)}
html[data-theme="dark"] .agree{background:rgba(255,255,255,.03)}
.agree input{width:18px;height:18px;margin-top:2px}
.agree a{color:var(--royal-blue);text-decoration:underline;text-underline-offset:3px;font-weight:1000}

.btn[disabled]{opacity:.55; cursor:not-allowed}



/* Big money/value fields */
.form-shell input.big-money{
  min-height: 60px;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .2px;
}
/* Shipment form: large, professional fields */
.form-shell input,
.form-shell select{
  min-height: 54px;
  font-size: 1.05rem;
  padding: 14px 16px;
  border-radius: 14px;
}
.form-shell textarea{
  min-height: 140px;
  font-size: 1.05rem;
  padding: 14px 16px;
  border-radius: 14px;
}
.form-shell .grid{
  gap: 14px;
}
.form-shell label{
  font-weight: 1000;
  margin-bottom: 6px;
  display:block;
}
.form-shell .help{
  margin-top: 6px;
  font-size: .92rem;
}
.form-shell .agree{
  align-items:flex-start;
}
.form-shell .agree input[type="checkbox"]{
  margin-top: 6px;
  width: 20px;
  height: 20px;
}



/* Invoice status badge */
.status-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:1000;
  font-size:.85rem;
  letter-spacing:.2px;
  line-height:1;
}
.status-badge.paid{ background:#16a34a; color:#fff; }
.status-badge.unpaid{ background:#dc2626; color:#fff; }

/* Print-friendly invoice */
@media print{
  .no-print{ display:none !important; }
  .card{ box-shadow:none !important; border:1px solid #e5e7eb !important; }
  body{ background:#fff !important; }
  a[href]:after{ content:""; }
}

/* ── Legal footer bar ──────────────────────────────────────────── */
.legal-footer{
  text-align:center;
  padding:14px 18px 10px;
  font-size:11.5px;
  color:var(--grey);
  line-height:1.65;
  border-top:1px solid var(--border);
  background:var(--white);
  letter-spacing:.01em;
}
.legal-footer .copy{
  font-weight:800;
  color:var(--black);
  opacity:.7;
}
.legal-footer .legal-links{
  margin-top:4px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:4px 8px;
}
.legal-footer .legal-links a{
  color:var(--royal-blue);
  font-weight:900;
  text-decoration:underline;
  text-underline-offset:2px;
  text-decoration-thickness:1px;
  cursor:pointer;
  transition:opacity .15s;
}
.legal-footer .legal-links a:hover{ opacity:.75; }
html[data-theme="dark"] .legal-footer{
  background:var(--card);
  border-top-color:var(--border);
}

/* ── Terms / Privacy modal ─────────────────────────────────────── */
.tp-overlay{
  display:none;
  position:fixed; inset:0;
  background:rgba(11,15,25,.62);
  z-index:10000;
  padding:16px;
  align-items:flex-end;
  justify-content:center;
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  animation:tp-fade-in .2s ease;
}
.tp-overlay.open{ display:flex; }
@keyframes tp-fade-in{ from{opacity:0} to{opacity:1} }

.tp-sheet{
  width:100%; max-width:520px;
  max-height:82vh;
  background:var(--white);
  border-radius:22px 22px 16px 16px;
  box-shadow:0 -4px 40px rgba(11,15,25,.22);
  display:flex; flex-direction:column;
  overflow:hidden;
  animation:tp-slide-up .28s cubic-bezier(.22,1,.36,1);
}
@keyframes tp-slide-up{
  from{ transform:translateY(40px); opacity:0; }
  to{   transform:translateY(0);    opacity:1; }
}

.tp-sheet-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px 12px;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.tp-sheet-head h2{
  margin:0; font-size:17px; font-weight:1000;
  color:var(--black); letter-spacing:-.2px;
}
.tp-close-btn{
  width:34px; height:34px;
  border-radius:50%;
  border:0;
  background:rgba(107,114,128,.12);
  color:var(--grey);
  font-size:18px; font-weight:900;
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s;
  flex-shrink:0;
}
.tp-close-btn:hover{ background:rgba(177,0,29,.12); color:var(--royal-red); }

.tp-sheet-body{
  flex:1; overflow-y:auto;
  padding:18px 18px 24px;
  -webkit-overflow-scrolling:touch;
  font-size:13.5px;
  line-height:1.7;
  color:var(--grey);
}
.tp-sheet-body p{ margin:0 0 10px; }
.tp-sheet-body strong{ color:var(--black); }
.tp-sheet-foot{
  padding:12px 18px;
  border-top:1px solid var(--border);
  text-align:center;
  flex-shrink:0;
  background:var(--ash);
}
.tp-sheet-foot a{
  display:inline-block;
  padding:10px 28px;
  border-radius:12px;
  background:var(--royal-blue);
  color:#fff !important;
  font-weight:900;
  font-size:13.5px;
  text-decoration:none !important;
  transition:opacity .15s;
}
.tp-sheet-foot a:hover{ opacity:.88; }

html[data-theme="dark"] .tp-sheet{background:var(--card);}
html[data-theme="dark"] .tp-sheet-foot{background:var(--ash);}
