/* Business Hub portal — CRM + Inventory pages, internal team UI.
   All hub pages set body.hub-app — gives us a scope to neutralize Frappe chrome.
   No dependencies on other apps; safe to install standalone. */

/* ──────────────────────────────────────────────────────────────────────
   "Luminous Logic" design system (sourced from Stitch project
   8942926139347980915 — Modern Trending Dashboard Refresh).
   Material Design 3 tokens, Inter font, indigo primary, lavender surfaces.
   ────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
  /* ── Luminous Logic core palette ────────────────────────────────── */
  --hub-primary: #4648d4;             /* deep indigo */
  --hub-primary-container: #6063ee;   /* lifted indigo */
  --hub-primary-fixed: #e1e0ff;
  --hub-primary-fixed-dim: #c0c1ff;
  --hub-on-primary: #ffffff;
  --hub-on-primary-fixed: #07006c;

  /* Surfaces (white-lavender progression) */
  --hub-background: #faf8ff;
  --hub-surface: #faf8ff;
  --hub-surface-bright: #faf8ff;
  --hub-surface-container-lowest: #ffffff;
  --hub-surface-container-low: #f2f3ff;        /* sidebar bg */
  --hub-surface-container: #eaedff;
  --hub-surface-container-high: #e2e7ff;       /* nav hover */
  --hub-surface-container-highest: #dae2fd;
  --hub-surface-variant: #dae2fd;
  --hub-surface-dim: #d2d9f4;

  /* Text on surfaces */
  --hub-on-surface: #131b2e;
  --hub-on-surface-variant: #464554;
  --hub-on-background: #131b2e;

  /* Outline */
  --hub-outline: #767586;
  --hub-outline-variant: #c7c4d7;

  /* Accents — Material 3 secondary + tertiary */
  --hub-secondary: #006591;                    /* cyan */
  --hub-secondary-container: #39b8fd;
  --hub-on-secondary-container: #004666;
  --hub-secondary-fixed: #c9e6ff;
  --hub-tertiary: #b90538;                     /* magenta */
  --hub-tertiary-container: #dc2c4f;
  --hub-on-tertiary-container: #fffbff;
  --hub-tertiary-fixed: #ffdadb;

  /* Semantic */
  --hub-error: #ba1a1a;
  --hub-error-container: #ffdad6;
  --hub-on-error-container: #93000a;

  /* Legacy aliases — keep names that existing templates already use */
  --hub-brand: var(--hub-primary);
  --hub-brand-dark: #3a3cc0;
  --hub-brand-darker: #2f2ebe;
  --hub-brand-light: var(--hub-primary-fixed-dim);
  --hub-brand-soft: var(--hub-primary-fixed);
  --hub-brand-softer: var(--hub-surface-container-high);
  --hub-text: var(--hub-on-surface);
  --hub-text-strong: var(--hub-on-surface);
  --hub-text-muted: var(--hub-on-surface-variant);
  --hub-text-faded: var(--hub-outline);
  --hub-border: var(--hub-outline-variant);
  --hub-border-strong: var(--hub-outline);
  --hub-bg: var(--hub-background);
  --hub-bg-soft: var(--hub-surface-container-low);
  --hub-card: var(--hub-surface-container-lowest);

  /* Color-coded stat icon variants — pull from Luminous palette */
  --hub-crm: var(--hub-primary);
  --hub-crm-soft: var(--hub-primary-fixed);
  --hub-stock: var(--hub-secondary);
  --hub-stock-soft: var(--hub-secondary-fixed);
  --hub-purple: #7c3aed;
  --hub-purple-soft: #ede9fe;
  --hub-amber: #d97706;
  --hub-amber-soft: #fef3c7;
  --hub-info: var(--hub-secondary);
  --hub-info-soft: var(--hub-secondary-fixed);
  --hub-ok: #047857;
  --hub-ok-soft: #d1fae5;
  --hub-warn: #b45309;
  --hub-warn-soft: #fef3c7;
  --hub-danger: var(--hub-error);
  --hub-danger-soft: var(--hub-error-container);

  /* Shadows — Luminous Logic uses soft, primary-tinted shadows */
  --hub-shadow-sm: 0 1px 2px rgba(19, 27, 46, .04), 0 1px 3px rgba(19, 27, 46, .06);
  --hub-shadow: 0 2px 4px rgba(19, 27, 46, .04), 0 6px 16px rgba(19, 27, 46, .07);
  --hub-shadow-lg: 0 12px 28px rgba(19, 27, 46, .10), 0 18px 36px rgba(70, 72, 212, .08);
  --hub-shadow-primary: 0 8px 20px rgba(70, 72, 212, .22);

  --hub-sidebar-w: 256px;
  --hub-radius: 8px;
  --hub-radius-lg: 12px;
}

body.hub-app {
  background: var(--hub-background);
  color: var(--hub-on-background);
  font-family: 'Inter','Segoe UI',-apple-system,BlinkMacSystemFont,sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  font-size: 14px;
  letter-spacing: -0.005em;
}
body.hub-app .material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
}
body.hub-app * { box-sizing: border-box; }
body.hub-app a { color: var(--hub-brand); text-decoration: none; }

/* Suppress Frappe's built-in topbar escape hatches to the desk.
   Frappe ships these as .hidden by default and unhides them via JS for some
   users — but hub-app users should never bounce to /desk or /apps. */
body.hub-app a.switch-to-desk,
body.hub-app a.apps,
body.hub-app a[href="/desk"],
body.hub-app a[href="/apps"] {
  display: none !important;
}
body.hub-app a:hover { color: var(--hub-brand-dark); text-decoration: underline; }

/* Neutralize default Frappe website navbar/footer/breadcrumb on hub pages */
body.hub-app nav.navbar, body.hub-app > .navbar,
body.hub-app footer.web-footer, body.hub-app .page-breadcrumbs,
body.hub-app .page-header-wrapper { display: none !important; }
body.hub-app main.container { max-width: none !important; padding: 0 !important; margin: 0 !important; }
body.hub-app .page_content > .container { max-width: none !important; padding: 0 !important; }
body.hub-app .page-content-wrapper { padding: 0 !important; }

/* ── Layout shell: sidebar + main ──────────────────────────────────── */
.hub-shell { display: grid; grid-template-columns: var(--hub-sidebar-w) 1fr; min-height: 100vh; }

/* ── Sidebar — "Luminous Logic" pattern ─────────────────────────────── */
/* Three-section layout: brand (fixed top) + nav (scroll middle) + footer
   (fixed bottom). Guarantees the footer is always visible no matter how
   many nav items there are. */
.hub-sidebar {
  background: var(--hub-surface-container-low);
  color: var(--hub-on-surface);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hub-outline-variant);
  overflow: hidden;  /* outer hides — inner sections scroll independently */
}
.hub-sidebar-brand {
  display: flex; gap: 12px; align-items: center;
  padding: 18px 18px;
  text-decoration: none !important;
  border-bottom: 1px solid var(--hub-outline-variant);
  flex-shrink: 0;
  background: var(--hub-surface-container-lowest);
}
.hub-sidebar-brand .hub-brand-logo {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hub-sidebar-brand .hub-brand-logo img {
  width: 44px; height: 44px; object-fit: contain;
  /* show the real PCCVDI logo in its natural colors — no filter */
}
.hub-sidebar-brand .hub-brand-text {
  font-size: 16px; font-weight: 800; color: var(--hub-on-surface);
  letter-spacing: -0.01em; line-height: 1.1;
}
.hub-sidebar-brand .hub-brand-sub {
  font-size: 11px; font-weight: 600; color: var(--hub-primary);
  margin-top: 2px; letter-spacing: .04em; text-transform: uppercase;
}

/* Scrollable middle section that holds the nav groups */
.hub-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--hub-outline-variant) transparent;
}
.hub-sidebar-nav::-webkit-scrollbar { width: 6px; }
.hub-sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--hub-outline-variant); border-radius: 3px;
}
.hub-sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--hub-outline); }

.hub-sidebar-group {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 0;
}
.hub-sidebar-group + .hub-sidebar-group {
  border-top: 1px solid var(--hub-outline-variant);
  margin-top: 4px;
  padding-top: 12px;
}
.hub-sidebar-group-title {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--hub-on-surface-variant); font-weight: 600;
  padding: 0 12px 6px;
}
.hub-sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--hub-radius);
  color: var(--hub-on-surface-variant);
  font-size: 14px; font-weight: 600; text-decoration: none !important;
  transition: all .15s ease;
}
.hub-sidebar-link .material-symbols-outlined,
.hub-sidebar-link svg {
  font-size: 20px;
  width: 20px; height: 20px; flex-shrink: 0;
  color: currentColor;
  transition: color .15s ease;
}
.hub-sidebar-link:hover {
  background: var(--hub-surface-container-high);
  color: var(--hub-on-surface);
}
.hub-sidebar-link.active {
  background: #6366f1;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .25);
}
.hub-sidebar-link.active .material-symbols-outlined,
.hub-sidebar-link.active svg { color: #ffffff; }

.hub-sidebar-sublink {
  padding-left: 32px;
  font-size: 13px;
  font-weight: 500;
}
.hub-sidebar-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  background: var(--hub-surface-container-highest, #e5e7eb);
  color: var(--hub-on-surface, #111827);
}
.hub-sidebar-link.active .hub-sidebar-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.hub-sidebar-cta {
  margin: 6px 0 4px;
  padding: 0 4px;
}
.hub-sidebar-cta .hub-btn {
  width: 100%;
  background: var(--hub-primary) !important;
  color: var(--hub-on-primary) !important;
  border: 0;
  padding: 12px 14px;
  font-weight: 700;
  border-radius: var(--hub-radius);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--hub-shadow-primary);
  transition: opacity .15s;
}
.hub-sidebar-cta .hub-btn:hover { opacity: .92; }

.hub-sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--hub-outline-variant);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--hub-surface-container-lowest);
}
.hub-user-chip {
  display: flex; gap: 12px; align-items: center;
  border-radius: var(--hub-radius);
  padding: 10px 12px;
  text-decoration: none !important;
  transition: background .15s;
}
.hub-user-chip:hover { background: var(--hub-surface-container-high); }
.hub-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--hub-primary) 0%, var(--hub-tertiary) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.hub-user-info { flex: 1; min-width: 0; }
.hub-user-name {
  font-size: 13px; font-weight: 700; color: var(--hub-on-surface);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hub-user-role {
  font-size: 11px; color: var(--hub-on-surface-variant);
  font-weight: 500; margin-top: 1px;
}
.hub-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--hub-radius);
  color: var(--hub-error) !important;
  font-size: 14px; font-weight: 600;
  text-decoration: none !important;
  transition: background .15s;
}
.hub-logout .material-symbols-outlined,
.hub-logout svg {
  font-size: 20px; width: 20px; height: 20px;
  color: currentColor;
}
.hub-logout:hover { background: var(--hub-error-container); }

/* ── Main content area ─────────────────────────────────────────────── */
.hub-main { padding: 0; min-width: 0; background: var(--hub-background); }
.hub-topbar {
  background: var(--hub-surface-container-lowest);
  border-bottom: 1px solid var(--hub-outline-variant);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
  min-height: 64px;
}
.hub-topbar-title {
  font-size: 20px; font-weight: 700; color: var(--hub-primary); margin: 0;
  letter-spacing: -0.01em;
}
.hub-topbar-actions { display: flex; gap: 10px; align-items: center; }
.hub-topbar-search {
  width: 280px; padding: 9px 14px;
  border: 1px solid var(--hub-outline-variant);
  border-radius: 999px;
  font-size: 13px; background: var(--hub-surface-container);
  color: var(--hub-on-surface);
  transition: all .15s ease;
}
.hub-topbar-search::placeholder { color: var(--hub-on-surface-variant); }
.hub-topbar-search:focus {
  outline: 0; border-color: var(--hub-primary);
  box-shadow: 0 0 0 3px var(--hub-primary-fixed);
  background: var(--hub-surface-container-lowest);
}

.hub-content { padding: 32px; max-width: 1400px; }
.hub-content-narrow { padding: 32px; max-width: 1100px; }
.hub-section + .hub-section { margin-top: 28px; }

/* ── Buttons (Luminous Logic) ──────────────────────────────────────── */
.hub-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--hub-radius);
  font-weight: 600; font-size: 14px;
  cursor: pointer; border: 1px solid transparent; transition: all .15s ease;
  text-decoration: none !important; line-height: 1.2; white-space: nowrap;
  font-family: inherit;
}
.hub-btn:hover { text-decoration: none !important; }
.hub-btn-primary {
  background: var(--hub-primary);
  color: var(--hub-on-primary) !important;
  box-shadow: var(--hub-shadow-primary);
}
.hub-btn-primary:hover {
  background: var(--hub-primary-container);
  box-shadow: 0 12px 24px rgba(70, 72, 212, .28);
}
.hub-btn-outline {
  background: var(--hub-surface-container-lowest);
  color: var(--hub-on-surface) !important;
  border-color: var(--hub-outline-variant);
}
.hub-btn-outline:hover {
  border-color: var(--hub-primary);
  color: var(--hub-primary) !important;
  background: var(--hub-primary-fixed);
}
.hub-btn-ghost { background: transparent; color: var(--hub-on-surface-variant) !important; }
.hub-btn-ghost:hover {
  background: var(--hub-surface-container-high);
  color: var(--hub-on-surface) !important;
}
.hub-btn-danger {
  background: var(--hub-surface-container-lowest);
  color: var(--hub-error) !important;
  border-color: var(--hub-error-container);
}
.hub-btn-danger:hover {
  background: var(--hub-error-container);
  color: var(--hub-on-error-container) !important;
}
.hub-btn-sm { padding: 7px 14px; font-size: 13px; }
.hub-btn-lg { padding: 13px 22px; font-size: 15px; }
.hub-btn svg { width: 16px; height: 16px; }
.hub-btn .material-symbols-outlined { font-size: 18px; }

/* ── Cards (Luminous Logic) ────────────────────────────────────────── */
.hub-card {
  background: var(--hub-surface-container-lowest);
  border: 1px solid var(--hub-outline-variant);
  border-radius: var(--hub-radius-lg);
  padding: 24px;
  box-shadow: var(--hub-shadow-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.hub-card:hover { box-shadow: var(--hub-shadow); }
.hub-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.hub-card-title {
  font-size: 18px; font-weight: 700; color: var(--hub-on-surface); margin: 0;
  letter-spacing: -0.01em;
}
.hub-card-subtitle {
  font-size: 13px; color: var(--hub-on-surface-variant); margin: 4px 0 0;
}

/* ── Stat tiles (Luminous Logic bento style) ───────────────────────── */
.hub-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.hub-stat {
  background: var(--hub-surface-container-lowest);
  border: 1px solid var(--hub-outline-variant);
  border-radius: var(--hub-radius-lg);
  padding: 20px;
  transition: all .2s ease;
  position: relative;
  box-shadow: var(--hub-shadow-sm);
}
.hub-stat:hover {
  border-color: var(--hub-primary-fixed-dim);
  box-shadow: var(--hub-shadow);
}
.hub-stat-label {
  font-size: 12px; font-weight: 500;
  color: var(--hub-on-surface-variant); margin-bottom: 6px;
}
.hub-stat-value {
  font-size: 28px; font-weight: 700; color: var(--hub-on-surface);
  line-height: 1.1; letter-spacing: -0.02em;
}
.hub-stat-delta {
  font-size: 12px; font-weight: 600; margin-top: 8px;
  display: inline-flex; gap: 4px; align-items: center;
}
.hub-stat-delta.up { color: var(--hub-ok); }
.hub-stat-delta.down { color: var(--hub-danger); }
.hub-stat-icon {
  width: 44px; height: 44px; border-radius: var(--hub-radius);
  background: var(--hub-primary-fixed);
  color: var(--hub-primary);
  display: flex; align-items: center; justify-content: center;
  float: right; margin-top: -4px;
}
.hub-stat-icon .material-symbols-outlined { font-size: 22px; }
.hub-stat-icon svg { width: 22px; height: 22px; }

/* Color-coded stat icon variants */
.hub-stat-icon-crm { background: var(--hub-primary-fixed); color: var(--hub-primary); }
.hub-stat-icon-stock { background: var(--hub-secondary-fixed); color: var(--hub-on-secondary-container); }
.hub-stat-icon-warn { background: var(--hub-tertiary-fixed); color: var(--hub-tertiary); }
.hub-stat-icon-purple { background: var(--hub-purple-soft); color: var(--hub-purple); }
.hub-stat-icon-info { background: var(--hub-secondary-fixed); color: var(--hub-on-secondary-container); }

/* ── Tables ────────────────────────────────────────────────────────── */
.hub-table-wrap {
  background: var(--hub-surface-container-lowest);
  border: 1px solid var(--hub-outline-variant);
  border-radius: var(--hub-radius-lg);
  overflow: hidden;
  box-shadow: var(--hub-shadow-sm);
}
.hub-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hub-table thead th {
  text-align: left; padding: 14px 18px; font-size: 11px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--hub-on-surface-variant);
  background: var(--hub-surface-container-low);
  border-bottom: 1px solid var(--hub-outline-variant);
}
.hub-table tbody td {
  padding: 14px 18px; border-bottom: 1px solid var(--hub-outline-variant);
  color: var(--hub-on-surface);
}
.hub-table tbody tr:last-child td { border-bottom: 0; }
.hub-table tbody tr:hover { background: var(--hub-surface-container-low); }
.hub-table a { color: var(--hub-primary); font-weight: 600; }
.hub-table a:hover { color: var(--hub-primary-container); }
.hub-table-empty {
  padding: 60px 20px; text-align: center;
  color: var(--hub-on-surface-variant); font-size: 14px;
}

/* ── Badges / status pills ─────────────────────────────────────────── */
.hub-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1.5;
  border: 1px solid transparent;
}
.hub-badge-new { background: var(--hub-primary-fixed); color: var(--hub-on-primary-fixed); border-color: var(--hub-primary-fixed-dim); }
.hub-badge-qualified { background: var(--hub-tertiary-fixed); color: var(--hub-tertiary); border-color: var(--hub-tertiary-fixed-dim); }
.hub-badge-won { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.hub-badge-lost { background: var(--hub-error-container); color: var(--hub-on-error-container); border-color: #fecaca; }
.hub-badge-gray { background: var(--hub-surface-container-high); color: var(--hub-on-surface-variant); border-color: var(--hub-outline-variant); }
.hub-badge-info { background: var(--hub-secondary-fixed); color: var(--hub-on-secondary-container); border-color: #c9e6ff; }
.hub-badge-warn { background: var(--hub-tertiary-fixed); color: var(--hub-tertiary); border-color: #ffb2b7; }
.hub-badge-ok { background: var(--hub-ok-soft); color: #047857; border-color: #a7f3d0; }
.hub-badge-danger { background: var(--hub-error-container); color: var(--hub-on-error-container); border-color: #fecaca; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.hub-form { display: grid; gap: 16px; }
.hub-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hub-form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hub-input, .hub-select, .hub-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--hub-outline-variant);
  border-radius: var(--hub-radius);
  font-size: 14px;
  color: var(--hub-on-surface);
  background: var(--hub-surface-container-lowest);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.hub-input:focus, .hub-select:focus, .hub-textarea:focus {
  outline: 0; border-color: var(--hub-primary);
  box-shadow: 0 0 0 3px var(--hub-primary-fixed);
}
.hub-input::placeholder, .hub-textarea::placeholder { color: var(--hub-on-surface-variant); }
.hub-textarea { min-height: 100px; resize: vertical; }
.hub-label { display: block; font-size: 13px; font-weight: 600;
  color: var(--hub-text); margin-bottom: 6px; }
.hub-label-req::after { content: ' *'; color: var(--hub-danger); }
.hub-form-help { font-size: 12px; color: var(--hub-text-faded); margin-top: 4px; }

/* ── Page header ───────────────────────────────────────────────────── */
.hub-page-header { display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.hub-page-title {
  font-size: 30px; font-weight: 700; color: var(--hub-primary);
  margin: 0; letter-spacing: -0.02em;
}
.hub-page-subtitle {
  font-size: 16px; color: var(--hub-on-surface-variant);
  margin: 8px 0 0; line-height: 1.5;
}
.hub-page-actions { display: flex; gap: 10px; align-items: center; }

/* ── Filter bar ────────────────────────────────────────────────────── */
.hub-filter-bar {
  background: var(--hub-surface-container-lowest);
  border: 1px solid var(--hub-outline-variant);
  border-radius: var(--hub-radius-lg);
  padding: 14px 18px; margin-bottom: 18px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  box-shadow: var(--hub-shadow-sm);
}

/* ── Kanban ────────────────────────────────────────────────────────── */
.hub-kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  align-items: flex-start; }
.hub-kanban-col {
  background: var(--hub-bg-soft);
  border: 1px solid var(--hub-border);
  border-radius: 14px; padding: 14px; min-height: 240px;
}
.hub-kanban-col-head { display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 14px; }
.hub-kanban-col-title { font-size: 11px; font-weight: 700; color: var(--hub-text);
  text-transform: uppercase; letter-spacing: .08em; }
.hub-kanban-col-count { font-size: 11px; color: var(--hub-brand-dark);
  background: var(--hub-brand-soft); padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.hub-kanban-card { background: #fff; border: 1px solid var(--hub-border);
  border-radius: 10px; padding: 14px; margin-bottom: 8px; cursor: pointer;
  transition: all .15s ease; box-shadow: var(--hub-shadow-sm); }
.hub-kanban-card:hover {
  border-color: var(--hub-brand-light);
  box-shadow: var(--hub-shadow);
  transform: translateY(-1px);
}
.hub-kanban-card h4 { font-size: 14px; font-weight: 700; margin: 0 0 6px;
  color: var(--hub-text); letter-spacing: -0.01em; }
.hub-kanban-card p { font-size: 12px; color: var(--hub-text-muted); margin: 0 0 8px; }
.hub-kanban-card-meta { display: flex; gap: 10px; align-items: center;
  font-size: 11px; color: var(--hub-text-faded); }

/* ── Alerts ────────────────────────────────────────────────────────── */
.hub-alert { padding: 14px 18px; border-radius: 10px; font-size: 14px; margin-bottom: 18px;
  border: 1px solid transparent; }
.hub-alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.hub-alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.hub-alert-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.hub-alert-info { background: var(--hub-brand-soft); color: var(--hub-brand-darker);
  border-color: var(--hub-brand-softer); }

/* ── Responsive — drawer-style sidebar on tablet/phone ─────────────── */

/* Mobile menu toggle (only visible on small screens) */
.hub-menu-toggle {
  display: none;
  background: var(--hub-surface-container-low);
  border: 1px solid var(--hub-outline-variant);
  color: var(--hub-on-surface);
  width: 40px; height: 40px;
  border-radius: var(--hub-radius);
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 10px;
}
.hub-menu-toggle .material-symbols-outlined { font-size: 22px; }
.hub-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(19, 27, 46, .5);
  z-index: 998;
  backdrop-filter: blur(2px);
}
body.hub-sidebar-open .hub-sidebar-backdrop { display: block; }

@media (max-width: 960px) {
  .hub-shell { grid-template-columns: 1fr; }
  .hub-sidebar {
    position: fixed; left: 0; top: 0;
    width: 280px; height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(19, 27, 46, .25);
  }
  body.hub-sidebar-open .hub-sidebar { transform: translateX(0); }
  .hub-menu-toggle { display: inline-flex; }
  .hub-content, .hub-content-narrow { padding: 18px 16px; max-width: none; }
  .hub-topbar { padding: 12px 16px; gap: 8px; }
  .hub-topbar-title { font-size: 17px; }
  .hub-topbar-search { width: 100%; max-width: 200px; }
  .hub-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .hub-form-row, .hub-form-row-3 { grid-template-columns: 1fr; }
  .hub-kanban { grid-template-columns: repeat(2, 1fr); }
  .hub-page-title { font-size: 22px; }
  .hub-page-subtitle { font-size: 14px; }

  /* Tables horizontal-scroll on mobile */
  .hub-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hub-table { min-width: 580px; }

  /* Bento + two-col layouts stack to single column */
  .hub-content [style*="grid-template-columns:1fr 1fr"],
  .hub-content [style*="grid-template-columns: 1fr 1fr"],
  .hub-content [style*="grid-template-columns:1fr 340px"],
  .hub-content [style*="grid-template-columns: 1fr 340px"] {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 600px) {
  .hub-stats { grid-template-columns: 1fr !important; }
  .hub-kanban { grid-template-columns: 1fr; }
  .hub-page-header { flex-direction: column; align-items: flex-start; }
  .hub-card { padding: 18px 16px; border-radius: 10px; }
  .hub-page-title { font-size: 20px; }
  .hub-topbar-actions { gap: 6px; }
  .hub-btn-sm { padding: 6px 10px; font-size: 12px; }
  .hub-topbar-search { display: none; }
  /* Force action grids (3-col, 4-col) down to 2-col on phones */
  .hub-content [style*="grid-template-columns:repeat(3"],
  .hub-content [style*="grid-template-columns:repeat(4"],
  .hub-content [style*="grid-template-columns:repeat(5"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
