/* ── Infinity Designer Boutique – App Stylesheet ────────────────────────────
   Boutique Violet design system.
   Supplement to Tailwind CSS utility classes.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Web-font preload ─────────────────────────────────────────────────────── */
/* Font stack: Inter (system) → ui-sans-serif → system-ui → Apple/Android defaults */

/* ── CSS custom properties ────────────────────────────────────────────────── */
:root {
  /* Boutique Violet Palette */
  --color-brand-50:  #f5f3ff;
  --color-brand-100: #ede9fe;
  --color-brand-200: #ddd6fe;
  --color-brand-300: #c4b5fd;
  --color-brand-400: #a78bfa;
  --color-brand-500: #8b5cf6;
  --color-brand-600: #7c3aed;
  --color-brand-700: #6d28d9;
  --color-brand-800: #5b21b6;
  --color-brand-900: #4c1d95;
  --color-brand-950: #2e1065;

  --color-primary: #7c3aed;
  --color-primary-light: #a78bfa;
  --color-primary-dark: #6d28d9;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #2563eb;
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Surfaces */
  --page-bg: #fafafa;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --card-radius: 12px;
  --card-padding: 16px;
  --divider: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-disabled: #d1d5db;

  /* Surface hierarchy */
  --surface-page: #fafafa;
  --surface-card: #ffffff;
  --surface-elevated: #f9fafb;
  --surface-overlay: rgba(0, 0, 0, 0.32);

  /* Border and divider */
  --border-default: #e5e7eb;
  --border-divider: #f3f4f6;
  --border-focus: #7c3aed;

  /* Radius scale */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* Shadow scale */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.10), 0 8px 16px rgba(0, 0, 0, 0.06);
}

/* ── Typography ───────────────────────────────────────────────────────────── */

/* Ensure white text on any dark brand/purple background throughout the app */
[class*="bg-brand-6"],
[class*="bg-brand-7"],
[class*="bg-brand-8"],
[class*="bg-brand-9"],
[style*="background: #7c3aed"],
[style*="background:#7c3aed"],
[style*="background: var(--color-primary)"],
[style*="background-color: #7c3aed"],
[style*="background-color:#7c3aed"] {
  color: #ffffff;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* ── Form elements ────────────────────────────────────────────────────────── */
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
table {
  font-size: 13px;
}

table th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

/* ── LinkedIn-style card surfaces ─────────────────────────────────────────── */
.ln-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
}

/* ── Base resets ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overscroll-behavior-y: none;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--page-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove autofill background flash on iOS / Chrome */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--page-bg) inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Smooth transitions for all interactive elements ──────────────────────── */
a,
button,
input,
select,
textarea,
[role="button"],
.interactive {
  transition: color var(--transition-fast),
              background-color var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast),
              opacity var(--transition-fast);
}

/* ── PWA safe-area-inset padding (iPhone notch / Dynamic Island) ──────────── */
.safe-area-top    { padding-top:    var(--safe-top); }
.safe-area-bottom { padding-bottom: var(--safe-bottom); }
.safe-area-left   { padding-left:   var(--safe-left); }
.safe-area-right  { padding-right:  var(--safe-right); }
.safe-area-x {
  padding-left:  var(--safe-left);
  padding-right: var(--safe-right);
}
.safe-area-y {
  padding-top:    var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.safe-area-all {
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

/* ── PWA standalone mode tweaks ───────────────────────────────────────────── */
@media all and (display-mode: standalone) {
  body {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: auto;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }
}

/* ── Scrollbar styling (Webkit) ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

/* ── Focus-visible outline (a11y) ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 2px;
  border-radius: 4px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ── Number pad buttons ───────────────────────────────────────────────────── */
.numpad-btn {
  transition: transform 0.08s ease, background-color var(--transition-fast),
              box-shadow var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
}

.numpad-btn:hover {
  background-color: rgba(124, 58, 237, 0.06);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.12);
}

.numpad-btn:active {
  transform: scale(0.92);
  background-color: rgba(124, 58, 237, 0.12);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ── Toast notification animations ────────────────────────────────────────── */
@keyframes toast-slide-in {
  0%   { transform: translateY(-100%) translateX(-50%); opacity: 0; }
  100% { transform: translateY(0) translateX(-50%);     opacity: 1; }
}

@keyframes toast-slide-out {
  0%   { transform: translateY(0) translateX(-50%);     opacity: 1; }
  100% { transform: translateY(-100%) translateX(-50%); opacity: 0; }
}

.toast {
  position: fixed;
  top: calc(1rem + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 280px;
  max-width: 90vw;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.08);
  animation: toast-slide-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  pointer-events: auto;
}

.toast.toast-exit {
  animation: toast-slide-out 0.3s ease-in forwards;
}

.toast-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.toast-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.toast-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.toast-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(124, 58, 237, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 1rem;   height: 1rem;   border-width: 2px; }
.spinner-lg { width: 2.5rem; height: 2.5rem; border-width: 4px; }

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9000;
}

/* ── Shake animation (errors / invalid input) ─────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── Pulse animation (big punch buttons) ──────────────────────────────────── */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.punch-btn {
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.punch-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

.punch-btn:active {
  transform: scale(0.98);
}

/* ── Card hover effects ───────────────────────────────────────────────────── */
.card-hover {
  transition: box-shadow var(--transition-base);
}

.card-hover:hover {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.card-hover:active {
  box-shadow: none;
}

/* ── Bottom navigation active state ───────────────────────────────────────── */
.bottom-nav {
  padding-bottom: var(--safe-bottom);
}

.bottom-nav-item {
  position: relative;
  transition: color var(--transition-fast);
}

.bottom-nav-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--color-primary);
  transition: transform var(--transition-base);
}

.bottom-nav-item.active {
  color: var(--color-primary);
  font-weight: 600;
}

.bottom-nav-item.active::after {
  transform: translateX(-50%) scaleX(1);
}

.bottom-nav-item:not(.active) {
  color: #9ca3af;
}

/* ── Status color utilities ───────────────────────────────────────────────── */
.status-active   { color: var(--color-success); }
.status-warning  { color: var(--color-warning); }
.status-error    { color: var(--color-danger); }
.status-info     { color: var(--color-info); }

.badge-active {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-neutral {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

/* ── Print styles (settlements) ───────────────────────────────────────────── */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }

  .no-print,
  .bottom-nav,
  .toast,
  .loading-overlay,
  nav,
  header,
  footer {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .card-hover {
    box-shadow: none !important;
    border: 1px solid #d1d5db !important;
    break-inside: avoid;
  }

  a { text-decoration: none !important; color: #000 !important; }

  table {
    border-collapse: collapse;
    width: 100%;
  }

  th, td {
    border: 1px solid #d1d5db;
    padding: 0.5rem;
    text-align: left;
  }

  th {
    background-color: #f3f4f6 !important;
    font-weight: 600;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    margin: 1.5cm;
    size: A4 portrait;
  }
}

.print-only {
  display: none;
}

/* ── Utility: fade transitions ────────────────────────────────────────────── */
.fade-enter        { opacity: 0; }
.fade-enter-active { opacity: 1; transition: opacity var(--transition-base); }
.fade-leave        { opacity: 1; }
.fade-leave-active { opacity: 0; transition: opacity var(--transition-base); }

/* ── Utility: slide-up transitions ────────────────────────────────────────── */
.slide-up-enter        { opacity: 0; transform: translateY(12px); }
.slide-up-enter-active { opacity: 1; transform: translateY(0);
  transition: opacity var(--transition-base), transform var(--transition-base); }

/* ── Skeleton loading placeholder ─────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 0.375rem;
}

/* ── Missing Tailwind lg: responsive utilities ────────────────────────────── */
/* These classes are used in templates but missing from the pre-compiled
   tailwind.css. The lg breakpoint triggers at 64rem (1024px).              */
@media (min-width: 64rem) {
  .lg\:hidden     { display: none !important; }
  .lg\:flex       { display: flex !important; }
  .lg\:py-3       { padding-top: calc(var(--spacing) * 3); padding-bottom: calc(var(--spacing) * 3); }
  .lg\:grid       { display: grid; }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:block      { display: block; }
}

/* ── Missing Tailwind base utilities ──────────────────────────────────────── */
.h-3\.5 { height: calc(var(--spacing) * 3.5); }
.w-3\.5 { width:  calc(var(--spacing) * 3.5); }

/* Missing z-index utilities (used by billing modals and overlays) */
.z-20   { z-index: 20; }
.z-\[60\]  { z-index: 60; }
.z-\[70\]  { z-index: 70; }
.z-\[75\]  { z-index: 75; }
.z-\[78\]  { z-index: 78; }
.z-\[79\]  { z-index: 79; }

/* Missing backdrop opacity utility (bg-black/40 and /30 exist in compiled CSS but /50 does not) */
.bg-black\/50 { background-color: rgb(0 0 0 / 0.5); }

/* Alignment fallback utilities frequently used in forms/search bars.
  These keep UI spacing stable when precompiled Tailwind misses classes. */
.h-9 { height: calc(var(--spacing) * 9); }
.pl-8 { padding-left: calc(var(--spacing) * 8); }
.pl-9 { padding-left: calc(var(--spacing) * 9); }
.pl-10 { padding-left: calc(var(--spacing) * 10); }
.pr-3 { padding-right: calc(var(--spacing) * 3); }
.left-2\.5 { left: calc(var(--spacing) * 2.5); }
.left-3 { left: calc(var(--spacing) * 3); }

/* ── Boutique Premium Surfaces ────────────────────────────────────────── */
.boutique-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--card-border);
}

.boutique-header {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.boutique-bottomnav {
  background: #ffffff;
  border-top: 1px solid var(--card-border);
}

.boutique-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
}

.ring-brand-200 { --tw-ring-color: var(--color-brand-200); }
.hover\:ring-brand-200:hover { --tw-ring-color: var(--color-brand-200); }
.hover\:ring-brand-300:hover { --tw-ring-color: var(--color-brand-300); }

/* ── Icon Rail (desktop slim sidebar) ─────────────────────────────────── */
.icon-rail {
  background: #ffffff;
}

.rail-item.rail-active {
  position: relative;
  background: var(--color-brand-50);
  color: var(--color-primary);
}

.rail-item:not(.rail-active) {
  color: #9ca3af;
}

.rail-item:not(.rail-active):hover {
  background: #f9fafb;
  color: #6b7280;
}

.rail-item.rail-active::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 2px 2px 0;
  background: var(--color-primary);
}

.rail-tooltip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.rail-item:hover .rail-tooltip {
  opacity: 1;
}

/* ── Floating Bottom Navigation (mobile) ──────────────────────────────── */
.floating-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 0;
  padding-bottom: calc(4px + var(--safe-bottom));
  background: #ffffff;
  border-top: 1px solid var(--card-border);
}

/* Enough bottom padding so content never hides under the floating nav,
   including devices with a home-indicator safe area (iPhone, Android). */
.pb-nav-safe {
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

/* ── Missing Tailwind md: responsive utilities ────────────────────────────── */
/* These classes are used in templates but missing from the pre-compiled
   tailwind.css. The md breakpoint triggers at 48rem (768px).
   Placed AFTER .pb-nav-safe so md:pb-6 correctly overrides nav-safe padding
   on admin/manager layouts where the floating nav is hidden at tablet+.     */
@media (min-width: 48rem) {
  .md\:fixed       { position: fixed; }
  .md\:inset-y-0   { top: 0; bottom: 0; }
  .md\:left-0      { left: 0; }
  .md\:z-40        { z-index: 40; }
  .md\:flex        { display: flex !important; }
  .md\:hidden      { display: none !important; }
  .md\:block       { display: block !important; }
  .md\:grid        { display: grid !important; }
  .md\:ml-14       { margin-left: calc(var(--spacing) * 14); }
  .md\:px-6        { padding-left: calc(var(--spacing) * 6); padding-right: calc(var(--spacing) * 6); }
  .md\:pb-6        { padding-bottom: calc(var(--spacing) * 6); }
  .md\:pt-5        { padding-top: calc(var(--spacing) * 5); }
  .md\:max-w-3xl   { max-width: 48rem; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:gap-4       { gap: calc(var(--spacing) * 4); }
  .md\:items-start { align-items: flex-start; }
  .md\:col-span-1  { grid-column: span 1 / span 1; }
  .md\:mb-0        { margin-bottom: 0; }
}

.floating-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 0;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
  min-width: 56px;
}

.floating-nav a.fnav-active {
  color: var(--color-primary);
}

.floating-nav .fnav-label {
  font-size: 10px;
  font-weight: 500;
  display: block;
}

.floating-nav a.fnav-active .fnav-label {
  font-weight: 600;
}

.floating-nav .fnav-badge {
  position: absolute;
  top: 0;
  right: 4px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

/* ── Mobile Header ────────────────────────────────────────────────────── */
.mobile-header {
  background: #ffffff;
  border-bottom: 1px solid var(--card-border);
}

@media (min-width: 48rem) {
  .settlements-summary-grid {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .settlements-summary-card {
    padding: 0.625rem 0.875rem;
  }

  .settlements-desktop-list {
    display: block;
  }

  .settlements-mobile-list {
    display: none;
  }

  .settlements-desktop-head,
  .settlements-desktop-row {
    display: grid;
    grid-template-columns: minmax(12rem, 1.9fr) 0.5fr 0.65fr 0.82fr 0.72fr 0.86fr 0.9fr 0.84fr 2rem;
    align-items: center;
  }

  /* ── Billing tables ─────────────────────────────────────────────────── */
  .billing-desktop-head,
  .billing-desktop-row {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 1.1fr 0.9fr 1fr 1fr 0.9fr 2rem;
    align-items: center;
  }
  .billing-desktop-head {
    background-color: #f9fafb;
  }
  .billing-customers-head,
  .billing-customers-row {
    display: grid;
    grid-template-columns: 1.7fr 1.2fr 0.7fr 1fr 1fr 2rem;
    align-items: center;
  }
  .billing-customers-head {
    background-color: #f9fafb;
  }
  .billing-lineitems-head,
  .billing-lineitems-row {
    display: grid;
    grid-template-columns: 2rem 1fr 3rem 5rem 5rem;
    gap: 0.5rem;
    align-items: center;
  }
  .billing-lineitems-head {
    background-color: #f9fafb;
  }
  .billing-form-items-head,
  .billing-form-items-row {
    display: grid;
    grid-template-columns: 2rem 1fr 80px 100px 110px 2rem;
    gap: 0.75rem;
    align-items: center;
  }
  .billing-expanded-stats { display: flex; }

}

/* ── Billing invoice row status indicators ─────────────────────────────── */
.billing-row-unpaid  { border-left: 3px solid #f59e0b; }
.billing-row-partial { border-left: 3px solid #60a5fa; }
.billing-row-paid    { border-left: 3px solid #22c55e; }
.billing-row-draft   { border-left: 3px solid #e5e7eb; }
.billing-row-void    { border-left: 3px solid #e5e7eb; }

/* ── Attendance detail drawer ─────────────────────────────────────────── */
.drawer-slide-enter { transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.drawer-slide-leave { transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.drawer-slide-from  { transform: translateX(100%); }
.drawer-slide-to    { transform: translateX(0); }
.drawer-table-thead tr {
  background-color: #1f2937;
  color: #ffffff;
}

/* ── Slide-up animation ───────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── Design System Component Primitives ───────────────────────────────────── */
/* All primitives live in @layer components so Tailwind utilities always win. */
@layer components {

  /* ── Buttons ─────────────────────────────────────────────────────────── */
  .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border-radius: var(--radius-md);
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
  }
  .btn-primary:hover:not(:disabled) { background-color: var(--color-primary-dark); }
  .btn-primary:active:not(:disabled) { background-color: var(--color-brand-800); }
  .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

  .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border-radius: var(--radius-md);
    background-color: #f3f4f6;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: background-color var(--transition-fast);
  }
  .btn-secondary:hover:not(:disabled) { background-color: #e5e7eb; }
  .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

  .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border-radius: var(--radius-md);
    background-color: #fef2f2;
    color: var(--color-danger);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: background-color var(--transition-fast);
  }
  .btn-danger:hover:not(:disabled) { background-color: #fee2e2; }
  .btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

  .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: var(--radius-md);
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: background-color var(--transition-fast), color var(--transition-fast);
  }
  .btn-ghost:hover:not(:disabled) { background-color: #f3f4f6; color: #374151; }
  .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

  /* ── Cards ───────────────────────────────────────────────────────────── */
  .card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1rem;
  }

  .card-elevated {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
  }

  .card-interactive {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
  }
  .card-interactive:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-brand-200);
  }

  /* ── Badge ───────────────────────────────────────────────────────────── */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: var(--radius-full);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
  }

  /* ── Pill tabs / filters ─────────────────────────────────────────────── */
  .pill-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    background: transparent;
    border: none;
    font-family: inherit;
    transition: background-color var(--transition-fast), color var(--transition-fast),
                box-shadow var(--transition-fast);
  }
  .pill-tab:hover { background-color: #f3f4f6; color: #374151; }

  .pill-tab-active {
    background-color: var(--color-brand-600);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.08);
  }
  .pill-tab-active:hover { background-color: var(--color-brand-700); color: #fff; }

  /* ── Form primitives ─────────────────────────────────────────────────── */
  .input {
    display: block;
    width: 100%;
    height: 2.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface-card);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }
  .input::placeholder { color: var(--text-tertiary); }
  .input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus);
  }
  .input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--surface-elevated);
  }

  .select {
    display: block;
    width: 100%;
    height: 2.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    padding: 0 2rem 0 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--surface-card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }
  .select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus);
  }
  .select:disabled { opacity: 0.5; cursor: not-allowed; }

  .label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
  }

  /* ── List rows ───────────────────────────────────────────────────────── */
  .list-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-divider);
    transition: background-color var(--transition-fast);
    cursor: pointer;
  }
  .list-row:last-child { border-bottom: none; }
  .list-row:hover { background-color: var(--surface-elevated); }

  /* ── Drawer ──────────────────────────────────────────────────────────── */
  .drawer-body {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(100vw, 24rem);
    background: var(--surface-card);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
  }

  /* ── Modal overlay ───────────────────────────────────────────────────── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }
  @media (min-width: 40rem) {
    .modal-overlay { align-items: center; }
  }

  /* ── User avatar ─────────────────────────────────────────────────────── */
  .user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background-color: var(--color-brand-100);
    color: var(--color-brand-700);
    font-weight: 600;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
  }
  .user-avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.6875rem; }
  .user-avatar-md { width: 2rem;    height: 2rem;    font-size: 0.75rem; }
  .user-avatar-lg { width: 2.5rem;  height: 2.5rem;  font-size: 0.875rem; }

  /* ── Mode-switch (Manager Desk / My Work role toggle) ────────────────── */
  .mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border-radius: var(--radius-md);
    background-color: #f3f4f6;
    padding: 2px;
  }
  .mode-switch-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: calc(var(--radius-md) - 2px);
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--transition-fast), color var(--transition-fast),
                box-shadow var(--transition-fast);
  }
  .mode-switch-option:hover { color: #374151; }
  .mode-switch-active {
    background-color: #ffffff;
    color: var(--color-brand-700);
    box-shadow: var(--shadow-xs);
  }
  .mode-switch-active:hover { color: var(--color-brand-700); }

}
