/* ══════════════════════════════════════════════════════════════════════════
   VSC GATEWAY — intranet UI · "Reo's Home" warm theme
   Chocolate-brown ink on warm cream. Orange (the pot) as the primary accent,
   leaf-green and tomato-red as secondary touches. Light & appetising throughout.
   Variable NAMES are kept (--plum / --gold …) so the whole system reskins from
   here; only the VALUES changed to the warm palette.
   ══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════════
   PRECISION LIGHT — Swiss/technical system
   Near-black graphite on warm-neutral paper. Archivo grotesk + JetBrains Mono
   metadata. Hairline rules, sharp geometry, one signal accent, corner ticks,
   serial numbers. Designed to read as bespoke, not templated.
   (Variable NAMES kept so the whole app reskins from here.)
   ══════════════════════════════════════════════════════════════════════════ */

:root{
  --plum:      #4A3222;   /* warm brown ink */
  --plum-deep: #35251A;   /* darkest brown */
  --plum-soft: #7A5A3E;   /* body copy */
  --plum-mute: #A88C66;   /* muted / captions */

  --paper:     #F6EFDB;   /* warm cream canvas */
  --paper-2:   #EFE6CC;   /* recessed cream band */
  --surface:   #FFFDF6;   /* warm-white panels */

  --gold:      #E0972B;   /* warm orange/gold accent */
  --gold-soft: #F0B657;

  --green:     #5C9E3C;
  --red:       #D23B2A;
  --ok:        #5C9E3C;
  --danger:    #C8412E;

  --line:      rgba(90,58,34,.14);   /* soft warm hairline */
  --line-soft: rgba(90,58,34,.07);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'Hanken Grotesk', system-ui, sans-serif;
  --font-mono:    'Hanken Grotesk', system-ui, sans-serif;   /* no more mono */

  --ease: cubic-bezier(.22,1,.36,1);
  --shadow-card: 0 2px 4px rgba(74,50,34,.03), 0 30px 60px -38px rgba(74,50,34,.4);
  --radius: 16px;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --maxw: 1200px;
}

*,*::before,*::after{ margin:0; padding:0; box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; }
body{
  background:var(--paper);
  color:var(--plum);
  font-family:var(--font-body);
  font-size:1rem; line-height:1.6;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
img{ display:block; max-width:100%; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }
button{ font:inherit; color:inherit; cursor:pointer; background:none; border:none; }
input{ font:inherit; }

::selection{ background:var(--plum); color:var(--paper); }
:focus-visible{ outline:2px solid var(--gold); outline-offset:3px; border-radius:4px; }


/* ══════════════════ SHARED PRIMITIVES ══════════════════ */

.label{
  display:block;
  font-size:.7rem; font-weight:600;
  text-transform:uppercase; letter-spacing:.2em;
  color:var(--gold);
}

.btn-primary{
  display:inline-flex; align-items:center; justify-content:center; gap:.7em;
  padding:.95rem 2rem;
  background:var(--plum); color:var(--paper);
  border-radius:999px;
  font-size:.8rem; font-weight:600;
  text-transform:uppercase; letter-spacing:.13em;
  transition:background .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.btn-primary svg{
  width:1.05em; height:1.05em; fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;
  transition:transform .35s var(--ease);
}
.btn-primary:hover{ background:var(--plum-deep); transform:translateY(-2px); }
.btn-primary:hover svg{ transform:translateX(4px); }
.btn-primary:active{ transform:translateY(0); }
.btn-primary--block{ width:100%; }
.btn-primary[disabled]{ opacity:.55; pointer-events:none; }


/* ══════════════════════════════════════════════════════════════════════════
   LOGIN  (page-login) — full viewport, never scrolls
   ══════════════════════════════════════════════════════════════════════════ */

.page-login{ height:100dvh; overflow:hidden; }

/* Ambient video background + warm cream veil (keeps the page bright & on-brand) */
.login-video{ position:fixed; inset:0; z-index:0; overflow:hidden; background:var(--paper); }
.login-video video{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; object-position:center;
  filter:saturate(1.06);
}
.login-video-veil{
  position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(72% 62% at 50% 42%, rgba(246,239,219,.40) 0%, rgba(246,239,219,.70) 58%, var(--paper) 100%),
    linear-gradient(to bottom, rgba(246,239,219,.52) 0%, rgba(246,239,219,.40) 45%, rgba(246,239,219,.66) 100%);
}

.login{
  position:relative;
  z-index:1;                 /* above the video stage */
  height:100dvh;
  display:grid; grid-template-rows:1fr auto;
  place-items:center;
  padding:clamp(1.25rem,4vw,3rem);
  overflow:hidden;
}

/* Soft brand atmosphere behind the card — the only ornament */
.login-aura{
  position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(60% 55% at 50% 30%, rgba(219,138,46,.14) 0%, transparent 60%),
    radial-gradient(70% 60% at 50% 110%, rgba(90,58,34,.10) 0%, transparent 62%);
}
.login-aura::after{           /* hairline frame, formal */
  content:''; position:absolute; inset:clamp(.6rem,1.6vw,1.4rem);
  border:1px solid var(--line-soft); border-radius:calc(var(--radius) + 6px);
}

.login-card{
  position:relative;
  width:min(430px,100%);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow-card);
  padding:clamp(1.8rem,4vw,2.8rem);
  animation:cardIn .7s var(--ease) both;
}
@keyframes cardIn{ from{ opacity:0; transform:translateY(14px);} to{ opacity:1; transform:none;} }

.login-head{
  display:flex; align-items:center; gap:1.1rem;
  padding-bottom:1.6rem; margin-bottom:1.8rem;
  border-bottom:1px solid var(--line);
}
.login-logo{ height:52px; width:auto; flex:none; }
.login-titles h1{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 72,'SOFT' 0,'WONK' 0;
  font-weight:500; font-size:1.5rem; letter-spacing:-.01em; line-height:1;
  color:var(--plum-deep);
}
.login-sub{
  margin-top:.35rem;
  font-size:.72rem; letter-spacing:.04em; color:var(--plum-mute);
}

.login-lead{
  margin:1.6rem 0 1.15rem; font-size:.9rem; line-height:1.5;
  color:var(--plum-mute);
}
.login-note{
  margin-top:1.15rem; font-size:.76rem; line-height:1.5;
  color:var(--plum-mute); text-align:center;
}
.login-note strong{ color:var(--plum-deep); font-weight:600; }

.login-form{ display:flex; flex-direction:column; gap:1.05rem; }

.field{ display:block; }
.field-label{
  display:block; margin-bottom:.5rem;
  font-size:.68rem; font-weight:600;
  text-transform:uppercase; letter-spacing:.14em; color:var(--plum-soft);
}
.field input{
  width:100%;
  padding:.85rem 1rem;
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:11px;
  color:var(--plum-deep);
  transition:border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.field input:focus{
  outline:none; background:var(--surface);
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(219,138,46,.14);
}
.field-wrap{ position:relative; display:block; }
.field-wrap input{ padding-right:3rem; }
.reveal{
  position:absolute; right:.5rem; top:50%; transform:translateY(-50%);
  display:grid; place-items:center; width:2.2rem; height:2.2rem;
  color:var(--plum-mute); border-radius:8px;
  transition:color .2s ease, background .2s ease;
}
.reveal:hover{ color:var(--plum); background:var(--paper-2); }
.reveal svg{ width:1.15rem; height:1.15rem; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.reveal.is-on svg{ color:var(--gold); }

.login-error{
  margin:-.2rem 0 -.1rem;
  padding:.7rem .9rem;
  background:rgba(200,65,46,.08);
  border:1px solid rgba(200,65,46,.22);
  border-radius:9px;
  font-size:.82rem; color:var(--danger);
}

.login-form .btn-primary{ margin-top:.3rem; }

/* "or" divider + Google button */
.login-or{
  display:flex; align-items:center; gap:.9rem;
  margin:1.2rem 0; color:var(--plum-mute);
  font-size:.66rem; text-transform:uppercase; letter-spacing:.18em;
}
.login-or::before, .login-or::after{ content:''; flex:1; height:1px; background:var(--line); }

.btn-google{
  display:flex; align-items:center; justify-content:center; gap:.7em;
  width:100%; padding:.85rem 1rem;
  background:var(--surface);
  border:1px solid var(--line); border-radius:11px;
  font-size:.86rem; font-weight:600; color:var(--plum-deep);
  transition:border-color .25s ease, background .25s ease, box-shadow .25s ease, transform .25s ease;
}
.btn-google svg{ width:1.2rem; height:1.2rem; flex:none; }
.btn-google:hover{ border-color:var(--plum-mute); box-shadow:0 6px 18px -10px rgba(74,46,28,.4); transform:translateY(-1px); }
.btn-google:active{ transform:translateY(0); }

.demo-hint{
  margin-top:1.6rem; padding-top:1.3rem;
  border-top:1px dashed var(--line);
}
.demo-hint-title{
  display:block; margin-bottom:.6rem;
  font-size:.62rem; font-weight:600; text-transform:uppercase;
  letter-spacing:.18em; color:var(--plum-mute);
}
#demo-list{ display:grid; gap:.35rem; }
.demo-row{
  display:flex; align-items:center; gap:.5rem;
  font-size:.78rem; color:var(--plum-soft);
}
.demo-row button{
  font-size:.72rem; letter-spacing:.02em;
  color:var(--plum); text-align:left;
  border-bottom:1px solid transparent;
  transition:border-color .2s ease, color .2s ease;
}
.demo-row button:hover{ color:var(--gold); border-color:var(--gold); }
.demo-row code{
  font-family:var(--font-body); color:var(--plum-mute);
}
.demo-row .demo-role{ margin-left:auto; }

.login-foot{
  width:min(430px,100%);
  display:flex; justify-content:space-between; gap:1rem;
  padding-top:1.4rem;
  font-size:.66rem; letter-spacing:.08em; color:var(--plum-mute);
}


/* ══════════════════════════════════════════════════════════════════════════
   GATEWAY  (page-gateway)
   ══════════════════════════════════════════════════════════════════════════ */

.page-gateway{ background:var(--paper); min-height:100dvh; }
/* Guard: content stays hidden until app.js validates the session */
.page-gateway.is-guarding{ visibility:hidden; }

.gw-header{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:1rem var(--gutter);
  background:rgba(246,239,219,.9);
  backdrop-filter:saturate(1.1) blur(8px);
  border-bottom:1px solid var(--line-soft);
}
.gw-brand{ display:flex; align-items:center; gap:.85rem; }
.gw-logo{ height:34px; width:auto; }
.gw-brand-name{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 48,'SOFT' 0,'WONK' 0;
  font-weight:500; font-size:1.12rem; letter-spacing:-.01em;
  color:var(--plum-deep);
  padding-left:.85rem; border-left:1px solid var(--line);
}

.gw-user{ display:flex; align-items:center; gap:1.1rem; }
.gw-user-meta{ display:flex; flex-direction:column; align-items:flex-end; line-height:1.25; }
.gw-user-name{ font-size:.86rem; font-weight:600; color:var(--plum-deep); }
.gw-user-role{
  font-size:.6rem; font-weight:600; text-transform:uppercase; letter-spacing:.14em;
  padding:.12rem .5rem; border-radius:999px; margin-top:.2rem;
  color:var(--plum); background:var(--paper-2); border:1px solid var(--line);
}
.gw-user-role[data-role="admin"]  { color:#8A5518; background:rgba(219,138,46,.16); border-color:rgba(219,138,46,.4); }
.gw-user-role[data-role="manager"]{ color:#3F7A2E; background:rgba(92,158,60,.12); border-color:rgba(92,158,60,.3); }
.gw-user-role[data-role="staff"]  { color:#7A5A3E; background:rgba(90,58,34,.12); border-color:rgba(90,58,34,.3); }

.gw-logout{
  display:inline-flex; align-items:center; gap:.5em;
  padding:.55rem 1rem;
  border:1px solid var(--line); border-radius:999px;
  font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em;
  color:var(--plum-soft);
  transition:color .3s ease, border-color .3s ease, background .3s ease;
}
.gw-logout svg{ width:1.05em; height:1.05em; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.gw-logout:hover{ color:var(--plum-deep); border-color:var(--plum); background:var(--surface); }

.gw-main{ max-width:var(--maxw); margin:0 auto; padding:clamp(2.5rem,6vw,5rem) var(--gutter) 4rem; }

.gw-hello{ margin-bottom:3rem; }
.gw-hello .label{ margin-bottom:1rem; }
.gw-greeting{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 144,'SOFT' 0,'WONK' 0;
  font-weight:400;
  font-size:clamp(2rem,1.4rem + 2.6vw,3.4rem);
  line-height:1.05; letter-spacing:-.025em; color:var(--plum-deep);
  margin-bottom:.9rem;
}
.gw-lede{ color:var(--plum-soft); font-size:1.05rem; }
.gw-count{ color:var(--plum-mute); }

/* App tiles */
.gw-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(268px,1fr));
  gap:1.1rem;
}
.gw-tile{
  position:relative;
  display:flex; flex-direction:column; gap:1.4rem;
  padding:1.6rem 1.6rem 1.5rem;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  transition:transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
  opacity:0; transform:translateY(16px);
}
.gw-tile.is-in{ opacity:1; transform:none; }
.gw-tile:hover{
  transform:translateY(-4px);
  border-color:transparent;
  box-shadow:0 24px 50px -28px rgba(74,46,28,.5);
}
.gw-tile:hover .gw-tile-go{ color:var(--gold); transform:translateX(3px); }
.gw-tile.is-featured{ border-color:rgba(219,138,46,.4); }
.gw-tile.is-featured::after{
  content:'Primary'; position:absolute; top:1.15rem; right:1.15rem;
  font-size:.56rem; font-weight:600; text-transform:uppercase; letter-spacing:.14em;
  color:var(--gold); padding:.2rem .5rem;
  background:rgba(219,138,46,.14); border-radius:999px;
}

.gw-tile-icon{
  width:48px; height:48px; flex:none;
  display:grid; place-items:center;
  background:var(--paper-2); border-radius:12px;
  color:var(--plum);
}
.gw-tile-icon svg{ width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }

.gw-tile-body{ display:flex; flex-direction:column; gap:.35rem; }
.gw-tile-name{
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  font-family:var(--font-display);
  font-variation-settings:'opsz' 48,'SOFT' 0,'WONK' 0;
  font-weight:500; font-size:1.18rem; letter-spacing:-.01em; color:var(--plum-deep);
}
.gw-tile-go{ flex:none; width:1.15rem; height:1.15rem; color:var(--plum-mute); transition:color .3s var(--ease), transform .3s var(--ease); }
.gw-tile-go svg{ width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.gw-tile-desc{ font-size:.88rem; color:var(--plum-soft); }

/* Empty state */
.gw-empty{
  padding:3rem; text-align:center;
  border:1px dashed var(--line); border-radius:var(--radius);
  color:var(--plum-mute); font-size:.95rem;
}


/* ══════════════════ ADMIN — access control matrix ══════════════════ */

.gw-admin{
  margin-top:4.5rem; padding-top:3rem;
  border-top:1px solid var(--line);
}
.gw-admin-head{ margin-bottom:2rem; }
.gw-admin-head .label{ margin-bottom:.9rem; }
.gw-admin-title{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 96,'SOFT' 0,'WONK' 0;
  font-weight:400; font-size:clamp(1.6rem,1.2rem + 1.6vw,2.4rem);
  letter-spacing:-.02em; color:var(--plum-deep); margin-bottom:.7rem;
}
.gw-admin-note{ font-size:.9rem; color:var(--plum-soft); display:flex; flex-wrap:wrap; align-items:center; gap:.4rem 1rem; }
.gw-reset{
  font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em;
  color:var(--plum); border-bottom:1px solid var(--gold); padding-bottom:1px;
  transition:color .2s ease;
}
.gw-reset:hover{ color:var(--gold); }

.gw-matrix-scroll{ overflow-x:auto; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.gw-matrix{ width:100%; border-collapse:collapse; min-width:520px; }
.gw-matrix th, .gw-matrix td{ padding:.9rem 1.1rem; text-align:left; border-bottom:1px solid var(--line-soft); }
.gw-matrix thead th{
  font-size:.66rem; font-weight:600; text-transform:uppercase; letter-spacing:.13em;
  color:var(--plum-mute); background:var(--paper-2);
}
.gw-matrix thead th.col-role{ text-align:center; width:120px; }
.gw-matrix tbody tr:last-child td{ border-bottom:0; }
.gw-matrix .cell-link{ display:flex; flex-direction:column; }
.gw-matrix .cell-link b{ font-weight:600; color:var(--plum-deep); }
.gw-matrix .cell-link span{ font-size:.78rem; color:var(--plum-mute); }
.gw-matrix td.col-role{ text-align:center; }

/* Toggle */
.perm-toggle{ position:relative; display:inline-block; width:42px; height:24px; }
.perm-toggle input{ position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.perm-track{
  position:absolute; inset:0; border-radius:999px;
  background:var(--paper-2); border:1px solid var(--line);
  transition:background .25s ease, border-color .25s ease;
}
.perm-track::after{
  content:''; position:absolute; top:2px; left:2px;
  width:18px; height:18px; border-radius:50%;
  background:var(--surface); box-shadow:0 1px 3px rgba(74,46,28,.35);
  transition:transform .25s var(--ease);
}
.perm-toggle input:checked + .perm-track{ background:var(--gold); border-color:var(--gold); }
.perm-toggle input:checked + .perm-track::after{ transform:translateX(18px); }
.perm-toggle input:disabled + .perm-track{ opacity:.5; }        /* admin row locked on */
.perm-toggle input:focus-visible + .perm-track{ outline:2px solid var(--gold); outline-offset:2px; }


/* ══════════════════ FOOTER ══════════════════ */

.gw-foot{
  border-top:1px solid var(--line);
  max-width:var(--maxw); margin:0 auto;
  padding:2.4rem var(--gutter);
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:1rem;
  font-size:.7rem; letter-spacing:.08em; text-transform:uppercase; color:var(--plum-mute);
}


/* ══════════════════ TOAST (redirect / logout notices) ══════════════════ */

.vsc-toast{
  position:fixed; left:50%; bottom:2rem; transform:translateX(-50%) translateY(1rem);
  z-index:60; opacity:0; pointer-events:none;
  padding:.8rem 1.3rem;
  background:var(--plum-deep); color:var(--paper);
  border-radius:999px; font-size:.82rem; letter-spacing:.02em;
  box-shadow:0 20px 40px -18px rgba(74,46,28,.7);
  transition:opacity .4s var(--ease), transform .4s var(--ease);
}
.vsc-toast.is-on{ opacity:1; transform:translateX(-50%) translateY(0); }


/* ══════════════════ RESPONSIVE ══════════════════ */

@media (max-width:640px){
  .gw-brand-name{ display:none; }
  .gw-user-name{ display:none; }
  .gw-logout span{ display:none; }
  .gw-logout{ padding:.55rem; }
  .gw-grid{ grid-template-columns:1fr; }
  .login-foot{ flex-direction:column; gap:.3rem; text-align:center; align-items:center; }
  .login-head{ flex-direction:column; text-align:center; gap:.9rem; }
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
  .gw-tile{ opacity:1; transform:none; }
}


/* ══════════════════════════════════════════════════════════════════════════
   GATEWAY — category / sub-category grouping
   ══════════════════════════════════════════════════════════════════════════ */

/* Collapsible main categories — headers first, contents on click */
.gw-cat{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); margin-bottom:1rem; overflow:hidden;
  transition:border-color .3s ease, box-shadow .3s ease;
}
.gw-cat.is-open{ box-shadow:0 22px 54px -36px rgba(74,46,28,.55); }

.gw-cat-toggle{
  width:100%; display:flex; align-items:center; gap:1rem;
  padding:1.25rem 1.5rem; text-align:left; cursor:pointer;
  transition:background .25s ease;
}
.gw-cat-toggle:hover{ background:var(--paper-2); }

.gw-cat-icon{
  width:44px; height:44px; flex:none; display:grid; place-items:center;
  border:1px solid var(--line); border-radius:11px; color:var(--gold);
}
.gw-cat-icon svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }

.gw-cat-heading{ display:flex; flex-direction:column; gap:.2rem; flex:1; min-width:0; }
.gw-cat-name{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 72,'SOFT' 0,'WONK' 0;
  font-weight:500; font-size:clamp(1.25rem,1.1rem + .6vw,1.6rem);
  letter-spacing:-.015em; color:var(--plum-deep);
}
.gw-cat-meta{ font-size:.72rem; text-transform:uppercase; letter-spacing:.13em; color:var(--plum-mute); }

.gw-cat-chev{ flex:none; width:1.4rem; height:1.4rem; color:var(--plum-mute); transition:transform .35s var(--ease), color .25s ease; }
.gw-cat-chev svg{ width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.gw-cat.is-open .gw-cat-chev{ transform:rotate(180deg); color:var(--gold); }

/* animated expand via grid-rows 0fr → 1fr. The grid ITEM must have no padding
   (padding would keep the collapsed row ~25px tall and leak content), so the
   padding lives on an inner .gw-cat-pad wrapper. */
.gw-cat-body{ display:grid; grid-template-rows:0fr; transition:grid-template-rows .42s var(--ease); }
.gw-cat.is-open .gw-cat-body{ grid-template-rows:1fr; }
.gw-cat-inner{ overflow:hidden; min-height:0; }
.gw-cat-pad{ padding:0 1.5rem 1.6rem; }

.gw-sub{ margin-top:1.5rem; }
.gw-sub:first-child{ margin-top:.4rem; }
.gw-sub-name{
  font-size:.7rem; font-weight:600; text-transform:uppercase; letter-spacing:.16em;
  color:var(--plum-mute); margin-bottom:1rem;
  padding-bottom:.5rem; border-bottom:1px solid var(--line-soft);
}

/* Header admin-console link + crumb */
.gw-admin-link{
  display:inline-flex; align-items:center; gap:.5em;
  padding:.5rem 1rem; margin-right:.3rem;
  border:1px solid var(--gold); border-radius:999px;
  font-size:.7rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em;
  color:var(--gold-soft); background:rgba(219,138,46,.06);
  transition:background .3s ease, color .3s ease;
}
.gw-admin-link svg{ width:1.05em; height:1.05em; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.gw-admin-link:hover{ background:var(--gold); color:#fff; }
.gw-crumb{
  padding-left:.85rem; margin-left:.1rem; border-left:1px solid var(--line);
  font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; color:var(--plum-mute);
}


/* ══════════════════════════════════════════════════════════════════════════
   ADMIN CONSOLE  (page-admin)
   ══════════════════════════════════════════════════════════════════════════ */

.page-admin{ background:var(--paper); min-height:100dvh; }
.page-admin.is-guarding{ visibility:hidden; }

.ac-main{ max-width:1120px; margin:0 auto; padding:clamp(2rem,5vw,3.5rem) var(--gutter) 4rem; }

.ac-intro{ margin-bottom:2.2rem; }
.ac-intro .label{ margin-bottom:.9rem; }
.ac-title{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 144,'SOFT' 0,'WONK' 0;
  font-weight:400; font-size:clamp(2rem,1.5rem + 2vw,3rem);
  letter-spacing:-.025em; color:var(--plum-deep); margin-bottom:.7rem;
}
.ac-note{ font-size:.9rem; color:var(--plum-soft); max-width:60ch; }

/* tabs */
.ac-tabs{
  display:flex; align-items:center; gap:.4rem; flex-wrap:wrap;
  border-bottom:1px solid var(--line); margin-bottom:2.4rem;
}
.ac-tab{
  padding:.85rem 1.3rem; margin-bottom:-1px;
  font-size:.78rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em;
  color:var(--plum-mute); border-bottom:2px solid transparent;
  transition:color .3s ease, border-color .3s ease;
}
.ac-tab:hover{ color:var(--plum); }
.ac-tab.is-active{ color:var(--plum-deep); border-bottom-color:var(--gold); }
.ac-reset-all{
  margin-left:auto; font-size:.72rem; letter-spacing:.05em; color:var(--plum-mute);
  border-bottom:1px solid transparent; transition:color .2s ease, border-color .2s ease;
}
.ac-reset-all:hover{ color:var(--danger); border-color:var(--danger); }

.ac-panel{ display:none; }
.ac-panel.is-active{ display:block; animation:fadeUp .4s var(--ease) both; }
@keyframes fadeUp{ from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:none;} }

.ac-panel-head{
  display:flex; align-items:flex-end; justify-content:space-between; gap:1rem; flex-wrap:wrap;
  margin-bottom:1.8rem;
}
.ac-h2{
  font-family:var(--font-display);
  font-variation-settings:'opsz' 72,'SOFT' 0,'WONK' 0;
  font-weight:500; font-size:1.5rem; letter-spacing:-.01em; color:var(--plum-deep); margin-bottom:.3rem;
}
.ac-sub{ font-size:.88rem; color:var(--plum-soft); max-width:56ch; }

.btn-sm{ padding:.7rem 1.3rem; font-size:.72rem; }

/* ── content tree ── */
.ac-tree{ display:flex; flex-direction:column; gap:1.3rem; }
.ac-cat{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:1.3rem 1.3rem 1rem;
}
.ac-cat-head{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding-bottom:1rem; border-bottom:1px solid var(--line-soft); }
.ac-cat-title{ display:flex; align-items:center; gap:.75rem; min-width:0; }
.ac-cat-title b{ font-size:1.12rem; color:var(--plum-deep); font-weight:600; }
.ac-cat-icon{ width:34px; height:34px; flex:none; display:grid; place-items:center; background:var(--paper-2); border-radius:9px; color:var(--plum); }
.ac-cat-icon svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.ac-cat-icon.sm{ width:26px; height:26px; border-radius:7px; }
.ac-cat-icon.sm svg{ width:15px; height:15px; }

.ac-pill{ font-size:.62rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em; color:var(--gold); background:rgba(219,138,46,.13); padding:.18rem .55rem; border-radius:999px; white-space:nowrap; }
.ac-pill-soft{ color:var(--plum-mute); background:var(--paper-2); }

.ac-tools{ display:flex; align-items:center; gap:.3rem; flex:none; }
.ac-icon-btn{
  width:32px; height:32px; display:grid; place-items:center; border-radius:8px;
  color:var(--plum-soft); border:1px solid transparent;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.ac-icon-btn svg{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.ac-icon-btn:hover{ background:var(--paper-2); color:var(--plum-deep); }
.ac-icon-btn.is-danger:hover{ background:rgba(200,65,46,.1); color:var(--danger); }
.ac-icon-btn:disabled{ opacity:.3; pointer-events:none; }

/* admin sub blocks */
.ac-sub{ margin-top:1rem; padding-left:.4rem; border-left:2px solid var(--line-soft); }
.ac-sub-head{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.5rem .4rem .5rem .8rem; }
.ac-sub-title{ display:flex; align-items:center; gap:.6rem; }
.ac-sub-title b{ font-size:.95rem; color:var(--plum); font-weight:600; }

.ac-link{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.55rem .4rem .55rem .8rem; margin-left:.3rem; border-top:1px solid var(--line-soft); }
.ac-link-info{ display:flex; align-items:center; gap:.7rem; min-width:0; }
.ac-link-icon{ width:30px; height:30px; flex:none; display:grid; place-items:center; background:var(--paper-2); border-radius:8px; color:var(--plum-soft); }
.ac-link-icon svg{ width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.ac-link-meta{ display:flex; flex-direction:column; min-width:0; }
.ac-link-meta b{ font-size:.9rem; color:var(--plum-deep); font-weight:600; }
.ac-link-url{ font-size:.74rem; color:var(--plum-mute); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:46ch; }

.ac-add-inline, .ac-add-sub{
  display:inline-flex; align-items:center; gap:.4em;
  font-size:.74rem; font-weight:600; letter-spacing:.02em; color:var(--plum-soft);
  padding:.5rem .3rem; margin:.3rem 0 .3rem .8rem;
  transition:color .2s ease;
}
.ac-add-sub{ margin-top:.8rem; color:var(--gold-soft); }
.ac-add-inline svg, .ac-add-sub svg{ width:1.05em; height:1.05em; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ac-add-inline:hover, .ac-add-sub:hover{ color:var(--plum-deep); }

/* ── users table ── */
.ac-table-wrap{ overflow-x:auto; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.ac-table{ width:100%; border-collapse:collapse; min-width:560px; }
.ac-table th, .ac-table td{ padding:.9rem 1.1rem; text-align:left; border-bottom:1px solid var(--line-soft); }
.ac-table thead th{ font-size:.64rem; font-weight:600; text-transform:uppercase; letter-spacing:.13em; color:var(--plum-mute); background:var(--paper-2); }
.ac-table tbody tr:last-child td{ border-bottom:0; }
.ac-cell-strong{ font-weight:600; color:var(--plum-deep); }
.ac-cell-mute{ color:var(--plum-mute); }
.ac-cell-tools{ text-align:right; white-space:nowrap; }
.ac-cell-tools .ac-icon-btn{ display:inline-grid; }

/* ── access ── */
.ac-access{ display:grid; grid-template-columns:250px 1fr; gap:1.4rem; align-items:start; }
.ac-userlist{ display:flex; flex-direction:column; gap:.4rem; position:sticky; top:90px; }
.ac-userpick{
  display:flex; flex-direction:column; align-items:flex-start; gap:.35rem;
  padding:.8rem 1rem; text-align:left;
  border:1px solid var(--line); border-radius:12px; background:var(--surface);
  transition:border-color .25s ease, background .25s ease;
}
.ac-userpick:hover{ border-color:var(--plum-mute); }
.ac-userpick.is-active{ border-color:var(--gold); background:rgba(219,138,46,.06); }
.ac-userpick-name{ font-size:.9rem; font-weight:600; color:var(--plum-deep); }

.ac-accesstree{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:1.4rem 1.5rem; }
.ac-access-head{ display:flex; align-items:baseline; gap:.6rem; padding-bottom:1.1rem; margin-bottom:1.1rem; border-bottom:1px solid var(--line); }
.ac-access-head b{ font-size:1.1rem; color:var(--plum-deep); }
.ac-admin-note{ padding:1.2rem; background:var(--paper-2); border-radius:12px; font-size:.9rem; color:var(--plum-soft); }

.ac-acc-cat{ margin-bottom:1.2rem; padding-bottom:1.1rem; border-bottom:1px solid var(--line-soft); }
.ac-acc-cat:last-child{ margin-bottom:0; padding-bottom:0; border-bottom:0; }
.ac-acc-row{ display:flex; align-items:center; gap:.8rem; padding:.5rem 0; cursor:pointer; }
.ac-acc-name{ display:flex; align-items:center; gap:.55rem; }
.ac-acc-catrow .ac-acc-name b{ font-size:1rem; color:var(--plum-deep); }
.ac-acc-subrow{ padding-left:2.4rem; }
.ac-acc-subrow .ac-acc-name span:first-child{ font-size:.9rem; color:var(--plum-soft); }

/* ══════════════════ MODAL ══════════════════ */
.ac-modal{ position:fixed; inset:0; z-index:80; display:grid; place-items:center; padding:1.2rem; }
.ac-modal[hidden]{ display:none; }
.ac-modal-scrim{ position:absolute; inset:0; background:rgba(74,46,28,.42); backdrop-filter:blur(2px); animation:fadein .25s ease; }
@keyframes fadein{ from{ opacity:0; } to{ opacity:1; } }
.ac-modal-card{
  position:relative; width:min(460px,100%); max-height:90dvh; overflow-y:auto;
  background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow-card);
  padding:1.6rem 1.7rem 1.7rem; animation:cardIn .35s var(--ease) both;
}
.ac-modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:1.3rem; }
.ac-modal-head h3{ font-family:var(--font-display); font-variation-settings:'opsz' 60,'SOFT' 0,'WONK' 0; font-weight:500; font-size:1.3rem; color:var(--plum-deep); }
.ac-modal-x{ width:34px; height:34px; display:grid; place-items:center; border-radius:8px; color:var(--plum-mute); transition:background .2s ease, color .2s ease; }
.ac-modal-x svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; }
.ac-modal-x:hover{ background:var(--paper-2); color:var(--plum-deep); }

.ac-form{ display:flex; flex-direction:column; gap:1rem; }
.ac-field{ display:flex; flex-direction:column; gap:.45rem; }
.ac-field .field-label{ font-size:.68rem; font-weight:600; text-transform:uppercase; letter-spacing:.13em; color:var(--plum-soft); }
.ac-field input, .ac-field select, .ac-field textarea{
  width:100%; padding:.75rem .9rem; background:var(--paper);
  border:1px solid var(--line); border-radius:10px; color:var(--plum-deep);
  transition:border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.ac-field textarea{ resize:vertical; min-height:70px; font-family:inherit; }
.ac-field input:focus, .ac-field select:focus, .ac-field textarea:focus{
  outline:none; background:var(--surface); border-color:var(--gold); box-shadow:0 0 0 3px rgba(219,138,46,.14);
}
.ac-help{ font-size:.74rem; color:var(--plum-mute); }
.ac-form-error{ font-size:.82rem; color:var(--danger); background:rgba(200,65,46,.08); border:1px solid rgba(200,65,46,.2); border-radius:8px; padding:.55rem .8rem; }
.ac-form-actions{ display:flex; justify-content:flex-end; gap:.7rem; margin-top:.5rem; }
.btn-ghost-sm{ padding:.7rem 1.2rem; font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.1em; color:var(--plum-soft); border:1px solid var(--line); border-radius:999px; transition:border-color .2s ease, color .2s ease; }
.btn-ghost-sm:hover{ color:var(--plum-deep); border-color:var(--plum); }

/* icon picker */
.ac-icongrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(46px,1fr)); gap:.5rem; }
.ac-iconpick{ aspect-ratio:1; display:grid; place-items:center; border:1px solid var(--line); border-radius:10px; color:var(--plum-soft); background:var(--paper); transition:border-color .2s ease, color .2s ease, background .2s ease; }
.ac-iconpick svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.ac-iconpick:hover{ color:var(--plum-deep); border-color:var(--plum-mute); }
.ac-iconpick.is-sel{ color:var(--gold); border-color:var(--gold); background:rgba(219,138,46,.1); }

@media (max-width:760px){
  .ac-access{ grid-template-columns:1fr; }
  .ac-userlist{ position:static; flex-direction:row; flex-wrap:wrap; }
  .ac-userpick{ flex:1 1 140px; }
  .gw-crumb{ display:none; }
  .gw-admin-link span{ display:none; }
  .gw-admin-link{ padding:.5rem; }
}
