:root {
  --bg-app: #f7f6fa;
  --bg-sidebar: #100220;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.1);
  --bg-card: #ffffff;
  --bg-muted: #f7f3f8;
  --border: #e5e7eb;
  --border-strong: #bdbdbd;
  --text: #17131d;
  --text-muted: #766f7f;
  --text-sidebar: #f8f3ff;
  --text-sidebar-muted: #bca3d3;
  --primary: #cc036a;
  --primary-hover: #ab0358;
  --primary-soft: #fde8f3;
  --pink: #d81b60;
  --pink-hover: #c2185b;
  --pink-2: #ff4aa0;
  --accent: #d81b60;
  --success: #026451;
  --warning: #b45309;
  --danger: #ff3939;
  --sidebar-width: 248px;
  --sidebar-width-collapsed: 0px;
  --planner-width: 320px;
  --header-height: 56px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
}

.hidden { display: none !important; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(900px 320px at 50% -120px, rgba(255, 74, 160, 0.09), transparent 55%),
    radial-gradient(700px 260px at 18% 120px, rgba(20, 20, 20, 0.035), transparent 55%), #fbfbff;
}
.login-card {
  width: min(420px, 92vw);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.login-card--wide { width: min(520px, 92vw); }
.login-user-preview {
  padding: 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.login-user-preview strong { color: var(--text); }
.login-access-note { display: block; margin-top: 0.35rem; font-size: 0.75rem; }
.header-user-name { font-size: 0.8125rem; font-weight: 500; margin-right: 0.25rem; }
.access-denied {
  text-align: center;
  padding: 3rem 1.5rem;
}
.access-denied h2 { margin: 0 0 0.5rem; }
.stakeholder-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.stakeholder-home-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s;
}
.stakeholder-home-card:hover { border-color: var(--primary); }
.stakeholder-home-card h4 { margin: 0 0 0.35rem; font-size: 0.9rem; }
.stakeholder-home-card p { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.app.stakeholder-mode .planner-panel { display: none; }
.app.stakeholder-mode { grid-template-columns: var(--sidebar-width) 1fr !important; }

/* V2 interactive */
.version-pill {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #059669;
  color: #fff;
}
.version-pill--v21 { background: linear-gradient(135deg, #cc036a, #d81b60); }
.version-pill--v22 { background: linear-gradient(135deg, #e1007a, #cc036a); }
.version-pill--lg { font-size: 0.75rem; vertical-align: middle; margin-left: 0.35rem; }
.screen-title { margin: 0; font-size: 1.15rem; }
.toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.input-search { min-width: 180px; padding: 0.4rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.je-batch-filters .je-filter-field,
.je-filter-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.je-filter-field .select,
.je-filter-field .input--date {
  min-width: 8.5rem;
  max-width: 12rem;
}
.je-filter-field--multi {
  align-items: flex-start;
}
.je-filter-field--multi .select--multi {
  min-width: 11rem;
  max-width: 14rem;
  height: auto;
}
.je-filter-field--disabled {
  opacity: 0.55;
}
.je-upload-menu {
  z-index: 80;
  min-width: 11rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.je-upload-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  color: var(--text, #0f172a);
}
.je-upload-menu__item:hover {
  background: var(--bg-muted, #f1f5f9);
}
.je-upload-result .text-success { color: #15803d; }
.je-upload-result .text-danger { color: #b91c1c; }
.input.input--date {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.form-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 100%;
  align-items: start;
  column-gap: 1.25rem;
  row-gap: 0.9rem;
}
/* Explicit single-column (e.g. note-only panels) */
.form-grid--1 {
  grid-template-columns: minmax(0, 1fr);
  max-width: 560px;
}
.form-grid--2,
.form-grid--defaults {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 100%;
  align-items: start;
  column-gap: 1.25rem;
  row-gap: 0.9rem;
}
.form-grid > .field,
.form-grid > .search-select,
.form-grid--2 > .field,
.form-grid--2 > .search-select,
.form-grid--defaults > .field,
.form-grid--defaults > .search-select {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-sizing: border-box;
}
.form-grid > .field > .input,
.form-grid > .field > .select,
.form-grid > .field > input,
.form-grid > .field > select,
.form-grid > .search-select .input,
.form-grid--2 > .field > .input,
.form-grid--2 > .field > .select,
.form-grid--2 > .field > input,
.form-grid--2 > .field > select,
.form-grid--2 > .search-select .input,
.form-grid--defaults > .field > .input,
.form-grid--defaults > .field > .select,
.form-grid--defaults > .field > input,
.form-grid--defaults > .field > select,
.form-grid--defaults > .search-select .input {
  width: 100%;
  min-height: 2.4rem;
  box-sizing: border-box;
}
.form-grid > .form-actions,
.form-grid--2 > .form-actions,
.form-grid--defaults > .form-actions,
.form-grid > .form-section,
.form-grid--2 > .form-section,
.form-grid--defaults > .form-section,
.field--full {
  grid-column: 1 / -1;
}
@media (max-width: 720px) {
  .form-grid,
  .form-grid--2,
  .form-grid--defaults {
    grid-template-columns: minmax(0, 1fr);
  }
}
.form-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.form-section-title { margin: 0 0 0.75rem; font-size: 1rem; }
.interactive-table .row-actions { white-space: nowrap; }
.empty-cell { text-align: center; color: var(--text-muted); padding: 2rem !important; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.product-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--bg-muted); }
.product-price { font-size: 1.1rem; font-weight: 700; margin: 0.5rem 0; }
.muted { color: var(--text-muted); }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin: 1rem 0; }
.alert--success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.stmt-result { margin-top: 1rem; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 100; }
.modal-host { position: fixed; inset: 0; z-index: 101; display: grid; place-items: center; padding: 1rem; }
.modal-host.hidden, .modal-overlay.hidden { display: none; }
.modal-card { background: #fff; border-radius: 12px; width: min(520px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.2); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }
.login-footnote a { color: var(--primary); }

/* Platform Super Admin embed + theme */
.app.platform-admin-theme {
  --bg-sidebar: #121212;
  --primary: #cc036a;
  --primary-hover: #ab0358;
  --primary-soft: #fde8f3;
}
.pa-embed-card { overflow: hidden; }
.pa-embed-body { padding: 0 !important; }
.pa-embed-frame {
  display: block;
  width: 100%;
  min-height: min(78vh, 920px);
  border: 0;
  background: #f7f6fa;
}

/* Tenant System embed + theme */
.app.tenant-system-theme {
  --bg-sidebar: #100220;
  --primary: #cc036a;
  --primary-hover: #ab0358;
  --primary-soft: #fde8f3;
}
.sys-embed-card { overflow: hidden; }
.sys-embed-body { padding: 0 !important; }
.sys-embed-frame {
  display: block;
  width: 100%;
  min-height: min(78vh, 920px);
  border: 0;
  background: #f7f6fa;
}

/* Access Control & Approval Workflow embed */
.app.access-workflow-theme {
  --primary: #e1007a;
  --primary-hover: #cc036a;
  --primary-soft: #fdf2f8;
}
.aw-embed-card { overflow: hidden; }
.aw-embed-body { padding: 0 !important; }
.aw-embed-frame {
  display: block;
  width: 100%;
  min-height: min(78vh, 920px);
  border: 0;
  background: #f8fafc;
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { margin: 0.75rem 0 0.25rem; font-size: 1.35rem; }
.login-subtitle { margin: 0; color: var(--text-muted); font-size: 0.875rem; }
.login-form { display: grid; gap: 1rem; }
.login-footnote { margin: 1rem 0 0; text-align: center; font-size: 0.75rem; color: var(--text-muted); }

/* App shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}
.app.has-planner {
  grid-template-columns: var(--sidebar-width) 1fr var(--planner-width);
}
.app.sidebar-collapsed {
  --sidebar-width: var(--sidebar-width-collapsed);
}
.app.sidebar-collapsed .sidebar {
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sidebar {
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #19062f 100%);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
  transition: opacity 0.2s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}
.sidebar-collapse-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sidebar);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.header-leading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.sidebar-toggle {
  flex-shrink: 0;
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}
.sidebar-toggle-icon { display: block; }
.top-header .page-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--pink), rgba(255, 74, 160, 0.92));
  box-shadow: 0 10px 22px rgba(204, 3, 106, 0.35);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-brand-logo__w { color: #fff; font-weight: 700; font-size: 0.78rem; letter-spacing: -0.03em; }
.brand-text { display: block; font-weight: 600; color: #fff; font-size: 0.9rem; }
.sidebar-brand-tenant { display: block; font-size: 0.7rem; color: var(--text-sidebar-muted); }

.sidebar-tools {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.5rem;
}
.sidebar-search {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
}
.sidebar-search::placeholder { color: var(--text-sidebar-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.85) rgba(255, 255, 255, 0.08);
}
.sidebar-nav::-webkit-scrollbar { width: 10px; }
.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.75);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.95);
  background-clip: padding-box;
}

.nav-pillar-tabs {
  display: none;
}
.nav-pillar-section {
  margin: 0 0 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-pillar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.nav-pillar-toggle {
  padding: 0.55rem 0.85rem;
  color: #fff;
  font-size: var(--nav-font-application, 0.84rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  margin: 0 0.5rem 0.15rem;
  width: calc(100% - 1rem);
}
.nav-pillar-section.nav-pillar--active > .nav-pillar-toggle {
  background: rgba(37, 99, 235, 0.28);
  color: #fff;
}
.nav-pillar-section > .nav-section-body {
  padding-left: 0.15rem;
}
.nav-pillar-tab {
  display: block;
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: transparent;
  color: var(--text-sidebar-muted);
  font: inherit;
  font-size: var(--nav-font-application, 0.84rem);
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.25;
  cursor: pointer;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}
.nav-pillar-tab.active {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(37, 99, 235, 0.5);
  color: #fff;
}

/* Navigation tier hierarchy: Application → Module → Feature → Process → Task */
.nav-section { margin-bottom: 0.15rem; }
.nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  text-align: left;
}
.nav-section-toggle__chev {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-sidebar-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.nav-section-toggle[aria-expanded="false"] .nav-section-toggle__chev { transform: rotate(-90deg); }
.nav-section-toggle__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tier-module > .nav-section-toggle {
  font-size: var(--nav-font-module, 0.84rem);
  font-weight: 700;
  color: var(--text-sidebar);
  padding: 0.52rem 1rem;
}
.nav-tier-feature > .nav-section-toggle {
  font-size: var(--nav-font-feature, 0.79rem);
  font-weight: 600;
  color: #f1e9ff;
  padding: 0.46rem 1rem 0.46rem 1.2rem;
}
.nav-tier-process > .nav-section-toggle {
  font-size: var(--nav-font-process, 0.74rem);
  font-weight: 600;
  color: #e2d8f3;
  padding: 0.42rem 1rem 0.42rem 1.45rem;
}
.nav-section--depth-3.nav-tier-process > .nav-section-toggle,
.nav-section--depth-4.nav-tier-process > .nav-section-toggle {
  font-size: var(--nav-font-process-nested, 0.72rem);
  padding-left: 1.65rem;
}

.nav-section-body {
  overflow: hidden;
}
.nav-section-body.collapsed {
  display: none;
}
.nav-tier-module > .nav-section-body { padding-left: 0.35rem; }
.nav-tier-feature > .nav-section-body { padding-left: 0.5rem; }
.nav-tier-process > .nav-section-body { padding-left: 0.65rem; }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem 0.4rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-sidebar);
  font: inherit;
  font-size: var(--nav-font-task, 0.72rem);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  margin: 1px 0.5rem 1px 0;
}
.nav-item:hover { background: var(--bg-sidebar-hover); }
.nav-item.active {
  background: rgba(37, 99, 235, 0.22);
  color: #fff;
  font-weight: 600;
}
.nav-item--group {
  font-weight: 500;
  color: #e2e8f0;
}
.nav-tier-task.nav-item--leaf { padding-left: 1.35rem; }
.nav-tier-task.nav-item--depth-1 { padding-left: 1.5rem; font-size: var(--nav-font-task, 0.72rem); }
.nav-tier-task.nav-item--depth-2 { padding-left: 1.75rem; font-size: 0.71rem; }
.nav-tier-task.nav-item--depth-3 { padding-left: 2rem; font-size: 0.70rem; }
.nav-tier-task.nav-item--depth-4 { padding-left: 2.3rem; font-size: 0.69rem; }
.nav-tier-task.nav-item--depth-5 { padding-left: 2.6rem; font-size: 0.68rem; }
.nav-icon { opacity: 0.5; font-size: 0.65rem; }
.nav-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  color: var(--text-sidebar-muted);
}

.shell { display: flex; flex-direction: column; min-width: 0; }
.top-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { margin: 0; font-size: 1.1rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.header-context-switcher { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.header-context-select { width: auto; min-width: 140px; max-width: 200px; font-size: 0.78rem; padding: 0.3rem 0.5rem; }
.header-context-field { display: inline-flex; margin: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.header-tenant-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-weight: 500;
}

.main-content {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
}

/* Planner panel */
.planner-panel {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}
.planner-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.planner-header h2 { margin: 0; font-size: 0.95rem; }
.planner-body { flex: 1; overflow-y: auto; padding: 1rem; }
.planner-section { margin-bottom: 1.25rem; }
.planner-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-muted); }
.btn-block { width: 100%; }

.select, input[type="text"], input[type="email"], input[type="number"], textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
.select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}
.field { display: grid; gap: 0.3rem; }
.field-label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge--status { color: #fff; }
.badge--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.card-body { padding: 1.25rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-value { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

.progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: 999px;
  transition: width 0.3s;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.detail-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.detail-breadcrumb span + span::before { content: " › "; opacity: 0.5; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap--scroll {
  max-height: min(65vh, 560px);
  overflow: auto;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
}
.table-wrap--scroll .data-table {
  min-width: 1400px;
  margin: 0;
}
.table-wrap--scroll .data-table--income-batches {
  min-width: 1680px;
}
.table-wrap--scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  box-shadow: 0 1px 0 var(--border, #e2e8f0);
}
/* —— Data-type column sizing (system-wide) —— */
.data-table th.col-num,
.data-table td.col-num,
.data-table th.num-cell,
.data-table td.num-cell,
.data-table th.col-count,
.data-table td.col-count,
.data-table th.col-amt,
.data-table td.col-amt,
.data-table .amt,
.col-num,
.num-cell,
.col-count,
.col-amt,
.amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Body cells stay single-line; headers may wrap on whole words only */
.data-table td.col-num,
.data-table td.num-cell,
.data-table td.col-count,
.data-table td.col-amt,
.data-table td.amt {
  white-space: nowrap;
}
.data-table th.col-num,
.data-table th.num-cell,
.data-table th.col-count,
.data-table th.col-amt,
.data-table th.amt {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
  line-height: 1.2;
  vertical-align: bottom;
}
/* Count / integer columns — narrow; header wraps as whole words (e.g. Rejected / Entries) */
.data-table th.col-count,
.data-table td.col-count,
.col-count {
  width: 5.25rem;
  min-width: 4.75rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
/* Currency / amount columns */
.data-table th.col-amt,
.data-table td.col-amt,
.data-table th.amt,
.data-table td.amt,
.col-amt {
  width: 7.5rem;
  min-width: 7rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  white-space: nowrap;
}
.data-table th.col-amt,
.data-table th.amt {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}
/* Dates / periods */
.data-table th.col-date,
.data-table td.col-date,
.col-date {
  width: 7.25rem;
  min-width: 7rem;
  white-space: nowrap;
}
/* Codes / refs / IDs */
.data-table th.col-code,
.data-table td.col-code,
.col-code {
  width: 8.5rem;
  min-width: 7.5rem;
  white-space: nowrap;
}
.data-table--income-batches th.col-code,
.data-table--income-batches td.col-code {
  width: 12rem;
  min-width: 10.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Status / type badges */
.data-table th.col-status,
.data-table td.col-status,
.col-status {
  width: 6.75rem;
  min-width: 5.75rem;
  white-space: nowrap;
}
/* Flag / Yes-No columns */
.data-table th.col-flag,
.data-table td.col-flag,
.col-flag {
  width: 5.5rem;
  min-width: 4.75rem;
  white-space: nowrap;
  text-align: center;
}
/* Short names */
.data-table th.col-name,
.data-table td.col-name,
.col-name {
  min-width: 8rem;
  max-width: 14rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Long labels (product codes, segments, descriptions) — never crush into neighbours */
.data-table th.col-label,
.data-table td.col-label,
.col-label {
  min-width: 12rem;
  max-width: 22rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}
.data-table .col-center { text-align: center; }
.data-table .col-check,
.col-check { width: 2.25rem; text-align: center; }
input.input--amt,
input.amt,
input[type="number"].input--amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.detail-grid dd.amt,
.report-bs-total.amt,
.report-pl-line .amt,
.report-bs-line .amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* System-wide amount display: decimal + comma, right-justified */
.data-table th.col-amt,
.data-table td.col-amt,
.data-table th.amt,
.data-table td.amt,
.data-table th.num-cell.amt,
.data-table td.num-cell.amt,
.access-config-table td.num-cell.amt,
.access-config-table th.num-cell.amt,
dd.amt,
span.amt,
strong.amt,
.amt-value,
.mono.amt {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
input.input--amt,
input.amt {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
table.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: 0.8125rem;
}
table.data-table th, table.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data-table tr:hover td { background: var(--bg-muted); }
table.data-table tr.clickable { cursor: pointer; }
.cell-text {
  display: inline-block;
  max-width: 100%;
}

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
}
.checklist input { margin-top: 0.2rem; }

.sprint-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.sprint-column {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
}
.sprint-column-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
}
.sprint-column-body { padding: 0.5rem; display: grid; gap: 0.5rem; }
.sprint-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-size: 0.78rem;
}
.sprint-card:hover { border-color: var(--primary); }
.sprint-card-title { font-weight: 500; margin-bottom: 0.25rem; }
.sprint-card-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.role-card {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
}
.role-card.active { border-color: var(--primary); background: var(--primary-soft); }
.role-card h4 { margin: 0 0 0.25rem; font-size: 0.875rem; }
.role-card p { margin: 0; font-size: 0.75rem; color: var(--text-muted); }

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab {
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.toast-stack {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
  display: grid;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: min(28rem, calc(100vw - 2rem));
}
.toast--multiline {
  white-space: pre-wrap;
  line-height: 1.45;
  max-width: min(36rem, calc(100vw - 2rem));
  max-height: 50vh;
  overflow: auto;
}
.toast--status {
  border-left: 3px solid var(--primary, #3b82f6);
}
@keyframes slideIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin: 0 0 0.5rem; }

.wireframe-preview {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--bg-muted);
  min-height: 180px;
}
.wireframe-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.wireframe-toolbar .btn { opacity: 0.7; pointer-events: none; }
.wireframe-table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.wireframe-table div {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.wireframe-table div:first-child { background: var(--bg-muted); font-weight: 600; color: var(--text); }

@media (max-width: 1200px) {
  .app.has-planner { grid-template-columns: var(--sidebar-width) 1fr; }
  .planner-panel { display: none; }
}
