/* ============================================
   SAHAJ COOLING ERP — Design System
   Light sidebar, Shadcn/Radix-inspired layout
   ============================================ */

:root {
  /* shadcn CSS variables (used by login page) */
  --radius: 0.65rem;
  --background: hsl(0 0% 100%);
  --foreground: hsl(222.2 84% 4.9%);
  --primary: hsl(221.2 83.2% 53.3%);
  --primary-foreground: hsl(210 40% 98%);
  --muted-foreground: hsl(215.4 16.3% 46.9%);
  --accent: hsl(210 40% 96.1%);
  --accent-foreground: hsl(222.2 47.4% 11.2%);
  --destructive: hsl(0 84.2% 60.2%);
  --border: hsl(214.3 31.8% 91.4%);
  --input: hsl(214.3 31.8% 91.4%);
  --ring: hsl(221.2 83.2% 53.3%);

  /* Brand Colors */
  --s-primary: #2C4190;
  --s-primary-light: #3a56b0;
  --s-primary-dark: #1e2d66;
  --s-accent: #E42626;
  --s-accent-light: #ff4444;
  --s-accent-dark: #b81e1e;

  /* Semantic Colors */
  --s-success: #2e7d32;
  --s-success-light: #e8f5e9;
  --s-warning: #ed6c02;
  --s-warning-light: #fff3e0;
  --s-error: #d32f2f;
  --s-error-light: #ffebee;
  --s-info: #0288d1;
  --s-info-light: #e1f5fe;

  /* Neutrals */
  --s-bg: #f5f5f5;
  --s-surface: #ffffff;
  --s-border: #e0e0e0;
  --s-text: #212121;
  --s-text-secondary: #666666;
  --s-text-disabled: #9e9e9e;
  --s-hover: #f0f0f0;
  --s-selected: #e8eaf6;

  /* Sidebar — light theme tokens */
  --s-sidebar-width: 16rem;
  --s-sidebar-collapsed: 3rem;
  --s-sidebar-bg: #E3F2FD;
  --s-sidebar-text: #222222;
  --s-sidebar-text-muted: rgba(34,34,34,0.5);
  --s-sidebar-accent: #d6e4f0;
  --s-sidebar-accent-fg: #1e3a5f;
  --s-sidebar-border: #e8e8e8;
  --s-sidebar-ring: rgba(44,65,144,0.3);
  --s-header-height: 4rem;

  /* Spacing */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-2xl: 48px;

  /* Typography */
  --s-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --s-font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Shadows */
  --s-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --s-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --s-shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --s-shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --s-shadow-inset: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);

  /* Radius */
  --s-radius: 0.625rem;
  --s-radius-sm: 0.375rem;
  --s-radius-md: 0.625rem;
  --s-radius-lg: 0.75rem;
  --s-radius-xl: 1rem;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--s-font); color: var(--s-text); background: var(--s-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--s-primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { text-decoration: underline; }

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 600; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; }
.text-caption { font-size: 0.75rem; color: var(--s-text-secondary); }
.text-body2 { font-size: 0.875rem; }
.text-overline { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 1px; color: var(--s-text-secondary); }

/* ---- Grid System (12-col) ---- */
.s-grid { display: grid; gap: var(--s-md); }
.s-grid-2 { grid-template-columns: repeat(2, 1fr); }
.s-grid-3 { grid-template-columns: repeat(3, 1fr); }
.s-grid-4 { grid-template-columns: repeat(4, 1fr); }
.s-grid-6 { grid-template-columns: repeat(6, 1fr); }
.s-grid-12 { grid-template-columns: repeat(12, 1fr); }
.s-col-1 { grid-column: span 1; }
.s-col-2 { grid-column: span 2; }
.s-col-3 { grid-column: span 3; }
.s-col-4 { grid-column: span 4; }
.s-col-6 { grid-column: span 6; }
.s-col-8 { grid-column: span 8; }
.s-col-12 { grid-column: span 12; }
@media (max-width: 768px) {
  .s-grid-2, .s-grid-3, .s-grid-4, .s-grid-6 { grid-template-columns: 1fr; }
  .s-col-1, .s-col-2, .s-col-3, .s-col-4, .s-col-6, .s-col-8 { grid-column: span 1; }
}

/* ---- Flex Utilities ---- */
.s-stack { display: flex; flex-direction: column; gap: var(--s-md); }
.s-row { display: flex; flex-direction: row; gap: var(--s-md); align-items: center; }
.s-row-between { display: flex; justify-content: space-between; align-items: center; }
.s-gap-sm { gap: var(--s-sm); }
.s-gap-xs { gap: var(--s-xs); }
.s-wrap { flex-wrap: wrap; }

/* ---- Spacing ---- */
.s-p-sm { padding: var(--s-sm); }
.s-p-md { padding: var(--s-md); }
.s-p-lg { padding: var(--s-lg); }
.s-p-xl { padding: var(--s-xl); }
.s-mb-sm { margin-bottom: var(--s-sm); }
.s-mb-md { margin-bottom: var(--s-md); }
.s-mb-lg { margin-bottom: var(--s-lg); }
.s-mt-md { margin-top: var(--s-md); }

/* ---- Buttons ---- */
.s-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid transparent;
  font-family: var(--s-font); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: background 0.15s, color 0.15s; line-height: 1.4;
  background: var(--s-primary); color: #fff; border-radius: var(--s-radius);
}
.s-btn:hover { background: var(--s-primary-light); }
.s-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.s-btn--outline { background: transparent; color: var(--s-primary); border-color: var(--s-primary); }
.s-btn--outline:hover { background: var(--s-selected); }
.s-btn--text { background: transparent; color: var(--s-primary); border: none; padding: 8px 12px; }
.s-btn--text:hover { background: var(--s-hover); }
.s-btn--danger { background: var(--s-error); }
.s-btn--danger:hover { background: var(--s-accent-dark); }
.s-btn--text.s-btn--danger { background: transparent; color: var(--s-error); }
.s-btn--text.s-btn--danger:hover { background: color-mix(in srgb, var(--s-error) 10%, transparent); color: var(--s-error); }
.s-btn--success { background: var(--s-success); }
.s-btn--sm { padding: 4px 10px; font-size: 0.8125rem; }
.s-btn--icon { padding: 6px; min-width: 32px; justify-content: center; }

/* ---- Autocomplete ---- */
.s-autocomplete { position: relative; }
.s-autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1050;
  max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--s-border);
  border-radius: var(--s-radius); box-shadow: var(--s-shadow-md);
  margin-top: 2px;
}
.s-autocomplete-option {
  padding: 8px 12px; font-size: 0.84rem; cursor: pointer;
  transition: background 0.1s ease; background: #fff;
}
.s-autocomplete-option:hover, .s-autocomplete-option--active { background: #e8f0fe; }

/* Allow dropdowns/autocomplete to escape parent clipping — only when open */
td:has(.s-autocomplete), td:has(.s-multiselect), td:has(.s-custom-date) { overflow: visible !important; }
.s-table:has(.s-autocomplete), .s-table-edit:has(.s-autocomplete), .s-table:has(.s-multiselect), .s-table-edit:has(.s-multiselect) { overflow: visible !important; }
/* SSelect (`.s-custom-select-*`) renders its dropdown as position:fixed with
   JS-computed coordinates, so it doesn't need overflow:visible on ancestors.
   Removing the s-custom-select-backdrop entries here keeps the list page's
   sticky pagination contained when an inline status SSelect opens in a row. */
.s-table-wrap:has(.s-autocomplete-dropdown), .s-table-wrap:has(.s-multiselect-backdrop) { overflow: visible !important; }
.s-card:has(.s-autocomplete-dropdown), .s-card:has(.s-multiselect-backdrop) { overflow: visible !important; }
.lead-panel:has(.s-autocomplete), .lead-panel:has(.s-multiselect), .lead-panel:has(.s-custom-date) { overflow: visible !important; }
.lead-panel-body:has(.s-autocomplete), .lead-panel-body:has(.s-multiselect), .lead-panel-body:has(.s-custom-date) { overflow: visible !important; }
/* ---- Custom Themed Dropdowns ---- */
.s-multiselect, .s-custom-select { position: relative; }
.s-multiselect-dropdown, .s-custom-select-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 1050; max-height: 200px; overflow-y: auto; background: #fff; border: 1px solid var(--s-border); border-radius: var(--s-radius); box-shadow: var(--s-shadow-md); margin-top: 2px; padding: 0; scrollbar-width: none; -ms-overflow-style: none; }
.s-multiselect-dropdown::-webkit-scrollbar, .s-custom-select-dropdown::-webkit-scrollbar { display: none; }
.s-multiselect-backdrop, .s-custom-select-backdrop { position: fixed; inset: 0; z-index: 1049; }
.s-custom-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 6px; cursor: pointer; padding: 8px 12px; border: 1px solid var(--s-border); font-family: var(--s-font); font-size: 0.875rem; background: var(--s-surface); color: var(--s-text); border-radius: var(--s-radius); transition: border-color 0.15s, box-shadow 0.15s; width: 100%; user-select: none; min-height: 38px; }
.s-custom-select-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.s-custom-select-trigger:hover { border-color: #bbb; }
.s-custom-select-trigger.open { border-color: var(--s-primary); box-shadow: 0 0 0 2px rgba(44,65,144,0.15); }
.s-custom-select-trigger svg { width: 14px; height: 14px; color: var(--s-text-secondary); flex-shrink: 0; transition: transform 0.15s; }
.s-custom-select-trigger.open svg { transform: rotate(180deg); }
.s-custom-select-option { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; font-size: 0.84rem; color: var(--s-text); transition: background 0.1s; }
.s-custom-select-option:hover { background: var(--s-hover); }
.s-custom-select-option.selected { background: var(--s-selected); color: var(--s-primary); font-weight: 500; }
.s-custom-select-option .check-icon { width: 14px; height: 14px; color: var(--s-primary); }

/* ---- Custom Themed Date Picker ---- */
.s-custom-date { position: relative; }
.s-custom-date-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 8px 12px; border: 1px solid var(--s-border); font-family: var(--s-font); font-size: 0.875rem; background: var(--s-surface); color: var(--s-text); border-radius: var(--s-radius); transition: border-color 0.15s, box-shadow 0.15s; width: 100%; user-select: none; }
.s-custom-date-trigger:hover { border-color: #bbb; }
.s-custom-date-trigger.open { border-color: var(--s-primary); box-shadow: 0 0 0 2px rgba(44,65,144,0.15); }
.s-custom-date-trigger svg { width: 16px; height: 16px; color: var(--s-text-secondary); flex-shrink: 0; }
.s-custom-date-trigger .date-text { flex: 1; }
.s-custom-date-trigger .date-placeholder { color: var(--s-text-disabled); }
.s-custom-date-popup { position: absolute; top: 100%; left: 0; z-index: 1050; background: #fff; border: 1px solid var(--s-border); border-radius: var(--s-radius); box-shadow: var(--s-shadow-md); margin-top: 2px; padding: 12px; min-width: 280px; }
.s-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.s-cal-header span { font-size: 0.875rem; font-weight: 600; color: var(--s-text); }
.s-cal-nav { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; background: none; cursor: pointer; border-radius: var(--s-radius-sm); color: var(--s-text-secondary); font-size: 16px; }
.s-cal-nav:hover { background: var(--s-hover); color: var(--s-text); }
.s-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.s-cal-dow { font-size: 0.7rem; font-weight: 600; color: var(--s-text-disabled); padding: 4px 0; }
.s-cal-day { font-size: 0.8rem; padding: 6px 0; border-radius: var(--s-radius-sm); cursor: pointer; color: var(--s-text); transition: background 0.1s; border: none; background: none; }
.s-cal-day:hover { background: var(--s-hover); }
.s-cal-day.other-month { color: var(--s-text-disabled); }
.s-cal-day.today { font-weight: 700; color: var(--s-primary); }
.s-cal-day.selected { background: var(--s-primary); color: #fff; font-weight: 600; }
.s-cal-day.selected:hover { background: var(--s-primary-light); }
.s-cal-today-btn { display: block; width: 100%; margin-top: 8px; padding: 6px; border: none; background: none; color: var(--s-primary); font-size: 0.78rem; font-weight: 500; cursor: pointer; border-radius: var(--s-radius-sm); }
.s-cal-today-btn:hover { background: var(--s-selected); }
/* .lead-panel-head { background: var(--s-sidebar-bg) !important; } */

/* ---- Shared Panel / Form Layout ---- */
.lead-form { display: flex; flex-direction: column; gap: 12px; }
.lead-panel { margin-bottom: 6px; background: #fff; border: 1px solid var(--s-border); border-radius: 8px; overflow: hidden; }
.lead-panel-head { background: #f8f9fb; padding: 8px 16px; border-bottom: 1px solid var(--s-border); font-size: 0.8rem; font-weight: 600; color: var(--s-primary); text-transform: uppercase; letter-spacing: 0.4px; }
.lead-panel-body { padding: 12px 16px; }
.lead-panel-body .s-grid { gap: 8px 12px; }
.lead-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lead-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 16px; background: #f8f9fb; border: 1px solid var(--s-border); border-radius: 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f0f1f3; font-size: 0.85rem; }
.detail-label { color: var(--s-text-secondary); font-weight: 500; }
.detail-value { color: var(--s-text); font-weight: 600; text-align: right; }
@media (max-width: 900px) { .lead-two-col { grid-template-columns: 1fr; } }

/* ---- Form Controls ---- */
.s-field { display: flex; flex-direction: column; gap: 6px; }
.s-label { font-size: 0.8125rem; font-weight: 500; color: var(--s-text-secondary); }
.s-input, .s-select, .s-textarea {
  padding: 8px 12px; border: 1px solid var(--s-border);
  font-family: var(--s-font); font-size: 0.875rem;
  background: var(--s-surface); color: var(--s-text);
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
  border-radius: var(--s-radius);
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.s-input:focus, .s-select:focus, .s-textarea:focus {
  outline: none; border-color: var(--s-primary); box-shadow: 0 0 0 2px rgba(44,65,144,0.15);
}
.s-input:disabled, .s-select:disabled, .s-textarea:disabled {
  background: #fff; cursor: not-allowed; color: var(--s-text-disabled);
}
.s-input:read-only, .s-textarea:read-only,
.s-input--readonly, .s-input--readonly:focus {
  background: #f3f4f6; cursor: not-allowed; color: var(--s-text-secondary);
  border-color: var(--s-border); box-shadow: none;
}
.s-btn:focus-visible, .s-tab:focus-visible, .s-pagination button:focus-visible, .s-nav-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--s-surface), 0 0 0 4px rgba(44,65,144,0.3);
  transition: box-shadow 0.15s;
}
@keyframes s-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.s-input--error { border-color: var(--s-error); animation: s-shake 0.3s ease; }
.s-input--changed { background-color: #fef3c7; border-color: #f59e0b; font-weight: 800; color: #78350f; letter-spacing: 0.01em; }
.s-helper { font-size: 0.75rem; color: var(--s-text-secondary); }
.s-error-text { font-size: 0.75rem; color: var(--s-error); }
.s-textarea { min-height: 80px; resize: vertical; }
.s-checkbox-row { display: flex; align-items: center; gap: 8px; }
.s-section-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--s-text);
  margin: 0; padding-bottom: 0.25rem;
}
.s-switch { position: relative; width: 40px; height: 22px; }

/* ---- Cards / Paper ---- */
.s-card, .s-paper {
  background: var(--s-surface); border: 1px solid var(--s-border);
  padding: var(--s-md); box-shadow: var(--s-shadow-sm);
  border-radius: var(--s-radius);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.s-card--elevated { box-shadow: var(--s-shadow); }
.s-card--elevated:hover { box-shadow: var(--s-shadow-md); transform: translate3d(0, -1px, 0); }
.s-card--form { padding: var(--s-lg); }

.s-list-page > .s-card { padding: 0; border-radius: var(--s-radius); }

/* ---- Editable Table (Excel-like) ---- */
.s-table-edit { width: 100%; border-collapse: collapse; font-size: 0.82rem; table-layout: auto; }
.s-table-edit th {
  padding: 10px 10px; background: #f0f0f0; border: 1px solid #d0d0d0;
  font-weight: 600; font-size: 0.75rem; color: var(--s-text-secondary);
  text-align: center; white-space: nowrap; user-select: none;
}
.s-table-edit td {
  padding: 4px 6px; border: 1px solid #d0d0d0; vertical-align: middle;
  position: relative; text-align: center; min-height: 40px;
}
.s-table-edit td .s-input,
.s-table-edit td .s-textarea,
.s-table-edit td input,
.s-table-edit td textarea {
  border: none; border-radius: 0; background: transparent;
  padding: 8px 10px; width: 100%; font-size: 0.82rem;
  outline: none; box-shadow: none; text-align: center;
}
.s-table-edit td .s-select,
.s-table-edit td select {
  border: none; border-radius: 0; background: #fff;
  padding: 8px 10px; width: 100%; font-size: 0.82rem;
  outline: none; box-shadow: none; text-align: center;
  -webkit-appearance: menulist;
}
.s-table-edit td select option { background: #fff; color: #333; }
.s-table-edit td input:focus,
.s-table-edit td select:focus,
.s-table-edit td .s-input:focus {
  background: #e8f0fe; outline: 2px solid var(--s-primary); outline-offset: -2px;
}
.s-table-edit td .s-field { gap: 0; }
.s-table-edit td .s-label { display: none; }
.s-table-edit td .s-custom-select-trigger { min-height: unset; padding: 4px 8px; font-size: 0.82rem; border: none; border-radius: 0; box-shadow: none; }
.s-table-edit td .s-custom-select-trigger:hover { border: none; }
.s-table-edit td .s-custom-select-trigger.open { border: none; box-shadow: none; outline: none; }
.s-table-edit td span { padding: 8px 10px; display: block; font-size: 0.82rem; }
.s-table-edit td .s-autocomplete { position: relative; }
.s-table-edit td .s-autocomplete .s-input { border: none; border-radius: 0; }
.s-table-edit td input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--s-primary); }
.s-table-edit td .s-btn--icon { padding: 4px; }
.s-table-edit tbody tr:hover { background: #f8f9fa; }
.s-table-edit tbody tr:nth-child(even) { background: #fafbfc; }
.s-table-edit tbody tr:nth-child(even):hover { background: #f0f1f2; }
.s-table-edit tfoot td { background: #f0f0f0; font-weight: 600; padding: 6px 8px; text-align: center; }
.s-table-edit--hs th { background: #E3F2FD; color: #1565C0; }
.s-table-edit--hs tfoot td { background: #E3F2FD; }
.s-table-edit--ls th { background: #FFF3E0; color: #E65100; }
.s-table-edit--ls tfoot td { background: #FFF3E0; }

/* ---- Tables ---- */
.s-table-wrap { overflow-x: auto; }
.s-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; table-layout: auto; border: 1px solid var(--s-border); }
.s-table th {
  text-align: center; padding: 9px 12px; background: #fafafa;
  border: 1px solid var(--s-border); font-weight: 700;
  color: #000000; font-size: 0.8rem;
  white-space: nowrap; cursor: default; user-select: none;
}
.s-table td { padding: 8px 12px; border: 1px solid var(--s-border); text-align: center; vertical-align: middle; color: var(--s-text); font-size: 0.78rem; font-weight: 400; }

/* Actions column (last) centered */
.s-table th:last-child,
.s-table td:last-child { text-align: center; }

.s-table tbody tr { transition: background 0.15s ease; cursor: pointer; }
.s-table tbody tr:hover { background: var(--s-hover); }
.s-table tbody tr.selected { background: var(--s-selected); }
.s-table--empty { padding: 40px; text-align: center; color: var(--s-text-secondary); }
.s-table .s-actions { display: flex; flex-direction: row; align-items: center; gap: var(--s-xs); justify-content: center; }

/* ---- Pagination ---- */
.s-pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: var(--s-sm) 0; }
.s-pagination button {
  min-width: 32px; height: 32px; border: 1px solid var(--s-border);
  background: var(--s-surface); cursor: pointer; font-size: 0.8125rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--s-radius); transition: background 0.15s ease, color 0.15s ease;
}
.s-pagination button:hover { background: var(--s-hover); }
.s-pagination button.active { background: var(--s-primary); color: #fff; border-color: var(--s-primary); }
.s-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Badges / Chips ---- */
.s-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; font-size: 0.75rem; font-weight: 600;
  border-radius: var(--s-radius-sm); text-transform: uppercase; letter-spacing: 0.5px;
}
.s-badge--success { background: var(--s-success-light); color: var(--s-success); }
.s-badge--warning { background: var(--s-warning-light); color: var(--s-warning); }
.s-badge--error { background: var(--s-error-light); color: var(--s-error); }
.s-badge--info { background: var(--s-info-light); color: var(--s-info); }
.s-badge--default { background: #f5f5f5; color: var(--s-text-secondary); }
.s-badge--primary { background: var(--s-selected); color: var(--s-primary); }

/* ---- Tabs ---- */
.s-tabs { display: flex; flex-direction: column; }
.s-tabs-header { display: flex; border-bottom: 2px solid var(--s-border); gap: 0; }
.s-tab-btn {
  padding: 10px 20px; cursor: pointer; font-size: 0.875rem; font-weight: 500;
  color: var(--s-text-secondary); border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--s-font); white-space: nowrap;
}
.s-tab-btn:hover { color: var(--s-primary); background: #f5f5f5; }
.s-tab-btn--active { color: var(--s-primary); border-bottom-color: var(--s-primary); font-weight: 600; }
.s-tabs-content { padding: var(--s-md) 0; }
.s-tab-panel { }

/* ---- Dialogs / Modals ---- */
.s-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn 0.2s ease-out;
  overflow: hidden;
}
.s-dialog {
  background: var(--s-surface); min-width: 400px; max-width: 90vw;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--s-shadow-lg); border-radius: var(--s-radius-lg);
  animation: zoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  /* Note: do NOT add `will-change: transform` or `transform` here — it would
     turn .s-dialog into the containing block for position:fixed children
     (e.g. SSelect dropdowns), pinning their popovers to the dialog corner. */
}
.s-dialog-title {
  padding: 16px 20px; font-size: 1.125rem; font-weight: 600;
  border-bottom: 1px solid var(--s-border);
}
.s-dialog-inner { display: flex; flex-direction: column; max-height: 90vh; }
.s-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--s-border); }
.s-dialog-body { padding: 20px; overflow-y: auto; flex: 1; }
.s-dialog-content { padding: 20px; overflow-y: auto; flex: 1; }
.s-dialog-actions { padding: 12px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--s-border); }

/* ---- Utility ---- */
.s-form { width: 100%; }
.text-danger { color: var(--s-error); }

/* ---- Toasts (Sonner richColors) ---- */
.s-toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 356px;
  max-width: calc(100vw - 32px);
}
.s-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  padding-right: 36px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid;
  font-family: var(--s-font);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  animation: s-toast-in 0.35s cubic-bezier(0.21,1.02,0.73,1) forwards;
  will-change: transform, opacity;
}
.s-toast--exiting {
  animation: s-toast-out 0.2s ease-in forwards;
}

/* richColors per severity */
.s-toast--success {
  background: #fff;
  border-color: hsl(0 0% 89.8%);
  color: #0a0a0a;
}
.s-toast--error {
  background: hsl(359, 100%, 97%);
  border-color: hsl(359, 100%, 94%);
  color: hsl(360, 100%, 45%);
}
.s-toast--warning {
  background: hsl(49, 100%, 97%);
  border-color: hsl(49, 91%, 91%);
  color: hsl(31, 92%, 45%);
}
.s-toast--info {
  background: hsl(208, 100%, 97%);
  border-color: hsl(221, 91%, 91%);
  color: hsl(210, 92%, 45%);
}

/* Icon */
.s-toast__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.s-toast__icon svg { display: block; }

/* Content */
.s-toast__content { flex: 1; min-width: 0; }
.s-toast__title {
  font-size: 13px;
  font-weight: 600;
}
.s-toast__desc {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 2px;
}

/* Action button */
.s-toast__action {
  flex-shrink: 0;
  padding: 2px 10px;
  height: 24px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--s-font);
  background: rgba(0,0,0,0.15);
  color: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  align-self: center;
}
.s-toast__action:hover { background: rgba(0,0,0,0.25); }

/* Close button — always visible, top-right */
.s-toast__close {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.15s;
  padding: 0;
}
.s-toast__close:hover { opacity: 1; }

/* Loading spinner */
.s-toast__spinner {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}
.s-toast__spinner circle {
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-dasharray: 40;
  stroke-dashoffset: 12;
  stroke-linecap: round;
}

/* Animations */
@keyframes s-toast-in {
  from { opacity: 0; transform: translateY(100%) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes s-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(100%) scale(0.96); }
}

@media (max-width: 600px) {
  .s-toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* ---- Alerts ---- */
.s-alert {
  padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.875rem; border-left: 4px solid;
  border-radius: var(--s-radius);
}
.s-alert--success { background: var(--s-success-light); border-left-color: var(--s-success); }
.s-alert--error { background: var(--s-error-light); border-left-color: var(--s-error); }
.s-alert--warning { background: var(--s-warning-light); border-left-color: var(--s-warning); }
.s-alert--info { background: var(--s-info-light); border-left-color: var(--s-info); }

/* ---- Progress ---- */
.s-progress { height: 6px; background: var(--s-border); overflow: hidden; border-radius: var(--s-radius); }
.s-progress-bar { height: 100%; background: var(--s-primary); transition: width 0.3s; }
.s-progress-bar--success { background: var(--s-success); }

/* ---- Spinner ---- */
.s-spinner {
  width: 24px; height: 24px; border: 3px solid var(--s-border);
  border-top-color: var(--s-primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
  will-change: transform;
}
.s-spinner--lg { width: 40px; height: 40px; border-width: 4px; }
.s-spinner-center { display: flex; justify-content: center; padding: var(--s-xl); }

/* ---- Divider ---- */
.s-divider { border: none; border-top: 1px solid var(--s-border); margin: var(--s-md) 0; }

/* ---- Tooltip ---- */
.s-tooltip { position: relative; display: inline-block; }
.s-tooltip::after {
  content: attr(data-tooltip); position: absolute; bottom: 100%;
  left: 50%; transform: translateX(-50%); padding: 4px 8px;
  background: #333; color: #fff; font-size: 0.75rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  border-radius: var(--s-radius-sm);
}
.s-tooltip:hover::after { opacity: 1; }

/* ============================================
   App Shell — Inset Sidebar Layout
   All collapse/expand driven by .s-collapsed on .s-app
   ============================================ */
.s-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--s-sidebar-bg);
}

/* ---- Sidebar ---- */
.s-sidebar {
  width: var(--s-sidebar-width);
  background: var(--s-sidebar-bg);
  color: var(--s-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;
  transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

.s-collapsed .s-sidebar {
  width: var(--s-sidebar-collapsed);
}

/* Sidebar Header (logo area) */
.s-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  min-height: var(--s-header-height);
  flex-shrink: 0;
}

.s-sidebar-logo-img {
  max-height: calc(var(--s-header-height) - 16px);
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: max-width 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.s-collapsed .s-sidebar-header {
  padding: 0.5rem 0.25rem;
}

.s-collapsed .s-sidebar-logo-img {
  max-height: calc(var(--s-header-height) - 18px);
  max-width: calc(var(--s-sidebar-collapsed) - 16px);
  object-fit: contain;
  object-position: center;
}

.s-collapsed .s-sidebar-content {
  padding: 0.25rem 0;
}

/* Sidebar Content (scrollable nav area — hidden scrollbar like Ticket-Final) */
.s-sidebar-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem 0.5rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.s-sidebar-content::-webkit-scrollbar {
  display: none;
}

/* Nav Sections */
.s-nav-section {
  padding: 0.25rem 0;
}

.s-nav-section-title {
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e3a5f;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  height: auto;
  transition: opacity 200ms, height 200ms, padding 200ms;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.s-nav-section-title:hover {
  background: rgba(0,0,0,0.06);
  border-radius: var(--s-radius-sm);
  color: #0d2340;
}
.s-nav-section-title .s-chevron {
  width: 12px; height: 12px; transition: transform 200ms; flex-shrink: 0;
}
.s-nav-section.s-section-collapsed .s-chevron { transform: rotate(-90deg); }
.s-nav-section.s-section-collapsed .s-nav-link { display: none; }

.s-collapsed .s-nav-section-title {
  display: none;
}

/* Nav Links */
.s-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
  height: 2rem;
  color: var(--s-sidebar-text);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s, padding 200ms;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--s-radius-sm);
  white-space: nowrap;
  overflow: hidden;
}

.s-nav-link:hover {
  background: var(--s-sidebar-accent);
  color: var(--s-sidebar-accent-fg);
  text-decoration: none;
}

.s-nav-link.active {
  background: var(--s-sidebar-accent);
  color: var(--s-sidebar-accent-fg);
  font-weight: 500;
}

.s-nav-link svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.s-nav-link span {
  overflow: hidden;
  opacity: 1;
  transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
}

.s-collapsed .s-nav-link {
  justify-content: center;
  padding: 0;
  gap: 0;
  width: 100%;
  position: relative;
}

.s-collapsed .s-nav-link span {
  display: none;
}

.s-collapsed .s-nav-link:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  background: var(--s-text);
  color: var(--s-surface);
  padding: 0.25rem 0.5rem;
  border-radius: var(--s-radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  opacity: 1;
}

/* Sidebar Footer */
.s-sidebar-footer {
  padding: 0.5rem;
  border-top: 1px solid var(--s-sidebar-border);
  flex-shrink: 0;
}

/* ---- Sidebar Inset (main content wrapper) ---- */
.s-sidebar-inset {
  margin-left: var(--s-sidebar-width);
  margin-top: 0.5rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 1rem);
  transition: margin-left 200ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: margin-left;
  background: var(--s-surface);
  border-radius: var(--s-radius-xl);
  border: 1px solid var(--s-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow: hidden;
}

.s-collapsed .s-sidebar-inset {
  margin-left: calc(var(--s-sidebar-collapsed) + 0.5rem);
}

/* ---- Header ---- */
.s-header {
  height: var(--s-header-height);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-lg);
  position: sticky;
  top: 0;
  /* Must be ABOVE sticky table thead (z-index 50) so the notification panel
     descending from the header stacks above tables on every page. */
  z-index: 200;
  transition: box-shadow 200ms;
  border-bottom: 1px solid transparent;
}

.s-header.scrolled {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-bottom-color: var(--s-border);
}

/* Toggle Button */
.s-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--s-text);
  cursor: pointer;
  border-radius: var(--s-radius-sm);
  transition: background 0.15s;
}

.s-toggle-btn:hover {
  background: var(--s-hover);
}

.s-toggle-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* ---- Content Area ---- */
.s-content {
  padding: var(--s-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---- Full-height list page layout ---- */
.s-list-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.s-list-page > .s-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.s-list-page > .s-card > .s-table-wrap {
  overflow-x: auto;
  flex: 1;
  border-top-left-radius: var(--s-radius);
  border-top-right-radius: var(--s-radius);
}

/* Match the rounded card on the sticky thead so its grey background doesn't
   square off the card's rounded top corners. */
.s-list-page > .s-card > .s-table-wrap > .s-table thead tr:first-child th:first-child {
  border-top-left-radius: var(--s-radius);
}
.s-list-page > .s-card > .s-table-wrap > .s-table thead tr:first-child th:last-child {
  border-top-right-radius: var(--s-radius);
}

/* Solid sticky header — applies to every list-page table */
.s-table thead,
.s-table thead tr {
  background: #dde3eb !important;
}
.s-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  background: #dde3eb !important;
  box-shadow: inset 0 -1px 0 var(--s-border), inset 0 1px 0 var(--s-border) !important;
}


/* Report pages: the .s-card directly wraps the <table> with no .s-table-wrap,
   so the page itself is the scroll container and the sticky thead has no close
   scrolling ancestor to attach to. Adding overflow + max-height here turns the
   card into the scroll region; the .s-table thead th sticky rule above then
   keeps the header pinned to the top of the card while rows scroll. */
.s-card.s-card--scroll {
  overflow: auto;
  max-height: calc(100vh - 240px);
}

/* Center the filter header divs */
.s-table th > div { justify-content: center; }

.s-list-page > .s-card > .s-pagination {
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 1px solid var(--s-border);
  margin: 0 -0px;
  padding: 8px 12px;
  background: #fff;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.04);
  border-bottom-left-radius: var(--s-radius);
  border-bottom-right-radius: var(--s-radius);
}

/* ---- Mobile Overlay ---- */
.s-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity 200ms;
  pointer-events: none;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
  .s-sidebar {
    transform: translateX(-100%);
    width: var(--s-sidebar-width);
    z-index: 200;
    box-shadow: var(--s-shadow-lg);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1), width 200ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .s-collapsed .s-sidebar {
    width: var(--s-sidebar-width);
    transform: translateX(-100%);
  }

  .s-mobile-open .s-sidebar {
    transform: translateX(0);
  }

  .s-mobile-open .s-sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .s-sidebar-inset,
  .s-collapsed .s-sidebar-inset {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    min-height: 100vh;
    border-radius: 0;
  }
}

/* ---- Page Header ---- */
.s-page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-lg);
}
.s-page-title { font-size: 1.5rem; font-weight: 600; border: none; outline: none; }
.s-page-subtitle { font-size: 0.875rem; color: var(--s-text-secondary); }

/* ---- Toolbar ---- */
.s-toolbar { display: flex; gap: var(--s-sm); flex-wrap: nowrap; align-items: center; margin-bottom: var(--s-md); }
.s-toolbar .s-select { width: auto; min-width: 0; padding: 6px 8px; font-size: 0.8125rem; }

/* ---- Search Box ---- */
.s-search { position: relative !important; display: inline-flex !important; align-items: center; min-width: 250px; }
.s-search .s-input { padding-left: 36px !important; width: 100% !important; }
.s-search > svg { position: absolute !important; left: 10px !important; top: 50% !important; transform: translateY(-50%) !important; color: var(--s-text-secondary); pointer-events: none; z-index: 1; width: 16px !important; height: 16px !important; overflow: visible !important; }

/* ---- Currency ---- */
.s-currency { font-variant-numeric: tabular-nums; }
.s-currency::before { content: '\20B9'; }

/* ---- Dropdown ---- */
.s-dropdown { position: relative; display: inline-block; }
.s-dropdown-menu {
  position: absolute; top: 100%; right: 0; min-width: 180px;
  background: var(--s-surface); border: 1px solid var(--s-border);
  box-shadow: var(--s-shadow-md); z-index: 500;
  display: none; border-radius: var(--s-radius);
}
.s-dropdown.open .s-dropdown-menu {
  display: block;
  animation: zoomIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.s-dropdown-item {
  padding: 8px 16px; cursor: pointer; font-size: 0.875rem;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.15s ease;
}
.s-dropdown-item:hover { background: var(--s-hover); }

/* ---- Animations (GPU-accelerated with translate3d/scale3d) ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideInRight { from { transform: translate3d(100%, 0, 0); opacity: 0; } to { transform: translate3d(0, 0, 0); opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale3d(0.95, 0.95, 1); } to { opacity: 1; transform: scale3d(1, 1, 1); } }
@keyframes zoomOut { from { opacity: 1; transform: scale3d(1, 1, 1); } to { opacity: 0; transform: scale3d(0.95, 0.95, 1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes s-filter-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
.s-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }

/* ---- Login Page ---- */
.login-page,
.login-page *,
.login-page *::before,
.login-page *::after {
  box-sizing: border-box;
}
.login-page h1,
.login-page h2,
.login-page h3,
.login-page p {
  margin: 0;
}
.login-page a {
  color: inherit;
  text-decoration: none;
  transition: none;
}
.login-page a:hover {
  text-decoration: none;
}
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  gap: 1.5rem;
  background: var(--background);
  color: var(--foreground);
  padding: 1.5rem;
  font-family: var(--s-font);
}
@media (min-width: 768px) {
  .login-page { padding: 2.5rem; }
}
.login-container {
  width: 100%;
  max-width: 24rem;
}
.login-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.login-fieldgroup {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}
.login-logo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--foreground);
}
.login-logo-link:hover { text-decoration: none; }
.login-logo {
  display: flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
}
.login-logo svg { width: 1.5rem; height: 1.5rem; }
.login-logo img { height: 2.5rem; width: auto; }
.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin: 0;
}
.login-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
  text-align: center;
}
.login-description a {
  color: var(--foreground) !important;
  font-weight: 500;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}
.login-description a:hover { text-decoration: underline !important; }
.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.login-label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--foreground);
}
.login-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-forgot {
  font-size: 0.8125rem;
  color: var(--foreground) !important;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}
.login-forgot:hover { color: var(--foreground) !important; text-decoration: underline !important; }
.login-input {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background: transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--s-font);
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  box-sizing: border-box;
}
.login-input::placeholder {
  color: var(--muted-foreground);
}
.login-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 15%, transparent);
}
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--s-font);
  height: 2.25rem;
  padding: 0.375rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  box-sizing: border-box;
  line-height: 1.25rem;
}
.login-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.login-btn--primary {
  width: 100%;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.login-btn--primary:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
}
.login-btn--outline {
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--input);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.login-btn--outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.login-separator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
}
.login-separator::before,
.login-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-social-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .login-social-grid { grid-template-columns: 1fr 1fr; }
}
.login-password-wrapper { position: relative; }
.login-password-wrapper .login-input { padding-right: 2.5rem; }
.login-password-toggle {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted-foreground);
  padding: 0; display: flex; align-items: center; justify-content: center;
}
.login-password-toggle:hover { color: var(--foreground); }
.login-password-toggle svg { width: 1rem; height: 1rem; }
.login-terms {
  padding: 0 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-wrap: balance;
  margin: 0;
  line-height: 1.6;
}
.login-terms a {
  color: var(--foreground) !important;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}
.login-terms a:hover { color: var(--foreground) !important; }
.login-alert {
  border-radius: calc(var(--radius) - 2px);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
}
.login-alert--error {
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
  color: var(--destructive);
  border: 1px solid color-mix(in srgb, var(--destructive) 20%, transparent);
}
.login-alert--success {
  background: color-mix(in srgb, hsl(142 76% 36%) 10%, transparent);
  color: hsl(142 76% 36%);
  border: 1px solid color-mix(in srgb, hsl(142 76% 36%) 20%, transparent);
}

/* ---- Auth Pages (Login / Register) ---- */
.s-auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, #eff6ff, #f3f4f6);
  padding: var(--s-md);
}
.s-auth-card {
  background: var(--s-surface); width: 100%; max-width: 28rem;
  border-radius: var(--s-radius-lg); box-shadow: var(--s-shadow-lg);
  overflow: hidden;
}
.s-auth-card-header {
  background: var(--s-primary-dark, #1e2d66); color: white;
  text-align: center; padding: 1.5rem;
}
.s-auth-card-header .s-auth-icon {
  width: 48px; height: 48px; display: flex; align-items: center;
  justify-content: center; margin: 0 auto 12px; color: white;
  background: none; border-radius: 0;
}
.s-auth-card-header .s-auth-icon svg { width: 48px; height: 48px; }
.s-auth-card-header .s-auth-heading {
  font-size: 1.5rem; font-weight: 700; text-align: center;
  margin: 0 0 var(--s-xs); color: white;
}
.s-auth-card-header .s-auth-subtitle {
  font-size: 0.875rem; text-align: center; color: rgba(255,255,255,0.7);
  margin: 0;
}
.s-auth-card-body { padding: 2rem; }
.s-auth-heading {
  font-size: 1.5rem; font-weight: 700; text-align: center;
  margin: 0 0 var(--s-xs); color: var(--s-text);
}
.s-auth-subtitle {
  font-size: 0.875rem; text-align: center; color: var(--s-text-secondary);
  margin: 0 0 var(--s-lg);
}
/* Password show/hide toggle */
.s-password-wrapper { position: relative; }
.s-password-wrapper .s-input { padding-right: 40px; }
.s-password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #9ca3af; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.s-password-toggle:hover { color: #4b5563; }
.s-password-toggle svg { width: 16px; height: 16px; }
.s-auth-forgot {
  display: block; text-align: center; margin-top: var(--s-md);
  font-size: 0.8125rem; color: var(--s-primary); text-decoration: none;
}
.s-auth-forgot:hover { text-decoration: underline; }
.s-auth-divider {
  display: flex; align-items: center; gap: var(--s-md);
  margin: var(--s-lg) 0; font-size: 0.8125rem; color: var(--s-text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.s-auth-divider::before,
.s-auth-divider::after {
  content: ''; flex: 1; border-top: 1px solid var(--s-border);
}
.s-auth-footer {
  text-align: center; margin-top: var(--s-lg); font-size: 0.875rem;
  color: var(--s-text-secondary);
}
.s-auth-footer a { color: var(--s-primary); font-weight: 600; text-decoration: none; }
.s-auth-footer a:hover { text-decoration: underline; }
.s-auth-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-md); }
.s-btn--block { width: 100%; justify-content: center; }
.s-btn--outline {
  background: var(--s-surface); color: var(--s-text); border: 1px solid var(--s-border);
}
.s-btn--outline:hover { background: var(--s-hover); }
.s-btn--outline:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 480px) {
  .s-auth-card-body { padding: 1.5rem; }
}

/* ===== Reports module ===== */
.s-report-hero {
  background: linear-gradient(135deg, var(--s-primary) 0%, var(--s-primary-light) 60%, #5468c7 100%);
  color: #fff;
  border-radius: var(--s-radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 28px -16px rgba(44,65,144,0.55);
}
.s-report-hero::after {
  content: ""; position: absolute; right: -70px; top: -70px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at center, rgba(228,38,38,0.35), transparent 70%);
  pointer-events: none;
}
.s-report-hero__inner { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.s-report-hero h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.35rem; letter-spacing: -0.01em; color: #fff; }
.s-report-hero h1:focus, .s-report-hero h1:focus-visible { outline: none; box-shadow: none; background: transparent; }
.s-report-hero p { margin: 0; opacity: 0.9; font-size: 0.9rem; }
.s-report-hero__meta { display: flex; gap: 1rem; font-size: 0.78rem; opacity: 0.9; align-items: center; }
.s-report-hero__meta b { font-weight: 600; }

.s-kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1.25rem; }
.s-kpi {
  background: var(--s-surface); border: 1px solid var(--s-border);
  border-radius: var(--s-radius-md);
  padding: 1rem 1.1rem; position: relative; overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.s-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(0,0,0,0.18); }
.s-kpi::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--s-primary);
}
.s-kpi--accent::before { background: var(--s-accent); }
.s-kpi--success::before { background: #2e7d32; }
.s-kpi--warn::before { background: #ed6c02; }
.s-kpi--info::before { background: #0288d1; }
.s-kpi__label { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--s-text-muted); font-weight: 600; }
.s-kpi__value { font-size: 1.55rem; font-weight: 700; color: var(--s-text); margin: 0.2rem 0 0.15rem; line-height: 1.1; letter-spacing: -0.02em; }
.s-kpi__sub { font-size: 0.76rem; color: var(--s-text-muted); }
.s-kpi__icon {
  position: absolute; right: 0.8rem; top: 0.85rem;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(44,65,144,0.08); color: var(--s-primary);
}
.s-kpi--accent .s-kpi__icon { background: rgba(228,38,38,0.1); color: var(--s-accent); }
.s-kpi--success .s-kpi__icon { background: rgba(46,125,50,0.12); color: #2e7d32; }
.s-kpi--warn .s-kpi__icon { background: rgba(237,108,2,0.12); color: #ed6c02; }
.s-kpi--info .s-kpi__icon { background: rgba(2,136,209,0.12); color: #0288d1; }

.s-report-card-title { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.15rem; display: flex; align-items: center; gap: 0.5rem; }
.s-report-card-sub { font-size: 0.78rem; color: var(--s-text-muted); margin: 0 0 0.85rem; }

/* Distribution bar */
.s-dist { display: flex; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: var(--s-border); }
.s-dist > span { display: block; height: 100%; transition: width 300ms ease; }
.s-dist-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.7rem; font-size: 0.75rem; color: var(--s-text-muted); }
.s-dist-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: middle; }
.s-dist-legend b { font-weight: 600; color: var(--s-text); margin-left: 0.2rem; }

/* Funnel */
.s-funnel { display: flex; flex-direction: column; gap: 0.55rem; }
.s-funnel__row { display: grid; grid-template-columns: 120px 1fr 70px; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.s-funnel__label { color: var(--s-text-secondary); font-weight: 500; }
.s-funnel__bar { height: 22px; background: var(--s-hover, #f5f5f5); border-radius: 6px; overflow: hidden; position: relative; }
.s-funnel__fill { height: 100%; background: linear-gradient(90deg, var(--s-primary), #5468c7); border-radius: 6px; transition: width 400ms ease; }
.s-funnel__fill--accent { background: linear-gradient(90deg, var(--s-accent), #ff6b6b); }
.s-funnel__fill--success { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.s-funnel__count { font-weight: 600; color: var(--s-text); text-align: right; font-variant-numeric: tabular-nums; }

/* Hub category card */
.s-rcat {
  position: relative; display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.25rem; background: var(--s-surface);
  border: 1px solid var(--s-border); border-radius: var(--s-radius-lg);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  min-height: 172px; text-decoration: none; color: inherit;
}
.s-rcat:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -16px rgba(44,65,144,0.28); border-color: rgba(44,65,144,0.3); }
.s-rcat__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.s-rcat__icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(44,65,144,0.08); color: var(--s-primary); flex: none; }
.s-rcat__title { font-size: 1rem; font-weight: 600; margin: 0.25rem 0 0; color: var(--s-text); }
.s-rcat__desc { font-size: 0.82rem; color: var(--s-text-muted); margin: 0; flex: 1; line-height: 1.5; }
.s-rcat__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 0.25rem; }
.s-rcat__cta { color: var(--s-primary); font-weight: 600; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.3rem; }
.s-rcat__tag { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.22rem 0.55rem; border-radius: 999px; background: rgba(46,125,50,0.12); color: #2e7d32; }
.s-rcat__tag--soon { background: rgba(158,158,158,0.18); color: #616161; }
.s-rcat__tag--beta { background: rgba(237,108,2,0.14); color: #ed6c02; }
.s-rcat--accent .s-rcat__icon { background: rgba(228,38,38,0.1); color: var(--s-accent); }
.s-rcat--success .s-rcat__icon { background: rgba(46,125,50,0.12); color: #2e7d32; }
.s-rcat--warn .s-rcat__icon { background: rgba(237,108,2,0.12); color: #ed6c02; }
.s-rcat--info .s-rcat__icon { background: rgba(2,136,209,0.12); color: #0288d1; }
.s-report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

/* Coming-soon checklist */
.s-soon-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 1rem; }
.s-soon-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.75rem 0.9rem; background: var(--s-surface); border: 1px dashed var(--s-border); border-radius: var(--s-radius-md); font-size: 0.85rem; color: var(--s-text-secondary); }
.s-soon-item svg { color: var(--s-text-muted); flex: none; }

/* Rank / leaderboard list */
.s-rank { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.s-rank__item { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.s-rank__pos { width: 22px; height: 22px; border-radius: 6px; background: rgba(44,65,144,0.08); color: var(--s-primary); font-weight: 700; font-size: 0.72rem; display: flex; align-items: center; justify-content: center; }
.s-rank__item:nth-child(1) .s-rank__pos { background: rgba(228,38,38,0.12); color: var(--s-accent); }
.s-rank__label { color: var(--s-text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-rank__value { color: var(--s-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.s-rank__bar { grid-column: 2 / 4; height: 4px; background: var(--s-border); border-radius: 999px; overflow: hidden; margin-top: -0.15rem; }
.s-rank__bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--s-primary), #5468c7); }

/* Trend chart */
.s-trend { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.4rem; align-items: end; height: 140px; padding: 0 0 0.25rem; }
.s-trend__col { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; height: 100%; justify-content: flex-end; }
.s-trend__bar { width: 100%; max-width: 28px; background: linear-gradient(180deg, var(--s-primary), #5468c7); border-radius: 6px 6px 0 0; min-height: 4px; transition: height 300ms ease; }
.s-trend__bar--accent { background: linear-gradient(180deg, var(--s-accent), #ff6b6b); }
.s-trend__label { font-size: 0.7rem; color: var(--s-text-muted); font-weight: 500; }
.s-trend__value { font-size: 0.72rem; color: var(--s-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Stat grid (inside cards) */
.s-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.75rem; margin-top: 0.5rem; }
.s-stat { padding: 0.65rem 0.75rem; border-radius: var(--s-radius-md); background: var(--s-hover, #f7f9fc); border: 1px solid var(--s-border); }
.s-stat__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--s-text-muted); font-weight: 600; }
.s-stat__value { font-size: 1.1rem; font-weight: 700; color: var(--s-text); margin-top: 0.2rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* Dashboard hero overrides */
.s-dash-hero { padding: 2rem 1.75rem; min-height: 132px; display: flex; align-items: center; }
.s-dash-hero .s-report-hero__inner { align-items: center; gap: 1.25rem; flex-wrap: nowrap; width: 100%; }
.s-dash-hero__id { display: flex; align-items: center; gap: 1rem; min-width: 0; flex: 1; }
.s-dash-hero__id > div:last-child { min-width: 0; }
.s-dash-hero__id h1 { font-size: 1.4rem; margin: 0 0 0.35rem; line-height: 1.25; }
.s-dash-hero__id h1:focus, .s-dash-hero__id h1:focus-visible { outline: none; box-shadow: none; background: transparent; }
.s-dash-hero__id p { margin: 0; opacity: 0.9; font-size: 0.85rem; line-height: 1.45; }
.s-dash-hero__avatar {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}
.s-dash-hero__date {
  text-align: right; flex: none; padding: 0.55rem 0.9rem;
  border-radius: 10px; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
}
.s-dash-hero__day { font-size: 0.78rem; opacity: 0.8; font-weight: 500; letter-spacing: 0.02em; }
.s-dash-hero__full { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.005em; margin-top: 0.1rem; }
@media (max-width: 720px) {
  .s-dash-hero .s-report-hero__inner { flex-wrap: wrap; }
  .s-dash-hero__date { text-align: left; width: 100%; }
}

/* Bucket (progress segment) */
.s-bucket { display: flex; flex-direction: column; gap: 0.5rem; }
.s-bucket__row { display: grid; grid-template-columns: 90px 1fr 70px; gap: 0.6rem; align-items: center; font-size: 0.82rem; }
.s-bucket__label { color: var(--s-text-secondary); font-weight: 500; }
.s-bucket__track { height: 18px; background: var(--s-hover, #f5f5f5); border-radius: 4px; overflow: hidden; }
.s-bucket__fill { height: 100%; background: linear-gradient(90deg, var(--s-primary), #5468c7); transition: width 400ms ease; }
.s-bucket__count { text-align: right; font-weight: 600; color: var(--s-text); font-variant-numeric: tabular-nums; }
