
:root {
  --bg: #f3f6fb;
  --bg-soft: #eef3f9;
  --card: #ffffff;
  --card-alt: #f9fbfe;
  --border: #d9e2ef;
  --border-strong: #c7d3e3;
  --text: #162033;
  --text-soft: #53627b;
  --text-muted: #6c7b93;
  --primary: #2559c3;
  --primary-dark: #19449f;
  --primary-soft: #e8f0ff;
  --steel: #334155;
  --steel-soft: #e5ebf3;
  --teal: #0f766e;
  --teal-soft: #ddf6f1;
  --danger: #d14343;
  --danger-soft: #feecec;
  --warning: #c77a16;
  --warning-soft: #fff4e5;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-md: 0 18px 42px rgba(15, 23, 42, .08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, #edf2f8 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
strong { color: var(--text); }
pre { white-space: pre-wrap; word-break: break-word; }

.layout {
  display: grid;
  grid-template-columns: clamp(236px, 18vw, 286px) minmax(0, 1fr);
  min-height: 100vh;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 0;
  max-height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
  border-right: 1px solid var(--border);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.sidebar__inner {
  padding: 24px 18px 18px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.sidebar__inner::-webkit-scrollbar {
  width: 10px;
}
.sidebar__inner::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar__inner::-webkit-scrollbar-thumb {
  background: #cfd9e8;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar__inner::-webkit-scrollbar-thumb:hover {
  background: #b8c7dd;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar__footer {
  padding: 14px 18px 24px;
  border-top: 1px solid rgba(217, 226, 239, .85);
  background: linear-gradient(180deg, rgba(251,253,255,.68) 0%, rgba(243,247,251,.98) 100%);
}
.brand-panel {
  background: linear-gradient(145deg, #ffffff 0%, #f4f8fd 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.brand-panel__tag {
  margin-top: 12px;
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--steel-soft);
  color: var(--steel);
  font-size: 12px;
  font-weight: 700;
}
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand--center { justify-content: center; }
.brand__mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  letter-spacing: .06em;
  box-shadow: 0 14px 28px rgba(37, 89, 195, .18);
}
.brand__title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .01em;
}
.brand__subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar__section-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .16em;
  margin: 16px 10px 10px;
  font-weight: 700;
}
.nav {
  display: grid;
  gap: 8px;
}
.nav__link {
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  display: grid;
  gap: 4px;
  transition: .18s ease;
}
.nav__link span {
  font-weight: 700;
}
.nav__link small {
  color: var(--text-muted);
}
.nav__link:hover {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nav__link.active {
  background: linear-gradient(145deg, #ffffff 0%, #eef4ff 100%);
  border-color: #cfe0ff;
  box-shadow: var(--shadow-sm);
}
.user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.user-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.user-card__name { font-weight: 800; }
.user-card__role { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.small-note { color: var(--text-muted); font-size: 13px; margin: 12px 0 16px; line-height: 1.5; }

.main {
  min-width: 0;
  padding: 28px 28px 34px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 26px;
}
.page-header__left h1 {
  margin: 6px 0 8px;
  font-size: 34px;
  line-height: 1.05;
}
.page-header__right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.page-body {
  display: grid;
  gap: 22px;
}
.header-pill,
.status-pill,
.badge,
.grid-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.header-pill--accent,
.status-pill--accent {
  background: var(--primary-soft);
  border-color: #d2e0ff;
  color: var(--primary);
}
.status-pill--ok {
  background: var(--teal-soft);
  border-color: #bbe9df;
  color: var(--teal);
}
.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.muted { color: var(--text-muted); }

.hero-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 58%, #eef8f6 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .95fr);
  gap: 24px;
}
.hero-panel h2 {
  margin: 8px 0 10px;
  font-size: 32px;
  line-height: 1.1;
}
.hero-panel--tight {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.hero-panel--executive {
  align-items: stretch;
}
.hero-actions,
.hero-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.hero-stats {
  display: grid;
  gap: 14px;
}
.hero-stat {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(201,214,232,.9);
  border-radius: 18px;
  padding: 18px 18px;
}
.hero-stat__label { color: var(--text-muted); font-size: 13px; font-weight: 700; }
.hero-stat__value { font-size: 25px; font-weight: 800; margin: 8px 0 4px; line-height: 1.1; }
.hero-stat__meta { color: var(--text-soft); font-size: 13px; }

.section-stack { display: grid; gap: 16px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}
.section-heading h2 { margin: 6px 0 0; font-size: 24px; }
.section-heading__hint { color: var(--text-muted); font-size: 13px; }

.grid { display: grid; gap: 22px; }
.grid--cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--2-1 { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr); }
.stack-col { display: grid; gap: 22px; }

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #dbe7fb 0%, #b9cff9 100%);
}
.metric-card--primary::before {
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
}
.metric-card--accent::before {
  background: linear-gradient(90deg, #0f766e 0%, #34d399 100%);
}
.metric-card__label { color: var(--text-muted); font-size: 13px; font-weight: 700; }
.metric-card__value { font-size: 28px; font-weight: 800; margin: 10px 0 6px; line-height: 1.05; }
.metric-card__meta { color: var(--text-soft); font-size: 13px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.panel--contrast {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}
.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.panel__header h2 {
  margin: 0 0 4px;
  font-size: 22px;
}
.panel__meta {
  color: var(--text-muted);
  font-size: 13px;
}
.chart {
  min-height: 310px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
  border: 1px solid var(--border);
  padding: 10px;
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.quick-card {
  display: grid;
  gap: 8px;
  background: linear-gradient(145deg, #ffffff 0%, #f6f9fd 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #c7d8f4;
}
.quick-card__title { font-weight: 800; font-size: 18px; }
.quick-card__text { color: var(--text-muted); line-height: 1.55; }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
  color: var(--steel);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  color: var(--text-soft);
  vertical-align: top;
}
.table tbody tr:hover td { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table--compact td, .table--compact th { font-size: 13px; }

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, auto));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.toolbar--secondary {
  grid-template-columns: repeat(7, minmax(0, auto));
  margin-top: -2px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid--single { grid-template-columns: 1fr; }
.field {
  display: grid;
  gap: 7px;
}
.field span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
}
.field--grow { min-width: 240px; }
.field--full { grid-column: 1 / -1; }
.field--checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  background: #f9fbfe;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 14px;
}
.field--checkbox span {
  font-size: 14px;
  color: var(--text-soft);
  letter-spacing: normal;
  text-transform: none;
}
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  transition: .18s ease;
}
textarea {
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: #8fb0ef;
  box-shadow: 0 0 0 4px rgba(37, 89, 195, .08);
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.field--checkbox input[type="checkbox"],
.column-menu__item input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  box-shadow: none;
}
.button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}
.button:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.button--primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #2559c3 0%, #1d4ed8 100%);
  color: #fff;
}
.button--secondary {
  border-color: #b7d2ce;
  background: var(--teal-soft);
  color: var(--teal);
}
.button--ghost {
  background: #f8fbff;
  color: var(--steel);
}
.button--full { width: 100%; }

.notes-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--text-soft);
}
.stat-block {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.status-list {
  display: grid;
  gap: 12px;
}
.status-list__item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid var(--border);
}
.status-list__item span { color: var(--text-muted); }
.status-list__item strong { font-size: 15px; }

.result-box {
  margin-top: 14px;
  min-height: 132px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--border);
  padding: 16px;
  font-size: 13px;
  line-height: 1.55;
}
.alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}
.alert--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f6c3c3;
}

.grid-shell {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  overflow: hidden;
}
.grid-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fbff;
}
.grid-toolbar__left,
.grid-toolbar__right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.grid-meta {
  color: var(--text-muted);
  font-size: 13px;
}
.column-menu {
  display: none;
  padding: 14px 16px 4px;
  border-bottom: 1px solid var(--border);
  background: #fcfdff;
}
.column-menu.open { display: block; }
.column-menu__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.column-menu__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
}
.column-menu__item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 12px;
  color: var(--text-soft);
}
.table-scroll {
  overflow: auto;
}
.data-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
}
.data-grid th,
.data-grid td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  white-space: nowrap;
  font-size: 13px;
}
.data-grid {
  table-layout: fixed;
}
.data-grid thead th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  color: var(--steel);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  z-index: 1;
}
.data-grid th {
  position: relative;
  user-select: none;
}
.data-grid td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-grid__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}
.data-grid__label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: transparent;
  transition: background .16s ease;
}
.data-grid th:hover .col-resizer::after,
.col-resizer.is-active::after {
  background: #9db5df;
}
body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}
.data-grid tbody tr:hover td { background: #f8fbff; }
.data-grid tfoot td {
  position: sticky;
  bottom: 0;
  background: #f8fbff;
  font-weight: 800;
  border-top: 1px solid var(--border);
}
.data-grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.sortable { cursor: pointer; user-select: none; }
.sort-asc::after { content: " ↑"; color: var(--primary); }
.sort-desc::after { content: " ↓"; color: var(--primary); }
.grid-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
}
.grid-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: #fcfdff;
}
.grid-pagination__info { color: var(--text-muted); font-size: 13px; }
.grid-pagination__controls { display: flex; gap: 10px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  background: linear-gradient(135deg, #f5f8fc 0%, #eef4fb 100%);
}
.login-showcase {
  padding: 52px clamp(28px, 6vw, 88px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-showcase__content {
  max-width: 620px;
}
.login-showcase h1 {
  font-size: clamp(38px, 4vw, 56px);
  line-height: 1.02;
  margin: 10px 0 14px;
}
.login-benefits {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}
.login-benefit {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(201,214,232,.95);
  box-shadow: var(--shadow-sm);
}
.login-benefit span { color: var(--text-muted); line-height: 1.55; }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
  background: #fff;
  border-left: 1px solid var(--border);
}
.login-card__header h2 {
  margin: 8px 0 6px;
  font-size: 30px;
}
.login-hint {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--border);
  color: var(--text-soft);
  line-height: 1.7;
}
.login-hint__title { font-weight: 800; margin-bottom: 8px; color: var(--text); }

@media (max-width: 1340px) {
  .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar--secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    max-height: none;
    min-height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar__inner {
    overflow: visible;
    scrollbar-gutter: auto;
  }
  .sidebar__footer {
    border-top: 0;
    padding-top: 0;
  }
  .page-header { flex-direction: column; }
  .hero-panel,
  .grid--2,
  .grid--2-1,
  .quick-links,
  .login-shell { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}

@media (max-width: 720px) {
  .toolbar,
  .toolbar--secondary,
  .form-grid,
  .grid--cards { grid-template-columns: 1fr; }
  .page-header__left h1 { font-size: 30px; }
  .hero-panel h2 { font-size: 28px; }
  .login-card,
  .login-showcase { padding: 24px; }
  .brand--left-mobile { justify-content: flex-start; }
}

.alert--success {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid #bde6de;
}
.module-access-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.module-access-badges--large { margin-top: 14px; }
.module-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.module-badge--ok {
  background: var(--teal-soft);
  border-color: #bfe8de;
  color: var(--teal);
}
.module-badge--off {
  background: var(--warning-soft);
  border-color: #f0ddba;
  color: var(--warning);
}
.hub-shell {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  gap: 22px;
}
.hub-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.hub-topbar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
  gap: 20px;
  padding: 26px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 54%, #eef7f5 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.hub-hero h1 {
  margin: 8px 0 12px;
  font-size: 40px;
  line-height: 1.05;
}
.hub-user-panel {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(201,214,232,.95);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.hub-user-panel__label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
}
.hub-user-panel__name {
  font-size: 26px;
  font-weight: 800;
  margin-top: 10px;
}
.hub-user-panel__role {
  margin-top: 6px;
  color: var(--text-muted);
}
.module-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.module-switch-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
}
.module-switch-card--locked {
  opacity: .8;
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
}
.module-switch-card__eyebrow {
  color: var(--primary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
}
.module-switch-card h2 {
  margin: 0;
  font-size: 28px;
}
.module-switch-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  display: grid;
  gap: 8px;
}
.module-switch-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.toggle-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-soft);
}
.toggle-cell input {
  width: 18px;
  height: 18px;
}
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}
@media (max-width: 1080px) {
  .hub-shell { padding: 18px; }
  .hub-hero,
  .module-switch-grid { grid-template-columns: 1fr; }
  .hub-topbar { flex-direction: column; align-items: flex-start; }
}

/* ===== Module hub refresh v9.1 ===== */
body.hub-page {
  background:
    radial-gradient(circle at top right, rgba(37, 89, 195, 0.08), transparent 28%),
    radial-gradient(circle at left center, rgba(15, 118, 110, 0.06), transparent 24%),
    linear-gradient(180deg, #f5f8fc 0%, #eef3f9 100%);
}

.hub-shell--xl {
  max-width: 1480px;
  margin: 0 auto;
  padding-top: 34px;
  padding-bottom: 42px;
}

.hub-topbar--glass {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-color: rgba(207, 220, 237, 0.95);
  box-shadow: 0 18px 38px rgba(15, 23, 42, .07);
}

.hub-topbar__right {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.hub-status-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hub-hero--v2 {
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.92fr);
  align-items: stretch;
  padding: 34px;
  box-shadow: 0 22px 54px rgba(15, 23, 42, .09);
}

.hub-copy {
  display: grid;
  align-content: center;
  gap: 16px;
}

.hub-copy__lead {
  margin: 0;
  max-width: 800px;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.7;
}

.hub-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.hub-kpi {
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(199, 211, 227, .95);
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 26px rgba(15, 23, 42, .05);
}

.hub-kpi span,
.summary-card__label,
.hub-user-stat span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.hub-kpi strong,
.summary-card__value,
.hub-user-stat strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
}

.hub-kpi small,
.summary-card__meta {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  line-height: 1.55;
}

.hub-user-panel--pro {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 24px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(207, 220, 237, .95);
  box-shadow: 0 18px 30px rgba(15, 23, 42, .06);
}

.hub-user-stats {
  display: grid;
  gap: 12px;
}

.hub-user-stat {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.hub-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.summary-card {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
}

.module-switch-grid--hub {
  gap: 24px;
}

.module-switch-grid--hub .module-switch-card {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  padding: 28px;
  gap: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

.module-switch-grid--hub .module-switch-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
}

.module-switch-card--finance::before {
  background: linear-gradient(90deg, #2559c3 0%, #60a5fa 100%);
}

.module-switch-card--invoices::before {
  background: linear-gradient(90deg, #0f766e 0%, #34d399 100%);
}

.module-switch-grid--hub .module-switch-card:hover {
  transform: translateY(-3px);
  transition: transform .18s ease, box-shadow .18s ease;
}

.module-switch-card__top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.module-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #fff;
  box-shadow: 0 14px 28px rgba(37, 89, 195, .18);
}

.module-icon--finance {
  background: linear-gradient(135deg, #2559c3 0%, #1d4ed8 100%);
}

.module-icon--invoices {
  background: linear-gradient(135deg, #0f766e 0%, #059669 100%);
  box-shadow: 0 14px 28px rgba(15, 118, 110, .18);
}

.module-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-highlight {
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.module-highlight span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.module-highlight strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.module-switch-grid--hub .module-switch-card h2 {
  font-size: 32px;
  line-height: 1.08;
}

.module-switch-list--checked {
  list-style: none;
  margin: 0;
  padding: 0;
}

.module-switch-list--checked li {
  position: relative;
  padding-left: 30px;
  color: var(--text-soft);
  line-height: 1.55;
}

.module-switch-list--checked li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.module-switch-card--invoices .module-switch-list--checked li::before {
  background: var(--teal-soft);
  color: var(--teal);
}

.module-switch-grid--hub .module-switch-card--locked {
  opacity: .92;
}

.module-switch-grid--hub .module-switch-card--locked .button {
  box-shadow: none;
}

.module-access-badges--large {
  gap: 10px;
}

.module-access-badges--large .module-badge {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

@media (max-width: 1320px) {
  .hub-kpis,
  .hub-summary-grid,
  .module-highlight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .hub-shell--xl {
    padding-top: 20px;
    padding-bottom: 28px;
  }
  .hub-topbar__right {
    justify-items: stretch;
    width: 100%;
  }
  .hub-status-row {
    justify-content: flex-start;
  }
  .hub-hero--v2,
  .hub-summary-grid,
  .module-switch-grid--hub {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hub-topbar,
  .hub-hero--v2,
  .summary-card,
  .module-switch-grid--hub .module-switch-card {
    padding: 20px;
  }
  .hub-hero h1 {
    font-size: 32px;
  }
  .module-switch-grid--hub .module-switch-card h2 {
    font-size: 28px;
  }
}


.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.filter-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.drill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.list-panel .panel__header h2 { margin: 0; }
.muted--small { font-size: 12px; margin-top: 4px; }
.truncate-cell { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-actions { white-space: nowrap; }
.button--xs { min-height: 30px; padding: 0 10px; font-size: 12px; }
.key-value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.key-value {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  gap: 6px;
}
.key-value span { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.key-value strong { font-size: 15px; line-height: 1.4; }
.key-value--wide { grid-column: span 3; }
.inline-note { margin-top: 16px; color: var(--text-soft); font-size: 13px; }
.pagination { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
@media (max-width: 1200px) {
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .drill-grid, .key-value-grid, .filter-grid { grid-template-columns: 1fr; }
  .key-value--wide { grid-column: span 1; }
  .truncate-cell { max-width: 260px; }
}


/* === v20 stability: responsive shell, scrollable menus and Excel grids === */
html, body { width: 100%; overflow-x: hidden; }
.layout { width: 100%; max-width: 100vw; grid-template-columns: minmax(232px, 270px) minmax(0, 1fr); }
.sidebar { height: 100dvh; max-height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar__inner { max-height: calc(100dvh - 118px); overflow-y: auto; padding-bottom: 22px; }
.main { min-width: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
.page-body, .panel, .card, .grid--2, .grid--2-1, .grid--cards, .dashboard-grid, .drill-grid { min-width: 0; }
.table-scroll, .data-grid-shell, .excel-grid-shell { max-width: 100%; overflow: auto; }
.table-scroll table, .data-grid, table { max-width: none; }
.data-grid th, .data-grid td, .table th, .table td { overflow-wrap: anywhere; }
.data-grid th, .data-grid td { min-width: 72px; }
.data-grid th:first-child, .data-grid td:first-child { position: sticky; left: 0; z-index: 3; background: inherit; }
.data-grid thead th:first-child { z-index: 5; background: #eef4ff; }
.col-resizer { touch-action: none; }
.button, .nav__link, .header-pill, .status-pill { max-width: 100%; }
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; max-height: none; min-height: auto; overflow: visible; }
  .sidebar__inner { max-height: none; overflow: visible; }
  .sidebar__footer { position: relative; }
  .main { padding: 18px; }
}
@media (max-width: 760px) {
  .page-header, .page-header__right, .toolbar, .filter-grid, .drill-grid, .key-value-grid { min-width: 0; }
  .page-header__right, .filter-actions { width: 100%; }
  .page-header__right .button, .filter-actions .button { flex: 1 1 180px; }
  .table-scroll { border-radius: 12px; }
}

/* Controlling v21 */
.status-pill--warn {
  background: var(--warning-soft);
  border-color: #ffd8a6;
  color: var(--warning);
}
.status-pill--danger {
  background: var(--danger-soft);
  border-color: #f5bbbb;
  color: var(--danger);
}
.metric-card--danger::before {
  background: linear-gradient(90deg, #d14343 0%, #fb7185 100%);
}
.button--danger {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.button--small {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}
.toolbar--wrap { flex-wrap: wrap; }
.field--wide { min-width: min(420px, 100%); flex: 1 1 320px; }
.notice {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-weight: 700;
}
.notice--success { background: var(--teal-soft); color: var(--teal); border-color: #bbe9df; }
.notice--error { background: var(--danger-soft); color: var(--danger); border-color: #f5bbbb; }
.code-block {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #e5e7eb;
  overflow: auto;
  font-size: 12px;
}
.row-danger td { background: rgba(209, 67, 67, .08); }
.row-warning td { background: rgba(199, 122, 22, .10); }
.excel-table-wrap { max-width: 100%; overflow: auto; }
.excel-enhanced th { white-space: nowrap; }
.excel-enhanced td { vertical-align: top; }
@media (max-width: 980px) {
  .grid--2, .grid--2-1, .grid--cards { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: 1fr; }
}

/* v22 Budget Control: simpler layout and clean controlling tables */
.layout--fixed { height: 100vh; overflow: hidden; }
.sidebar { height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
.main--scrollable { height: 100vh; overflow-y: auto; overflow-x: hidden; }
.nav--primary-module .nav__link { border-color: rgba(22, 163, 74, .22); background: rgba(22, 163, 74, .06); }
.nav--primary-module .nav__link.active { background: linear-gradient(135deg, #14532d, #166534); color: #fff; }
.module-switch-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-icon--control { background: linear-gradient(135deg, #16a34a, #0f766e); color: #fff; }
.module-switch-card--control { border-color: rgba(22, 163, 74, .22); }
.budget-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(135deg, #fff, #f8fafc); box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.budget-hero h2 { margin: 4px 0 6px; font-size: 26px; }
.budget-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kpi-grid--compact { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card--warn { border-color: #f5c16c; background: #fff7ed; }
.kpi-card--danger { border-color: #f0a2a2; background: #fff1f2; }
.form-grid--budget { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.grid-span-2 { grid-column: span 2; }
.inline-filter { display: flex; gap: 10px; align-items: center; }
.excel-table { font-size: 13px; border-collapse: separate; border-spacing: 0; }
.excel-table th { position: sticky; top: 0; z-index: 2; background: #f8fafc; color: #0f172a; box-shadow: inset 0 -1px 0 var(--border); white-space: nowrap; }
.excel-table td, .excel-table th { border-right: 1px solid #e5e7eb; }
.excel-table tbody tr:nth-child(even) td { background: #fcfcfd; }
.excel-table tbody tr:hover td { background: #f0f9ff; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negative { color: #b91c1c; font-weight: 800; }
.empty-cell { padding: 26px; text-align: center; color: var(--muted); }
.status-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 96px; border-radius: 999px; padding: 5px 10px; font-weight: 800; font-size: 12px; }
.status-chip--ok { background: #dcfce7; color: #166534; }
.status-chip--warn { background: #fef9c3; color: #854d0e; }
.status-chip--danger { background: #ffedd5; color: #9a3412; }
.status-chip--over { background: #fee2e2; color: #991b1b; }
.status-chip--no_budget { background: #e0e7ff; color: #3730a3; }
.budget-row--warn td { background: #fffbeb; }
.budget-row--danger td { background: #fff7ed; }
.budget-row--over td { background: #fff1f2; }
.budget-row--no_budget td { background: #eef2ff; }
.progress-cell { display: inline-block; width: 110px; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin-right: 8px; vertical-align: middle; }
.progress-cell span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b, #dc2626); max-width: 100%; }
.two-col-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.form-stack { display: grid; gap: 12px; }
.table-wrap--wide { overflow: auto; max-width: 100%; }
@media (max-width: 1180px) {
  .module-switch-grid--three, .kpi-grid--compact { grid-template-columns: 1fr 1fr; }
  .form-grid--budget, .two-col-grid { grid-template-columns: 1fr; }
  .grid-span-2 { grid-column: span 1; }
}
@media (max-width: 760px) {
  .layout--fixed { display: block; height: auto; overflow: visible; }
  .sidebar { position: relative; width: auto; height: auto; max-height: none; }
  .main--scrollable { height: auto; overflow: visible; }
  .module-switch-grid--three, .kpi-grid--compact { grid-template-columns: 1fr; }
  .budget-hero { flex-direction: column; }
}
