/* =====================================================================
   SphereConnect — "Aurora" interface
   Innovasphere navy as the anchor, an indigo→sky accent, glass surfaces,
   soft depth and motion that answers what people do.
   ===================================================================== */
/* Prompt, served from this site (no request to Google Fonts) */
@font-face { font-family: Prompt; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/prompt-thai-400-normal.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Prompt; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/prompt-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Prompt; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/prompt-thai-500-normal.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Prompt; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/prompt-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Prompt; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/prompt-thai-600-normal.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Prompt; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/prompt-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --navy-900: #080738; --navy-800: #15144a; --navy-700: #26255e; --navy-600: #4d4d70;
  --navy-400: #7b7a94; --navy-300: #9191a7; --navy-200: #b0afbf; --navy-100: #ceced7; --navy-50: #e6e7f0;
  --white: #fff;
  --ink: #0b0a3a; --ink-muted: #565678; --ink-soft: #8a8aa6;
  --surface: #ffffff; --surface-raised: #f5f6fc; --page: #f3f4fb;
  --border: #e3e5f1; --border-strong: #b9bcd3;
  --action: #4f46e5; --action-2: #7c3aed; --action-hover: #4338ca; --on-action: #fff; --focus-ring: #6366f1; --brand-dark: #080738; --brand-accent: #0ea5e9;
  --grad-action: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --grad-brand: linear-gradient(135deg, #080738 0%, #2e2a9e 52%, #0ea5e9 100%);
  --grad-title: linear-gradient(120deg, #080738 10%, #4338ca 60%, #0ea5e9 100%);
  --c-sky-bg: #e0f2fe;    --c-sky: #0369a1;
  --c-violet-bg: #ede9fe; --c-violet: #6d28d9;
  --c-indigo-bg: #e0e7ff; --c-indigo: #4338ca;
  --c-amber-bg: #fef3c7;  --c-amber: #b45309;
  --c-green-bg: #dcfce7;  --c-green: #15803d;
  --c-teal-bg: #ccfbf1;   --c-teal: #0f766e;
  --c-red-bg: #ffe4e6;    --c-red: #be123c;
  --c-slate-bg: #eef1f6;  --c-slate: #475569;
  --c-orange-bg: #ffedd5; --c-orange: #c2410c;
  --c-pink-bg: #fce7f3;   --c-pink: #be185d;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 20px; --radius-pill: 9999px;
  --font-sans: Prompt, "Noto Sans Thai", system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(16, 18, 64, .05);
  --shadow: 0 1px 2px rgba(16, 18, 64, .04), 0 8px 24px rgba(16, 18, 64, .06);
  --shadow-lg: 0 2px 6px rgba(16, 18, 64, .05), 0 24px 48px rgba(16, 18, 64, .12);
  --shadow-glow: 0 6px 20px rgba(79, 70, 229, .32);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --appbar-h: 68px;
  --container: 1240px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 16px/26px var(--font-sans); color: var(--ink); background: var(--page); min-height: 100vh; }
body::before {
  content: ""; position: fixed; inset: -20vh -10vw auto auto; width: 60vw; height: 60vw; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--action) 16%, transparent), transparent 70%);
}
body::after {
  content: ""; position: fixed; inset: auto auto -25vh -15vw; width: 55vw; height: 55vw; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand-accent) 13%, transparent), transparent 70%);
}
a { color: var(--action); text-underline-offset: 3px; transition: color .15s ease; }
a:hover { color: var(--action-hover); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 32px; line-height: 42px; background: var(--grad-title); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 21px; line-height: 30px; font-weight: 600; color: var(--brand-dark); }
h3 { font-size: 17px; line-height: 26px; font-weight: 600; color: var(--brand-dark); }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-raised); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; line-height: 22px; }
.caption { font-size: 12px; line-height: 18px; color: var(--ink-muted); }
.eyebrow { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .22em; color: var(--action); text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--space-4); }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
[hidden] { display: none !important; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50; height: var(--appbar-h);
  display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6);
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid rgba(227, 229, 241, .8);
}
.appbar .brand-mini { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy-900); }
.appbar .brand-mini img { height: 30px; width: auto; display: block; }
.appbar .brand-mini span { font-weight: 600; font-size: 15px; padding-left: 10px; border-left: 1px solid var(--border); }
.appbar-search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.appbar-search input { width: 100%; height: 44px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: rgba(243, 244, 251, .9); padding: 0 52px 0 44px; font: 400 14px/20px var(--font-sans); color: var(--ink); transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
.appbar-search input:focus { outline: none; background: #fff; border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 15%, transparent); }
.appbar-search .s-icon { position: absolute; left: 15px; top: 12px; color: var(--ink-soft); display: flex; }
.appbar-search kbd { position: absolute; right: 12px; top: 11px; font: 500 11px/20px var(--font-sans); color: var(--ink-soft); border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; background: #fff; }
.appbar-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
@media (max-width: 860px) { .appbar-search { display: none; } .appbar .brand-mini span { display: none; } .appbar { padding: 0 var(--space-3); } .appbar-actions .btn-label { display: none; } }

/* Hamburger: three bars morph into an X */
.hamburger { width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; position: relative; flex: none; transition: background-color .2s ease; }
.hamburger:hover { background: var(--surface-raised); }
.hamburger span { position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px; background: var(--navy-900); transition: transform .35s var(--spring), opacity .2s ease, top .35s var(--spring); }
.hamburger span:nth-child(1) { top: 15px; } .hamburger span:nth-child(2) { top: 21px; } .hamburger span:nth-child(3) { top: 27px; }
.hamburger[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.hamburger[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* User menu */
.usermenu { position: relative; }
.usermenu > button { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: #fff; cursor: pointer; font: 500 14px/20px var(--font-sans); color: var(--ink); transition: box-shadow .2s ease, border-color .2s ease; }
.usermenu > button:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.usermenu > button .chev { transition: transform .25s var(--ease); }
.usermenu > button[aria-expanded="true"] .chev { transform: rotate(180deg); }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; transform-origin: top right; animation: popIn .22s var(--spring) both; }
.usermenu-panel .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu-panel a, .usermenu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: none; background: none; text-align: left; text-decoration: none; font: 500 14px/20px var(--font-sans); color: var(--ink); cursor: pointer; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-raised); color: var(--action); }
@media (max-width: 860px) { .usermenu > button .uname, .usermenu > button .chev { display: none; } .usermenu > button { padding: 3px; } }

/* ---------- Drawer (side navigation, hidden by default) ---------- */
.drawer {
  position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: 300px; max-width: 86vw;
  background: linear-gradient(180deg, var(--brand-dark) 0%, color-mix(in srgb, var(--brand-dark) 82%, var(--action)) 60%, color-mix(in srgb, var(--brand-dark) 68%, var(--action)) 100%); color: #fff;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
  transform: translateX(-104%); transition: transform .42s var(--ease); box-shadow: 24px 0 60px rgba(8, 7, 56, .35);
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.drawer-head img { width: 168px; height: auto; display: block; }
.drawer-close { width: 40px; height: 40px; border-radius: 12px; border: none; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color .2s ease, transform .3s var(--spring); }
.drawer-close:hover { background: rgba(255, 255, 255, .16); transform: rotate(90deg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; line-height: 16px; letter-spacing: .18em; color: #8f8ed0; padding: 14px 12px 6px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none;
  font: 500 14px/20px var(--font-sans); color: #d6d5f6; position: relative; transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.nav a svg { color: color-mix(in srgb, var(--action) 45%, white); flex: none; transition: color .2s ease, transform .3s var(--spring); }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(3px); }
.nav a:hover svg { transform: scale(1.12); }
.nav a[aria-current="page"] { background: linear-gradient(90deg, color-mix(in srgb, var(--action) 55%, transparent), color-mix(in srgb, var(--brand-accent) 20%, transparent)); color: #fff; }
.nav a[aria-current="page"] svg { color: color-mix(in srgb, var(--brand-accent) 55%, white); }
.drawer.open .nav a { animation: navIn .45s var(--ease) both; }
.drawer.open .nav a:nth-child(2) { animation-delay: 30ms; } .drawer.open .nav a:nth-child(3) { animation-delay: 60ms; }
.drawer.open .nav a:nth-child(4) { animation-delay: 90ms; } .drawer.open .nav a:nth-child(5) { animation-delay: 120ms; }
.drawer.open .nav a:nth-child(n+6) { animation-delay: 150ms; }
.drawer .me { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; align-items: center; gap: 12px; }
.drawer .me .caption { color: #a9a8d6; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(8, 7, 56, .42); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.scrim.open { opacity: 1; pointer-events: auto; }

/* ---------- Page ---------- */
.main { padding: var(--space-8) var(--space-6) var(--space-16); }
.container { width: 100%; max-width: var(--container); margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-6); }
.container.narrow { max-width: 820px; }
@media (max-width: 640px) { .main { padding: var(--space-4) var(--space-3) var(--space-12); } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.narrow .page-head { justify-content: center; text-align: center; }
.narrow .page-head > div { display: flex; flex-direction: column; align-items: center; }
.page-head .lead { color: var(--ink-muted); font-size: 15px; line-height: 24px; max-width: 70ch; margin-top: 4px; }
.crumb { font-size: 13px; line-height: 20px; color: var(--ink-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.crumb a { color: var(--ink-muted); }
a.crumb:hover { color: var(--action); }

/* ---------- Buttons (with ripple) ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  font: 500 14px/20px var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad-action); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 26px color-mix(in srgb, var(--action) 38%, transparent); }
.btn-secondary { background: #fff; color: var(--navy-900); border-color: var(--border); box-shadow: var(--shadow-sm); padding: 0 18px; }
.btn-secondary:hover { border-color: var(--action); color: var(--action); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); padding: 0 12px; }
.btn-ghost:hover { background: var(--surface-raised); color: var(--action); }
.btn-danger { background: linear-gradient(135deg, #e11d48, #f43f5e); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.btn[disabled], .btn.is-busy { opacity: .7; pointer-events: none; }
.btn.is-busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; pointer-events: none; animation: ripple .6s ease-out forwards; z-index: -1; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font: 500 14px/20px var(--font-sans); color: var(--navy-900); }
.hint { font-size: 12px; line-height: 18px; color: var(--ink-muted); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px;
  font: 400 15px/22px var(--font-sans); color: var(--ink); background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: #9a9ec0; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 15%, transparent); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23565678' stroke-width='1.8' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.textarea { resize: vertical; min-height: 110px; line-height: 24px; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: #e11d48; box-shadow: 0 0 0 4px rgba(225, 29, 72, .1); animation: shake .4s ease; }
/* Numbers are typed, never stepped */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.field-error { font: 500 13px/20px var(--font-sans); color: #be123c; display: flex; gap: 6px; align-items: flex-start; animation: fadeUp .3s var(--ease) both; }
.field-error::before { content: "!"; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: #e11d48; color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.check { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 22px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--action); flex: none; }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font: 500 14px/20px var(--font-sans); margin-bottom: 8px; color: var(--navy-900); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.narrow .form-actions { justify-content: center; }
.narrow form.card { margin-inline: auto; width: 100%; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); display: inline-flex; align-items: center; font: 500 14px/20px var(--font-sans); cursor: pointer; background: #fff; transition: all .25s var(--ease); }
.segmented label:hover { border-color: var(--action); color: var(--action); }
.segmented input:checked + label { background: var(--grad-action); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.segmented input:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.pill-tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 1px solid var(--border); align-self: flex-start; position: relative; }
.pill-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.pill-tabs label, .pill-tabs a { min-height: 38px; padding: 0 16px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; font: 500 14px/20px var(--font-sans); color: var(--ink-muted); cursor: pointer; text-decoration: none; transition: background-color .25s var(--ease), color .2s ease, box-shadow .25s ease; }
.pill-tabs input:checked + label, .pill-tabs a[aria-current="page"] { background: #fff; color: var(--action); box-shadow: var(--shadow); }
.pill-tabs input:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.switch { position: relative; display: inline-flex; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--radius-pill); background: #cfd2e3; transition: background-color .25s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(16, 18, 64, .25); transition: transform .35s var(--spring); }
.switch input:checked + span { background: linear-gradient(135deg, #16a34a, #22c55e); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Surfaces ---------- */
.card, .card-flush, .card-raised { background: rgba(255, 255, 255, .9); border: 1px solid rgba(227, 229, 241, .9); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card { padding: 26px; }
.card-raised { padding: 26px; background: linear-gradient(180deg, #ffffff, #f8f8ff); }
.card-flush { overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 26px; border-bottom: 1px solid var(--border); }
@media (max-width: 640px) { .card, .card-raised { padding: 18px; } .card-head { padding: 14px 18px; } }
.split { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: flex-start; }
.split > .primary { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.split > .aside { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: calc(var(--appbar-h) + 16px); }
@media (max-width: 1000px) { .split > .aside { position: static; } }
.dl { display: grid; grid-template-columns: minmax(96px, 120px) 1fr; gap: 8px 12px; margin: 0; font-size: 14px; line-height: 22px; }
.dl dt { color: var(--ink-muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Chips, tags, avatars ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--radius-pill); font: 500 12px/18px var(--font-sans); border: 1px solid var(--border-strong); white-space: nowrap; }
.chip-solid { background: var(--grad-action); color: #fff; border-color: transparent; }
.chip-soft { background: var(--surface-raised); border-color: transparent; }
.chip.status { border-color: transparent; }
.chip.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.status-new { background: var(--c-sky-bg); color: var(--c-sky); } .status-assigned { background: var(--c-violet-bg); color: var(--c-violet); }
.status-in_progress { background: var(--c-indigo-bg); color: var(--c-indigo); } .status-pending { background: var(--c-amber-bg); color: var(--c-amber); }
.status-resolved { background: var(--c-teal-bg); color: var(--c-teal); } .status-closed { background: var(--c-green-bg); color: var(--c-green); }
.status-cancelled { background: var(--c-slate-bg); color: var(--c-slate); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 8px; background: var(--surface-raised); font: 500 12px/18px var(--font-sans); }
.tag.tc-0, .dot.tc-0 { --t: #4f46e5; } .tag.tc-1, .dot.tc-1 { --t: #0ea5e9; } .tag.tc-2, .dot.tc-2 { --t: #14b8a6; } .tag.tc-3, .dot.tc-3 { --t: #f59e0b; }
.tag.tc-4, .dot.tc-4 { --t: #ec4899; } .tag.tc-5, .dot.tc-5 { --t: #8b5cf6; } .tag.tc-6, .dot.tc-6 { --t: #22c55e; } .tag.tc-7, .dot.tc-7 { --t: #f97316; }
.tag[class*="tc-"] { background: color-mix(in srgb, var(--t) 14%, white); color: color-mix(in srgb, var(--t) 78%, black); }
.dot[class*="tc-"] { background: var(--t); }
.count { display: inline-block; min-width: 24px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--surface-raised); font-size: 12px; line-height: 20px; text-align: center; transition: background-color .2s ease, color .2s ease; }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font: 600 14px/1 var(--font-sans); background: var(--grad-action); color: #fff; object-fit: cover; box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(16, 18, 64, .12); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; } .avatar.xs { width: 22px; height: 22px; font-size: 10px; } .avatar.lg { width: 96px; height: 96px; font-size: 32px; } .avatar.xl { width: 128px; height: 128px; font-size: 42px; }
.avatar-soft { background: var(--navy-50); color: var(--ink); } .avatar-outline { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--border-strong); }
.av-0 { background: linear-gradient(135deg, #4f46e5, #6366f1); } .av-1 { background: linear-gradient(135deg, #0284c7, #0ea5e9); } .av-2 { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.av-3 { background: linear-gradient(135deg, #d97706, #f59e0b); } .av-4 { background: linear-gradient(135deg, #db2777, #ec4899); } .av-5 { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.av-6 { background: linear-gradient(135deg, #16a34a, #22c55e); } .av-7 { background: linear-gradient(135deg, #ea580c, #f97316); }

.prio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.prio i { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.prio i b { width: 3px; border-radius: 1px; background: #d6d8e8; }
.prio i b:nth-child(1) { height: 6px; } .prio i b:nth-child(2) { height: 8.5px; } .prio i b:nth-child(3) { height: 11px; } .prio i b:nth-child(4) { height: 14px; }
.prio[data-level="1"] { --p: #22c55e; } .prio[data-level="2"] { --p: #3b82f6; } .prio[data-level="3"] { --p: #f59e0b; } .prio[data-level="4"] { --p: #ef4444; color: #be123c; font-weight: 500; }
.prio[data-level="1"] i b:nth-child(-n+1), .prio[data-level="2"] i b:nth-child(-n+2),
.prio[data-level="3"] i b:nth-child(-n+3), .prio[data-level="4"] i b:nth-child(-n+4) { background: var(--p); }
.chip.prio-chip { border-color: transparent; }
.prio-chip[data-level="1"] { background: var(--c-green-bg); color: var(--c-green); } .prio-chip[data-level="2"] { background: #dbeafe; color: #1d4ed8; }
.prio-chip[data-level="3"] { background: var(--c-orange-bg); color: var(--c-orange); } .prio-chip[data-level="4"] { background: var(--c-red-bg); color: var(--c-red); }

/* SLA bars */
.sla { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sla-line { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; }
.sla-bar { height: 7px; border-radius: var(--radius-pill); background: #eceef7; overflow: hidden; display: block; }
.sla-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #4ade80); transition: width 1.1s var(--ease); }
.sla[data-state="warn"] .sla-bar span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sla[data-state="breach"] .sla-bar span, .sla[data-state="missed"] .sla-bar span { background: linear-gradient(90deg, #e11d48, #fb7185); }
.sla[data-state="met"] .sla-bar span { background: linear-gradient(90deg, #0d9488, #2dd4bf); }
.sla[data-state="paused"] .sla-bar span { background: repeating-linear-gradient(135deg, #cbd5e1 0 4px, #e2e8f0 4px 8px); }
.badge-breach { padding: 1px 8px; border-radius: var(--radius-pill); background: #e11d48; color: #fff; font-weight: 500; animation: breathe 1.8s ease-in-out infinite; }
.badge-warn { padding: 0 8px; border-radius: var(--radius-pill); background: var(--c-amber-bg); color: var(--c-amber); font-weight: 500; }

/* ---------- Queue ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: var(--space-4); }
.stat {
  position: relative; overflow: hidden; text-align: left; font: inherit; color: inherit; cursor: pointer; text-decoration: none;
  padding: 22px 24px; border-radius: var(--radius-lg); border: 1px solid rgba(227, 229, 241, .9); background: rgba(255, 255, 255, .94); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .45s var(--spring), box-shadow .35s ease, border-color .3s ease, background-color .3s ease;
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--tone-grad, var(--grad-action)); transform: scaleX(.18); transform-origin: left; transition: transform .5s var(--ease); }
.stat::after { content: ""; position: absolute; right: -50px; top: -50px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(closest-side, var(--tone-bg, #e0e7ff), transparent); opacity: .8; transition: transform .6s var(--ease), opacity .4s ease; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.stat:hover::before { transform: scaleX(1); }
.stat:active { transform: translateY(0) scale(.985); transition-duration: .12s; }
.stat .num { font-size: 42px; line-height: 54px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand-dark); position: relative; z-index: 1; transition: color .3s ease, transform .45s var(--spring); transform-origin: left center; }
.stat > span { position: relative; z-index: 1; }
.stat .stat-icon { position: absolute; z-index: 1; top: 20px; right: 20px; width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--tone-grad, var(--grad-action)); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--tone, #4f46e5) 35%, transparent); transition: transform .5s var(--spring); }
.stat:hover .stat-icon { transform: rotate(-8deg) scale(1.06); }
/* The selected card: coloured ring, full accent line, number in the card's colour */
.stat.is-active { border-color: color-mix(in srgb, var(--tone, var(--action)) 55%, white); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone, var(--action)) 16%, transparent), var(--shadow-lg); background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--tone-bg, #e0e7ff) 45%, white)); }
.stat.is-active::before { transform: scaleX(1); height: 5px; }
.stat.is-active::after { transform: scale(1.5); opacity: 1; }
.stat.is-active .num { color: color-mix(in srgb, var(--tone, var(--action)) 85%, black); transform: scale(1.06); }
.stat.is-active .stat-icon { animation: iconPop .6s var(--spring); }
.stat.is-strong:not(.is-active) { background: linear-gradient(180deg, #fff, #fff5f7); border-color: #fecdd3; }
@keyframes iconPop { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-10deg); } 100% { transform: scale(1) rotate(0); } }
.tone-indigo { --tone: var(--action); --tone-bg: color-mix(in srgb, var(--action) 14%, white); --tone-grad: var(--grad-action); }
.tone-amber { --tone: #f59e0b; --tone-bg: #fef3c7; --tone-grad: linear-gradient(135deg, #f59e0b, #fbbf24); }
.tone-red { --tone: #e11d48; --tone-bg: #ffe4e6; --tone-grad: linear-gradient(135deg, #e11d48, #fb7185); }
.tone-sky { --tone: #0ea5e9; --tone-bg: #e0f2fe; --tone-grad: linear-gradient(135deg, #0284c7, #38bdf8); }
.tone-green { --tone: #16a34a; --tone-bg: #dcfce7; --tone-grad: linear-gradient(135deg, #16a34a, #4ade80); }
.tone-violet { --tone: #7c3aed; --tone-bg: #ede9fe; --tone-grad: linear-gradient(135deg, #7c3aed, #a78bfa); }
.tone-teal { --tone: #0d9488; --tone-bg: #ccfbf1; --tone-grad: linear-gradient(135deg, #0d9488, #2dd4bf); }

.tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; position: relative; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 16px 10px 14px; white-space: nowrap; text-decoration: none; color: var(--ink-muted); font: 500 14px/20px var(--font-sans); transition: color .2s ease; }
.tabs a:hover { color: var(--navy-900); }
.tabs a[aria-current="page"] { color: var(--action); }
.tabs a[aria-current="page"] .count { background: var(--grad-action); color: #fff; }
.tab-ink { position: absolute; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad-action); transition: left .35s var(--ease), width .35s var(--ease); }
.table-scroll { overflow-x: auto; }
.trow { display: grid; grid-template-columns: minmax(260px, 2.4fr) minmax(170px, 1.5fr) minmax(110px, .9fr) minmax(150px, 1.1fr) minmax(180px, 1.5fr); gap: 16px; align-items: center; padding: 16px 26px; min-width: 920px; }
.trow-head { background: var(--surface-raised); padding-top: 11px; padding-bottom: 11px; font: 600 11px/18px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
a.trow { text-decoration: none; color: var(--ink); border-top: 1px solid var(--border); position: relative; transition: background-color .2s ease, transform .2s ease; }
a.trow::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad-action); transform: scaleY(0); transition: transform .25s var(--ease); }
a.trow:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--action) 5%, white), #fff); color: var(--ink); }
a.trow:hover::before { transform: scaleY(1); }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty::before { content: ""; width: 88px; height: 88px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c7d2fe, #e0f2fe 60%, transparent 61%); animation: float 4s ease-in-out infinite; }
#queue-body { transition: opacity .2s ease; }
#queue-body.is-loading { opacity: .35; }
.skeleton { height: 64px; border-top: 1px solid var(--border); background: linear-gradient(90deg, #f3f4fb 25%, #ffffff 50%, #f3f4fb 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* Simple data table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 22px; }
.table th { text-align: left; font: 600 11px/18px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); background: var(--surface-raised); padding: 12px 16px; white-space: nowrap; }
.table td { padding: 13px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr.is-inactive td { color: var(--ink-soft); }
.table tbody tr { transition: background-color .2s ease; }
.table tbody tr:hover { background: color-mix(in srgb, var(--action) 4%, white); }
.table th:first-child, .table td:first-child { padding-left: 26px; }
.table th:last-child, .table td:last-child { padding-right: 26px; }

/* Drag to reorder */
.drag-handle { width: 36px; height: 36px; border-radius: 10px; border: none; background: transparent; color: var(--ink-soft); cursor: grab; display: inline-flex; align-items: center; justify-content: center; touch-action: none; transition: background-color .2s ease, color .2s ease; }
.drag-handle:hover { background: var(--surface-raised); color: var(--action); }
.drag-handle:active { cursor: grabbing; }
[data-sortable] > .is-dragging { position: relative; z-index: 5; background: #fff !important; box-shadow: 0 14px 34px rgba(16, 18, 64, .18); transform: scale(1.01); }
[data-sortable] > .is-dragging td:first-child { border-left: 3px solid var(--action); }
.order-bar { position: fixed; left: 50%; bottom: 24px; z-index: 45; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; border-radius: 18px; background: var(--brand-dark); color: #fff; box-shadow: var(--shadow-lg); transform: translate(-50%, calc(100% + 48px)); visibility: hidden; transition: transform .45s var(--spring), visibility 0s linear .45s; font-size: 14px; }
.order-bar.show { transform: translate(-50%, 0); visibility: visible; transition: transform .45s var(--spring), visibility 0s; }
.order-bar .btn-ghost { color: #c7d2fe; }
.order-bar .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- Ticket ---------- */
.stepper { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.stepper-track { position: absolute; left: 10%; right: 10%; top: 17px; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.stepper-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #16a34a, var(--action)); transition: width 1.1s var(--ease); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.step-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--border); font-weight: 600; color: var(--ink-soft); transition: all .35s var(--spring); }
.step.is-done { color: var(--ink); font-weight: 500; }
.step.is-done .step-dot { background: linear-gradient(135deg, #16a34a, #22c55e); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(22, 163, 74, .3); }
.step.is-current { color: var(--action); font-weight: 600; }
.step.is-current .step-dot { border-color: var(--action); color: var(--action); box-shadow: 0 0 0 6px color-mix(in srgb, var(--action) 14%, transparent); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(180deg, color-mix(in srgb, var(--action) 30%, white), color-mix(in srgb, var(--brand-accent) 20%, white)); border-radius: 2px; }
.entry { position: relative; display: flex; gap: 14px; padding: 18px 22px; border-radius: 18px; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s ease; }
.entry::before { content: ""; position: absolute; left: -21px; top: 26px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid color-mix(in srgb, var(--action) 60%, white); }
.entry:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.entry.is-note { background: #fffbeb; border-color: #fde68a; }
.entry.is-note::before { border-color: #f59e0b; }
.entry.is-customer { border-color: #bae6fd; background: #f6fbff; }
.entry.is-customer::before { border-color: #0ea5e9; }
.entry.is-system { padding-top: 12px; padding-bottom: 12px; background: transparent; border-style: dashed; box-shadow: none; }
.entry.is-system::before { border-color: #cbd5e1; }
.entry-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.file { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; text-decoration: none; background: #fff; transition: border-color .2s ease, transform .2s ease; }
.file:hover { border-color: var(--action); transform: translateY(-1px); }
@media (max-width: 640px) { .timeline { padding-left: 0; } .timeline::before, .entry::before { display: none; } .entry { padding: 14px; gap: 10px; } }
.ring circle.val { transition: stroke-dashoffset 1.2s var(--ease); }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Customer picker */
.picker, .picker .field { position: relative; }
.picker-list { list-style: none; margin: 6px 0 0; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-lg); position: absolute; top: 100%; left: 0; right: 0; z-index: 10; max-height: 320px; overflow-y: auto; animation: popIn .2s var(--spring) both; }
.picker-list button { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: none; border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.picker-list button:hover, .picker-list button.is-active { background: color-mix(in srgb, var(--action) 8%, white); }
.picked { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--action) 8%, white), color-mix(in srgb, var(--brand-accent) 8%, white)); border: 1px solid color-mix(in srgb, var(--action) 18%, white); }

/* ---------- Feedback ---------- */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: flex; align-items: center; gap: 12px; max-width: min(480px, calc(100vw - 32px)); padding: 14px 20px; border-radius: 14px; background: #0b0a3a; color: #fff; font-size: 14px; line-height: 22px; box-shadow: var(--shadow-lg); animation: toastIn .35s var(--spring) both; }
.toast.is-leaving { animation: toastOut .25s ease both; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid #fecdd3; background: #fff1f2; color: #9f1239; font-size: 14px; line-height: 22px; font-weight: 500; }
.alert-soft { border-color: var(--border); background: var(--surface-raised); color: var(--ink); font-weight: 400; }

/* ---------- Field groups ---------- */
.field-group { border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px 18px; background: linear-gradient(180deg, #fbfbff, #fff); }
.field-group-title { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; font: 600 14px/20px var(--font-sans); color: var(--navy-900); }
.field-group-title .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Files ---------- */
.uploader { display: flex; flex-direction: column; gap: 8px; }
.up-list, .file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.up-list:empty, .file-list:empty { display: none; }
.up-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: #fff; animation: slideIn .35s var(--ease) both; }
.up-item .up-name { display: flex; align-items: center; min-width: 0; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; }
.up-item .up-name:focus-within { border-color: var(--action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action) 14%, transparent); }
.up-item .up-name input { border: none; outline: none; font: 500 14px/22px var(--font-sans); color: var(--ink); background: transparent; padding: 0; flex: 0 1 auto; width: 14ch; min-width: 3ch; max-width: 100%; field-sizing: content; }
.up-item .up-name span { font: 500 14px/22px var(--font-sans); color: var(--ink-muted); }
.up-item .up-meta { grid-column: 2; font-size: 12px; color: var(--ink-muted); margin-top: -6px; padding-left: 7px; }
.up-item .up-bar { grid-column: 1 / -1; height: 4px; border-radius: 9999px; background: #eceef7; overflow: hidden; }
.up-item .up-bar span { display: block; height: 100%; width: 0; background: var(--grad-action); transition: width .2s ease; }
.up-item.is-error { border-color: #fecdd3; background: #fff7f8; }
.up-item.is-done .up-bar span { background: #16a34a; }
.up-progress { height: 6px; border-radius: 9999px; background: #eceef7; overflow: hidden; }
.up-progress span { display: block; height: 100%; width: 0; background: var(--grad-action); transition: width .2s ease; }
.file-ext { width: 40px; height: 40px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font: 700 10px/1 var(--font-sans); letter-spacing: .02em; background: var(--c-slate-bg); color: var(--c-slate); }
.ext-pdf { background: #ffe4e6; color: #be123c; } .ext-xlsx, .ext-csv { background: #dcfce7; color: #15803d; } .ext-docx, .ext-txt { background: #dbeafe; color: #1d4ed8; }
.ext-png, .ext-jpg, .ext-jpeg, .ext-gif, .ext-webp { background: #ede9fe; color: #6d28d9; } .ext-zip { background: #fef3c7; color: #b45309; } .ext-pptx { background: #ffedd5; color: #c2410c; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: #fff; transition: background-color .2s ease, opacity .25s ease, transform .25s ease, box-shadow .2s ease; }
.file-row:hover { box-shadow: var(--shadow); }
.file-row.is-removing { opacity: 0; transform: translateX(24px) scale(.98); }
.file-row.is-new { animation: slideIn .45s var(--spring) both; }
@media (max-width: 640px) { .file-row { flex-wrap: wrap; } .file-actions { margin-left: auto; } }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px; border: 2px dashed #c7cbe0; border-radius: 16px; background: #fafbff; cursor: pointer; text-align: center; transition: border-color .2s ease, background-color .2s ease, transform .2s ease; }
.dropzone:hover, .dropzone.is-over { border-color: var(--action); background: color-mix(in srgb, var(--action) 7%, white); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--grad-action); color: #fff; box-shadow: var(--shadow-glow); transition: transform .35s var(--spring); }
.dropzone:hover .dz-icon, .dropzone.is-over .dz-icon { transform: translateY(-3px) scale(1.06); }
.chip.st-ready { background: var(--c-indigo-bg); color: var(--c-indigo); border-color: transparent; }
.chip.st-error { background: var(--c-red-bg); color: var(--c-red); border-color: transparent; }
.chip.st-up { background: var(--c-sky-bg); color: var(--c-sky); border-color: transparent; }
.chip.st-done { background: var(--c-green-bg); color: var(--c-green); border-color: transparent; }

/* ---------- Profile ---------- */
.avatar-editor { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.avatar-drop { position: relative; border-radius: 50%; cursor: pointer; }
.avatar-drop::after { content: "เปลี่ยนรูป"; position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(8, 7, 56, .55); color: #fff; font: 500 13px/1 var(--font-sans); opacity: 0; transition: opacity .2s ease; }
.avatar-drop:hover::after, .avatar-drop.is-over::after { opacity: 1; }
.avatar-drop .avatar { transition: transform .35s var(--spring); }
.avatar-drop:hover .avatar { transform: scale(1.04); }
.profile-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 36px 28px 28px; background: var(--grad-brand); color: #fff; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-hero h1 { background: none; color: #fff; font-size: 28px; line-height: 38px; }
.profile-hero .caption { color: #c7d2fe; }

/* ---------- Plain (sign-in), portal, installer ---------- */
.plain { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--grad-brand); }
.plain-card { width: 100%; max-width: 440px; background: rgba(255, 255, 255, .96); border-radius: 24px; padding: 36px; display: flex; flex-direction: column; gap: 24px; box-shadow: 0 30px 80px rgba(8, 7, 56, .45); animation: popIn .5s var(--spring) both; }
.plain-card .logo { width: 180px; }
.portal-header { border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .97); position: sticky; top: 0; z-index: 20; }
.portal-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.portal-header .portal-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.portal-header img { width: 170px; display: block; }
.portal-main { padding-top: 48px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 48px; }
.portal-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.portal-hero p { font-size: 18px; line-height: 30px; color: var(--ink-muted); max-width: 560px; }
.portal-hero-band { position: relative; overflow: hidden; background: var(--grad-brand); color: #fff; border-radius: 28px; padding: 64px 32px 104px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.portal-hero-band::before, .portal-hero-band::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); animation: float 7s ease-in-out infinite; }
.portal-hero-band::before { width: 240px; height: 240px; left: -60px; top: -80px; }
.portal-hero-band::after { width: 180px; height: 180px; right: -40px; bottom: -60px; animation-delay: -3s; }
.portal-hero-band h1 { background: none; color: #fff; font-size: 42px; line-height: 54px; position: relative; }
.portal-hero-band p { color: #dbeafe; font-size: 18px; line-height: 30px; max-width: 560px; position: relative; }
.portal-hero-band .eyebrow { color: #93c5fd; position: relative; }
.portal-form { align-self: center; width: 100%; max-width: 680px; }
.portal-hero-band + .portal-form { margin-top: -80px; box-shadow: var(--shadow-lg); position: relative; z-index: 2; }
.portal-footer { border-top: 1px solid var(--border); }
.portal-footer .portal-wrap { padding-top: 24px; padding-bottom: 24px; font-size: 12px; color: var(--ink-muted); }
.vsteps { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; gap: 20px; }
.vsteps::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: var(--border); }
.vsteps .fill { position: absolute; left: 17px; top: 18px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #16a34a, var(--action)); height: 0; transition: height 1.2s var(--ease); }
.vstep { position: relative; display: flex; gap: 16px; align-items: flex-start; }
.vstep .step-dot { flex: none; }
.vstep.is-done .step-dot { background: linear-gradient(135deg, #16a34a, #22c55e); border-color: transparent; color: #fff; }
.vstep span.t { padding-top: 6px; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.vstep.is-done span.t { color: var(--ink); font-weight: 500; }
@media (max-width: 640px) {
  .portal-wrap { padding: 0 16px; } .portal-main { padding-top: 24px; gap: 32px; }
  .portal-hero-band { padding: 44px 20px 92px; border-radius: 22px; } .portal-hero-band h1 { font-size: 28px; line-height: 38px; }
  .plain-card { padding: 26px; } h1 { font-size: 26px; line-height: 36px; }
}
.install-progress { position: fixed; inset: 0; z-index: 70; background: rgba(8, 7, 56, .55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.install-progress .vstep.is-done .step-dot, .install-progress .vstep.is-active .step-dot { background: var(--grad-action); border-color: transparent; color: #fff; }
.install-progress .vstep.is-active .step-dot { animation: breathe 1.2s ease-in-out infinite; }
.install-progress .vstep.is-done span.t, .install-progress .vstep.is-active span.t { color: var(--ink); font-weight: 500; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 16px 26px; border-top: 1px solid var(--border); font-size: 14px; }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: growUp .8s var(--ease) both; }

/* SweetAlert2 in the house style */
.swal2-popup { font-family: var(--font-sans) !important; border-radius: 24px !important; color: var(--ink) !important; padding: 28px 24px 24px !important; }
.swal2-title { font-size: 22px !important; font-weight: 600 !important; color: #080738 !important; }
.swal2-html-container { font-size: 15px !important; color: var(--ink-muted) !important; }
.swal2-styled { border-radius: 12px !important; font-weight: 500 !important; font-size: 14px !important; padding: 12px 24px !important; transition: transform .2s ease !important; }
.swal2-styled:hover { transform: translateY(-1px); }
.swal2-styled.swal2-confirm { background: var(--grad-action) !important; box-shadow: var(--shadow-glow) !important; }
.swal2-styled.swal2-confirm.is-danger { background: linear-gradient(135deg, #e11d48, #f43f5e) !important; box-shadow: 0 6px 18px rgba(225, 29, 72, .3) !important; }
.swal2-styled.swal2-cancel { background: #eef1f6 !important; color: #334155 !important; }
.swal2-input, .swal2-textarea { font-family: var(--font-sans) !important; border-radius: 12px !important; font-size: 15px !important; }
.swal2-toast { border-radius: 16px !important; box-shadow: 0 14px 36px rgba(8, 7, 56, .2) !important; }
.swal2-toast .swal2-title { font-size: 15px !important; font-weight: 500 !important; }
.swal2-timer-progress-bar { background: var(--grad-action) !important; }

/* ---------- Motion ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes navIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-6vw, 8vh) scale(1.15); } }
@keyframes gradientShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes pulseRing { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 16%, transparent); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--action) 6%, transparent); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 30%, 70% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.enter { animation: fadeUp .32s var(--ease) both; }
.enter-1 { animation-delay: 30ms; } .enter-2 { animation-delay: 60ms; } .enter-3 { animation-delay: 90ms; } .enter-4 { animation-delay: 120ms; }
.pop { animation: pop .45s var(--spring) both; }
.is-new { animation: slideIn .45s var(--spring) both; }
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Search bars & table tools ---------- */
.searchbar { position: relative; display: flex; align-items: center; flex: 1; max-width: 460px; min-width: 0; }
.searchbar input { width: 100%; height: 46px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: #fff; padding: 0 44px 0 46px; font: 400 15px/22px var(--font-sans); color: var(--ink); transition: border-color .2s ease, box-shadow .2s ease; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbar input:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 15%, transparent); }
.searchbar .sb-icon { position: absolute; left: 16px; color: var(--ink-soft); display: flex; transition: color .2s ease; pointer-events: none; }
.searchbar:focus-within .sb-icon { color: var(--action); }
.searchbar .sb-clear { position: absolute; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--surface-raised); color: var(--ink-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; animation: popIn .2s var(--spring) both; }
.searchbar .sb-clear:hover { background: color-mix(in srgb, var(--action) 12%, white); color: var(--action); }
.searchbar-lg { max-width: none; }
.searchbar-lg input { height: 58px; font-size: 16px; padding-left: 54px; padding-right: 168px; box-shadow: var(--shadow); border-color: var(--border); }
.searchbar-lg .sb-icon { left: 20px; }
.searchbar-lg .sb-clear { right: 128px; }
.searchbar-lg .sb-submit { position: absolute; right: 6px; height: 46px; border-radius: var(--radius-pill); padding: 0 22px; }
@media (max-width: 560px) { .searchbar-lg input { padding-right: 96px; } .searchbar-lg .sb-submit span { display: none; } .searchbar-lg .sb-submit { padding: 0 14px; } .searchbar-lg .sb-clear { right: 60px; } }
.search-hero { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; padding: 26px; border-radius: 24px; background: linear-gradient(135deg, color-mix(in srgb, var(--action) 10%, white), color-mix(in srgb, var(--brand-accent) 10%, white)); border: 1px solid color-mix(in srgb, var(--action) 14%, white); }
.search-hero .searchbar { width: 100%; max-width: 720px; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 26px; border-bottom: 1px solid var(--border); }
.chip-filter { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 26px; border-bottom: 1px solid var(--border); background: var(--surface-raised); }
.chip-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: #fff; font: 500 13px/20px var(--font-sans); color: var(--ink-muted); cursor: pointer; transition: all .25s var(--ease); }
.chip-opt .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip-opt:hover { border-color: var(--action); color: var(--action); }
.chip-opt[aria-pressed="true"] { background: var(--grad-action); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.chip-opt[aria-pressed="true"] .count { background: rgba(255, 255, 255, .25); color: #fff; }
tr.is-filtered-out { display: none; }
.filter-empty td { text-align: center; color: var(--ink-muted); padding: 32px !important; }
.row-actions { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; }
.row-actions form { display: inline-flex; }
.btn-del:hover { color: #e11d48 !important; background: #fff1f2 !important; border-color: #fecdd3 !important; }
mark.hl { background: color-mix(in srgb, #facc15 45%, white); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Searchable select (combobox) ---------- */
.combo { position: relative; }
.combo-btn { width: 100%; min-height: 48px; padding: 12px 40px 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; font: 400 15px/22px var(--font-sans); color: var(--ink); text-align: left; cursor: pointer; display: flex; align-items: center; transition: border-color .2s ease, box-shadow .2s ease; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23565678' stroke-width='1.8' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.combo-btn:hover { border-color: #9a9ec0; }
.combo-btn[aria-expanded="true"], .combo-btn:focus-visible { outline: none; border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 15%, transparent); }
.combo-btn .placeholder { color: var(--ink-soft); }
.combo-panel { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; animation: popIn .2s var(--spring) both; }
.combo-panel .searchbar { max-width: none; margin-bottom: 6px; }
.combo-panel .searchbar input { height: 40px; }
.combo-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.combo-list li { padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; line-height: 20px; display: flex; justify-content: space-between; gap: 8px; }
.combo-list li[aria-selected="true"] { color: var(--action); font-weight: 500; }
.combo-list li[aria-selected="true"]::after { content: "✓"; }
.combo-list li.is-active, .combo-list li:hover { background: color-mix(in srgb, var(--action) 8%, white); }
.combo-list .combo-empty { color: var(--ink-muted); cursor: default; background: none !important; }

/* ---------- Footer ---------- */
.app-footer, .portal-footer .portal-wrap, .plain-footer { text-align: center; }
.app-footer { padding: 8px 24px 32px; font-size: 12px; color: var(--ink-muted); }
.plain-footer { margin-top: 18px; font-size: 12px; color: rgba(255, 255, 255, .8); }
.plain { flex-direction: column; }

/* ---------- Branding preview ---------- */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.preset { border: 2px solid var(--border); border-radius: 16px; padding: 10px; background: #fff; cursor: pointer; text-align: left; font: 500 13px/20px var(--font-sans); color: var(--ink); display: flex; flex-direction: column; gap: 8px; transition: transform .3s var(--spring), border-color .2s ease, box-shadow .2s ease; }
.preset:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.preset[aria-pressed="true"] { border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 14%, transparent); }
.preset .swatch { height: 56px; border-radius: 10px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 48px; height: 48px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 4px; background: #fff; cursor: pointer; flex: none; }
.color-field .input { font-family: ui-monospace, monospace; text-transform: lowercase; }
.brand-preview { border-radius: 20px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--page); }
.bp-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.bp-bar img { height: 26px; width: auto; max-width: 150px; object-fit: contain; }
.bp-body { display: grid; grid-template-columns: 110px 1fr; min-height: 260px; }
.bp-side { background: linear-gradient(180deg, var(--brand-dark), color-mix(in srgb, var(--brand-dark) 70%, var(--action))); padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.bp-side img { width: 88px; height: auto; max-height: 30px; object-fit: contain; margin-bottom: 6px; }
.bp-side span { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .18); }
.bp-side span.on { background: linear-gradient(90deg, color-mix(in srgb, var(--action) 70%, transparent), color-mix(in srgb, var(--brand-accent) 30%, transparent)); }
.bp-main { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.bp-main .bp-title { font: 600 20px/28px var(--font-sans); background: var(--grad-title); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bp-hero { height: 56px; border-radius: 14px; background: var(--grad-brand); }
.file-pick { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 14px; background: #fff; }
.file-pick .thumb { width: 120px; height: 52px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-raised); overflow: hidden; flex: none; }
.file-pick .thumb.dark { background: var(--brand-dark); }
.file-pick .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Smooth, fast page changes ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
.appbar { view-transition-name: appbar; }
::view-transition-group(appbar) { animation: none; }
/* Long lists: let the browser skip work for rows that are off screen */
a.trow { content-visibility: auto; contain-intrinsic-size: auto 72px; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- People (admin/users) ---------- */
.people-filters { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 22px; background: rgba(255, 255, 255, .92); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.role-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.role-tab { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-raised); cursor: pointer; font: 500 14px/20px var(--font-sans); color: var(--ink); text-align: left; transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s var(--spring); }
.role-tab:hover { border-color: color-mix(in srgb, var(--action) 40%, white); transform: translateY(-1px); }
.role-tab .rt-icon { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--action); flex: none; }
.role-tab .rt-label { flex: 1; min-width: 0; }
.role-tab .rt-count { font: 600 18px/1 var(--font-sans); color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.role-tab[aria-pressed="true"] { background: var(--grad-action); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }
.role-tab[aria-pressed="true"] .rt-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.role-tab[aria-pressed="true"] .rt-count { color: #fff; }
.people-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.people-tools .searchbar { max-width: none; flex: 1 1 260px; }
.dept-filter { width: auto; min-width: 200px; flex: 0 1 240px; border-radius: var(--radius-pill); min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
.view-toggle { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 1px solid var(--border); }
.view-toggle button { width: 38px; height: 38px; border-radius: 50%; border: none; background: none; color: var(--ink-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color .2s ease, color .2s ease; }
.view-toggle button[aria-pressed="true"] { background: #fff; color: var(--action); box-shadow: var(--shadow-sm); }

.people { display: grid; gap: 16px; }
.people.is-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.person { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 0 20px 18px; border-radius: 20px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .3s var(--spring), box-shadow .25s ease, opacity .25s ease; }
.person:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.person.tone-violet { --tone: #7c3aed; --tone-bg: #ede9fe; } .person.tone-amber { --tone: #d97706; --tone-bg: #fef3c7; } .person.tone-sky { --tone: #0284c7; --tone-bg: #e0f2fe; }
.person-band { height: 56px; margin: 0 -20px; background: linear-gradient(120deg, var(--tone-bg), color-mix(in srgb, var(--tone-bg) 40%, white)); }
.person-head { display: flex; align-items: flex-end; gap: 12px; margin-top: -40px; }
.person-avatar { position: relative; flex: none; text-decoration: none; }
.person-avatar .avatar { box-shadow: 0 0 0 4px #fff, 0 4px 14px rgba(16, 18, 64, .14); width: 72px; height: 72px; font-size: 24px; }
.presence { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; border: 3px solid #fff; }
.presence.on { background: #22c55e; }
.person-name { flex: 1; padding-bottom: 4px; }
.person-name a { font: 600 16px/24px var(--font-sans); color: var(--brand-dark); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name a:hover { color: var(--action); }
.person-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 2px; padding: 2px; border-radius: 12px; background: rgba(255, 255, 255, .85); box-shadow: var(--shadow-sm); opacity: .85; transition: opacity .2s ease; }
.person:hover .person-actions, .person:focus-within .person-actions { opacity: 1; }
.person-actions form { display: inline-flex; }
.person-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 26px; }
.role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: var(--radius-pill); background: var(--tone-bg); color: color-mix(in srgb, var(--tone) 85%, black); font: 600 12px/18px var(--font-sans); }
.role-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.person-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.person-stats div { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.person-stats div + div { border-left: 1px solid var(--border); }
.person-stats dt { font-size: 11px; line-height: 16px; color: var(--ink-muted); }
.person-stats dd { margin: 0; font: 600 18px/24px var(--font-sans); color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.person-stats dd.small { font: 500 13px/24px var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.person.is-off { background: #fbfbfd; }
.person.is-off .avatar { filter: grayscale(1); opacity: .7; }
.person.is-off .person-band { filter: grayscale(.9); }
.person.is-hidden { display: none; }
.people-empty { grid-column: 1 / -1; }

/* List view: the same cards, laid out as rows */
.people.is-list { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.people.is-list .person { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(200px, 2fr) minmax(250px, 2fr) 170px; align-items: center; gap: 16px; padding: 12px 20px; border: none; border-radius: 0; box-shadow: none; transform: none; }
.people.is-list .person + .person { border-top: 1px solid var(--border); }
.people.is-list .person:hover { background: color-mix(in srgb, var(--action) 4%, white); }
.people.is-list .person-band { display: none; }
.people.is-list .person-head { margin: 0; align-items: center; }
.people.is-list .person-avatar .avatar { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 0 0 2px #fff; }
.people.is-list .presence { width: 12px; height: 12px; border-width: 2px; right: 0; bottom: 0; }
.people.is-list .person-actions { display: none; }
.people.is-list .person-stats { border: none; }
.people.is-list .person-stats div { padding: 0 10px; }
.people.is-list .person-foot { border: none; padding: 0; justify-content: flex-end; }
.people.is-list .person-foot::after { content: ""; }
.people.is-list .person .person-actions { display: flex; position: static; background: none; box-shadow: none; opacity: 1; }
@media (max-width: 900px) { .people.is-list .person { grid-template-columns: 1fr; } .people.is-list .person-foot { justify-content: space-between; } }
