/* ==========================================================================
   E-Commerce Fulfillment System — theme (red & white)
   ========================================================================== */
:root{
  --red:#e00000; --red-600:#c40000; --red-700:#8a0000; --red-50:#fdf2f2;
  --red-100:#fce4e4; --red-glow:rgba(224,0,0,.25);
  --ink:#1c2024; --muted:#6b7280; --line:#e8e8ee; --bg:#f6f7f9;
  --white:#ffffff; --ok:#16a34a; --warn:#d97706; --info:#2563eb;
  --radius:12px; --radius-sm:8px; --shadow:0 1px 3px rgba(16,24,40,.06),0 1px 2px rgba(16,24,40,.04);
  --shadow-md:0 6px 20px rgba(16,24,40,.08); --sidebar-w:250px;
  --font:'Segoe UI',system-ui,-apple-system,Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:var(--font);color:var(--ink);background:var(--bg);line-height:1.55;font-size:15px}
a{color:var(--red);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;display:block}
h1,h2,h3,h4{margin:0 0 .5em;line-height:1.25;font-weight:700}
.container{max-width:1180px;margin:0 auto;padding:0 20px}

/* Buttons ---------------------------------------------------------------- */
.btn{display:inline-flex;align-items:center;gap:.5rem;justify-content:center;
  border:1px solid transparent;background:var(--red);color:#fff;font-weight:600;
  padding:.62rem 1.1rem;border-radius:var(--radius-sm);cursor:pointer;font-size:.92rem;
  transition:.15s ease;text-decoration:none;line-height:1}
.btn:hover{background:var(--red-600);text-decoration:none;box-shadow:0 4px 12px var(--red-glow)}
.btn:active{transform:translateY(1px)}
.btn-outline{background:#fff;color:var(--red);border-color:var(--red)}
.btn-outline:hover{background:var(--red-50)}
.btn-ghost{background:transparent;color:var(--ink);border-color:var(--line)}
.btn-ghost:hover{background:#f0f1f4}
.btn-sm{padding:.4rem .7rem;font-size:.82rem}
.btn-block{width:100%}
.btn-danger{background:var(--red-700)}
.btn[disabled]{opacity:.55;cursor:not-allowed}

/* Forms ------------------------------------------------------------------ */
label{display:block;font-weight:600;font-size:.85rem;margin-bottom:.35rem;color:#374151}
.input,input[type=text],input[type=email],input[type=password],input[type=number],
input[type=date],input[type=search],select,textarea{
  width:100%;padding:.62rem .8rem;border:1px solid var(--line);border-radius:var(--radius-sm);
  font:inherit;color:var(--ink);background:#fff;transition:.15s}
.input:focus,input:focus,select:focus,textarea:focus{outline:none;border-color:var(--red);
  box-shadow:0 0 0 3px var(--red-glow)}
.field{margin-bottom:1rem}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.help{font-size:.8rem;color:var(--muted);margin-top:.3rem}

/* Alerts ----------------------------------------------------------------- */
.alert{padding:.8rem 1rem;border-radius:var(--radius-sm);margin-bottom:1rem;font-size:.9rem;
  border:1px solid transparent}
.alert-error{background:var(--red-50);color:var(--red-700);border-color:var(--red-100)}
.alert-success{background:#ecfdf3;color:#027a48;border-color:#d1fadf}
.alert-info{background:#eff6ff;color:#1e40af;border-color:#dbeafe}

/* Cards ------------------------------------------------------------------ */
.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-body{padding:1.25rem}
.card-head{padding:1rem 1.25rem;border-bottom:1px solid var(--line);display:flex;
  align-items:center;justify-content:space-between;gap:1rem}
.card-head h3{margin:0;font-size:1.02rem}

/* Badges ----------------------------------------------------------------- */
.badge{display:inline-block;padding:.2rem .55rem;border-radius:999px;font-size:.74rem;
  font-weight:600;letter-spacing:.2px}
.badge-active,.badge-approved,.badge-paid,.badge-delivered{background:#ecfdf3;color:#027a48}
.badge-inactive,.badge-declined,.badge-rejected{background:var(--red-50);color:var(--red-700)}
.badge-pending,.badge-open,.badge-unpaid{background:#fef3c7;color:#92400e}
.badge-info{background:#eff6ff;color:#1e40af}
.badge-rank{background:#fff7e6;color:#92610a;border:1px solid #f5dfa8}

/* Tables ----------------------------------------------------------------- */
.table-wrap{overflow-x:auto;border-radius:var(--radius)}
table.data{width:100%;border-collapse:collapse;background:#fff;font-size:.76rem;table-layout:auto}
/* Cells wrap so wide tables fit the screen instead of forcing a horizontal scrollbar. */
table.data th,table.data td{padding:.42rem .5rem;text-align:left;border-bottom:1px solid var(--line);
  white-space:normal;overflow-wrap:anywhere;word-break:break-word;vertical-align:middle}
table.data thead th{background:#fafafb;color:#4b5563;font-size:.66rem;text-transform:uppercase;
  letter-spacing:.2px;font-weight:700;position:sticky;top:0}
table.data tbody tr:hover{background:#fcfcfd}
/* Action buttons stay inline and compact. */
table.data td.actions{white-space:nowrap}
table.data td.actions{display:flex;flex-wrap:wrap;gap:.3rem}
table.data td.actions .btn{padding:.3rem .5rem;font-size:.72rem}
table.data td.actions form{display:inline}
table.data .badge{font-size:.66rem;padding:.15rem .45rem}
table.data img{width:30px;height:30px}
.text-right{text-align:right}
.empty{padding:2.5rem;text-align:center;color:var(--muted)}

/* ===== Public site ===== */
.site-header{background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:40}
.site-header .container{display:flex;align-items:center;justify-content:space-between;height:66px}
.brand{display:flex;align-items:center;gap:.6rem;font-weight:800;font-size:1.12rem;color:var(--ink)}
.brand:hover{text-decoration:none}
.brand .logo{width:34px;height:34px;background:#fff;border:1px solid #f1d4d4;border-radius:9px;display:grid;
  place-items:center;color:#fff;font-weight:800}
.nav{display:flex;gap:1.4rem;align-items:center}
.nav a{color:#374151;font-weight:500;font-size:.94rem}
.nav a:hover{color:var(--red);text-decoration:none}
.hero{background:linear-gradient(160deg,#fff 0%,var(--red-50) 100%);padding:4.5rem 0}
.hero h1{font-size:2.6rem;max-width:14ch;background:linear-gradient(90deg,var(--red),var(--red-700));
  -webkit-background-clip:text;background-clip:text;color:transparent}
.hero p{font-size:1.15rem;color:#4b5563;max-width:52ch;margin:1rem 0 1.8rem}
/* Homepage hero with the admin's picture: text left, picture right (~half the window). */
.hero .container.hero-split{max-width:1440px;display:grid;grid-template-columns:minmax(0,1fr) var(--hero-w,50%);gap:3rem;align-items:center}
.hero .container.hero-split.hero-stack{grid-template-columns:1fr;gap:2rem}
.hero-media{display:flex;justify-content:center;min-width:0}
.hero-media img{display:block;border-radius:20px;box-shadow:0 24px 60px rgba(17,24,39,.18)}
/* Whole picture: never cropped, as big as the column allows, capped by the height setting. */
.hero-full img{max-width:100%;width:auto;height:auto;max-height:var(--hero-h,80vh)}
/* Fill a fixed shape: full column width, cropped to the chosen ratio. */
.hero-fill{width:100%}
.hero-fill img{width:100%;height:auto;aspect-ratio:var(--hero-ratio,16/9);object-fit:cover;max-height:var(--hero-h,80vh)}
.home-video{padding-top:2.5rem;padding-bottom:1rem}
.video-frame{position:relative;padding-top:56.25%;border-radius:16px;overflow:hidden;background:#000;box-shadow:0 18px 44px rgba(17,24,39,.16);margin-top:1.2rem}
.video-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.section{padding:3.5rem 0}
.section h2{font-size:1.8rem;text-align:center}
.section .lead{text-align:center;color:var(--muted);max-width:56ch;margin:.4rem auto 2.4rem}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:1.4rem}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:2rem}
.feature{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:1.6rem;box-shadow:var(--shadow)}
.feature .ico{width:44px;height:44px;border-radius:11px;background:var(--red-50);color:var(--red);
  display:grid;place-items:center;font-size:1.3rem;margin-bottom:.9rem}
.site-footer{background:#1a1c20;color:#c3c7cf;padding:3rem 0 1.5rem;margin-top:3rem}
.site-footer a{color:#e5e7eb}
.site-footer .cols{display:grid;grid-template-columns:2fr 1fr 1fr;gap:2rem;margin-bottom:2rem}
.socials{display:flex;gap:.7rem;margin-top:1rem}
.socials a{width:38px;height:38px;border-radius:9px;background:#2a2d33;display:grid;place-items:center;color:#fff}
.socials a:hover{background:var(--red)}
.copyright{border-top:1px solid #2a2d33;padding-top:1.2rem;font-size:.85rem;color:#8b9099;text-align:center}

/* ===== Auth pages ===== */
.auth-wrap{min-height:100vh;display:grid;place-items:center;padding:2rem;
  background:radial-gradient(1200px 500px at 50% -10%,var(--red-50),var(--bg))}
.auth-card{width:100%;max-width:420px;background:#fff;border:1px solid var(--line);
  border-radius:16px;box-shadow:var(--shadow-md);padding:2.2rem}
.auth-card .brand{justify-content:center;margin-bottom:.4rem}
.auth-card h2{text-align:center;font-size:1.4rem}
.auth-sub{text-align:center;color:var(--muted);margin-bottom:1.6rem;font-size:.92rem}
.divider{display:flex;align-items:center;gap:1rem;color:var(--muted);margin:1.2rem 0;font-size:.82rem}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--line)}
.oauth-btns{display:flex;flex-direction:column;gap:.6rem}
.oauth-btn{display:flex;align-items:center;justify-content:center;gap:.6rem;padding:.6rem;
  border:1px solid var(--line);border-radius:var(--radius-sm);background:#fff;font-weight:600;
  color:#374151;cursor:pointer;font-size:.9rem}
.oauth-btn:hover{background:#f9fafb;text-decoration:none}
.auth-foot{text-align:center;margin-top:1.4rem;font-size:.9rem;color:var(--muted)}
.otp-input{letter-spacing:.6em;text-align:center;font-size:1.5rem;font-weight:700}

/* ===== Tabs (settings sub-navigation) ===== */
.tabs{display:flex;gap:.3rem;flex-wrap:wrap;border-bottom:1px solid var(--line);margin-bottom:1.1rem}
.tabs .tab{padding:.55rem .95rem;font-size:.9rem;font-weight:600;color:var(--muted);
  border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs .tab:hover{color:var(--ink);text-decoration:none}
.tabs .tab.active{color:var(--red);border-bottom-color:var(--red)}

/* ===== Permissions ===== */
.perm-chip{display:inline-block;padding:.2rem .6rem;border-radius:999px;font-size:.74rem;font-weight:600;white-space:nowrap}

/* ===== SMS integration ===== */
.pw-wrap{position:relative;display:flex;align-items:center}
.pw-wrap input{flex:1;padding-right:2.6rem}
.pw-eye{position:absolute;right:.5rem;background:none;border:none;cursor:pointer;font-size:1rem;
  opacity:.5;padding:.2rem}
.pw-eye:hover,.pw-eye.on{opacity:1}
.trig-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;
  padding:.75rem 0;border-bottom:1px solid var(--line)}
.trig-row:last-child{border-bottom:none}
.switch{position:relative;display:inline-block;width:46px;height:26px;flex:none}
.switch input{opacity:0;width:0;height:0}
.switch .slider{position:absolute;top:0;right:0;bottom:0;left:0;background:#cbd2dc;border-radius:999px;transition:.2s;cursor:pointer}
.switch .slider::before{content:"";position:absolute;height:20px;width:20px;left:3px;top:3px;
  background:#fff;border-radius:50%;transition:.2s;box-shadow:0 1px 2px rgba(0,0,0,.25)}
.switch input:checked + .slider{background:var(--red)}
.switch input:checked + .slider::before{transform:translateX(20px)}

/* ===== OTP verify ===== */
.otp-head{text-align:center;margin-bottom:1.1rem}
.otp-badge{width:66px;height:66px;margin:0 auto 1rem;border-radius:18px;display:grid;place-items:center;
  color:#fff;background:linear-gradient(135deg,var(--red) 0%,var(--red-700) 100%);
  box-shadow:0 8px 20px var(--red-glow)}
.otp-icon{width:64px;height:64px;margin:0 auto .9rem;border-radius:50%;display:grid;place-items:center;
  background:var(--red-50);color:var(--red)}
.otp-head h2{margin:.2rem 0 .45rem;font-size:1.35rem}
.otp-sub{color:var(--muted);font-size:.9rem;margin:0}
.badge-secure{display:inline-block;background:#ecfdf3;color:#027a48;border:1px solid #d1fadf;
  padding:.12rem .5rem;border-radius:999px;font-size:.72rem;font-weight:700;margin-right:.35rem}
.otp-target{display:flex;align-items:center;gap:.7rem;text-align:left;background:var(--red-50);
  border:1px solid var(--red-100);border-radius:12px;padding:.6rem .8rem;margin:0 0 1.1rem}
.otp-target-ico{width:38px;height:38px;flex:none;display:grid;place-items:center;background:#fff;
  border-radius:9px;font-size:1.05rem;box-shadow:var(--shadow)}
.otp-target-label{font-size:.68rem;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);font-weight:700}
.otp-target-mail{font-size:.95rem;font-weight:700;color:var(--ink)}
.otp-boxes{display:flex;gap:.55rem;justify-content:center;margin:1.1rem 0 .3rem}
.otp-box{width:48px;height:58px;text-align:center;font-size:1.6rem;font-weight:800;color:var(--ink);
  border:1.5px solid var(--line);border-radius:12px;background:#fbfcfd;padding:0;transition:.15s}
.otp-box:focus{border-color:var(--red);background:#fff;box-shadow:0 0 0 3px var(--red-glow);outline:none}
.otp-box:not(:placeholder-shown){border-color:var(--red);color:var(--red);background:#fff}
.otp-expiry{display:flex;align-items:center;justify-content:center;gap:.35rem;color:var(--muted);
  font-size:.85rem;margin:0 0 1.1rem}
.otp-expiry svg{opacity:.8}
.otp-actions{display:flex;gap:.6rem;justify-content:center;margin-top:1.1rem;padding-top:1.1rem;
  border-top:1px solid var(--line)}
.otp-actions form{margin:0}
.otp-remember{display:flex;gap:.5rem;align-items:flex-start;font-size:.85rem;color:#374151;margin:-.3rem 0 1rem;text-align:left;cursor:pointer}
.otp-remember input{margin-top:.2rem;accent-color:var(--brand,#c81e1e)}
.otp-backup{margin-top:1rem;font-size:.85rem;text-align:left;background:#fafafa;border:1px solid var(--line);border-radius:10px;padding:.6rem .8rem}
.otp-backup summary{cursor:pointer;font-weight:600;color:#374151}
.otp-backup form{display:flex;gap:.5rem;margin:.7rem 0 .4rem}
.otp-backup input[type=text]{flex:1;text-transform:uppercase;letter-spacing:.12em;font-family:ui-monospace,Consolas,monospace}
.otp-backup p{margin:0;color:var(--muted);font-size:.78rem}
.otp-security{display:flex;align-items:center;justify-content:center;gap:.35rem;margin:1rem 0 0;
  color:var(--muted);font-size:.78rem}
@media(max-width:420px){.otp-box{width:42px;height:52px;font-size:1.35rem}.otp-boxes{gap:.4rem}}

/* ===== Admin shell ===== */
.admin{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh}
.sidebar{background:linear-gradient(180deg,#1e2740 0%,#1a2235 100%);color:#aab4cc;position:fixed;
  top:0;right:auto;bottom:0;left:0;height:100vh;width:var(--sidebar-w);   /* longhand + height: iOS 12 ignores the `inset` shorthand */
  overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:30;padding-bottom:2rem;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-color:#3b465f transparent}      /* slim scrollbar (Firefox) */
.sidebar::-webkit-scrollbar{width:6px}                            /* slim scrollbar (Chrome/Edge/Safari) */
.sidebar::-webkit-scrollbar-track{background:transparent}
.sidebar::-webkit-scrollbar-thumb{background:#3b465f;border-radius:3px}
.sidebar::-webkit-scrollbar-thumb:hover{background:#556080}
.sidebar .s-foot{margin-top:.25rem;border-top:1px solid rgba(255,255,255,.08);padding-top:.5rem}
.sidebar .s-brand{display:flex;align-items:center;gap:.6rem;padding:1.1rem 1.2rem;color:#fff;
  font-weight:800;border-bottom:1px solid rgba(255,255,255,.08);position:sticky;top:0;background:#1e2740;
  z-index:5;box-shadow:0 6px 10px -8px rgba(0,0,0,.5)}
.sidebar .s-brand .logo{width:30px;height:30px;background:#fff;border-radius:8px;display:grid;place-items:center}
.s-group{padding:.5rem 0}
.s-group .s-title{padding:.7rem 1.2rem .35rem;font-size:.68rem;text-transform:uppercase;
  letter-spacing:.8px;color:#7a86a4;font-weight:700}
/* Collapsible sidebar groups (dropdown accordions) */
details.s-group{padding:.25rem 0}
/* NOTE: keep <summary> at its default display:list-item. Setting display:flex/block/grid
   on a <summary> BREAKS the native tap-to-toggle in iOS/Safari (works in Chrome). The
   caret is positioned absolutely instead so we still get the title + right-aligned arrow. */
details.s-group > summary.s-title{list-style:none;cursor:pointer;position:relative;
  padding-right:1.9rem;user-select:none;transition:color .15s;-webkit-tap-highlight-color:transparent}
details.s-group > summary.s-title::-webkit-details-marker{display:none}
details.s-group > summary.s-title:hover{color:#d6dcec}
details.s-group > summary.s-title::after{content:"\25B8";font-size:.75rem;opacity:.55;
  position:absolute;right:1.2rem;top:50%;transform:translateY(-50%);transition:transform .18s ease}
details.s-group[open] > summary.s-title::after{transform:translateY(-50%) rotate(90deg)}
.sidebar a.s-link{display:flex;align-items:center;gap:.7rem;padding:.55rem 1.2rem;color:#aab4cc;
  font-size:.88rem;border-left:3px solid transparent}
.sidebar a.s-link:hover{background:#28324c;color:#fff;text-decoration:none}
.sidebar a.s-link.active{background:#28324c;color:#fff;border-left-color:var(--red)}
.sidebar a.s-link .i{flex:0 0 18px;width:18px;text-align:center;opacity:.9;
  display:inline-block;overflow:hidden;font-size:1rem;line-height:1}
.main{grid-column:2;display:flex;flex-direction:column;min-width:0}
.topbar{background:#fff;border-bottom:1px solid var(--line);height:62px;display:flex;
  align-items:center;justify-content:space-between;padding:0 1.5rem;position:sticky;top:0;z-index:20}
.topbar .page-title{font-weight:700;font-size:1.05rem}
.topbar .user{display:flex;align-items:center;gap:.7rem}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--red);color:#fff;display:grid;
  place-items:center;font-weight:700;font-size:.85rem}
.content{padding:1.6rem;flex:1}
.page-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.2rem;flex-wrap:wrap}
.page-head h1{font-size:1.35rem;margin:0}
.toolbar{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap}
.toolbar form{display:flex;gap:.5rem}

/* Stat cards */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:1.1rem;margin-bottom:1.5rem}
.stat{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:1.1rem 1.2rem;
  box-shadow:var(--shadow);position:relative;overflow:hidden}
.stat .k{font-size:.78rem;color:var(--muted);text-transform:uppercase;letter-spacing:.4px;font-weight:600}
.stat .v{font-size:1.7rem;font-weight:800;margin-top:.25rem}
.stat .ico{position:absolute;right:1rem;top:1rem;width:38px;height:38px;border-radius:10px;
  background:var(--red-50);color:var(--red);display:grid;place-items:center;font-size:1.1rem}
.stat.accent{background:linear-gradient(135deg,var(--red),var(--red-700));color:#fff;border:none}
.stat.accent .k{color:#ffd9d9}
.stat.accent .ico{background:rgba(255,255,255,.18);color:#fff}

.two-col{display:grid;grid-template-columns:1.4fr 1fr;gap:1.2rem}
.bar-row{display:flex;align-items:center;gap:.8rem;margin-bottom:.7rem}
.bar-row .lbl{width:120px;font-size:.82rem;color:#4b5563;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar-track{flex:1;height:10px;background:#f0f1f4;border-radius:999px;overflow:hidden}
.bar-fill{height:100%;background:linear-gradient(90deg,var(--red),var(--red-600));border-radius:999px}
.bar-row .num{width:48px;text-align:right;font-weight:700;font-size:.85rem}

.pagination{display:flex;gap:.35rem;margin-top:1.1rem;justify-content:flex-end}
.pagination a,.pagination span{padding:.4rem .7rem;border:1px solid var(--line);border-radius:6px;
  font-size:.85rem;color:#374151;background:#fff}
.pagination .cur{background:var(--red);color:#fff;border-color:var(--red)}

.muted{color:var(--muted)}
.mt{margin-top:1rem}.mb{margin-bottom:1rem}
.flex{display:flex}.gap{gap:.6rem}.between{justify-content:space-between}.center{align-items:center}

@media(max-width:960px){
  .admin{grid-template-columns:1fr}
  .sidebar{transform:translateX(-100%);transition:.2s}
  .sidebar.open{transform:none}
  .main{grid-column:1}
  /* !important so per-page inline column counts (e.g. stats forced to
     repeat(5,1fr)) still collapse on mobile instead of squishing/truncating. */
  .stats{grid-template-columns:1fr 1fr !important}
  .two-col,.grid-3,.grid-2,.form-row{grid-template-columns:1fr !important}
  .hero h1{font-size:2rem}
  .hero .container.hero-split{grid-template-columns:1fr;gap:1.8rem}
}
@media(max-width:560px){
  .stats{grid-template-columns:1fr !important}
  /* Give stat labels/values room so nothing truncates when stacked. */
  .stat .k{white-space:normal}
  .stat .v{font-size:1.5rem;white-space:nowrap}
}
.menu-toggle{display:none;background:none;border:none;font-size:1.4rem;cursor:pointer;color:var(--ink)}
@media(max-width:960px){.menu-toggle{display:block}}

/* Mobile: keep data tables readable by scrolling them sideways (laptop-style)
   instead of squishing columns until headers wrap character-by-character. */
.table-wrap{-webkit-overflow-scrolling:touch}
@media(max-width:820px){
  table.data{width:auto;min-width:100%}
  table.data th,table.data td{white-space:nowrap}
  table.data td.actions{white-space:normal}
  /* subtle hint that the table scrolls horizontally */
  .table-wrap{position:relative;box-shadow:inset -14px 0 10px -12px rgba(0,0,0,.12)}
}

/* Order status timeline */
.timeline{display:flex;align-items:flex-start;gap:0;overflow-x:auto;padding:.5rem 0}
.tl-step{flex:1;min-width:96px;text-align:center;position:relative}
.tl-step .dot{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;margin:0 auto .4rem;
  background:#eef0f3;color:#9aa0a8;font-weight:700;border:2px solid #eef0f3;position:relative;z-index:2}
.tl-step .lbl{font-size:.72rem;color:var(--muted);line-height:1.2;padding:0 .2rem}
.tl-step::before{content:"";position:absolute;top:17px;left:-50%;width:100%;height:3px;background:#eef0f3;z-index:1}
.tl-step:first-child::before{display:none}
.tl-step.done .dot{background:var(--ok);border-color:var(--ok);color:#fff}
.tl-step.done::before{background:var(--ok)}
.tl-step.current .dot{background:var(--red);border-color:var(--red);color:#fff;box-shadow:0 0 0 4px var(--red-glow)}
.tl-step.current .lbl{color:var(--red);font-weight:700}
.summary-row{display:flex;justify-content:space-between;padding:.45rem 0;border-bottom:1px solid var(--line);font-size:.9rem}
.summary-row.total{border-bottom:none;font-weight:800;font-size:1.05rem;padding-top:.7rem}
.quick-status{display:flex;flex-wrap:wrap;gap:.4rem}
.quick-status button{border:1px solid var(--line);background:#fff;border-radius:999px;padding:.4rem .8rem;font-size:.82rem;cursor:pointer;font-weight:600;color:#374151}
.quick-status button:hover{background:var(--red-50);border-color:var(--red)}
.quick-status button.on{background:var(--red);color:#fff;border-color:var(--red)}

/* Support ticket pills (type/status/priority chips) */
.pill{display:inline-block;padding:.12rem .5rem;border-radius:999px;color:#fff;font-size:.72rem;font-weight:600;white-space:nowrap;line-height:1.5}
.ticket-thread{display:flex;flex-direction:column;gap:.75rem}
.ticket-msg{border:1px solid var(--line);border-radius:10px;padding:.7rem .9rem;background:#fff}
.ticket-msg.internal{background:#fff8e6;border-color:#f0d999}
.ticket-msg.system{background:#f3f5f7;border-style:dashed;font-size:.85rem;color:#555}
.ticket-msg .who{font-weight:600;font-size:.85rem}
.ticket-msg .when{color:#8a8f98;font-size:.75rem}

/* "Install App" sheet (login pages). iOS-12 safe: longhand offsets (no `inset`
   shorthand), class-toggle (no [hidden] conflict), no flex `gap`. */
.install-sheet{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;
  background:rgba(17,17,17,.55);align-items:center;justify-content:center;padding:1rem}
.install-sheet.open{display:flex}
.install-sheet-card{background:#fff;border-radius:16px;padding:1.3rem 1.4rem;max-width:340px;width:100%;
  position:relative;box-shadow:0 24px 60px rgba(0,0,0,.35)}
.install-sheet-x{position:absolute;top:.4rem;right:.6rem;background:none;border:none;
  font-size:1.6rem;line-height:1;cursor:pointer;color:#9aa0a8;padding:.2rem .4rem}
.install-sheet-x:hover{color:#555}

/* iOS-only Add-to-Home-Screen banner (login pages). iOS-12 safe: longhand
   offsets, margin instead of flex `gap`. Shown via .show class by app.js. */
.ios-install-banner{display:none;position:fixed;left:0;right:0;bottom:0;z-index:900;
  background:#1e2740;color:#fff;padding:.85rem 2.6rem .95rem 1rem;font-size:.9rem;
  box-shadow:0 -6px 22px rgba(0,0,0,.3)}
.ios-install-banner.show{display:block}
.ios-install-banner-body{display:flex;align-items:center;line-height:1.4}
.ios-install-emoji{font-size:1.5rem;margin-right:.6rem;flex:0 0 auto}
.ios-install-banner-x{position:absolute;top:.35rem;right:.55rem;background:none;border:none;
  color:#fff;font-size:1.5rem;line-height:1;cursor:pointer;opacity:.8;padding:.15rem .35rem}
.ios-install-arrow{position:absolute;bottom:-4px;left:50%;margin-left:-9px;color:#fff;
  font-size:1.4rem;animation:iosArrowBounce 1.3s ease-in-out infinite}
@keyframes iosArrowBounce{0%,100%{transform:translateY(0)}50%{transform:translateY(6px)}}

/* AI Assistant (merchant chat + plans) ------------------------------------ */
.ai-wrap{display:grid;grid-template-columns:280px 1fr;gap:1.1rem;align-items:start}
.ai-side{display:flex;flex-direction:column;gap:1rem}
.ai-quota .bar-track{margin:.55rem 0 .35rem}
.ai-quota .bar-fill.warn{background:linear-gradient(90deg,#e0902b,#d97706)}
.ai-quota .bar-fill.crit{background:#8a8f98}
.ai-convs a.ai-conv{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.5rem .6rem;border-radius:8px;color:var(--ink);font-size:.86rem}
.ai-convs a.ai-conv:hover{background:#f3f4f6;text-decoration:none}
.ai-convs a.ai-conv.active{background:var(--red-50);color:var(--red-700);font-weight:600}
.ai-panel{display:flex;flex-direction:column;min-height:520px}
.ai-log{flex:1;overflow:auto;padding:1.1rem;height:calc(100vh - 300px);min-height:380px;background:#fafafa;border-radius:var(--radius) var(--radius) 0 0}
.ai-msg{display:flex;gap:.6rem;margin-bottom:.9rem;max-width:88%}
.ai-msg.user{margin-left:auto;flex-direction:row-reverse}
.ai-msg>div:last-child{min-width:0}
.ai-avatar{flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-size:.9rem;background:#fff;border:1px solid var(--line)}
.ai-msg.user .ai-avatar{background:var(--red);color:#fff;border:none}
.ai-bubble{background:#fff;border:1px solid var(--line);border-radius:14px;padding:.65rem .9rem;font-size:.92rem;line-height:1.55;box-shadow:var(--shadow);overflow-wrap:anywhere}
.ai-msg.user .ai-bubble{background:var(--red);color:#fff;border:none}
.ai-bubble p{margin:0 0 .5em}.ai-bubble p:last-child{margin:0}
.ai-bubble ul,.ai-bubble ol{margin:.3em 0 .5em 1.2em;padding:0}
.ai-bubble code{background:#f3f4f6;padding:.05em .3em;border-radius:4px;font-size:.86em}
.ai-msg.user .ai-bubble code{background:rgba(255,255,255,.2)}
.ai-meta{font-size:.72rem;color:var(--muted);margin-top:.3rem}
.ai-msg.user .ai-meta{text-align:right}
.ai-typing span{display:inline-block;width:6px;height:6px;border-radius:50%;background:#9ca3af;margin-right:3px;animation:aiBlink 1.2s infinite}
.ai-typing span:nth-child(2){animation-delay:.2s}.ai-typing span:nth-child(3){animation-delay:.4s}
@keyframes aiBlink{0%,80%,100%{opacity:.25}40%{opacity:1}}
.ai-form{display:flex;gap:.6rem;padding:.8rem;border-top:1px solid var(--line);align-items:flex-end}
.ai-form textarea{resize:none;min-height:44px;max-height:160px;line-height:1.4}
.ai-chips{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.8rem}
.ai-chip{border:1px solid var(--line);background:#fff;border-radius:999px;padding:.35rem .75rem;font-size:.82rem;cursor:pointer;color:var(--ink);font:inherit;font-size:.82rem;text-align:left}
.ai-chip:hover{border-color:var(--red);color:var(--red)}
.ai-chip[disabled]{opacity:.5;cursor:not-allowed}
.ai-welcome{background:#fff;border:1px dashed var(--line);border-radius:12px;padding:1rem 1.1rem}
.ai-foot{padding:.5rem .9rem .7rem;font-size:.75rem}
.ai-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem}
.ai-plan{border:1px solid var(--line);border-radius:var(--radius);padding:1.1rem;background:#fff;box-shadow:var(--shadow)}
.ai-plan.current{border-color:var(--red);box-shadow:0 0 0 3px var(--red-100)}
.ai-plan .price{font-size:1.6rem;font-weight:800;margin:.3rem 0}
.ai-plan ul{margin:.4rem 0 0 1.1rem;padding:0;font-size:.88rem;color:#374151}
@media(max-width:960px){.ai-wrap{grid-template-columns:1fr}.ai-log{height:auto;max-height:60vh;min-height:280px}.ai-msg{max-width:100%}}

/* Public site header on phones: let the brand + nav wrap instead of overflowing ---- */
@media(max-width:700px){
  .site-header .container{height:auto;min-height:60px;flex-wrap:wrap;gap:.35rem .8rem;padding-top:.55rem;padding-bottom:.55rem}
  .site-header .brand{font-size:1rem}
  .site-header .nav{flex-wrap:wrap;gap:.45rem .9rem;width:100%;justify-content:flex-start}
  .site-header .nav a{font-size:.88rem}
  .site-header .nav .btn{padding:.35rem .65rem}
}

/* Intern CEO dashboard — KPI cards by parcel status ------------------------- */
.kpi-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-bottom:1.2rem}
.kpi{position:relative;border-radius:12px;padding:1.1rem 1.2rem 1.5rem;color:#fff;text-align:right;min-height:104px;display:flex;flex-direction:column;justify-content:center;box-shadow:var(--shadow);overflow:hidden;text-decoration:none}
.kpi:hover{text-decoration:none;filter:brightness(1.06);color:#fff}
.kpi .amt{font-size:1.6rem;font-weight:800;line-height:1.1}
.kpi .lbl{font-size:.76rem;font-weight:700;letter-spacing:.3px;text-transform:uppercase;opacity:.95;margin-top:.3rem}
.kpi .sub{font-size:.8rem;font-weight:800;opacity:.95}
.kpi .hint{position:absolute;left:.9rem;bottom:.55rem;font-size:.7rem;font-style:italic;opacity:.8}
.kpi .ico{position:absolute;left:.8rem;top:.6rem;font-size:1.7rem;opacity:.3}
.kpi.c-blue{background:#2f8fd8}.kpi.c-green{background:#22b573}.kpi.c-orange{background:#f5a623}.kpi.c-teal{background:#12a594}
.kpi.c-slate{background:#4b5563}.kpi.c-sky{background:#3aa0e8}.kpi.c-red{background:#e63946}.kpi.c-crimson{background:#c1121f}
.kpi.c-purple{background:#7b4fd6}.kpi.c-orange2{background:#f26a1b}
@media(max-width:960px){.kpi-grid{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.kpi-grid{grid-template-columns:1fr}.kpi .amt{font-size:1.35rem}}

/* Messaging inbox (Pancake-style) ------------------------------------------- */
.sidebar .s-badge{margin-left:auto;background:var(--red);color:#fff;border-radius:999px;font-size:.66rem;padding:.05rem .45rem;font-weight:700;line-height:1.4}
.ib{display:grid;grid-template-columns:300px minmax(0,1fr) 290px;border:1px solid var(--line);border-radius:var(--radius);background:#fff;box-shadow:var(--shadow);height:calc(100vh - 150px);min-height:540px;overflow:hidden}
.ib-list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-width:0}
.ib-search{display:flex;gap:.4rem;padding:.6rem;border-bottom:1px solid var(--line)}
.ib-search input{flex:1;min-width:0;padding:.4rem .55rem;font-size:.85rem}
.ib-filters{display:flex;flex-wrap:wrap;gap:.3rem;padding:.5rem .6rem;border-bottom:1px solid var(--line)}
.ib-chip{font-size:.7rem;font-weight:600;padding:.18rem .5rem;border-radius:999px;background:#f0f1f4;color:#374151}
.ib-chip:hover{text-decoration:none;background:#e5e7eb}
.ib-chip.active{background:var(--red);color:#fff}
.ib-chip .n{opacity:.75;margin-left:.15rem}
.ib-channels{padding:.4rem .6rem;border-bottom:1px solid var(--line);font-size:.76rem;display:flex;gap:.35rem .7rem;flex-wrap:wrap}
.ib-channels a{color:var(--muted)}.ib-channels a.on{color:var(--red);font-weight:700}.ib-channels b{color:var(--red)}
.ib-convs{flex:1;overflow-y:auto}
.ib-conv{display:flex;gap:.6rem;padding:.65rem .75rem;border-bottom:1px solid #f1f2f5;color:var(--ink);align-items:flex-start;border-left:3px solid transparent}
.ib-conv:hover{background:#f7f8fb;text-decoration:none}
.ib-conv.on{background:var(--red-50);border-left-color:var(--red)}
.ib-conv.unread .ib-name,.ib-conv.unread .ib-snip{font-weight:700;color:var(--ink)}
.ib-av{width:36px;height:36px;border-radius:50%;background:#e5e7eb;color:#374151;display:grid;place-items:center;font-weight:700;font-size:.85rem;flex:0 0 36px;overflow:hidden}
.ib-body{flex:1;min-width:0;display:block}
.ib-name{font-size:.88rem;display:flex;gap:.25rem;align-items:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ib-name small{font-size:.75rem}
.ib-snip{display:block;font-size:.78rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ib-meta{text-align:right;font-size:.68rem;color:var(--muted);flex:0 0 auto}
.ib-unread{display:inline-block;min-width:18px;padding:0 .35rem;border-radius:999px;background:var(--red);color:#fff;font-size:.68rem;text-align:center;margin-top:.2rem;line-height:1.5}
.ib-thread{display:flex;flex-direction:column;min-width:0}
.ib-head{display:flex;justify-content:space-between;align-items:center;gap:.6rem;padding:.55rem .9rem;border-bottom:1px solid var(--line);flex-wrap:wrap}
.ib-head form{display:inline-flex;gap:.3rem;align-items:center;flex-wrap:wrap}
.ib-back{display:none}
.ib-msgs{flex:1;overflow-y:auto;padding:1rem;background:#f6f7f9;display:flex;flex-direction:column;gap:.45rem}
.ib-m{max-width:74%;padding:.5rem .75rem;border-radius:14px;font-size:.9rem;line-height:1.45;white-space:pre-wrap;word-wrap:break-word;position:relative}
.ib-m.in{align-self:flex-start;background:#fff;border:1px solid var(--line);border-bottom-left-radius:4px}
.ib-m.out{align-self:flex-end;background:var(--red);color:#fff;border-bottom-right-radius:4px}
.ib-m.out a{color:#fff;text-decoration:underline}
.ib-m.bot{background:#1e2740}
.ib-m.note{align-self:center;background:#fef3c7;color:#92400e;font-size:.8rem;max-width:92%;border-radius:8px}
.ib-m .t{display:block;font-size:.66rem;opacity:.7;margin-top:.2rem;white-space:normal}
.ib-m.out .t{text-align:right}
.ib-m .err{display:block;font-size:.7rem;color:#fde68a;white-space:normal}
.ib-m img{max-width:100%;border-radius:8px;display:block;margin-bottom:.3rem}
.ib-compose{border-top:1px solid var(--line);padding:.6rem .9rem;position:relative;background:#fff}
.ib-compose textarea{width:100%;min-height:60px;resize:vertical;font-size:.9rem}
.ib-compose .row{display:flex;gap:.4rem;justify-content:space-between;align-items:center;margin-top:.4rem;flex-wrap:wrap}
.ib-quick{position:absolute;left:.9rem;right:.9rem;bottom:100%;background:#fff;border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow);max-height:220px;overflow:auto;z-index:5}
.ib-quick button{display:block;width:100%;text-align:left;background:none;border:0;padding:.45rem .7rem;font-size:.85rem;cursor:pointer;border-bottom:1px solid #f1f2f5;color:var(--ink)}
.ib-quick button:hover{background:#f7f8fb}
.ib-quick b{color:var(--red);margin-right:.3rem}
.ib-side{border-left:1px solid var(--line);overflow-y:auto;padding:.9rem;font-size:.86rem}
.ib-side h4{margin:.2rem 0 .5rem;font-size:.74rem;text-transform:uppercase;letter-spacing:.5px;color:var(--muted)}
.ib-side .field{margin-bottom:.5rem}
.ib-side label{font-size:.76rem}
.ib-side input,.ib-side select,.ib-side textarea{padding:.38rem .55rem;font-size:.84rem}
.ib-stages{display:flex;flex-wrap:wrap;gap:.3rem;margin-bottom:.6rem}
.ib-stage{font-size:.72rem;padding:.2rem .55rem;border-radius:999px;border:1px solid var(--line);background:#fff;cursor:pointer;color:var(--ink)}
.ib-stage.on{background:#22b573;color:#fff;border-color:#22b573}
.ib-lead{background:#eff6ff;border:1px solid #dbeafe;border-radius:8px;padding:.55rem .7rem;margin-bottom:.6rem;color:#1e40af;font-size:.82rem}
.ib-empty{display:grid;place-items:center;height:100%;min-height:120px;color:var(--muted);text-align:center;padding:1.5rem;font-size:.88rem}
.ib-toast{position:fixed;bottom:1rem;right:1rem;background:#1e2740;color:#fff;padding:.6rem .9rem;border-radius:8px;font-size:.85rem;z-index:99;box-shadow:var(--shadow);max-width:360px}
.ib-toast.err{background:var(--red-700)}
.ib-pages{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:.6rem}
.ib-page{display:flex;gap:.6rem;align-items:center;border:1px solid var(--line);border-radius:10px;padding:.6rem;cursor:pointer;font-weight:400}
.ib-page img{width:40px;height:40px;border-radius:50%}
.ib-code{background:#1e2740;color:#e5e7eb;padding:.7rem .9rem;border-radius:8px;font-size:.76rem;overflow:auto;white-space:pre-wrap;word-break:break-all;margin:0 0 .5rem}
@media(max-width:1100px){.ib{grid-template-columns:260px minmax(0,1fr);height:auto;min-height:0}.ib-side{grid-column:1/-1;border-left:0;border-top:1px solid var(--line)}.ib-msgs{min-height:320px;max-height:55vh}.ib-convs{max-height:60vh}}
@media(max-width:760px){.ib{grid-template-columns:1fr}.ib-list{border-right:0;border-bottom:1px solid var(--line)}.ib.has-conv .ib-list{display:none}.ib-back{display:inline-flex}.ib-convs{max-height:none}.ib-m{max-width:88%}}

/* AI sales agents ------------------------------------------------------------ */
.ib-m.ai{background:#7b4fd6;color:#fff}
.ib-ai{display:inline-flex;gap:.3rem;align-items:center;font-size:.7rem;font-weight:700;padding:.12rem .5rem;border-radius:999px;background:#ede9fe;color:#5b21b6;margin-top:.2rem}
.ib-ai.off{background:#fef3c7;color:#92400e}
.ib-ai.human{background:var(--red-50);color:var(--red-700)}
.ag-products{max-height:240px;overflow:auto;border:1px solid var(--line);border-radius:8px;padding:.5rem .75rem;font-size:.85rem;background:#fff}
.ag-products label{display:block;font-weight:400;margin:.1rem 0}

/* Automation flow builder ---------------------------------------------------- */
.fb-steps{display:flex;flex-direction:column;gap:.5rem}
.fb-step{border:1px solid var(--line);border-radius:10px;background:#fff;box-shadow:var(--shadow)}
.fb-head{display:flex;align-items:center;gap:.6rem;padding:.45rem .7rem;border-bottom:1px solid #f1f2f5;font-size:.88rem}
.fb-n{width:22px;height:22px;border-radius:50%;background:var(--red);color:#fff;display:grid;place-items:center;font-size:.72rem;font-weight:700;flex:0 0 22px}
.fb-tools{margin-left:auto;display:flex;gap:.2rem}
.fb-tools .btn{padding:.15rem .45rem;font-size:.75rem}
.fb-body{padding:.6rem .7rem}
.fb-body textarea{width:100%;font-size:.88rem}
.fb-inline{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin-top:.4rem;font-size:.85rem}
.fb-inline label{font-size:.78rem;color:var(--muted);margin:0}
.fb-inline select,.fb-inline input{padding:.35rem .5rem;font-size:.84rem}

/* AI agents: ready-to-sell checklist + Autopilot */
.ar-card.ar-bad{border-left:4px solid #dc2626}.ar-card.ar-warn{border-left:4px solid #f59e0b}.ar-card.ar-ok{border-left:4px solid #16a34a}
.ar-list{list-style:none;margin:0;padding:0}
.ar-list li{display:flex;gap:.7rem;align-items:center;padding:.55rem 0;border-bottom:1px solid var(--line)}
.ar-list li:last-child{border-bottom:0}
.ar-ico{flex:0 0 1.4rem;text-align:center}.ar-text{flex:1;min-width:0}.ar-text small{color:var(--muted)}
.ap-head{display:flex;gap:.9rem;align-items:center}
.ap-dot{width:14px;height:14px;border-radius:50%;background:#16a34a;box-shadow:0 0 0 0 rgba(22,163,74,.5);animation:apPulse 2s infinite}
.ap-off .ap-dot{background:#dc2626;animation:none}
@keyframes apPulse{0%{box-shadow:0 0 0 0 rgba(22,163,74,.5)}70%{box-shadow:0 0 0 12px rgba(22,163,74,0)}100%{box-shadow:0 0 0 0 rgba(22,163,74,0)}}
@media (prefers-reduced-motion:reduce){.ap-dot{animation:none}}
