/* === RESET & BASE === */
@import url('vendor/assistant-font.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f2f7;
  --surface: #ffffff;
  --border: #e4e8f0;
  --border-light: #f0f2f7;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --disabled-bg: #f8fafc;
  --disabled-text: #cbd5e1;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
}

body {
  font-family: 'Assistant', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === APP LAYOUT === */
.app { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
  width: 240px; min-width: 240px; background: #0c1222;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  color: #94a3b8;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar { transition: width 0.25s ease, min-width 0.25s ease; }

/* Collapse toggle button */
.sidebar-collapse-btn {
  background: none; border: none; color: #475569; cursor: pointer;
  margin-right: auto; padding: 4px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }
.sidebar-collapse-btn .ti { font-size: 18px; transition: transform 0.25s ease; }

/* === COLLAPSED SIDEBAR === */
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .sidebar-header { padding: 24px 0 20px; justify-content: center; gap: 0; }
.sidebar.collapsed .sidebar-brand { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; }
.sidebar.collapsed .sidebar-collapse-btn .ti { transform: rotate(180deg); }
.sidebar.collapsed .nav-section { padding: 4px 8px; }
.sidebar.collapsed .nav-title { padding: 10px 0 4px; text-align: center; }
.sidebar.collapsed .nav-title .nav-text { display: none; }
.sidebar.collapsed .nav-title::after { content: ''; display: block; width: 20px; height: 1px; background: #334155; margin: 0 auto; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; gap: 0; }
.sidebar.collapsed .nav-item .ti { font-size: 19px; width: auto; }
.sidebar.collapsed .nav-item span:not(.ti),
.sidebar.collapsed .nav-item:not(.nav-item-sm)::after { display: none; }
/* Hide text nodes in nav-items — done via JS adding a span wrapper */
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-badge { display: none !important; }
.sidebar.collapsed .sidebar-new-btn { margin: 10px 8px 6px; padding: 10px; justify-content: center; gap: 0; }
.sidebar.collapsed .sidebar-new-btn .nav-text { display: none; }
.sidebar.collapsed .nav-divider { margin: 10px 8px; }
.sidebar.collapsed .sidebar-footer-actions { padding: 8px; }
.sidebar.collapsed .nav-item-sm { justify-content: center; padding: 8px; gap: 0; }
.sidebar.collapsed .nav-item-sm .nav-text { display: none; }
.sidebar.collapsed .sidebar-user { padding: 14px 0; justify-content: center; gap: 0; }
.sidebar.collapsed .user-info { display: none; }

/* Tooltip on hover when collapsed */
.sidebar.collapsed .nav-item[data-tooltip]:hover::before,
.sidebar.collapsed .sidebar-new-btn[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
  background: #1e293b; color: #f1f5f9; padding: 5px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap; z-index: 100;
  margin-right: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.sidebar.collapsed .nav-item,
.sidebar.collapsed .sidebar-new-btn { position: relative; }

.sidebar-header {
  padding: 24px 20px 20px; display: flex; align-items: center; gap: 12px;
}
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
  flex-shrink: 0;
}
.sidebar-brand { font-size: 15px; font-weight: 700; color: #f1f5f9; letter-spacing: -0.3px; }
.sidebar-brand small { display: block; font-size: 10px; font-weight: 400; color: #475569; margin-top: 2px; letter-spacing: 0; }

.nav-section { padding: 4px 12px; flex: 1; }
.nav-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: #475569; padding: 18px 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: #64748b;
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.nav-item.active { background: rgba(59,130,246,0.15); color: #60a5fa; font-weight: 600; }
.nav-item .ti { font-size: 17px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item.active .ti { color: #60a5fa; }
.nav-item:hover .ti { color: #e2e8f0; }
.nav-badge {
  margin-right: auto; font-size: 10px; font-weight: 700;
  background: #3b82f6; color: #fff; padding: 2px 7px;
  border-radius: 10px; min-width: 20px; text-align: center;
}
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 10px 10px; }

.sidebar-new-btn {
  margin: 10px 12px 6px;
  padding: 10px 14px;
  background: #3b82f6;
  color: #fff;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.15s;
}
.sidebar-new-btn:hover { background: #2563eb; }
.sidebar-new-btn .ti { font-size: 16px; }

.nav-item-sm { padding: 7px 12px; font-size: 12px; }
.nav-item-danger { color: #f87171; }
.nav-item-danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

.sidebar-footer {
  margin-top: auto; border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer-actions { padding: 8px 12px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-top: 1px solid #1e2d45;
}
.avatar {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.user-info small { display: block; font-size: 10px; color: #475569; font-weight: 400; margin-top: 1px; }

/* === MAIN CONTENT === */
.app-main {
  flex: 1;
  padding: 20px 24px;
  overflow-x: auto;
  min-width: 0;
}

/* === BUTTONS === */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.2);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(37,99,235,0.25); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid #fca5a5;
}
.btn-danger-outline:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  transition: all 0.12s;
}
.btn-icon:hover { background: #f1f5f9; color: var(--text); }
.btn-icon.danger:hover { color: var(--danger); background: var(--danger-light); }


/* === STATS === */
.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow);
}

/* Stacked variant — single card with a header on top and two rows below
   (e.g. תפוקה / ניודים pair on the pension page). */
.stat-card-stack {
  align-items: stretch;
  padding: 10px 14px;
  min-width: 200px;
}
.stat-card-stack .stat-card-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.stat-card-stack .stat-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 0;
}
.stat-card-stack .stat-card-sub-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-card-stack .stat-value {
  font-size: 17px;
  direction: ltr;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* Category stat cards */
.stats-bar-categories {
  gap: 14px;
  display: grid;
  grid-template-columns: repeat(7, 1fr) 90px;
  margin-bottom: 18px;
}

.stat-card-cat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
}

.stat-card-cat::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 10px 10px 0 0;
}

#catThirdParty::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
#catMandatory::before { background: linear-gradient(90deg, #10b981, #34d399); }
#catPremium::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
#catHol::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
#catRiders::before { background: linear-gradient(90deg, #ec4899, #f472b6); }

.stat-card-cat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-cat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-cat-total {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.stat-cat-split {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.stat-cat-new, .stat-cat-renewal {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.stat-cat-new b { color: var(--success); font-weight: 700; }
.stat-cat-renewal b { color: #d97706; font-weight: 700; }

.stat-card-unpaid {
  align-items: center;
  justify-content: center;
  background: var(--danger-light);
  border-color: #fecaca;
  min-width: auto;
}
.stat-card-unpaid .stat-value { color: var(--danger); }
.stat-card-unpaid .stat-label { color: #ef4444; font-weight: 600; }

/* === FILTERS === */
.filters-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-row-break { flex-basis: 100%; height: 0; }

.input-search {
  flex: 1;
  min-width: 180px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  transition: all 0.15s;
  color: var(--text);
}
.input-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.input-search::placeholder { color: var(--text-muted); }

.input-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  min-width: 130px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.input-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.filter-date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Renewals button */
.btn-renewals {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  background: var(--warning-light);
  color: var(--warning);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-renewals:hover { background: #fef3c7; border-color: var(--warning); }
.btn-renewals.active { background: #f59e0b; border-color: #d97706; color: #fff; }
.btn-renewals.active:hover { background: #d97706; }
.btn-renewals.active .renewals-badge { background: #fff; color: var(--warning); }
.renewals-icon { font-size: 14px; }
.renewals-badge {
  background: #f59e0b;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.renewals-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--warning-light);
  border-bottom: 2px solid #fcd34d;
  border-radius: 0;
}
.renewals-filter-bar .input-select { max-width: 200px; }

.btn-export-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  white-space: nowrap;
}

/* === TABLE === */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: visible;
}
/* Always show horizontal scrollbar */
.table-container::-webkit-scrollbar { height: 12px; }
.table-container::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 6px; }
.table-container::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; min-width: 40px; }
.table-container::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Fixed scrollbar at viewport bottom */
#fixedHScroll {
  position: fixed;
  bottom: 0;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
  background: #e8ecf2;
  border-top: 1px solid #cbd5e1;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
#fixedHScroll::-webkit-scrollbar { height: 14px; }
#fixedHScroll::-webkit-scrollbar-track { background: #e2e8f0; }
#fixedHScroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 7px; border: 2px solid #e2e8f0; }
#fixedHScroll::-webkit-scrollbar-thumb:hover { background: #64748b; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #fafbfc;
  position: sticky;
  top: 0;
  z-index: 10;
}

thead::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0; left: 0;
  height: 2px;
  background: #94a3b8;
}

th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid #94a3b8;
  border-left: 1px solid #cbd5e1;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

th:last-child { border-left: none; }

th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-left: 22px;
  transition: color 0.12s;
}

th.sortable:hover { color: var(--primary); background: var(--primary-light); }

th.sortable::after {
  content: '↕';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #cbd5e1;
}

th.sortable.sort-asc::after { content: '↑'; color: var(--primary); }
th.sortable.sort-desc::after { content: '↓'; color: var(--primary); }

td {
  padding: 11px 14px;
  border-bottom: 1.5px solid #cbd5e1;
  border-left: 1px solid #cbd5e1;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 13px;
}

td:last-child { border-left: none; }

/* Wider, non-truncating column for ID-style numbers (memberNumber, etc.) */
.col-id-wide { max-width: none !important; min-width: 140px; }
td.col-id-wide { overflow: visible; text-overflow: clip; }

tr:last-child td { border-bottom: none; }

#tableBody tr {
  cursor: pointer;
  transition: background 0.1s;
}

#tableBody tr:hover td,
#lifeTableBody tr:hover td,
#risksTableBody tr:hover td,
#pensionTableBody tr:hover td {
  background: #f8faff;
}

tr .actions { white-space: nowrap; }

/* === STATUS PILLS === */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-new { background: #ecfdf5; color: #059669; }
.status-new::before { background: #10b981; }
.status-add { background: #eff6ff; color: #2563eb; }
.status-add::before { background: #3b82f6; }
.status-renew { background: #fffbeb; color: #d97706; }
.status-renew::before { background: #f59e0b; }
.status-cancel { background: #fef2f2; color: #dc2626; }
.status-cancel::before { background: #ef4444; }
.status-other { background: #f1f5f9; color: #475569; }
.status-other::before { background: #94a3b8; }

/* === COLLECTION PILLS === */
.collection-paid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #059669;
  font-weight: 600;
  font-size: 11.5px;
}
.collection-paid::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.collection-unpaid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
  font-size: 11.5px;
}
.collection-unpaid::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

/* Load more */
.load-more-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.btn-load-more {
  padding: 9px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(37,99,235,0.2);
}
.btn-load-more:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(37,99,235,0.25); }

.load-more-info {
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  display: none;
}

.hidden { display: none !important; }

/* === MODAL === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal.visible { display: flex; }

.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

.modal-wide { max-width: 1000px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 1;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: all 0.12s;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }

.modal-body { padding: 22px; }

/* === FORM === */
.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.form-group { display: flex; flex-direction: column; }

.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  transition: all 0.15s ease;
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group.field-disabled input,
.form-group.field-disabled select {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--border);
  cursor: not-allowed;
  pointer-events: none;
}

.form-group.field-disabled label { color: var(--disabled-text); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* === EXCEL-STYLE TRANSACTION FORM (intentional retro design) === */
.modal-excel {
  max-width: 860px;
  background: #e5e7eb;
  border-radius: 16px;
  border: 2px solid #1e3a5f;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(30,58,95,0.1);
}

.excel-title-bar {
  background: #1e3a5f;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
}

.excel-title-bar h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.excel-title-bar .modal-close {
  font-size: 20px;
  color: rgba(255,255,255,0.7);
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s;
}
.excel-title-bar .modal-close:hover { color: #fff; background: rgba(255,255,255,0.15); }

.excel-form { padding: 20px 24px; background: #e5e7eb; }

.excel-search {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.excel-search-radios {
  display: flex;
  gap: 20px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #374151;
}

.excel-search-radios label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.excel-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.excel-search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f9fafb;
  transition: border-color 0.15s;
}
.excel-search-bar input:focus { border-color: #1e3a5f; box-shadow: 0 0 0 2px rgba(30,58,95,0.15); outline: none; }

.btn-excel {
  padding: 8px 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-height: 34px;
  border-radius: 8px;
  font-weight: 600;
  color: #374151;
  transition: all 0.15s;
}
.btn-excel:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn-excel:active { background: #e5e7eb; }
.btn-excel-primary { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.btn-excel-primary:hover { background: #15304f; }

.excel-options {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #374151;
}

.excel-options-label { font-weight: 600; color: #1e3a5f; }
.excel-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.excel-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.excel-col { display: flex; flex-direction: column; gap: 8px; }

.excel-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.excel-field label {
  min-width: 85px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  color: #374151;
  text-transform: none;
  letter-spacing: 0;
}

.excel-field input,
.excel-field select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  font-family: inherit;
  background: #f9fafb;
  min-height: 34px;
  border-radius: 8px;
  transition: border-color 0.15s;
}

.excel-field input:focus,
.excel-field select:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(30,58,95,0.15);
  background: #fff;
}

.excel-field input[readonly] { background: #e5e7eb; color: #6b7280; }

.excel-field.field-disabled input,
.excel-field.field-disabled select {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #d1d5db;
  cursor: not-allowed;
  pointer-events: none;
}

.excel-field.field-disabled label { color: #9ca3af; }

/* === SEARCHABLE SELECT === */
.searchable-select { position: relative; flex: 1; }

/* Chevron — visual cue that this is a dropdown, not just a text field */
.searchable-select::after {
  content: '▼';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #6b7280;
  pointer-events: none;
  transition: transform 0.15s;
}
.searchable-select:focus-within::after {
  transform: translateY(-50%) rotate(180deg);
  color: #1e3a5f;
}

.searchable-input {
  width: 100%;
  padding: 7px 28px 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  min-height: 34px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.searchable-input:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(30,58,95,0.15);
  background: #fff;
  cursor: text;
}

.searchable-empty {
  padding: 12px;
  color: #9ca3af;
  text-align: center;
  font-style: italic;
  font-size: 12.5px;
}

.searchable-list {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  margin-top: 4px;
}

.searchable-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s;
}

.searchable-item:first-child { border-radius: 8px 8px 0 0; }
.searchable-item:last-child { border-radius: 0 0 8px 8px; }
.searchable-item:hover { background: #f0f4ff; }
.searchable-item.selected { background: #dbeafe; font-weight: 600; color: #1e3a5f; }

.label-red { color: #cc0000 !important; }
.label-blue { color: #0000cc !important; }

.excel-license-radios {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 105px;
}

.excel-license-radios label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 400;
  min-width: auto;
  cursor: pointer;
  color: #374151;
}

.excel-financial {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.excel-financial .excel-field { gap: 8px; }
.excel-financial .excel-field label { min-width: 50px; }

.excel-notes { margin-bottom: 12px; font-size: 13px; color: #374151; }
.excel-notes > label { font-weight: 600; margin-bottom: 6px; display: block; color: #1e3a5f; }

.excel-notes-row { display: flex; gap: 8px; }

.excel-notes-row select {
  width: 180px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f9fafb;
}

.excel-notes-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f9fafb;
}

.excel-notes-row select:focus,
.excel-notes-row input:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(30,58,95,0.15);
  background: #fff;
}

.excel-buttons { display: flex; gap: 10px; padding-top: 12px; }

/* === ADMIN === */
.admin-top { margin-bottom: 16px; }

.admin-new-type {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.admin-new-type h3 { font-size: 15px; margin-bottom: 12px; }

.field-toggles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.field-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}

.field-toggle:hover { border-color: var(--primary); background: var(--primary-light); }
.field-toggle input[type="checkbox"] { accent-color: var(--primary); }

.admin-types-list { display: grid; gap: 8px; }

.admin-type-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.15s;
}

.admin-type-item:hover { box-shadow: var(--shadow-md); }

.admin-type-name { font-weight: 700; font-size: 14px; }

.admin-type-category {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-right: 8px;
  padding: 2px 10px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 500;
}

.admin-type-fields { font-size: 12px; color: var(--text-muted); }
.admin-type-actions { display: flex; gap: 6px; }

/* === VIEW MODAL === */
.view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.view-field { padding: 10px 0; }

.view-field-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.view-field-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius);
  font-size: 13.5px;
  z-index: 200;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* === PRODUCTION SUMMARY === */
.production-date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.production-date-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.production-table th,
.production-table td { text-align: center; }

.production-table th:first-child,
.production-table td:first-child { text-align: right; }

.production-total-row td {
  font-weight: 700;
  background: #eff6ff;
  border-top: 2px solid var(--primary);
  font-size: 14px;
}

/* === DASHBOARD === */
.dashboard-date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.dashboard-date-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dash-period-label { font-size: 12px; color: var(--text-muted); margin-right: 8px; }

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: box-shadow 0.15s;
}

.dash-card:hover { box-shadow: var(--shadow-md); }

.dash-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dash-card-current {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.dash-card-prev { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.dash-card-diff { font-size: 13px; font-weight: 700; }

.dash-up { color: var(--success); }
.dash-down { color: var(--danger); }

.dashboard-tables-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.dash-type-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dash-type-header {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #fff;
}

.dash-type-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.dash-type-table th {
  padding: 0 12px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #f8fafc;
  border-bottom: 1px solid var(--border);
  background: #1e293b;
  height: 36px;
  line-height: 36px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dash-type-table th:first-child { text-align: right; }

.dash-type-table td {
  padding: 0 12px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  height: 36px;
  line-height: 36px;
  white-space: nowrap;
}

.dash-type-table td:first-child {
  text-align: right;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  background: #fafbfc;
  white-space: nowrap;
}

.dash-type-table tr:last-child td { border-bottom: none; }

.dash-type-table td.dash-type-diff {
  font-weight: 700;
  font-size: 12px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  height: 36px;
}
.dash-type-table td.dash-type-diff .diff-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 100%;
}

.diff-num { flex: 1; text-align: center; white-space: nowrap; }
.diff-divider { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.diff-pct { flex: 0 0 48px; text-align: center; font-size: 11px; white-space: nowrap; padding: 0; }

.dash-diff-renewal { color: var(--text); }
.dash-diff-renewal .diff-pct { color: var(--text); }

.dash-summary-block { grid-column: 1 / -1; width: 100%; }
.dash-summary-block .dash-type-table { width: 100%; table-layout: fixed; }
.dash-summary-block .dash-type-table th,
.dash-summary-block .dash-type-table td { width: 25%; }

/* === DATE SHORTCUTS === */
.date-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 6px;
}

.date-shortcut-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 11.5px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
}

.date-shortcut-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.date-shortcut-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === COLUMN FILTER BUTTON === */
.btn-col-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
}

.btn-col-filter:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-col-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-col-filter.has-filters { border-color: var(--primary); color: var(--primary); }
.btn-col-filter.active.has-filters { background: var(--primary); color: #fff; }

.filter-funnel { font-size: 11px; }

/* Column filter arrow */
.col-filter-arrow-wrap { display: none; margin-right: 4px; }
.col-filters-visible .col-filter-arrow-wrap { display: inline-block; }
.col-filter-arrow {
  cursor: pointer; font-size: 11px; color: #94a3b8; transition: all 0.15s;
  vertical-align: middle; padding: 4px 6px; border-radius: 4px;
  background: rgba(59,130,246,0.08);
}
.col-filter-arrow:hover { color: var(--primary); background: rgba(59,130,246,0.18); }
.col-filter-arrow.active { color: #fff; background: var(--primary); font-weight: 700; }

/* Column filter dropdown */
.col-filter-dropdown {
  z-index: 500;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  width: 220px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  direction: rtl;
  font-size: 13px;
}
.col-filter-search {
  margin: 8px 8px 4px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  font-family: inherit;
  direction: rtl;
}
.col-filter-search:focus { border-color: var(--primary); }
.col-filter-btn-bar {
  display: flex; gap: 4px; padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
.col-filter-action-btn {
  flex: 1; padding: 4px 0; border: none; border-radius: 5px;
  background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
}
.col-filter-action-btn:hover { background: #e2e8f0; }
.col-filter-list {
  overflow-y: auto; padding: 4px 8px 8px; flex: 1;
}
.col-filter-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 4px; border-radius: 4px; cursor: pointer;
  font-size: 12px; color: #334155;
}
.col-filter-item:hover { background: #f8fafc; }
.col-filter-item input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: var(--primary); flex-shrink: 0;
}

/* === COMPANY REPORT CARDS === */
.company-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

.cc-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow: hidden;
}

.cc-card-empty { opacity: 0.5; }

.cc-card-summary {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
  border: none;
}

.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.cc-card-summary .cc-header { border-bottom-color: rgba(255,255,255,0.15); }

.cc-name {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.cc-card-summary .cc-name { color: #fff; font-size: 18px; }

.cc-badge {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a5f;
  background: #eff6ff;
  padding: 4px 14px;
  border-radius: 20px;
  direction: ltr;
}

.cc-totals-row {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
}

.cc-total-box { flex: 1; text-align: center; }
.cc-total-label { font-size: 12px; opacity: 0.8; margin-bottom: 4px; }
.cc-total-val { font-size: 24px; font-weight: 800; direction: ltr; }
.cc-total-val.cc-prev { opacity: 0.7; }

.cc-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.cc-period { padding: 0; }
.cc-period:first-child { border-left: 1px solid #f1f5f9; }

.cc-period-title {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px 6px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.cc-table th {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.cc-table td {
  padding: 5px 12px;
  border-bottom: 1px solid #f8fafc;
  color: #334155;
}

.cc-rate { color: #64748b; font-size: 11.5px; }
.cc-val { direction: ltr; text-align: left; }
.cc-val-bold { direction: ltr; text-align: left; font-weight: 700; color: #1e293b; }

.cc-subtotal td {
  background: #f0f9ff;
  font-weight: 600;
  border-bottom: 1px solid #e0f2fe;
}

.cc-grand td {
  background: #1e3a5f;
  color: #fff !important;
  font-weight: 700;
}

.cc-grand .cc-val-bold { color: #fff; }

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .dashboard-tables-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar-categories { grid-template-columns: repeat(4, 1fr); }
}

/* === MOBILE HEADER (hidden on desktop) === */
.mobile-header { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  /* Hide collapse button on mobile */
  .sidebar-collapse-btn { display: none !important; }
  .sidebar.collapsed { width: 270px; min-width: 270px; }

  /* --- Mobile Header --- */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0; right: 0; left: 0;
    height: 56px;
    background: #0c1222;
    color: #fff;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .mobile-hamburger {
    background: none; border: none; color: #fff;
    font-size: 24px; cursor: pointer; padding: 4px;
    display: flex; align-items: center; justify-content: center;
  }
  .mobile-title { font-size: 16px; font-weight: 700; }

  /* --- Sidebar as slide-in overlay --- */
  .sidebar {
    display: flex !important;
    position: fixed;
    right: 0; top: 0;
    height: 100vh; width: 270px;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.5);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- Main content --- */
  .app-main {
    padding: 64px 10px 16px !important;
    width: 100%;
    min-width: 0;
  }

  /* --- Tables --- */
  .table-container { border-radius: 8px; }
  .table-container table { font-size: 12px; }
  .table-container th { padding: 8px; font-size: 10px; }
  .table-container td { padding: 6px 8px; }

  /* --- Modals --- */
  .modal { z-index: 400 !important; }
  .modal-content {
    width: 98% !important;
    max-width: 100% !important;
    max-height: calc(100vh - 68px) !important;
    margin: 60px 4px 8px !important;
    border-radius: 12px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .modal-excel {
    max-width: 100% !important;
    max-height: calc(100vh - 68px) !important;
    margin: 60px 4px 8px !important;
    border-radius: 12px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .modal-body {
    max-height: none;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
  }

  /* --- Forms --- */
  .form-row { grid-template-columns: 1fr; }
  .field-toggles { grid-template-columns: repeat(2, 1fr); }
  .excel-columns { grid-template-columns: 1fr; }
  .excel-financial { grid-template-columns: 1fr; }
  .excel-options { flex-wrap: wrap; }
  .excel-form { padding: 12px; }
  .excel-search { padding: 10px; }

  /* --- Stats bar --- */
  .stats-bar { gap: 6px; flex-wrap: wrap; }
  .stat-card { min-width: 90px; padding: 10px 12px; }
  .stats-bar-categories { grid-template-columns: repeat(2, 1fr); gap: 8px; overflow: hidden; }
  .stats-bar-categories > :last-child { grid-column: 1 / -1; }
  .stat-card-cat { padding: 10px 12px; }
  .stat-cat-total { font-size: 16px; }
  .stat-cat-new, .stat-cat-renewal { font-size: 10px; }
  .stat-cat-new b, .stat-cat-renewal b { font-size: 10px; }

  /* --- Filter bars --- */
  .filters-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }
  .filters-bar .input-search,
  .filters-bar .input-select {
    width: 100%; min-width: 0;
  }
  .report-date-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch !important;
    padding: 12px;
  }
  .report-date-bar input[type="date"] {
    width: 100% !important; flex: none;
  }
  .report-date-bar .btn { width: 100%; }

  /* --- Home dashboard --- */
  .greeting-bar { font-size: 20px; }
  .home-date-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }
  .home-date-bar input[type="date"] { width: 100%; }

  .hero-banner {
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
    border-radius: 14px;
    min-height: auto;
  }
  .hero-left h2 { font-size: 20px; }
  .hero-stats { flex-wrap: nowrap; gap: 4px; justify-content: center; width: 100%; }
  .hero-stat-card { min-width: 0; flex: 1; padding: 8px 6px; }
  .hero-stat-icon { font-size: 16px; margin-bottom: 4px; }
  .hero-stat-value { font-size: 19px; letter-spacing: -0.5px; }
  .hero-stat-label { font-size: 9px; }
  .hero-stat-sep { display: none; }

  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; overflow: hidden; }
  .cat-grid > :last-child { grid-column: 1 / -1; max-width: 70%; margin: 0 auto; }
  .cat-card { padding: 10px 8px; border-radius: 10px; }
  .cat-card-header { margin-bottom: 6px; }
  .cat-card-total { font-size: 18px; margin-bottom: 6px; }
  .cat-card-title { font-size: 11.5px; gap: 4px; }
  .cat-card-title .ti { font-size: 14px; }
  .cat-bar { margin: 5px 0 4px; }
  .cat-card-split { gap: 3px; }
  .cat-split-row { font-size: 10.5px; }
  .cat-split-val { font-size: 10.5px; }
  .cat-split-pct { font-size: 9.5px; padding: 1px 4px; margin-right: 3px; }

  .bento-2 { grid-template-columns: 1fr; }

  /* --- YoY --- */
  .yoy-kpis {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .yoy-kpi { flex: 1 1 120px; min-width: 120px; padding: 8px; }
  .yoy-kpi-val { font-size: 22px; }
  .yoy-kpi-prev .yoy-kpi-val { font-size: 18px; }
  .yoy-delta-box { margin: 4px auto; padding: 10px 16px; }
  .yoy-delta-pct { font-size: 15px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
  .catbreak-legend { font-size: 10px; gap: 8px; }

  /* --- Company report cards --- */
  .cc-tables { grid-template-columns: 1fr; }
  .cc-header { padding: 10px 14px; }
  .cc-name { font-size: 14px; }
  .cc-badge { font-size: 12px; padding: 3px 10px; }
  .cc-totals-row { padding: 12px 14px; }
  .cc-total-val { font-size: 20px; }
  .cc-table { font-size: 11px; }
  .cc-table th, .cc-table td { padding: 4px 8px; }
  .cc-period:first-child { border-left: none; border-bottom: 1px solid #f1f5f9; }

  /* --- Dashboard summary / tables --- */
  .dashboard-summary { grid-template-columns: repeat(2, 1fr); }
  .dashboard-tables-grid { grid-template-columns: 1fr; }

  /* --- Recent transactions table (brand-v6) --- */
  .recent-tx-table { font-size: 11px; }
  .recent-tx-table th { padding: 6px 8px; font-size: 10px; }
  .recent-tx-table td { padding: 8px; }

  /* --- Bottom filter bar (renewals, export, etc.) --- */
  .renewals-filter-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .renewals-filter-bar .input-select { max-width: 100%; flex: 1; min-width: 120px; }
  .btn-export-pdf { margin-right: 0; width: 100%; justify-content: center; }

  /* --- Performers chart subtitle --- */
  .topbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .topbar-left { justify-content: center; }

  /* --- Searchable dropdowns --- */
  .searchable-list { max-height: 150px; }

  /* --- General spacing --- */
  .section-header { flex-wrap: wrap; gap: 8px; }
  .section-title { font-size: 16px; }
}

/* =========================================================
   HOME DASHBOARD (brand-v6)
   ========================================================= */
.home-section { padding-bottom: 32px; min-width: 0; max-width: 100%; overflow-x: hidden; }

.home-date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.home-date-bar .date-shortcuts {
  margin-top: 0;
  flex: 1;
}

/* Admin page — tabs at the top, panels below */
.admin-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.admin-page-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 0 8px;
}
.admin-tab {
  background: transparent;
  border: none;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-tab:hover { color: #1e293b; background: rgba(255,255,255,0.5); }
.admin-tab.active {
  color: #1e3a8a;
  border-bottom-color: #3b82f6;
  background: #fff;
}
.admin-tab-badge {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.admin-tab-panel {
  padding: 20px 24px;
  min-height: 300px;
}

/* Floating bug-report button (bottom-left, RTL) */
.floating-bug-btn {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s, box-shadow 0.18s;
}
.floating-bug-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.6);
}

/* Bug-report admin cards */
.bug-report-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}
.bug-report-card.resolved { background: #f8fafc; opacity: 0.75; }
.bug-report-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f1f5f9; padding-bottom: 6px; margin-bottom: 8px;
}
.bug-report-head strong { color: #0f172a; font-size: 14px; }
.bug-report-meta { font-size: 11px; color: #94a3b8; }
.bug-report-status {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}
.bug-report-status.open    { background: #fee2e2; color: #b91c1c; }
.bug-report-status.resolved { background: #d1fae5; color: #047857; }
.bug-report-desc {
  white-space: pre-wrap;
  font-size: 13px;
  color: #1e293b;
  padding: 6px 0;
}
.bug-report-page {
  font-size: 11px;
  font-family: monospace;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 4px;
  color: #475569;
  margin-top: 6px;
  word-break: break-all;
  direction: ltr;
}
.bug-report-actions {
  display: flex; gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

/* Sidebar badge for open bug count */
.nav-item .nav-badge {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 6px;
}

/* VAT & Income-target admin — year row */
.cfg-year-row {
  display: flex; gap: 8px; align-items: center;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 6px 10px;
}
.cfg-year-row strong { min-width: 50px; }
.cfg-year-row input[type="number"] {
  width: 110px; padding: 4px 8px;
  border: 1px solid #cbd5e1; border-radius: 4px;
}

/* Team report — per-metric new/renewal breakdown inside each card */
.income-card.team-card { min-width: 340px; }
.team-card-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.team-metric-row {
  display: grid;
  grid-template-columns: 70px 90px 1fr 1fr;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.team-metric-row:last-child { border-bottom: none; }
.team-metric-row-emph {
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 6px;
  font-weight: 700;
  border-bottom: none;
  margin-bottom: 4px;
}
.team-metric-label  { color: #0f172a; font-weight: 600; }
.team-metric-total  { color: #1e3a8a; font-weight: 700; direction: ltr; text-align: right; }
.team-metric-new    { color: #059669; font-variant-numeric: tabular-nums; }
.team-metric-ren    { color: #d97706; font-variant-numeric: tabular-nums; }
.team-metric-row small { color: #94a3b8; font-weight: 600; margin-right: 2px; }

/* Dashboard tables — צפי סוף שנה column */
.dash-type-forecast-hd {
  background: #312e81 !important;
  color: #ffffff !important;
  border-left: 2px solid #3b82f6;
  font-weight: 800;
}
.dash-type-table td.dash-type-forecast {
  background: #f8fafc;
  font-weight: 700;
  color: #1e3a8a;
  border-left: 2px solid #3b82f6;
  text-align: left;
  direction: ltr;
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
}

/* === Income Report — card view === */
.income-summary-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.income-sum-card {
  display: flex; flex-direction: column;
  padding: 8px 14px;
  background: #f8fafc;
  border-radius: 8px;
  min-width: 120px;
}
.income-sum-card.income-sum-primary {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #fff;
}
.income-sum-card.income-sum-primary .income-sum-lbl { color: rgba(255,255,255,0.85); }
.income-sum-lbl { font-size: 11px; color: #64748b; font-weight: 600; margin-bottom: 2px; }
.income-sum-val { font-size: 18px; font-weight: 800; color: #0f172a; direction: ltr; text-align: right; }
.income-sum-card.income-sum-primary .income-sum-val { color: #fff; }

.income-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.income-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.18s, transform 0.18s;
}
.income-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.income-card.rank-1 { border-color: #fbbf24; background: linear-gradient(180deg, #fffbeb 0%, #fff 70%); }
.income-card-head {
  display: flex; justify-content: space-between; align-items: center;
}
.income-card-name {
  font-size: 15px; font-weight: 800; color: #0f172a;
}
.income-card-rank {
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #64748b;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
}
.income-card.rank-1 .income-card-rank { background: #fbbf24; color: #fff; }
.income-card.rank-2 .income-card-rank { background: #cbd5e1; color: #fff; }
.income-card.rank-3 .income-card-rank { background: #d97706; color: #fff; }

.income-card-amount {
  font-size: 26px; font-weight: 800; color: #0f172a;
  direction: ltr; text-align: right;
  letter-spacing: -0.5px;
}
.income-card-bar-wrap {
  display: flex; flex-direction: column; gap: 4px;
}
.income-card-bar-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #64748b; font-weight: 600;
}
.income-card-bar-pct { font-weight: 800; }
.income-card-bar {
  background: #f1f5f9; border-radius: 10px; height: 8px; overflow: hidden; position: relative;
}
.income-card-bar-fill {
  height: 100%; border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.income-card-bar-fill.tier-red    { background: linear-gradient(90deg, #ef4444, #f87171); }
.income-card-bar-fill.tier-orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.income-card-bar-fill.tier-green  { background: linear-gradient(90deg, #10b981, #34d399); }
.income-card-bar-fill.tier-gold   { background: linear-gradient(90deg, #f59e0b, #fbbf24, #fde68a); box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.income-card-bar-pct.tier-red    { color: #dc2626; }
.income-card-bar-pct.tier-orange { color: #d97706; }
.income-card-bar-pct.tier-green  { color: #059669; }
.income-card-bar-pct.tier-gold   { color: #b45309; }

.income-card-breakdown {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #64748b;
  border-top: 1px solid var(--border-light); padding-top: 8px;
}
.income-card-breakdown b { color: #0f172a; font-weight: 700; }

/* Custom Hebrew/RTL datepicker popup */
.he-datepicker { cursor: pointer; background: #fff; }
.he-datepicker-popup {
  position: absolute;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(15,23,42,0.12);
  padding: 10px;
  z-index: 1000;
  width: 260px;
  direction: rtl;
  font-family: inherit;
  font-size: 13px;
}
.hdp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 6px;
}
.hdp-nav {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1;
  color: #475569; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.hdp-nav:hover { background: #e0e7ff; color: #2563eb; }
.hdp-month { font-weight: 700; font-size: 14px; color: #0f172a; }
.hdp-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
  color: #94a3b8; font-size: 11px; font-weight: 600;
}
.hdp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; padding-top: 6px;
}
.hdp-day {
  background: none; border: none; padding: 6px 0;
  border-radius: 6px; cursor: pointer;
  font-size: 12.5px; color: #0f172a;
  transition: background 0.1s, color 0.1s;
}
.hdp-day:hover { background: #eff6ff; }
.hdp-other { color: #cbd5e1; }
.hdp-today { color: #2563eb; font-weight: 700; }
.hdp-selected { background: #3b82f6 !important; color: #fff !important; font-weight: 700; }
.hdp-foot {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid #f1f5f9;
  display: flex; gap: 8px; justify-content: space-between;
}
.hdp-foot button {
  background: none; border: none; color: #3b82f6;
  cursor: pointer; font-size: 12px; font-weight: 600; padding: 2px 6px;
}
.hdp-foot button:hover { color: #1e3a8a; text-decoration: underline; }

/* Side-arrow month nav for date inputs */
.date-month-group {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fff; height: 34px;
}
.date-month-group input[type="date"] {
  border: none; border-radius: 0; margin: 0; height: 100%;
  border-inline: 1px solid var(--border);
}
.date-month-group input[type="date"]:focus { outline: none; box-shadow: none; }
.date-month-group .month-arrow {
  background: #f8fafc; border: none; color: #475569;
  font-size: 18px; font-weight: 700; padding: 0 10px;
  cursor: pointer; line-height: 1; min-width: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.date-month-group .month-arrow:hover { background: #e0e7ff; color: var(--primary); }
.date-month-group .month-arrow:active { background: #c7d2fe; }
/* Hide native ▲▼ spinner inside the wrapped date input — we use ‹ › buttons instead */
.date-month-group input[type="date"]::-webkit-inner-spin-button,
.date-month-group input[type="date"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0; display: none;
}


/* Agent mode toggle */
.agent-mode-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.agent-mode-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: all 0.15s;
  white-space: nowrap;
}
.agent-mode-btn:hover { color: #334155; }
.agent-mode-btn.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.3);
}

/* Greeting */
.greeting-bar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  font-size: 28px; font-weight: 500; color: #1e293b; letter-spacing: -0.5px;
}
.greeting-bar strong { font-weight: 800; color: #0f172a; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.topbar-right h1 { font-size: 24px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.date-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 12px;
  background: #fff; font-size: 13px;
  color: #475569; font-weight: 500;
  border: 1px solid #e8ecf4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.date-pill .ti { font-size: 16px; color: #94a3b8; }

/* Hero banner */
.hero-banner {
  background: linear-gradient(135deg, #0f2554 0%, #1d4ed8 55%, #3b82f6 100%);
  border-radius: 22px; padding: 32px 36px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; position: relative; overflow: hidden;
  min-height: 148px; gap: 24px;
}
.hero-banner::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-banner::after {
  content: ''; position: absolute; bottom: -80px; left: 120px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.hero-left { position: relative; z-index: 1; }
.hero-period-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.14); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 5px 13px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.92);
  margin-bottom: 12px;
}
.hero-left h2 { font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 5px; letter-spacing: -0.5px; }
.hero-left p { font-size: 13px; color: rgba(255,255,255,0.6); }
.hero-stats { position: relative; z-index: 1; display: flex; align-items: stretch; gap: 4px; }
.hero-stat-card {
  text-align: center; padding: 18px 28px;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 16px;
  min-width: 130px;
}
.hero-stat-card.hero-stat-total { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.3); }
.hero-stat-icon { font-size: 20px; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.hero-stat-value { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -1px; line-height: 1; }
.hero-stat-label { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 5px; font-weight: 500; }
.hero-stat-sep { width: 1px; background: rgba(255,255,255,0.12); margin: 8px 4px; border-radius: 1px; align-self: stretch; }

/* Donut pair (current vs prev period) — stacked vertically so the card column stays narrow */
.donut-pair { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.donut-pair-col {
  width: 100%; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  height: 200px;
}
.donut-pair-label { font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 2px; letter-spacing: 0.2px; }
.donut-pair-col > div:last-child { width: 100%; flex: 1; min-height: 0; overflow: hidden; }

/* Category stats grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr) 0.65fr;
  gap: 14px; margin-bottom: 24px;
}
.cat-card {
  background: #fff; border-radius: 16px; padding: 16px 14px;
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s; min-width: 0;
}
.cat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-2px); }
.cat-card-stripe { position: absolute; top: 0; right: 0; left: 0; height: 3px; }
.cat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cat-card-title { font-size: 13px; font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 6px; }
.cat-card-title .ti { font-size: 16px; }
.cat-card-total { font-size: 22px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; line-height: 1.15; margin-bottom: 10px; direction: ltr; text-align: right; }
.cat-card-total small { font-size: 12px; font-weight: 500; color: #94a3b8; letter-spacing: 0; }
.cat-card-split { display: flex; flex-direction: column; gap: 6px; }
.cat-split-row { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: #475569; }
.cat-split-label { font-weight: 500; }
.cat-split-val { font-weight: 700; color: #0f172a; direction: ltr; }
.cat-split-pct { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; margin-right: 6px; }
.cat-split-pct.green { background: #ecfdf5; color: #059669; }
.cat-split-pct.blue  { background: #eff6ff; color: #2563eb; }
.cat-bar { height: 6px; border-radius: 3px; background: #f1f5f9; margin: 10px 0 6px; overflow: hidden; display: flex; }
.cat-bar-fill { height: 100%; transition: width 0.5s; }
.cat-card-unpaid { background: linear-gradient(135deg, #fef2f2, #fff5f5); border-color: #fecaca; padding: 12px 14px; align-self: start; }
.cat-card-unpaid .cat-card-total { color: #dc2626; font-size: 18px; margin-bottom: 6px; }
.cat-card-unpaid .cat-card-header { margin-bottom: 6px; }
.cat-card-unpaid .cat-card-split { gap: 3px; }
.cat-card-unpaid .cat-split-row { font-size: 10.5px; }

/* Bento grid rows */
.bento { display: grid; gap: 18px; margin-bottom: 18px; }
.bento-2 { grid-template-columns: 1.5fr 1fr; }
.bento-3 { grid-template-columns: 1fr 1.4fr 1fr; min-width: 0; }
.bento-3 > .card { min-width: 0; }
.bento-2:has(.yoy-card + .yoy-card) { grid-template-columns: 1fr 1fr; }

/* Cards */
.card { background: #fff; border-radius: 18px; border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid #f1f5f9;
}
.card-title { font-size: 15px; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.card-title .ti { color: #3b82f6; font-size: 18px; }
.card-subtitle { font-size: 12px; color: #94a3b8; font-weight: 500; }
.card-body { padding: 20px 24px; }

/* YoY comparison */
.yoy-kpis {
  display: flex; align-items: center; justify-content: center;
  gap: 0; padding: 20px 28px 4px; border-bottom: 1px solid #f1f5f9;
}
.yoy-kpi { flex: 1; text-align: center; padding: 12px 16px; }
.yoy-kpi-year { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: #94a3b8; margin-bottom: 6px; }
.yoy-kpi-current .yoy-kpi-year { color: #3b82f6; }
.yoy-kpi-val { font-size: 30px; font-weight: 800; color: #0f172a; letter-spacing: -1.5px; line-height: 1; }
.yoy-kpi-prev .yoy-kpi-val { color: #94a3b8; font-size: 24px; }
.yoy-kpi-label { font-size: 11px; color: #cbd5e1; margin-top: 5px; font-weight: 500; }
.yoy-delta-box { flex: 0 0 auto; text-align: center; padding: 14px 28px; border-right: 1px solid #f1f5f9; border-left: 1px solid #f1f5f9; border-radius: 14px; margin: 0 8px; }
.yoy-delta-box.up { background: #f0fdf4; }
.yoy-delta-box.down { background: #fff1f2; }
.yoy-delta-arrow { font-size: 22px; line-height: 1; }
.yoy-delta-box.up .yoy-delta-arrow { color: #10b981; }
.yoy-delta-box.down .yoy-delta-arrow { color: #ef4444; }
.yoy-delta-pct { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; margin-top: 2px; }
.yoy-delta-box.up .yoy-delta-pct { color: #10b981; }
.yoy-delta-box.down .yoy-delta-pct { color: #ef4444; }
.yoy-delta-sub { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; margin-top: 3px; }

/* Category breakdown legend */
.catbreak-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #64748b; font-weight: 500; }
.catbreak-legend span { display: flex; align-items: center; gap: 5px; }
.leg-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* Stat list (financial summary) */
.stat-list { display: flex; flex-direction: column; }
.stat-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #f5f7fa; }
.stat-item:last-child { border-bottom: none; }
.stat-icon-v6 { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon-v6 .ti { font-size: 18px; }
.stat-info { flex: 1; min-width: 0; }
.stat-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.stat-desc { font-size: 11.5px; color: #94a3b8; margin-top: 1px; }
.stat-val { font-size: 15px; font-weight: 700; color: #0f172a; text-align: left; direction: ltr; }

/* Status badges (brand-v6 style, namespaced to avoid conflicts) */
.sts { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 600; }
.sts::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sts-g { background: #ecfdf5; color: #059669; } .sts-g::before { background: #10b981; }
.sts-y { background: #fffbeb; color: #d97706; } .sts-y::before { background: #f59e0b; }
.sts-r { background: #fef2f2; color: #dc2626; } .sts-r::before { background: #ef4444; }
.sts-b { background: #eff6ff; color: #2563eb; } .sts-b::before { background: #3b82f6; }

/* Loading placeholder */
.loading { color: #94a3b8; font-size: 13px; padding: 30px; text-align: center; }

/* === MOBILE OVERRIDES FOR HOME DASHBOARD (must be last to override desktop rules) === */
@media (max-width: 768px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .cat-grid > :last-child {
    grid-column: 1 / -1;
    max-width: 70%;
    margin: 0 auto;
  }
  .cat-card { padding: 10px 8px !important; border-radius: 10px; }
  .cat-card-header { margin-bottom: 6px; }
  .cat-card-total { font-size: 18px !important; margin-bottom: 6px; }
  .cat-card-title { font-size: 11.5px !important; }
  .cat-card-title .ti { font-size: 14px !important; }
  .cat-bar { margin: 5px 0 4px; }
  .cat-card-split { gap: 3px; }
  .cat-split-row { font-size: 10.5px !important; }
  .cat-split-val { font-size: 10.5px !important; }
  .cat-split-pct { font-size: 9.5px !important; padding: 1px 4px; }
  .hero-banner { padding: 20px 16px !important; border-radius: 14px !important; }
  .hero-stats { flex-wrap: nowrap !important; gap: 4px !important; width: 100%; }
  .hero-stat-card { min-width: 0 !important; flex: 1; padding: 8px 6px !important; }
  .hero-stat-icon { font-size: 16px !important; margin-bottom: 4px; }
  .hero-stat-value { font-size: 19px !important; }
  .hero-stat-label { font-size: 9px !important; }
  .bento-2, .bento-3 { grid-template-columns: 1fr !important; }
  .yoy-kpis { flex-wrap: wrap !important; padding: 12px; }
  .yoy-kpi { flex: 1 1 120px; min-width: 120px; }
  .yoy-kpi-val { font-size: 22px !important; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }

  /* --- Modal: prevent header overlap + fix scroll --- */
  .modal {
    z-index: 400 !important;
  }
  .modal-content {
    margin-top: 60px !important;
    max-height: calc(100vh - 68px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .modal-excel {
    margin-top: 60px !important;
    max-height: calc(100vh - 68px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .modal-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    max-height: none;
  }
  /* Prevent background scroll when modal is open */
  body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
  }

  /* --- Financial summary spacing --- */
  .stat-item { gap: 10px; }
  .stat-name { margin-bottom: 2px; }
}
