/* =========================
   workspace.css — Ichebo Platform Desktop Workspace
   Path: backend/static/css/workspace.css

   Desktop workspace layout for Level 3–5 stewards and coordinators.
   Activates at ≥ 1024px. Below 768px gracefully degrades to the
   existing mobile shell (navbar + bottom nav) — no regressions.

   Load order in base.html: after app-drawer.css, before page-specific CSS.
   ========================= */


/* ─── WORKSPACE BREAKPOINT GUARD ─────────────────────────────
   All workspace chrome is gated to ≥ 1024px.
   Below that, the existing mobile shell takes over.
────────────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
  .ws-sidebar,
  .ws-topbar { display: none !important; }
}


/* ─── ROOT LAYOUT ─────────────────────────────────────────────
   The .ics-shell gets .ws-active added by JS (workspace-init.js)
   when the user is Level 3+ and viewport ≥ 1024px.
   This switches the shell from mobile stack to sidebar layout.
────────────────────────────────────────────────────────────── */

@media (min-width: 1024px) {

  /* Override the mobile shell's default layout */
  body.ws-active {
    overflow: hidden; /* Prevent double scrollbars — sidebar scrolls, main scrolls */
  }

  /* Hide mobile-only chrome and main content when workspace is active */
  body.ws-active .ics-main { display: none !important; }
  body.ws-active .navbar { display: none !important; }
  body.ws-active .bottom-bar { display: none !important; }
  body.ws-active .fab { display: none !important; }

  /* The workspace wrapper — full viewport */
  .ws-layout {
    display: none; /* Hidden by default */
  }

  body.ws-active .ws-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--card); /* Stone #F5F3F0 — main content background */
    position: fixed;
    top: 0;
    left: 0;
  }

}


/* ─── SIDEBAR ─────────────────────────────────────────────────
   Fixed left panel. Ink dark background (#0E0E0E).
   Mirrors the dark hero sections on ichebo.online.
   Width: 240px fixed. Does not shrink or scroll horizontally.
────────────────────────────────────────────────────────────── */

.ws-sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  background: var(--ink);           /* #0E0E0E */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── Sidebar Logo area ── */
.ws-sidebar__logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.ws-sidebar__logo-mark {
  height: 20px;
  width: auto;
  fill: #f5f3f0;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.ws-sidebar__logo:hover .ws-sidebar__logo-mark {
  opacity: 0.8;
}

.ws-sidebar__wordmark {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ── Sidebar scroll area ── */
.ws-sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding-bottom: var(--space-m);
}

.ws-sidebar__scroll::-webkit-scrollbar { display: none; }

/* ── Nav section ── */
.ws-sidebar__section {
  padding: var(--space-s) var(--space-xs) var(--space-2xs);
}

.ws-sidebar__section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 0 var(--space-2xs);
  margin-bottom: var(--space-2xs);
  display: block;
}

/* ── Nav item ── */
.ws-sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--space-2xs);
  border-radius: var(--radius-s);   /* 4px — editorial sharpness */
  font-size: var(--fz--1);          /* 14px */
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast),
              background var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--ff-body);
}

.ws-sidebar__nav-item .material-symbols-outlined {
  font-size: 18px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.35);
  transition: color var(--transition-fast);
}

/* Hover state */
.ws-sidebar__nav-item:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
}

.ws-sidebar__nav-item:hover .material-symbols-outlined {
  color: rgba(255, 255, 255, 0.6);
}

/* Active state — the left red rule (signature pattern from ichebo.online) */
.ws-sidebar__nav-item.active {
  color: #ffffff;
  background: rgba(175, 50, 54, 0.14);
}

.ws-sidebar__nav-item.active .material-symbols-outlined {
  color: var(--primary);
}

.ws-sidebar__nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

/* Nav item badge — notification count */
.ws-sidebar__nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* ── Sidebar divider — DEPRECATED: use .ctx-divider from workspace_v2.css ── */
.ws-sidebar__divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-2xs) var(--space-xs);
}

/* ── Sidebar bottom user block ── */
.ws-sidebar__user {
  padding: var(--space-xs) var(--space-s);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  text-decoration: none;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.ws-sidebar__user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ws-sidebar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.ws-sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-sidebar__user-info {
  flex: 1;
  min-width: 0;
}

.ws-sidebar__user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.ws-sidebar__user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}

.ws-sidebar__level-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}


/* ─── WORKSPACE BODY ──────────────────────────────────────────
   The right area — topbar + scrollable main content.
────────────────────────────────────────────────────────────── */

.ws-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.ws-main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Hide detail panel globally by default */
.ws-detail-panel {
  display: none;
  width: 400px;
  min-width: 400px;
  border-left: 1px solid var(--border);
  background: var(--card);
  overflow-y: auto;
}

/* Enable detail panel only for master-detail layouts */
.ws-layout--master-detail .ws-detail-panel {
  display: block;
}

/* Master-detail pages use full-bleed content on the left */
.ws-layout--master-detail .ws-content {
  flex: 1;
}


/* ─── TOPBAR ──────────────────────────────────────────────────
   56px fixed bar above the main content area.
   Carries: breadcrumb / page title + right actions.
   Does NOT span the sidebar (sidebar has its own logo).
────────────────────────────────────────────────────────────── */

.ws-topbar {
  height: 56px;
  background: var(--bg);            /* White in light, #0E0E0E in dark */
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-m);
  flex-shrink: 0;
  gap: var(--space-s);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Breadcrumb */
.ws-topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fz--2);
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
}

.ws-topbar__breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.ws-topbar__breadcrumb a:hover { color: var(--text); }

.ws-topbar__breadcrumb-sep {
  color: rgba(0, 0, 0, 0.2);
  font-size: 10px;
  flex-shrink: 0;
}

.ws-topbar__current {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar right actions */
.ws-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-shrink: 0;
}

/* Topbar icon button */
.ws-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-m);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast);
  font-size: 18px;
}

.ws-icon-btn:hover {
  background: var(--hover);
  color: var(--text);
  border-color: var(--border);
}

/* Topbar primary CTA button */
.ws-topbar__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  height: 36px;
  padding: 0 var(--space-s);
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-s);
  font-size: var(--fz--1);
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--ff-body);
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.ws-topbar__cta:hover { background: var(--primary-dark); }
.ws-topbar__cta .material-symbols-outlined { font-size: 16px; }

/* Topbar search */
.ws-topbar__search {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 0 12px;
  height: 36px;
  width: 220px;
  transition: border-color var(--transition-fast),
              width var(--transition);
}

.ws-topbar__search:focus-within {
  border-color: var(--primary);
  width: 280px;
}

.ws-topbar__search .material-symbols-outlined {
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.ws-topbar__search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--fz--1);
  color: var(--text);
  font-family: var(--ff-body);
  outline: none;
  min-width: 0;
}

.ws-topbar__search input::placeholder { color: var(--muted-light); }


/* ─── MAIN CONTENT AREA ───────────────────────────────────────
   The scrollable content zone. Stone (#F5F3F0) background.
   Content column is constrained to 960px for readability
   but the background fills the full available width.
────────────────────────────────────────────────────────────── */

.ws-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--card);
  scrollbar-width: thin;
  scrollbar-color: var(--stone-2, #ece9e4) transparent;
}

.ws-content::-webkit-scrollbar { width: 6px; }
.ws-content::-webkit-scrollbar-track { background: transparent; }
.ws-content::-webkit-scrollbar-thumb {
  background: var(--card-2);
  border-radius: var(--radius-pill);
}

/* Content inner — the actual content column */
.ws-content__inner {
  max-width: 960px;
  margin-inline: auto;
  padding: var(--space-l) var(--space-l) var(--space-3xl);
}

/* ── Page header (inside ws-content) ── */
.ws-page-header {
  margin-bottom: var(--space-l);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-m);
  flex-wrap: wrap;
}

.ws-page-header__left { flex: 1; min-width: 0; }

.ws-page-title {
  font-family: var(--ff-display);
  font-size: 48px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}

.ws-page-title em {
  font-style: italic;
  color: var(--primary);
  font-weight: 900;
}

.ws-page-subtitle {
  font-size: var(--fz--1);
  color: var(--muted);
  line-height: 1.5;
}

.ws-page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-shrink: 0;
}


/* ─── RIGHT PANEL (optional) ──────────────────────────────────
   Slide-in right panel for record detail, member profile, etc.
   Hidden by default. Toggled via JS adding .ws-panel--open.
────────────────────────────────────────────────────────────── */

.ws-panel {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform var(--transition);
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 60;
}

/* At very wide screens (≥ 1400px), right panel is always visible */
@media (min-width: 1400px) {
  .ws-panel {
    position: static;
    transform: none;
  }
}

.ws-panel--open {
  transform: translateX(0);
}

.ws-panel__header {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-s);
  flex-shrink: 0;
}

.ws-panel__title {
  font-size: var(--fz-0);
  font-weight: 600;
  color: var(--text);
}

.ws-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-m);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  transition: background var(--transition-fast);
}

.ws-panel__close:hover { background: var(--hover); }

.ws-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-m);
}


/* ─── WORKSPACE COMPONENT LIBRARY ────────────────────────────
   Components specific to the desktop workspace.
   General components (cards, badges, buttons) are in main.css.
────────────────────────────────────────────────────────────── */

/* ── Stat cards (dashboard metrics) ── */
.ws-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-s);
  margin-bottom: var(--space-l);
}

.ws-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--space-s) var(--space-s) var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.ws-stat-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-card);
}

/* Optional left accent colour on stat card */
.ws-stat-card--accent {
  border-left: 3px solid var(--primary);
  padding-left: calc(var(--space-s) - 3px);
}

.ws-stat-card--success { border-left: 3px solid var(--success); padding-left: calc(var(--space-s) - 3px); }
.ws-stat-card--warning { border-left: 3px solid var(--warning); padding-left: calc(var(--space-s) - 3px); }
.ws-stat-card--info    { border-left: 3px solid var(--secondary); padding-left: calc(var(--space-s) - 3px); }

.ws-stat-card__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--muted);
}

.ws-stat-card__value {
  font-family: var(--ff-display);
  font-size: var(--fz-4);          /* 32px */
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.ws-stat-card__sub {
  font-size: var(--fz--2);
  color: var(--muted);
  margin-top: 2px;
}

/* ── Section header row (label + action) ── */
.ws-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  margin-bottom: var(--space-s);
  flex-wrap: wrap;
}

.ws-section-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.ws-section-title {
  font-family: var(--ff-display);
  font-size: var(--fz-2);           /* 20px */
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ws-section-action {
  font-size: var(--fz--2);
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity var(--transition-fast);
}

.ws-section-action:hover { opacity: 0.75; }
.ws-section-action .material-symbols-outlined { font-size: 14px; }

/* ── Data table ── */
.ws-table-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  margin-bottom: var(--space-m);
}

.ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fz--1);
}

.ws-table thead {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.ws-table th {
  padding: var(--space-2xs) var(--space-s);
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--muted);
  white-space: nowrap;
}

.ws-table th:first-child { padding-left: var(--space-s); }
.ws-table th:last-child { padding-right: var(--space-s); }

.ws-table td {
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.ws-table td:first-child { padding-left: var(--space-s); }
.ws-table td:last-child { padding-right: var(--space-s); }

.ws-table tbody tr:last-child td { border-bottom: none; }

.ws-table tbody tr {
  transition: background var(--transition-fast);
  cursor: default;
}

.ws-table tbody tr:hover { background: var(--card); }

.ws-table tbody tr.ws-row--clickable { cursor: pointer; }

/* Table cell variants */
.ws-td-muted { color: var(--muted); }
.ws-td-primary { color: var(--primary); font-weight: 600; }
.ws-td-mono {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: var(--fz--2);
  color: var(--muted);
}

/* Table empty row */
.ws-table-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-m);
  color: var(--muted);
  font-size: var(--fz--1);
}

/* ── Workspace card (wider than mobile card) ── */
.ws-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--space-m);
  margin-bottom: var(--space-s);
}

.ws-card--accent {
  border-left: 3px solid var(--primary);
  padding-left: calc(var(--space-m) - 3px);
}

/* ── Two column layout within ws-content ── */
.ws-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  margin-bottom: var(--space-m);
}

.ws-cols--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.ws-cols--sidebar {
  grid-template-columns: 1fr 300px;
}

/* ── Tab row (workspace-specific, sits below topbar) ── */
.ws-tab-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.ws-tab-row::-webkit-scrollbar { display: none; }

.ws-tab {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-s);
  font-size: var(--fz--1);
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--ff-body);
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  outline: none;
}

.ws-tab.active,
.ws-tab[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Inline label-tag for workspace (matches ichebo.online) ── */
.ws-label-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-2xs);
}

.ws-label-tag::before {
  content: '';
  width: 16px;
  height: 2px;
  background: var(--primary);
  flex-shrink: 0;
}


/* ─── DARK MODE OVERRIDES ─────────────────────────────────────
   The sidebar is already --ink so stays the same.
   Main content area, topbar, and cards shift.
────────────────────────────────────────────────────────────── */

html.dark .ws-topbar {
  background: var(--ink-2);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-content {
  background: var(--ink);
}

html.dark .ws-stat-card,
html.dark .ws-card,
html.dark .ws-table-wrap {
  background: var(--ink-2);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-table thead {
  background: rgba(255, 255, 255, 0.03);
}

html.dark .ws-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

html.dark .ws-table td {
  border-color: rgba(255, 255, 255, 0.05);
}

html.dark .ws-tab-row {
  background: var(--ink-2);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-page-title { color: #f5f3f0; }
html.dark .ws-section-title { color: #f5f3f0; }

html.dark .ws-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
}

html.dark .ws-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

html.dark .ws-topbar__search {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark .ws-topbar__search input { color: #f5f3f0; }

html.dark .ws-topbar__breadcrumb-sep {
  color: rgba(255, 255, 255, 0.15);
}

html.dark .ws-panel {
  background: var(--ink-2);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-panel__header {
  border-color: rgba(255, 255, 255, 0.06);
}


/* ═══════════════════════════════════════════════════════════════
   WORKSPACE LAYOUT PATTERNS
   Three named patterns applied via class on the ws-content wrapper.
   Each page picks one. Never mixed on the same page.
   ═══════════════════════════════════════════════════════════════ */


/* ── Pattern 1: GRID ──────────────────────────────────────────
   Used by: Dashboard
   Full-width content split into responsive columns.
   No list/detail split — content is self-contained sections.
   The inner column is wider than default (1200px vs 960px)
   to make use of the desktop canvas.
────────────────────────────────────────────────────────────── */

.ws-layout--grid .ws-content__inner {
  max-width: 1200px;
  padding: var(--space-l) var(--space-l) var(--space-3xl);
}

/* Primary grid: two columns, left wider */
.ws-grid-primary {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-m);
  align-items: start;
}

/* Three-column stat strip */
.ws-grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

/* Full-width section inside the grid layout */
.ws-grid-full {
  grid-column: 1 / -1;
}

/* Stack to single column on narrower workspace viewports */
@media (max-width: 1199px) {
  .ws-grid-primary {
    grid-template-columns: 1fr;
  }
}

/* Dark mode */
html.dark .ws-grid-primary { color: inherit; }


/* ── Pattern 2: MASTER-DETAIL ─────────────────────────────────
   Used by: Governance, Tenants, Community
   Fixed list panel on the left, detail panel fills the rest.
   Clicking a list item loads content into #ws-detail via HTMX.
   The ws-content__inner max-width is removed — layout is full bleed.
────────────────────────────────────────────────────────────── */

.ws-layout--master-detail .ws-content__inner {
  max-width: none;
  padding: 0;
  height: 100%;
  display: flex;
}

/* The master-detail container fills the available height */
.ws-master-detail {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* List panel — fixed width, scrollable */
.ws-list-panel {
  width: 300px;
  min-width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ws-list-panel--wide {
  width: 360px;
  min-width: 360px;
}

/* List panel header — search / filter / title */
.ws-list-panel__header {
  padding: var(--space-s) var(--space-s) var(--space-xs);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ws-list-panel__title {
  font-size: var(--fz-0);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2xs);
}

.ws-list-panel__search {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 0 var(--space-xs);
  height: 34px;
}

.ws-list-panel__search .material-symbols-outlined {
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.ws-list-panel__search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--fz--1);
  color: var(--text);
  font-family: var(--ff-body);
  outline: none;
  min-width: 0;
}

/* List panel scrollable items */
.ws-list-panel__scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ws-list-panel__scroll::-webkit-scrollbar { width: 4px; }
.ws-list-panel__scroll::-webkit-scrollbar-thumb { background: var(--border); }

/* List item row */
.ws-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
  color: var(--text);
}

.ws-list-item:hover {
  background: var(--card);
}

.ws-list-item.active,
.ws-list-item[aria-selected="true"] {
  background: rgba(175, 50, 54, 0.06);
  border-left: 3px solid var(--primary);
  padding-left: calc(var(--space-s) - 3px);
}

.ws-list-item__title {
  font-size: var(--fz--1);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.ws-list-item__meta {
  font-size: var(--fz--2);
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-list-item__badge {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Detail panel — fills remaining space, scrollable */
.ws-detail-panel {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  background: var(--card);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ws-detail-panel::-webkit-scrollbar { width: 6px; }
.ws-detail-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }

/* Detail panel inner padding */
.ws-detail-panel__inner {
  padding: var(--space-l);
  max-width: 800px;
}

/* Empty state for detail panel — shown when nothing is selected */
.ws-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--muted);
  gap: var(--space-xs);
  padding: var(--space-2xl);
  text-align: center;
}

.ws-detail-empty .material-symbols-outlined {
  font-size: 40px;
  opacity: 0.25;
}

.ws-detail-empty__label {
  font-size: var(--fz--1);
  color: var(--muted);
}

/* Dark mode — master-detail */
html.dark .ws-list-panel {
  background: var(--ink-2);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-list-panel__header {
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark .ws-list-item {
  border-color: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.75);
}

html.dark .ws-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

html.dark .ws-list-item.active {
  background: rgba(175, 50, 54, 0.12);
}

html.dark .ws-detail-panel {
  background: var(--ink);
}

html.dark .ws-list-panel__search {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark .ws-list-panel__search input { color: #f5f3f0; }


/* ── Pattern 3: FULL PAGE ─────────────────────────────────────
   Used by: Activity, Learn, Records, Video Live, Notifications
   Full content width, natural scroll.
   Creation/edit opens the ws-panel slide-in.
   Optional tab bar via {% block ws_tabs %}.
   Wider inner column (1200px) for content-heavy views.
────────────────────────────────────────────────────────────── */

.ws-layout--full-page .ws-content__inner {
  max-width: 1200px;
  padding: var(--space-l) var(--space-l) var(--space-3xl);
}

/* Toolbar row — sits at the top of full-page content.
   Holds filters, search, primary action. */
.ws-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
  flex-wrap: wrap;
}

.ws-toolbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}

.ws-toolbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* Filter pill — lightweight tag-style filter button */
.ws-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 var(--space-xs);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--fz--2);
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition-fast),
              color var(--transition-fast),
              background var(--transition-fast);
  white-space: nowrap;
  font-family: var(--ff-body);
}

.ws-filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ws-filter-pill.active {
  background: rgba(175, 50, 54, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.ws-filter-pill .material-symbols-outlined { font-size: 14px; }

/* Feed / list container inside full-page layout */
.ws-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Inner content wrapper — constrains width, provides padding */
.ws-full-page-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-l) var(--space-l) var(--space-3xl);
}

/* Feed section — labelled group of items within a full-page view */
.ws-feed-section {
  margin-bottom: var(--space-l);
}

/* Empty state — centred placeholder when a list is empty */
.ws-empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-m);
  color: var(--muted);
}

/* Workspace button — consistent CTA style for ws_content areas */
.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 var(--space-s);
  border-radius: var(--radius-s);
  font-size: var(--fz--1);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.ws-btn:hover { border-color: var(--primary); color: var(--primary); }
.ws-btn .material-symbols-outlined { font-size: 16px; }

.ws-btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ws-btn--primary:hover { background: var(--primary-dark, var(--primary)); opacity: 0.9; color: #fff; }

.ws-btn--secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.ws-btn--secondary:hover { border-color: var(--primary); color: var(--primary); }

/* Dark mode — full page */
html.dark .ws-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

html.dark .ws-filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

html.dark .ws-filter-pill.active {
  background: rgba(175, 50, 54, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

html.dark .ws-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}
html.dark .ws-btn:hover { border-color: var(--primary); color: var(--primary); }
html.dark .ws-btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
html.dark .ws-btn--primary:hover { opacity: 0.9; color: #fff; }
html.dark .ws-btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
}
html.dark .ws-btn--secondary:hover { border-color: var(--primary); color: var(--primary); }


/* ─── DASHBOARD-SPECIFIC COMPONENTS ──────────────────────────
   Components used only in the dashboard ws_content block.
────────────────────────────────────────────────────────────── */

/* ── Divine Intel block ── */
.ws-dash-intel {
  background: var(--ink);
  border-radius: var(--radius-m);
  padding: var(--space-m);
  color: rgba(255, 255, 255, 0.9);
}

.ws-dash-intel .ws-label-tag {
  color: var(--primary);
  margin-bottom: var(--space-s);
}

.ws-dash-intel .ws-label-tag::before {
  background: var(--primary);
}

.ws-dash-intel__body {
  display: flex;
  gap: var(--space-s);
  align-items: flex-start;
  margin-bottom: var(--space-s);
}

.ws-dash-intel__icon {
  font-size: 20px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.ws-dash-intel__prompt {
  font-family: var(--ff-display);
  font-size: var(--fz-1);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  border: none;
  padding: 0;
}

.ws-dash-intel__pathway {
  font-size: var(--fz--2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: var(--space-s);
}

.ws-dash-intel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

/* Override filter pill colours inside dark intel block */
.ws-dash-intel .ws-filter-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}

.ws-dash-intel .ws-filter-pill:hover,
.ws-dash-intel .ws-filter-pill.active {
  background: rgba(175, 50, 54, 0.25);
  border-color: var(--primary);
  color: #fff;
}

/* ── DAR card ── */
.ws-dar {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.ws-dar__status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
}

.ws-dar__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-dar__text strong {
  font-size: var(--fz-0);
  font-weight: 700;
  color: var(--text);
}

.ws-dar__text span {
  font-size: var(--fz--2);
  color: var(--muted);
}

.ws-dar__action {
  display: flex;
  justify-content: flex-end;
}

/* Pending state — subtle warm tint */
.ws-dar--pending {
  border-color: rgba(202, 138, 4, 0.3);
  background: rgba(202, 138, 4, 0.04);
}

/* ── Quick links grid ── */
.ws-quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xs);
  margin-top: var(--space-xs);
}

.ws-quick-link {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-xs);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-size: var(--fz--1);
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}

.ws-quick-link:hover {
  background: var(--card);
  border-color: var(--primary);
  color: var(--primary);
}

.ws-quick-link .material-symbols-outlined {
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.ws-quick-link:hover .material-symbols-outlined {
  color: var(--primary);
}

/* ── Streak pills (workspace variant) ── */
.ws-streak-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-3xs) var(--space-xs);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.ws-streak-pill__val {
  font-family: var(--ff-display);
  font-size: var(--fz-0);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.ws-streak-pill__title {
  font-size: var(--fz--2);
  font-weight: 500;
  color: var(--muted);
}

/* Dark mode — dashboard components */
html.dark .ws-dash-intel {
  background: var(--ink-2);
}

html.dark .ws-dar__text strong { color: #f5f3f0; }

html.dark .ws-quick-link {
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

html.dark .ws-quick-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

html.dark .ws-streak-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ─── GLOBAL SEARCH OVERLAY ──────────────────────────────────
   Premium search interface triggered by CMD+K or /.
────────────────────────────────────────────────────────────── */

.ws-search-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(14, 14, 14, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  padding: 8vh 1rem 1rem;
  align-items: flex-start;
  justify-content: center;
}

.ws-search-overlay.active {
  display: flex;
}

.ws-search-container {
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.ws-search-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
}

.ws-search-header .material-symbols-outlined {
  font-size: 24px;
  color: var(--primary);
}

.ws-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.15rem;
  font-family: var(--ff-body);
  color: var(--text);
  outline: none;
}

.ws-search-input::placeholder {
  color: var(--muted);
}

.ws-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--card);
}

.ws-search-group-label {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.6;
}

.ws-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-m);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  cursor: pointer;
}

.ws-search-item:hover,
.ws-search-item.selected {
  background: var(--hover);
}

.ws-search-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

.ws-search-item.selected .ws-search-item__icon,
.ws-search-item:hover .ws-search-item__icon {
  color: var(--primary);
  background: rgba(175, 50, 54, 0.1);
}

.ws-search-item__content {
  flex: 1;
  min-width: 0;
}

.ws-search-item__title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-search-item__meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.ws-search-footer {
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  font-size: 11px;
  color: var(--muted);
}

.ws-search-footer kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
  margin-right: 4px;
}
