/* ═══════════════════════════════════════════════════
   PERDANA UMS — ONE UI DESIGN SYSTEM
   Single source of truth for all colours, spacing,
   typography, radius, shadows, motion.
   Light + Dark mode. Mobile-first.
   ═══════════════════════════════════════════════════ */

/* ── LIGHT MODE (default) ── */
:root {
  /* Brand — Option A vivid gradient */
  --pu-grad-1: #667eea;
  --pu-grad-2: #764ba2;
  --pu-grad-3: #f093fb;
  --pu-grad-4: #f5576c;
  --pu-grad-5: #fda085;
  --pu-topbar-grad: linear-gradient(
      110deg,
      #5b5be8  0%,     /* indigo   */
      #7c4ddb 26%,     /* violet   */
      #b44bd6 52%,     /* fuchsia  */
      #e0518f 76%,     /* rose     */
      #ef6a5a 100%     /* coral (deeper than before) */
  );
  /* Directional scrim: darkens toward the right, where the
     profile card's white text sits. */
  --pu-topbar-scrim: linear-gradient(
      100deg,
      rgba(15, 12, 41, .30)  0%,
      rgba(15, 12, 41, .24) 45%,
      rgba(15, 12, 41, .44) 78%,
      rgba(15, 12, 41, .56) 100%
  );

  /* Accent — indigo-violet: legible on white AND on black */
  --accent:        #6366f1;
  --accent-hover:  #5457e5;
  --accent-soft:   #eef0fe;
  --accent-border: #d5d8fb;

  /* Surfaces */
  --bg:        #f2f2f7;
  --surface:   #ffffff;
  --surface-2: #f7f7fa;
  --surface-3: #eeeef3;
  --border:    #e5e5ea;
  --border-2:  #f0f0f4;

  /* Text */
  --text:      #1c1c1e;
  --text-2:    #48484a;
  --text-mute: #6b6b70;
  --text-hint: #a1a1a8;
  --text-on-accent: #ffffff;

  /* Semantic */
  --ok:        #1a9e46;
  --ok-soft:   #e7f8ee;
  --ok-border: #b8ecca;
  --err:       #dc2f26;
  --err-soft:  #fdeceb;
  --err-border:#f8c8c5;
  --warn:      #c47500;
  --warn-soft: #fff4e3;
  --warn-border:#fbdfb3;
  --info:      #1a6ef5;
  --info-soft: #e9f1fe;
  --info-border:#c3daFC;

  /* Typography scale — LARGER than typical, for older users */
  --fs-2xs: 11px;
  --fs-xs:  12px;
  --fs-sm:  13px;
  --fs-md:  15px;   /* body default */
  --fs-lg:  17px;
  --fs-xl:  20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 38px;

  --fw-normal: 500;
  --fw-med:    600;
  --fw-bold:   700;
  --fw-black:  800;
  --fw-heavy:  900;

  --lh-tight: 1.25;
  --lh-base:  1.6;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display",
          "Segoe UI", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", monospace;

  /* Spacing */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Radius — One UI = generous, pill-heavy */
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   26px;
  --r-2xl:  32px;
  --r-pill: 999px;

  /* Elevation */
  --sh-1: 0 1px 3px rgba(15,23,42,.05);
  --sh-2: 0 4px 14px rgba(15,23,42,.07);
  --sh-3: 0 12px 32px rgba(15,23,42,.10);
  --sh-4: 0 24px 60px rgba(15,23,42,.16);

  /* Motion */
  --ease:        cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast:  .15s var(--ease);
  --t-base:  .25s var(--ease);
  --t-slow:  .38s var(--ease);

  /* Staff sidebar compatibility alias; v2 owns the canonical token. */
  --topbar-h:  64px;
  --sidebar-w: var(--ums-sidebar-expanded, 272px);

  /* Touch targets — 44px min for older users */
  --touch: 44px;

  /* Chart palette — FIXED colours, identical in light and dark mode.
     Chosen to stay distinguishable on both white and black.
     Charts need explicit colours, never adaptive tokens. */
  --chart-1: #6366f1;   /* indigo  */
  --chart-2: #ec4899;   /* pink    */
  --chart-3: #14b8a6;   /* teal    */
  --chart-4: #f59e0b;   /* amber   */
  --chart-5: #8b5cf6;   /* violet  */
  --chart-6: #06b6d4;   /* cyan    */
}

/* ── DARK MODE ── */
[data-mode="dark"] {
  --accent:        #818cf8;
  --accent-hover:  #949dfa;
  --accent-soft:   rgba(129, 140, 248, .14);
  --accent-border: rgba(129, 140, 248, .30);

  --bg:        #0b0b0f;
  --surface:   #17171c;
  --surface-2: #1f1f26;
  --surface-3: #2a2a33;
  --border:    #2e2e38;
  --border-2:  #24242c;

  --text:      #f2f2f7;
  --text-2:    #d4d4dc;
  --text-mute: #9a9aa5;
  --text-hint: #6e6e78;

  --ok:        #3ddc74;
  --ok-soft:   rgba(61,220,116,.13);
  --ok-border: rgba(61,220,116,.26);
  --err:       #ff6b60;
  --err-soft:  rgba(255,107,96,.13);
  --err-border:rgba(255,107,96,.26);
  --warn:      #ffb340;
  --warn-soft: rgba(255,179,64,.13);
  --warn-border:rgba(255,179,64,.26);
  --info:      #5aa2ff;
  --info-soft: rgba(90,162,255,.13);
  --info-border:rgba(90,162,255,.26);

  --sh-1: 0 1px 3px rgba(0,0,0,.4);
  --sh-2: 0 4px 14px rgba(0,0,0,.5);
  --sh-3: 0 12px 32px rgba(0,0,0,.6);
  --sh-4: 0 24px 60px rgba(0,0,0,.7);
}

/* ═══════════ BASE ═══════════ */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-base), color var(--t-base);
}
*:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ═══════════ PAGE SHELL ═══════════ */
.ou-page {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  animation: ouPageIn .3s var(--ease) both;
}

/* Authoritative authenticated workspace. */
.content-wrap { padding: 0 !important; }
.ums-page-shell {
  width: var(--ums-workspace-width, 90%);
  max-width: var(--ums-workspace-max-width, none);
  min-width: 0;
  margin-inline: auto;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.ums-page-shell > :where(.ou-page, .container, .container-md, .exec-control, [class*="-page"]) {
  width: 100%;
  max-width: none !important;
  min-width: 0;
  margin-inline: 0 !important;
}
.ums-page-shell > :where(.container, .container-md, .exec-control, [class*="-page"]) {
  padding-inline: 0 !important;
}
.ums-page-shell > :where(.exec-control, [class*="-page"], .ums-module-page) {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.ums-page-shell > :where(.exec-control, [class*="-page"], .ums-module-page) > :not(style):not(script):not(link) {
  margin-block: 0 !important;
}
.ums-page-shell > .ou-head,
.ums-page-shell > :where(.exec-control, [class*="-page"], .ums-module-page) > .ou-head {
  margin-bottom: 0;
}

.ums-kpi-grid,
.ou-dashboard-grid,
.adm-kpi,
.approval-stats,
.core-stat-grid,
.csu-kpi-grid,
.exam-kpi-grid,
.finance-dashboard-kpi-grid,
.finance-kpi-grid,
.gov-kpis,
.hr-kpi-grid,
.leave-widget-grid,
.library-kpi-grid,
.mkt-kpis,
.rg-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)) !important;
  gap: 14px;
  width: 100%;
  min-width: 0;
}
.ums-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  min-width: 0;
}
.ums-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  min-width: 0;
}
.ums-table-wrap { width: 100%; min-width: 0; overflow-x: auto; }

@media (max-width: 1279px) {
  .ums-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .ums-page-shell { padding: 16px 18px 28px; }
}
@media (max-width: 767px) {
  :where(.ums-kpi-grid, .ou-dashboard-grid, .adm-kpi, .approval-stats,
    .core-stat-grid, .csu-kpi-grid, .exam-kpi-grid,
    .finance-dashboard-kpi-grid, .finance-kpi-grid, .gov-kpis,
    .hr-kpi-grid, .leave-widget-grid, .library-kpi-grid, .mkt-kpis, .rg-kpi,
    .ums-grid-2, .ums-grid-3) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 640px) {
  .ums-page-shell { padding: 12px; gap: var(--s-3); }
}
@keyframes ouPageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════ PAGE HEADING ═══════════ */
.ou-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.ou-head-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  color: var(--accent);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: var(--s-1);
}
.ou-head-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-heavy);
  color: var(--text);
  letter-spacing: -.5px;
  line-height: var(--lh-tight);
}
.ou-head-sub {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  margin-top: var(--s-1);
}
.ou-head-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ═══════════ CARD ═══════════ */
.ou-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: var(--s-4);
  box-shadow: var(--sh-1);
  transition: background var(--t-base), border-color var(--t-base),
              box-shadow var(--t-fast), transform var(--t-fast);
}
.ou-card.pad-0 { padding: 0; overflow: hidden; }
.ou-card.hover:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.ou-card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  color: var(--text);
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.ou-card-title-ic {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.ou-card-header,
.ou-card-footer,
.ums-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.ou-card-header { margin-bottom: var(--s-4); }
.ou-card-body.pad-0 { margin: calc(-1 * var(--s-4)); }
.ou-card-footer {
  margin: var(--s-4) calc(-1 * var(--s-4)) calc(-1 * var(--s-4));
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-2);
  background: var(--surface-2);
}
.ou-card--unbordered { border-color: transparent; }
.ou-card-actions { display: flex; align-items: center; gap: var(--s-2); }
.ums-section-title { margin: 0; font-size: var(--fs-lg); color: var(--text); }
.ums-section-subtitle { margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--text-mute); }
.ums-form-section { width: 100%; max-width: var(--ums-form-max, 1100px); }
.ums-form-section-body { margin-top: var(--s-4); }
.ou-form-actions,
.ums-check-row,
.ums-inline-form {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.ou-form-actions { margin-top: var(--s-5); }
.ums-check-row { margin-top: var(--s-4); }
.ums-check { display: inline-flex !important; align-items: center; gap: var(--s-2); }
.ums-inline-form .ou-select { width: min(100%, 520px); }
@media (max-width: 640px) {
  .ou-form-actions > *, .ums-inline-form > .ou-select, .ums-inline-form > .ou-btn { width: 100%; }
}

/* ═══════════ BUTTONS — pill, 44px touch ═══════════ */
.ou-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--touch);
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  letter-spacing: -.2px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--t-fast);
}
.ou-btn:active { transform: scale(.97); }
.ou-btn:disabled { opacity: .5; cursor: not-allowed; }

.ou-btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(107,92,231,.28);
}
.ou-btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(107,92,231,.36);
}
.ou-btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.ou-btn--ghost:hover { background: var(--surface-3); }
.ou-btn--danger {
  background: var(--err);
  color: #fff;
}
.ou-btn--danger-soft {
  background: var(--err-soft);
  color: var(--err);
  border-color: var(--err-border);
}
.ou-btn--sm { min-height: 36px; padding: 0 var(--s-4); font-size: var(--fs-xs); }
.ou-btn--lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-md); }
.ou-btn--block { width: 100%; }

/* Loading state */
.ou-btn.is-loading {
  pointer-events: none;
  opacity: .7;
  padding-right: calc(var(--s-5) + 22px);
  position: relative;
}
.ou-btn.is-loading::after {
  content: '';
  position: absolute;
  right: var(--s-4);
  top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ouSpin .7s linear infinite;
}
.ou-btn--ghost.is-loading::after {
  border-color: var(--border);
  border-top-color: var(--accent);
}
@keyframes ouSpin { to { transform: rotate(360deg); } }

/* ═══════════ BADGE ═══════════ */
.ou-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  letter-spacing: .2px;
  white-space: nowrap;
}
.ou-badge--ok    { background: var(--ok-soft);    color: var(--ok); }
.ou-badge--err   { background: var(--err-soft);   color: var(--err); }
.ou-badge--warn  { background: var(--warn-soft);  color: var(--warn); }
.ou-badge--info  { background: var(--info-soft);  color: var(--info); }
.ou-badge--accent{ background: var(--accent-soft);color: var(--accent); }
.ou-badge--mute  { background: var(--surface-2);  color: var(--text-mute); }

/* Code chip (staff IDs, student numbers) */
.ou-code {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
}

/* ═══════════ FORM ═══════════ */
.ou-field { margin-bottom: var(--s-4); }
.ou-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: var(--s-2);
}
.ou-label .req { color: var(--err); margin-left: 2px; }

.ou-input,
.ou-select,
.ou-textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 11px var(--s-4);
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-normal);
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  transition: all var(--t-fast);
  box-sizing: border-box;
}
.ou-textarea {
  border-radius: var(--r-lg);
  min-height: 100px;
  padding: var(--s-3) var(--s-4);
  resize: vertical;
  line-height: var(--lh-base);
}
.ou-input:focus,
.ou-select:focus,
.ou-textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.ou-input::placeholder,
.ou-textarea::placeholder { color: var(--text-hint); }
.ou-input.is-error,
.ou-select.is-error,
.ou-textarea.is-error {
  border-color: var(--err);
  background: var(--err-soft);
}
.ou-hint {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--text-hint);
  margin-top: 5px;
  padding-left: var(--s-4);
}
.ou-error {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--err);
  font-weight: var(--fw-bold);
  margin-top: 5px;
  padding-left: var(--s-4);
}
.ou-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-4);
}

/* Checkbox / radio — larger for older users */
.ou-check {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--touch);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: var(--fw-med);
  color: var(--text);
}
.ou-check input[type="checkbox"],
.ou-check input[type="radio"] {
  width: 22px; height: 22px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ═══════════ TABLE ═══════════ */
.ou-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.ou-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ou-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.ou-table th {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  color: var(--text-mute);
  letter-spacing: .8px;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.ou-table td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-2);
  color: var(--text-2);
  vertical-align: middle;
}
.ou-table tbody tr { transition: background var(--t-fast); }
.ou-table tbody tr:hover td { background: var(--accent-soft); }
.ou-table tbody tr:last-child td { border-bottom: none; }
.ou-td-primary {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text);
}
.ou-td-sub {
  font-size: var(--fs-2xs);
  color: var(--text-hint);
  margin-top: 2px;
}
.ou-td-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
}

/* Pagination */
.ou-paginate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  border-top: 1px solid var(--border-2);
  flex-wrap: wrap;
}
.ou-paginate-info {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  font-weight: var(--fw-bold);
}

/* ═══════════ KPI / STAT ═══════════ */
.ou-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.ou-kpi {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: all var(--t-base);
  animation: ouCardIn .35s var(--ease) both;
}
.ou-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
  border-color: var(--accent-border);
}
.ou-kpi-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-heavy);
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text);
}
.ou-kpi-label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-top: 6px;
}
.ou-kpi-meta {
  font-size: var(--fs-xs);
  color: var(--text-hint);
  margin-top: 4px;
}
.ou-kpi--ok    .ou-kpi-value { color: var(--ok); }
.ou-kpi--err   .ou-kpi-value { color: var(--err); }
.ou-kpi--warn  .ou-kpi-value { color: var(--warn); }
.ou-kpi--info  .ou-kpi-value { color: var(--info); }
.ou-kpi--accent .ou-kpi-value { color: var(--accent); }

/* Stagger */
.ou-kpi-grid > *:nth-child(1) { animation-delay: 0ms; }
.ou-kpi-grid > *:nth-child(2) { animation-delay: 45ms; }
.ou-kpi-grid > *:nth-child(3) { animation-delay: 90ms; }
.ou-kpi-grid > *:nth-child(4) { animation-delay: 135ms; }
.ou-kpi-grid > *:nth-child(5) { animation-delay: 180ms; }
.ou-kpi-grid > *:nth-child(6) { animation-delay: 225ms; }
@keyframes ouCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════ ALERT (inline, for validation only) ═══════════ */
.ou-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  border: 1.5px solid;
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
  margin-bottom: var(--s-4);
}
.ou-alert--ok   { background: var(--ok-soft);   border-color: var(--ok-border);   color: var(--ok); }
.ou-alert--err  { background: var(--err-soft);  border-color: var(--err-border);  color: var(--err); }
.ou-alert--warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.ou-alert--info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }

/* ═══════════ EMPTY STATE ═══════════ */
.ou-empty {
  text-align: center;
  padding: var(--s-12) var(--s-5);
}
.ou-empty-circle {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto var(--s-4);
}
.ou-empty-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
  color: var(--text);
  margin-bottom: var(--s-2);
  letter-spacing: -.3px;
}
.ou-empty-desc {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  max-width: 340px;
  margin: 0 auto var(--s-5);
  line-height: var(--lh-base);
}

/* ═══════════ FILTER BAR ═══════════ */
.ou-filter {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--sh-1);
}
.ou-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  align-items: end;
}
.ou-filter-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.ou-filter-count {
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-mute);
}

/* ═══════════ MODAL ═══════════ */
.ou-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  animation: ouFade .2s ease both;
}
@keyframes ouFade { from { opacity: 0; } to { opacity: 1; } }
.ou-modal {
  background: var(--surface);
  border-radius: var(--r-2xl);
  padding: var(--s-6);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--sh-4);
  animation: ouModalIn .28s var(--ease) both;
}
@keyframes ouModalIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.ou-modal-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: var(--s-4);
}
.ou-modal-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-heavy);
  color: var(--text);
  margin-bottom: var(--s-2);
  letter-spacing: -.3px;
}
.ou-modal-desc {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  line-height: var(--lh-base);
  margin-bottom: var(--s-5);
}
.ou-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

/* ═══════════ TOAST ═══════════ */
#ums-toast-container {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  pointer-events: none;
  width: 380px;
  max-width: calc(100vw - var(--s-8));
}
.ums-toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--sh-4);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  animation: ouToastIn .42s var(--ease-spring) both;
}
.ums-toast.hiding { animation: ouToastOut .26s ease forwards; }
.ums-toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: var(--r-pill) 0 0 var(--r-pill);
}
.ums-toast.success::before { background: var(--ok); }
.ums-toast.error::before   { background: var(--err); }
.ums-toast.warning::before { background: var(--warn); }
.ums-toast.info::before    { background: var(--info); }

.ums-toast-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ums-toast.success .ums-toast-icon { background: var(--ok-soft); }
.ums-toast.error   .ums-toast-icon { background: var(--err-soft); }
.ums-toast.warning .ums-toast-icon { background: var(--warn-soft); }
.ums-toast.info    .ums-toast-icon { background: var(--info-soft); }

.ums-toast-body { flex: 1; min-width: 0; }
.ums-toast-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  color: var(--text);
  line-height: 1.3;
}
.ums-toast-msg {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  line-height: 1.45;
  margin-top: 1px;
  word-break: break-word;
}
.ums-toast-close {
  width: 30px; height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: var(--fw-bold);
  color: var(--text-hint);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.ums-toast-close:hover { background: var(--surface-3); }
.ums-toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  animation: ouToastProgress linear forwards;
}
.ums-toast.success .ums-toast-progress { background: var(--ok); }
.ums-toast.error   .ums-toast-progress { background: var(--err); }
.ums-toast.warning .ums-toast-progress { background: var(--warn); }
.ums-toast.info    .ums-toast-progress { background: var(--info); }

@keyframes ouToastIn {
  from { opacity: 0; transform: translateX(60px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes ouToastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(60px) scale(.92); }
}
@keyframes ouToastProgress { from { width: 100%; } to { width: 0%; } }

/* ═══════════ MOBILE — CRITICAL ═══════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
}

@media (max-width: 768px) {
  :root {
    --fs-md: 16px;    /* never below 16px on mobile — prevents iOS zoom */
    --topbar-h: 60px;
  }
  /* Headings stack */
  .ou-head {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
  }
  .ou-head-title { font-size: var(--fs-xl); }
  .ou-head-actions { width: 100%; }
  .ou-head-actions .ou-btn { flex: 1; }

  /* Cards get less padding, less radius */
  .ou-card { padding: var(--s-4); border-radius: var(--r-lg); }
  .ou-card-title { font-size: var(--fs-md); }

  /* KPI grid → 2 cols */
  .ou-kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .ou-kpi { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); }
  .ou-kpi-value { font-size: var(--fs-2xl); }

  /* Filter stacks */
  .ou-filter { padding: var(--s-4); border-radius: var(--r-lg); }
  .ou-filter-grid { grid-template-columns: 1fr; }
  .ou-filter-actions { width: 100%; }
  .ou-filter-actions .ou-btn { flex: 1; }

  /* Form single column */
  .ou-form-grid { grid-template-columns: 1fr; }

  /* Modals full-width bottom sheet */
  .ou-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .ou-modal {
    max-width: 100%;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    max-height: 88vh;
    animation: ouSheetIn .3s var(--ease) both;
  }
  @keyframes ouSheetIn {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .ou-modal-actions { grid-template-columns: 1fr; }

  /* Toasts full-width bottom */
  #ums-toast-container {
    bottom: var(--s-3);
    right: var(--s-3);
    left: var(--s-3);
    width: auto;
    max-width: none;
  }
  .ums-toast { border-radius: var(--r-lg); }
  .ums-toast::before { border-radius: var(--r-lg) 0 0 var(--r-lg); }

  /* ── MOBILE TABLE → CARD LIST ──
     Any table with .ou-table-mobile-cards turns each row into a card.
     Requires each td to have a data-label attribute. */
  .ou-table-mobile-cards thead { display: none; }
  .ou-table-mobile-cards,
  .ou-table-mobile-cards tbody,
  .ou-table-mobile-cards tr,
  .ou-table-mobile-cards td { display: block; width: 100%; }
  .ou-table-mobile-cards tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-3);
    margin-bottom: var(--s-3);
    box-shadow: var(--sh-1);
  }
  .ou-table-mobile-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding: var(--s-2) 0;
    border-bottom: 1px solid var(--border-2);
    text-align: right;
  }
  .ou-table-mobile-cards td:last-child { border-bottom: none; }
  .ou-table-mobile-cards td::before {
    content: attr(data-label);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-black);
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .6px;
    text-align: left;
    flex-shrink: 0;
  }
  .ou-table-mobile-cards td.no-label::before { content: none; }
  .ou-td-actions { justify-content: flex-end; }
  .ou-td-actions .ou-btn { flex: 1; }

  /* Pagination stacks */
  .ou-paginate { flex-direction: column; align-items: stretch; }

  /* Empty state smaller */
  .ou-empty { padding: var(--s-8) var(--s-4); }
  .ou-empty-circle { width: 68px; height: 68px; font-size: 30px; }
}

/* ═══════════ REDUCED MOTION ═══════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════ PRINT ═══════════ */
@media print {
  .topbar, .sidebar, #ums-toast-container,
  .ou-head-actions, .ou-filter, .ou-td-actions { display: none !important; }
  .ou-card { box-shadow: none; border: 1px solid #ccc; }
}

/* ═══════════ TOPBAR — Option A gradient ═══════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900; /* above content, below dropdowns(1200)/modals(2000); z-50 would sink under the sidebar drawer */
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-4);
  background: linear-gradient(90deg,
      var(--topbar-bg-start) 0%,
      var(--topbar-bg-mid) 45%,
      var(--topbar-bg-end) 100%);
  border-bottom: 1px solid var(--topbar-border);
  /* Identical in light and dark — brand chrome stays constant */
}

/* Floating light orbs */
@keyframes tbOrb {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(16px,10px) scale(1.08); }
}

.tb-left  { display: flex; align-items: center; gap: var(--s-3);
            flex: 1; min-width: 0; position: relative; z-index: 1; }
.tb-right { display: flex; align-items: center; gap: var(--s-2);
            flex-shrink: 0; position: relative; z-index: 1; }

/* Hamburger + icon buttons — glass on gradient */
.tb-icon-btn {
  width: 40px; height: 40px;
  min-width: 40px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  cursor: pointer;
  position: relative;
  transition: all var(--t-fast);
  backdrop-filter: blur(8px);
}
.tb-icon-btn:hover {
  background: rgba(255,255,255,.24);
  border-color: rgba(255,255,255,.34);
  transform: scale(1.05);
}
.tb-icon-btn--round { border-radius: 50%; }
.tb-icon-btn svg { width: 20px; height: 20px; stroke: #fff; }

/* Notification count badge */
.tb-count {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  background: var(--err);
  color: #fff;
  font-size: 9px;
  font-weight: var(--fw-heavy);
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #7a4f9e; /* mid-gradient tone */
}

/* Title — pure white + shadow for guaranteed legibility */
.tb-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-black);
  color: #ffffff;
  letter-spacing: -.3px;
  line-height: var(--lh-tight);
  text-shadow: 0 1px 4px rgba(0,0,0,.45), 0 0 20px rgba(0,0,0,.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-subtitle {
  font-size: var(--fs-2xs);
  color: rgba(255,255,255,.68);
  font-weight: var(--fw-med);
  margin-top: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── PROFILE CARD ── */
.tb-profile-wrap { position: relative; }
.tb-profile {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: rgba(0,0,0,.26);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--r-pill);
  padding: 4px 14px 4px 4px;
  cursor: pointer;
  transition: all var(--t-base);
  backdrop-filter: blur(10px);
  min-height: var(--touch);
}
.tb-profile:hover {
  background: rgba(0,0,0,.36);
  border-color: rgba(255,255,255,.38);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.tb-av {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4);
  overflow: visible;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.tb-av-img,
.tb-av-fallback {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}
.tb-av-fallback {
  background: linear-gradient(135deg,
    rgba(255,255,255,.32), rgba(255,255,255,.12));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
  color: #fff;
  letter-spacing: -.3px;
}
.tb-online {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  background: #30d158;
  border-radius: 50%;
  border: 2.5px solid #8a5aa0; /* gradient mid-tone */
  animation: tbPing 2.6s ease-in-out infinite;
}
@keyframes tbPing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(48,209,88,.5); }
  50%      { box-shadow: 0 0 0 6px rgba(48,209,88,0); }
}

.tb-uname {
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  color: #ffffff;
  letter-spacing: -.2px;
  line-height: var(--lh-tight);
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
  white-space: nowrap;
}
.tb-urole {
  font-size: var(--fs-2xs);
  color: rgba(255,255,255,.65);
  font-weight: var(--fw-med);
  margin-top: 1px;
  white-space: nowrap;
}
.tb-chev {
  font-size: var(--fs-md);
  color: rgba(255,255,255,.5);
  font-weight: 300;
  line-height: 1;
  transition: transform var(--t-fast);
}
.tb-chev.is-open { transform: rotate(90deg); }

/* ── DROPDOWN ── */
.tb-dd {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 292px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  padding: var(--s-2);
  z-index: 1200;
  /* Vanilla-JS driven (no Alpine): animate in each time it is un-hidden. */
  animation: tbDdIn .2s var(--ease) both;
}
@keyframes tbDdIn {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tb-dd-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-3) var(--s-3);
}
.tb-dd-av {
  width: 52px; height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent-border);
  flex-shrink: 0;
}
.tb-dd-av img,
.tb-dd-av .tb-av-fallback {
  width: 100%; height: 100%;
  object-fit: cover;
}
.tb-dd-av .tb-av-fallback {
  background: linear-gradient(135deg, var(--pu-grad-1), var(--pu-grad-3));
  font-size: var(--fs-lg);
}
.tb-dd-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-black);
  color: var(--text);
  letter-spacing: -.3px;
}
.tb-dd-email {
  font-size: var(--fs-2xs);
  color: var(--text-mute);
  margin-top: 2px;
  word-break: break-all;
}
.tb-dd-role {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: var(--fw-heavy);
  margin-top: 6px;
}
.tb-dd-div {
  height: 1px;
  background: var(--border-2);
  margin: var(--s-1) var(--s-2);
}
.tb-dd-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--touch);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background var(--t-fast);
}
.tb-dd-item:hover { background: var(--accent-soft); }
.tb-dd-ic {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.tb-dd-item--danger { color: var(--err); font-weight: var(--fw-bold); }
.tb-dd-item--danger:hover { background: var(--err-soft); }
.tb-dd-item--danger .tb-dd-ic { background: var(--err-soft); }
.tb-dd-note {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-2xs);
  color: var(--accent);
  font-weight: var(--fw-med);
  margin: var(--s-1) var(--s-2) var(--s-2);
  line-height: 1.5;
}

/* Dark-mode toggle pill inside dropdown */
.tb-dm-row { justify-content: space-between; cursor: default; }
.tb-dm-row:hover { background: none; }
.tb-dm-pill {
  width: 46px; height: 27px;
  min-width: 46px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.tb-dm-pill.is-on { background: var(--accent); }
.tb-dm-thumb {
  position: absolute;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform var(--t-base) var(--ease-spring);
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.tb-dm-pill.is-on .tb-dm-thumb { transform: translateX(19px); }

/* ── ALPINE DROPDOWN TRANSITIONS ── */
.tb-dd-in       { transition: all .22s var(--ease); }
.tb-dd-in-start { opacity: 0; transform: translateY(-8px) scale(.96); }
.tb-dd-in-end   { opacity: 1; transform: translateY(0) scale(1); }
.tb-dd-out      { transition: all .16s ease; }
[x-cloak]       { display: none !important; }

/* ── MOBILE TOPBAR ── */
@media (max-width: 768px) {
  .topbar { padding: 0 var(--s-3); gap: var(--s-2); }
  .tb-orb { display: none; }          /* keep it light on mobile */
  .tb-subtitle { display: none; }     /* save vertical space */
  .tb-title { font-size: var(--fs-sm); }
  .tb-uname, .tb-urole, .tb-chev { display: none; }
  .tb-profile {
    padding: 3px;
    border-radius: 50%;
    gap: 0;
  }
  .tb-dd {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    padding: var(--s-3) var(--s-3) calc(var(--s-4) + env(safe-area-inset-bottom));
    animation: ouSheetIn .3s var(--ease) both;
  }
  /* On mobile the dropdown is a bottom sheet — override the transform */
  .tb-dd-in-start { opacity: 0; transform: translateY(100%); }
  .tb-dd-in-end   { opacity: 1; transform: translateY(0); }
}

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 800;
  transition: background var(--t-base), border-color var(--t-base),
              transform var(--t-base);
}

.sb-head {
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
}
.sb-logo {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--pu-grad-1), var(--pu-grad-3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
  color: #fff;
  letter-spacing: -.5px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(118,75,162,.3);
}
/* Real PU logo image variant — white plate instead of the gradient monogram */
.sb-logo.has-img {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--sh-1);
}
.sb-logo.has-img img { width: 30px; height: 30px; object-fit: contain; display: block; }
.sb-brand-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  color: var(--text);
  line-height: var(--lh-tight);
}
.sb-brand-sub {
  font-size: 10px;
  color: var(--text-hint);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-top: 1px;
}

.sb-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sb-scroll::-webkit-scrollbar { width: 5px; }
.sb-scroll::-webkit-scrollbar-track { background: transparent; }
.sb-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-pill);
}

/* Section header — now a toggle button */
.sb-section {
  margin-bottom: var(--s-1);
}
.sb-section-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  font-weight: var(--fw-heavy);
  color: var(--text-hint);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
  min-height: 34px;
  text-align: left;
}
.sb-section-btn:hover {
  color: var(--text-mute);
  background: var(--surface-2);
}
.sb-section-code {
  width: 24px; height: 20px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-mute);
  font-size: 9px;
  font-weight: var(--fw-heavy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}
.sb-section-label { flex: 1; min-width: 0; }
.sb-section-chev {
  font-size: 12px;
  color: var(--text-hint);
  transition: transform var(--t-fast);
  flex-shrink: 0;
}
.sb-section-chev.is-open { transform: rotate(90deg); }

/* Nav item — pill */
.sb-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--touch);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast);
  margin-bottom: 2px;
  position: relative;
}
.sb-item:hover { background: var(--surface-2); }
.sb-item.is-active { background: var(--accent-soft); }

.sb-item-ic {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.sb-item.is-active .sb-item-ic {
  background: linear-gradient(135deg, var(--pu-grad-1), var(--pu-grad-2));
  color: #fff;
}
.sb-item-label {
  text-transform: none;      /* never SHOUTING — legacy sidebar.css did this */
  font-size: var(--fs-sm);   /* 13px min — readable */
  font-weight: var(--fw-med);
  letter-spacing: 0;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-fast);
}
.sb-item.is-active .sb-item-label {
  color: var(--accent);
  font-weight: var(--fw-black);
}
.sb-item-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: var(--fw-heavy);
  text-align: center;
  flex-shrink: 0;
}
.sb-item-badge--err  { background: var(--err);  color: #fff; }
.sb-item-badge--warn { background: var(--warn); color: #fff; }
.sb-item-badge--info { background: var(--info); color: #fff; }

/* MY WORKSPACE — pinned favourites, accented */
.sb-workspace .sb-item {
  background: linear-gradient(90deg,
    var(--accent-soft) 0%, transparent 100%);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding-left: calc(var(--s-3) - 3px);
}
.sb-workspace .sb-item:hover {
  background: linear-gradient(90deg,
    var(--accent-soft) 0%, var(--surface-2) 100%);
}
.sb-workspace .sb-section-btn { color: var(--accent); }

.sb-divider {
  height: 1px;
  background: var(--border-2);
  margin: var(--s-2) var(--s-3);
}

/* Footer status */
.sb-foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  color: var(--text-mute);
}
.sb-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: tbPing 2.6s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── MOBILE DRAWER ── */
.sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 850;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base), visibility var(--t-base);
}
body.sb-open .sb-backdrop {
  opacity: 1;
  visibility: visible;
}
body.sb-open { overflow: hidden; }

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 320px);
    transform: translateX(-100%);
    z-index: 900;
    box-shadow: var(--sh-4);
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.sb-open .sidebar {
    transform: translateX(0);
  }
  .sb-item { min-height: 48px; }        /* bigger touch on mobile */
  .sb-item-label { font-size: var(--fs-md); }
}

@media (min-width: 1025px) {
  .sb-backdrop { display: none; }
}

/* ── VANILLA COLLAPSE (no Alpine): section + nested panels driven by .is-open ──
   The prompt's x-show/x-collapse can't run (this app loads no Alpine runtime),
   so panels open/close via a container .is-open class toggled by the sidebar JS. */
.sb-panel,
.sb-subpanel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height var(--t-base), opacity var(--t-fast);
}
.sb-section.is-open > .sb-panel { max-height: 4000px; opacity: 1; }
.sb-subwrap.is-open > .sb-subpanel { max-height: 2000px; opacity: 1; }
.sb-section.is-open > .sb-section-btn .sb-section-chev { transform: rotate(90deg); }

/* Workspace is always expanded — no toggle, panel always shown */
.sb-workspace .sb-panel { max-height: none; opacity: 1; overflow: visible; }

/* Nested parent item (has children) + its child links */
.sb-item--parent {
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  text-align: left;
}
.sb-item-chev {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-hint);
  transition: transform var(--t-fast);
  flex-shrink: 0;
}
.sb-subwrap.is-open > .sb-item--parent .sb-item-chev { transform: rotate(90deg); }
.sb-subpanel { padding-left: var(--s-3); }
.sb-item--child { min-height: 40px; }
.sb-item--child .sb-item-ic {
  width: 24px; height: 24px;
  font-size: var(--fs-2xs);
  border-radius: 6px;
}
.sb-item--child .sb-item-label { font-size: var(--fs-sm); }

/* ── DESKTOP COLLAPSE RAIL (preserves the #puSidebarToggle feature) ── */
@media (min-width: 1025px) {
  .sidebar.is-collapsed { width: var(--sidebar-collapsed, 80px); }
  .sidebar.is-collapsed .sb-brand-text,
  .sidebar.is-collapsed .sb-item-label,
  .sidebar.is-collapsed .sb-item-chev,
  .sidebar.is-collapsed .sb-item-badge,
  .sidebar.is-collapsed .sb-section-label,
  .sidebar.is-collapsed .sb-section-chev,
  .sidebar.is-collapsed .sb-foot span { display: none; }
  .sidebar.is-collapsed .sb-item,
  .sidebar.is-collapsed .sb-section-btn,
  .sidebar.is-collapsed .sb-brand { justify-content: center; }
  .sidebar.is-collapsed .sb-workspace .sb-item {
    border-left: 0;
    border-radius: var(--r-md);
    padding-left: var(--s-2);
    background: var(--accent-soft);
  }
  .sidebar.is-collapsed .sb-panel,
  .sidebar.is-collapsed .sb-subpanel { max-height: 0 !important; opacity: 0 !important; }
  .sidebar.is-collapsed .sb-workspace .sb-panel { max-height: none !important; opacity: 1 !important; }
  .sidebar.is-collapsed .sb-head { padding: var(--s-3) var(--s-2); }
  .sidebar.is-collapsed .sb-divider { margin: var(--s-2); }
}

/* ═══════════ LOGIN PAGE (standalone shell) ═══════════ */
/* The login view does not extend layouts/app.blade.php; it links only
   this file. .login-page lives on <body> for the base reset. */
.login-page { margin: 0; }
.login-shell,
.login-shell * { box-sizing: border-box; }

.login-shell { display: flex; min-height: 100vh; }

/* ── Brand pane (left) — same gradient as the topbar ── */
.login-brand {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--pu-topbar-grad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-12);
}
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg,
    rgba(15,12,41,.34), rgba(15,12,41,.20) 60%, rgba(15,12,41,.40));
}
.login-brand > * { position: relative; z-index: 1; }
.login-orb { position: absolute; border-radius: 50%; pointer-events: none; }
/* three orbs, white radial glow, reuse the topbar tbOrb keyframes */
.login-orb--1 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%);
  top: -100px; right: -60px;
  animation: tbOrb 11s ease-in-out infinite alternate;
}
.login-orb--2 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 65%);
  bottom: -80px; left: -70px;
  animation: tbOrb 14s ease-in-out infinite alternate-reverse;
}
.login-orb--3 {
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 65%);
  top: 30%; left: 55%;
  animation: tbOrb 17s ease-in-out infinite alternate;
}

.login-brand-logo {
  position: absolute;
  top: var(--s-10);
  left: var(--s-12);
}
.login-brand-logo img {
  width: 148px;
  height: auto;
  display: block;
  /* paint the colour lockup pure white on the gradient */
  filter: brightness(0) invert(1) drop-shadow(0 4px 16px rgba(0,0,0,.28));
}

.login-title {
  font-size: 44px;
  font-weight: var(--fw-heavy);
  color: #fff;
  line-height: 1.1;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.login-sub {
  font-size: var(--fs-lg);
  color: rgba(255,255,255,.75);
  margin-top: var(--s-4);
  max-width: 380px;
  line-height: var(--lh-base);
}

.login-support {
  position: absolute;
  bottom: var(--s-8);
  left: var(--s-12);
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.65);
}
.login-support a {
  color: #fff;
  font-weight: var(--fw-bold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Form pane (right) ── */
.login-form-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-8);
  background: var(--bg);
}
.login-card { width: 100%; max-width: 400px; }
.login-heading {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-heavy);
  color: var(--text);
  letter-spacing: -.8px;
  margin: 0;
}
.login-heading-sub {
  font-size: var(--fs-md);
  color: var(--text-mute);
  margin-top: var(--s-2);
  margin-bottom: var(--s-6);
}

.login-google {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--fs-md);
  font-weight: var(--fw-black);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t-fast);
  box-shadow: var(--sh-1);
}
.login-google:hover {
  border-color: var(--accent);
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}
.login-google svg { width: 20px; height: 20px; flex-shrink: 0; }
/* Loading: block repeat clicks while the OAuth redirect is in flight */
.login-google.is-loading {
  pointer-events: none;
  opacity: .7;
}
.login-google.is-loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ouSpin .7s linear infinite;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-6) 0;
  font-size: var(--fs-xs);
  color: var(--text-hint);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-note {
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-xs);
  color: var(--info);
  line-height: var(--lh-base);
  margin-top: var(--s-5);
}

/* Password show/hide inside an .ou-input */
.login-pw-wrap { position: relative; }
.login-pw-wrap .ou-input { padding-right: 52px; }
.login-pw-toggle {
  position: absolute;
  top: 50%;
  right: var(--s-2);
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-hint);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.login-pw-toggle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.login-pw-toggle .icon-off { display: none; }
.login-pw-toggle[aria-pressed="true"] .icon-on  { display: none; }
.login-pw-toggle[aria-pressed="true"] .icon-off { display: block; }

/* ── Mobile: gradient becomes a short header band ── */
@media (max-width: 900px) {
  .login-shell { flex-direction: column; min-height: 100vh; }
  .login-brand {
    flex: none;
    min-height: 200px;
    padding: var(--s-6);
    justify-content: flex-end;
  }
  .login-brand-logo {
    top: var(--s-5);
    left: var(--s-6);
  }
  .login-brand-logo img { width: 104px; }
  .login-title { font-size: 28px; }
  .login-sub { font-size: var(--fs-sm); margin-top: var(--s-2); }
  .login-orb { display: none; }
  .login-support { display: none; }
  .login-form-pane { flex: 1; padding: var(--s-5) var(--s-4); align-items: flex-start; }
  .login-card { max-width: 100%; }
}

/* ═══════════ EXECUTIVE DASHBOARD ═══════════ */
.dash-hero {
  position: relative;
  overflow: hidden;
  background: var(--pu-topbar-grad);
  border-radius: var(--r-2xl);
  padding: var(--s-8);
  margin-bottom: var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
}
.dash-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    rgba(15,12,41,.30), rgba(15,12,41,.18) 55%, rgba(15,12,41,.42));
}
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.dash-hero-orb--1 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 66%);
  top: -140px; right: 120px;
  animation: tbOrb 11s ease-in-out infinite alternate;
}
.dash-hero-orb--2 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 66%);
  bottom: -110px; left: 180px;
  animation: tbOrb 14s ease-in-out infinite alternate-reverse;
}
.dash-hero-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  color: rgba(255,255,255,.62);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-bottom: var(--s-2);
}
.dash-hero-greet {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-heavy);
  color: #fff;
  letter-spacing: -1px;
  line-height: 1.15;
  text-shadow: 0 2px 12px rgba(0,0,0,.28);
}
.dash-hero-sub {
  font-size: var(--fs-md);
  color: rgba(255,255,255,.72);
  margin-top: var(--s-2);
}
.dash-hero-card {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  backdrop-filter: blur(14px);
  min-width: 240px;
}
.dash-hero-date {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.66);
  font-weight: var(--fw-med);
}
.dash-hero-session {
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
  color: #fff;
  margin-top: var(--s-1);
  letter-spacing: -.3px;
}
.dash-hero-meta {
  font-size: var(--fs-2xs);
  color: rgba(255,255,255,.5);
  margin-top: var(--s-2);
}

@media (max-width: 768px) {
  .dash-hero {
    padding: var(--s-5);
    border-radius: var(--r-xl);
    flex-direction: column;
    align-items: stretch;
  }
  .dash-hero-orb { display: none; }
  .dash-hero-greet { font-size: var(--fs-xl); }
  .dash-hero-card { min-width: 0; width: 100%; }
}

/* ── Quick task cards ── */
.dash-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3);
}
.dash-task {
  display: block;
  text-decoration: none;
}
.dash-task-ic {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  font-size: 22px;
  background: var(--ok-soft);
  margin-bottom: var(--s-3);
}
.dash-task--urgent .dash-task-ic { background: var(--err-soft); }
.dash-task-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-heavy);
  line-height: 1;
  letter-spacing: -1px;
  color: var(--err);
}
.dash-task-value.is-clear {
  font-size: var(--fs-xl);
  letter-spacing: -.3px;
  color: var(--ok);
}
.dash-task-label {
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
  color: var(--text-2);
}
.dash-task-link {
  display: block;
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  color: var(--accent);
}
@media (max-width: 768px) {
  .dash-task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .dash-task-grid { grid-template-columns: 1fr; }
  .dash-kpi-grid { grid-template-columns: 1fr; }
}

/* ── Activity timeline dots, coloured by event type ── */
.dash-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.dash-dot--info   { background: var(--info);   box-shadow: 0 0 0 4px var(--info-soft); }
.dash-dot--ok     { background: var(--ok);     box-shadow: 0 0 0 4px var(--ok-soft); }
.dash-dot--err    { background: var(--err);    box-shadow: 0 0 0 4px var(--err-soft); }
.dash-dot--accent { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ═══════════ SEGMENTED TABS ═══════════ */
.ou-tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
}
.ou-tab {
  padding: 8px 18px;
  border-radius: var(--r-pill);
  border: none;
  background: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-mute);
  cursor: pointer;
  text-decoration: none;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  transition: all var(--t-fast);
}
.ou-tab:hover { color: var(--text); }
.ou-tab.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--sh-1);
}
@media (max-width: 640px) {
  .ou-tabs { width: 100%; }
  .ou-tab { flex: 1; justify-content: center; padding: 8px 10px; }
}

/* ═══════════ TIER-3 BREAKDOWN PANEL ═══════════
   Reference detail grouped into one card instead of a wall of
   metric boxes. <details> gives a native, no-JS collapse. */
.ou-breakdown summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  color: var(--accent);
  min-height: var(--touch);
}
.ou-breakdown summary::-webkit-details-marker { display: none; }
.ou-breakdown summary::after {
  content: '›';
  font-size: var(--fs-md);
  transition: transform var(--t-fast);
}
.ou-breakdown[open] summary::after { transform: rotate(90deg); }

.ou-break-section {
  margin-top: var(--s-4);
}
.ou-break-section > h3 {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 0 0 var(--s-2);
}
.ou-break-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--border-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ou-break-item {
  background: var(--surface);
  padding: var(--s-3) var(--s-4);
  margin: 0;
}
.ou-break-item dt {
  font-size: var(--fs-xs);
  font-weight: var(--fw-med);
  color: var(--text-mute);
}
.ou-break-item dd {
  margin: 2px 0 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  color: var(--text);
  letter-spacing: -.3px;
}
.ou-break-item dd small {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-med);
  color: var(--text-hint);
  letter-spacing: 0;
}
/* zeros recede; problem figures speak */
.ou-break-item dd.is-zero { color: var(--text-hint); }
.ou-break-item dd.is-err  { color: var(--err); }

/* ═══════════ POST-DEPLOY FIXES (live screenshot audit) ═══════════ */
/* Long sidebar section names ("Research Management Centre") were
   clipping mid-word and pushing the chevron out of view. */
.sb-section-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Zeros recede, they don't shout — a coloured "0" reads as a problem. */
.ou-kpi.is-zero .ou-kpi-value { color: var(--text-hint); }

/* ═══════════════════════════════════════════════════
   ENTERPRISE LAYER — ERP standardization (2026-07-15)
   Hybrid direction: brand gradient stays in the topbar;
   everything below it is calm, flat, table-first.
   ═══════════════════════════════════════════════════ */

/* ── Staff sidebar compatibility alias; resolved by the v2 shell. ── */
:root { --sidebar-w: var(--ums-sidebar-expanded, 272px); }

/* ── Breadcrumb ── */
.ou-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-med);
  color: var(--text-hint);
  margin-bottom: var(--s-1);
}
.ou-crumbs a {
  color: var(--text-mute);
  text-decoration: none;
}
.ou-crumbs a:hover { color: var(--accent); }
.ou-crumbs .sep { color: var(--text-hint); opacity: .6; }
.ou-crumbs .current { color: var(--text-2); font-weight: var(--fw-bold); }

/* ── COMPACT PAGE HEADER (≤90px) ──
   Every page renders x-ums.page-header (.ou-head.ums-page-header).
   The enterprise header is a single calm row: breadcrumb + title +
   description on the left, actions + compact side meta on the right.
   No hero banners; module identity comes from the tabs below it. */
.ums-page-shell .ums-page-header,
.ums-module-page > .ums-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
  padding: var(--s-4) 0 var(--s-3);
  margin: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border-2);
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
}
.ums-page-header .ums-page-header-eyebrow {
  font-size: 10px;
  letter-spacing: 1.2px;
  margin-bottom: 2px;
}
.ums-page-header .ums-page-header-title {
  font-size: var(--fs-2xl);           /* 24px — calm, not a banner */
  font-weight: var(--fw-heavy);
  letter-spacing: -.5px;
  line-height: var(--lh-tight);
}
.ums-page-header .ums-page-header-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  margin-top: 2px;
  max-width: 720px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ums-page-header .ums-page-header-badges {
  margin-top: var(--s-2);
  gap: var(--s-1);
}
.ums-page-header .ums-header-pill {
  font-size: var(--fs-2xs);
  padding: 3px 10px;
}
/* Side slot: compact right-aligned meta, no card chrome. */
.ums-page-header .ums-page-header-side,
.ums-page-header .ums-header-side-card {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  text-align: right;
}
.ums-page-header .ums-header-side-card > span {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.ums-page-header .ums-header-side-card > strong {
  display: block;
  font-size: var(--fs-xl);
  font-weight: var(--fw-heavy);
  color: var(--text);
}
.ums-page-header .ums-header-side-card > p {
  font-size: var(--fs-2xs);
  color: var(--text-hint);
  margin: 2px 0 0;
}

/* ── Module tabs strip (sits directly under the page header) ── */
.ou-module-tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border-2);
  margin-bottom: var(--s-4);
  overflow-x: auto;
  scrollbar-width: none;
}
.ou-module-tabs::-webkit-scrollbar { display: none; }
.ou-module-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3);
  min-height: 42px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-mute);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.ou-module-tab:hover { color: var(--text); }
.ou-module-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Standard toolbar (below header/tabs, above the table) ── */
.ou-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-2) 0 var(--s-3);
}
.ou-toolbar-left, .ou-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ── WORKSPACE TABLE — tables are the primary content ──
   Sticky header, 600px working area, bulk select, density switch. */
.ou-worktable {
  min-height: 600px;
  display: flex;
  flex-direction: column;
}
.ou-worktable .ou-table-scroll {
  max-height: 70vh;
  overflow: auto;
}
.ou-worktable thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}
.ou-worktable .ou-table td { transition: padding var(--t-fast); }
.ou-worktable[data-density="compact"] .ou-table td { padding: var(--s-2) var(--s-4); }
.ou-worktable[data-density="compact"] .ou-table th { padding: var(--s-2) var(--s-4); }
.ou-worktable .col-check { width: 44px; text-align: center; }
.ou-worktable td.is-hidden-col, .ou-worktable th.is-hidden-col { display: none; }
.ou-worktable tr.is-selected td { background: var(--accent-soft); }

/* Bulk action bar appears once rows are selected */
.ou-bulkbar {
  display: none;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--accent);
}
.ou-bulkbar.is-visible { display: flex; }

/* Column-visibility / density popover */
.ou-colmenu { position: relative; }
.ou-colmenu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 950;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  padding: var(--s-2);
}
.ou-colmenu-panel[hidden] { display: none; }
.ou-colmenu-panel label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin: 0;
}
.ou-colmenu-panel label:hover { background: var(--surface-2); }

/* ── STICKY SAVE BAR (forms) ── */
.ou-form-page { max-width: 1200px; }
.ou-savebar {
  position: sticky;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  margin: var(--s-5) calc(-1 * var(--s-6)) calc(-1 * var(--s-8));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.ou-savebar .ou-savebar-note {
  margin-right: auto;
  font-size: var(--fs-xs);
  color: var(--text-mute);
}

@media (max-width: 768px) {
  .ums-page-shell .ums-page-header { padding-top: var(--s-3); }
  .ums-page-header .ums-page-header-side,
  .ums-page-header .ums-header-side-card { text-align: left; }
  .ou-toolbar-left, .ou-toolbar-right { width: 100%; }
  .ou-savebar { margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); }
}

/* Sidebar ERP zone headings */
.sb-zone-label {
  padding: var(--s-4) var(--s-3) var(--s-1);
  font-size: 10px;
  font-weight: var(--fw-heavy);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-hint);
  border-top: 1px solid var(--border-2);
  margin-top: var(--s-2);
}
.sb-zone-label:first-child { border-top: 0; margin-top: 0; }
.sidebar.is-collapsed .sb-zone-label { display: none; }

/* ═══════════ ENTERPRISE TOPBAR (compact, 3-zone) ═══════════ */
:root {
  --topbar-height:       64px;               /* alias, spec name */
  --topbar-bg-start:     #4F46E5;
  --topbar-bg-mid:       #7C3AED;
  --topbar-bg-end:       #C0266D;
  --topbar-text:         #FFFFFF;
  --topbar-muted:        rgba(255,255,255,.78);
  --topbar-border:       rgba(255,255,255,.12);
  --topbar-action-bg:    rgba(255,255,255,.10);
  --topbar-action-hover: rgba(255,255,255,.18);
}

/* Zones: LEFT identity/context · CENTER search+session · RIGHT actions */
.tb-left  { flex: 0 1 auto; min-width: 0; }
.tb-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.tb-right { flex: 0 0 auto; }

.tb-title { font-size: var(--fs-md); font-weight: var(--fw-med); text-shadow: none; }
.tb-subtitle { font-size: 11px; color: var(--topbar-muted); text-shadow: none; }

/* Standardized 40px action buttons, equal spacing, visible focus */
.tb-icon-btn {
  border-radius: var(--r-md);
  background: var(--topbar-action-bg);
  border-color: var(--topbar-border);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.tb-icon-btn:hover { background: var(--topbar-action-hover); transform: none; }
.tb-icon-btn:focus-visible,
.tb-search-input:focus-visible,
.tb-profile:focus-visible,
.tb-session:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Global search (UI shell) ── */
.tb-search {
  position: relative;
  width: min(420px, 100%);
  min-width: 220px;
}
.tb-search-input {
  width: 100%;
  height: 40px;
  padding: 0 64px 0 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--topbar-border);
  background: var(--topbar-action-bg);
  color: var(--topbar-text);
  font-family: var(--font);
  font-size: var(--fs-sm);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.tb-search-input::placeholder { color: var(--topbar-muted); }
.tb-search-input:focus {
  outline: none;
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.35);
}
.tb-search-ic {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--topbar-muted);
  pointer-events: none;
  font-size: var(--fs-sm);
}
.tb-search-kbd {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--topbar-muted);
  border: 1px solid var(--topbar-border);
  border-radius: 6px;
  padding: 1px 6px;
  pointer-events: none;
}
.tb-search-btn { display: none; } /* mobile-only icon variant */

/* ── Academic session chip ── */
.tb-session {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--topbar-border);
  background: var(--topbar-action-bg);
  color: var(--topbar-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}
.tb-session .is-unset { color: var(--topbar-muted); font-weight: var(--fw-med); }

/* Profile: flatter chip on the restrained bar */
.tb-profile {
  background: var(--topbar-action-bg);
  border-color: var(--topbar-border);
}
.tb-profile:hover {
  background: var(--topbar-action-hover);
  border-color: rgba(255,255,255,.3);
  transform: none;
  box-shadow: none;
}
.tb-online { border-color: var(--topbar-bg-mid); }
.tb-count  { border-color: var(--topbar-bg-mid); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .tb-urole { display: none; }            /* tablet: name only */
}
@media (max-width: 1024px) {
  .tb-search { display: none; }           /* full field hides… */
  .tb-search-btn { display: flex; }       /* …icon appears */
  .tb-session { display: none; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; --topbar-height: 56px; }
  .tb-subtitle { display: none; }
  .tb-center { display: none; }
}
