/* ===== WelcomeDesk — premium UI (UIX revamp) =====
   One shared design system. Every legacy class name is preserved so pages
   that haven't been bespoke-revamped still render correctly — they simply
   inherit the refined tokens, depth and motion below.
   ------------------------------------------------------------------------ */

/* ---------- Design tokens — light ---------- */
:root {
  color-scheme: light;

  /* Brand. --brand may be overridden per-org via an inline style; keep it the
     single source of truth and derive hovers from it where possible. */
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-2: #8b7ff5;
  --brand-soft: #eef1ff;
  --accent: #0ea5b4;
  --accent-soft: #e2f6f7;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f2f6;
  --border: #e9eaef;
  --border-strong: #d7d9e0;

  --text: #181a20;
  --text-soft: #3b404d;
  --muted: #646b7a;
  --muted-2: #9298a6;

  --green: #15a34a;  --green-soft: #e6f6ec;
  --amber: #d97706;  --amber-soft: #fdf1de;
  --red:   #e0413a;  --red-soft:   #fdebea;
  --blue:  #3b82f6;  --blue-soft:  #e8efff;

  --sidebar: #0f1118;
  --glass: rgba(255,255,255,.82);

  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(18,20,38,.05), 0 1px 3px rgba(18,20,38,.04);
  --shadow: 0 4px 12px -2px rgba(18,20,38,.09), 0 2px 6px -2px rgba(18,20,38,.06);
  --shadow-lg: 0 26px 60px -14px rgba(18,20,38,.26), 0 8px 22px -10px rgba(18,20,38,.16);
  --shadow-brand: 0 12px 30px -8px rgba(79,70,229,.45);

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.4,.5,1);
}

/* ---------- Design tokens — dark ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --brand-2: #9a90ff;
  --brand-soft: #232649;
  --accent-soft: #0c3b40;

  --bg: #0b0d13;
  --surface: #14161f;
  --surface-2: #1a1c26;
  --surface-3: #232531;
  --border: #272a37;
  --border-strong: #383c4b;

  --text: #eceef3;
  --text-soft: #c3c7d3;
  --muted: #9097a6;
  --muted-2: #636979;

  --green-soft: #11291c;
  --amber-soft: #2f2410;
  --red-soft:   #311714;
  --blue-soft:  #14233f;

  --sidebar: #0c0e15;
  --glass: rgba(17,19,27,.82);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow: 0 6px 18px -4px rgba(0,0,0,.55);
  --shadow-lg: 0 28px 64px -14px rgba(0,0,0,.74);
  --shadow-brand: 0 12px 34px -8px rgba(79,70,229,.6);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body, .card, .stat, .metric, .topbar, .sidebar, .tabs, .auth-card,
input, select, textarea, .btn, .pill, .kiosk-card {
  transition: background-color .28s var(--ease), border-color .28s var(--ease),
              color .28s var(--ease), box-shadow .2s var(--ease);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 23px; letter-spacing: -.022em; font-weight: 800; }
h2 { font-size: 18px; letter-spacing: -.014em; font-weight: 700; }
h3 { font-size: 15px; letter-spacing: -.01em; font-weight: 700; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* Refined scrollbars (WebKit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 99px;
  border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Motion keyframes ---------- */
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes kiosk-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.5); } 62% { transform: scale(1.09); } 100% { opacity: 1; transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-ring { 0% { transform: scale(.6); opacity: .7; } 80%,100% { transform: scale(2.4); opacity: 0; } }
@keyframes shimmer { to { background-position: 200% 0; } }
@keyframes confetti-fall {
  0%   { transform: translate3d(0,-12vh,0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--cx,0),104vh,0) rotate(var(--cr,540deg)); opacity: 1; }
}

/* Elements that gently enter on load. --i staggers groups (set inline). */
.card, .stat, .metric, .hero, .auth-card, .kiosk-card, .empty {
  animation: reveal .55s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

/* ===== App shell ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: var(--sidebar); color: #aeb4c2; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 16px 0 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background-image: linear-gradient(180deg, rgba(255,255,255,.022), transparent 220px);
  animation: none;
}
.sidebar .brand {
  font-size: 18.5px; font-weight: 800; color: #fff; padding: 6px 20px 18px;
  letter-spacing: -.025em; display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .dot {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  box-shadow: 0 4px 12px -2px rgba(79,70,229,.6), inset 0 1px 0 rgba(255,255,255,.35);
  position: relative;
}
.sidebar .brand .dot::after {
  content: ""; position: absolute; inset: 0; display: block;
  background: radial-gradient(7px 7px at 64% 36%, rgba(255,255,255,.85), transparent 70%);
  border-radius: inherit;
}
.sidebar .brand span { color: #a9a2f9; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  color: #9aa1b2; margin: 1px 12px; padding: 8px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,.055); color: #fff; text-decoration: none;
}
.sidebar nav a.active {
  background: #3f3ac4;
  background: color-mix(in oklab, var(--brand) 92%, #11131b);
  color: #fff; font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(79,70,229,.7);
}
.sidebar nav a .ico {
  width: 18px; text-align: center; opacity: .92; font-size: 13px;
}
.sidebar nav a.active .ico { opacity: 1; }
.sidebar .nav-group {
  font-size: 10px; text-transform: uppercase; letter-spacing: .11em;
  color: #565d6e; padding: 17px 24px 6px; font-weight: 700;
}
.sidebar .spacer { flex: 1; }
.sidebar .org-box {
  margin: 10px 12px 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.04); font-size: 13px;
  border: 1px solid rgba(255,255,255,.05);
}
.sidebar .org-box .name { color: #fff; font-weight: 600; }
.sidebar .org-box .plan {
  color: #6b7283; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; margin-top: 2px;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--glass); backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
  padding: 12px 30px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar strong { font-size: 15px; letter-spacing: -.012em; font-weight: 700; }
.topbar .user { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.content { padding: 26px 30px 64px; max-width: 1260px; width: 100%; }

/* Icon buttons in the topbar (theme toggle, notification bell) */
.icon-btn {
  display: inline-grid; place-items: center; width: 35px; height: 35px;
  border-radius: 10px; border: 1px solid transparent; background: transparent;
  cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1;
  font-family: inherit; transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.93); }
.theme-ico-dark { display: none; }
[data-theme="dark"] .theme-ico-light { display: none; }
[data-theme="dark"] .theme-ico-dark { display: inline; }

.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--text); line-height: 1; padding: 4px 8px;
}

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-head p.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Hero band (dashboard showcase) ===== */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(125deg, var(--brand-dark) 0%, var(--brand) 46%, var(--brand-2) 100%);
  border-radius: var(--radius-lg); padding: 27px 30px;
  margin-bottom: 22px; box-shadow: var(--shadow-brand);
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; flex-wrap: wrap;
}
.hero::before {
  content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  right: -90px; top: -150px; background: rgba(255,255,255,.13); filter: blur(6px);
}
.hero::after {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  right: 130px; bottom: -130px; background: rgba(255,255,255,.09);
}
.hero-text { position: relative; z-index: 1; }
.hero-eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.hero h1 { color: #fff; font-size: 26px; letter-spacing: -.025em; }
.hero-sub { color: rgba(255,255,255,.82); font-size: 14px; margin-top: 5px; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 9px; flex-wrap: wrap; }
.hero .btn {
  background: #fff; color: var(--brand-dark); border-color: #fff; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.4);
}
.hero .btn:hover { background: #f3f3ff; border-color: #f3f3ff; }
.hero .btn.secondary {
  background: rgba(255,255,255,.14); color: #fff;
  border-color: rgba(255,255,255,.34); box-shadow: none;
  backdrop-filter: blur(4px);
}
.hero .btn.secondary:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 21px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h3 { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-head h3 { margin-bottom: 0; }
.card-link { font-size: 13px; font-weight: 600; color: var(--muted); }
.card-link:hover { color: var(--brand); text-decoration: none; }
.grid { display: grid; gap: 17px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Stat tiles (legacy — kept for non-revamped pages) ===== */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat .label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
}
.stat .value { font-size: 31px; font-weight: 800; margin-top: 5px; letter-spacing: -.035em; }
.stat .value.alert { color: var(--red); }
.stat .value.ok { color: var(--green); }
.stat .foot { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.stat .spark { position: absolute; right: 16px; top: 16px; font-size: 18px; opacity: .25; }

/* ===== Metric cards (dashboard showcase) ===== */
.metric {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 19px 17px; box-shadow: var(--shadow-sm);
}
.metric:hover {
  transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong);
}
.metric::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px;
  border-radius: 50%; background: var(--brand-soft); opacity: .55; pointer-events: none;
}
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; position: relative; z-index: 1; }
.metric-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 19px; background: var(--brand-soft); color: var(--brand);
}
.metric-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; margin-top: 15px; position: relative; z-index: 1;
}
.metric-value {
  font-size: 35px; font-weight: 800; letter-spacing: -.04em; line-height: 1.04;
  margin-top: 3px; position: relative; z-index: 1;
}
.metric-foot {
  font-size: 12.5px; color: var(--muted-2); margin-top: 6px;
  display: flex; align-items: center; gap: 6px; position: relative; z-index: 1;
}
.metric.t-blue  .metric-ico { background: var(--blue-soft);  color: var(--blue); }
.metric.t-blue::after  { background: var(--blue-soft); }
.metric.t-amber .metric-ico { background: var(--amber-soft); color: var(--amber); }
.metric.t-amber::after { background: var(--amber-soft); }
.metric.t-green .metric-ico { background: var(--green-soft); color: var(--green); }
.metric.t-green::after { background: var(--green-soft); }
.metric.t-red   .metric-ico { background: var(--red-soft);   color: var(--red); }
.metric.t-red::after   { background: var(--red-soft); }
.metric.t-red   .metric-value { color: var(--red); }

.delta {
  display: inline-flex; align-items: center; gap: 3px; font-weight: 700;
  font-size: 11.5px; padding: 2px 7px; border-radius: 99px;
}
.delta.up   { background: var(--green-soft); color: #137a39; }
.delta.down { background: var(--red-soft);   color: #be332d; }
.delta.flat { background: var(--surface-3);  color: var(--muted); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .045em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700;
}
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }
.table-empty .big { font-size: 30px; margin-bottom: 6px; opacity: .5; }

/* ===== Illustrated empty states ===== */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 30px 22px;
}
.empty-art {
  width: 112px; height: 112px; margin-bottom: 15px; color: var(--brand);
}
.empty-art svg { width: 100%; height: 100%; overflow: visible; }
.empty-art .blob { fill: var(--brand-soft); }
.empty-art .ink { stroke: var(--brand); }
.empty-art .ink-soft { stroke: var(--muted-2); }
.empty-art .float { animation: float 4.5s var(--ease) infinite; transform-origin: center; }
.empty-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-text { font-size: 13px; color: var(--muted); max-width: 330px; line-height: 1.6; }
.empty-text a { font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer;
  font-weight: 600; text-decoration: none; font-family: inherit;
  transition: transform .12s var(--ease), background .14s, border-color .14s, box-shadow .14s;
  white-space: nowrap; box-shadow: 0 1px 2px rgba(18,20,38,.12);
}
.btn:hover {
  background: var(--brand-dark);
  background: color-mix(in oklab, var(--brand) 86%, #000);
  border-color: color-mix(in oklab, var(--brand) 86%, #000);
  text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover {
  background: var(--surface-3); border-color: var(--muted-2); color: var(--text);
}
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover {
  background: color-mix(in oklab, var(--red) 86%, #000);
  border-color: color-mix(in oklab, var(--red) 86%, #000);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Forms ===== */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 18%, transparent);
}
input[type=color] { padding: 4px; height: 44px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
textarea { resize: vertical; min-height: 88px; }
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-line input { width: auto; }

/* ===== Pills ===== */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-soft); color: #137a39; }
.pill.amber { background: var(--amber-soft); color: #b45309; }
.pill.red   { background: var(--red-soft);   color: #be332d; }
.pill.blue  { background: var(--blue-soft);  color: var(--brand-dark); }
.pill.gray  { background: var(--surface-3);  color: var(--muted); }
[data-theme="dark"] .pill.green { color: #4ade80; }
[data-theme="dark"] .pill.amber { color: #fbbf24; }
[data-theme="dark"] .pill.red   { color: #f87171; }
[data-theme="dark"] .pill.blue  { color: #93b4fd; }

/* ===== Flash ===== */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid transparent;
}
.flash.success { background: var(--green-soft); color: #11703a; border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.flash.error   { background: var(--red-soft);   color: #b02f29; border-color: color-mix(in srgb, var(--red) 22%, transparent); }
[data-theme="dark"] .flash.success { color: #6ee7a0; }
[data-theme="dark"] .flash.error   { color: #fca5a0; }

/* ===== Auth / centered ===== */
.center-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(720px 460px at 18% -8%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 62%),
    radial-gradient(680px 460px at 95% 108%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-card .brand {
  font-size: 23px; font-weight: 800; letter-spacing: -.025em;
  display: flex; align-items: center; gap: 9px;
}
.auth-card .brand .dot {
  width: 24px; height: 24px; border-radius: 8px;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  box-shadow: 0 4px 11px -3px rgba(79,70,229,.6);
}
.auth-card .brand span { color: var(--brand); }
.auth-card .tag { color: var(--muted); margin: 6px 0 22px; font-size: 14px; }

/* ===== Bar chart ===== */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 134px; padding-bottom: 22px; }
.bars .bar {
  flex: 1; background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 5px 5px 3px 3px; min-height: 4px; position: relative;
  transition: filter .14s, transform .14s;
}
.bars .bar:hover { filter: brightness(1.12) saturate(1.1); transform: scaleY(1.03); transform-origin: bottom; }
.bars .bar span {
  position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--muted-2); white-space: nowrap;
}
.bars .bar[data-v]:hover::after {
  content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--text); color: var(--surface);
  font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; box-shadow: var(--shadow);
}

/* ===== Tabs ===== */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.tabs a { padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--brand); color: #fff; box-shadow: 0 4px 10px -4px rgba(79,70,229,.6); }

/* ===== Avatars / photos ===== */
.vphoto {
  width: 40px; height: 40px; border-radius: 11px; object-fit: cover;
  background: var(--brand-soft); flex-shrink: 0;
}
.vphoto.lg { width: 84px; height: 84px; border-radius: 16px; }
.initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700;
}
[data-theme="dark"] .initials { color: var(--brand-2); }
.live-dot {
  position: relative; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); display: inline-block; flex-shrink: 0;
}
.live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--green); animation: pulse-ring 2s var(--ease) infinite;
}

/* ===== Calendar ===== */
.cal { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); }
.cal-head div {
  padding: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); text-align: center;
}
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 104px; border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  padding: 5px 6px;
}
.cal-cell:nth-child(7n+1) { border-left: none; }
.cal-cell.muted-cell { background: var(--surface-2); }
.cal-cell.muted-cell .cal-day { color: var(--muted-2); }
.cal-cell.today { background: var(--brand-soft); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.cal-cell.today .cal-day { color: var(--brand-dark); }
.cal-ev {
  display: block; font-size: 11.5px; padding: 3px 6px; border-radius: 5px;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
}
.cal-ev:hover { text-decoration: none; opacity: .88; }
.cal-ev.group { background: var(--brand); color: #fff; }
.cal-ev.invite { background: var(--blue-soft); color: var(--brand-dark); }
.cal-ev .t { font-weight: 700; opacity: .85; }
.cal-ev .n {
  background: rgba(255,255,255,.28); border-radius: 999px; padding: 0 5px;
  font-weight: 700; font-size: 10px;
}
.cal-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }
.cal-key.group { background: var(--brand); }
.cal-key.invite { background: var(--blue-soft); }
@media (max-width: 760px) {
  .cal-cell { min-height: 64px; }
  .cal-ev { font-size: 10px; }
  .cal-ev .t, .cal-ev .n { display: none; }
}

/* ===== Misc utilities ===== */
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flag-row td { background: var(--red-soft) !important; }
.over-row td { background: var(--amber-soft) !important; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
code {
  background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 12.5px;
  font-family: var(--mono);
}
.kbd-list td code { font-size: 12px; }
details > summary { cursor: pointer; }
details[open] > summary { margin-bottom: 4px; }
.media-line { display: flex; align-items: center; gap: 10px; }
.section-label {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin: 0 0 10px;
}
.nowrap { white-space: nowrap; }

/* ===== Badge print ===== */
.badge-print {
  width: 340px; border: 2px solid #111; border-radius: 16px;
  padding: 22px; margin: 30px auto; text-align: center; box-shadow: var(--shadow);
}
.badge-print .vphoto.lg { margin: 0 auto 10px; }
.badge-print .vname { font-size: 24px; font-weight: 700; }
.badge-print .vco { color: var(--muted); margin-bottom: 10px; }
.badge-print .bnum { font-size: 40px; font-weight: 800; letter-spacing: 2px; }
.badge-print .meta { font-size: 13px; margin-top: 10px; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ===== Kiosk (visitor-facing) ===== */
.kiosk {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; color: #fff;
  background:
    radial-gradient(820px 540px at 14% 2%, rgba(139,127,245,.36), transparent 58%),
    radial-gradient(760px 560px at 100% 100%, rgba(79,70,229,.46), transparent 56%),
    linear-gradient(165deg, #1b2036 0%, #0d0f1a 72%);
}
.kiosk-orb {
  position: fixed; border-radius: 50%; pointer-events: none; filter: blur(2px);
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.16), transparent 68%);
}
.kiosk-orb.o1 { width: 220px; height: 220px; top: 8%; right: 12%; animation: float 9s var(--ease) infinite; }
.kiosk-orb.o2 { width: 140px; height: 140px; bottom: 12%; left: 9%; animation: float 11s var(--ease) infinite reverse; }
.kiosk-card {
  position: relative; z-index: 1;
  background: var(--surface); color: var(--text); border-radius: 26px;
  padding: 42px; width: 100%; max-width: 540px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.6);
  animation: kiosk-in .55s var(--ease-out) both;
}
.kiosk-card h1 { font-size: 29px; margin-bottom: 6px; letter-spacing: -.03em; text-align: center; }
.kiosk-card .sub { color: var(--muted); margin-bottom: 26px; font-size: 15px; text-align: center; }
.kiosk-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--brand); background: var(--brand-soft);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.kiosk-logo {
  font-size: 25px; font-weight: 800; margin-bottom: 22px; text-align: center;
  letter-spacing: -.025em;
}
.kiosk-foot { color: #8a93a8; margin-top: 22px; font-size: 13px; text-align: center; }
.kiosk-foot b { color: #c2c9d8; font-weight: 600; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.type-grid a, .type-grid button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 16px; border: 1.5px solid var(--border);
  border-radius: 17px; text-align: center; font-weight: 700; color: var(--text);
  background: var(--surface); cursor: pointer; font-size: 15px; font-family: inherit;
  transition: transform .14s var(--ease), border-color .14s, background .14s, box-shadow .14s;
}
.type-grid a:hover, .type-grid button:hover {
  border-color: var(--brand); text-decoration: none;
  transform: translateY(-3px); box-shadow: var(--shadow);
}
.type-grid .ico {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  font-size: 27px; margin-bottom: 11px;
  background: var(--brand-soft); color: var(--brand);
  transition: background .14s, color .14s, transform .14s var(--ease-spring);
}
.type-grid a:hover .ico, .type-grid button:hover .ico {
  background: var(--brand); color: #fff; transform: scale(1.07);
}

/* Kiosk — large code / query inputs */
.kiosk-bigfield {
  font-size: 26px; text-align: center; letter-spacing: 6px; font-weight: 700;
  padding: 16px 12px; text-transform: uppercase;
}
.kiosk-bigfield.name { letter-spacing: normal; text-transform: none; font-size: 20px; }

/* Kiosk — success check + badge (done screen) */
.success-check {
  width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 8px;
  display: grid; place-items: center; background: var(--green-soft);
  animation: pop .55s var(--ease-spring) both;
}
.success-check.warn { background: var(--amber-soft); }
.success-check svg { width: 44px; height: 44px; }
.success-check svg path {
  fill: none; stroke: var(--green); stroke-width: 3.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: draw .5s .3s var(--ease-out) forwards;
}
.success-check.warn svg path { stroke: var(--amber); }
.kiosk-badge {
  text-align: center; padding: 20px; border-radius: 18px;
  background: linear-gradient(150deg, var(--brand-soft), var(--surface-3));
  border: 1px solid var(--border);
}
.kiosk-badge .blabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: .13em;
  color: var(--muted); font-weight: 700;
}
.kiosk-badge .bnum {
  font-size: 46px; font-weight: 800; letter-spacing: 4px; margin-top: 4px;
  color: var(--brand-dark);
}
[data-theme="dark"] .kiosk-badge .bnum { color: var(--brand-2); }

/* Confetti (delight moment) */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti-piece {
  position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti-fall var(--cd, 3s) var(--ease) forwards;
}

/* ===== Toggle switch (settings pages) ===== */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border-strong); border-radius: 24px; transition: background .18s;
}
.slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .slider { background: var(--brand); }
.toggle input:checked + .slider::before { transform: translateX(20px); }
.toggle input:focus-visible + .slider { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggle input:disabled + .slider { opacity: .5; cursor: not-allowed; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100; height: 100vh;
    transform: translateX(-100%); transition: transform .24s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(8,10,16,.55);
    z-index: 90; backdrop-filter: blur(2px); }
  body.nav-open .nav-scrim { display: block; }
  .menu-toggle { display: block; }
  .content { padding: 18px 16px 54px; }
  .topbar { padding: 11px 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }
  .hero { padding: 22px; border-radius: var(--radius); }
  .hero h1 { font-size: 22px; }
  .card { padding: 17px; }
  .btn.lg { width: 100%; }
  h1 { font-size: 21px; }
  /* tables collapse to stacked cards */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td {
    display: block; width: 100%;
  }
  table.responsive tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 10px; padding: 4px 0;
  }
  table.responsive tr:hover td { background: transparent; }
  table.responsive td {
    border: none; padding: 7px 14px; display: flex;
    justify-content: space-between; gap: 14px; text-align: right;
  }
  table.responsive td::before {
    content: attr(data-label); font-weight: 700; color: var(--muted);
    text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em;
    text-align: left; align-self: center;
  }
  table.responsive td[data-label=""]::before { content: ""; }
  .kiosk { padding: 18px; }
  .kiosk-card { padding: 28px 22px; }
  .kiosk-card h1 { font-size: 24px; }
  .auth-card { padding: 28px 22px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
