/* ─────────────────────────────────────────────────────────────────────
 * WRSTBND Reporting Portal — design system
 * Palette + gradient pulled from www.wrstbnd.com brand guidelines.
 * ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand palette */
  --navy:       #002549;
  --navy-90:    #002549e6;
  --navy-12:    #0025491f;
  --navy-06:    #00254910;
  --plum:       #5b39b8;
  --plum-12:    #5b39b81f;
  --pink:       #d7339a;
  --pink-12:    #d7339a1f;
  --yellow:     #ffa91e;
  --orange:     #ea5555;
  --ice:        #c2f8e2;
  --ice-50:     #c2f8e280;
  --lime:       #d7f59b;
  --lemon:      #ffe644;
  --purple:     #a333d7;
  --cream:      #fcfafa;
  --gray-50:    #f7f8fa;
  --gray-100:   #ededed;
  --gray-200:   #e1e4ea;
  --gray-400:   #98a1ad;
  --gray-600:   #5a6573;
  --gray-800:   #2b3340;
  --ink:        #16202e;
  --white:      #ffffff;

  /* Brand gradients */
  --grad-cta:    linear-gradient(130deg, var(--pink), var(--yellow));
  --grad-cta-hover: linear-gradient(130deg, var(--yellow), var(--pink));
  --grad-glow:   radial-gradient(800px 400px at 20% 0%, rgba(215, 51, 154, 0.12), transparent 60%),
                 radial-gradient(900px 500px at 100% 100%, rgba(255, 169, 30, 0.10), transparent 70%);
  --grad-navy:   radial-gradient(800px 400px at 0% 0%, rgba(91, 57, 184, 0.45), transparent 70%),
                 radial-gradient(900px 500px at 100% 100%, rgba(215, 51, 154, 0.30), transparent 70%),
                 var(--navy);

  /* Type badge tints (background → text) */
  --t-credentialing-bg: #c2f8e2;  --t-credentialing-fg: #00382b;
  --t-fulfillment-bg:   #fff1d6;  --t-fulfillment-fg:   #5a3500;
  --t-sales-bg:         #ffd7d7;  --t-sales-fg:         #5a0d0d;
  --t-parking-bg:       #e2d8ff;  --t-parking-fg:       #1a0066;
  --t-zone-bg:          #ffd6ee;  --t-zone-fg:          #5a0044;
  --t-packaging-bg:     #fff5b8;  --t-packaging-fg:     #4a3a00;
  --t-summary-bg:       #cfe8ff;  --t-summary-fg:       #002a55;
  --t-analytics-bg:     #d7f59b;  --t-analytics-fg:     #1f3500;
  --t-other-bg:         #ededed;  --t-other-fg:         #2b3340;

  /* Tag palette (chip backgrounds) */
  --tag-plum:   #5b39b8;  --tag-plum-bg:   #5b39b81f;
  --tag-pink:   #d7339a;  --tag-pink-bg:   #d7339a1f;
  --tag-yellow: #b87800;  --tag-yellow-bg: #ffa91e26;
  --tag-orange: #b03b3b;  --tag-orange-bg: #ea55551f;
  --tag-ice:    #00382b;  --tag-ice-bg:    #c2f8e2cc;
  --tag-lime:   #345200;  --tag-lime-bg:   #d7f59bcc;
  --tag-lemon:  #4a3a00;  --tag-lemon-bg:  #ffe644a8;
  --tag-navy:   #ffffff;  --tag-navy-bg:   #002549;
  --tag-gray:   #2b3340;  --tag-gray-bg:   #e1e4ea;

  /* Shape */
  --r-xs: 0.375rem;
  --r-sm: 0.625rem;
  --r-md: 0.875rem;
  --r-lg: 1.25rem;
  --r-xl: 1.75rem;
  --r-pill: 100vw;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(0, 37, 73, 0.06), 0 1px 3px rgba(0, 37, 73, 0.04);
  --sh-2: 0 4px 14px rgba(0, 37, 73, 0.08), 0 2px 4px rgba(0, 37, 73, 0.04);
  --sh-3: 0 18px 36px rgba(0, 37, 73, 0.14), 0 6px 12px rgba(0, 37, 73, 0.06);
  --sh-4: 0 30px 60px rgba(0, 37, 73, 0.22), 0 12px 24px rgba(0, 37, 73, 0.10);
  --ring: 0 0 0 3px rgba(215, 51, 154, 0.25);

  /* Type scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.25rem;

  /* Layout */
  --sidebar-w: 264px;
  --topbar-h: 64px;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─────────────────────────────────────────────────────────────── reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--gray-50);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: var(--plum); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--pink); }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--navy);
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 700;
  line-height: 1.15;
}
h1 { font-size: var(--fs-3xl); letter-spacing: -0.035em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0; }

/* ──────────────────────────────────────────────────────── focus styles */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
button:focus-visible, a:focus-visible { box-shadow: var(--ring); }

/* ───────────────────────────────────────────────────── app shell layout */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app[data-collapsed="true"] { --sidebar-w: 72px; }

/* ─────────────────────────────────────────────────────────── sidebar */
.sidebar {
  background: var(--navy);
  background-image: var(--grad-navy);
  color: var(--white);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--topbar-h);
}
.sidebar__brand img { height: 20px; width: auto; }
.sidebar__brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
}
.sidebar__brand-text span {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
}

.sidebar__nav { padding: 1rem 0.625rem; flex: 1; overflow-y: auto; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 6px; }

.sidebar__section {
  padding: 0.5rem 0.75rem 0.375rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  font-size: var(--fs-md);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  position: relative;
}
.nav-link svg { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; opacity: 0.9; }
.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--white);
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -0.625rem;
  top: 0.375rem; bottom: 0.375rem;
  width: 3px;
  background: var(--grad-cta);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
}
.nav-link__count {
  margin-left: auto;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  padding: 0.1rem 0.5rem;
  border-radius: var(--r-pill);
  font-weight: 600;
}

.sidebar__client {
  font-size: 0.85rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.65);
  display: flex; align-items: center; gap: 0.5rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar__client::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.sidebar__client:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}
.sidebar__client:hover::before { background: var(--pink); }

.sidebar__footer {
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; gap: 0.625rem;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-cta);
  color: var(--white);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.sidebar__userinfo { flex: 1; min-width: 0; }
.sidebar__userinfo .name {
  font-size: 0.82rem; font-weight: 600; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar__userinfo .role {
  font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.icon-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.65);
  transition: all 0.15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.icon-btn svg { width: 16px; height: 16px; }

/* ────────────────────────────────────────────────────────── main area */
.main {
  min-width: 0; /* prevent overflow */
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 20;
}
.topbar__search {
  flex: 1;
  max-width: 540px;
  display: flex;
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-pill);
  padding: 0.4rem 0.875rem 0.4rem 0.75rem;
  gap: 0.5rem;
  transition: all 0.15s ease;
}
.topbar__search:focus-within {
  border-color: var(--pink);
  background: var(--white);
  box-shadow: var(--ring);
}
.topbar__search svg { width: 16px; height: 16px; color: var(--gray-600); flex-shrink: 0; }
.topbar__search input {
  border: 0; background: transparent; outline: none; flex: 1;
  font-size: var(--fs-md);
  min-width: 0;
}
.topbar__search kbd {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 0.1rem 0.45rem;
  border-radius: var(--r-xs);
  border: 1px solid var(--gray-200);
}
.topbar__actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }

.page {
  flex: 1;
  padding: 2rem 2.25rem 3rem;
  max-width: 1400px;
  width: 100%;
}
.page.wide { max-width: none; padding: 0; }

/* ─────────────────────────────────────────────────── page header */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-header__title h1 { margin: 0; }
.page-header__title p {
  color: var(--gray-600);
  font-size: var(--fs-md);
  margin-top: 0.35rem;
}
.page-header__actions { display: flex; gap: 0.5rem; align-items: center; }

.crumbs {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  color: var(--gray-600); font-size: var(--fs-sm);
  margin-bottom: 0.75rem;
}
.crumbs a { color: var(--plum); }
.crumbs .sep { opacity: 0.35; }

/* ─────────────────────────────────────────────────── stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.25rem 1rem;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.stat:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-cta);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.stat:hover::before { opacity: 1; }
.stat .label {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-600);
  font-weight: 600;
}
.stat .value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 0.4rem;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat .delta { font-size: var(--fs-sm); color: var(--gray-600); margin-top: 0.35rem; }
.stat .icon {
  position: absolute; top: 1rem; right: 1rem;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--gray-50);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.stat .icon svg { width: 16px; height: 16px; }

/* ─────────────────────────────────────────────── section + grid */
.section { margin-bottom: 2.5rem; }
.section__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.section__head h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
.section__head .link { font-size: var(--fs-sm); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }

/* ─────────────────────────────────────────────────── card */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.625rem;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
  min-height: 138px;
}
.card:hover {
  border-color: var(--navy-12);
  box-shadow: var(--sh-3);
  transform: translateY(-2px);
  text-decoration: none;
}
.card:hover .card__title { color: var(--plum); }
.card__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: var(--fs-xs); letter-spacing: 0.04em;
  color: var(--gray-600);
  text-transform: uppercase; font-weight: 600;
}
.card__title {
  font-family: var(--font-display);
  font-weight: 700; font-size: var(--fs-lg);
  color: var(--navy); letter-spacing: -0.02em; line-height: 1.25;
  transition: color 0.15s ease;
}
.card__desc { color: var(--gray-600); font-size: var(--fs-sm); }
.card__footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--gray-600);
}
.card__icon {
  position: absolute; top: 1.25rem; right: 1.25rem;
  color: var(--gray-400);
  transition: all 0.15s ease;
}
.card:hover .card__icon { color: var(--pink); transform: translate(2px, -2px); }
.card__icon svg { width: 18px; height: 18px; }

.card.is-client { padding-top: 1.5rem; }
.card.is-event::after,
.card.is-client::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--grad-cta);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.card:hover.is-event::after,
.card:hover.is-client::after { opacity: 1; }

/* ─────────────────────────────────────────────── badges & chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.4;
  text-transform: none;
}
.chip svg { width: 12px; height: 12px; }
.chip--year { background: var(--lemon); color: var(--ink); }
.chip--draft { background: var(--orange); color: var(--white); }
.chip--admin { background: var(--navy); color: var(--white); }
.chip--client { background: var(--ice); color: var(--ink); }

/* report type tints */
.chip--type[data-t="credentialing"] { background: var(--t-credentialing-bg); color: var(--t-credentialing-fg); }
.chip--type[data-t="fulfillment"]   { background: var(--t-fulfillment-bg);   color: var(--t-fulfillment-fg); }
.chip--type[data-t="sales"]         { background: var(--t-sales-bg);         color: var(--t-sales-fg); }
.chip--type[data-t="parking"]       { background: var(--t-parking-bg);       color: var(--t-parking-fg); }
.chip--type[data-t="zone"]          { background: var(--t-zone-bg);          color: var(--t-zone-fg); }
.chip--type[data-t="packaging_yoy"] { background: var(--t-packaging-bg);     color: var(--t-packaging-fg); }
.chip--type[data-t="summary"]       { background: var(--t-summary-bg);       color: var(--t-summary-fg); }
.chip--type[data-t="analytics"]     { background: var(--t-analytics-bg);     color: var(--t-analytics-fg); }
.chip--type[data-t="other"]         { background: var(--t-other-bg);         color: var(--t-other-fg); }

/* user-defined tag chip colors */
.chip--tag[data-c="plum"]   { background: var(--tag-plum-bg);   color: var(--tag-plum); }
.chip--tag[data-c="pink"]   { background: var(--tag-pink-bg);   color: var(--tag-pink); }
.chip--tag[data-c="yellow"] { background: var(--tag-yellow-bg); color: var(--tag-yellow); }
.chip--tag[data-c="orange"] { background: var(--tag-orange-bg); color: var(--tag-orange); }
.chip--tag[data-c="ice"]    { background: var(--tag-ice-bg);    color: var(--tag-ice); }
.chip--tag[data-c="lime"]   { background: var(--tag-lime-bg);   color: var(--tag-lime); }
.chip--tag[data-c="lemon"]  { background: var(--tag-lemon-bg);  color: var(--tag-lemon); }
.chip--tag[data-c="navy"]   { background: var(--tag-navy-bg);   color: var(--tag-navy); }
.chip--tag[data-c="gray"]   { background: var(--tag-gray-bg);   color: var(--tag-gray); }

/* ────────────────────────────────────────────────────────── buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-md);
  border: 1px solid transparent;
  background: var(--navy);
  color: var(--white);
  text-decoration: none;
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--plum); color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn--primary {
  background: var(--grad-cta);
  background-size: 200% 100%;
  background-position: 0 0;
}
.btn--primary:hover {
  background: var(--grad-cta-hover);
  background-size: 200% 100%;
  background-position: 100% 0;
}
.btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--gray-200);
}
.btn--ghost:hover { background: var(--gray-50); border-color: var(--navy-12); color: var(--navy); }
.btn--sm { padding: 0.35rem 0.75rem; font-size: var(--fs-sm); }
.btn--icon { padding: 0.4rem; width: 36px; height: 36px; justify-content: center; }

/* ────────────────────────────────────────────────────────── filter bar */
.filterbar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center;
}
.filterbar form { display: contents; }
.filterbar select, .filterbar input[type="search"] {
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: var(--fs-sm);
  transition: all 0.15s ease;
}
.filterbar select:focus, .filterbar input:focus {
  outline: none; border-color: var(--pink); background: var(--white); box-shadow: var(--ring);
}
.filterbar input[type="search"] { min-width: 240px; flex: 1; }
.filterbar .clear {
  color: var(--gray-600); font-size: var(--fs-sm);
  padding: 0.5rem 0.625rem; border-radius: var(--r-sm);
}
.filterbar .clear:hover { background: var(--gray-100); color: var(--navy); }
.filterbar .results-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--gray-600);
  font-weight: 500;
}

/* ─────────────────────────────────────── tag/type cluster on cards */
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* ─────────────────────────────────────────────────── empty state */
.empty {
  background: var(--white);
  border: 1px dashed var(--gray-200);
  border-radius: var(--r-lg);
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty__icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem;
}
.empty h3 { color: var(--navy); margin-bottom: 0.35rem; font-size: var(--fs-lg); }
.empty p { color: var(--gray-600); font-size: var(--fs-sm); }
.empty .btn { margin-top: 1rem; }

/* ─────────────────────────────────────────────────── auth screen */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: var(--grad-navy);
}
.auth-wrap::after {
  content: "";
  position: fixed; inset: 0;
  background: var(--grad-glow);
  pointer-events: none;
}
.auth-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 2.5rem 2.25rem;
  width: 100%; max-width: 440px;
  box-shadow: var(--sh-4);
  position: relative;
  z-index: 1;
}
.auth-card__brand {
  display: flex; align-items: center; gap: 0.65rem;
  margin-bottom: 1.5rem;
}
.auth-card__brand img { height: 28px; }
.auth-card__brand .wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--navy);
  font-size: 0.9rem;
}
.auth-card__brand .wordmark small {
  display: block;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--gray-600);
  margin-top: 1px;
}
.auth-card h1 { font-size: 1.6rem; }
.auth-card .sub { color: var(--gray-600); margin: 0.25rem 0 1.5rem; font-size: var(--fs-md); }
.field { margin-bottom: 0.9rem; }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
  font-size: var(--fs-md);
  background: var(--white);
  transition: all 0.15s ease;
}
.field input:focus {
  outline: none; border-color: var(--pink); background: #fff7fb;
  box-shadow: var(--ring);
}
.form-error {
  background: #fde7e7;
  border: 1px solid #f5b3b3;
  color: #8b1a1a;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  margin-bottom: 0.85rem;
}
.form-actions .btn { width: 100%; justify-content: center; padding: 0.75rem 1.5rem; }
.auth-card .links {
  margin-top: 1.25rem; font-size: var(--fs-sm); text-align: center;
}

/* ─────────────────────────────────────────── report viewer (iframe) */
.viewer-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 25;
}
.viewer-bar__title { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.viewer-bar__title h1 {
  font-size: var(--fs-lg);
  font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.viewer-bar__title .crumb {
  color: var(--gray-600);
  font-size: var(--fs-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.viewer-bar__title .crumb a { color: var(--plum); }
.viewer-bar__actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.viewer-frame {
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  border: 0; display: block;
  background: var(--white);
}

/* ─────────────────────────────────────── phone menu (admin pages) */
.topbar__menu, .sidebar__close { display: none; }

/* ─────────────────────────────────────────────────── responsive */
@media (max-width: 1023.98px) {
  .app { grid-template-columns: 1fr; }
  /* The sidebar becomes an off-canvas panel. Closed, it is hidden from Tab and screen readers. */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: min(300px, 86vw); height: 100%;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
    z-index: 60;
  }
  .sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
  }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 20, 40, 0.45);
  }
  .topbar__menu { display: inline-flex; flex: none; }
  .sidebar__close {
    display: inline-flex; align-items: center;
    position: absolute; top: 10px; right: 10px; z-index: 1;
    min-height: 44px; padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--r-sm);
    background: transparent; color: var(--white); font-weight: 600;
  }
  .page { padding: 1.25rem 1rem 2rem; }
  .topbar { padding: 0 1rem; gap: 0.5rem; }
  .topbar__search { max-width: none; min-width: 0; }
  .topbar__search input { min-width: 0; width: 100%; }
  .grid, .grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
  .filterbar select { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.is-open { transition: none; }
}

/* Inline SVG nicety */
.i { display: inline-flex; align-items: center; }
.spaced { display: flex; gap: 0.5rem; align-items: center; }

/* Subtle decorative */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 1.5rem 0;
}

/* helper: text vars */
.muted { color: var(--gray-600); }
.subtle { font-size: var(--fs-sm); color: var(--gray-600); }
.mono { font-family: var(--font-mono); }

/* ────────────────────────────────────────────────────────── data table */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-600);
  font-weight: 600;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: var(--gray-50); }
.table .row-actions {
  display: flex; gap: 0.25rem; justify-content: flex-end;
  opacity: 0; transition: opacity 0.15s ease;
}
.table tbody tr:hover .row-actions { opacity: 1; }
.table .row-user {
  display: flex; align-items: center; gap: 0.75rem;
}
.table .row-user .avatar { width: 32px; height: 32px; font-size: 0.7rem; }
.table .row-user .name { font-weight: 600; color: var(--navy); line-height: 1.25; }
.table .row-user .email { color: var(--gray-600); font-size: var(--fs-sm); }
.table .row-self { color: var(--pink); font-size: 0.65rem; letter-spacing: 0.18em;
                   text-transform: uppercase; font-weight: 700; margin-left: 0.5rem; }
.table .right { text-align: right; }
.table-empty { padding: 3rem; text-align: center; color: var(--gray-600); }

/* ─────────────────────────────────────────── status dot (active/inactive) */
.status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: var(--fs-sm); color: var(--navy); font-weight: 500;
}
.status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
}
.status--active::before { background: #1ea672; box-shadow: 0 0 0 3px #1ea67220; }
.status--inactive { color: var(--gray-600); }

/* ────────────────────────────────────────────────────────── form layout */
.form-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 2rem 2.25rem;
  max-width: 760px;
}
.form-card__section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--gray-200);
}
.form-card__section:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.form-card__section h3 {
  font-size: var(--fs-lg); margin-bottom: 0.25rem;
}
.form-card__section .help { color: var(--gray-600); font-size: var(--fs-sm); margin-bottom: 1rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }

.form-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.form-field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
  display: flex; align-items: center; gap: 0.4rem;
}
.form-field .help { color: var(--gray-600); font-size: 0.78rem; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  font-size: var(--fs-md);
  background: var(--white);
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--pink); background: var(--white); box-shadow: var(--ring);
}
.form-field .errors {
  background: #fde7e7;
  border: 1px solid #f5b3b3;
  color: #8b1a1a;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-sm);
  font-size: 0.78rem;
}

/* multi-checkbox chip grid for clients */
.checkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem;
  padding: 0.4rem 0;
}
.checkgrid label {
  display: flex; align-items: center; gap: 0.55rem;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--navy);
  transition: all 0.15s ease;
}
.checkgrid label:hover { border-color: var(--plum); background: var(--white); }
.checkgrid label input { accent-color: var(--pink); }
.checkgrid label:has(input:checked) {
  background: var(--white);
  border-color: var(--pink);
  box-shadow: var(--sh-1);
}

/* toggle switch */
.toggle {
  display: inline-flex; align-items: center; gap: 0.65rem;
  cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500; color: var(--navy);
}
.toggle input { display: none; }
.toggle .track {
  width: 38px; height: 22px;
  background: var(--gray-200);
  border-radius: var(--r-pill);
  position: relative;
  transition: background 0.2s ease;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
.toggle input:checked + .track { background: #1ea672; }
.toggle input:checked + .track::after { transform: translateX(16px); }

/* form footer with cancel/save */
.form-actions-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--gray-200);
}
.form-actions-row .danger {
  color: #b73c3c; font-size: var(--fs-sm); font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.form-actions-row .danger:hover { color: #8b1a1a; }
.form-actions-row .right { display: flex; gap: 0.5rem; }

/* ────────────────────────────────────────────────────── flash messages */
.flash {
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  display: flex; align-items: center; gap: 0.5rem;
}
.flash--success { background: #d9f7e7; color: #0a5a3a; border: 1px solid #8de3bd; }
.flash--error { background: #fde7e7; color: #8b1a1a; border: 1px solid #f5b3b3; }
.flash--info { background: var(--ice); color: var(--ink); border: 1px solid #8be0c2; }

/* danger zone in edit form */
.danger-zone {
  margin-top: 1.5rem;
  border: 1px dashed #f5b3b3;
  background: #fef6f6;
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.danger-zone strong { color: #8b1a1a; }
.danger-zone p { color: var(--gray-600); font-size: var(--fs-sm); margin-top: 0.15rem; }
.btn--danger { background: #c0392b; color: var(--white); }
.btn--danger:hover { background: #8b1a1a; color: var(--white); }
.btn--link {
  background: transparent; color: var(--gray-600); padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm); border: 0;
}
.btn--link:hover { background: var(--gray-100); color: var(--navy); }

/* role chips */
.chip--role[data-r="admin"]  { background: var(--navy); color: var(--white); }
.chip--role[data-r="client"] { background: var(--ice); color: var(--ink); }
