/* ==========================================================================
   NEOX CRM by CodeFier — design system
   Electric blue on charcoal. Dark-first, with a full light theme.
   Tokens → primitives → layout → components → utilities → responsive
   ========================================================================== */

/* ----------------------------------------------------------- 1. Tokens */

:root {
  /* Brand */
  --blue-50:  #eaf1ff;
  --blue-100: #cfe0ff;
  --blue-200: #a3c3ff;
  --blue-300: #6f9cff;
  --blue-400: #4a80ff;
  --blue-500: #2f6bff;   /* primary */
  --blue-600: #1c53e6;
  --blue-700: #1440b4;
  --blue-800: #0f2f82;
  --cyan-400: #22d3ee;
  --cyan-500: #00c2e8;

  /* Semantic */
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .14);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, .14);
  --danger:  #f45b69;
  --danger-soft: rgba(244, 91, 105, .14);
  --info:    #38bdf8;
  --info-soft: rgba(56, 189, 248, .14);
  --purple:  #8b5cf6;
  --purple-soft: rgba(139, 92, 246, .14);
  --teal:    #00c2a8;
  --teal-soft: rgba(0, 194, 168, .14);
  --orange:  #fb923c;
  --orange-soft: rgba(251, 146, 60, .14);
  --primary-soft: rgba(47, 107, 255, .14);
  --muted-soft: rgba(148, 163, 184, .14);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-xs: .6875rem;   /* 11 */
  --fs-sm: .75rem;     /* 12 */
  --fs-md: .8125rem;   /* 13 */
  --fs-base: .875rem;  /* 14 */
  --fs-lg: 1rem;       /* 16 */
  --fs-xl: 1.125rem;   /* 18 */
  --fs-2xl: 1.375rem;  /* 22 */
  --fs-3xl: 1.75rem;   /* 28 */
  --fs-4xl: 2.25rem;   /* 36 */

  /* Spacing scale (4px rhythm) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px;

  /* Radius */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  /* Layout */
  --sidebar-w: 258px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --bottomnav-h: 62px;
  --content-max: 1600px;

  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
  --transition-slow: 320ms cubic-bezier(.4, 0, .2, 1);
}

/* Dark (default) */
:root,
[data-theme='dark'] {
  --bg:            #0b0e15;
  --bg-grad:       radial-gradient(1200px 620px at 12% -8%, rgba(47,107,255,.16), transparent 62%),
                   radial-gradient(900px 520px at 100% 0%, rgba(0,194,232,.10), transparent 58%);
  --surface:       #12161f;
  --surface-2:     #171c28;
  --surface-3:     #1d2331;
  --surface-hover: #1f2635;
  --border:        #252c3b;
  --border-soft:   #1c2230;
  --border-strong: #333d52;

  --text:      #eef2f9;
  --text-2:    #a8b3c7;
  --text-3:    #6f7c93;
  --text-on-brand: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.36);
  --shadow-md: 0 6px 20px rgba(0,0,0,.40);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.52);
  --glow: 0 0 0 3px rgba(47,107,255,.22);

  --sidebar-bg: #0d111a;
  --topbar-bg: rgba(18,22,31,.86);
  --skeleton: linear-gradient(90deg, #171c28 25%, #202839 37%, #171c28 63%);
  color-scheme: dark;
}

/* Light */
[data-theme='light'] {
  --bg:            #f5f7fc;
  --bg-grad:       radial-gradient(1100px 560px at 10% -10%, rgba(47,107,255,.10), transparent 60%),
                   radial-gradient(800px 420px at 100% 0%, rgba(0,194,232,.08), transparent 56%);
  --surface:       #ffffff;
  --surface-2:     #ffffff;
  --surface-3:     #f2f5fb;
  --surface-hover: #eef2fa;
  --border:        #dfe5f0;
  --border-soft:   #eaeff7;
  --border-strong: #c6d0e2;

  --text:      #0d1220;
  --text-2:    #4a556b;
  --text-3:    #7b869c;
  --text-on-brand: #ffffff;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px rgba(16,24,40,.09);
  --shadow-lg: 0 24px 56px rgba(16,24,40,.14);
  --glow: 0 0 0 3px rgba(47,107,255,.18);

  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(255,255,255,.88);
  --skeleton: linear-gradient(90deg, #eef1f7 25%, #f7f9fd 37%, #eef1f7 63%);
  color-scheme: light;
}

/* ----------------------------------------------------------- 2. Base */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 650; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p  { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--blue-400); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-300); }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; opacity: 1; }

::selection { background: var(--blue-500); color: #fff; }

:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ----------------------------------------------------------- 3. Layout */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
  transition: width var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  overflow: hidden;
}
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  background: #0b0e15;
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(11,14,21,.26);
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-weight: 750; font-size: var(--fs-lg); letter-spacing: -.03em; white-space: nowrap; }
.brand-sub  { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-4) var(--sp-3) var(--sp-6); }

.nav-section { margin-bottom: var(--sp-5); }
.nav-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-weight: 600;
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: var(--fs-base);
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--blue-300); font-weight: 600; }
[data-theme='light'] .nav-item.active { color: var(--blue-600); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--blue-500);
}
.nav-item .nav-count {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: var(--fs-xs); font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
}
.nav-item .nav-count.is-quiet { background: var(--muted-soft); color: var(--text-2); }

.sidebar-footer { padding: var(--sp-3); border-top: 1px solid var(--border-soft); flex-shrink: 0; }

.is-collapsed .sidebar .brand-text,
.is-collapsed .sidebar .nav-label,
.is-collapsed .sidebar .nav-item span,
.is-collapsed .sidebar .nav-count,
.is-collapsed .sidebar .user-mini-text { display: none; }
.is-collapsed .sidebar .nav-item { justify-content: center; padding: 10px; }
.is-collapsed .sidebar-brand { justify-content: center; padding: 0; }

.user-mini {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  transition: background var(--transition);
}
.user-mini:hover { background: var(--surface-hover); }
.user-mini-text { min-width: 0; line-height: 1.25; }
.user-mini-name { font-weight: 600; font-size: var(--fs-md); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-role { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }

/* --- Main column --- */
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-6);
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.icon-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-2);
  display: grid; place-items: center;
  font-size: 1.05rem;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.has-dot::after {
  content: ''; position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}

.topbar-search { position: relative; flex: 1; max-width: 460px; }
.topbar-search i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: .95rem; pointer-events: none;
}
.topbar-search input {
  width: 100%; height: 40px;
  padding: 0 var(--sp-4) 0 38px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-base);
  font-family: inherit;
  transition: all var(--transition);
}
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search input:focus { outline: 2px solid transparent; outline-offset: 2px; border-color: var(--blue-500); box-shadow: var(--glow); background: var(--surface); }

.topbar-spacer { flex: 1; }

.page-body {
  flex: 1;
  padding: var(--sp-6);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  min-width: 0;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.page-title h1 { font-size: var(--fs-3xl); line-height: 1.2; }
.page-title .sub { color: var(--text-3); font-size: var(--fs-base); }
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.breadcrumb-mini { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 2px; }
.breadcrumb-mini a { color: var(--text-3); }
.breadcrumb-mini a:hover { color: var(--blue-400); }

/* ----------------------------------------------------------- 4. Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: var(--sp-4); }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  min-height: 58px;
  flex-wrap: wrap;
}
.card-head h3, .card-head h2 { font-size: var(--fs-lg); font-weight: 650; }
.card-head .sub { font-size: var(--fs-sm); color: var(--text-3); font-weight: 400; }
.card-body { padding: var(--sp-5); }
.card-body.tight { padding: var(--sp-4); }
.card-body.flush { padding: 0; }
.card-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border-soft); background: var(--surface-3); }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent, var(--blue-500)), transparent);
  opacity: .9;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.stat-label { font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: .06em; }
.stat-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: 1.1rem;
  background: var(--accent-soft, var(--primary-soft)); color: var(--accent, var(--blue-400));
  flex-shrink: 0;
}
.stat-value { font-size: var(--fs-3xl); font-weight: 720; letter-spacing: -.03em; line-height: 1.1; }
.stat-meta { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--text-3); }

/* Layout grids */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.grid-side-main { grid-template-columns: 320px minmax(0, 1fr); }

/* ----------------------------------------------------------- 5. Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 var(--sp-4);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: inherit; font-size: var(--fs-base); font-weight: 600;
  line-height: 1; white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn i { font-size: 1rem; }

.btn-primary { background: var(--blue-500); color: #fff; box-shadow: 0 2px 10px rgba(47,107,255,.32); }
.btn-primary:hover { background: var(--blue-600); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(47,107,255,.42); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

.btn-soft { background: var(--primary-soft); color: var(--blue-400); }
.btn-soft:hover { background: var(--blue-500); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }

.btn-success { background: var(--success); color: #04210f; }
.btn-success:hover { filter: brightness(1.06); color: #04210f; }

.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-md); }
.btn-xs { height: 27px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.btn-lg { height: 46px; padding: 0 var(--sp-6); font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 27px; }

.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.btn-group .btn { border-radius: 0; border: 0; border-right: 1px solid var(--border); height: 34px; }
.btn-group .btn:last-child { border-right: 0; }
.btn-group .btn.active { background: var(--primary-soft); color: var(--blue-400); }

/* ----------------------------------------------------------- 6. Forms */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }

.label {
  font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.label .req { color: var(--danger); }
.hint { font-size: var(--fs-sm); color: var(--text-3); }
.err { font-size: var(--fs-sm); color: var(--danger); display: flex; align-items: center; gap: 4px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid transparent; outline-offset: 2px; border-color: var(--blue-500); background: var(--surface); box-shadow: var(--glow);
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .6; cursor: not-allowed; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236f7c93' d='M6 8 0 1.4 1.4 0 6 4.8 10.6 0 12 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
}

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .addon {
  display: grid; place-items: center; padding: 0 var(--sp-3);
  background: var(--surface-hover); border: 1px solid var(--border); border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-3); font-size: var(--fs-md); font-weight: 600;
  white-space: nowrap;
}

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: var(--fs-base); color: var(--text-2); }
.check input[type='checkbox'], .check input[type='radio'] {
  width: 17px; height: 17px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--blue-500); cursor: pointer;
}

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-strong); border-radius: var(--r-full);
  transition: var(--transition);
}
.switch .slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: var(--transition);
}
.switch input:checked + .slider { background: var(--blue-500); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-3);
}
.file-drop:hover, .file-drop.dragover { border-color: var(--blue-500); background: var(--primary-soft); color: var(--blue-300); }
.file-drop i { font-size: 1.7rem; display: block; margin-bottom: var(--sp-2); }

/* ----------------------------------------------------------- 7. Chips & badges */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.chip i { font-size: .8rem; }
.chip-primary { background: var(--primary-soft); color: var(--blue-400); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger  { background: var(--danger-soft);  color: var(--danger); }
.chip-info    { background: var(--info-soft);    color: var(--info); }
.chip-purple  { background: var(--purple-soft);  color: var(--purple); }
.chip-teal    { background: var(--teal-soft);    color: var(--teal); }
.chip-orange  { background: var(--orange-soft);  color: var(--orange); }
.chip-muted   { background: var(--muted-soft);   color: var(--text-3); }
[data-theme='light'] .chip-primary { color: var(--blue-600); }

.pill-tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: var(--r-md); overflow-x: auto; }
.pill-tabs a, .pill-tabs button {
  padding: 7px var(--sp-4); border-radius: var(--r-sm);
  font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
}
.pill-tabs a:hover, .pill-tabs button:hover { color: var(--text); background: var(--surface-hover); }
.pill-tabs a.active, .pill-tabs button.active { background: var(--surface); color: var(--blue-400); box-shadow: var(--shadow-sm); }

/* Avatars */
.avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: var(--fs-md); font-weight: 700; color: #fff;
  object-fit: cover;
  letter-spacing: -.02em;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: var(--fs-xs); }
.avatar-sm { width: 30px; height: 30px; font-size: var(--fs-xs); }
.avatar-lg { width: 52px; height: 52px; font-size: var(--fs-lg); }
.avatar-xl { width: 84px; height: 84px; font-size: var(--fs-2xl); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.user-cell { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.user-cell-text { min-width: 0; line-height: 1.3; }
.user-cell-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-cell-sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----------------------------------------------------------- 8. Tables */

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }
.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--blue-400); }
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text-2);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td strong, .table td .strong { color: var(--text); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }
.table-fixed { table-layout: fixed; }
.table tr.is-clickable { cursor: pointer; }

.table-compact td, .table-compact th { padding: 9px var(--sp-3); }

/* ----------------------------------------------------------- 9. Filters */

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
}
.filter-item { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1 1 150px; }
.filter-item.grow { flex: 2 1 220px; }
.filter-item .label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.filter-item .input, .filter-item .select { height: 36px; min-height: 36px; font-size: var(--fs-md); }
.filter-actions { display: flex; gap: var(--sp-2); align-items: center; flex-shrink: 0; }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-4); }
.active-filters .chip a { color: inherit; opacity: .7; display: inline-flex; }
.active-filters .chip a:hover { opacity: 1; }

/* ----------------------------------------------------------- 10. Kanban */

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(288px, 1fr);
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  align-items: start;
}
.kanban-col {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 260px);
  min-height: 200px;
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: var(--surface-3); z-index: 2;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.kanban-col-title { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: var(--fs-md); }
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-count { background: var(--surface); color: var(--text-3); font-size: var(--fs-xs); font-weight: 700; padding: 2px 7px; border-radius: var(--r-full); }
.kanban-total { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.kanban-body { padding: var(--sp-3); overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.kanban-body.is-over { background: var(--primary-soft); border-radius: var(--r-md); }

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  cursor: grab;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); }
.kanban-card-title { font-weight: 600; color: var(--text); margin-bottom: 5px; line-height: 1.35; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-3); }
.kanban-value { font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- 11. Timeline */

.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: var(--sp-5); }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -30px; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border);
  font-size: .68rem; color: var(--text-3);
  z-index: 1;
}
.tl-dot.is-primary { border-color: var(--blue-500); color: var(--blue-400); background: var(--primary-soft); }
.tl-dot.is-success { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.tl-dot.is-danger  { border-color: var(--danger);  color: var(--danger);  background: var(--danger-soft); }
.tl-dot.is-warning { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.tl-head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.tl-title { font-weight: 600; color: var(--text); }
.tl-time { font-size: var(--fs-sm); color: var(--text-3); }
.tl-body { font-size: var(--fs-md); color: var(--text-2); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* ----------------------------------------------------------- 12. Progress */

.progress-track { height: 7px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--blue-500), var(--cyan-500));
  transition: width var(--transition-slow);
}
.progress-fill.is-success { background: linear-gradient(90deg, var(--success), #4ade80); }
.progress-fill.is-warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.is-danger  { background: linear-gradient(90deg, var(--danger), #fb7185); }
.progress-lg { height: 11px; }
.progress-xs { height: 4px; }

.ring { --p: 0; --size: 96px; --thick: 9px; width: var(--size); height: var(--size); position: relative; flex-shrink: 0; }
.ring::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--blue-500)) calc(var(--p) * 1%), var(--surface-3) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
}
.ring-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 720; font-size: var(--fs-lg); letter-spacing: -.02em;
}

/* ----------------------------------------------------------- 13. Empty & skeleton */

.empty { text-align: center; padding: var(--sp-9) var(--sp-5); color: var(--text-3); }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface-3); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 1.6rem; color: var(--text-3);
}
.empty h4 { color: var(--text-2); margin-bottom: 5px; font-size: var(--fs-lg); }
.empty p { font-size: var(--fs-base); max-width: 380px; margin: 0 auto var(--sp-4); }

.skeleton { background: var(--skeleton); background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--r-xs); }
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-line.short { width: 55%; }
.sk-card { height: 108px; border-radius: var(--r-lg); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Global route loading bar */
#neox-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--blue-500), var(--cyan-400));
  z-index: 9999; opacity: 0; transition: width 220ms ease, opacity 220ms ease;
  box-shadow: 0 0 12px rgba(47,107,255,.7);
}
#neox-progress.active { opacity: 1; }

.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin .7s linear infinite;
}
.spinner-lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.5); border-right-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ----------------------------------------------------------- 14. Toasts */

.toast-stack {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5);
  z-index: 1200; display: flex; flex-direction: column; gap: var(--sp-2);
  max-width: min(380px, calc(100vw - 32px));
}
.toast-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue-500);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
  font-size: var(--fs-base);
}
.toast-item.is-success { border-left-color: var(--success); }
.toast-item.is-danger  { border-left-color: var(--danger); }
.toast-item.is-warning { border-left-color: var(--warning); }
.toast-item .ti-icon { font-size: 1.05rem; margin-top: 1px; }
.toast-item.is-success .ti-icon { color: var(--success); }
.toast-item.is-danger  .ti-icon { color: var(--danger); }
.toast-item.is-warning .ti-icon { color: var(--warning); }
.toast-item.is-info    .ti-icon { color: var(--info); }
.toast-item .ti-body { flex: 1; min-width: 0; color: var(--text); word-break: break-word; }
.toast-item .ti-close { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; }
.toast-item.leaving { animation: toastOut .22s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(28px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(28px) scale(.96); } }

/* ----------------------------------------------------------- 15. Dropdowns & modals */

.dropdown { position: relative; }
.dropdown-menu-neox {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  display: none;
  animation: ddIn .16s ease;
}
.dropdown-menu-neox.show { display: block; }
.dropdown-menu-neox.left { right: auto; left: 0; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dd-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px 10px; border-radius: var(--r-xs);
  color: var(--text-2); font-size: var(--fs-base); width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.dd-item:hover { background: var(--surface-hover); color: var(--text); }
.dd-item.is-danger { color: var(--danger); }
.dd-item.is-danger:hover { background: var(--danger-soft); }
.dd-divider { height: 1px; background: var(--border-soft); margin: 5px 0; }
.dd-head { padding: 8px 10px 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 650; }

.modal-backdrop-neox {
  position: fixed; inset: 0; background: rgba(4, 7, 14, .68);
  backdrop-filter: blur(3px); z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: var(--sp-4);
  overflow-y: auto;
}
.modal-backdrop-neox.show { display: flex; animation: fadeIn .18s ease; }
.modal-neox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: modalIn .24s cubic-bezier(.2,.9,.3,1.05);
  margin: auto;
}
.modal-neox.wide { max-width: 860px; }
.modal-neox.narrow { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
}
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-soft); flex-shrink: 0;
  flex-wrap: wrap;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------- 16. Chat */

.chat-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - var(--sp-6) * 2);
  min-height: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: var(--sp-4); border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.chat-list-scroll { overflow-y: auto; flex: 1; }
.chat-person {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer; transition: background var(--transition);
}
.chat-person:hover { background: var(--surface-hover); }
.chat-person.active { background: var(--primary-soft); border-left: 3px solid var(--blue-500); padding-left: calc(var(--sp-4) - 3px); }
.chat-person-text { flex: 1; min-width: 0; }
.chat-person-name { font-weight: 600; font-size: var(--fs-base); color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-person-last { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread { background: var(--blue-500); color: #fff; font-size: var(--fs-xs); font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); display: grid; place-items: center; }

.chat-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.msg-row { display: flex; gap: var(--sp-2); max-width: 74%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  padding: 9px var(--sp-3);
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  font-size: var(--fs-base);
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
}
.msg-row.mine .msg-bubble {
  background: var(--blue-500); border-color: var(--blue-500); color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.msg-time { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; display: block; }
.msg-row.mine .msg-time { text-align: right; }
.msg-day { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin: var(--sp-2) 0; text-transform: uppercase; letter-spacing: .07em; }
.chat-compose { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-soft); flex-shrink: 0; }
.chat-compose .textarea { min-height: 42px; max-height: 130px; resize: none; }

/* ----------------------------------------------------------- 17. Video player */

.video-shell { background: #000; border-radius: var(--r-lg); overflow: hidden; position: relative; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-shield { position: absolute; inset: 0; cursor: pointer; }

.vp-controls {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(180deg, #0f131c, #0a0d14);
  color: #e9eefb;
  flex-wrap: wrap;
}
.vp-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 0; color: #fff;
  display: grid; place-items: center; cursor: pointer; font-size: 1.05rem;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.vp-btn:hover { background: var(--blue-500); transform: scale(1.06); }
.vp-btn.primary { width: 46px; height: 46px; background: var(--blue-500); font-size: 1.2rem; }
.vp-bar { flex: 1; min-width: 140px; height: 6px; background: rgba(255,255,255,.16); border-radius: var(--r-full); cursor: pointer; position: relative; }
.vp-bar-fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--blue-500), var(--cyan-400)); width: 0; transition: width .25s linear; }
.vp-bar-knob {
  position: absolute; top: 50%; transform: translate(-50%, -50%); left: 0;
  width: 13px; height: 13px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.5); opacity: 0; transition: opacity var(--transition);
}
.vp-bar:hover .vp-bar-knob { opacity: 1; }
.vp-time { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: #b9c4da; white-space: nowrap; }
.vp-spacer { flex: 1; }
.vp-rate { background: rgba(255,255,255,.08); border: 0; color: #fff; border-radius: var(--r-xs); padding: 5px 9px; font-size: var(--fs-sm); cursor: pointer; font-weight: 600; }

.lesson-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.lesson-item:hover { background: var(--surface-hover); }
.lesson-item.active { background: var(--primary-soft); }
.lesson-num {
  width: 27px; height: 27px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-3); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 700; color: var(--text-3);
}
.lesson-item.done .lesson-num { background: var(--success-soft); border-color: var(--success); color: var(--success); }

/* ----------------------------------------------------------- 18. Reward card */

.reward-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(3, 6, 12, .8); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: var(--sp-4);
}
.reward-backdrop.show { display: flex; animation: fadeIn .25s ease; }
.reward-card {
  position: relative;
  width: 100%; max-width: 380px;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 70px rgba(47,107,255,.28);
  animation: rewardPop .55s cubic-bezier(.18,.9,.3,1.3);
  overflow: hidden;
}
.reward-card::before {
  content: ''; position: absolute; top: -55%; left: -55%; width: 210%; height: 210%;
  background: conic-gradient(from 0deg, transparent, rgba(47,107,255,.18), transparent 30%);
  animation: rewardSpin 5s linear infinite;
}
.reward-inner { position: relative; z-index: 1; }
@keyframes rewardSpin { to { transform: rotate(360deg); } }
@keyframes rewardPop { 0% { opacity: 0; transform: scale(.7) translateY(28px); } 100% { opacity: 1; transform: none; } }

.reward-medal {
  width: 104px; height: 104px; margin: 0 auto var(--sp-4);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2.6rem; color: #fff;
  background: linear-gradient(140deg, var(--blue-500), var(--cyan-500));
  box-shadow: 0 12px 38px rgba(47,107,255,.5);
  animation: medalFloat 2.6s ease-in-out infinite;
}
@keyframes medalFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.reward-kicker { font-size: var(--fs-sm); letter-spacing: .16em; text-transform: uppercase; color: var(--blue-400); font-weight: 700; }
.reward-title { font-size: var(--fs-2xl); margin: var(--sp-2) 0 var(--sp-1); }
.reward-desc { color: var(--text-2); font-size: var(--fs-base); margin-bottom: var(--sp-4); }
.reward-points {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--success-soft); color: var(--success);
  padding: 6px var(--sp-4); border-radius: var(--r-full);
  font-weight: 700; margin-bottom: var(--sp-5);
}

.confetti-piece {
  position: fixed; width: 9px; height: 15px; top: -20px;
  z-index: 1299; pointer-events: none; opacity: .95;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(760deg); opacity: 0; }
}

/* Badge tiles */
.badge-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: var(--sp-4) var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
  transition: transform var(--transition), border-color var(--transition);
}
.badge-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.badge-tile.locked { opacity: .42; filter: grayscale(1); }
.badge-medal {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.4rem; color: #fff;
  flex-shrink: 0;
}
.badge-tile-name { font-size: var(--fs-md); font-weight: 650; color: var(--text); line-height: 1.3; }
.badge-tile-desc { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.4; }

/* Leaderboard */
.lb-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.lb-row:hover { background: var(--surface-hover); }
.lb-row.is-me { background: var(--primary-soft); }
.lb-rank {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0;
  display: grid; place-items: center; font-weight: 750; font-size: var(--fs-md);
  background: var(--surface-3); color: var(--text-3);
}
.lb-rank.gold   { background: linear-gradient(135deg, #f5c451, #e0a020); color: #3a2600; }
.lb-rank.silver { background: linear-gradient(135deg, #dfe6ef, #b3bfd0); color: #2b3340; }
.lb-rank.bronze { background: linear-gradient(135deg, #e0a274, #bd7c48); color: #3a2003; }

/* ----------------------------------------------------------- 19. Auth page */

.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: 1fr 1fr;
}
.auth-aside {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #0a1330 0%, #0b1b4d 42%, #061024 100%);
  color: #fff;
  padding: var(--sp-9) var(--sp-8);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::before {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(47,107,255,.42), transparent 68%);
  top: -180px; right: -200px;
}
.auth-aside::after {
  content: ''; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,194,232,.28), transparent 68%);
  bottom: -170px; left: -140px;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-headline { font-size: clamp(1.9rem, 3vw, 2.7rem); line-height: 1.16; font-weight: 750; letter-spacing: -.03em; color: #fff; }
.auth-sub { color: rgba(226,235,255,.78); font-size: var(--fs-lg); margin-top: var(--sp-4); max-width: 430px; }
.auth-points { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-7); }
.auth-point { display: flex; align-items: flex-start; gap: var(--sp-3); color: rgba(226,235,255,.9); font-size: var(--fs-base); }
.auth-point i { color: var(--cyan-400); font-size: 1.05rem; margin-top: 1px; }

.auth-main { display: grid; place-items: center; padding: var(--sp-6); background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-session-note{display:inline-flex;align-items:center;gap:7px;color:var(--text-3);font-size:var(--fs-sm)}
.auth-session-note i{color:var(--success)}
.auth-method-divider{display:flex;align-items:center;gap:12px;margin:18px 0;color:var(--text-3);font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.06em}
.auth-method-divider::before,.auth-method-divider::after{content:"";height:1px;flex:1;background:var(--border)}
.auth-biometric-btn{height:auto;min-height:54px;gap:12px;text-align:left}
.auth-biometric-btn>i{font-size:1.45rem;color:var(--blue-500)}
.auth-biometric-btn>span{display:grid;gap:1px;line-height:1.25}
.auth-biometric-btn strong{font-size:var(--fs-md)}
.auth-biometric-btn small{color:var(--text-3);font-size:var(--fs-xs);font-weight:500}
.auth-logo { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-7); }

.demo-accounts { margin-top: var(--sp-5); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.demo-account {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: 9px var(--sp-3); border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border);
  cursor: pointer; margin-bottom: 6px; text-align: left;
  transition: all var(--transition); color: var(--text-2); font-family: inherit;
}
.demo-account:hover { border-color: var(--blue-500); background: var(--primary-soft); color: var(--text); }
.demo-account-text { flex: 1; min-width: 0; }
.demo-account-role { font-weight: 650; font-size: var(--fs-md); color: var(--text); }
.demo-account-mail { font-size: var(--fs-xs); color: var(--text-3); }

/* ----------------------------------------------------------- 20. Misc components */

.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 9px var(--sp-3); font-size: var(--fs-base); }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); font-weight: 550; word-break: break-word; }

.section-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: var(--sp-3);
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.alert {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-3);
  font-size: var(--fs-base);
  color: var(--text-2);
}
.alert i { font-size: 1.05rem; margin-top: 1px; flex-shrink: 0; }
.alert-info    { background: var(--info-soft);    border-color: transparent; color: var(--info); }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert-danger  { background: var(--danger-soft);  border-color: transparent; color: var(--danger); }

.pagination-neox { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); }
.pagination-info { font-size: var(--fs-md); color: var(--text-3); }
.pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-links a, .pagination-links span {
  min-width: 33px; height: 33px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); border: 1px solid var(--border);
  font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  transition: all var(--transition);
}
.pagination-links a:hover { border-color: var(--blue-500); color: var(--blue-400); background: var(--primary-soft); }
.pagination-links .current { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.pagination-links .disabled { opacity: .4; pointer-events: none; }

.tooltip-host { position: relative; }
.tooltip-host[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
  padding: 5px 9px; border-radius: var(--r-xs); font-size: var(--fs-sm); white-space: nowrap;
  box-shadow: var(--shadow-md); z-index: 300; pointer-events: none;
}

.stat-line { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.stat-line:last-child { border-bottom: 0; }
.stat-line-label { color: var(--text-2); font-size: var(--fs-base); display: flex; align-items: center; gap: 7px; min-width: 0; }
.stat-line-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.chart-box { position: relative; width: 100%; }
.chart-box canvas { max-width: 100%; }

.mono { font-family: var(--font-mono); font-size: .92em; }
.ref-tag {
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-3);
  background: var(--surface-3); padding: 2px 7px; border-radius: var(--r-xs); border: 1px solid var(--border-soft);
  white-space: nowrap;
}

/* Mobile bottom navigation */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.bottom-nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--bottomnav-h); }
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; position: relative;
}
.bn-item i { font-size: 1.24rem; }
.bn-item.active { color: var(--blue-400); }
.bn-item .bn-dot { position: absolute; top: 9px; right: 50%; margin-right: -14px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }

.sidebar-scrim {
  position: fixed; inset: 0; background: rgba(4,7,14,.6); z-index: 55;
  display: none; backdrop-filter: blur(2px);
}
.sidebar-scrim.show { display: block; animation: fadeIn .18s ease; }

/* PWA install prompt */
.install-banner {
  position: fixed; left: var(--sp-4); right: var(--sp-4); bottom: calc(var(--bottomnav-h) + 12px);
  z-index: 900; display: none; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 12px;
  max-width: 620px; margin: 0 auto; padding: 14px;
  background: #fff; border: 1px solid rgba(47,107,255,.2);
  border-radius: 18px; box-shadow: 0 20px 55px rgba(15,30,65,.22); backdrop-filter: blur(18px);
}
.install-banner.show { display: grid; animation: toastIn .3s ease; }
.install-banner-logo { width: 54px; height: 54px; border-radius: 15px; box-shadow: 0 8px 18px rgba(15,23,42,.2); }
.install-banner-copy { min-width: 0; display: grid; gap: 1px; }
.install-banner-kicker { color: var(--blue-600); font-size: .57rem; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; }
.install-banner-copy strong { font-size: .87rem; }
.install-banner-copy small { color: var(--text-3); font-size: .66rem; line-height: 1.35; }
.install-banner-actions { display: flex; align-items: center; gap: 6px; }

@media (max-width: 600px) {
  .install-banner { grid-template-columns: 48px minmax(0,1fr); left: 10px; right: 10px; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 9px); gap: 10px; padding: 12px; border-radius: 17px; }
  .install-banner-logo { width: 48px; height: 48px; border-radius: 14px; }
  .install-banner-actions { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0,1fr); }
  .install-banner-actions .btn { min-height: 42px; justify-content: center; }
}

/* ----------------------------------------------------------- 21. Utilities */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); } .mt-7 { margin-top: var(--sp-7); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0; } .p-3 { padding: var(--sp-3); } .p-4 { padding: var(--sp-4); } .p-5 { padding: var(--sp-5); }

.text-xs { font-size: var(--fs-xs); } .text-sm { font-size: var(--fs-sm); } .text-md { font-size: var(--fs-md); }
.text-lg { font-size: var(--fs-lg); } .text-xl { font-size: var(--fs-xl); } .text-2xl { font-size: var(--fs-2xl); }
.text-muted { color: var(--text-3); }
.text-dim { color: var(--text-2); }
.text-success { color: var(--success); } .text-danger { color: var(--danger); }
.text-warning { color: var(--warning); } .text-primary { color: var(--blue-400); }
.text-center { text-align: center; } .text-right { text-align: right; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.pointer { cursor: pointer; }
.divider { height: 1px; background: var(--border-soft); margin: var(--sp-4) 0; }
.scroll-y { overflow-y: auto; }
.no-print { }

/* ----------------------------------------------------------- 22. Responsive */

@media (max-width: 1400px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side, .grid-side-main { grid-template-columns: minmax(0, 1fr); }
  .chat-shell { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (max-width: 992px) {
  :root { --sidebar-w: 262px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-shell.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .is-collapsed .sidebar .brand-text,
  .is-collapsed .sidebar .nav-label,
  .is-collapsed .sidebar .nav-item span,
  .is-collapsed .sidebar .nav-count,
  .is-collapsed .sidebar .user-mini-text { display: revert; }
  .is-collapsed .sidebar .nav-item { justify-content: flex-start; padding: 9px var(--sp-3); }
  .is-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 var(--sp-5); }

  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-body { padding: var(--sp-4) var(--sp-4) calc(var(--bottomnav-h) + var(--sp-6)); }
  .bottom-nav { display: block; }
  .toast-stack { bottom: calc(var(--bottomnav-h) + var(--sp-3)); right: var(--sp-3); left: var(--sp-3); }
  .chat-shell { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - var(--bottomnav-h) - var(--sp-6)); }
  .chat-shell .chat-list { display: none; }
  .chat-shell.show-list .chat-list { display: flex; }
  .chat-shell.show-list .chat-panel { display: none; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 58px; }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .topbar-search { max-width: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .page-title h1 { font-size: var(--fs-2xl); }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
  .stat-card { padding: var(--sp-4); }
  .stat-value { font-size: var(--fs-2xl); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card-body { padding: var(--sp-4); }
  .card-head { padding: var(--sp-3) var(--sp-4); }
  .modal-neox { max-height: calc(100dvh - 24px); }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .msg-row { max-width: 88%; }
  .kanban { grid-auto-columns: 84vw; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px var(--sp-2); }
  .kv dt { margin-top: var(--sp-2); }
  .filter-item { flex: 1 1 100%; min-width: 0; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
}

@media (max-width: 576px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-body { padding: var(--sp-3) var(--sp-3) calc(var(--bottomnav-h) + var(--sp-6)); }
  .table th, .table td { padding: 10px var(--sp-3); }
  .ring { --size: 78px; --thick: 8px; }
}

@media (max-width: 400px) {
  .stat-grid, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Wide screens keep content from stretching uncomfortably */
@media (min-width: 1900px) {
  .page-body { padding: var(--sp-7) var(--sp-8); }
}

/* ----------------------------------------------------------- 23. Motion & print */

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

@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .toast-stack, .no-print, .install-banner { display: none !important; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  body { background: #fff; color: #000; }
  .card { border-color: #ddd; box-shadow: none; break-inside: avoid; }
  .page-body { padding: 0; max-width: none; }
  a { color: #000; text-decoration: none; }
}


/* ===== NEOX 2026 precision polish: auth, booking, privacy, resilient layout ===== */
:where(.page-head,.card-head,.filter-bar,.page-actions,.flex){min-width:0}
:where(.page-title,.card-head>div,.user-cell-text,.flex-1){min-width:0}
:where(.page-title h1,.card h1,.card h2,.card h3,.user-cell-name,.text-muted){overflow-wrap:anywhere}
.page-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.auth-card{width:min(100%,460px)}
.auth-help-link{font-size:.875rem;font-weight:650;text-decoration:none;color:var(--blue-400);white-space:nowrap}
.auth-help-link:hover{text-decoration:underline}
.auth-page-focused{min-height:100dvh;display:block;background:radial-gradient(circle at 50% 15%,var(--primary-soft),transparent 34%),var(--bg)}
.auth-main-centered{min-height:100dvh;display:grid;place-items:center;padding:clamp(20px,5vw,56px)}
.auth-card-focused{background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:clamp(24px,4vw,36px);box-shadow:var(--shadow-lg)}
.auth-back{display:inline-flex;align-items:center;gap:8px;text-decoration:none;color:var(--text-3);font-size:.875rem;font-weight:650;margin-bottom:28px}
.auth-back:hover{color:var(--text)}
.auth-reset-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--primary-soft);color:var(--blue-400);font-size:1.15rem;margin-bottom:18px}
.auth-otp{font-size:1.35rem;letter-spacing:.34em;font-variant-numeric:tabular-nums;font-weight:700;text-align:center}
.auth-security-note{display:flex;gap:10px;align-items:flex-start;margin-top:18px;padding:12px 14px;border:1px solid var(--border);border-radius:12px;color:var(--text-3);font-size:.78rem;line-height:1.5}
.auth-security-note i{margin-top:2px;color:var(--success)}
.booking-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(270px,320px);gap:20px;align-items:start}
.booking-primary{overflow:hidden}
.booking-card-head{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap}
.section-kicker{display:block;margin-bottom:5px;color:var(--blue-400);font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.calendly-frame-wrap{position:relative;min-height:690px;background:var(--surface-2);border-top:1px solid var(--border);overflow:hidden}
.calendly-frame{display:block;width:100%;height:690px;border:0;background:#fff}
.calendly-loader{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;gap:10px;color:var(--text-3);background:var(--surface-2)}
.calendly-loader[hidden]{display:none}
.booking-settings-card{position:sticky;top:86px}
.booking-settings-card .input{overflow:hidden;text-overflow:ellipsis}
.manual-meeting-panel{border:1px solid var(--border);border-radius:16px;background:var(--surface);overflow:hidden}
.manual-meeting-panel>summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 18px;min-height:58px;transition:background .16s ease}
.manual-meeting-panel>summary::-webkit-details-marker{display:none}
.manual-meeting-panel>summary:hover{background:var(--surface-2)}
.manual-meeting-panel>summary>span{display:flex;align-items:center;gap:10px;min-width:0}
.manual-meeting-panel>summary small{color:var(--text-3);font-weight:400}
.manual-meeting-panel[open] .manual-chevron{transform:rotate(180deg)}
.manual-chevron{transition:transform .16s ease}
.manual-meeting-body{padding:20px;border-top:1px solid var(--border)}
.privacy-banner{display:flex;gap:12px;align-items:flex-start;padding:15px 16px;border:1px solid var(--border);border-radius:14px;background:var(--surface-2)}
.privacy-banner>i{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--primary-soft);color:var(--blue-400);flex:0 0 auto}
.privacy-banner strong,.privacy-banner span{display:block}.privacy-banner span{margin-top:2px;color:var(--text-3);font-size:.83rem;line-height:1.5}
.btn,.input,.select,.icon-btn{transition:border-color .15s ease,box-shadow .15s ease,background .15s ease,color .15s ease,transform .1s ease}
:where(.btn,.input,.select,.icon-btn,a):focus-visible{outline:2px solid var(--blue-500);outline-offset:2px}
.table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain}
.card,.stat-card{min-width:0}
@media (max-width:1024px){.booking-workspace{grid-template-columns:minmax(0,1fr)}.booking-settings-card{position:static}.calendly-frame-wrap,.calendly-frame{min-height:650px;height:650px}}
@media (max-width:782px){.page-actions{justify-content:flex-start}.booking-card-head{align-items:stretch}.booking-card-head .btn{width:100%}.manual-meeting-panel>summary>span{align-items:flex-start;flex-wrap:wrap}.manual-meeting-panel>summary small{flex-basis:100%;padding-left:26px}}
@media (max-width:600px){.auth-main-centered{padding:16px}.auth-card-focused{border-radius:16px;padding:22px 18px}.calendly-frame-wrap,.calendly-frame{min-height:610px;height:610px}.manual-meeting-body{padding:14px}.page-actions>.btn{flex:1 1 auto;justify-content:center}}
@media (prefers-reduced-motion:reduce){.manual-chevron,.btn,.input,.select,.icon-btn{transition:none!important}}

/* ===== NEOX 1.1.1 focused workspace polish: proofs, daily tasks, messages ===== */

/* Modal compatibility: a few legacy views used alternate class names. */
.modal-neox-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal-neox-body,
.modal-body {
  padding: var(--sp-5);
  overflow-y: auto;
  flex: 1;
}
.modal-neox-foot,
.modal-footer,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.modal-close-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.modal-close-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ----------------------------------------------------------- Work Proof upload */
.proof-upload-modal {
  width: min(100%, 620px);
  max-width: 620px;
  border-radius: 20px;
  overflow: hidden;
}
.proof-modal-head { padding: 18px 22px; align-items: flex-start; }
.proof-modal-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.proof-modal-title > span:last-child { min-width: 0; }
.proof-modal-title h3 { font-size: 1.08rem; line-height: 1.35; }
.proof-modal-title small {
  display: block;
  margin-top: 3px;
  color: var(--text-2);
  font-size: var(--fs-md);
  line-height: 1.45;
}
.proof-modal-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--blue-400);
  font-size: 1rem;
}
.proof-upload-form { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.proof-upload-modal .modal-body { padding: 22px; }
.proof-form-stack { display: grid; gap: 18px; }
.proof-form-stack .form-group { margin: 0; min-width: 0; }
.label-optional {
  margin-left: auto;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.proof-file-input {
  min-height: 58px;
  padding: 8px;
  border-style: dashed;
  border-color: var(--border-strong);
  background: var(--surface-3);
  cursor: pointer;
}
.proof-file-input:hover { border-color: var(--blue-400); background: var(--primary-soft); }
.proof-file-input::file-selector-button {
  height: 40px;
  margin: 0 12px 0 0;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--blue-400);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.proof-file-input:hover::file-selector-button { background: var(--blue-500); color: #fff; }
.proof-file-help {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 7px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.proof-file-help i { margin-top: 2px; color: var(--blue-400); }
.proof-related-block {
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-3);
}
.proof-related-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.proof-related-head > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-weight: 700;
  font-size: var(--fs-md);
}
.proof-related-head > span i { color: var(--blue-400); }
.proof-related-head small { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.proof-related-grid { gap: 12px; }
.proof-modal-foot {
  justify-content: space-between;
  gap: 14px;
  background: var(--surface-2);
  padding: 14px 22px;
}
.proof-foot-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.proof-foot-note i { color: var(--success); flex-shrink: 0; }
.proof-foot-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ----------------------------------------------------------- Daily Tasks */
.task-day-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 270px);
  gap: 12px;
  align-items: end;
  padding: 10px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.task-day-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-3);
  min-width: 0;
}
.task-day-nav .btn {
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  box-shadow: none;
}
.task-day-nav .btn:hover { background: var(--surface-hover); color: var(--text); transform: none; }
.task-day-nav .btn.is-active {
  background: var(--surface);
  color: var(--blue-400);
  box-shadow: var(--shadow-sm);
}
.task-day-nav .btn i { font-size: .78rem; color: var(--text-3); }
.task-day-nav .btn.is-active i { color: var(--blue-400); }
.task-date-control { min-width: 0; }
.task-date-control .label {
  margin: 0 2px 6px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}
.task-date-control .label i { color: var(--blue-400); }
.task-date-control .input { height: 40px; min-height: 40px; background: var(--surface-3); }
.task-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); gap: 18px; align-items: start; }
.task-overview-card {
  border-color: var(--border-strong);
  background:
    radial-gradient(520px 180px at 0% 0%, var(--primary-soft), transparent 72%),
    var(--surface);
}
.task-overview-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 24px;
  align-items: center;
  padding: 24px;
}
.task-progress-summary { display: flex; align-items: center; gap: 20px; min-width: 0; }
.task-progress-ring { --size: 106px; --thick: 9px; }
.task-ring-copy { display: grid; place-items: center; line-height: 1.1; text-align: center; }
.task-ring-copy strong { font-size: 1.4rem; font-weight: 760; color: var(--text); }
.task-ring-copy span { margin-top: 5px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.task-progress-copy { min-width: 0; }
.task-progress-copy h2 { font-size: 1.16rem; line-height: 1.35; margin-bottom: 5px; }
.task-progress-copy p { max-width: 520px; color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; }
.task-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.task-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.task-stat-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: .84rem;
}
.task-stat-icon.is-streak { background: var(--danger-soft); color: var(--danger); }
.task-stat-icon.is-points { background: var(--warning-soft); color: var(--warning); }
.task-stat-icon.is-level { background: var(--primary-soft); color: var(--blue-400); }
.task-stat > span:last-child { display: grid; min-width: 0; line-height: 1.25; }
.task-stat small { color: var(--text-2); font-size: var(--fs-xs); }
.task-stat strong { margin-top: 2px; color: var(--text); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-section-card .card-head { min-height: 56px; }
.task-section-card .card-head h3,
.task-side-card .card-head h3 { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.task-section-icon,
.task-side-title-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: .75rem;
}
.task-section-icon.is-pending { background: var(--warning-soft); color: var(--warning); }
.task-section-icon.is-complete { background: var(--success-soft); color: var(--success); }
.task-section-icon.is-skipped { background: var(--muted-soft); color: var(--text-3); }
.task-side-title-icon { background: var(--primary-soft); color: var(--blue-400); }
.task-row {
  min-height: 66px;
  padding: 13px 16px;
  gap: 12px;
}
.task-row:hover { background: var(--surface-2); }
.task-row .lesson-num { width: 34px; height: 34px; flex-basis: 34px; }
.task-row .user-cell-name { display: block; font-size: var(--fs-base); line-height: 1.35; }
.task-row .user-cell-sub { display: block; margin-top: 4px; line-height: 1.45; white-space: normal; }
.task-row-skipped { opacity: .68; }
.task-empty { padding: 38px 20px; }
.task-empty .empty-icon { width: 54px; height: 54px; margin-bottom: 12px; font-size: 1.15rem; }
.task-side-card .card-head { padding: 13px 15px; min-height: 56px; }
.task-side-card .card-body { padding: 15px; }
.task-card-date {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 650;
}
.task-mini-empty {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 11px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.task-mini-empty i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--surface-3);
}
.badge-progress-item { padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.badge-progress-item:first-child { padding-top: 0; }
.badge-progress-item:last-child { padding-bottom: 0; border-bottom: 0; }
.team-task-list { display: grid; }
.team-task-row { padding: 14px 15px; border-bottom: 1px solid var(--border-soft); }
.team-task-row:last-child { border-bottom: 0; }
.team-task-row .avatar { width: 34px; height: 34px; font-size: var(--fs-xs); }
.team-task-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 11px 0 7px 46px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.team-task-metrics strong { color: var(--text-2); font-variant-numeric: tabular-nums; }
.team-task-row > .progress-track { margin-left: 46px; height: 6px; }

/* ----------------------------------------------------------- Messages */
.chat-shell {
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  height: clamp(560px, calc(100dvh - var(--topbar-h) - 144px), 760px);
  min-height: 560px;
  border-color: var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.chat-list {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.chat-list-head { padding: 16px; background: var(--surface); }
.chat-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.chat-list-title strong { display: block; color: var(--text); font-size: var(--fs-lg); line-height: 1.2; }
.chat-list-title .section-kicker { margin-bottom: 2px; font-size: .62rem; }
.chat-contact-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 750;
}
.chat-search { position: relative; min-width: 0; }
.chat-search > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  color: var(--text-3);
  font-size: .84rem;
  pointer-events: none;
}
.chat-search .input { height: 40px; min-height: 40px; padding-left: 36px; background: var(--surface-3); }
.chat-person-list { min-height: 0; overflow-y: auto; flex: 1; }
.chat-person {
  position: relative;
  min-height: 72px;
  padding: 12px 14px;
  gap: 11px;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
}
.chat-person:hover { background: var(--surface-hover); color: inherit; }
.chat-person.is-active,
.chat-person.active {
  background: var(--primary-soft);
  border-left: 3px solid var(--blue-500);
  padding-left: 11px;
}
.chat-person.has-unread .chat-person-name { font-weight: 750; }
.chat-person .avatar { width: 38px; height: 38px; font-size: var(--fs-xs); }
.chat-person-info,
.chat-person-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-person-name {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-weight: 650;
  font-size: var(--fs-base);
  white-space: nowrap;
}
.chat-person-name > .chip { flex: 0 0 auto; }
.chat-person-sub,
.chat-person-last {
  min-width: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-person-meta { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; flex: 0 0 auto; }
.chat-time { color: var(--text-3); font-size: .65rem; white-space: nowrap; }
.badge-count,
.chat-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--blue-500);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  line-height: 1;
}
.chat-panel { background: var(--surface); }
.chat-panel-head,
.chat-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-panel-head .user-cell { min-width: 0; }
.chat-panel-head .avatar { width: 38px; height: 38px; }
.chat-panel-head .user-cell-name { font-size: var(--fs-base); }
.chat-back-btn { display: none; }
.chat-panel-empty {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 36px;
  background:
    radial-gradient(420px 220px at 50% 42%, var(--primary-soft), transparent 70%),
    var(--surface);
}
.chat-panel-empty > * { max-width: 420px; }
.chat-empty-visual {
  width: 76px;
  height: 76px;
  margin-bottom: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-2);
  color: var(--blue-400);
  box-shadow: var(--shadow-sm);
  font-size: 1.55rem;
}
.chat-panel-empty h3 { margin: 2px 0 7px; font-size: 1.16rem; }
.chat-panel-empty p { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; }
.chat-messages {
  gap: 10px;
  padding: 22px 24px;
  background: var(--surface-2);
  scroll-behavior: smooth;
}
.msg-row { max-width: min(72%, 620px); align-items: flex-end; }
.msg-row.msg-mine,
.msg-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-row.msg-theirs,
.msg-row.theirs { align-self: flex-start; }
.msg-row .avatar { margin-bottom: 4px; }
.msg-bubble {
  padding: 10px 12px 8px;
  border-radius: 16px 16px 16px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
  font-size: var(--fs-base);
  line-height: 1.52;
  white-space: normal;
}
.msg-row.msg-mine .msg-bubble,
.msg-row.mine .msg-bubble {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: #fff;
  border-radius: 16px 16px 5px 16px;
}
.msg-text { overflow-wrap: anywhere; white-space: normal; }
.msg-time { display: flex; align-items: center; gap: 3px; margin-top: 5px; color: var(--text-3); font-size: .65rem; line-height: 1; }
.msg-row.msg-mine .msg-time,
.msg-row.mine .msg-time { justify-content: flex-end; color: rgba(255,255,255,.72); }
.msg-row.msg-mine .msg-time i,
.msg-row.mine .msg-time i { color: rgba(255,255,255,.78) !important; }
.msg-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 9px 0;
  color: var(--text-3);
  font-size: .64rem;
  letter-spacing: .06em;
}
.msg-day::before,
.msg-day::after { content: ''; height: 1px; flex: 1; background: var(--border-soft); }
.msg-day span { padding: 4px 8px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border-soft); white-space: nowrap; }
.msg-empty {
  margin: auto;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.chat-compose {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-compose-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 10px;
  margin: 0;
}
.chat-textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 11px 13px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  line-height: 1.45;
}
.chat-textarea::placeholder { color: var(--text-3); }
.chat-textarea:hover { border-color: var(--border-strong); }
.chat-textarea:focus { outline: 2px solid transparent; border-color: var(--blue-500); box-shadow: var(--glow); background: var(--surface); }
.chat-send-btn { width: 44px; height: 44px; padding: 0; border-radius: 13px; flex: 0 0 44px; }

@media (max-width: 1380px) {
  .task-overview-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .task-stat-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 1024px) {
  .task-layout { grid-template-columns: minmax(0, 1fr); }
  .task-layout > div:last-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
  .task-layout > div:last-child .card { margin: 0; }
  .chat-shell { grid-template-columns: minmax(280px, 310px) minmax(0, 1fr); }
}

@media (max-width: 782px) {
  .proof-upload-modal { max-width: 620px; }
  .proof-related-grid { grid-template-columns: minmax(0, 1fr); }
  .proof-modal-foot { align-items: stretch; }
  .proof-foot-note { flex: 1 1 100%; }
  .proof-foot-actions { width: 100%; margin-left: 0; }
  .proof-foot-actions .btn { flex: 1 1 0; }

  .task-day-toolbar { grid-template-columns: minmax(0, 1fr); }
  .task-layout > div:last-child { grid-template-columns: minmax(0, 1fr); }
  .task-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .chat-shell {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - 92px);
    min-height: 430px;
  }
  .chat-shell .chat-list,
  .chat-shell .chat-panel { border: 0; }
  .chat-shell.show-list .chat-list { display: flex; }
  .chat-shell.show-list .chat-panel { display: none; }
  .chat-shell.show-panel .chat-list { display: none; }
  .chat-shell.show-panel .chat-panel { display: flex; }
  .chat-back-btn { display: inline-flex; }
  .chat-panel-head { min-height: 62px; padding: 10px 12px; }
  .chat-messages { padding: 18px 14px; }
  .msg-row { max-width: 84%; }
}

@media (max-width: 600px) {
  .proof-upload-modal { border-radius: 16px; }
  .proof-modal-head { padding: 16px; }
  .proof-upload-modal .modal-body { padding: 16px; }
  .proof-modal-foot { padding: 12px 16px; }
  .proof-modal-title small { max-width: 270px; }

  .task-day-toolbar { padding: 8px; }
  .task-day-nav .btn { height: 38px; padding: 0 8px; font-size: var(--fs-sm); }
  .task-day-nav .btn i { display: none; }
  .task-overview-body { padding: 18px; }
  .task-progress-summary { align-items: flex-start; gap: 14px; }
  .task-progress-ring { --size: 88px; --thick: 8px; }
  .task-ring-copy strong { font-size: 1.15rem; }
  .task-stat-grid { grid-template-columns: minmax(0, 1fr); }
  .task-row { align-items: flex-start; flex-wrap: wrap; }
  .task-row > .flex.items-center.gap-2 { width: 100%; padding-left: 46px; justify-content: space-between; }
  .team-task-metrics,
  .team-task-row > .progress-track { margin-left: 46px; }

  .chat-list-head { padding: 13px; }
  .chat-person { min-height: 68px; padding: 11px 12px; }
  .chat-panel-empty { padding: 24px 18px; }
  .chat-empty-visual { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
  .chat-compose { padding: 10px; }
  .chat-compose-form { grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
  .chat-textarea { min-height: 42px; }
  .chat-send-btn { width: 42px; height: 42px; border-radius: 12px; }
  .msg-row { max-width: 90%; }
}

@media (max-width: 420px) {
  .task-progress-summary { display: grid; grid-template-columns: 82px minmax(0, 1fr); }
  .task-progress-copy h2 { font-size: 1.05rem; }
  .proof-foot-actions { flex-direction: column-reverse; }
  .proof-foot-actions .btn { width: 100%; }
  .chat-person-name .chip { display: none; }
}

/* ===== NEOX 1.3 production mobile workspaces ===== */
.chat-compose-form { grid-template-columns: 40px minmax(0, 1fr) 44px; }
.chat-attach-btn {
  width: 40px; height: 44px; display: grid; place-items: center; margin: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  color: var(--text-2); cursor: pointer;
}
.chat-attach-btn:hover, .chat-attach-btn.has-file { border-color: var(--blue-500); color: var(--blue-500); background: var(--primary-soft); }
.chat-attachment-preview {
  grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr) 36px;
  align-items: center; gap: 9px; padding: 7px 8px; border: 1px solid var(--border);
  border-radius: 11px; background: var(--surface-2);
}
.chat-attachment-preview[hidden] { display: none; }
.chat-attachment-preview > img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; background: #0b1220; }
.chat-attachment-preview > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--blue-500); }
.chat-attachment-preview > span { min-width: 0; display: grid; }
.chat-attachment-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.chat-attachment-preview small { color: var(--text-3); font-size: .62rem; }
.chat-attachment-preview .icon-btn { width: 36px; height: 36px; }
.toast-item.is-actionable { cursor: pointer; }
.toast-item.is-actionable:hover { border-color: var(--blue-400); transform: translateY(-1px); }
.msg-attachment { min-width: min(280px, 62vw); display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 9px; margin-top: 8px; padding: 7px; border-radius: 11px; background: rgba(255,255,255,.14); color: inherit; }
.msg-theirs .msg-attachment { background: var(--surface-3); }
.msg-attachment img { width: 100%; max-height: 230px; grid-column: 1 / -1; border-radius: 8px; object-fit: contain; background: #0b1220; }
.msg-attachment > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: rgba(47,109,246,.13); color: var(--blue-500); }
.msg-attachment span { min-width: 0; display: grid; gap: 2px; }
.msg-attachment strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.msg-attachment small { font-size: .62rem; opacity: .74; }

.proof-viewer { z-index: 1400; padding: 0; background: rgba(3,7,15,.94); backdrop-filter: blur(12px); }
.proof-viewer-dialog { width: 100vw; height: 100dvh; display: flex; flex-direction: column; background: #0b111d; color: #fff; }
.proof-viewer-dialog > header { min-height: 64px; display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid rgba(255,255,255,.12); }
.proof-viewer-dialog > header > span { min-width: 0; display: grid; flex: 1; }
.proof-viewer-dialog > header small { color: #9eabc0; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.proof-viewer-dialog > header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-viewer-dialog .icon-btn { color: #fff; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.08); }
.proof-viewer-stage { min-height: 0; flex: 1; display: grid; place-items: center; overflow: auto; padding: 14px; }
.proof-viewer-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.proof-viewer-stage > iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.proof-viewer-stage > audio { width: min(560px, 100%); }
.proof-viewer-file { display: grid; place-items: center; gap: 12px; text-align: center; }
.proof-viewer-file > i { font-size: 3rem; color: var(--blue-400); }
.proof-viewer-file p { margin: 0; color: #a9b4c5; }

/* Activity log: role-aware timeline workspace */
.audit-page-head { align-items: flex-end; }
.audit-page-head .page-title { gap: 4px; }
.audit-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--blue-600); font-size: .68rem; font-weight: 800; letter-spacing: .085em; text-transform: uppercase; }
.audit-head-status { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-1); box-shadow: var(--shadow-sm); }
.audit-head-status > span:last-child { display: grid; line-height: 1.25; }
.audit-head-status strong { font-size: .76rem; }
.audit-head-status small { color: var(--text-3); font-size: .65rem; }
.audit-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.audit-scope-banner { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-bottom: 16px; padding: 13px 15px; border: 1px solid rgba(47,107,255,.2); border-radius: 16px; background: linear-gradient(135deg,rgba(47,107,255,.09),rgba(125,92,255,.06)); }
.audit-scope-icon, .audit-summary-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--blue-600); background: var(--primary-soft); }
.audit-scope-banner > span:nth-child(2) { min-width: 0; display: grid; }
.audit-scope-banner strong { font-size: .82rem; }
.audit-scope-banner small { color: var(--text-3); font-size: .7rem; line-height: 1.45; }
.audit-access-card > summary, .audit-filter-card > summary { cursor: pointer; list-style: none; }
.audit-access-card > summary::-webkit-details-marker, .audit-filter-card > summary::-webkit-details-marker { display: none; }
.audit-panel-summary { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; }
.audit-panel-summary > span:nth-child(2) { min-width: 0; display: grid; }
.audit-panel-summary strong { font-size: .84rem; }
.audit-panel-summary small { color: var(--text-3); font-size: .69rem; line-height: 1.4; }
.audit-summary-action { display: inline-flex; align-items: center; gap: 7px; color: var(--blue-600); font-size: .7rem; font-weight: 800; }
.audit-summary-action i { transition: transform .2s ease; }
details[open] > .audit-panel-summary .audit-summary-action i { transform: rotate(180deg); }
.audit-access-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; padding: 0 16px 16px; }
.audit-access-row { display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); transition: border-color .2s, box-shadow .2s; }
.audit-access-row.is-enabled { border-color: rgba(34,197,94,.3); box-shadow: inset 3px 0 0 var(--success); }
.audit-access-copy { min-width: 0; display: grid; gap: 3px; }
.audit-access-copy > span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.audit-access-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.audit-access-copy small { overflow: hidden; color: var(--text-3); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.audit-access-state { padding: 2px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-size: .56rem; font-weight: 800; text-transform: uppercase; }
.audit-access-row.is-enabled .audit-access-state { color: var(--success); background: var(--success-soft); }
.audit-access-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding-top: 4px; }
.audit-access-toggle { min-width: 0; }
.audit-access-toggle button { display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: center; gap: 9px; width: 100%; min-height: 82px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); color: var(--text-2); text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.audit-access-toggle button:hover { transform: translateY(-1px); border-color: rgba(47,107,255,.3); background: var(--primary-soft); }
.audit-access-toggle button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.audit-access-toggle.is-enabled button { border-color: rgba(34,197,94,.3); background: var(--success-soft); }
.audit-access-toggle-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--blue-600); background: var(--primary-soft); }
.audit-access-toggle.is-enabled .audit-access-toggle-icon { color: var(--success); background: color-mix(in srgb,var(--success) 13%,transparent); }
.audit-access-toggle button > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.audit-access-toggle strong { font-size: .72rem; }
.audit-access-toggle small { color: var(--text-3); font-size: .61rem; line-height: 1.35; white-space: normal; }
.audit-access-toggle-state { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 3px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-size: .56rem; font-weight: 800; text-transform: uppercase; }
.audit-access-toggle.is-enabled .audit-access-toggle-state { color: var(--success); background: color-mix(in srgb,var(--success) 12%,transparent); }
.audit-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.audit-kpi { --audit-tone: var(--blue-500); display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 11px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg,var(--surface-1),var(--surface-2)); box-shadow: var(--shadow-sm); }
.audit-kpi.is-danger { --audit-tone: var(--danger); }.audit-kpi.is-warning { --audit-tone: var(--warning); }.audit-kpi.is-success { --audit-tone: var(--success); }
.audit-kpi-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--audit-tone); background: color-mix(in srgb,var(--audit-tone) 11%,transparent); }
.audit-kpi > span:last-child { min-width: 0; display: grid; }
.audit-kpi small { overflow: hidden; color: var(--text-2); font-size: .64rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.audit-kpi strong { color: var(--text-1); font-size: 1.45rem; line-height: 1.15; }
.audit-kpi em { color: var(--text-3); font-size: .6rem; font-style: normal; }
.audit-category-strip { display: flex; gap: 8px; margin: 0 0 14px; padding: 2px 1px 5px; overflow-x: auto; scrollbar-width: none; }
.audit-category-strip::-webkit-scrollbar { display: none; }
.audit-category { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); color: var(--text-2); font-size: .7rem; font-weight: 750; }
.audit-category:hover, .audit-category.active { border-color: rgba(47,107,255,.28); background: var(--primary-soft); color: var(--blue-600); }
.audit-filter-count { min-width: 24px; height: 24px; display: grid; place-items: center; margin-left: auto; border-radius: 999px; background: var(--blue-600); color: #fff; font-size: .65rem; font-weight: 800; }
.audit-filter-card .audit-panel-summary { grid-template-columns: 42px minmax(0,1fr) auto auto; }
.audit-filter-body { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; padding: 0 16px 16px; border-top: 1px solid var(--border); padding-top: 15px; }
.audit-filter-body .filter-item { min-width: 0; }
.audit-search-field { grid-column: span 2; }
.audit-search-field > span { position: relative; display: block; }
.audit-search-field > span > i { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.audit-search-field .input { padding-left: 37px; }
.audit-filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.audit-stream-card { overflow: hidden; }
.audit-stream-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.audit-stream-head > span:first-child { display: grid; }
.audit-stream-head strong { font-size: .9rem; }
.audit-stream-head small { color: var(--text-3); font-size: .67rem; }
.audit-sort-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: .65rem; font-weight: 700; }
.audit-feed { padding: 8px 16px 18px; }
.audit-date-divider { position: relative; display: flex; align-items: center; gap: 10px; margin: 14px 0 9px; color: var(--text-3); font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.audit-date-divider::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.audit-date-divider span { flex: 0 0 auto; }
.audit-event { --event-tone: var(--text-3); position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 12px; margin-bottom: 9px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-1); transition: transform .18s ease,border-color .18s ease,box-shadow .18s ease; }
.audit-event:hover { transform: translateY(-1px); border-color: color-mix(in srgb,var(--event-tone) 28%,var(--border)); box-shadow: var(--shadow-sm); }
.audit-event.is-primary { --event-tone: var(--blue-500); }.audit-event.is-success { --event-tone: var(--success); }.audit-event.is-danger { --event-tone: var(--danger); }.audit-event.is-warning { --event-tone: var(--warning); }.audit-event.is-info { --event-tone: #0ea5e9; }.audit-event.is-violet { --event-tone: #8b5cf6; }
.audit-event-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--event-tone); background: color-mix(in srgb,var(--event-tone) 11%,transparent); }
.audit-event-main { min-width: 0; }
.audit-event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.audit-event-top time { flex: 0 0 auto; color: var(--text-3); font-size: .64rem; font-weight: 700; }
.audit-actor { display: flex; align-items: center; gap: 8px; min-width: 0; }
.audit-actor > span:last-child { min-width: 0; display: grid; }
.audit-actor strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.audit-actor small { color: var(--text-3); font-size: .61rem; }
.audit-system-avatar { color: var(--blue-500); background: var(--primary-soft) !important; }
.audit-action-line { display: flex; align-items: center; gap: 7px; margin: 8px 0 5px; }
.audit-action-badge { color: var(--event-tone); font-size: .7rem; font-weight: 800; }
.audit-action-line code { padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); font-size: .58rem; }
.audit-event p { margin: 0; color: var(--text-2); font-size: .74rem; line-height: 1.5; overflow-wrap: anywhere; }
.audit-event-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; margin-top: 9px; color: var(--text-3); font-size: .61rem; }
.audit-event-meta span { display: inline-flex; align-items: center; gap: 5px; }
.audit-event-meta i { color: var(--event-tone); }
.audit-empty { padding: 48px 18px; }

@media (max-width: 782px) {
  .chat-page-head.has-thread { display: none; }
  .chat-page-head:not(.has-thread) { margin-bottom: 12px; }
  .chat-shell {
    --chat-nav-offset: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    height: calc(var(--neox-visual-height, 100dvh) - var(--topbar-h) - var(--chat-nav-offset));
    min-height: 0;
    border-radius: 14px;
  }
  body.neox-chat-thread-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
  body.neox-chat-thread-open .bottom-nav {
    display: none !important;
  }
  body.neox-chat-thread-open .page-body {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
  }
  body.neox-chat-thread-open .chat-shell.show-panel {
    --chat-nav-offset: 0px;
    height: var(--chat-workspace-height, calc(var(--neox-visual-height, 100dvh) - var(--topbar-h)));
    margin: 0;
    border-inline: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body.neox-chat-thread-open .chat-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .chat-panel,
  .chat-messages,
  .chat-compose,
  .chat-compose-form,
  .chat-textarea { min-width: 0; }
  .chat-panel-head {
    min-height: 58px;
    position: relative;
    z-index: 2;
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px));
    box-shadow: 0 1px 0 var(--border-soft);
  }
  .chat-panel-head .user-cell { flex: 1; overflow: hidden; }
  .chat-panel-head .user-cell-text { flex: 1; overflow: hidden; }
  .chat-panel-head .user-cell-name,
  .chat-panel-head .user-cell-sub { display: block; }
  .chat-panel-head .user-cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-back-btn { min-width: 66px; padding-inline: 8px; }
  .chat-messages {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    padding: 14px max(11px, env(safe-area-inset-right, 0px)) 18px max(11px, env(safe-area-inset-left, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-block: 14px;
  }
  .chat-compose {
    position: relative;
    z-index: 5;
    display: block !important;
    flex: 0 0 auto;
    width: 100%;
    padding: 8px max(9px, env(safe-area-inset-right, 0px)) max(9px, env(safe-area-inset-bottom, 0px)) max(9px, env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 -8px 24px rgba(16, 24, 40, .04);
  }
  .chat-compose-form {
    grid-template-columns: 42px minmax(0, 1fr) 44px;
    gap: 8px;
    max-width: 100%;
  }
  .chat-attach-btn,
  .chat-send-btn { touch-action: manipulation; }
  .chat-attach-btn { width: 42px; height: 46px; border-radius: 14px; }
  .chat-send-btn { width: 44px; height: 46px; border-radius: 14px; }
  .chat-textarea {
    min-height: 46px;
    max-height: min(128px, 28vh);
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 16px;
    line-height: 1.42;
  }
  .msg-row { max-width: 88%; }
  .msg-bubble { padding: 9px 11px 7px; border-radius: 15px 15px 15px 5px; }
  .lead-detail-head { gap: 12px; }
  .lead-detail-head .page-title h1 { font-size: clamp(1.35rem, 6vw, 1.72rem); line-height: 1.12; overflow-wrap: anywhere; }
  .lead-detail-head .page-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .lead-detail-head .page-actions .btn { min-height: 42px; padding: 8px 7px; font-size: .7rem; white-space: normal; text-align: center; }
  .lead-lifecycle-card .card-body > .flex { flex-wrap: nowrap !important; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: thin; }
  .lead-lifecycle-card form, .lead-lifecycle-card .chip { flex: 0 0 auto; }
  .lead-lifecycle-card .ml-auto { margin-left: 8px; flex: 0 0 auto; }
  .lead-detail-grid { gap: 14px; }
  .lead-detail-grid .card { margin-bottom: 14px !important; }
  .lead-detail-grid .card-head { padding: 13px 14px; }
  .lead-detail-grid .card-body { padding: 14px; }
  .lead-detail-grid .pill-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .lead-detail-grid .pill-tabs button { flex: 0 0 auto; }
  .audit-page-head { display: grid; gap: 12px; margin-bottom: 14px; }
  .audit-head-status { width: fit-content; padding: 7px 10px; }
  .audit-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .audit-kpi { grid-template-columns: 34px minmax(0,1fr); gap: 8px; padding: 11px; border-radius: 14px; }
  .audit-kpi-icon { width: 34px; height: 34px; border-radius: 10px; }
  .audit-kpi strong { font-size: 1.2rem; }
  .audit-kpi em { display: none; }
  .audit-panel-summary { padding: 12px; grid-template-columns: 38px minmax(0,1fr) auto; }
  .audit-filter-card .audit-panel-summary { grid-template-columns: 38px minmax(0,1fr) auto auto; }
  .audit-summary-icon { width: 38px; height: 38px; border-radius: 11px; }
  .audit-summary-action { font-size: 0; }
  .audit-summary-action i { font-size: .68rem; }
  .audit-access-grid { grid-template-columns: minmax(0,1fr); padding: 0 12px 12px; }
  .audit-access-row .btn { min-height: 42px; }
  .audit-filter-body { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 13px 12px; }
  .audit-search-field { grid-column: 1 / -1; }
  .audit-stream-head { padding: 13px; }
  .audit-feed { padding: 5px 10px 14px; }
  .audit-event { grid-template-columns: 37px minmax(0,1fr); gap: 9px; padding: 11px; border-radius: 14px; }
  .audit-event-icon { width: 36px; height: 36px; border-radius: 11px; }
}

@media (max-width: 782px) {
  body.neox-chat-thread-open.neox-keyboard-open .topbar { display: none; }
  body.neox-chat-thread-open.neox-keyboard-open .chat-shell {
    --chat-nav-offset: 0px;
    min-height: 0;
  }
  body.neox-chat-thread-open.neox-keyboard-open .chat-compose { padding-bottom: 7px; }
  body.neox-keyboard-open .bottom-nav {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(110%);
    pointer-events: none;
  }
  .audit-access-actions { grid-template-columns: minmax(0,1fr); }
  .audit-access-toggle button { grid-template-columns: 36px minmax(0,1fr) auto; min-height: 68px; }
  .audit-access-toggle-state { grid-column: auto; justify-self: end; white-space: nowrap; }
}

@media (max-width: 430px) {
  .chat-panel-head .avatar { width: 34px; height: 34px; }
  .chat-panel-head .user-cell-name { font-size: .8rem; }
  .chat-panel-head .user-cell-sub { font-size: .62rem; }
  .msg-row { max-width: 92%; }
  .msg-row .avatar { width: 26px; height: 26px; font-size: .58rem; }
  .msg-bubble { font-size: .83rem; }
  .audit-scope-banner { grid-template-columns: 38px minmax(0,1fr); padding: 11px; }
  .audit-scope-banner .chip { display: none; }
  .audit-scope-icon { width: 38px; height: 38px; }
  .audit-access-row { grid-template-columns: 36px minmax(0,1fr); }
  .audit-access-actions { grid-template-columns: minmax(0,1fr); }
  .audit-filter-body { grid-template-columns: minmax(0,1fr); }
  .audit-filter-body .filter-item, .audit-filter-actions { grid-column: 1; }
  .audit-filter-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .audit-category { min-height: 42px; padding: 7px 10px; }
  .audit-stream-head .audit-sort-label { font-size: 0; }
  .audit-stream-head .audit-sort-label i { font-size: .7rem; }
  .audit-event-top { gap: 7px; }
  .audit-action-line { align-items: flex-start; flex-direction: column; gap: 3px; }
  .audit-event-meta span:last-child { display: none; }
}

@media (max-width: 360px) {
  .chat-compose-form { grid-template-columns: 40px minmax(0, 1fr) 42px; gap: 6px; }
  .chat-attach-btn { width: 40px; }
  .chat-send-btn { width: 42px; }
  .chat-back-btn { min-width: 42px; width: 42px; padding: 0; font-size: 0; }
  .chat-back-btn i { font-size: .8rem; }
}

.task-toggle { cursor: pointer; }
.task-row.done .task-toggle { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.task-modal .modal-body { display: grid; gap: 16px; }
.task-modal .modal-body > .form-group,
.task-modal .modal-body > .grid { margin: 0; }
.task-modal .form-group { min-width: 0; }
.task-modal .modal-head h3 { display: flex; align-items: center; gap: 8px; }

[data-theme='light'] .section-kicker { color: var(--blue-600); }

/* --------------------------------------------------------------------------
   Error recovery experience
   -------------------------------------------------------------------------- */
.error-experience {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(24px, 5vw, 64px);
  background:
    radial-gradient(circle at 14% 18%, rgba(47, 109, 246, .12), transparent 27%),
    radial-gradient(circle at 86% 78%, rgba(116, 87, 255, .1), transparent 25%),
    linear-gradient(145deg, #f8faff 0%, #f2f6ff 48%, #f7f9fd 100%);
}
.error-atmosphere { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.error-orbit { position: absolute; border: 1px solid rgba(47, 109, 246, .12); border-radius: 50%; }
.error-orbit.orbit-a { width: min(52vw, 680px); aspect-ratio: 1; left: -18vw; top: -30vw; }
.error-orbit.orbit-b { width: min(44vw, 560px); aspect-ratio: 1; right: -15vw; bottom: -28vw; }
.error-grid {
  position: absolute;
  inset: 0;
  opacity: .28;
  background-image: linear-gradient(rgba(47, 109, 246, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(47, 109, 246, .05) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: radial-gradient(circle at center, #000, transparent 68%);
  mask-image: radial-gradient(circle at center, #000, transparent 68%);
}
.error-panel {
  width: min(100%, 570px);
  display: grid;
  justify-items: center;
  padding: clamp(30px, 5vw, 50px);
  border: 1px solid rgba(205, 215, 232, .9);
  border-radius: 26px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 28px 80px rgba(37, 56, 88, .13), inset 0 1px 0 rgba(255, 255, 255, .9);
  text-align: center;
  backdrop-filter: blur(18px);
}
.error-visual { position: relative; width: 118px; height: 118px; display: grid; place-items: center; margin-bottom: 24px; }
.error-visual-ring { position: absolute; inset: 0; border: 1px solid rgba(47, 109, 246, .16); border-radius: 50%; }
.error-visual-ring.ring-two { inset: 13px; border-style: dashed; animation: error-spin 18s linear infinite; }
.error-visual-icon {
  position: relative;
  z-index: 2;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 109, 246, .18);
  border-radius: 20px;
  background: linear-gradient(145deg, #fff, #eaf0ff);
  color: var(--blue-500);
  box-shadow: 0 14px 30px rgba(47, 109, 246, .18);
  font-size: 1.35rem;
  transform: rotate(-5deg);
}
.error-route-dot { position: absolute; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--blue-500); box-shadow: 0 4px 10px rgba(47, 109, 246, .35); }
.error-route-dot.dot-one { left: 5px; top: 49px; }
.error-route-dot.dot-two { right: 10px; bottom: 22px; background: #765cff; }
.error-code { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; color: var(--text-3); font-size: .68rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.error-code span { color: var(--blue-500); }
.error-code i { width: 22px; height: 1px; background: var(--border-strong); }
.error-code strong { color: var(--text-3); font: inherit; }
.error-panel h1 { margin: 0; color: var(--text); font-size: clamp(1.8rem, 6vw, 2.65rem); line-height: 1.08; letter-spacing: -.035em; }
.error-panel > p { max-width: 440px; margin: 14px 0 0; color: var(--text-2); font-size: .94rem; line-height: 1.65; }
.error-requested-route { max-width: 100%; display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: #f7f9fd; color: var(--text-3); font-size: .7rem; }
.error-requested-route span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-actions { display: flex; justify-content: center; margin-top: 24px; }
.error-actions .btn { min-height: 44px; padding-inline: 18px; border-radius: 12px; box-shadow: 0 10px 22px rgba(47, 109, 246, .2); }
.error-help { display: flex; align-items: center; gap: 7px; margin-top: 20px; color: var(--text-3); font-size: .68rem; }
.error-brand { position: absolute; left: clamp(18px, 3vw, 40px); bottom: clamp(18px, 3vw, 34px); display: flex; align-items: center; gap: 9px; color: var(--text); }
.error-brand > b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--blue-500); color: #fff; font-size: .67rem; box-shadow: 0 8px 18px rgba(47, 109, 246, .22); }
.error-brand > span { display: grid; font-size: .7rem; font-weight: 800; line-height: 1.2; letter-spacing: .02em; }
.error-brand small { color: var(--text-3); font-size: .55rem; font-weight: 550; letter-spacing: 0; }
@keyframes error-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .error-experience { align-items: center; padding: 18px; }
  .error-panel { padding: 28px 20px; border-radius: 20px; }
  .error-visual { width: 98px; height: 98px; margin-bottom: 20px; }
  .error-visual-icon { width: 58px; height: 58px; border-radius: 17px; }
  .error-panel > p { font-size: .86rem; }
  .error-actions, .error-actions .btn { width: 100%; }
  .error-brand { position: static; margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .error-visual-ring.ring-two { animation: none; }
}
