/* ============================================================
   NEXUS ADMIN — Design System
   style.css
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* COLORS */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-secondary: #e4e8ef;
  --color-success: #3b82f6;
  --color-warning: #b45309;
  --color-danger: #ef4444;
  --color-info: #1d4ed8;

  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-border: #e4e8ef;
  --color-text: #111827;
  --color-text-muted: #6b7a99;

  /* Legacy aliases (to non break UI immediately) */
  --brand-500: var(--color-primary);
  --brand-600: var(--color-primary-hover);
  --brand-50: #e6efeb;
  --gray-50: #f8f9fb;
  --gray-100: #f1f3f7;
  --gray-200: #e4e8ef;
  --gray-300: #d0d6e2;
  --gray-400: #9aa5bc;
  --gray-500: var(--color-text-muted);
  --gray-600: #4a546e;
  --gray-700: #323c52;
  --gray-800: #1e2535;
  --gray-900: var(--color-text);

  --success-bg: #ecfdf3;
  --success-text: var(--color-success);
  --success-border: #bbf7d0;
  --warning-bg: #fffbeb;
  --warning-text: var(--color-warning);
  --warning-border: #fde68a;
  --danger-bg: #fef2f2;
  --danger-text: var(--color-danger);
  --danger-border: #fecaca;
  --info-bg: #eff6ff;
  --info-text: var(--color-info);
  --info-border: #bfdbfe;

  --surface: var(--color-surface);
  --border: var(--color-border);

  /* SPACING */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* RADIUS */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 12px;

  /* SHADOWS */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .10);

  /* TYPOGRAPHY */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 68px;
  --header-h: 60px;

  /* Transition */
  --trans: 200ms cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-y: scroll;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: radial-gradient(circle at top left, #eef2f6 0%, #f8f9fb 40%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-500);
  text-decoration: none;
}

a:hover {
  color: var(--brand-600);
}

button {
  cursor: pointer;
  font-family: inherit;
}

img,
svg {
  display: block;
}

/* ---------- Shell Layout ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--trans);
}

.shell.collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) 1fr;
}

/* ---------- Sidebar (Mac vibrancy preview) ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #cfdbed 0%, #b8c8e0 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 100;
  transition: width var(--trans);
  width: var(--sidebar-w);
}

.shell.collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--header-h);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-500);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(10, 92, 54, 0.3);
}

.sidebar-brand .brand-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.sidebar-brand .brand-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(60, 60, 67, 0.5);
  padding: 10px 12px 3px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--trans);
}

.shell.collapsed .nav-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(60, 60, 67, 0.85);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--trans), color var(--trans);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #1d1d1f;
}

.nav-item.active {
  background: rgba(0, 113, 227, 0.10);
  color: #0071e3;
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.5; /* SF Symbols-like thin stroke */
  color: #ffffff;
}
.nav-item:hover svg, .nav-item.active svg {
  color: #ffffff;
}

.nav-label {
  transition: opacity var(--trans);
}

.shell.collapsed .nav-label {
  opacity: 0;
  pointer-events: none;
}

.nav-badge {
  /* Position absolute → il badge fluttua sopra la voce senza occupare spazio
     nel flow. Quando alerts.js lo inietta dopo il fetch /summary, niente
     reflow della sidebar (le sezioni sotto NON si spostano più). */
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: var(--brand-500);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  pointer-events: none;
  transition: opacity var(--trans);
}

.nav-badge:empty {
  display: none;
}

.shell.collapsed .nav-badge {
  opacity: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* ---------- Header ---------- */
.header {
  grid-area: header;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  margin-top: 8px;
}

.header-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans), color var(--trans);
}

.header-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Company Selector */
.company-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
}

.company-selector:hover {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.company-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-500);
  flex-shrink: 0;
}

.company-chevron {
  width: 14px;
  height: 14px;
  color: var(--gray-400);
}

/* Search */
.header-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 16px;
  transition: border-color var(--trans), box-shadow var(--trans);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.header-search:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px var(--brand-50);
}

.header-search svg {
  width: 16px;
  height: 16px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.header-search input {
  border: none;
  background: none;
  outline: none;
  font-size: var(--text-sm);
  color: var(--gray-800);
  width: 100%;
  font-family: inherit;
}

.header-search input::placeholder {
  color: var(--gray-400);
}

/* Pages with a local search filter hide the non-functional global header search
   to prevent confusing dual-search UX. Applied via body.has-local-search. */
body.has-local-search .header-search {
  display: none;
}


.search-shortcut {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--gray-500);
  transition: background var(--trans), color var(--trans);
}

.icon-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.divider-v {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}

/* Profile */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--trans);
}

.profile-btn:hover {
  background: var(--gray-100);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-info {
  text-align: left;
}

.profile-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.2;
}

.profile-role {
  font-size: 11px;
  color: var(--gray-500);
}

/* ---------- Main Content ---------- */
.main {
  grid-area: main;
  padding: 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-left: 16px;
  padding-right: 16px;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin: 0 !important;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: 2px;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--trans);
  line-height: 1;
  white-space: nowrap;
  outline: none;
  cursor: pointer;
  background: transparent;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--trans);
}









.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--color-text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  transform: scale(1.02);
}

.btn-success {
  background: #059669;
  color: #fff;
  border-color: transparent;
}

.btn-success:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, .25);
}

/* Varianti bottoni colorati — onboarding detail footer */
.btn-indigo {
  background: #4f46e5;
  color: #fff;
  border-color: transparent;
}

.btn-indigo:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .25);
}

.btn-teal {
  background: #0d9488;
  color: #fff;
  border-color: transparent;
}

.btn-teal:hover {
  background: #0f766e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, .25);
}

.btn-amber {
  background: #d97706;
  color: #fff;
  border-color: transparent;
}

.btn-amber:hover {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, .25);
}

/* Danger zone nel footer — box rosso compatto, allineato a destra */
.detail-danger-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-left: auto;
  width: fit-content;
  padding: 7px 12px;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md, 10px);
}

.detail-danger-zone .danger-zone-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #b91c1c;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 12px;
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-5);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 0;
  width: 38px;
  justify-content: center;
}

.btn-sm.btn-icon {
  width: 32px;
}

/* Icon buttons like bell, mail */
.icon-btn-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  position: relative;
}

.icon-btn-header:hover {
  background: var(--gray-100);
  transform: scale(1.10);
  color: var(--gray-800);
}

.icon-btn-header svg {
  width: 16px;
  height: 16px;
}


/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 1px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.tab-btn {
  padding: 5px 12px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: none;
  transition: background var(--trans), color var(--trans);
}

.tab-btn.active,
.tab-btn:hover {
  background: var(--surface);
  color: var(--gray-800);
}

.tab-btn.active {
  box-shadow: var(--shadow-sm);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead {
  background: var(--gray-50);
}

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--gray-700);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--trans);
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody tr:last-child td {
  border-bottom: none;
}

.td-main {
  font-weight: 500;
  color: var(--gray-800);
}

.td-sub {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

.td-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.avatar-colors {
  --c0: #4f6ef7;
  --c1: #0ea5e9;
  --c2: #8b5cf6;
  --c3: #10b981;
  --c4: #f59e0b;
  --c5: #ef4444;
}

.c0 {
  background: var(--c0);
}

.c1 {
  background: var(--c1);
}

.c2 {
  background: var(--c2);
}

.c3 {
  background: var(--c3);
}

.c4 {
  background: var(--c4);
}

.c5 {
  background: var(--c5);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.badge-active::before {
  background: var(--success-text);
}

.badge-signed {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

.badge-signed::before {
  background: var(--info-text);
}

.badge-unpaid {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.badge-unpaid::before {
  background: var(--warning-text);
}

.badge-overdue {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.badge-overdue::before {
  background: var(--danger-text);
}

.badge-pending {
  background: var(--gray-100);
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.badge-pending::before {
  background: var(--gray-400);
}

.badge-draft {
  background: #f3f0ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.badge-draft::before {
  background: #7c3aed;
}

/* ---------- Filter Bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: border-color var(--trans);
}

.filter-search:focus-within {
  border-color: var(--brand-500);
}

.filter-search svg {
  width: 14px;
  height: 14px;
  color: var(--gray-400);
}

.filter-search input {
  border: none;
  background: none;
  outline: none;
  font-size: var(--text-sm);
  font-family: inherit;
  width: 160px;
  color: var(--gray-800);
}

.filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  font-size: var(--text-sm);
  color: var(--gray-700);
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans);
}

.filter-select:focus {
  border-color: var(--brand-500);
}

.filter-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ---------- Progress Bar ---------- */
.progress-wrap {
  width: 80px;
}

.progress-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand-500);
}

.progress-fill.green {
  background: var(--success-text);
}

.progress-fill.amber {
  background: #f59e0b;
}

.progress-fill.red {
  background: #ef4444;
}

.progress-label {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 3px;
}

/* ---------- Stats Row ---------- */
.stats-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-600);
}

.stat-pill strong {
  color: var(--gray-800);
  font-weight: 600;
}

/* ---------- Charts Placeholder ---------- */
.chart-placeholder {
  height: 180px;
  background: repeating-linear-gradient(90deg,
      var(--gray-50) 0px, var(--gray-50) 1px,
      transparent 1px, transparent 48px);
  display: flex;
  align-items: flex-end;
  padding: 0 20px 16px;
  gap: 10px;
}

.chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
}

.chart-bar {
  flex: 1;
  border-radius: var(--radius-md);
  transition: filter var(--trans);
  cursor: pointer;
}

.chart-bar.primary {
  background: #20b2aa;
}

.chart-bar.muted {
  background: var(--gray-200);
}

.chart-bar:hover {
  filter: brightness(1.1);
}

.chart-x-labels {
  display: flex;
  padding: 4px 20px 0;
  gap: 10px;
}

.chart-x-label {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--gray-400);
}

/* ---------- Activity Feed ---------- */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: var(--gray-50);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.blue {
  background: var(--brand-500);
}

.activity-dot.green {
  background: var(--success-text);
}

.activity-dot.amber {
  background: #f59e0b;
}

.activity-dot.red {
  background: #ef4444;
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: var(--text-sm);
  color: var(--gray-700);
}

.activity-text strong {
  color: var(--gray-900);
}

.activity-time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ---------- Dropdown ---------- */
.dropdown-wrap {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--trans), transform var(--trans), visibility var(--trans);
}

.dropdown-wrap.open .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--gray-700);
  cursor: pointer;
  transition: background var(--trans);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--gray-100);
}

.dropdown-item svg {
  width: 15px;
  height: 15px;
  color: var(--gray-400);
}

.dropdown-item.danger {
  color: var(--danger-text);
}

.dropdown-item.danger svg {
  color: var(--danger-text);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--trans), visibility var(--trans);
}

.modal-overlay.open {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.97) translateY(8px);
  transition: transform var(--trans);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-900);
}

/* .modal-close inherits styles from .icon-btn */

.modal-body {
  padding: 16px 24px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 24px 20px;
}

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid.full {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}

.field input,
.field select,
.field textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--gray-800);
  background: var(--surface);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-50);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.breadcrumb a {
  color: var(--gray-500);
}

.breadcrumb a:hover {
  color: var(--brand-500);
}

.breadcrumb-sep {
  color: var(--gray-300);
}

.breadcrumb-current {
  color: var(--gray-800);
  font-weight: 500;
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: var(--space-3);
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-xl);
  margin: var(--space-4) 0;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--gray-50);
  border-radius: 50%;
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
}

.empty-state-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 320px;
  line-height: 1.5;
}

.empty-state-actions {
  margin-top: var(--space-2);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Table Pagination ---------- */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--gray-500);
  flex-wrap: wrap;
  gap: 8px;
}

.pagination {
  display: flex;
  gap: 4px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
}

.page-btn:hover {
  background: var(--gray-100);
}

.page-btn.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---------- Notification Dropdown ---------- */
.notif-panel {
  min-width: 320px;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.notif-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-800);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--trans);
}

.notif-item:hover {
  background: var(--gray-50);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item.unread {
  background: var(--brand-50);
}

.notif-ico {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-ico svg {
  width: 15px;
  height: 15px;
}

.notif-ico.blue {
  background: var(--info-bg);
  color: var(--info-text);
}

.notif-ico.amber {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.notif-ico.red {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notif-text {
  font-size: var(--text-sm);
  color: var(--gray-700);
  line-height: 1.4;
}

.notif-when {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ---------- Utility & Layout Helpers ---------- */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-5 {
  gap: var(--space-5);
}

.gap-6 {
  gap: var(--space-6);
}

.stack-xs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.ml-auto {
  margin-left: auto;
}

.w-full {
  width: 100%;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Global overrides for macOS column headers per user request --- */
.mac-header-row,
.mac-header-row * {
  text-transform: none !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  color: var(--gray-600) !important;
  letter-spacing: normal !important;
}

/* Remove default select styles so they match text perfectly */
.mac-header-row select {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  cursor: pointer !important;
  padding: 0 !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Subtle enhancement: darken color on hover for interactive headers */
.mac-header-row .inv-col-hdr:hover,
.mac-header-row .inv-col-hdr:hover *,
.mac-header-row select:hover,
.mac-header-row > div[style*="cursor"]:hover {
  color: var(--gray-900) !important;
  transition: color 0.15s ease;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-800);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease forwards;
  min-width: 260px;
}

.toast.success {
  border-left: 3px solid var(--success-text);
}

.toast.error {
  border-left: 3px solid #ef4444;
}

.toast.info {
  border-left: 3px solid var(--brand-500);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@keyframes slideUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 0 1fr;
  }

  .shell.mobile-open {
    grid-template-columns: var(--sidebar-w) 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--trans);
  }

  .shell.mobile-open .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }

  .profile-info {
    display: none;
  }
}

/* -- Lang Switcher (Globe + code, premium dropdown) --------- */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--trans), border-color var(--trans), color var(--trans);
  line-height: 1;
}

.lang-trigger:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.lang-trigger:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.lang-globe {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.lang-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.lang-chevron {
  opacity: .5;
  transition: transform .18s ease, opacity .18s;
  flex-shrink: 0;
}

.lang-dropdown.open~* .lang-chevron,
.lang-trigger[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
  opacity: .8;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .10), 0 2px 6px rgba(0, 0, 0, .06);
  overflow: hidden;
  z-index: 200;
}

.lang-dropdown.open {
  display: block;
  animation: dropdown-in .15s ease;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--gray-700);
  text-align: left;
  transition: background var(--trans);
}

.lang-option:hover {
  background: var(--gray-100);
}

.lang-option.active {
  background: var(--brand-50);
  color: var(--brand-500);
  font-weight: 600;
}

.lang-opt-code {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  width: 20px;
  flex-shrink: 0;
}

.lang-opt-name {
  color: var(--gray-500);
  font-size: 12px;
}

.lang-option.active .lang-opt-name {
  color: var(--brand-500);
}

/* -- Client Portal extras (from client_dash.html) ----------- */
.doc-list {
  display: flex;
  flex-direction: column;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}

.doc-item:last-child {
  border-bottom: none;
}

.doc-item:hover {
  background: var(--gray-50);
}

.doc-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-icon svg {
  width: 18px;
  height: 18px;
}

.doc-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-800);
}

.doc-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

.doc-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* -- Welcome banner (client portal) ------------------------- */
.welcome-banner {
  background: var(--brand-500);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  box-shadow: 0 8px 30px rgba(10, 92, 54, .2);
}

.welcome-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.welcome-sub {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, .8);
}

.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* -- fw-600 utility ----------------------------------------- */
.fw-600 {
  font-weight: 600;
}

/* -- Stat chip value color modifiers ------------------------- */
.stat-chip-val--success {
  color: var(--success-text);
}

.stat-chip-val--warning {
  color: var(--warning-text);
}

.stat-chip-val--danger {
  color: var(--danger-text);
}

.stat-chip-val--muted {
  color: var(--gray-400);
}

/* -- Utility link and no-wrap -------------------------------- */
.link-brand {
  color: var(--brand-500);
  text-decoration: none;
}

.link-brand:hover {
  text-decoration: underline;
}

.no-wrap {
  white-space: nowrap;
}

.td-id {
  font-size: 11px;
  color: var(--gray-400);
}


/* ================================================================
   UNIFIED STAT/KPI CARD SYSTEM
================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-grid--sm {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background var(--trans);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--gray-300);
}

.stat-card.active {
  border-color: var(--brand-500);
  box-shadow: 0 4px 16px rgba(5, 150, 105, .12);
  background: var(--brand-50);
}

.stat-card.active::before {
  background: var(--brand-500);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
}

.stat-card-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-500);
}

.stat-card-icon svg {
  width: 20px;
  height: 20px;
}

/* stat-card--lg: mantiene padding aumentato ma allinea font al sistema standard */
.stat-card--lg {
  padding: 20px 22px;
  border-radius: var(--radius-xl);
}

.stat-card--lg .stat-card-val {
  font-size: 28px;
}

/* stesso delle pagine interne */
.stat-card--brand:hover::before {
  background: var(--brand-500);
}

.stat-card--brand .stat-card-icon {
  background: #e6f4ec;
  color: #10b981;
}

.stat-card--success:hover::before {
  background: #10b981;
}

.stat-card--success .stat-card-icon {
  background: #dcfce7;
  color: #15803d;
}

.stat-card--success .stat-card-val {
  color: #15803d;
}

.stat-card--info:hover::before {
  background: #3b82f6;
}

.stat-card--info .stat-card-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

.stat-card--purple:hover::before {
  background: #8b5cf6;
}

.stat-card--purple .stat-card-icon {
  background: #f3f0ff;
  color: #7c3aed;
}

.stat-card--amber:hover::before {
  background: #f59e0b;
}

.stat-card--amber .stat-card-icon {
  background: #fef3c7;
  color: #d97706;
}

.stat-card--amber .stat-card-val {
  color: #b45309;
}

.stat-card--danger:hover::before {
  background: #ef4444;
}

.stat-card--danger .stat-card-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.stat-card--danger .stat-card-val {
  color: #b91c1c;
}

.stat-card--highlight {
  background: var(--brand-500);
  color: #fff;
  border: none;
}

.stat-card--highlight:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.25);
}

.stat-card--highlight::before {
  display: none;
}

.stat-card--highlight .stat-card-label,
.stat-card--highlight .stat-card-meta {
  color: rgba(255, 255, 255, 0.8);
}

.stat-card--highlight .stat-card-val {
  color: #fff;
}

.stat-card--highlight .stat-card-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.stat-card--warning:hover::before {
  background: #f59e0b;
}

.stat-card--warning .stat-card-icon {
  background: #fef3c7;
  color: #d97706;
}

.stat-card--warning .stat-card-val {
  color: #b45309;
}



/* ================================================================
   FILTER TABS — Sistema tab filtro unificato tra tutte le pagine
================================================================ */
/* ----------------------------------------------------------------
   FORM-INPUT / FILTER SELECT — unified design-system selects
   ---------------------------------------------------------------- */
.form-input {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--trans), box-shadow var(--trans);
  white-space: nowrap;
  line-height: 34px;
  width: 100%;
  box-sizing: border-box;
}

select.form-input {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

input[type=date].form-input {
  background-image: none;
  padding-right: 10px;
}

textarea.form-input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  background-image: none;
  line-height: 1.5;
}

.form-input:hover {
  border-color: var(--brand-400);
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}

.form-input::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

/* Filter search — consistent height with selects */
.filter-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 34px;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.filter-search:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}

.filter-search svg {
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.filter-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-sm);
  color: var(--gray-700);
  min-width: 160px;
  font-family: inherit;
  padding: 0;
  line-height: 34px;
}

.filter-search input::placeholder {
  color: var(--gray-400);
}

/* Form group / label */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
}

.form-required {
  color: var(--color-danger, #dc2626);
  margin-left: 2px;
}

.form-hint {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 3px;
}

/* Form section title — colored bar + uppercase label (used in all modals) */
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-section-title span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.form-section-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
  background: #fff;
  border: 1.5px solid var(--border-light, #e5e7eb);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1;
}

.filter-tab:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

.filter-tab.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 1px 6px rgba(5, 150, 105, 0.25);
}

.filter-tab.active:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
}


/* .tag-pill — small outlined tag chips (like 'Design','UI/UX' in cards) */
.tag-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  background: transparent;
  border: 1.5px solid var(--border-light, #e5e7eb);
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1;
}

/* Legacy .pill classes used by UI.pill() global helper */
.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.pill-primary {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}

.pill-new {
  background: #e0f2fe;
  color: #0284c7;
}

/* Sky Blue specifically for 'New' states */
.pill-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success, #10b981);
}

.pill-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning, #f59e0b);
}

.pill-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger, #ef4444);
}

.pill-gray {
  background: var(--bg-card);
  color: var(--gray-500);
  border: 1px solid var(--border);
}

.pill-active {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.pill-inactive {
  background: var(--bg-hover);
  color: var(--gray-500);
}

.pill-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* Priority badge variants — used in list cards */
.priority-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1;
}

.priority-badge--high {
  background: #e11d48;
  color: #ffffff;
}

.priority-badge--medium {
  background: #16a34a;
  color: #ffffff;
}

.priority-badge--low {
  background: #f3f4f6;
  color: #374151;
}

/* ================================================================
   ACTIVITY TIMELINE  (client_dash)
================================================================ */
.timeline {
  padding: 0 20px 20px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 20px 36px 1fr;
  gap: 0 12px;
  position: relative;
  padding-bottom: 24px;
}

.timeline-item--last {
  padding-bottom: 4px;
}

.timeline-line {
  grid-row: 1 / 3;
  grid-column: 1 / 2;
  width: 2px;
  background: var(--gray-200);
  margin: 0 auto;
  margin-top: 18px;
}

.timeline-item--last .timeline-line {
  background: transparent;
}

.timeline-dot {
  grid-row: 1 / 2;
  grid-column: 2 / 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-dot svg {
  width: 16px;
  height: 16px;
}

.timeline-dot--brand {
  background: var(--brand-50, #e6f4ec);
  color: var(--brand-600, #1a7a3c);
}

.timeline-dot--success {
  background: var(--success-bg, #dcfce7);
  color: var(--success-text, #15803d);
}

.timeline-dot--info {
  background: var(--info-bg, #dbeafe);
  color: var(--info-text, #1d4ed8);
}

.timeline-dot--warning {
  background: var(--warning-bg, #fef9c3);
  color: var(--warning-text, #b45309);
}

.timeline-dot--danger {
  background: var(--danger-bg, #fee2e2);
  color: var(--danger-text, #b91c1c);
}

.timeline-content {
  grid-column: 3 / 4;
  padding-left: 12px;
}

/* ---------- Common Utilities ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--gray-500);
  gap: 12px;
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--gray-400);
}

.timeline-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.4;
}

.timeline-desc {
  font-size: var(--text-xs, 0.75rem);
  color: var(--gray-500);
  margin-top: 2px;
  line-height: 1.4;
}

.timeline-date {
  font-size: var(--text-xs, 0.75rem);
  color: var(--gray-400);
  margin-top: 4px;
}

/* -- List Cards (Table Replacement) ------------------------- */
.card-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-card {
  background: var(--surface);
  color: var(--gray-800);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  transition: all 300ms ease;
  cursor: pointer;
}

.list-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.list-card-title {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--gray-900);
}

.list-card-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.list-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-card-meta svg {
  width: 16px;
  height: 16px;
  color: var(--gray-400);
}


/* ================================================================
   ALERT CARD  (action required banners)
================================================================ */
.alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
  font-size: var(--text-sm);
  font-weight: 500;
}

.alert-card svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-card>div {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.alert-card--warning {
  background: #fef9c3;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-card--warning svg {
  color: #b45309;
}

.alert-card--danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-card--info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ================================================================
   FILTER BAR  — new unified design (search + Filter/Date + tabs)
================================================================ */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

/* Top row: search + action buttons */
.filter-bar-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-bar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-50, #f9fafb);
  border: 1.5px solid var(--border-light, #e5e7eb);
  border-radius: var(--radius-lg, 10px);
  padding: 0 12px;
  height: 38px;
  transition: border-color .15s, box-shadow .15s;
}

.filter-bar-search:focus-within {
  border-color: var(--brand-400, #4ade80);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .08);
  background: #fff;
}

.filter-bar-search svg {
  width: 16px;
  height: 16px;
  color: var(--gray-400, #9ca3af);
  flex-shrink: 0;
}

.filter-bar-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-sm, 0.875rem);
  color: var(--gray-900, #111827);
  line-height: 1;
}

.filter-bar-search input::placeholder {
  color: var(--gray-400, #9ca3af);
}

.filter-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-lg, 10px);
  border: 1.5px solid var(--border-light, #e5e7eb);
  background: #fff;
  color: var(--gray-700, #374151);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.filter-bar-btn:hover {
  background: var(--gray-50, #f9fafb);
  border-color: var(--gray-300, #d1d5db);
}

.filter-bar-btn svg {
  width: 15px;
  height: 15px;
  color: var(--gray-500);
}

/* Bottom row: quick-filter pills */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-light, #e5e7eb);
  background: #fff;
  color: var(--gray-600, #4b5563);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.filter-tab:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.filter-tab.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

/* --- Dashboard 2-column grid (chart + activity panel) --- */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.activity-dot.brand {
  background: var(--brand-500);
}

@media (max-width: 900px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* -- Sidebar footer user block ------------------------------ */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: var(--gray-500);
  font-size: 11px;
}

/* -- Dropdown label (company switcher header) --------------- */
.dropdown-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
}

/* ---------- Animations & Transitions ---------- */
.fade-in {
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Skeleton Loaders ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 50%;
}

.skeleton-title {
  height: 28px;
  width: 40%;
  margin-bottom: 12px;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-badge {
  width: 60px;
  height: 24px;
  border-radius: 999px;
}

.skeleton-kpi-value {
  height: 36px;
  width: 80px;
  margin-bottom: 8px;
}

/* Skeleton layouts */
.skeleton-list-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
}

.skeleton-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.skeleton-list-body {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* -- Coming soon state -------------------------------------- */
.coming-soon-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--gray-400);
}

.coming-soon-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  opacity: .35;
}

.coming-soon-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.coming-soon-sub {
  font-size: .875rem;
  max-width: 400px;
  line-height: 1.6;
}

/* -- Reminder policy rule cards ---------------------------- */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 16px 20px;
}

.policy-card {
  background: var(--gray-50);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.policy-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 6px;
}

.policy-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.policy-card-detail {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ---------- Quick Actions Bar -------------------------------- */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .quick-actions-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .quick-actions-bar {
    grid-template-columns: 1fr 1fr;
  }
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans), background var(--trans);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.quick-action-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.qa-icon--brand {
  background: var(--brand-500);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.qa-icon--amber {
  background: #f59e0b;
  box-shadow: 0 44px 10px rgba(245, 158, 11, 0.25);
}

.qa-icon--info {
  background: var(--color-info);
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.2);
}

.qa-icon--purple {
  background: #8b5cf6;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.25);
}

.qa-icon--success {
  background: #059669;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

/* ================================================================
   PREMIUM POLISH — filter + list area refinements
   Applies globally to all admin list pages (onboarding, clients,
   invoices, contracts, documents, renewals)
   ================================================================ */

/* Filter bar: column-direction variant applied via inline override.
   Ensure the inner select row gets proper alignment. */
.filter-bar>div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filter-tabs top padding reset when inside column filter-bar */
.filter-bar>.filter-tabs {
  padding-top: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Page header refinements ---------- */
.page-header {
  padding: 22px 28px 18px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 3px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ---------- List card premium feel ---------- */
.list-card {
  transition: box-shadow 150ms ease, border-color 150ms ease;
}

.list-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border-color: var(--gray-300);
}

/* Blocked row subtle left accent */
.list-card[style*="border-left"] {
  padding-left: 17px;
  /* compensate for the border */
}

/* ---------- Row actions alignment ---------- */
.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---------- Stat card subtitle / accent ---------- */
.stat-card-label {
  font-size: 12px;
  letter-spacing: 0.01em;
}

.stat-card-val {
  font-variant-numeric: tabular-nums;
}

.stat-card-meta {
  font-size: 11px;
  min-height: 16px;
}

/* ---------- Stat card info (blue) accent ---------- */
.stat-card--info:hover::before {
  background: #3b82f6;
}

.stat-card--info .stat-card-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

/* no val color change for info — keeps neutral */

/* ---------- Finance / amount emphasis ---------- */
.amount-primary {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}

.amount-secondary {
  font-size: 12px;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

/* ---------- Overdue row accent ---------- */
.list-card--overdue {
  border-left: 3px solid var(--color-danger, #ef4444);
}

.list-card--urgent {
  border-left: 3px solid #f59e0b;
}

/* ---------- Empty state premium ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--gray-400);
  max-width: 320px;
  line-height: 1.5;
}

/* ---------- Progress bar premium feel ---------- */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.progress-bar-track {
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-bar-label {
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   PREMIUM VISUAL POLISH — B2B SaaS quality refinements
   Stripe / Linear / Notion admin quality target.
   ================================================================ */

/* ── Stat-card: always-on top accent bar ───────────────────────── */
/* Top colored bar now visible at rest (not just hover).
   Creates immediate visual identity for each KPI type. */
.stat-card--brand::before {
  background: var(--brand-500);
  opacity: 1;
}

.stat-card--info::before {
  background: #3b82f6;
  opacity: 1;
}

.stat-card--success::before {
  background: #10b981;
  opacity: 1;
}

.stat-card--amber::before {
  background: #f59e0b;
  opacity: 1;
}

.stat-card--warning::before {
  background: #f59e0b;
  opacity: 1;
}

.stat-card--danger::before {
  background: #ef4444;
  opacity: 1;
}

.stat-card--purple::before {
  background: #8b5cf6;
  opacity: 1;
}

/* Hover: slightly deeper shadow + stronger border (no scale) */
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--gray-300);
}

/* Brand card hover glow */
.stat-card--brand:hover {
  border-color: var(--brand-400);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.14);
}

.stat-card--info:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

.stat-card--danger:hover {
  border-color: #fca5a5;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12);
}

.stat-card--amber:hover {
  border-color: #fcd34d;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
}

.stat-card--purple:hover {
  border-color: #c4b5fd;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12);
}

/* Stronger base shadow at rest */
.stat-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Tighten label, strengthen value hierarchy */
.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
}

.stat-card-val {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: 2px;
}

.stat-card-meta {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 400;
}

/* Icon: slightly larger, more presence */
.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 18px;
  height: 18px;
}

/* ── Filter bar: control bar feel ──────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px 12px;
}

/* Search field: slightly more prominent */
.filter-search {
  background: #ffffff;
  border-color: var(--gray-300);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.filter-search svg {
  color: var(--gray-400);
}

.filter-search:focus-within {
  background: #ffffff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.10);
}

/* Secondary selects: quieter than search */
.filter-bar select.form-input {
  background-color: var(--gray-50);
  font-size: 12px;
  color: var(--gray-600);
  height: 34px;
}

/* ── Filter tabs: pill style (canonical) ───────────────────── */
.filter-tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  border-radius: 999px;
  border: 1.5px solid var(--border-light, #e5e7eb);
  background: #fff;
  color: var(--gray-600);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  line-height: 1;
  -webkit-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}

.filter-tab:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

.filter-tab.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(5, 150, 105, 0.25);
}

/* ── List cards: workflow row feel ──────────────────────────────── */
.list-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0;
  background: #ffffff;
  transition: box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
}

.list-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  border-color: var(--gray-300);
  background: #fafbfc;
}

.list-card+.list-card {
  border-top: none;
  border-radius: 0;
}

.list-card:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.list-card:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.list-card:only-child {
  border-radius: var(--radius-md);
}

/* List card title: slightly stronger */
.list-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.list-card-meta {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Page header: stronger hierarchy ───────────────────────────── */
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 400;
  margin-top: 2px;
  letter-spacing: 0;
}

/* ── Card wrapper: slightly elevated feel ──────────────────────── */
.card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  border-color: var(--gray-200);
}

/* ── Empty state: intentional not generic ─────────────────────── */
.empty-state-icon {
  color: var(--gray-300);
}

.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: -0.01em;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--gray-400);
  line-height: 1.6;
  max-width: 280px;
}

/* ── Contract Template Variable Chips ───────────────────── */
.ct-var-chip {
  display: block;
  font-family: monospace;
  font-size: 11px;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  padding: 3px 7px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ct-var-chip:hover {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}

/* ---- Nova CRM sidebar logo removed from here to unify at EOF ---- */

/* ============================================================
   ADMIN UI POLISH — Additive layer (no overrides to base rules)
   ============================================================ */

/* ── Activity dot — emoji variant ─────────────────────────── */
.activity-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  background: var(--gray-100);
}

.activity-dot-emoji { display: block; }

.activity-dot.blue   { background: #eff6ff; }
.activity-dot.green  { background: #f0fdf4; }
.activity-dot.brand  { background: var(--brand-50); }
.activity-dot.amber  { background: #fffbeb; }
.activity-dot.red    { background: #fef2f2; }
.activity-dot.gray   { background: var(--gray-100); }
.activity-dot.purple { background: #f5f3ff; }
.activity-dot.teal   { background: #f0fdfa; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--trans);
  border-radius: var(--radius-sm);
  padding-left: 4px;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--gray-50); }

.activity-content { flex: 1; min-width: 0; }

.activity-text {
  font-size: 13px;
  color: var(--gray-800);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ── KPI stat-cards — accent border per color ──────────────── */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stat-card--brand::before  { background: var(--color-primary); }
.stat-card--amber::before  { background: #f59e0b; }
.stat-card--info::before   { background: #3b82f6; }
.stat-card--purple::before { background: #7c3aed; }

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-400);
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card--brand .stat-card-icon { background: var(--brand-50); color: var(--color-primary); }
.stat-card--amber .stat-card-icon { background: #fffbeb; color: #b45309; }
.stat-card--info  .stat-card-icon { background: #eff6ff; color: #1d4ed8; }
.stat-card--purple .stat-card-icon { background: #f5f3ff; color: #7c3aed; }

.stat-card-icon svg { width: 18px; height: 18px; }

.stat-card-val {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--gray-900);
  line-height: 1.1;
  margin: 8px 0 4px;
}

.stat-card--amber .stat-card-val { color: #b45309; }
.stat-card--info  .stat-card-val { color: #1d4ed8; }
.stat-card--purple .stat-card-val { color: #7c3aed; }

.stat-card-meta {
  font-size: 12px;
  color: var(--gray-500);
  min-height: 18px;
}

.stat-grid {
  display: grid;
  gap: 16px;
}

.stat-grid--sm { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) { .stat-grid--sm { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .stat-grid--sm { grid-template-columns: 1fr; } }

/* ── Quick Actions bar ─────────────────────────────────────── */
.quick-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  text-decoration: none;
  color: var(--gray-800);
  font-size: var(--text-sm);
  font-weight: 500;
  flex: 1;
  min-width: 160px;
  transition: all var(--trans);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-icon svg { width: 18px; height: 18px; }

.qa-icon--brand  { background: var(--brand-50);  color: var(--color-primary); }
.qa-icon--success{ background: #f0fdf4; color: #059669; }
.qa-icon--amber  { background: #fffbeb; color: #b45309; }
.qa-icon--info   { background: #eff6ff; color: #1d4ed8; }
.qa-icon--purple { background: #f5f3ff; color: #7c3aed; }

/* ── Dashboard 2-col grid ──────────────────────────────────── */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .dash-grid-2 { grid-template-columns: 1fr; } }

/* ── Storico / Timeline filter pills ──────────────────────── */
.timeline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0 8px;
}

.timeline-filter-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--surface);
  color: var(--gray-500);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.timeline-filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--brand-50);
}

.timeline-filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ── Add-activity form textarea ────────────────────────────── */
.timeline-add-form {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.timeline-add-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--surface);
  transition: border-color var(--trans);
}

.timeline-add-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--brand-50);
}

.timeline-add-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.timeline-add-form-row select {
  flex: 1;
  height: 32px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--surface);
  cursor: pointer;
}

/* ── Timeline entry items ──────────────────────────────────── */
.timeline-entry {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.timeline-entry:last-child { border-bottom: none; }

.timeline-entry-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--gray-100);
}

.timeline-entry-body { flex: 1; min-width: 0; }

.timeline-entry-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.35;
}

.timeline-entry-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-entry-desc {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 6px;
  line-height: 1.5;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  white-space: pre-wrap;
}

/* ── Skeleton helpers ──────────────────────────────────────── */
.skeleton-kpi-value {
  height: 42px;
  width: 64px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   UNIFIED ADMIN UI SYSTEM
   ============================================================ */

/* ── 1. Buttons (Unified outline danger) ── */
.btn-ghost-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--danger-border);
}
.btn-ghost-danger:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.2);
}

/* ── 2. Modal unified header/section styles ── */
.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin: 24px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-section-label svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── 3. Unified Filter Pills ── */
.filter-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-tab:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}
.filter-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}
.filter-tab.active:hover {
  background: var(--color-primary-hover);
}

/* ── 4. Unified Filter Selects ── */
.filter-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.filter-select:hover {
  border-color: var(--gray-400);
}
.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--brand-50);
}

/* ============================================================
   5. ZOHO CRM STYLE DETAIL LAYOUT
   ============================================================ */

.detail-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-top: 0;
}
@media (max-width: 1024px) {
  .detail-layout { flex-direction: column; }
}

/* --- Left Profile Column --- */
.profile-col {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
}
@media (max-width: 1024px) {
  .profile-col { width: 100%; position: static; }
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.profile-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 4px;
}
.profile-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.profile-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 16px;
}

/* Base contact info in profile */
.profile-info-list {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-info-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-400);
  letter-spacing: .05em;
}
.profile-info-val {
  font-size: 13px;
  color: var(--gray-900);
  font-weight: 500;
  word-break: break-word;
}
.profile-info-val a {
  color: var(--brand-600);
  text-decoration: none;
}
.profile-info-val a:hover {
  text-decoration: underline;
}

/* Quick Actions in Left Col */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Right Data Column --- */
.data-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.data-tabs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  overflow: hidden;
}
.data-tabs-header {
  border-bottom: 1px solid var(--border);
  background: #fdfdfd;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.data-tabs-header::-webkit-scrollbar {
  display: none;
}
.data-tabs-header button {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
  white-space: nowrap;
}
.data-tabs-header button:hover {
  color: var(--gray-800);
}
.data-tabs-header button.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
  font-weight: 600;
}
.data-tabs-body {
  padding: 24px;
}

/* --- Modern Activity Timeline --- */
.al-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.al-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  background: #fafafa;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.al-tab-btn {
  padding: 14px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .2s, border-color .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.al-tab-btn:hover {
  color: var(--gray-700);
}
.al-tab-btn.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
  font-weight: 600;
}
.al-body-area {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}
/* Quick Add Box */
.al-quick-add {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface);
  margin-bottom: 32px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: border-color var(--trans), box-shadow var(--trans);
}
.al-quick-add:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}
.al-quick-title {
  width: 100%;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  outline: none;
  margin-bottom: 12px;
  background: transparent;
}
.al-quick-title::placeholder {
  font-weight: 500;
  color: var(--gray-400);
}
.al-quick-body {
  width: 100%;
  border: none;
  font-size: 13px;
  color: var(--gray-600);
  outline: none;
  resize: vertical;
  min-height: 50px;
  background: transparent;
  line-height: 1.5;
}
.al-quick-body::placeholder {
  color: var(--gray-300);
}
.al-quick-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}
.al-type-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.al-type-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  background: var(--gray-50);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.al-type-btn.active {
  background: #f0fdf4;
  color: var(--brand-700);
  border-color: #bbf7d0;
}
.al-type-btn:hover:not(.active) {
  background: var(--gray-100);
}

/* Timeline Filtering & List */
.al-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.al-title-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mac-modal-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f3f4f6;
  color: #9ca3af;
}
.mac-modal-icon-box.blue {
  background: #eff6ff;
  color: #3b82f6;
}
.mac-modal-icon-box.amber {
  background: #fffbeb;
  color: #d97706;
}
.al-native-select {
  padding: 8px 32px 8px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 16px 16px;
  appearance: none;
  cursor: pointer;
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

/* Vertical Timeline */
.al-vertical-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.al-vertical-list::before {
  content: '';
  position: absolute;
  top: 16px;
  bottom: 0;
  left: 17px;
  width: 2px;
  background: var(--gray-100);
  z-index: 0;
}
.al-item {
  position: relative;
  display: flex;
  gap: 16px;
  z-index: 1;
}
.al-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--surface);
  border: 1px solid var(--border);
  font-size: 16px;
}
.al-item-content {
  flex: 1;
  background: #fcfcfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.al-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.al-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}
.al-item-time {
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
}
.al-item-body {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 12px;
}
.al-item-footer {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 12px;
}
.al-meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gray-50);
}

/* ── Pipeline bar — Minimalist Underline Tabs ── */
.onb-pipeline-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  background: var(--surface);
  justify-content: space-between;
}
.onb-pipeline-bar::-webkit-scrollbar {
  display: none;
}

/* ── Activity Timeline ─────────────────────────────── */
.al-toolbar       { display:flex; justify-content:flex-end; margin-bottom:16px; }
.al-filter-bar    { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:16px; }
.al-filter-btn    { padding:5px 12px; font-size:12px; font-weight:600; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--gray-600); cursor:pointer; transition:all .15s; }
.al-filter-btn:hover, .al-filter-btn.active { background:var(--gray-900); color:#fff; border-color:var(--gray-900); }
.al-events        { display:flex; flex-direction:column; gap:0; position:relative; }
.al-events::before { content:''; position:absolute; left:16px; top:0; bottom:0; width:1px; background:var(--gray-200); z-index:0; }
.al-event         { display:flex; gap:16px; padding:16px 0; position:relative; z-index:1; }
.al-dot           { width:33px; height:33px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; background:#fff; border:1px solid var(--gray-200); box-shadow:0 2px 4px rgba(0,0,0,0.05); }
.al-content       { flex:1; min-width:0; background:#fff; padding:16px; border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:0 1px 2px rgba(0,0,0,0.02); }
.al-header        { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:4px; gap:8px; }
.al-title         { font-size:14px; font-weight:700; color:var(--gray-900); }
.al-badge         { font-size:11px; font-weight:600; padding:3px 8px; border-radius:20px; }
.al-body          { font-size:13px; color:var(--gray-600); margin:8px 0 0; line-height:1.5; white-space:pre-wrap; }
.al-meta          { font-size:11px; font-weight:600; color:var(--gray-400); margin-top:4px; }
.al-empty         { text-align:center; padding:40px; color:var(--gray-400); font-size:14px; }
.al-error         { color:var(--color-danger); }
.al-loading       { text-align:center; padding:40px; color:var(--gray-400); }
.al-add-form      { background:var(--gray-50); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; margin-bottom:24px; box-shadow:inset 0 1px 3px rgba(0,0,0,0.02); }
.al-add-header    { display:flex; gap:8px; margin-bottom:12px; align-items:center; }
.al-select        { font-size:13px; font-weight:500; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 12px; background:white; }
.al-input         { width:100%; font-size:13px; border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; margin-bottom:12px; box-sizing:border-box; }
.al-textarea      { width:100%; font-size:13px; border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; box-sizing:border-box; resize:vertical; }
.al-page-bar      { display:flex; gap:12px; align-items:center; justify-content:center; padding:20px 0; font-size:13px; color:var(--gray-500); }

.pipeline-pill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 8px;
  flex: 1;
  min-width: 90px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
  opacity: 0.6;
}

.pipeline-pill:hover {
  opacity: 0.9;
}

.pipeline-pill.active {
  opacity: 1;
  border-bottom-color: var(--brand-500);
}

.pipeline-pill-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  margin-bottom: 4px;
  transition: color .2s;
  text-align: center;
}

.pipeline-pill-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-800);
  transition: color .2s;
  text-align: center;
}

.pipeline-pill.active .pipeline-pill-title {
  color: var(--brand-600);
}
.pipeline-pill.active .pipeline-pill-count {
  color: var(--brand-700);
}

/* Optional: Subtle colored border overrides based on stage (data-color attr used originally) */
.pipeline-pill.active[data-color="all"] { border-bottom-color: var(--brand-500); }
.pipeline-pill.active[data-color="all"] .pipeline-pill-title { color: var(--brand-600); }
.pipeline-pill.active[data-color="all"] .pipeline-pill-count { color: var(--brand-600); }

.pipeline-pill.active[data-color="new"] { border-bottom-color: #3b82f6; }
.pipeline-pill.active[data-color="new"] .pipeline-pill-title { color: #3b82f6; }
.pipeline-pill.active[data-color="new"] .pipeline-pill-count { color: #2563eb; }

.pipeline-pill.active[data-color="quote"] { border-bottom-color: #8b5cf6; }
.pipeline-pill.active[data-color="quote"] .pipeline-pill-title { color: #8b5cf6; }
.pipeline-pill.active[data-color="quote"] .pipeline-pill-count { color: #7c3aed; }

.pipeline-pill.active[data-color="contract"] { border-bottom-color: #0ea5e9; }
.pipeline-pill.active[data-color="contract"] .pipeline-pill-title { color: #0ea5e9; }
.pipeline-pill.active[data-color="contract"] .pipeline-pill-count { color: #0284c7; }

.pipeline-pill.active[data-color="proforma"] { border-bottom-color: #f59e0b; }
.pipeline-pill.active[data-color="proforma"] .pipeline-pill-title { color: #f59e0b; }
.pipeline-pill.active[data-color="proforma"] .pipeline-pill-count { color: #d97706; }

.pipeline-pill.active[data-color="verifica"] { border-bottom-color: #10b981; }
.pipeline-pill.active[data-color="verifica"] .pipeline-pill-title { color: #10b981; }
.pipeline-pill.active[data-color="verifica"] .pipeline-pill-count { color: #059669; }

.pipeline-pill.active[data-color="alert"] { border-bottom-color: #f43f5e; }
.pipeline-pill.active[data-color="alert"] .pipeline-pill-title { color: #f43f5e; }
.pipeline-pill.active[data-color="alert"] .pipeline-pill-count { color: #e11d48; }

.pipeline-pill.active[data-color="brand"] { border-bottom-color: #0d9488; }
.pipeline-pill.active[data-color="brand"] .pipeline-pill-title { color: #0d9488; }
.pipeline-pill.active[data-color="brand"] .pipeline-pill-count { color: #0f766e; }

.pipeline-pill.active[data-color="cancelled"] { border-bottom-color: #ef4444; }
.pipeline-pill.active[data-color="cancelled"] .pipeline-pill-title { color: #ef4444; }
.pipeline-pill.active[data-color="cancelled"] .pipeline-pill-count { color: #dc2626; }



/* ── Logo / Brand stable layout ──────────────────────────────────
   Explicit dimensions prevent layout-shift while the image loads. */
.sidebar-brand {
  height: 80px; /* Slightly taller to accommodate larger logo */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  box-sizing: border-box;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border); /* optional nice separator */
}
.sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 180px; /* Increased from 140px */
  height: auto;
  min-height: 46px; /* Match the HTML height=46 attribute */
  object-fit: contain;
}


/* ================================================================
   Clienti Module — Dense Row Layout (cl-*)
   Layout-only: no color/font/button style changes.
   ================================================================ */

/* ── Tab + quick-filter bar ──────────────────────────────────── */
/* Stile per il badge (numerino contatore) */


/* scrollable selects wrapper */
.cl-filter-selects-wrap::-webkit-scrollbar { display: none; }

/* Reset link-style button */
.cl-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 0 6px;
  height: 32px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  border-radius: 6px;
  transition: color .12s;
}
.cl-filter-reset:hover { color: #ef4444; }

/* ── Compact client row (list item) ──────────────────────────── */
.cl-list {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cl-row {
  display: grid;
  grid-template-columns: 2.5fr 1.5fr 1.5fr 1.5fr 1fr 140px;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  transition: background .12s;
}
.cl-row:last-child { border-bottom: none; }
.cl-row:hover { background: var(--brand-50, #f0fdf4) !important; }

/* Column Helpers */
.cl-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.cl-col-right {
  align-items: flex-end;
}

/* Data Typography */
.cl-data-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cl-data-lbl {
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cl-data-lbl svg { margin-right: 3px; vertical-align: -2px; }

/* Column A — Identity */
.cl-row-identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.cl-row-avatar {
  width: 28px !important;
  height: 28px !important;
  font-size: 11px !important;
  flex-shrink: 0;
  margin-top: 2px;
}
.cl-row-avatar-blocked {
  background: #dc2626 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.cl-row-identity-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cl-row-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cl-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-row-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--gray-500);
}
a.cl-row-link {
  color: var(--gray-500);
  text-decoration: none;
}
a.cl-row-link:hover { color: var(--brand-600); text-decoration: underline; }

/* In-table KPI pills */
.cl-mini-kpi {
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gray-700);
}
.cl-mini-kpi-val { font-weight: 700; }

/* Windoc badge */
.cl-windoc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: default;
  white-space: nowrap;
  line-height: 1.2;
}
.cl-windoc-ok {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.cl-windoc-push {
  background: transparent;
  color: var(--gray-500);
  border: 1px solid var(--border);
  cursor: pointer;
}
.cl-windoc-push:hover { background: var(--gray-100); }

/* Column D — Quick actions */
.cl-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  justify-content: flex-end;
  transition: opacity .15s;
}
.cl-row:hover .cl-row-actions { opacity: 1; }

/* Responsive: switch to vertical on narrow screens */
@media (max-width: 1024px) {
  .cl-row { grid-template-columns: 1fr auto; }
  .cl-col:not(.cl-col-actions) { display: none; }
  .cl-row-actions { opacity: 1; }
}


/* Detail page tab badge (count indicator inside tab button) */
.detail-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--gray-200);
  color: var(--gray-700);
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}
.detail-tab-badge:empty { display: none; }
.detail-tab.active .detail-tab-badge { background: var(--brand-100); color: var(--brand-700); }

/* Mac Action Pill (clickable status toggle) */
.mac-action-pill { display:inline-flex; align-items:center; gap:3px; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; cursor:pointer; transition:all .15s; border:none; background:none; white-space:nowrap; line-height:1.4; }
.mac-action-pill.off { background:#f1f5f9; color:#94a3b8; }
.mac-action-pill.off:hover { background:#e2e8f0; color:#64748b; }
.mac-action-pill.on { background:#dcfce7; color:#15803d; }
.mac-action-pill.on:hover { background:#bbf7d0; color:#166534; }

/* Fix: cl-list container - explicit white background prevents body gradient bleed */
.cl-list { background: var(--surface); border-radius: var(--radius-md); overflow: hidden; }
.cl-row  { background: var(--surface); }

/* Fix: #cl-list id selector (HTML uses id not class) */
#cl-list { background: var(--surface); border-radius: var(--radius-md); overflow: hidden; }

/* ================================================================
   ENTERPRISE CRM — Client Detail Page (Zoho-style)
   All new classes for the enterprise redesign
   ================================================================ */

/* ── Header: z-header ─────────────────────────────────────────── */
.z-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 12px;
  flex-wrap: wrap;
}
.z-header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.z-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.z-avatar {
  width: 52px; height: 52px; border-radius: 12px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff; font-size: 18px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(5,150,105,0.35);
}
.z-title {
  font-size: 20px; font-weight: 800; color: var(--gray-900);
  margin: 0 0 3px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.z-subtitle { font-size: 13px; color: var(--gray-500); margin: 0; }
.z-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}

/* ── Info strip (quick contact facts) ─────────────────────────── */
.z-info-strip {
  display: flex; flex-wrap: wrap; gap: 4px 0;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.z-info-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gray-600); white-space: nowrap;
  padding: 0 16px 0 0;
}
.z-info-pill:not(:last-child) { border-right: 1px solid var(--border); margin-right: 16px; }
.z-info-pill svg { color: var(--gray-400); flex-shrink: 0; width: 14px; height: 14px; }
.z-info-pill a { color: var(--brand-600); text-decoration: none; font-weight: 500; }
.z-info-pill a:hover { text-decoration: underline; }

/* ── Action bar ───────────────────────────────────────────────── */
.z-action-bar {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto; flex-wrap: nowrap;
  scrollbar-width: none;
}
.z-action-bar::-webkit-scrollbar { display: none; }
.z-action-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--gray-700);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; white-space: nowrap; flex-shrink: 0;
  font-family: inherit;
}
.z-action-btn:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
  box-shadow: 0 1px 4px rgba(79,70,229,0.12);
}
.z-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.z-action-btn.primary-action {
  background: var(--brand-600); color: #fff; border-color: var(--brand-600);
}
.z-action-btn.primary-action:hover { background: var(--brand-700); border-color: var(--brand-700); }
.z-action-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

/* ── KPI chips row ────────────────────────────────────────────── */
.cd-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.cd-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; cursor: default;
  transition: box-shadow .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cd-chip:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.cd-chip-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.cd-chip-val { font-size: 24px; font-weight: 800; color: var(--gray-900); }

/* ── View toggle ──────────────────────────────────────────────── */
.z-view-toggles-container {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.z-view-toggles { display: flex; gap: 0; }
.z-view-btn {
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  color: var(--gray-500); background: none; border: none;
  border-bottom: 3px solid transparent; cursor: pointer;
  transition: all .15s; margin-bottom: -1px;
  font-family: inherit;
}
.z-view-btn:hover { color: var(--gray-800); }
.z-view-btn.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }

/* ── Main view panels ─────────────────────────────────────────── */
#view-panoramica, #view-timeline { display: none; }
#view-panoramica.active, #view-timeline.active { display: block; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.z-sidebar { padding: 0; }
.z-sidebar-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--gray-400); padding: 0 0 8px;
}
.z-nav-list { list-style: none; margin: 0; padding: 0; }
.z-nav-list li { margin: 0; }
.z-nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--gray-600);
  text-decoration: none; border-radius: 7px; transition: all .12s;
}
.z-nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.z-nav-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.z-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--gray-200); color: var(--gray-600);
  font-size: 11px; font-weight: 700;
}
.z-nav-item.active .z-nav-badge { background: var(--brand-100); color: var(--brand-700); }

/* ── Sidebar quick info section ───────────────────────────────── */
.z-sidebar-quick {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.z-sidebar-quick-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--gray-400); margin-bottom: 10px;
}
.z-qc-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
  transition: box-shadow .12s;
}
.z-qc-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.z-qc-name { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.z-qc-role { font-size: 11px; color: var(--gray-500); margin-bottom: 6px; }
.z-qc-links { display: flex; flex-direction: column; gap: 3px; }
.z-qc-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--brand-600); text-decoration: none; font-weight: 500;
}
.z-qc-link:hover { text-decoration: underline; }
.z-qc-link svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Card base ────────────────────────────────────────────────── */
.z-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .15s;
}
.z-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.z-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.z-card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); margin: 0; }
.z-card-body { padding: 20px; }

/* ── Zoho-style Field rows (zf-*) ─────────────────────────────── */
.zf-section { margin-bottom: 20px; }
.zf-section:last-child { margin-bottom: 0; }
.zf-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--gray-100);
}
.zf-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--gray-500);
}
.zf-edit-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #374151;
  background: #e5e7eb; border: 1px solid #d1d5db;
  cursor: pointer; padding: 4px 10px;
  border-radius: 6px; transition: all .15s ease; font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.zf-edit-link:hover { background: #d1d5db; color: #111827; }
.zf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
@media (max-width: 680px) { .zf-cols { grid-template-columns: 1fr; } }
.zf-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--gray-50);
  min-height: 36px;
}
.zf-row:last-child { border-bottom: none; }
.zf-lbl {
  min-width: 128px; font-size: 12.5px; color: var(--gray-500);
  flex-shrink: 0; padding-top: 1px;
}
.zf-val { flex: 1; font-size: 13.5px; color: var(--gray-900); font-weight: 500; min-width: 0; }
.zf-val.mono { font-family: monospace; font-size: 12.5px; color: var(--gray-700); }
.zf-val a { color: #2563eb; text-decoration: none; }
.zf-val a:hover { text-decoration: underline; color: #1d4ed8; }
.zf-val strong { color: var(--gray-900); font-weight: 700; }

/* ── Note compose (shared) ────────────────────────────────────── */
.z-note-compose {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #fff; transition: box-shadow .15s, border-color .15s;
}
.z-note-compose:focus-within {
  box-shadow: 0 0 0 3px var(--brand-100); border-color: var(--brand-400);
}
.z-note-compose textarea {
  display: block; width: 100%; border: none; background: transparent;
  padding: 14px 16px; font-size: 14px; color: var(--gray-900);
  resize: vertical; min-height: 80px; box-sizing: border-box;
  font-family: inherit; outline: none; line-height: 1.5;
}
.z-note-compose textarea::placeholder { color: var(--gray-400); }
.z-note-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px; background: var(--gray-50); border-top: 1px solid var(--border);
}

/* ── Contact row cards ────────────────────────────────────────── */
.z-contact-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.z-contact-row:last-child { border-bottom: none; }
.z-contact-row:hover { background: var(--gray-50); }
.z-contact-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.z-contact-info { flex: 1; min-width: 0; }
.z-contact-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.z-contact-role { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.z-contact-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.z-contact-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--brand-600); text-decoration: none; font-weight: 500;
}
.z-contact-link:hover { text-decoration: underline; }
.z-contact-link svg { width: 11px; height: 11px; }

/* ── Related records table layout ─────────────────────────────── */
.z-rel-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.z-rel-table th {
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 9px 20px; background: var(--gray-50);
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.z-rel-table td {
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  color: var(--gray-800); vertical-align: middle;
}
.z-rel-table tr:last-child td { border-bottom: none; }
.z-rel-table tr:hover td { background: var(--gray-50); }
.z-rt-name { font-weight: 600; color: var(--gray-900) !important; }
.z-rt-amt { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gray-900) !important; }
.z-rt-date { color: var(--gray-500) !important; font-size: 12px; }
.z-rt-link {
  color: var(--brand-600) !important; font-weight: 600;
  text-decoration: none; font-size: 12px;
}
.z-rt-link:hover { text-decoration: underline; }

/* ── Layout grid ──────────────────────────────────────────────── */
.detail-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start;
}
@media (max-width: 860px) {
  .detail-layout { grid-template-columns: 1fr; }
  .profile-col { display: none; }
}
.profile-col { position: sticky; top: 80px; }
.data-col { min-width: 0; }

/* ── Activity timeline compose (Storico view) ─────────────────── */
.al-container { }
.al-body-area { }
.al-quick-add {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .15s;
}
.al-quick-add:focus-within { box-shadow: 0 0 0 3px var(--brand-100); border-color: var(--brand-300); }
.al-quick-title {
  width: 100%; border: none; border-bottom: 1px solid var(--border); background: none;
  font-size: 14px; font-weight: 600; color: var(--gray-900); padding: 0 0 10px;
  margin-bottom: 10px; outline: none; font-family: inherit;
}
.al-quick-title::placeholder { color: var(--gray-400); font-weight: 400; }
.al-quick-body {
  width: 100%; border: none; background: none; font-size: 13.5px;
  color: var(--gray-700); resize: vertical; min-height: 70px;
  outline: none; font-family: inherit; line-height: 1.5; box-sizing: border-box;
}
.al-quick-body::placeholder { color: var(--gray-400); }
.al-quick-actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.al-type-selector { display: flex; gap: 6px; flex-wrap: wrap; }
.al-type-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px;
  background: #fff; font-size: 12.5px; font-weight: 500; color: var(--gray-600);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.al-type-btn:hover:not(.active) { border-color: var(--brand-300); color: var(--brand-700); }
.al-type-btn.active {
  background: var(--brand-600); color: #fff; border-color: var(--brand-600); font-weight: 600;
}
.al-schedule-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--brand-600);
  background: none; border: 1px dashed var(--brand-300); border-radius: 6px;
  padding: 5px 12px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.al-schedule-toggle:hover { background: var(--brand-50); }
.al-schedule-toggle.open { background: var(--brand-50); border-style: solid; }
.al-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.al-title-text { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.al-native-select {
  font-size: 13px; font-weight: 500; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 28px 7px 12px; background: #fff;
  color: var(--gray-700); cursor: pointer; outline: none; font-family: inherit;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}
/* Cronologia-style dated timeline */
.al-date-header {
  display: flex; align-items: center;
  padding: 20px 0 8px;
}
.al-date-header span {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--gray-700); background: var(--gray-100);
  border: 1px solid var(--gray-200); border-radius: 20px;
  padding: 3px 14px;
}
.al-date-group {
  position: relative;
}
.al-date-group::before {
  content: '';
  position: absolute;
  left: 68px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--gray-200);
  z-index: 0;
}
.al-item {
  display: grid;
  grid-template-columns: 56px 36px 1fr;
  gap: 0 12px;
  align-items: flex-start;
  padding: 8px 0;
  position: relative;
}
.al-item-time-col {
  font-size: 11.5px; color: var(--gray-400);
  font-weight: 500; text-align: right;
  padding-top: 6px; white-space: nowrap;
}
.al-item-line-col {
  display: flex; flex-direction: column;
  align-items: center; z-index: 1;
}
.al-item-dot {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; background: #fff;
}
.al-item-content { padding-top: 5px; min-width: 0; padding-bottom: 8px; }
.al-item-title { font-size: 13.5px; font-weight: 600; color: var(--gray-900); line-height: 1.4; }
.al-item-subtitle { font-weight: 500; color: var(--brand-600); }
.al-item-body { font-size: 13px; color: var(--gray-600); line-height: 1.5; margin: 4px 0 4px; }
.al-item-meta { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.al-item-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.al-item-footer-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gray-400); }
.al-meta-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.al-scheduled-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--brand-700); background: var(--brand-50); padding: 3px 10px; border-radius: 6px; margin-top: 5px; }
.al-invite-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--brand-600);
  background: none; border: 1px solid var(--brand-200); border-radius: 6px;
  padding: 3px 10px; cursor: pointer; transition: all .15s; font-family: inherit;
  margin-top: 5px;
}
.al-invite-btn:hover { background: var(--brand-50); }

/* ==========================================================
   BODY — Apple Vision gradient background (all admin pages)
   ========================================================== */
body {
  background-color: #f8fafc;
  background-image:
    radial-gradient(circle at 85% 0%, rgba(220,252,231,0.6) 0%, transparent 40%),
    radial-gradient(circle at 10% 40%, rgba(207,250,254,0.4) 0%, transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(241,245,249,0.6) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ==========================================================
   CLIENT DETAIL PAGE — admin_client_detail.html
   All styles for the 2-column client detail view.
   Memory.md: HTML = structure only. CSS = here only.
   ========================================================== */

/* ── Layout ── */
.main.detail-main {
  background: transparent;
  padding: 0;
  margin: 0;
  gap: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.detail-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.profile-col {
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
  background: rgba(248, 249, 251, 0.96);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid rgba(0,0,0,0.07);
  padding-top: 16px;
}
.data-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.data-col-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* ── Left panel back link ── */
.z-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  padding: 0 16px 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
  transition: color 150ms;
}
.z-back-link:hover { color: #059669; }
.z-back-link svg { width: 14px; height: 14px; }

/* ── Identity block ── */
.z-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 16px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.z-identity .z-avatar { width: 56px; height: 56px; font-size: 18px; margin-bottom: 10px; }
.z-identity-text .z-title { font-size: 13.5px; font-weight: 700; color: #1e293b; line-height: 1.3; }
.z-identity-text .z-subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── ELENCO CORRELATO nav ── */
.profile-col > .z-sidebar { background: transparent; }
.z-sidebar { padding: 0; }
.z-sidebar-title {
  font-size: 10.5px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 10px 12px 3px;
  margin-top: 20px;
  display: block;
}
.z-nav-list { list-style: none; padding: 4px 0 12px; margin: 0; }
.z-nav-list li { margin-bottom: 2px; }
.z-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13.5px;
  color: #374151;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  transition: background 200ms, box-shadow 200ms, color 200ms;
}
.z-nav-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
.z-nav-item.active {
  background: #ffffff;
  color: #059669;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
}
.z-nav-badge {
  background: rgba(0,0,0,0.10);
  color: inherit;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}
.z-nav-item.active .z-nav-badge { background: rgba(5,150,105,0.12); color: #059669; }
.z-nav-badge:empty { display: none; }

/* ── Client detail header bar ── */
.z-header {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  margin-bottom: 0;
  padding: 14px 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.z-header-left { display: flex; align-items: center; gap: 16px; }
.z-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.z-header-right .btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-danger-ghost {
  background: #fff;
  color: #ef4444;
  border: 1px solid #fca5a5;
}
.btn-danger-ghost:hover { background: #fef2f2; border-color: #f87171; }
.btn svg { width: 14px; height: 14px; }

/* ── Avatar ── */
.z-avatar {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(5,150,105,0.22);
  flex-shrink: 0;
}

/* ── Header text ── */
.z-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.z-subtitle { font-size: 12.5px; color: #64748b; margin-top: 3px; }
.z-subtitle a { color: #059669; text-decoration: none; font-weight: 500; }
.z-subtitle a:hover { text-decoration: underline; }
.z-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Info pills ── */
.z-info-strip { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.z-info-pill { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #64748b; }
.z-info-pill svg { width: 13px; height: 13px; color: #94a3b8; }
.z-info-pill a { color: #059669; text-decoration: none; }
.z-info-pill a:hover { text-decoration: underline; }

/* ── View tab toggles ── */
.z-view-toggles-container {
  background: transparent;
  border: none;
  padding: 24px 32px 16px;
  margin: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}
.z-view-toggles { display: inline-flex; gap: 8px; }
.z-view-btn {
  padding: 7px 18px;
  border: 1px solid transparent;
  outline: none;
  background: transparent;
  border-radius: 20px;
  font-weight: 500;
  font-size: 13.5px;
  color: #64748b;
  cursor: pointer;
  transition: all 200ms;
  font-family: inherit;
}
.z-view-btn.active {
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

/* ── View containers ── */
#view-panoramica { padding: 0 32px 32px; }
#view-panoramica, #view-timeline { display: none; }
#view-panoramica.active, #view-timeline.active {
  display: block;
  animation: cdFadeIn 250ms;
}
@keyframes cdFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards (glassmorphism light) ── */
.z-card {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  margin-bottom: 24px;
  padding: 0;
  box-shadow: 0 12px 40px rgba(0,0,0,0.04);
  scroll-margin-top: 90px;
  overflow: hidden;
}
.z-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.z-card-title { font-size: 13.5px; font-weight: 700; color: #1e293b; margin: 0; letter-spacing: -0.01em; }
.z-card-body { padding: 20px; }
.z-card-body--flush { padding: 0; }

/* ── Outline action button ── */
.z-btn-outline {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
  font-family: inherit;
}
.z-btn-outline:hover { border-color: #059669; color: #059669; background: #f0fdf4; }

/* ── Details grid ── */
.z-details-grid {
  display: grid;
  grid-template-columns: minmax(170px, max-content) 1fr;
  gap: 12px 24px;
  align-items: center;
}
.z-detail-label { font-size: 12.5px; color: #94a3b8; font-weight: 500; text-align: right; }
.z-detail-value { font-size: 13.5px; color: #1e293b; font-weight: 500; word-break: break-word; }

/* ── KPI strip ── */
.cd-chips {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
}
.cd-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-right: 1px solid #f0f2f5;
  transition: background 150ms;
}
.cd-chip:last-child { border-right: none; }
.cd-chip:hover { background: #f8fafc; }
.cd-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cd-chip-lbl { font-size: 10.5px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }
.cd-chip-val { font-size: 17px; font-weight: 700; color: #1e293b; margin-left: auto; line-height: 1; }

/* ── Timeline ── */
.z-timeline { position: relative; padding-left: 100px; margin-top: 10px; }
.z-timeline::before {
  content: '';
  position: absolute;
  left: 130px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e4e9f0;
}
.z-timeline-date {
  position: absolute;
  left: 0;
  top: -10px;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  z-index: 2;
}
.z-timeline-item { position: relative; margin-bottom: 28px; margin-top: 28px; display: flex; align-items: flex-start; }
.z-timeline-time { position: absolute; left: -100px; width: 60px; text-align: right; font-size: 11.5px; color: #94a3b8; top: 6px; }
.z-timeline-icon {
  position: absolute;
  left: -16px;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e4e9f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  z-index: 2;
}
.z-timeline-icon svg { width: 14px; height: 14px; }
.z-timeline-content { margin-left: 36px; padding-top: 6px; }
.z-timeline-meta { font-size: 13px; color: #1e293b; font-weight: 600; margin-bottom: 4px; display: flex; gap: 4px; align-items: center; }
.z-timeline-meta span.blue { color: #2563eb; font-weight: 400; }
.z-timeline-text { font-size: 12px; color: #94a3b8; margin: 0; }

/* ── Note compose ── */
.z-note-compose {
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #fff;
}
.z-note-compose textarea {
  width: 100%;
  border: none;
  padding: 14px;
  font-size: 13px;
  min-height: 72px;
  resize: none;
  background: transparent;
  font-family: inherit;
  color: #374151;
  line-height: 1.6;
}
.z-note-compose textarea:focus { outline: none; }
.z-note-actions {
  border-top: 1px solid #f0f2f5;
  padding: 8px 12px;
  display: flex;
  justify-content: flex-end;
  background: #fafbfc;
}

/* ── Modal size variants ──  */
.modal--sm { max-width: 480px; width: 100%; }
.modal--xs { max-width: 440px; width: 100%; }

/* ── Sidebar brand logo ── */
.sidebar-brand-logo { max-width: 220px; height: auto; max-height: 90px; object-fit: contain; }

/* ── Sidebar footer user info ── */
.sidebar-user-wrap { overflow: hidden; }
.sidebar-user-name {
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { color: rgba(255,255,255,0.45); font-size: 11px; }
.sidebar-avatar-sm { width: 30px; height: 30px; font-size: 11px; }

/* ── Text utilities ── */
.text-muted { color: var(--gray-500); font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .detail-layout { flex-direction: column; overflow: visible; }
  .profile-col { width: 100%; overflow-y: visible; }
  .data-col { overflow-y: visible; height: auto; }
}

/* ============================================================
   APPLE MAC-OS STYLE OVERRIDES (Dashboard & Sidebar)
   ============================================================ */
body {
  background: #fbfbfd !important;
}

/* SIDEBAR LIGHT THEME */
.sidebar {
  background: rgba(245, 245, 247, 0.85) !important; 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0,0,0,0.05) !important;
}
.sidebar-brand .brand-name {
  color: #1d1d1f !important;
}
.sidebar-user-name, .sidebar-user-role {
  color: #1d1d1f !important;
}
.sidebar-user-role { opacity: 0.6; }

/* SIDEBAR ICONS MAC-OS STYLE */
.nav-item {
  color: #515154 !important;
  border-radius: 8px !important;
  margin-bottom: 2px !important;
  font-weight: 500 !important;
}
.nav-item:hover {
  background: rgba(0,0,0,0.04) !important;
  color: #1d1d1f !important;
}
.nav-item.active {
  background: #e8e8ed !important;
  color: #1d1d1f !important;
  font-weight: 600 !important;
}
.nav-section-label {
  color: #86868b !important;
  font-weight: 600 !important;
}
.sidebar-footer {
  border-top: 1px solid rgba(0,0,0,0.05) !important;
}

.nav-item svg {
  width: 26px !important;
  height: 26px !important;
  padding: 5px !important;
  border-radius: 6px !important;
  color: #ffffff !important;
  flex-shrink: 0;
  stroke-width: 1.8 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}
/* Protettivo per la chevron della sidebar, per non prendere lo stile bulk delle icone principali.
   Padding aumenta l'hit-area cliccabile senza alterare la dimensione visiva dell'svg. */
.sidebar-nav .nav-item svg.chevron-icon,
.sidebar-nav .nav-item.active svg.chevron-icon {
  width: 18px !important;
  height: 18px !important;
  padding: 4px !important;
  margin-left: auto !important;
  box-sizing: content-box !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--gray-700) !important;
  stroke-width: 2.4 !important;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-item svg.chevron-icon:hover {
  background: rgba(0,0,0,0.06) !important;
  color: var(--gray-900) !important;
}

/* Colori vibranti Apple per icone sidebar */
.nav-item[href*="admin_dash"] svg { background: #34c759 !important; }
.nav-item[href*="admin_onboarding"] svg { background: #af52de !important; }
.nav-item[href*="admin_clients"] svg { background: #007aff !important; }
.nav-item[href*="admin_quotes"] svg { background: #ff9500 !important; }
.nav-item[href*="admin_services"] svg { background: #5ac8fa !important; }
.nav-item[href*="admin_contracts"] svg { background: #5856d6 !important; }
.nav-item[href*="admin_documents"] svg { background: #ff2d55 !important; }
.nav-item[href*="admin_invoices"] svg, #nav-item-fatture > svg:first-of-type { background: #34c759 !important; }
.nav-item[href*="admin_renewals"] svg { background: #30b0c7 !important; }
.nav-item[href*="admin_calendar"] svg { background: #ff2d92 !important; }
.nav-item[href*="admin_activities"] svg { background: #8e8e93 !important; }
.nav-item[href*="admin_reports"] svg { background: #007aff !important; }
.nav-item[href*="admin_health"] svg { background: #ff3b30 !important; }
.nav-item[href*="admin_companies"] svg { background: #ff9500 !important; }
.nav-item[href*="admin_users"] svg { background: #af52de !important; }
.nav-item[href*="admin_operativita"] svg { background: #f59e0b !important; }
.nav-item[href*="admin_banca_csv"] svg { background: #a78bfa !important; }
.nav-item[href*="admin_candidati"] svg { background: #ec4899 !important; }
.nav-item[href*="admin_alia_cleanup"] svg { background: #10b981 !important; }
.nav-item[href*="admin_job_ads"] svg { background: #a855f7 !important; }
.nav-item[href*="admin_teamtailor_accounts"] svg { background: #06b6d4 !important; }
.nav-item[href*="admin_setup_tt_alia"] svg { background: #06b6d4 !important; }
.nav-item[href*="admin_alia_mapping"] svg { background: #6366f1 !important; }
.nav-item[href*="admin_payslips"] svg { background: #f97316 !important; }

/* KPI CARDS (DASHBOARD) */
.stat-card {
  background: #ffffff !important;
  border-radius: 20px !important;
  border: 1px solid rgba(0,0,0,0.04) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03) !important;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease !important;
  overflow: hidden !important;
}
.stat-card::before {
}
.stat-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,0.08) !important;
}
.stat-card-label {
  font-weight: 600 !important;
  color: #86868b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  font-size: 11px !important;
}
.stat-card-val {
  font-weight: 700 !important;
  color: #1d1d1f !important;
  font-size: 32px !important;
  letter-spacing: -0.02em !important;
}

/* QUICK ACTIONS (DASHBOARD) */
.quick-action-btn {
  background: #ffffff !important;
  border-radius: 16px !important;
  border: 1px solid rgba(0,0,0,0.04) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.02) !important;
  padding: 12px 16px !important;
  font-weight: 500 !important;
  color: #1d1d1f !important;
  transition: all 0.2s ease !important;
}
.quick-action-btn:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.06) !important;
  transform: scale(1.02) !important;
}

/* ============================================================
   CORREZIONI APPLE STYLE + COMPLIANCE Card_Design.md
   ============================================================ */
body {
  background: #ffffff !important; /* Rimuove il "tutto grigio" globale */
}

/* Ripristino Top Marker per le KPI Cards come richiesto in Card_Design.md */
.stat-card::before {
  display: block !important; 
  height: 3px !important;
  border-radius: 20px 20px 0 0 !important;
}
.stat-card {
  box-shadow: 0 4px 14px rgba(0,0,0,0.03) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}

/* Sidebar Nav Item Attivo - Bianco su grigio per staccare */
.nav-item.active {
  background: #ffffff !important;
  color: #1d1d1f !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 2px 8px rgba(0,0,0,0.02) !important;
  font-weight: 600 !important;
}

/* ============================================================
   CORREZIONI APPLE STYLE + COMPLIANCE Card_Design.md
   ============================================================ */
body {
  background: #ffffff !important; /* Rimuove il "tutto grigio" globale */
}

/* Ripristino Top Marker per le KPI Cards come richiesto in Card_Design.md */
.stat-card::before {
  display: block !important; 
  height: 3px !important;
  border-radius: 20px 20px 0 0 !important;
}
.stat-card {
  box-shadow: 0 4px 14px rgba(0,0,0,0.03) !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
}

/* Sidebar Nav Item Attivo - Bianco su grigio per staccare */
.nav-item.active {
  background: #ffffff !important;
  color: #1d1d1f !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03) !important;
  font-weight: 600 !important;
}

/* ============================================================
   CORREZIONI APPLE STYLE - BARRA FILTRI (Rimozione sfondi grigi)
   ============================================================ */
/* .cl-filter-row è la barra filtri orizzontale usata nelle tabelle */

/* .filter-bar è il layout usato in altre sezioni (Dashboard) */
.filter-bar {
  background: #ffffff !important;
}

/* Gli input diventano molto tenui per risaltare sul bianco in stile Apple iOS */
.cl-filter-search-wrap input,
.cl-filter-select,
.filter-bar-search,
.filter-tab {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Hover e Focus per i filtri */
.cl-filter-search-wrap input:focus,
.cl-filter-select:focus,
.filter-bar-search:focus-within,
.filter-tab:hover {
  background: #ffffff !important;
  border-color: rgba(0, 113, 227, 0.4) !important;
  box-shadow: none !important;
}

.filter-tab.active {
  background: #1d1d1f !important;
  color: #ffffff !important;
}

/* ============================================================
   CORREZIONI APPLE STYLE - TINTA SFONDO & HEADER SEARCH
   ============================================================ */
/* Aggiungiamo una leggerissima tinta fresca allo sfondo (meno "vuoto bianco") */
body {
  background: #f4f6f9 !important; /* Grigio-azzurrino chiarissimo, elegante stile Apple/iPadOS */
}

/* La ricerca globale in alto diventa una 'pillola' identica ai filtri */
.header-search {
  background: #ebebed !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

.header-search:focus-within {
  background: #e1e1e4 !important; /* Diventa leggermente più scura al focus */
  box-shadow: none !important;
}

/* Header Navbar: se la pagina è grigina, la navbar in alto la facciamo staccare meglio col bianco */
.header {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}

/* Assicuriamoci che la Dashboard Card Area sia bianca */
.card, .stat-card {
  background: #ffffff !important;
}

/* ============================================================
   MAC OS GROUPED FORM LIST (SETTINGS STYLE)
   ============================================================ */
.mac-form-section {
  font-size: 13.5px;
  font-weight: 600;
  text-transform: none;
  color: #1d1d1f;
  margin: 32px 0 8px 12px;
  max-width: 700px;
}
.mac-form-section:first-child { margin-top: 16px; }

.mac-form-list {
  background: #f5f5f7;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: none;
  border: none;
  max-width: 700px; /* Constrain width for a better form aesthetic */
}

.mac-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  min-height: 44px; /* Settings inputs are slightly taller */
}

.mac-form-row:last-child {
  border-bottom: none;
}

.mac-form-label {
  font-size: 14.5px;
  font-weight: 400;
  color: #1d1d1f;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mac-form-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  text-align: right;
  outline: none !important;
  box-shadow: none !important;
  color: #86868b;
  padding: 0 0 0 16px !important;
  font-size: 14.5px;
  height: 24px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  font-family: inherit;
  transition: color 0.1s;
}

.mac-form-input:focus {
  color: #1d1d1f;
}
.mac-form-input::placeholder {
  color: #d1d1d6;
}

/* Mac Select Styling */
select.mac-form-input {
  direction: ltr; /* Reset to left-to-right */
  text-align: right;
  background: transparent !important; /* No pill */
  border-radius: 0;
  padding: 0 20px 0 0 !important; /* Space for chevron on the right */
  height: auto !important;
  color: #86868b;
  font-weight: 400;
  flex: 1 1 auto;
  width: auto;
  margin-left: auto;
  max-width: 300px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M8 10l4-4 4 4'/%3e%3cpath d='M16 14l-4 4-4-4'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right center !important;
  background-size: 14px 14px !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

select.mac-form-input:hover {
  background-color: transparent !important;
  color: #1d1d1f;
}

select.mac-form-input option {
  direction: ltr;
  text-align: left;
}

/* Modifica Header Buttons Top */
.mac-btn-cancel {
  background: transparent !important;
  color: #007aff !important;
  border: none !important;
  box-shadow: none !important;
  font-weight: 500;
  padding: 4px 8px;
}
.mac-btn-cancel:hover { background: rgba(0,122,255,0.1) !important; }


/* ============================================================
   MAC OS TOGGLE SWITCH (ACCENDI/SPEGNI)
   ============================================================ */
.mac-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 51px;
  height: 31px;
  background: #e5e5ea;
  border-radius: 31px;
  position: relative;
  cursor: pointer;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); /* subtle inner border */
  transition: background 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  flex-shrink: 0;
  margin: 0;
}

.mac-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.16), 0 3px 1px rgba(0,0,0,0.1);
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.mac-toggle:checked {
  background: #34c759; /* iOS green */
}

.mac-toggle:checked::after {
  transform: translateX(20px);
}


/* ============================================================
   MAC OS SEGMENTED CONTROL (FILTER TABS)
   ============================================================ */
.mac-segmented-control {
  display: inline-flex;
  background: #e5e5ea; /* macOS light gray */
  border-radius: 8px;
  padding: 2px;
  align-items: center;
}
.mac-segmented-control .cl-status-pill {
  background: transparent !important;
  border: none !important;
  color: #000000 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  transition: all 0.2s;
  box-shadow: none !important;
}
.mac-segmented-control .cl-status-pill.active {
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 1px rgba(0,0,0,0.06) !important;
}



.mac-filter-input {
  background-color: #e5e5ea !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 4px 12px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: #000000 !important;
  height: 28px !important;
  outline: none !important;
  box-shadow: none !important;
}
.mac-filter-input::placeholder { color: #8e8e93 !important; }

/* ============================================================
   MAC OS 3-DOTS MENU (Context Menu)
   ============================================================ */
.mac-context-btn {
  background: transparent;
  border: none;
  color: #8e8e93;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mac-context-btn:hover {
  background: #e5e5ea;
  color: #000000;
}
.mac-context-btn svg { width: 16px; height: 16px; }

/* The popup menu inside */
.mac-context-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.85); /* Glassmorphism */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.2);
  min-width: 140px;
  padding: 6px;
  z-index: 100;
  display: none;
  flex-direction: column;
}
.mac-context-menu.open {
  display: flex;
}
.mac-context-item {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #000;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.mac-context-item:hover {
  background: #007aff;
  color: #fff;
}
.mac-context-item.danger { color: #ff3b30; }
.mac-context-item.danger:hover { background: #ff3b30; color: #fff; }

/* In list rows, force position relative so context menu aligns right */
.cl-row { position: relative; }

/* ============================================================
   GLOBAL FILTER SELECTS & INPUTS (MAC OS STYLE ALIGNED)
   ============================================================ */
.cl-filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  min-height: 34px !important;
  padding: 0 28px 0 12px !important;
  font-size: 13px !important;
  font-family: inherit !important;
  font-weight: 500 !important;
  color: #1c1c1e !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  line-height: 32px !important;
  vertical-align: middle !important;
  box-shadow: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 10px !important;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: auto !important;
  min-width: 0 !important;
}
.cl-filter-select:hover {
  border-color: rgba(0, 113, 227, 0.4) !important;
}
.cl-filter-select:focus {
  outline: none !important;
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15) !important;
}

.cl-filter-search-input {
  appearance: none;
  -webkit-appearance: none;
  background-color: #ffffff !important;
  border: 1px solid #d1d1d6 !important;
  border-radius: 100px !important; /* Forma a pillola Apple */
  box-sizing: border-box !important;
  min-height: 32px !important;
  padding: 0 16px 0 36px !important; /* spazio per lente a sx, spazio a dx */
  font-size: 14px !important;
  font-family: inherit !important;
  font-weight: 400 !important;
  color: #1c1c1e !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 30px !important;
  vertical-align: middle !important;
  transition: all 0.2s;
  min-width: 220px;
}
.cl-filter-search-input:focus {
  outline: none !important;
  border-color: #007aff !important;
  box-shadow: 0 0 0 3px rgba(0,122,255,0.2) !important;
}
.cl-filter-search-input::placeholder { color: #8e8e93 !important; }

/* Date specific fixes */
input[type="date"].cl-filter-select, 
input[type="text"].cl-filter-select {
  background-image: none !important;
  padding: 0 4px 0 10px !important; /* ridotto padding destro per incollare l'icona al testo */
  width: 110px !important; /* costringe l'icona del calendario ad allinearsi strettamente */
}

/* ============================================================
   GLOBAL MAC STYLE ACTION BUTTON (+)
   ============================================================ */
.btn-action-icon {
  background: #007aff !important;
  color: #ffffff !important;
  border: none !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
  transition: background 0.2s, transform 0.1s !important;
  flex-shrink: 0;
}
.btn-action-icon:hover {
  background: #006ce4 !important;
}
.btn-action-icon:active {
  transform: scale(0.95) !important;
}
.btn-action-icon svg {
  width: 20px !important;
  height: 20px !important;
}


/* Fix for date inputs acting as filters so they don't get the select arrow */
input[type="date"].cl-filter-select, 
input[type="text"].cl-filter-select {
  background-image: none !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
  padding: 0 10px !important;
}


/* ============================================================
   APPLE DESIGN SYSTEM (COMPLIANT)
   ============================================================ */
.cl-quick-badges {
  display: inline-flex; align-items: center; gap: 2px;
  background: #f2f2f7; padding: 3px; border-radius: 8px; flex-wrap: nowrap; overflow-x: auto;
}
.cl-quick-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: #3a3a3c;
  background: transparent; border: none; border-radius: 6px;
  padding: 4px 12px; cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.cl-quick-badge:hover { background: rgba(0,0,0,0.05); }
.cl-quick-badge.active { 
  background: #ffffff; color: #000000; font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06); 
}
.cl-quick-badge span {
  background: rgba(0,0,0,0.08); padding: 2px 6px; border-radius: 12px;
  font-size: 11px; font-weight: 600; line-height: 1; border: none;
}


.btn-primary {
  background: #007aff; color: #ffffff; border: none; border-radius: 6px;
  padding: 6px 14px; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.1); transition: all 0.2s;
}
.btn-primary:hover { background: #005bb5; }

.btn-secondary {
  background: #ffffff; color: #000000; border: 1px solid #d1d1d6; border-radius: 6px;
  padding: 6px 14px; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.02); transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
}
.btn-secondary:hover { background: #f2f2f7; border-color: #c7c7cc; }

/* Stile icone della search input filter */
.relative:has(.cl-filter-search-input) svg { color: #1c1c1e; }

.header {
  background: #f2f2f7 !important;
  border-bottom: 1px solid #e5e5ea !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.header-search {
  background: #ffffff !important;
  border: 1px solid #d1d1d6 !important;
  border-radius: 100px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 16px !important;
  height: 36px !important;
  transition: all 0.2s !important;
}
.header-search:focus-within {
  border-color: #007aff !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2) !important;
}
/* Company selector background white */
.company-selector {
  background: #ffffff !important;
  border: 1px solid #d1d1d6 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  border-radius: 8px !important;
}

/* Default color for company dot 'T' */
.company-dot {
  background-color: #007aff; /* Apple blue default */
  color: #ffffff;
  font-weight: 600;
}

/* Color icons (bell, help) */
.icon-btn svg {
  color: #007aff !important;
}

/* Profile role 'Admin' color so it's visible */
.profile-role {
  color: #5c5c60 !important; /* Darker gray to be visible, or #007aff */
  font-weight: 500 !important;
}

/* The profile button background should probably match */
.profile-btn {
  background: transparent !important;
}
.profile-btn:hover {
  background: rgba(0,0,0,0.04) !important;
}
.pill-red {
  background: #fee2e2; color: #dc2626; border: none; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
}


/* ====== Mac-style detail page components (restored) ====== */

/* Sidebar for detail pages */
.mac-sidebar {
  width: 220px;
  min-width: 220px;
  background: #f5f5f7;
  border-right: 1px solid rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
  flex-shrink: 0;
}
.mac-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #3a3a3c;
  cursor: pointer;
  border-radius: 8px;
  margin: 0 8px 2px;
  transition: background 0.12s;
  text-decoration: none;
  position: relative;
}
.mac-nav-item:hover { background: rgba(0,0,0,0.05); }
.mac-nav-item.active {
  background: var(--brand-500, #4f6ef7);
  color: #fff;
}
.mac-nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  background: rgba(0,0,0,0.08);
}
.mac-nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* Section label inside sidebar */
.mac-section {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 14px 20px 4px;
}

/* Top bar */

/* Tab content sections */
.mac-tab-section {
  display: none;
}
.mac-tab-section.active {
  display: block;
}

/* Divider */
.mac-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 12px 0;
}

.mac-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 6px;
  gap: 8px;
}
.mac-form-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #1c1c1e;
  letter-spacing: -0.01em;
}

/* form-value (right-side value in a mac-form-row) */
.mac-form-value {
  font-size: 14px;
  color: #1c1c1e;
  text-align: right;
  flex: 1;
  word-break: break-word;
}
.mac-form-value a {
  color: var(--brand-600, #2563eb);
  text-decoration: none;
}
.mac-form-value.mono { font-family: ui-monospace, monospace; font-size: 13px; }

/* Text-style button (e.g. Modifica) */
.mac-btn-text {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-600, #2563eb);
  font-family: inherit;
  padding: 0;
  transition: opacity 0.1s;
}
.mac-btn-text:hover { opacity: 0.7; }
.mac-btn-text.text-danger { color: #ef4444; }
.mac-btn-text.text-save { color: var(--brand-600, #2563eb); }

/* Pipeline / progress track */
.mac-pipeline-wrap {
  padding: 16px 0 8px;
  overflow-x: auto;
}
.mac-pipeline-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: max-content;
  padding: 0 8px;
  position: relative;
}
.mac-pipeline-track-bg {
  position: absolute;
  top: 15px;
  left: 36px;
  right: 36px;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}
.mac-pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 80px;
  position: relative;
  z-index: 1;
  cursor: default;
}
.mac-pipeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
}
.mac-pipeline-step.done .mac-pipeline-dot {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.mac-pipeline-step.current .mac-pipeline-dot {
  background: var(--brand-500, #4f6ef7);
  border-color: var(--brand-500, #4f6ef7);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(79,110,247,0.18);
}
.mac-pipeline-label {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
}
.mac-pipeline-step.done .mac-pipeline-label { color: #10b981; }
.mac-pipeline-step.current .mac-pipeline-label {
  color: var(--brand-500, #4f6ef7);
  font-weight: 700;
}
.mac-pipeline-progress {
  height: 2px;
  background: #10b981;
  position: absolute;
  top: 15px;
  left: 50%;
  right: -50%;
  z-index: 0;
}
.mac-pipeline-step:last-child .mac-pipeline-progress { display: none; }

/* Mass action bar */
.mac-mass-action-bar {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: bottom 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 9999;
  min-width: 320px;
}
.mac-mass-action-bar.visible { bottom: 28px; }
.mac-mass-action-content { display: flex; align-items: center; gap: 12px; width: 100%; }
.mac-mass-action-selected { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); white-space: nowrap; }
.mac-mass-action-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.2); flex-shrink: 0; }
.mac-mass-action-buttons { display: flex; align-items: center; gap: 8px; flex: 1; margin-left: 12px; }
.mac-mass-action-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 6px 14px;
  font-size: 13px; font-weight: 600; color: #fff;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background 0.1s;
}
.mac-mass-action-btn:hover { background: rgba(255,255,255,0.22); }
.mac-mass-action-btn.delete { color: #ff6b6b; }
.mac-mass-action-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.mac-mass-action-close {
  background: rgba(255,255,255,0.1); border: none; border-radius: 8px;
  width: 32px; height: 32px; color: rgba(255,255,255,0.7);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: auto; transition: background 0.1s;
}
.mac-mass-action-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.mac-cat-select-wrap {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 0 12px;
  height: 32px; cursor: pointer;
  transition: background 0.1s;
}
.mac-cat-select-wrap:hover { background: rgba(255,255,255,0.22); }
.mac-cat-select-wrap svg { color: rgba(255,255,255,0.75); flex-shrink: 0; }
.mac-cat-select-wrap select {
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 0;
  -webkit-appearance: none; appearance: none;
  min-width: 130px;
}
.mac-cat-select-wrap select option { color: #111; background: #fff; }
/* Per-row category selector */
.mac-cat-row-wrap {
  display: flex; align-items: center; gap: 6px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 6px; padding: 3px 8px 3px 6px;
  cursor: pointer; min-width: 0; transition: border-color 0.15s, background 0.15s;
}
.mac-cat-row-wrap:hover { background: #f1f5f9; border-color: #d1d5db; }
.mac-cat-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.mac-cat-row-select {
  background: transparent; border: none; outline: none;
  font-size: 12px; font-weight: 600; color: var(--gray-700);
  cursor: pointer; min-width: 80px; max-width: 130px;
  -webkit-appearance: auto; appearance: auto;
}

/* Sidebar nav: colored icons */
.sidebar-nav .nav-item:nth-child(2) svg { color: #4f6ef7; }
.sidebar-nav .nav-item:nth-child(3) svg { color: #0ea5e9; }
.sidebar-nav .nav-item:nth-child(5) svg { color: #10b981; }
.sidebar-nav .nav-item:nth-child(6) svg { color: #8b5cf6; }
.sidebar-nav .nav-item:nth-child(7) svg { color: #6366f1; }
.sidebar-nav .nav-item:nth-child(8) svg { color: #f59e0b; }
.sidebar-nav .nav-item:nth-child(9) svg { color: #ec4899; }
.sidebar-nav .nav-item:nth-child(11) svg { color: #84cc16; } /* Fatture */
/* nav-submenu is child 12 */
.sidebar-nav .nav-item:nth-child(13) svg { color: #f97316; } /* Rinnovi */
.sidebar-nav .nav-item:nth-child(15) svg { color: #a855f7; } /* Calendario */
.sidebar-nav .nav-item:nth-child(16) svg { color: #14b8a6; } /* Task */
.sidebar-nav .nav-item.active svg { color: #fff !important; }
/* ====== End mac-style detail page components ====== */
.sidebar-footer { display: none !important; }


/* Mac Switch injected */
.mac-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.mac-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.mac-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.mac-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.mac-switch input:checked + .mac-slider {
  background-color: #10b981;
}
.mac-switch input:checked + .mac-slider:before {
  transform: translateX(16px);
}
.mac-switch input:disabled + .mac-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Notifications ---------- */
.notif-panel {
  width: 340px;
  max-width: 100vw;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.notif-panel-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--gray-800);
}

.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--gray-500);
  font-size: var(--text-sm);
}

#notif-list-container {
  max-height: 400px;
  overflow-y: auto;
}

#notif-list-container::-webkit-scrollbar {
  width: 4px;
}
#notif-list-container::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  cursor: pointer;
  background: var(--surface);
  transition: background var(--trans);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--gray-50);
}

.notif-item.unread {
  background: #f8fafc;
  border-left: 3px solid #0ea5e9;
}

.notif-item.unread:hover {
  background: #f1f5f9;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.notif-item.unread .notif-item-title {
  font-weight: 600;
  color: #0369a1;
}

.notif-item-message {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.4;
}

.notif-item-date {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 4px;
}

#notif-badge-count {
  display: flex !important;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  color: transparent;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  line-height: 1;
  box-sizing: border-box;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  margin-bottom: 6px;
}

.nav-sub-item {
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 12px 6px 46px; 
  border-radius: 8px;
  color: #71717a !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.nav-sub-item:hover {
  background: rgba(0,0,0,0.04) !important;
  color: #1d1d1f !important;
}

.nav-sub-item.active {
  background: #e8e8ed !important;
  color: #1d1d1f !important;
  font-weight: 600 !important;
}

