/* One stylesheet for the login, client portal, seller area and back office.
   Brand colour comes from the server (--brand is set inline by layout.php). */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --ink: #0b1020;
  --muted: #5b6478;
  --line: #e6e8f0;
  --brand: #6d28d9;
  --brand-dark: #5b21b6;
  --brand-soft: #f1ecfe;
  --accent: #06b6d4;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --head: #0a0e1a;
  --head-2: #131a2e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 16, 32, .05), 0 10px 30px rgba(11, 16, 32, .06);
  --shadow-lg: 0 20px 60px rgba(11, 16, 32, .14);
  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --head-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1rem; }
code, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
code { background: #eef0f6; padding: .1em .4em; border-radius: 6px; }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; padding: .1em .45em; border-radius: 6px; }
.muted { color: var(--muted); }
.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }
main { padding: 1.75rem 0 3rem; min-height: 60vh; }
main.wide .wrap { width: min(1440px, 100% - 2rem); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40; color: #fff;
  background: rgba(10, 14, 26, .88);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.head-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--head-h); position: relative; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--brand)); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.brand-logo { height: 30px; width: auto; border-radius: 8px; }
.nav { display: flex; gap: .2rem; margin-left: .5rem; flex: 1; }
.nav a {
  color: #c7cbe0; font-size: .92rem; font-weight: 500; padding: .45rem .8rem; border-radius: 999px;
  transition: background .15s, color .15s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; background: rgba(255,255,255,.12); }
.nav .nav-logout { display: none; }
.head-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.who-chip { display: flex; flex-direction: column; line-height: 1.15; font-size: .85rem; color: #e8eaf3; padding-right: .3rem; text-align: right; }
.who-chip small { color: #8f97b3; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.nav-toggle {
  display: none; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px; padding: 0;
}
.nav-toggle span { width: 18px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.05rem; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 6px 18px rgba(109, 40, 217, .28); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 8px 22px rgba(109, 40, 217, .36); }
.btn-ghost { background: transparent; color: #e6e8f3; border-color: rgba(255,255,255,.2); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { background: #f3f0ff; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; border-radius: 9px; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; border-radius: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.25rem 1.35rem; }
.grid { display: grid; gap: 1rem; }
.cols-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 1rem; }
.split { grid-template-columns: minmax(280px, 330px) 1fr; align-items: start; }
.split-r { grid-template-columns: 1fr minmax(280px, 340px); align-items: start; }
.section { margin-bottom: 1.75rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: .35rem; }

/* ---------- page hero (portal / seller) ---------- */
.page-hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; margin-bottom: 1.5rem;
  padding: 1.8rem 1.8rem; background: linear-gradient(120deg, #0f1430 0%, #251a5e 55%, #0b3a52 100%);
  box-shadow: var(--shadow-lg);
}
.page-hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 212, 255, .35), transparent 70%); pointer-events: none;
}
.page-hero::after {
  content: ""; position: absolute; left: -80px; bottom: -160px; width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(123, 47, 255, .45), transparent 70%); pointer-events: none;
}
.page-hero > * { position: relative; z-index: 1; }
.page-hero h1 { color: #fff; margin-bottom: .3rem; }
.page-hero p { color: #b9c0dc; max-width: 60ch; margin: 0; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; }
.stat-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.stat-pill {
  display: inline-flex; flex-direction: column; min-width: 96px; padding: .55rem .85rem; border-radius: 14px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px);
}
.stat-pill b { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.1; }
.stat-pill small { color: #b9c0dc; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }

/* legacy hero (kept for any older page) */
.hero { background: linear-gradient(135deg, #0a0e1a 0%, #251a5e 100%); color: #fff; border-radius: var(--radius); padding: 2.2rem 1.6rem; margin-bottom: 1.5rem; }
.hero h1 { color: #fff; }
.hero p { color: #c7cbe0; max-width: 56ch; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem; background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; padding: .12rem .6rem; font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.chip-ok { background: #ecfdf5; color: var(--ok); }
.chip-warn { background: #fffbeb; color: var(--warn); }
.chip-bad { background: #fef2f2; color: var(--bad); }
.chip-dark { background: #0a0e1a; color: #fff; }

/* ---------- forms ---------- */
label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .62rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(109, 40, 217, .15); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: .9rem; }
.form-narrow { max-width: 420px; margin-inline: auto; }
.help { font-size: .8rem; color: var(--muted); margin-top: .3rem; line-height: 1.5; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8f9fc; white-space: nowrap; }
tbody tr:hover { background: #f8f9fc; }
table input, table select { padding: .42rem .55rem; font-size: .86rem; }

/* ---------- flash ---------- */
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-size: .9rem; font-weight: 500; display: flex; gap: .5rem; align-items: flex-start; }
.flash-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice { padding: .8rem 1rem; border-radius: 12px; background: var(--brand-soft); color: #3b1d8a; font-size: .88rem; border: 1px solid #e2d9fb; }

/* ---------- stat tiles (admin) ---------- */
.tiles { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--brand), var(--accent)); }
.tile .n { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.tile .l { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- admin tabs ---------- */
.tabs { display: flex; gap: .3rem; overflow-x: auto; padding: .3rem; margin-bottom: 1.25rem; background: #eceef5; border-radius: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: none; padding: .55rem .95rem; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: .88rem; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); background: #fff; box-shadow: var(--shadow); }
.panel { display: none; }
.panel.on { display: block; }

/* ---------- pre-footer + footer ---------- */
.prefoot { margin-top: 3rem; }
.prefoot-inner {
  position: relative; overflow: hidden; border-radius: 22px; padding: 1.8rem 1.8rem; color: #fff;
  background: linear-gradient(120deg, var(--brand) 0%, #4c1d95 60%, #0e7490 100%);
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.prefoot-inner h2 { color: #fff; margin: 0 0 .25rem; }
.prefoot-inner p { color: rgba(255,255,255,.82); margin: 0; max-width: 56ch; }
.prefoot-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.site-foot { background: var(--head); color: #9aa3c0; margin-top: 2.5rem; }
.foot-inner { display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr 1fr; padding: 2.6rem 0 1.6rem; }
.foot-brand .brand { color: #fff; margin-bottom: .6rem; }
.foot-brand p { font-size: .88rem; max-width: 34ch; margin: 0; }
.foot-col h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .7rem; }
.foot-links { display: grid; gap: .4rem; font-size: .9rem; }
.foot-links a { transition: color .15s; }
.foot-links a:hover { color: #fff; }
.foot-bar { border-top: 1px solid rgba(255,255,255,.08); padding: 1rem 0; font-size: .8rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.foot-bar a:hover { color: #fff; }

/* ---------- login stage ---------- */
body.bare { background: #070b16; color: #e6e8f3; }
body.bare main { padding: 0; min-height: 100vh; display: grid; place-items: center; }
body.bare .site-foot, body.bare .prefoot { display: none; }

.login-stage {
  position: relative; width: min(1040px, 100% - 2rem); padding: 2.5rem 0; isolation: isolate;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center;
}
.login-intro { position: relative; z-index: 2; }
.login-intro .brand { color: #fff; font-size: 1.3rem; margin-bottom: 1.6rem; }
.login-intro h1 { color: #fff; font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 700; margin-bottom: .8rem; }
.login-intro h1 em { font-style: normal; background: linear-gradient(90deg, #c4b5fd, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-intro p { color: #9aa3c0; max-width: 46ch; font-size: 1.02rem; }
.login-points { display: grid; gap: .7rem; margin-top: 1.4rem; padding: 0; list-style: none; }
.login-points li { display: flex; gap: .7rem; align-items: flex-start; color: #c7cbe0; font-size: .93rem; }
.login-points .pt { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #67e8f9; font-size: .8rem; }
.login-card {
  position: relative; z-index: 2; width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px; padding: 1.8rem;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  transition: transform .25s ease; transform-style: preserve-3d;
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.login-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; }
.login-brand strong { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -.01em; }
.login-card label { color: #c7cbe0; }
.login-card input { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); color: #fff; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(6, 182, 212, .25); }
.login-foot { margin: 1.1rem 0 0; font-size: .78rem; text-align: center; color: #8f97b3; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; z-index: 1; pointer-events: none; }
.orb-a { width: 360px; height: 360px; background: var(--brand); top: -80px; left: -60px; animation: drift 14s ease-in-out infinite alternate; }
.orb-b { width: 300px; height: 300px; background: var(--accent); bottom: -60px; right: -40px; animation: drift 18s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate3d(40px, -30px, 0) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .login-card, .orb { animation: none; transition: none; } }

/* ---------- extension state banner ---------- */
.ext-state {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .75rem 1rem; border-radius: 14px; margin: 0 0 1.25rem;
  font-size: .9rem; font-weight: 500; border: 1px solid var(--line); background: var(--surface);
}
.ext-state .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.ext-state .btn { margin-left: auto; }
.ext-unknown .dot { animation: pulse 1.1s ease-in-out infinite; }
.ext-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ext-ok .dot { background: var(--ok); }
.ext-missing { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ext-missing .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- tool cards ---------- */
.tool-card { display: flex; flex-direction: column; gap: .9rem; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(11, 16, 32, .12); }
.tool-card.locked { opacity: .78; }
.tool-card.locked .lock-note { display: inline; }
.tool-card:not(.locked) .lock-note { display: none; }
.tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.tool-id { display: flex; gap: .7rem; align-items: center; min-width: 0; }
.tool-id strong { display: block; font-family: var(--font-display); font-size: 1.02rem; }
.tool-id .muted { font-size: .8rem; }
.tool-actions { display: flex; align-items: center; gap: .6rem; margin-top: auto; flex-wrap: wrap; }
.tool-actions .btn { flex: 1 1 auto; }
.lock-note { font-size: .76rem; flex-basis: 100%; }
.tool-icon { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex: none; background: #eef0f6; }
.tool-icon-fallback { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--brand)); }
.expiry-bar { height: 5px; border-radius: 999px; background: #eef0f6; overflow: hidden; }
.expiry-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--brand)); }
.expiry-bar.low i { background: linear-gradient(90deg, #f59e0b, #dc2626); }

/* ---------- guide / steps ---------- */
.steps { display: grid; gap: .9rem; padding: 0; margin: 0; list-style: none; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: .9rem; align-items: flex-start; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.step-num { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--accent)); }
.step h3 { margin: .15rem 0 .25rem; }
.step p { margin: 0; color: var(--muted); font-size: .92rem; }
.step .mock { margin-top: .7rem; }
.install-steps li { margin-bottom: .45rem; }
.faq details { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; background: var(--surface); margin-bottom: .6rem; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "\2013"; }
.faq p { margin: .6rem 0 0; color: var(--muted); font-size: .92rem; }
.mock { border-radius: 12px; border: 1px solid var(--line); background: #f8f9fc; padding: .8rem; font-size: .82rem; display: grid; gap: .45rem; }
.mock-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.mock-bar .hl { outline: 2px solid var(--bad); outline-offset: 2px; border-radius: 6px; }
.mock-btn { display: inline-block; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.mock-btn.hl { outline: 2px solid var(--bad); outline-offset: 2px; }
.dl-card { display: flex; gap: 1rem; align-items: center; }
.dl-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
.badge-row { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }

/* ---------- misc (admin) ---------- */
.perm-row { display: block; font-weight: 400; font-size: .84rem; margin-bottom: .3rem; line-height: 1.45; }
.perm-row input[type="checkbox"] { display: inline-block; width: auto; margin: 0 .4rem 0 0; vertical-align: middle; accent-color: var(--brand); }
.brand-preview { border: 1px dashed var(--line); border-radius: 12px; padding: 1rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.modal-back { position: fixed; inset: 0; background: rgba(11,16,32,.5); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-back.on { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: min(620px, 100%); max-height: 88vh; overflow: auto; padding: 1.25rem; }
.account { display: grid; grid-template-columns: 230px 1fr; gap: 1.25rem; align-items: start; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; box-shadow: var(--shadow); position: sticky; top: 4.5rem; }

/* ---------- give-access checklist (admin → Clients → Manage access) ---------- */
.access-controls {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .6rem .75rem; margin: .3rem 0 .9rem;
  background: #f8f9fc; border: 1px solid var(--line); border-radius: 12px;
}
.access-controls input, .access-controls select { padding: .38rem .5rem; font-size: .84rem; }
.tool-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .6rem; }
.tool-pick {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s;
}
.tool-pick:hover { border-color: #a5a9c4; }
.tool-pick.on { border-color: var(--brand); background: var(--brand-soft); }
.tool-pick input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }
.tp-body { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; }
.tp-icon { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; flex: none; background: #fff; }
.tp-icon-fallback { display: grid; place-items: center; background: #e6e8f0; color: var(--muted); font-weight: 700; font-size: .85rem; }
.tp-text { min-width: 0; }
.tp-text strong { display: block; font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-text small { display: block; font-size: .72rem; line-height: 1.3; }
.tp-flag { flex: none; font-size: .64rem; }

/* ---------- filter bar + inline "add account" ---------- */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; padding: .45rem .6rem; font-size: .86rem; }
.filter-search { flex: 1; min-width: 190px; }
.add-account { position: relative; }
.add-account > summary { list-style: none; cursor: pointer; display: inline-flex; }
.add-account > summary::-webkit-details-marker { display: none; }
.add-account-form { position: absolute; right: 0; top: calc(100% + .5rem); width: min(560px, 88vw); z-index: 25; }
.clean-table td, .clean-table th { vertical-align: middle; }

/* ---------- staff guide (admin → Tools → cookies) ---------- */
.guide-box { border: 1px solid #e2d9fb; background: linear-gradient(180deg, #faf8ff, #fff); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.guide-box h3 { margin-top: 0; }
.guide-box ol { padding-left: 1.2rem; margin: .4rem 0 .8rem; }
.guide-box li { margin-bottom: .35rem; font-size: .9rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .login-stage { grid-template-columns: 1fr; gap: 1.5rem; width: min(480px, 100% - 2rem); }
  .login-intro { text-align: center; }
  .login-intro .brand { justify-content: center; }
  .login-points { display: none; }
  .foot-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  :root { --head-h: 58px; }
  .nav-toggle { display: inline-flex; }
  .head-actions .who-chip, .head-actions .btn-ghost { display: none; }
  .nav .nav-logout { display: block; color: #fca5a5; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; margin: 0; padding: .6rem 1rem 1rem;
    flex-direction: column; gap: .2rem; background: var(--head-2); border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 20px 40px rgba(0,0,0,.4);
  }
  .nav-open .nav { display: flex; }
  .nav a { padding: .7rem .9rem; border-radius: 10px; font-size: 1rem; }
  .account, .split, .split-r { grid-template-columns: 1fr; }
  .side { position: static; }
  .page-hero { padding: 1.4rem 1.2rem; border-radius: 18px; }
  .prefoot-inner { padding: 1.4rem 1.2rem; }
  .card-pad { padding: 1.05rem 1.1rem; }
  h1 { font-size: 1.6rem; }
}
@media (max-width: 620px) {
  .wrap { width: min(1180px, 100% - 1.5rem); }
  main { padding-top: 1.2rem; }
  .foot-inner { grid-template-columns: 1fr; gap: 1.4rem; padding-top: 2rem; }
  .add-account { position: static; }
  .add-account-form { position: static; width: 100%; margin-top: .6rem; }
  .step { grid-template-columns: 36px 1fr; gap: .7rem; padding: .85rem .9rem; }
  .step-num { width: 36px; height: 36px; border-radius: 10px; font-size: .95rem; }
  .tool-actions .btn { flex-basis: 100%; }
  .hero-row { align-items: flex-start; }
  .stat-pill { min-width: 84px; padding: .45rem .7rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 1.4rem; }
}
