/* ============================================================
   Gydon CRM – Application Stylesheet
   v3.1 — Enterprise (matches legacy design)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');


/* ------------------------------------------------------------
   1. Theme tokens
   ------------------------------------------------------------ */
:root {
  /* Brand / accent — Refined Navy azure */
  --g-accent:                #2D5BD7;
  --g-accent-hover:          #2348B8;
  --g-accent-light:          rgba(45, 91, 215, 0.08);
  --g-accent-rgb:            45, 91, 215;
  --g-accent-100:            #eaf0fd;
  --g-accent-ring:           rgba(45, 91, 215, 0.30);

  /* Superbar (dark chrome, subtly lighter than sidebar) */
  --g-superbar-height:       50px;
  --g-superbar-bg:           #102a45;

  /* Sidebar — brand ink */
  --g-sidebar-bg:            #0B1F33;
  --g-sidebar-width:         212px;
  --g-sidebar-link-color:    rgba(255,255,255,0.80);
  --g-sidebar-link-hover-bg: rgba(255,255,255,0.07);
  --g-sidebar-section-color: rgba(255,255,255,0.40);
  --g-sidebar-logo-height:   34px;

  /* App shell — light, airy slate canvas */
  --g-body-bg:               #F5F8FC;
  --g-topbar-bg:             #ffffff;
  --g-topbar-border:         #E5EBF2;
  --g-topbar-shadow:         0 1px 2px rgba(15,27,45,0.06);

  /* Cards — tighter radius, finer two-step shadow */
  --g-card-radius:           12px;
  --g-card-shadow:           0 1px 2px rgba(15,27,45,0.06), 0 1px 3px rgba(15,27,45,0.05);
  --g-card-shadow-hover:     0 4px 10px rgba(15,27,45,0.08), 0 2px 4px rgba(15,27,45,0.05);

  /* Semantic — kept separate from the accent */
  --g-ok:                    #15935A;
  --g-warn:                  #B7791F;
  --g-bad:                   #C53434;

  /* Fonts */
  --g-font-mono:             'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Login page */
  --g-login-page-bg:         #0B1F33;
  --g-login-card-shadow:     0 24px 60px rgba(11,31,51,0.34);
  --g-login-logo-height:     48px;

  /* Typography */
  --g-font-xs:               0.72rem;
  --g-font-sm:               0.8125rem;
  --g-font-badge-xs:         0.64rem;
  --g-font-badge-sm:         0.78rem;

  /* Component sizing */
  --g-select-type-width:       110px;
  --g-select-type-wide-width:  120px;
  --g-select-platform-width:   130px;
  --g-timeline-icon-size:      36px;
  --g-search-input-min-width:  220px;
}


/* ------------------------------------------------------------
   2. Base & typography
   ------------------------------------------------------------ */
body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--g-body-bg);
  color: #1e293b;
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 600;
  color: #1e293b;
}

/* Bootstrap primary → corporate blue accent */
.btn-primary {
  background-color: var(--g-accent);
  border-color: var(--g-accent);
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
  background-color: var(--g-accent-hover);
  border-color: var(--g-accent-hover);
}
.btn-outline-primary { color: var(--g-accent); border-color: var(--g-accent); }
.btn-outline-primary:hover { background-color: var(--g-accent); border-color: var(--g-accent); color: #fff; }
.text-primary { color: var(--g-accent) !important; }
.bg-primary { background-color: var(--g-accent) !important; }
a { color: var(--g-accent); }
a:hover { color: var(--g-accent-hover); }

/* Controls */
.btn { border-radius: 8px; font-weight: 550; font-size: 0.8125rem; }
.btn-sm { border-radius: 6px; font-size: 0.78rem; }
.btn-lg { border-radius: 10px; }
.btn-primary:focus { box-shadow: 0 0 0 0.2rem var(--g-accent-ring); }

.form-control, .form-select, .input-group-text {
  border-radius: 8px;
  border-color: #d7e0ec;
  font-size: 0.8125rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--g-accent);
  box-shadow: 0 0 0 0.25rem rgba(var(--g-accent-rgb), 0.25);
}
.form-control-sm, .form-select-sm { border-radius: 8px; }
.input-group-text { background-color: #f5f5f5; border-color: #e2e8f0; font-size: 0.8125rem; }

/* Cards */
.card {
  border: 1px solid var(--g-topbar-border);
  border-radius: var(--g-card-radius);
  box-shadow: var(--g-card-shadow);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--g-card-radius) var(--g-card-radius) 0 0 !important;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}
.card-body { padding: 1rem; }

/* Tables */
.table { font-size: 0.8125rem; margin-bottom: 0; font-variant-numeric: tabular-nums; }
.table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}
.table td { padding: 0.5rem 0.75rem; vertical-align: middle; border-color: #f1f5f9; }
.table-hover > tbody > tr:hover > * { background-color: #f8fafc; }

/* Badges */
.badge { font-weight: 500; letter-spacing: 0.01em; border-radius: 6px; }

/* Alerts */
.alert { border-radius: 10px; border: none; font-size: 0.875rem; box-shadow: var(--g-card-shadow); }
.alert-success { background: #e6f4ec; color: #0f7a48; }
.alert-danger  { background: #fbe9e9; color: #b42626; }
.alert-warning { background: #fbf1dd; color: #92600f; }
.alert-info    { background: #eaf0fd; color: #1e3a8a; }

/* Dropdowns */
.dropdown-menu {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  padding: 0.25rem;
  font-size: 0.8125rem;
}
.dropdown-item {
  border-radius: 4px;
  padding: 0.4rem 0.65rem;
  font-size: 0.8125rem;
  color: #1e293b;
}
.dropdown-item:hover { background: #f1f5f9; color: #0f172a; }
.dropdown-item.active, .dropdown-item:active { background: var(--g-accent); color: #fff; }
.dropdown-divider { margin: 0.25rem 0; border-color: #f1f5f9; }
.dropdown-header { font-size: 0.6875rem; color: #94a3b8; padding: 0.35rem 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.profile-menu { min-width: 15rem; }
.profile-menu .dropdown-header-sub {
  padding-top: 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.625rem;
  text-transform: none;
  letter-spacing: 0.02em;
  color: #64748b;
}
.profile-menu .dropdown-item-overview {
  white-space: normal;
  line-height: 1.35;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.profile-menu .dropdown-item-overview .overview-hint {
  display: block;
  margin-top: 0.15rem;
  padding-left: 1.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
}


/* ------------------------------------------------------------
   3. Superbar
   ------------------------------------------------------------ */
.superbar {
  position: fixed;
  top: 0;
  left: var(--g-sidebar-width);
  right: 0;
  height: var(--g-superbar-height);
  background: var(--g-superbar-bg);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1.25rem;
  gap: 0.25rem;
  background: var(--g-topbar-bg);
  border-bottom: 1px solid var(--g-topbar-border);
  box-shadow: var(--g-topbar-shadow);
}

.superbar .btn-superbar {
  color: #475569;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  font-weight: 550;
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.superbar .btn-superbar:hover,
.superbar .btn-superbar.show,
.superbar .btn-superbar.active {
  color: var(--g-accent);
  background: var(--g-accent-light);
}
.superbar .dropdown-menu {
  font-size: 0.8rem;
  min-width: 180px;
}

/* Quick-add (+) button */
.superbar .btn-superbar-add {
  width: auto;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--g-accent);
  border: 1px solid var(--g-accent);
  border-radius: 8px;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
  padding: 0 0.85rem;
  gap: 0.35rem;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--g-card-shadow);
}
.superbar .btn-superbar-add:hover,
.superbar .btn-superbar-add.show {
  color: #fff;
  border-color: var(--g-accent-hover);
  background: var(--g-accent-hover);
}
.superbar .quick-add-menu {
  min-width: 210px;
  font-size: 0.8rem;
  padding: 0.35rem 0;
}
.superbar .quick-add-menu .dropdown-header {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0.4rem 1rem 0.2rem;
}
.superbar .quick-add-menu .dropdown-item {
  padding: 0.35rem 1rem;
  font-weight: 500;
}
.superbar .quick-add-menu .dropdown-item:hover {
  background: var(--g-accent-light);
}
.superbar .quick-add-menu .dropdown-divider {
  margin: 0.3rem 0;
}

/* Activity modal overrides */
#activityModal .modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
#activityModal .modal-title {
  font-size: 0.9rem;
  color: var(--g-accent);
}
#activityModal .modal-body {
  padding: 1rem;
}
#activityModal .modal-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid #e2e8f0;
}

/* Toast overrides */
#globalToast {
  font-size: 0.8125rem;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

/* Notification bell badge */
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  font-size: 0.6rem; font-weight: 700;
  line-height: 16px; text-align: center;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444; color: #fff;
}

/* Notification dropdown panel */
.notif-panel { border-radius: 10px !important; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.18) !important; }
.notif-panel-header { border-bottom: 1px solid rgba(0,0,0,0.08); font-size: 0.875rem; }
.notif-panel-footer { font-size: 0.8125rem; }
.notif-panel-footer a { color: var(--g-accent); }
.notif-panel-footer a:hover { background: var(--g-accent-light); }

.notif-item {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  text-decoration: none; color: inherit;
  transition: background 0.15s;
}
.notif-item:hover { background: rgba(0,0,0,0.03); }
.notif-item:not(.read) { background: rgba(59,130,246,0.04); }
.notif-item.read { opacity: 0.7; }

.notif-icon {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: #fff;
}
.notif-icon.bg-primary   { background: #3b82f6 !important; }
.notif-icon.bg-success   { background: #10b981 !important; }
.notif-icon.bg-danger    { background: #ef4444 !important; }
.notif-icon.bg-warning   { background: #f59e0b !important; color: #fff !important; }
.notif-icon.bg-info      { background: #0ea5e9 !important; }
.notif-icon.bg-secondary { background: #64748b !important; }

.notif-content { min-width: 0; flex: 1; overflow: hidden; }
.notif-title   { display: block; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-message { display: block; font-size: 0.75rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time    { display: block; font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }

/* Dismiss button in dropdown */
.notif-item-wrap { position: relative; display: flex; align-items: stretch; }
.notif-item-wrap .notif-item { flex: 1; }
.notif-dismiss-btn {
  display: none;
  position: absolute; top: 0; right: 0;
  width: 28px; height: 100%;
  background: none; border: none; padding: 0;
  color: #94a3b8; font-size: 1rem; cursor: pointer;
  align-items: center; justify-content: center;
}
.notif-dismiss-btn:hover { color: #ef4444; }
.notif-item-wrap:hover .notif-dismiss-btn { display: flex; }

/* Full page notification list */
.notif-page-item { border-bottom: 1px solid rgba(0,0,0,0.06); transition: background 0.15s; }
.notif-page-item:hover { background: rgba(0,0,0,0.02); }
.notif-page-item.unread { background: rgba(59,130,246,0.04); }
.notif-page-item.unread:hover { background: rgba(59,130,246,0.07); }
.notif-page-dismiss {
  opacity: 0;
  color: #94a3b8;
  transition: opacity 0.15s;
  text-decoration: none;
  border-left: 1px solid rgba(0,0,0,0.06);
}
.notif-page-item:hover .notif-page-dismiss { opacity: 1; }
.notif-page-dismiss:hover { color: #ef4444 !important; }
.notif-unread-dot {
  width: 8px; height: 8px; min-width: 8px;
  border-radius: 50%; background: #3b82f6;
  display: inline-block;
}


/* ------------------------------------------------------------
   4. Sidebar
   ------------------------------------------------------------ */
.sidebar {
  width: var(--g-sidebar-width);
  height: 100vh;
  max-height: 100dvh;
  background: var(--g-sidebar-bg);
  padding-top: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0,0,0,0.2);
}

/* Scrollable nav region — keeps logo fixed and all links reachable on short viewports */
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.125rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.375rem;
  min-width: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(150deg, #3b74e6, #2348b8);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { color: rgba(255,255,255,0.42); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-logo {
  max-height: var(--g-sidebar-logo-height);
  max-width: 100%;
  width: auto;
}

.sidebar .nav-link {
  color: var(--g-sidebar-link-color);
  border-radius: 8px;
  margin: 1px 0.45rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: background .15s, color .15s;
}

.sidebar .nav-link i {
  font-size: 0.95rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.sidebar .nav-link:hover {
  background: var(--g-sidebar-link-hover-bg);
  color: #fff;
}

.sidebar .nav-link:hover i {
  opacity: 1;
}

.sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(45,91,215,0.16), rgba(45,91,215,0.04));
  color: #fff;
  font-weight: 550;
  box-shadow: inset 3px 0 0 #5b8def;
}

.sidebar .nav-link.active i {
  opacity: 1;
  color: #9dc0ff;
}

.sidebar .nav-section {
  color: var(--g-sidebar-section-color);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.65rem 1.25rem 0.2rem;
}

.sidebar-scroll .nav-section:first-child {
  padding-top: 0.35rem;
}

/* Collapsible groups & pinned shortcuts */
.sidebar-nav-root {
  padding-top: 0.25rem;
}

.sidebar-pinned-wrap {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-pinned-label {
  color: var(--g-sidebar-section-color);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 1.1rem 0.25rem;
}

.sidebar-group {
  margin-top: 0.15rem;
}

.sidebar-group-toggle {
  width: calc(100% - 0.9rem);
  margin: 1px 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sidebar-group-toggle:hover,
.sidebar-group.is-active .sidebar-group-toggle {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-group-icon {
  font-size: 0.95rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-group-label {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-group-chevron {
  font-size: 0.75rem;
  opacity: 0.55;
  transition: transform 0.2s ease;
}

.sidebar-group.is-open .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group-items {
  display: none;
  padding-bottom: 0.2rem;
}

.sidebar-group.is-open .sidebar-group-items {
  display: block;
}

.sidebar-link-row {
  display: flex;
  align-items: stretch;
  position: relative;
}

.sidebar-link-row .nav-link {
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 0;
  padding-right: 1.75rem;
}

.sidebar-pin-btn {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.sidebar-item:hover .sidebar-pin-btn,
.sidebar-pin-btn.is-pinned,
.sidebar-pin-btn:focus-visible {
  opacity: 1;
}

.sidebar-pin-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-pin-btn.is-pinned {
  color: #93c5fd;
}

.sidebar-item--pinned .sidebar-pin-btn {
  opacity: 1;
}

.sidebar-pinned-row {
  align-items: center;
}

.sidebar-pinned-row .nav-link {
  padding-left: 0.35rem;
  padding-right: 1.75rem;
}

.sidebar-drag-handle {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: grab;
  touch-action: none;
}

.sidebar-drag-handle:hover {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-drag-handle:active {
  cursor: grabbing;
}

.sidebar-item--pinned.is-dragging {
  opacity: 0.55;
}

.sidebar-item--pinned.is-dragging .sidebar-drag-handle {
  cursor: grabbing;
}


/* ------------------------------------------------------------
   5. App shell — main content area
   ------------------------------------------------------------ */
.main {
  margin-left: var(--g-sidebar-width);
  padding: 1.5rem;
  padding-top: calc(var(--g-superbar-height) + 1.5rem);
  min-height: 100vh;
}

.topbar {
  background: var(--g-topbar-bg);
  border-bottom: 1px solid var(--g-topbar-border);
  box-shadow: var(--g-topbar-shadow);
  padding: 0.75rem 1.5rem;
  margin: -1.5rem -1.5rem 1.5rem;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
}

.topbar h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0;
}


/* ------------------------------------------------------------
   6. Login page
   ------------------------------------------------------------ */
.login-page {
  background: var(--g-login-page-bg);
}

.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-logo {
  max-height: var(--g-login-logo-height);
  width: auto;
  margin-bottom: 1.5rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--g-login-card-shadow);
}

.login-subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}


/* ------------------------------------------------------------
   7. TomSelect overrides
   ------------------------------------------------------------ */
.ts-wrapper.single .ts-control {
  background: #fff;
}

/* TomSelect replaces the <select> with its own markup, so the house form-control
   sizing above never reaches the visible control — it rendered at the inherited body
   size (14px / 10px radius) next to native 13px / 8px inputs, which read as a bigger
   font in every filter bar and form. Restate the house metrics on .ts-control so a
   searchable select is indistinguishable from a plain one.
   Mail compose sets its own !important overrides and is unaffected. */
.ts-wrapper .ts-control,
.ts-wrapper.single .ts-control {
  font-size: 0.8125rem;
  border-radius: 8px;
  border-color: #d7e0ec;
}

.ts-control > input,
.ts-control > .item,
.ts-wrapper .ts-control::placeholder {
  font-size: inherit;
}

/* Small variant: match the height of a native .form-select-sm / .form-control-sm
   sitting beside it in a filter bar. */
.ts-wrapper.form-select-sm .ts-control,
.ts-wrapper.form-control-sm .ts-control {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 0.5rem;
}

.ts-dropdown {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  font-size: 0.8125rem;
}

.ts-opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ts-opt-sub {
  color: #64748b;
  font-size: 0.75rem;
  margin-left: auto;
}

.ts-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* ------------------------------------------------------------
   8. Stat cards
   ------------------------------------------------------------ */
.stat-card {
  display: block;
  text-decoration: none;
}

.stat-card .card {
  transition: box-shadow .3s ease, transform .3s ease;
  border: 1px solid #e3e6ea;
}

.stat-card:hover .card {
  box-shadow: var(--g-card-shadow-hover) !important;
  transform: translateY(-2px);
}

.stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 1.2rem;
}

/* Gradient icon backgrounds */
.stat-card__icon--blue    { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.stat-card__icon--green   { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card__icon--amber   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card__icon--red     { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-card__icon--purple  { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat-card__icon--cyan    { background: linear-gradient(135deg, #06b6d4, #0284c7); }
.stat-card__icon--indigo  { background: linear-gradient(135deg, #6366f1, #4338ca); }
.stat-card__icon--orange  { background: linear-gradient(135deg, #f97316, #c2410c); }
.stat-card__icon--slate   { background: linear-gradient(135deg, #64748b, #334155); }
.stat-card__icon--teal    { background: linear-gradient(135deg, #14b8a6, #0f766e); }

.stat-card__primary {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-card__secondary {
  font-size: .875rem;
  font-weight: 600;
  color: #10b981;
}

.stat-card__label {
  font-size: .8rem;
  color: #64748b;
  margin-top: .1rem;
}

.stat-card__sub {
  font-size: .7rem;
  color: #94a3b8;
  margin-top: .2rem;
}


/* ------------------------------------------------------------
   9. Timeline
   ------------------------------------------------------------ */
.timeline-icon {
  width: var(--g-timeline-icon-size);
  height: var(--g-timeline-icon-size);
}

.timeline-meta {
  font-size: var(--g-font-xs);
}


/* ------------------------------------------------------------
   10. Badges & Status Badges
   ------------------------------------------------------------ */
.badge-xs { font-size: var(--g-font-badge-xs); }
.badge-sm { font-size: var(--g-font-badge-sm); }

/* Single unified pill / badge system
   All badges share identical shape, size and spacing.
   Colour applied via .bg-{colour} helpers below.
   Dot-status variants use .status-badge-* + an <i> dot element. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Soft pastel bg + bold high-contrast text — canonical pill palette */
.badge.bg-primary   { background-color: #eaf0fd !important; color: #2348B8 !important; }
.badge.bg-info      { background-color: #e0f2fe !important; color: #0369a1 !important; }
.badge.bg-success   { background-color: #e6f4ec !important; color: #15935A !important; }
.badge.bg-warning   { background-color: #fbf1dd !important; color: #B7791F !important; }
.badge.bg-danger    { background-color: #fbe9e9 !important; color: #C53434 !important; }
.badge.bg-secondary { background-color: #eef2f7 !important; color: #475569 !important; }

/* Status-badge aliases — identical look, exist for semantic clarity + dot support */
.status-badge-primary,
.status-badge-info,
.status-badge-teal,
.status-badge-success,
.status-badge-warning,
.status-badge-danger,
.status-badge-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge-primary   { background-color: #eaf0fd; color: #2348B8; }
.status-badge-info      { background-color: #e0f2fe; color: #0369a1; }
.status-badge-teal      { background-color: #d8f3ee; color: #0d8074; }
.status-badge-success   { background-color: #e6f4ec; color: #15935A; }
.status-badge-warning   { background-color: #fbf1dd; color: #B7791F; }
.status-badge-danger    { background-color: #fbe9e9; color: #C53434; }
.status-badge-secondary { background-color: #eef2f7; color: #475569; }

/* Dot inside status badge */
.status-badge-primary i,
.status-badge-info i,
.status-badge-teal i,
.status-badge-success i,
.status-badge-warning i,
.status-badge-danger i,
.status-badge-secondary i {
  font-size: 0.4rem;
}


/* ------------------------------------------------------------
   11. Form helpers
   ------------------------------------------------------------ */
.search-input     { min-width: var(--g-search-input-min-width); }
.select-type      { width: var(--g-select-type-width); }
.select-type-wide { width: var(--g-select-type-wide-width); }
.select-platform  { width: var(--g-select-platform-width); }


/* ------------------------------------------------------------
   12. Utilities
   ------------------------------------------------------------ */
.cursor-pointer { cursor: pointer; }

.shadow-sm  { box-shadow: var(--g-card-shadow) !important; }
.shadow     { box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05) !important; }
.shadow-lg  { box-shadow: var(--g-card-shadow-hover) !important; }

.text-muted { color: #64748b !important; }
.border     { border-color: #e2e8f0 !important; }
.bg-light   { background-color: #f5f5f5 !important; }


/* ------------------------------------------------------------
   13. Kanban board
   ------------------------------------------------------------ */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding-bottom: 1rem;
}

.kanban-col {
  flex: 1 1 0;
  min-width: 150px;
  background: #f0f2f5;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 148px);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid #e3e6ea;
  background: #fff;
  border-radius: 8px 8px 0 0;
  gap: 0.35rem;
}

.kanban-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-stage-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-col-value {
  font-size: .75rem;
  font-weight: 600;
  color: #475569;
  padding: .2rem .85rem;
  border-bottom: 1px solid #e3e6ea;
  background: #fff;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: .375rem;
  display: flex;
  flex-direction: column;
  gap: .375rem;
  min-height: 80px;
}

.deal-card {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  cursor: grab;
  position: relative;
  transition: box-shadow .3s ease, transform .3s ease;
}

.deal-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

.deal-card--closed { opacity: .65; }

.deal-card--ghost {
  opacity: .4;
  background: #dbeafe;
  border: 2px dashed #3b82f6;
}

.deal-card--drag {
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  cursor: grabbing;
}

.deal-card-title {
  font-weight: 600;
  font-size: .8125rem;
  display: block;
  color: #1e293b;
  text-decoration: none;
  margin-bottom: .25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-card-title:hover { color: var(--g-accent); }

.deal-card-contact {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  margin-bottom: .35rem;
  color: #64748b;
}

.deal-card-footer {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .6875rem;
}

.deal-card-value { font-weight: 600; color: #059669; }

.deal-card-owner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--g-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .55rem;
  font-weight: 700;
  flex-shrink: 0;
}

.deal-card-ribbon {
  position: absolute;
  top: .35rem;
  right: .35rem;
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.deal-card-ribbon--won  { background: #d1fae5; color: #065f46; }
.deal-card-ribbon--lost { background: #fee2e2; color: #991b1b; }

.deal-note-row {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.deal-note-row:last-child { border-bottom: none; }

.deal-note-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #64748b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.deal-note-body    { flex: 1; min-width: 0; }
.deal-note-meta    { font-size: .8rem; margin-bottom: .2rem; color: #64748b; }
.deal-note-content { font-size: .875rem; word-break: break-word; }

.btn-xs {
  padding: .1rem .3rem;
  font-size: .7rem;
  line-height: 1.4;
  border-radius: 4px;
}


/* ------------------------------------------------------------
   14. Settings page
   ------------------------------------------------------------ */
.settings-layout { min-height: calc(100vh - 120px); }

.settings-nav-col { background: #fff; }

.settings-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  position: sticky;
  top: 1rem;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  padding: .55rem 1.1rem;
  color: #64748b;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 6px;
  margin: 1px 0.5rem;
  transition: all .3s ease;
}

.settings-nav-link:hover {
  color: var(--g-accent);
  background: var(--g-accent-light);
}

.settings-nav-link.active {
  color: var(--g-accent);
  background: var(--g-accent-light);
  font-weight: 600;
}

.settings-nav-link .badge {
  font-size: 0.65rem;
  min-width: 1.25rem;
}

#role-form-tabs .settings-nav-link,
.settings-nav .settings-nav-link:has(.badge) {
  width: calc(100% - 1rem);
}

.role-perm-module {
  background: #fff;
}

.role-perm-module--alt {
  background: #f8fafc;
}

.role-perm-module-inner {
  padding: 1rem 1.5rem;
}

.role-perm-module + .role-perm-module {
  border-top: 1px solid #e2e8f0;
}

.role-perm-check {
  margin-bottom: 0;
}

.role-perm-check:hover {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
}

.settings-content { background: #fff; padding: 0; }

.settings-content-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.settings-form { padding: .5rem 0; }

.settings-row {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.settings-row:last-of-type { border-bottom: none; }

.settings-row-label {
  flex: 0 0 280px;
  max-width: 280px;
  padding-top: .25rem;
}

.settings-row-control { flex: 1; min-width: 0; }
.settings-input-narrow { max-width: 160px; }
.settings-input-medium { max-width: 380px; }

.settings-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}


/* ------------------------------------------------------------
   15. Line items (quotes / orders new & edit forms)
   ------------------------------------------------------------ */
.line-item-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: .5rem; padding: 1rem; margin-bottom: .75rem; }

.product-search-wrapper { position: relative; }

.product-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #ced4da;
    border-top: none; border-radius: 0 0 .375rem .375rem;
    max-height: 220px; overflow-y: auto; z-index: 1050; display: none;
}
.product-dropdown .pd-item { padding: .45rem .75rem; cursor: pointer; font-size: .875rem; }
.product-dropdown .pd-item:hover { background: #e9ecef; }
.product-dropdown .pd-item .pd-sku { color: #6c757d; font-size: .75rem; font-family: monospace; }
.product-dropdown .pd-item .pd-type { float: right; font-size: .7rem; }

.totals-table td { padding: .35rem .5rem; }
.totals-table .grand-total td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid #dee2e6; }

.addr-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: .5rem; padding: 1rem; }


/* ============================================================
   SUPERBAR SEARCH
   ============================================================ */
.superbar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}
.superbar-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 .5rem;
    flex: 0 0 50vw;
    width: 50vw;
    max-width: 50vw;
}
.superbar-search-inner {
    display: flex;
    align-items: center;
    width: 100%;
    height: 36px;
    background: var(--g-body-bg);
    border: 1px solid var(--g-topbar-border);
    border-radius: 8px;
    padding: 0 .75rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.superbar-search-inner:focus-within {
    background: #fff;
    border-color: var(--g-accent);
    box-shadow: 0 0 0 3px var(--g-accent-ring);
}
.superbar-search-icon {
    color: #64748b;
    font-size: .8rem;
    margin-right: .45rem;
    flex-shrink: 0;
}
.superbar-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #1e293b;
    font-size: .9rem;
    font-weight: 500;
    font-family: inherit;
    padding: 0;
    width: 100%;
}
.superbar-search-input::placeholder { color: #94a3b8; }

.superbar-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 780px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 9999;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.superbar-mega-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    min-height: 0;
}
.superbar-mega-col {
    border-right: 1px solid #e9eef4;
    min-width: 0;
}
.superbar-mega-col:last-child { border-right: none; }
.superbar-mega-col-header {
    padding: .3rem .75rem .2rem;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #e9eef4;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.superbar-mega-col-header i { font-size: .75rem; }
.superbar-result-item {
    display: flex;
    align-items: center;
    padding: .38rem .75rem;
    text-decoration: none;
    color: #1e293b;
    font-size: .82rem;
    gap: .55rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}
.superbar-result-item:last-child { border-bottom: none; }
.superbar-result-item:hover { background: var(--g-accent-light); color: var(--g-accent); }
.superbar-result-icon { color: #64748b; font-size: .82rem; flex-shrink: 0; }
.superbar-result-text { flex: 1; min-width: 0; }
.superbar-result-label { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.superbar-result-sub { display: block; font-size: .7rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.superbar-result-group {
    padding: .35rem .85rem .2rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #e9eef4;
    pointer-events: none;
    user-select: none;
}
.superbar-result-group:not(:first-child) { border-top: 1px solid #e9eef4; }
.superbar-result-type { font-size: .68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.superbar-result-all {
    background: #f8fafc;
    color: #3b82f6;
    font-weight: 500;
    border-top: 1px solid #e2e8f0;
    padding: .45rem 1rem;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    transition: background .1s;
}
.superbar-result-all:hover { background: #eff6ff; }
.superbar-mega-view-all {
    display: block;
    padding: .22rem .75rem .3rem;
    font-size: .7rem;
    color: #3b82f6;
    text-decoration: none;
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
}
.superbar-mega-view-all:hover { text-decoration: underline; }

/* ============================================================
   BULK ACTION TOOLBAR
   ============================================================ */
.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .75rem;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    font-size: .8125rem;
}
.bulk-count {
    font-weight: 600;
    color: #1e40af;
    margin-right: .25rem;
}

/* ============================================================
   TASK MODULE
   ============================================================ */
.task-priority-urgent  { border-left: 3px solid #ef4444 !important; }
.task-priority-high    { border-left: 3px solid #f59e0b !important; }
.task-priority-medium  { border-left: 3px solid #3b82f6 !important; }
.task-priority-low     { border-left: 3px solid #6b7280 !important; }

/* ============================================================
   TAGS ADMIN
   ============================================================ */
.tag-color-swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
    flex-shrink: 0;
}

/* ============================================================
   MAIL MODULE
   ============================================================ */
/* 2-column layout for standalone email view page (view.html.twig) */
.mail-layout {
    height: calc(100vh - var(--g-superbar-height) - 60px);
    overflow: hidden;
}

/* 3-pane Gmail/Outlook-style layout for inbox (inbox.html.twig) */
.mail-shell {
    display: flex;
    height: calc(100vh - var(--g-superbar-height) - 60px);
    overflow: hidden;
    margin: 0 -1.5rem -1.5rem;
    border-top: 1px solid var(--g-topbar-border);
}

.mail-account-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
}

.mail-sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--g-topbar-border);
    padding: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.mail-folder-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: #475569;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: 0.875rem;
}

.mail-folder-link:hover {
    background: var(--g-accent-light);
    color: var(--g-accent);
}

.mail-folder-link.active {
    background: var(--g-accent);
    color: #fff;
}

.mail-folder-link.active .badge {
    background: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

.mail-list,
.mail-content {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

/* Narrow fixed-width list panel (inbox 3-pane) */
.mail-list-panel {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--g-topbar-border);
    background: #fff;
}

/* Reading pane (inbox 3-pane) */
.mail-reading-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    min-width: 0;
}

/* Full-view main area (view.html.twig inside mail-shell) */
.mail-view-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    min-width: 0;
}

.mail-view-main .mail-body {
    flex: 1;
    overflow-y: auto;
}

/* Toolbar inside the list panel */
.mail-list-toolbar {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--g-topbar-border);
    flex-shrink: 0;
    background: #fff;
}

.mail-toolbar,
.mail-view-toolbar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--g-topbar-border);
    flex-shrink: 0;
}

.mail-messages {
    flex: 1;
    overflow-y: auto;
}

.mail-item {
    display: flex;
    align-items: flex-start;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    gap: 0.625rem;
    cursor: pointer;
    transition: background 0.1s;
}

.mail-item:hover {
    background: #f8fafc;
}

.mail-item.active {
    background: #eff6ff;
    border-left: 3px solid var(--g-accent);
    padding-left: calc(0.875rem - 3px);
}

.mail-item.unread {
    background: #f0f9ff;
}

.mail-item.unread .mail-item-from,
.mail-item.unread .mail-item-subject {
    font-weight: 600;
}

.mail-item-check {
    flex-shrink: 0;
    padding-top: 2px;
}

.mail-item-star {
    flex-shrink: 0;
    cursor: pointer;
    padding-top: 1px;
    font-size: 0.8rem;
}

/* 3-row body layout */
.mail-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mail-item-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem;
}

.mail-item-from {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.mail-item-date {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.mail-item-row2 {
    min-width: 0;
}

.mail-item-subject {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
}

.mail-item-row3 {
    min-width: 0;
}

.mail-item-snippet {
    display: block;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
}

.mail-pagination {
    padding: 0.75rem;
    border-top: 1px solid var(--g-topbar-border);
    flex-shrink: 0;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination .page-link {
    color: var(--g-accent);
    border-color: #dee2e6;
    border-radius: 6px !important;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    margin: 0 2px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pagination .page-link:hover {
    background-color: var(--g-accent-light);
    border-color: var(--g-accent);
    color: var(--g-accent);
}
.pagination .page-item.active .page-link {
    background-color: var(--g-accent);
    border-color: var(--g-accent);
    color: #fff;
    box-shadow: none;
}
.pagination .page-item.disabled .page-link {
    color: #adb5bd;
    border-color: #dee2e6;
    background: transparent;
}
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 6px !important;
}

/* Mail View */
.mail-view-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.mail-subject {
    font-size: 1.25rem;
    font-weight: 600;
}

.mail-avatar .avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--g-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.mail-attachments {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    text-decoration: none;
    color: inherit;
}

.attachment-chip:hover {
    border-color: var(--g-accent);
    color: var(--g-accent);
}

.mail-crm-links {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.mail-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Mail Search */
.mail-search-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    gap: 1rem;
}

.mail-search-item:hover {
    background: #f8fafc;
}

.mail-search-item.unread {
    background: #f0f9ff;
}

.mail-search-item.unread .mail-search-subject {
    font-weight: 600;
}

.mail-search-from {
    width: 160px;
    flex-shrink: 0;
}

.mail-search-content {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 0.5rem;
}

.mail-search-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
}

.mail-search-snippet {
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
}

.mail-search-meta {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 0.75rem;
}

/* Reading Pane ─────────────────────────────────────────────── */
.pane-email {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.pane-toolbar {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--g-topbar-border);
    flex-shrink: 0;
    background: #fff;
}

.pane-header {
    padding: 1rem 1.5rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
}

.pane-subject {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    line-height: 1.35;
    color: #1e293b;
}

.pane-avatar .avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--g-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.pane-attachments {
    padding: 0.5rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pane-crm-links,
.pane-crm-bar {
    padding: 0.375rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pane-body {
    flex: 1;
    overflow: hidden;
}

.pane-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pane-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #cbd5e1;
    gap: 0.75rem;
}

.pane-empty i {
    font-size: 3rem;
}

.pane-empty p {
    margin: 0;
    font-size: 0.9375rem;
    color: #94a3b8;
}

.pane-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Compose */
.compose-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    /* fill viewport below superbar + topbar + bottom padding */
    min-height: calc(100vh - var(--g-superbar-height) - 56px - 4.5rem);
}

.compose-card {
    background: #fff;
    border-radius: var(--g-card-radius);
    box-shadow: var(--g-card-shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.compose-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.compose-field {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.compose-field:last-child {
    border-bottom: none;
}

.compose-label {
    width: 70px;
    flex-shrink: 0;
    font-size: 0.875rem;
    color: #64748b;
}

.compose-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9375rem;
    padding: 0.375rem 0;
    background: transparent;
}

.compose-input:focus {
    outline: none;
}

.compose-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* CKEditor fills the compose body */
.compose-body .ck.ck-editor {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.compose-body .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content {
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
}

.compose-body .ck.ck-toolbar {
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    border-top: none !important;
}

.compose-body .ck.ck-editor__main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.compose-body .ck.ck-editor__editable {
    height: 100%;
    min-height: 380px;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    padding: 1.25rem 1.5rem !important;
}

.compose-body .ck.ck-editor__editable:focus {
    box-shadow: none !important;
}

.toggle-cc {
    font-size: 0.8125rem;
    color: #64748b;
    text-decoration: none;
    margin-left: 0.5rem;
}

.toggle-cc:hover {
    color: var(--g-accent);
}

.cc-bcc-fields {
    display: none;
}

.cc-bcc-fields.show {
    display: block;
}

/* Spin animation for sync */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ── Mail: CRM panel (replaces pane-crm-bar) ─────────────────── */
.pane-crm-panel {
    padding: 0.4rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

.pane-crm-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #e8f0fe;
    border: 1px solid #c7d9fb;
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    font-size: 0.78rem;
    color: #1e40af;
}

.pane-crm-badge a { color: inherit; }

.btn-pane-unlink {
    background: none;
    border: none;
    padding: 0 2px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.btn-pane-unlink:hover { color: #ef4444; }

.pane-crm-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.76rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    gap: 0.2rem;
    white-space: nowrap;
}
.pane-crm-btn:hover {
    background: var(--g-accent-light);
    color: var(--g-accent);
    border-color: var(--g-accent);
}

/* Sender CRM "add to CRM" badge */
.pane-badge-add-crm {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
}
.pane-badge-add-crm:hover { background: #e2e8f0; }

/* ── Mail: compose TomSelect recipient fields ────────────────── */
.compose-field .ts-wrapper {
    flex: 1;
    min-width: 0;
}
.compose-field .ts-control {
    border: none !important;
    box-shadow: none !important;
    padding: 0.25rem 0 !important;
    background: transparent !important;
    min-height: unset !important;
}
.compose-field .ts-control input {
    font-size: 0.9375rem !important;
}
.compose-field .ts-dropdown {
    font-size: 0.875rem;
}

/* ── Compose: attachment zone ────────────────────────────────── */
.compose-attach-zone {
    flex: 1;
    min-width: 0;
}
.compose-attach-zone--dragover {
    background: rgba(59,130,246,0.06);
    border-radius: 6px;
}

/* Drop prompt */
.compose-attach-drop {
    font-size: 0.8125rem;
    color: #94a3b8;
    padding: 0.3rem 0;
    cursor: default;
}
.compose-attach-drop a {
    color: var(--g-accent);
    text-decoration: underline;
    cursor: pointer;
}
.compose-attach-drop.has-files {
    font-size: 0.75rem;
    padding-top: 0.15rem;
}

/* File chip list */
.compose-attach-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.compose-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    line-height: 1.2;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    background: #f1f5f9;
    color: #334155;
    white-space: nowrap;
    max-width: 280px;
}
.compose-attach-chip i {
    font-size: 0.82rem;
    flex-shrink: 0;
}
.compose-attach-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.compose-attach-chip-size {
    color: #94a3b8;
    font-size: 0.7rem;
    flex-shrink: 0;
}
.compose-attach-chip-remove {
    background: none;
    border: none;
    padding: 0 0.1rem;
    font-size: 1rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
}
.compose-attach-chip-remove:hover {
    color: #ef4444;
}

/* Document PDF chip variant */
.compose-attach-chip--doc {
    background: #fef2f2;
    color: #991b1b;
}
.compose-attach-chip--doc .compose-attach-chip-size { display: none; }

/* Inline template selector inside doc chip */
.compose-attach-template-select {
    font-size: 0.72rem !important;
    padding: 0 0.4rem !important;
    height: auto !important;
    line-height: 1.4 !important;
    border-radius: 4px !important;
    max-width: 160px;
    border-color: #fecaca !important;
}

/* ==========================================================================
   Internal Messaging
   ========================================================================== */

/* Superbar messages badge (mirrors .notif-badge but blue) */
.msg-superbar-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    font-size: 0.6rem; font-weight: 700;
    line-height: 16px; text-align: center;
    padding: 0 4px;
    border-radius: 999px;
    background: #3b82f6; color: #fff;
}

/* Message delete button — visible on bubble-wrap hover */
.msg-delete-btn {
    opacity: 0;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    transition: opacity 0.15s;
    text-decoration: none;
}
.msg-bubble-wrap:hover .msg-delete-btn {
    opacity: 1;
}
.msg-delete-btn:hover {
    color: #ef4444 !important;
}

/* Inbox list */
.messaging-conv-row {
    transition: background 0.1s;
}
.messaging-conv-row:hover {
    background: #f8fafc;
}
.messaging-conv-delete-form {
    opacity: 0;
    transition: opacity 0.15s;
}
.list-group-item:hover .messaging-conv-delete-form {
    opacity: 1;
}
.messaging-conv-delete-btn {
    color: #94a3b8;
    text-decoration: none;
}
.messaging-conv-delete-btn:hover {
    color: #ef4444;
}
.messaging-conv-row--unread {
    background: #eff6ff;
}
.messaging-conv-row--unread:hover {
    background: #dbeafe;
}
.messaging-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--g-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}
.messaging-name {
    font-size: var(--g-font-sm);
}
.messaging-preview {
    font-size: var(--g-font-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thread card — fills available space below topbar, compose bar always visible */
.messaging-thread-card {
    height: calc(100vh - var(--g-superbar-height) - 60px);
    min-height: 400px;
    overflow: hidden;
    margin: 0 -1.5rem -1.5rem;
    border-radius: 0 !important;
}
.messaging-thread {
    flex: 1;
    min-height: 0;   /* lets a flex child shrink below its content size */
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Bubbles */
.messaging-bubble {
    max-width: 68%;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
    font-size: var(--g-font-sm);
    word-break: break-word;
}
.messaging-bubble--me {
    background: var(--g-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.messaging-bubble--them {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}
.messaging-bubble-name {
    font-size: var(--g-font-xs);
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 2px;
}
.messaging-bubble-body {
    line-height: 1.5;
}
.messaging-bubble-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 3px;
    text-align: right;
}
.messaging-bubble--them .messaging-bubble-time {
    text-align: left;
}

/* Compose bar */
.messaging-compose {
    background: #fff;
    flex-shrink: 0;
}

/* ------------------------------------------------------------
   AI Agent chat — mirrors messaging thread layout
   ------------------------------------------------------------ */

/* Make .main a flex column that fills the viewport so the card can flex-fill */
.chat-page .main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding-bottom: 0;
}

/* Topbar keeps its margin/padding but must not grow */
.chat-page .topbar {
    flex-shrink: 0;
}

.chat-thread-card {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin: 0 -1.5rem 0;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
}
.chat-thread-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}
.chat-thread-compose {
    background: var(--bs-body-bg);
    flex-shrink: 0;
    border-top: 1px solid var(--bs-border-color);
    padding: 0.75rem 1rem;
}
.chat-agent-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    flex-shrink: 0;
}
.chat-agent-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.chat-bubble-agent {
    max-width: 78%;
    padding: 0.6rem 0.9rem;
    border-radius: 14px 14px 14px 4px;
    background: #f1f5f9;
    color: #1e293b;
    font-size: var(--g-font-sm);
    word-break: break-word;
    align-self: flex-start;
}
.chat-bubble-agent pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: inherit;
    margin: 0;
}
.chat-bubble-user {
    max-width: 78%;
    padding: 0.6rem 0.9rem;
    border-radius: 14px 14px 4px 14px;
    background: var(--g-accent);
    color: #fff;
    font-size: var(--g-font-sm);
    word-break: break-word;
    align-self: flex-end;
}
.chat-typing-dots span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chat-bounce 1.2s infinite;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* ── Embedded AI assistant (FAB + offcanvas) ─────────────────────────────── */
.crm-assistant-fab {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    width: 3.25rem;
    height: 3.25rem;
    /* Above Bootstrap offcanvas (1045) and backdrop (1040) so the FAB stays reachable */
    z-index: 1060;
    border: none;
}
@media (min-width: 992px) {
    .crm-assistant-fab {
        right: 1.5rem;
        bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }
}
body.is-impersonating .crm-assistant-fab {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}
.crm-assistant-offcanvas {
    width: min(100vw, 440px) !important;
    /* Do not set z-index here: Bootstrap uses 1045 for .offcanvas and 1040 for the backdrop.
       Matching 1040 stacks the backdrop above the panel and blocks all clicks. */
}
.crm-assistant-offcanvas .offcanvas-body {
    max-height: calc(100vh - 4rem);
}


/* ------------------------------------------------------------
   16. Refined Navy — component refinements
   (tabs, modals, progress, list-groups, pagination, nav-pills)
   These cover the remaining Bootstrap-default surfaces so every
   screen adopts the system. Appended last so it wins on tie.
   ------------------------------------------------------------ */

/* Tabs — modern underline (detail pages: contacts, accounts, projects) */
.nav-tabs {
  border-bottom: 1px solid var(--g-topbar-border);
  gap: 2px;
}
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-weight: 550;
  font-size: 0.8125rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0;
  margin-bottom: -1px;
}
.nav-tabs .nav-link:hover {
  color: var(--g-accent);
  border-bottom-color: rgba(var(--g-accent-rgb), 0.35);
  background: transparent;
}
.nav-tabs .nav-link.active {
  color: var(--g-accent);
  background: transparent;
  border-bottom: 2px solid var(--g-accent);
  font-weight: 600;
}

/* Pills */
.nav-pills .nav-link {
  color: #475569;
  font-weight: 550;
  border-radius: 8px;
  font-size: 0.8125rem;
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background: var(--g-accent);
  color: #fff;
}

/* Modals — refined frame, used across 23+ screens */
.modal-content {
  border: 1px solid var(--g-topbar-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(11,31,51,0.28);
}
.modal-header {
  border-bottom: 1px solid var(--g-topbar-border);
  padding: 1rem 1.25rem;
}
.modal-title {
  font-size: 1rem;
  font-weight: 650;
  color: #0f1b2d;
  letter-spacing: -0.01em;
}
.modal-body { padding: 1.25rem; }
.modal-footer {
  border-top: 1px solid var(--g-topbar-border);
  padding: 0.85rem 1.25rem;
  gap: 0.25rem;
}

/* Progress bars (project completion, budget burn, capacity) */
.progress {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
}
.progress-bar { background-color: var(--g-accent); }
.progress-bar.bg-success { background-color: var(--g-ok) !important; }
.progress-bar.bg-warning { background-color: var(--g-warn) !important; }
.progress-bar.bg-danger  { background-color: var(--g-bad) !important; }

/* List groups */
.list-group-item {
  border-color: #eef2f7;
  font-size: 0.8125rem;
}
.list-group-item.active {
  background: var(--g-accent);
  border-color: var(--g-accent);
}
.list-group-item-action:hover { background: var(--g-accent-light); }

/* Pagination — bind Bootstrap vars to the accent */
.pagination {
  --bs-pagination-color: var(--g-accent);
  --bs-pagination-hover-color: var(--g-accent-hover);
  --bs-pagination-active-bg: var(--g-accent);
  --bs-pagination-active-border-color: var(--g-accent);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem var(--g-accent-ring);
  --bs-pagination-border-color: var(--g-topbar-border);
}
.page-link {
  border-radius: 7px;
  margin: 0 2px;
  font-size: 0.8125rem;
}

/* Nav underline variant some pages use directly on .nav */
.nav-underline .nav-link.active { color: var(--g-accent); border-bottom-color: var(--g-accent); }


/* ------------------------------------------------------------
   17. Refined Navy — sidebar (section-label group headers + user footer)
   ------------------------------------------------------------ */
/* Collapsible group headers read as quiet uppercase section labels */
.sidebar-group { margin-top: 0.35rem; }
.sidebar-group-toggle {
  width: calc(100% - 0.9rem);
  margin: 0 0.45rem;
  padding: 0.5rem 0.7rem 0.3rem !important;
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4) !important;
  background: transparent !important;
}
.sidebar-group-toggle:hover,
.sidebar-group.is-active .sidebar-group-toggle { color: rgba(255,255,255,0.72) !important; background: transparent !important; }
.sidebar-group-icon { display: none !important; }
.sidebar-group-chevron { font-size: 0.62rem; opacity: 0.4; margin-left: auto; }
.sidebar-pinned-label {
  color: rgba(255,255,255,0.4);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.5rem 0.95rem 0.3rem;
}

.sidebar-user {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  margin: 4px 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
.sidebar-user-av {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg,#3b74e6,#2348b8); color: #fff;
  font-size: 0.72rem; font-weight: 700;
}
.sidebar-user-meta { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user-meta .nm { display: block; color: #fff; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-meta .rl { display: block; color: rgba(255,255,255,0.45); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-cog { color: rgba(255,255,255,0.4); font-size: 0.9rem; flex: none; }
.sidebar-user:hover .sidebar-user-cog { color: rgba(255,255,255,0.85); }


/* ------------------------------------------------------------
   18. Projects — shared header + cross-view sub-nav
   ------------------------------------------------------------ */
.pjh { display: flex; align-items: flex-start; gap: 15px; }
.pjh-av { width: 48px; height: 48px; border-radius: 13px; flex: none; display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 17px; background: linear-gradient(140deg,#3b74e6,#2348b8); }
.pjh-main { min-width: 0; flex: 1; }
.pjh-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pjh-title { font-size: 20px; font-weight: 650; color: #0f1b2d; letter-spacing: -.02em; }
.pjh-ref { font-family: var(--g-font-mono); font-size: 11px; color: #9aa8bc; }
.pjh-meta { color: #76869b; font-size: 12.5px; margin-top: 5px; display: flex; gap: 16px; flex-wrap: wrap; }
.pjh-meta b { color: #3c4b60; font-weight: 600; }
.pjh-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pjh-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pjh-pill.h-ok { color: var(--g-ok); background: #e6f4ec; } .pjh-pill.h-warn { color: var(--g-warn); background: #fbf1dd; } .pjh-pill.h-bad { color: var(--g-bad); background: #fbe9e9; }
.pjh-pill.st-active { color: var(--g-accent); background: var(--g-accent-100); }
.pjh-pill.st-planned { color: #5160d6; background: #eceefc; } .pjh-pill.st-on_hold { color: var(--g-warn); background: #fbf1dd; }
.pjh-pill.st-completed { color: var(--g-ok); background: #e6f4ec; } .pjh-pill.st-draft, .pjh-pill.st-cancelled { color: #64748b; background: #eef2f7; }
.pjh-prog { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.pjh-prog .bar { flex: 1; max-width: 320px; height: 7px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.pjh-prog .bar i { display: block; height: 100%; border-radius: 999px; background: var(--g-accent); }
.pjh-prog .bar i.warn { background: var(--g-warn); } .pjh-prog .bar i.bad { background: var(--g-bad); }
.pjh-prog .pct { font-size: 12.5px; font-weight: 650; color: #0f1b2d; }

.pjsub { display: inline-flex; background: #fff; border: 1px solid var(--g-topbar-border); border-radius: 9px; padding: 3px; box-shadow: var(--g-card-shadow); margin: 16px 0; }
.pjsub a { padding: 7px 15px; border-radius: 6px; font-size: 12.5px; font-weight: 550; color: #76869b; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.pjsub a:hover { color: #0f1b2d; }
.pjsub a.active { background: var(--g-accent); color: #fff; }
.pjsub a i { font-size: 14px; }

/* Planner uses the shared sub-nav; hide its internal tab strip */
#planner-nav { display: none !important; }


/* ------------------------------------------------------------
   19. Generic list → record peek (deals, quotes, orders, invoices)
   Markup: .rec-wrap > (.card with table of .rec-row[data-*]) + aside.rec-peek
   Panel fields: [data-peek-field="<datasetKey>"]; links: + data-peek-href;
   bars: [data-peek-width="<key>"]; coloured chip: [data-peek-bg="<key>"].
   Behaviour wired once in base.html.twig.
   ------------------------------------------------------------ */
.rec-wrap { display: grid; grid-template-columns: 1fr 0fr; gap: 0; transition: grid-template-columns .26s ease; align-items: start; }
.rec-wrap.peeking { grid-template-columns: 1fr 372px; gap: 16px; }
.rec-row { cursor: pointer; }
.rec-row.sel > td { background: var(--g-accent-light) !important; }
.rec-row.sel > td:first-child { box-shadow: inset 3px 0 0 var(--g-accent); }

.rec-peek { background: #fff; border: 1px solid var(--g-topbar-border); border-radius: 14px; box-shadow: var(--g-card-shadow-hover); overflow: hidden; min-width: 0; opacity: 0; position: sticky; top: 1rem; }
.rec-wrap.peeking .rec-peek { opacity: 1; }
.rp-head { padding: 16px; border-bottom: 1px solid var(--g-topbar-border); position: relative; }
.rp-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border: none; border-radius: 7px; background: var(--g-body-bg); color: #76869b; }
.rp-close:hover { background: #e5ebf2; color: #0f1b2d; }
.rp-ref { font-family: var(--g-font-mono); font-size: 10.5px; color: #9aa8bc; }
.rp-title { font-size: 16px; font-weight: 650; color: #0f1b2d; margin-top: 3px; line-height: 1.3; padding-right: 30px; }
.rp-value { font-size: 24px; font-weight: 750; color: #0f1b2d; letter-spacing: -.02em; margin: 10px 0 8px; font-variant-numeric: tabular-nums; }
.rp-pill { display: inline-flex; font-size: 11px; font-weight: 600; color: #fff; padding: 3px 10px; border-radius: 999px; }
.rp-fields { padding: 6px 16px 10px; }
.rp-f { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef2f7; }
.rp-f:last-child { border-bottom: none; }
.rp-k { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #76869b; }
.rp-v { font-size: 12.5px; font-weight: 550; color: #0f1b2d; display: flex; align-items: center; gap: 8px; }
.rp-bar { width: 46px; height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.rp-bar i { display: block; height: 100%; background: var(--g-accent); border-radius: 999px; }
.rp-actions { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--g-topbar-border); }
.rp-actions .btn { flex: 1; justify-content: center; }
@media (max-width: 1100px) { .rec-wrap.peeking { grid-template-columns: 1fr; } .rec-wrap.peeking .rec-peek { display: none; } }


/* ------------------------------------------------------------
   20. Record identity header + summary stats (accounts, contacts)
   ------------------------------------------------------------ */
.acc-head { display: flex; align-items: center; gap: 15px; margin-bottom: 16px; }
.acc-av { width: 50px; height: 50px; border-radius: 13px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; background: linear-gradient(140deg, #1aa7a0, #0f7c77); }
.acc-av--person { background: linear-gradient(140deg, #3b74e6, #2348b8); }
.acc-main { min-width: 0; flex: 1; }
.acc-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acc-title { font-size: 20px; font-weight: 650; color: #0f1b2d; letter-spacing: -.02em; }
.acc-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.acc-pill.st-customer { color: var(--g-ok); background: #e6f4ec; }
.acc-pill.st-prospect { color: var(--g-accent); background: var(--g-accent-100); }
.acc-pill.st-partner { color: #6d45c9; background: #efe9fb; }
.acc-pill.st-lead, .acc-pill.st-inactive { color: #64748b; background: #eef2f7; }
.acc-meta { color: #76869b; font-size: 12.5px; margin-top: 5px; display: flex; gap: 16px; flex-wrap: wrap; }
.acc-meta a { color: var(--g-accent); text-decoration: none; }
.acc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.acc-stat { background: #fff; border: 1px solid var(--g-topbar-border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--g-card-shadow); }
.acc-stat-k { color: #76869b; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.acc-stat-v { font-size: 22px; font-weight: 680; color: #0f1b2d; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.acc-stat-v small { font-size: 12px; color: #76869b; font-weight: 600; }
@media (max-width: 1100px) { .acc-stats { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   21. HOUSE DEVELOPER — portfolio bars, summary rings,
       sales-progression timeline, plot board cards
   ============================================================ */

/* segmented availability bar (completed / sold / reserved / available) */
.segbar { display: flex; height: 9px; border-radius: 999px; overflow: hidden; background: var(--g-border-soft, #eef2f7); }
.segbar i { height: 100%; }
.segbar .seg-comp { background: var(--g-ok, #15935A); }
.segbar .seg-sold { background: var(--g-accent, #2D5BD7); }
.segbar .seg-res  { background: var(--g-warn, #B7791F); }
.segbar .seg-avail{ background: #cdd9e7; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; }
.seg-legend .lg { display: inline-flex; align-items: center; gap: 7px; }
.seg-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.seg-legend .dot.seg-comp { background: var(--g-ok, #15935A); }
.seg-legend .dot.seg-sold { background: var(--g-accent, #2D5BD7); }
.seg-legend .dot.seg-res  { background: var(--g-warn, #B7791F); }
.seg-legend .dot.seg-avail{ background: #cdd9e7; }

/* summary band with rings (development overview / reservation) */
.ov-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.ring-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff; border: 1px solid var(--g-border, #E5EBF2); border-radius: 14px; box-shadow: 0 1px 2px rgba(15,27,45,.06); }
.ring-card .ring { width: 58px; height: 58px; flex: none; }
.ring-card .ring-k { font-size: 11px; color: var(--g-text-3, #76869b); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.ring-card .ring-v { font-size: 19px; font-weight: 680; color: var(--g-ink, #0f1b2d); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ring-card .ring-s { font-size: 11.5px; color: var(--g-text-3, #76869b); }
@media (max-width: 1100px) { .ov-mini { grid-template-columns: repeat(2, 1fr); } }

/* sales-progression / phase timeline */
.ms { padding: 6px 4px 4px; }
.ms-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; padding: 11px 0; position: relative; align-items: start; }
.ms-row:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 32px; bottom: -11px; width: 2px; background: var(--g-border, #E5EBF2); }
.ms-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; z-index: 1; border: 2px solid #fff; flex: none; }
.ms-dot.done { background: var(--g-ok, #15935A); color: #fff; }
.ms-dot.doing { background: var(--g-accent, #2D5BD7); color: #fff; }
.ms-dot.pending { background: #fff; border: 2px solid #cdd9e7; color: var(--g-text-faint, #9AA8BC); }
.ms-dot i { font-size: 13px; }
.ms-nm { font-size: 13px; font-weight: 600; color: var(--g-ink, #0f1b2d); }
.ms-nm.pending { color: var(--g-text-3, #76869b); font-weight: 500; }
.ms-meta { font-size: 11.5px; color: var(--g-text-3, #76869b); margin-top: 1px; }
.ms-date { font-size: 11.5px; color: var(--g-text-3, #76869b); white-space: nowrap; text-align: right; }
.ms-date.over { color: var(--g-bad, #C53434); font-weight: 600; }
.ms-date b { color: var(--g-ink, #0f1b2d); }

/* plot board cards */
.hd-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: start; }
.hd-col { background: var(--g-surface-2, #FAFCFE); border: 1px solid var(--g-border, #E5EBF2); border-radius: 14px; min-height: 110px; }
.hd-col-h { display: flex; align-items: center; gap: 8px; padding: 11px 13px; font-size: 12px; font-weight: 650; color: var(--g-ink, #0f1b2d); }
.hd-col-h .cdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hd-col-h .cnt { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--g-text-3, #76869b); background: var(--g-border-soft, #eef2f7); border-radius: 999px; padding: 1px 8px; }
.hd-col-sub { padding: 0 13px 8px; font-size: 11.5px; font-weight: 600; color: var(--g-text-2, #3c4b60); font-variant-numeric: tabular-nums; }
.hd-col-body { padding: 0 9px 12px; display: flex; flex-direction: column; gap: 9px; min-height: 20px; }
.pcard { display: block; background: #fff; border: 1px solid var(--g-border, #E5EBF2); border-radius: 11px; padding: 10px 11px; box-shadow: 0 1px 2px rgba(15,27,45,.06); color: inherit; text-decoration: none; transition: box-shadow .12s, border-color .12s, transform .06s; }
.pcard:hover { box-shadow: 0 4px 10px rgba(15,27,45,.08); border-color: #cdd9e7; color: inherit; text-decoration: none; }
.pcard:active { transform: scale(.99); }
.pc-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.pc-no { font-weight: 700; color: var(--g-ink, #0f1b2d); font-size: 13px; }
.pc-price { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--g-ink, #0f1b2d); font-variant-numeric: tabular-nums; }
.pc-type { font-size: 11.5px; color: var(--g-text-2, #3c4b60); font-weight: 550; margin-bottom: 7px; }
.pc-title { display: block; font-weight: 600; font-size: 13px; color: var(--g-ink, #0f1b2d); line-height: 1.3; word-break: break-word; }
.pc-title:hover { color: var(--g-accent, #2D5BD7); }
.pc-sub { font-size: 11px; color: var(--g-text-3, #76869b); margin-top: 2px; }
.pc-foot { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pc-stage { font-size: 10px; font-weight: 600; color: var(--g-text-3, #76869b); background: var(--g-border-soft, #eef2f7); padding: 2px 7px; border-radius: 999px; }
.pc-ref { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--g-accent, #2D5BD7); font-family: var(--g-font-mono, monospace); }
@media (max-width: 1400px) { .hd-board { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .hd-board { grid-template-columns: 1fr; } }

/* ============================================================
   22. PROJECT STATUS BOARD — shared lane styling that mirrors
       the planner board (projects/planner.html.twig) so the
       /projects/board kanban is visually identical.
   ============================================================ */
.planner-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: .25rem; }
.planner-status-lane { display: flex; flex-direction: column; min-height: 24rem; background: #FAFCFE; border: 1px solid var(--g-topbar-border); border-radius: 14px; padding: 0; }
.planner-lane-header { padding: 12px 14px; border-bottom: 1px solid var(--g-topbar-border); }
.planner-lane-header .fw-semibold { font-size: 12.5px; color: #0f1b2d; }
.planner-lane-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.planner-metric-pill { font-size: 10.5px; font-weight: 600; color: #76869b; background: #eef2f7; border-radius: 999px; padding: 2px 9px; border: none; }
.planner-task-card { background: #fff; border: 1px solid var(--g-topbar-border); border-radius: 11px; padding: 11px 12px; box-shadow: var(--g-card-shadow); text-align: left; width: 100%; transition: box-shadow .12s, border-color .12s, transform .06s; }
.planner-task-card:hover { box-shadow: var(--g-card-shadow-hover); border-color: #cdd9e7; }
.planner-task-card:active { transform: scale(.99); }
.planner-task-card .fw-semibold { font-size: 13px; color: #0f1b2d; line-height: 1.35; }
.planner-status-lane.is-drop-target { outline: 2px dashed var(--g-accent, #2D5BD7); outline-offset: -2px; background: rgba(45, 91, 215, .08); }
.planner-empty { text-align: center; color: #94a3b8; font-size: 12px; padding: 14px 8px; }
/* health-coloured left stripe so at-risk / off-track projects read at a glance */
.project-card { border-left: 3px solid #cdd9e7; }
.project-card[data-health="on_track"] { border-left-color: var(--g-ok, #15935A); }
.project-card[data-health="at_risk"] { border-left-color: var(--g-warn, #B7791F); }
.project-card[data-health="off_track"] { border-left-color: var(--g-bad, #C53434); }
/* shared card elements (health dot, progress bar, coloured team avatars) — mirror portfolio */
.pjp-health { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #3c4b60; }
.pjp-hdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pjp-hdot.ok { background: var(--g-ok); } .pjp-hdot.warn { background: var(--g-warn); } .pjp-hdot.bad { background: var(--g-bad); }
.pjp-prog { display: flex; align-items: center; gap: 8px; }
.pjp-pbar { flex: 1; height: 7px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.pjp-pbar i { display: block; height: 100%; border-radius: 999px; background: var(--g-accent); }
.pjp-pbar i.ok { background: var(--g-ok); } .pjp-pbar i.warn { background: var(--g-warn); } .pjp-pbar i.bad { background: var(--g-bad); }
.pjp-avstack { display: flex; }
.pjp-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 600; margin-left: -7px; box-shadow: 0 0 0 2px #fff; }
.pjp-av:first-child { margin-left: 0; }
.pjp-av.a0 { background: linear-gradient(140deg,#3b74e6,#2348b8); } .pjp-av.a1 { background: linear-gradient(140deg,#1aa7a0,#0f7c77); }
.pjp-av.a2 { background: linear-gradient(140deg,#8a5cf0,#6d45c9); } .pjp-av.a3 { background: linear-gradient(140deg,#e0992f,#b7791f); }
.pjp-av.a4 { background: linear-gradient(140deg,#d65a8e,#a8366a); }
.pjp-avmore { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin-left: -7px; background: #eef2f7; color: #76869b; font-size: 10px; font-weight: 600; box-shadow: 0 0 0 2px #fff; }


/* ------------------------------------------------------------
   19. Sidebar v2 — spottable sections + collapsible icon rail
   (appended last so it overrides the earlier muted section-label look)
   ------------------------------------------------------------ */

/* The root nav is a Bootstrap .nav (display:flex; flex-wrap:wrap) — as a wrapping
   flex column it was inflating each group's height, leaving a ~17px empty band
   under every open group. It's just a vertical list, so make it plain block flow. */
.sidebar-nav-root { display: block; }
.sidebar-group { margin-top: 0.15rem; }
.sidebar-group-items { padding-bottom: 0 !important; }
.sidebar-group-items > .sidebar-item:last-child { margin-bottom: 0; }
.sidebar-group-toggle {
  width: calc(100% - 0.9rem);
  margin: 1px 0.45rem !important;
  padding: 0.45rem 0.65rem !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55) !important;
  background: transparent !important;
  border-radius: 8px;
  display: flex; align-items: center; gap: 0.55rem;
}
.sidebar-group-toggle:hover { color: #fff !important; background: rgba(255,255,255,0.06) !important; }
.sidebar-group.is-active .sidebar-group-toggle { color: rgba(255,255,255,0.92) !important; background: transparent !important; }
.sidebar-group-icon {
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 1.2rem; flex: none;
  font-size: 1rem; opacity: 1 !important;
  color: #6f8fc7 !important;
}
.sidebar-group.is-active .sidebar-group-icon,
.sidebar-group-toggle:hover .sidebar-group-icon { color: #9dc0ff !important; }
.sidebar-group-chevron { font-size: 0.6rem !important; opacity: 0.45; margin-left: auto; }

/* Item icons: brighter + aligned so destinations are easy to spot */
.sidebar .nav-link { gap: 0.6rem; }
.sidebar .nav-link i { font-size: 1rem; opacity: 0.82; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover i { opacity: 1; color: #cddcff; }
.sidebar .nav-link.active {
  background: rgba(45,91,215,0.24);
  box-shadow: inset 3px 0 0 #6ea0ff;
}
.sidebar .nav-link.active i { color: #bcd4ff; opacity: 1; }

/* Footer collapse toggle */
.sidebar-foot { padding: 0.4rem 0.45rem calc(0.5rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.7rem; border: 0; border-radius: 8px;
  background: transparent; color: rgba(255,255,255,0.55);
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-collapse-btn i { font-size: 0.9rem; width: 1.2rem; text-align: center; flex: none; }
.sc-when-collapsed { display: none; }

/* Standalone foot link (Point of Sale).

   Matches a top-level group header exactly rather than a child nav-link: it IS a
   top-level destination, it just has nothing to expand. Metrics are copied from
   .sidebar-group-toggle, with the foot's own 0.45rem padding standing in for the
   toggle's horizontal margin so the icons line up down the whole sidebar. */
.sidebar-standalone-link {
  width: 100%;
  margin: 1px 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.sidebar-standalone-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-standalone-link.active { color: rgba(255,255,255,0.92); background: transparent; }
.sidebar-standalone-link i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.2rem; flex: none;
  font-size: 1rem; opacity: 1;
  color: #6f8fc7;
}
.sidebar-standalone-link:hover i,
.sidebar-standalone-link.active i { color: #9dc0ff; }
.sidebar-standalone-link + .sidebar-collapse-btn { margin-top: 0.25rem; }
html.sidebar-collapsed .sidebar-standalone-link { justify-content: center; padding-left: 0; padding-right: 0; }

/* Smooth reflow when toggling the rail */
.sidebar { transition: width .18s ease; }
.main { transition: margin-left .18s ease; }
.superbar { transition: left .18s ease; }

/* ---- Collapsed icon rail ---- */
html.sidebar-collapsed { --g-sidebar-width: 68px; }
html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .sidebar-group-label,
html.sidebar-collapsed .sidebar-group-chevron,
html.sidebar-collapsed .sidebar-pinned-label,
html.sidebar-collapsed .sidebar-link-label,
html.sidebar-collapsed .sidebar-collapse-label,
html.sidebar-collapsed .sidebar-pin-btn,
html.sidebar-collapsed .sc-when-expanded { display: none !important; }
html.sidebar-collapsed .sc-when-collapsed { display: inline-flex; }

html.sidebar-collapsed .sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
html.sidebar-collapsed .sidebar .nav-link,
html.sidebar-collapsed .sidebar-collapse-btn { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
html.sidebar-collapsed .sidebar-link-row .nav-link { padding-right: 0; }
html.sidebar-collapsed .sidebar .nav-link i,
html.sidebar-collapsed .sidebar-collapse-btn i,
html.sidebar-collapsed .sidebar-group-icon { width: auto; }

/* Rail = one icon per section; the section's items appear in a hover flyout (JS).
   Keeps the rail short instead of dumping every item into a long column. */
html.sidebar-collapsed .sidebar-group-items { display: none !important; }
html.sidebar-collapsed .sidebar-group-toggle {
  justify-content: center;
  padding: 0.5rem 0 !important; margin: 2px 0.5rem !important;
  border-radius: 9px;
}
html.sidebar-collapsed .sidebar-group.is-active .sidebar-group-toggle,
html.sidebar-collapsed .sidebar-group.is-flyout .sidebar-group-toggle,
html.sidebar-collapsed .sidebar-group-toggle:hover {
  background: rgba(255,255,255,0.09) !important;
}
html.sidebar-collapsed .sidebar-group.is-active .sidebar-group-icon { color: #9dc0ff !important; }
html.sidebar-collapsed .sidebar-foot { padding-left: 0; padding-right: 0; }

/* Flyout submenu shown when hovering a section icon in the collapsed rail */
.sidebar-flyout {
  position: fixed; left: 66px; z-index: 200;
  min-width: 190px; max-width: 250px;
  background: #12314f;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 11px; padding: 6px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.42);
  opacity: 0; visibility: hidden; transform: translateX(-6px);
  transition: opacity .12s ease, transform .12s ease;
}
.sidebar-flyout.show { opacity: 1; visibility: visible; transform: none; }
.sidebar-flyout-title {
  color: rgba(255,255,255,0.5); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; padding: 5px 9px 7px;
}
.sidebar-flyout-list { list-style: none; margin: 0; padding: 0; }
.sidebar-flyout-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.42rem 0.6rem; border-radius: 8px;
  color: rgba(255,255,255,0.82); font-size: 0.8125rem; text-decoration: none;
}
.sidebar-flyout-link i { font-size: 1rem; opacity: 0.85; width: 1.2rem; text-align: center; flex: none; }
.sidebar-flyout-link:hover { background: rgba(255,255,255,0.09); color: #fff; }
.sidebar-flyout-link.active { background: rgba(45,91,215,0.28); color: #fff; }

/* ------------------------------------------------------------
   MRP time-phased grid
   ------------------------------------------------------------ */
/* The item name has to stay readable while the period columns scroll sideways —
   there can be 20+ of them (14 daily + 8 weekly). */
.mrp-grid .mrp-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 210px;
  box-shadow: 1px 0 0 var(--g-topbar-border);
}
.mrp-grid thead .mrp-sticky { z-index: 3; }
.mrp-grid tbody tr:hover .mrp-sticky { background: #f8fafc; }

/* Weekly columns are a coarser bucket than the daily ones; tint them so the
   change in granularity is visible rather than something you have to read. */
.mrp-grid .mrp-week { background: rgba(148, 163, 184, 0.07); }

.mrp-grid td, .mrp-grid th { white-space: nowrap; }
.mrp-detail td { border-top: 0; }
