/* =============================================================================
   KEREN SNACK ERP — Global Stylesheet
   Based on: Supabase Design Language (docs/desain.md)
   Enhanced for High Contrast, Clarity, & Developer Elegance
   Version: 3.1 | 2026
   ============================================================================= */

/* Alpine.js zero-flicker cloak rule */
[x-cloak] { display: none !important; }

/* Live dot pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* =============================================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ============================================================================= */
:root {
  /* --- Brand & Primary (Modern Enterprise Blue / Indigo — Calming, Clean & Professional) --- */
  --color-primary:       #2563eb;   /* Blue 600 — Clean, high clarity, standard enterprise CTA */
  --color-primary-deep:  #1d4ed8;   /* Darker Blue 700 */
  --color-primary-soft:  #eff6ff;   /* Soft Blue tint background */
  --color-primary-muted: rgba(37, 99, 235, 0.12);

  /* --- Surface (Light Mode) --- */
  --color-canvas:        #ffffff;   /* Pure White for Cards, Header, Panels */
  --color-canvas-soft:   #f1f5f9;   /* Slate 100 — Clear contrast against white cards */
  --color-surface:       #ffffff;
  --color-surface-soft:  #f1f5f9;
  --color-canvas-night:  #111827;   /* Deep Dark for Sidebar */
  --color-canvas-night-soft: #1f2937;

  /* --- Hairlines & Borders --- */
  --color-hairline:       #e2e8f0;   /* Slate 200 — Clean crisp border */
  --color-hairline-strong:#cbd5e1;   /* Slate 300 — Defined input border */
  --color-hairline-cool:  #f1f5f9;   /* Slate 100 — Inner divider */

  /* --- Text (High Contrast & Clear Hierarchy) --- */
  --color-ink:            #0f172a;   /* Slate 900 — Deep crisp text */
  --color-ink-secondary:  #334155;   /* Slate 700 — Subheadings */
  --color-ink-mute:       #64748b;   /* Slate 500 — Clear helper text */
  --color-ink-mute-2:     #94a3b8;   /* Slate 400 — Tertiary info */
  --color-ink-faint:      #94a3b8;   /* Slate 400 — Placeholders */
  --color-on-primary:     #ffffff;   /* White text on dark buttons */
  --color-on-dark:        #f8fafc;

  /* --- Semantic Status --- */
  --color-success:        #10b981;   /* Emerald Green for Profit/Kas Masuk/Lunas */
  --color-success-soft:   #ecfdf5;
  --color-warning:        #f59e0b;
  --color-warning-soft:   #fffbeb;
  --color-danger:         #ef4444;   /* Red ONLY for Warning, Debt, Out-of-Stock, Deletion */
  --color-danger-soft:    #fef2f2;
  --color-info:           #3b82f6;
  --color-info-soft:      #eff6ff;

  /* --- Sidebar (Always Dark Matte Carbon) --- */
  --sidebar-bg:          #121212;
  --sidebar-bg-soft:     #181818;
  --sidebar-border:      #222222;
  --sidebar-text:        #888888;
  --sidebar-text-hover:  #ffffff;
  --sidebar-active-text: #60a5fa;
  --sidebar-active-bg:   rgba(59, 130, 246, 0.14);

  /* --- Typography --- */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* --- Spacing (8px base) --- */
  --space-xxs:   2px;
  --space-xs:    4px;
  --space-sm:    8px;
  --space-md:    12px;
  --space-lg:    16px;
  --space-xl:    24px;
  --space-xxl:   32px;
  --space-huge:  64px;

  /* --- Border Radius --- */
  --rounded-xs:  4px;   /* Form inputs / tags */
  --rounded-sm:  6px;   /* Buttons — signature Supabase radius */
  --rounded-md:  8px;   /* Compact cards, alerts */
  --rounded-lg:  12px;  /* Cards, modals, product mockups */
  --rounded-xl:  16px;  /* Large containers */
  --rounded-full: 9999px; /* Pills, avatars */

  /* --- Elevation / Shadows --- */
  --shadow-0:    none;
  --shadow-1:    0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-2:    0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-3:    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* --- Layout --- */
  --sidebar-width:  224px;
  --header-height:  60px;
  --container-max:  1280px;

  /* --- Table Grab & Grabbing Cursors (Clean White with Crisp Black Outline) --- */
  --cursor-grab: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20d%3D%22M216%2C64v90.93c0%2C46.2-36.85%2C84.55-83%2C85.06A83.71%2C83.71%2C0%2C0%2C1%2C72.6%2C215.4C50.79%2C192.33%2C26.15%2C136%2C26.15%2C136a16%2C16%2C0%2C0%2C1%2C6.53-22.23c7.66-4%2C17.1-.84%2C21.4%2C6.62l21%2C36.44a6.09%2C6.09%2C0%2C0%2C0%2C6%2C3.09l.12%2C0A8.19%2C8.19%2C0%2C0%2C0%2C88%2C151.74V48a16%2C16%2C0%2C0%2C1%2C16.77-16c8.61.4%2C15.23%2C7.82%2C15.23%2C16.43V112a8%2C8%2C0%2C0%2C0%2C8.53%2C8%2C8.17%2C8.17%2C0%2C0%2C0%2C7.47-8.25V32a16%2C16%2C0%2C0%2C1%2C16.77-16c8.61.4%2C15.23%2C7.82%2C15.23%2C16.43V120a8%2C8%2C0%2C0%2C0%2C8.53%2C8%2C8.17%2C8.17%2C0%2C0%2C0%2C7.47-8.25V64.45c0-8.61%2C6.62-16%2C15.23-16.43A16%2C16%2C0%2C0%2C1%2C216%2C64Z%22%20fill%3D%22%23ffffff%22%20stroke%3D%22%23000000%22%20stroke-width%3D%2218%22%20stroke-linejoin%3D%22round%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") 11 11, grab;
  --cursor-grabbing: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20d%3D%22M216%2C104v48a88%2C88%2C0%2C0%2C1-176%2C0V136a16%2C16%2C0%2C0%2C1%2C32%2C0v8a8%2C8%2C0%2C0%2C0%2C16%2C0V88a16%2C16%2C0%2C0%2C1%2C32%2C0v16a8%2C8%2C0%2C0%2C0%2C16%2C0V88a16%2C16%2C0%2C0%2C1%2C32%2C0v16a8%2C8%2C0%2C0%2C0%2C16%2C0%2C16%2C16%2C0%2C0%2C1%2C32%2C0Z%22%20fill%3D%22%23ffffff%22%20stroke%3D%22%23000000%22%20stroke-width%3D%2218%22%20stroke-linejoin%3D%22round%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") 11 11, grabbing;

}

/* =============================================================================
   2. DARK MODE OVERRIDES (Google Chrome Dark Theme Standard)
   ============================================================================= */
.dark {
  /* --- Surfaces (Google Chrome Dark Charcoal Palette) --- */
  --color-canvas:        #303134;   /* Elevated Card, Header, Modal, Panel */
  --color-canvas-soft:   #202124;   /* App Base Background (Chrome Dark Charcoal) */
  --color-surface:       #303134;
  --color-surface-soft:  #202124;
  --color-canvas-night:  #1f1f1f;   /* Sidebar / Darkest surface */
  --color-canvas-night-soft: #28292c;

  /* --- Borders (Google Hairline & Outlines) --- */
  --color-hairline:        #3c4043;   /* 1px subtle divider */
  --color-hairline-strong: #5f6368;   /* Input borders & card edges */
  --color-hairline-cool:   #303134;   /* Secondary inner lines */

  /* --- Typography (Google Dark Theme Anti-Glare) --- */
  --color-ink:             #e8eaed;   /* Primary text — soft, anti-glare off-white */
  --color-ink-secondary:   #bdc1c6;   /* Sub-headings & secondary */
  --color-ink-mute:        #9aa0a6;   /* Helper text, labels, icons */
  --color-ink-mute-2:      #80868b;   /* Tertiary text, timestamps */
  --color-ink-faint:       #5f6368;   /* Placeholders, disabled text */
  --color-on-dark:         #e8eaed;
  --color-on-primary:      #ffffff;

  /* --- Brand & Primary (Google Material Blue Accent) --- */
  --color-primary:         #8ab4f8;   /* Google Dark Theme Blue Accent */
  --color-primary-deep:    #1a73e8;   /* Google Blue 600 */
  --color-primary-soft:    rgba(138, 180, 248, 0.14);
  --color-primary-muted:   rgba(138, 180, 248, 0.08);

  /* --- Semantic Status (Google Dark Pastel) --- */
  --color-success:         #81c995;
  --color-success-soft:    rgba(129, 201, 149, 0.14);
  --color-warning:         #fdd663;
  --color-warning-soft:    rgba(253, 214, 99, 0.14);
  --color-danger:          #f28b82;
  --color-danger-soft:     rgba(242, 139, 130, 0.14);
  --color-info:            #8ab4f8;
  --color-info-soft:       rgba(138, 180, 248, 0.14);

  /* --- Sidebar (Google Chrome Tab Strip Palette) --- */
  --sidebar-bg:            #1f1f1f;
  --sidebar-bg-soft:       #28292c;
  --sidebar-border:        #3c4043;
  --sidebar-text:          #9aa0a6;
  --sidebar-text-hover:    #e8eaed;
  --sidebar-active-text:   #8ab4f8;
  --sidebar-active-bg:     rgba(138, 180, 248, 0.14);
}

/* =============================================================================
   3. RESET & BASE
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent !important;
}

html {
  font-size: 16px;
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-ink);
  background-color: var(--color-canvas-soft);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent !important;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent !important;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea, [role="button"] {
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent !important;
}

/* Hilangkan highlight biru bawaan browser & focus ring saat elemen/tombol ditekan */
:focus {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

button:focus,
button:active,
a:focus,
a:active,
.btn:focus,
.btn:active,
.modal-tab-btn:focus,
.modal-tab-btn:active,
.card:focus,
.card:active,
[role="button"]:focus,
[role="button"]:active {
  outline: none !important;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent !important;
}

button:focus-visible,
a:focus-visible,
.btn:focus-visible,
.modal-tab-btn:focus-visible {
  outline: none !important;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

::selection {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

/* =============================================================================
   4. SCROLLBAR & OVERFLOW UTILITIES
   ============================================================================= */
.overflow-x-auto {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
  width: 100%;
  display: block;
}

.overflow-y-auto {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

.overflow-auto {
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}

.overflow-hidden {
  overflow: hidden !important;
}

/* Minimalist Zero-Scrollbar Engine (Smooth touch & zero visual clutter) */
* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.custom-scrollbar::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.custom-scrollbar,
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* =============================================================================
   5. APP SHELL LAYOUT (Responsive Desktop Shell & Fluid Mobile Scrolling)
   ============================================================================= */
@media (min-width: 1024px) {
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  .app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .app-content {
    flex: 1;
    padding: var(--space-xl);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1023px) {
  html {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
  }
  body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    width: 100%;
    max-width: 100vw;
  }
  .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100vw;
  }
  .app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100vw;
  }
  .app-header {
    position: sticky;
    top: 0;
    z-index: 35;
    flex-shrink: 0;
    width: 100%;
  }
  .app-content {
    flex: 1;
    height: auto;
    padding: 10px 10px calc(85px + env(safe-area-inset-bottom)) 10px;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* =============================================================================
   6. SIDEBAR (Always Dark Canvas-Night)
   ============================================================================= */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  position: sticky;
  top: 0;
  left: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  overflow: hidden;
  overscroll-behavior: contain;
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    z-index: 50;
    box-shadow: var(--shadow-3);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--header-height);
  padding: 0 10px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  text-decoration: none;
  cursor: default;
  user-select: none;
  overflow: hidden;
  transition: padding 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              height 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              gap 0.42s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-brand-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--rounded-md);
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-brand-icon svg {
  width: 15px;
  height: 15px;
  color: var(--color-on-primary);
}

.sidebar-brand-text {
  min-width: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: visible;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.36s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-on-dark);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-brand-badge {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1.5px 4.5px;
  border-radius: var(--rounded-xs);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  letter-spacing: 0.04em;
  border: 1px solid var(--sidebar-border);
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.28s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.35s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 7px;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
  transition: padding 0.42s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.sidebar-section-label {
  font-size: 9.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  padding: 14px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  max-height: 40px;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.28s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.35s cubic-bezier(0.25, 1, 0.4, 1),
              max-height 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              padding 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              margin 0.42s cubic-bezier(0.25, 1, 0.4, 1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7.5px 9px;
  border-radius: var(--rounded-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  transition: color 0.15s,
              background-color 0.15s,
              padding 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.15s ease;
}

.sidebar-link:active {
  transform: scale(0.97);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #6b7280;
  transition: color 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-link span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.36s cubic-bezier(0.25, 1, 0.4, 1),
              max-width 0.42s cubic-bezier(0.25, 1, 0.4, 1);
  max-width: 154px;
}

.sidebar-link:hover {
  color: var(--sidebar-text-hover);
  background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link:hover svg {
  color: #d1d5db;
}

.sidebar-link.is-active {
  color: var(--sidebar-active-text);
  background-color: var(--sidebar-active-bg);
  font-weight: 600;
}

.sidebar-link.is-active svg {
  color: var(--sidebar-active-text);
}

.sidebar-footer {
  padding: 8px 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: var(--sidebar-bg-soft);
  flex-shrink: 0;
  transition: padding 0.42s cubic-bezier(0.25, 1, 0.4, 1);
}

/* ---- EXPANDED profile row ---- */
.sidebar-profile-expanded {
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  padding: 6px 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-profile-expanded:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-profile-link {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
}

.sidebar-profile-info {
  min-width: 0;
  flex: 1;
}

/* ---- COLLAPSED profile (hidden in expanded, shown when collapsed) ---- */
.sidebar-profile-collapsed {
  display: none;
}

/* ---- Shared avatar ---- */
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.18s ease;
}

.sidebar-avatar svg {
  width: 15px;
  height: 15px;
  color: #94a3b8;
  transition: color 0.18s ease;
}

.sidebar-profile-expanded:hover .sidebar-avatar {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.18);
}

.sidebar-profile-expanded:hover .sidebar-avatar svg {
  color: #f1f5f9;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sidebar-user-role {
  font-size: 10.5px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
  margin-top: 1px;
  font-weight: 500;
}

.sidebar-logout-btn {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.07);
  color: #f87171;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  text-decoration: none;
}

.sidebar-logout-btn svg {
  width: 13px;
  height: 13px;
  transition: transform 0.18s ease;
}

.sidebar-logout-btn:hover {
  color: #ffffff;
  background-color: #e11d48;
  border-color: #e11d48;
  transform: translateY(-1px);
}

.sidebar-logout-btn:hover svg {
  transform: translateX(1px);
}

.sidebar-logout-btn:active {
  transform: scale(0.95);
}

/* ---- Collapsed avatar wrapper with popup ---- */
.sidebar-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-avatar-wrap .sidebar-avatar {
  cursor: pointer;
}

.sidebar-avatar-wrap:hover .sidebar-avatar {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.22);
}

.sidebar-avatar-wrap:hover .sidebar-avatar svg {
  color: #f1f5f9;
}

/* Fixed-position popup (outside sidebar, not clipped by overflow:hidden) */
.sidebar-profile-popup-fixed {
  position: fixed;
  min-width: 195px;
  background: #141b27;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 99999;
}

/* Hover bridge between sidebar and popup */
.sidebar-profile-popup-fixed::before {
  content: '';
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: -24px;
  width: 26px;
}

/* Popup header: name + role */
.sidebar-profile-popup-header {
  padding: 6px 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 6px;
}

.sidebar-popup-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-popup-role {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  text-transform: capitalize;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Popup action buttons */
.sidebar-profile-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-popup-action {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  text-decoration: none;
  background: transparent;
  border: none;
  transition: background-color 0.14s ease, color 0.14s ease;
  cursor: pointer;
}

.sidebar-popup-action svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #94a3b8;
  transition: color 0.14s ease;
}

.sidebar-popup-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-popup-action:hover svg {
  color: #ffffff;
}

.sidebar-popup-action-logout {
  color: #f87171;
}

.sidebar-popup-action-logout svg {
  color: #f87171;
}

.sidebar-popup-action-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.sidebar-popup-action-logout:hover svg {
  color: #fca5a5;
}

/* =============================================================================
   6.1 SIDEBAR COLLAPSIBLE (Icon-Only Mode — Desktop ≥1024px)
   ============================================================================= */

/* Sidebar width transition for smooth collapse/expand */
.sidebar {
  transition: width 0.42s cubic-bezier(0.25, 1, 0.4, 1),
              transform 0.3s cubic-bezier(0.25, 1, 0.4, 1);
  will-change: width;
}

/* Toggle button: only visible on desktop */
.sidebar-toggle-btn {
  display: none; /* hidden on mobile by default */
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s,
              background-color 0.15s,
              border-color 0.15s,
              transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-toggle-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-toggle-btn:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.sidebar-toggle-btn:active {
  transform: scale(0.92);
}

/* Toggle button icon state: pure CSS (guarantees exactly 1 icon is visible, never both) */
.sidebar-toggle-btn .sidebar-icon-close {
  display: block;
}
.sidebar-toggle-btn .sidebar-icon-open {
  display: none !important;
}

.sidebar.sidebar-collapsed .sidebar-toggle-btn .sidebar-icon-close,
html.sidebar-is-collapsed .sidebar .sidebar-toggle-btn .sidebar-icon-close {
  display: none !important;
}

.sidebar.sidebar-collapsed .sidebar-toggle-btn .sidebar-icon-open,
html.sidebar-is-collapsed .sidebar .sidebar-toggle-btn .sidebar-icon-open {
  display: block !important;
}

@media (min-width: 1024px) {
  .sidebar-toggle-btn {
    display: flex;
  }

  /* ---- Collapsed State ---- */
  .sidebar.sidebar-collapsed,
  html.sidebar-is-collapsed .sidebar {
    width: 60px;
  }

  /* Hide text elements in collapsed header completely so they don't break column layout */
  .sidebar.sidebar-collapsed .sidebar-brand-text,
  html.sidebar-is-collapsed .sidebar .sidebar-brand-text,
  .sidebar.sidebar-collapsed .sidebar-brand-badge,
  html.sidebar-is-collapsed .sidebar .sidebar-brand-badge {
    display: none !important;
  }

  .sidebar.sidebar-collapsed .sidebar-section-label,
  html.sidebar-is-collapsed .sidebar .sidebar-section-label {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: none;
    border: none;
  }

  .sidebar.sidebar-collapsed .sidebar-link span,
  html.sidebar-is-collapsed .sidebar .sidebar-link span {
    opacity: 0;
    max-width: 0;
    transform: translateX(-10px);
    pointer-events: none;
  }

  /* Center sidebar brand icon and toggle button cleanly when collapsed */
  .sidebar.sidebar-collapsed .sidebar-brand,
  html.sidebar-is-collapsed .sidebar .sidebar-brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    height: auto !important;
    padding: 12px 0 10px !important;
    gap: 8px !important;
    width: 60px !important;
    box-sizing: border-box !important;
  }

  .sidebar.sidebar-collapsed .sidebar-brand-icon,
  html.sidebar-is-collapsed .sidebar .sidebar-brand-icon {
    width: 32px !important;
    height: 32px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .sidebar.sidebar-collapsed .sidebar-toggle-btn,
  html.sidebar-is-collapsed .sidebar .sidebar-toggle-btn {
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  /* Nav link icon alignment and interactive hover effect */
  .sidebar.sidebar-collapsed .sidebar-link,
  html.sidebar-is-collapsed .sidebar .sidebar-link {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
  }

  .sidebar.sidebar-collapsed .sidebar-link svg,
  html.sidebar-is-collapsed .sidebar .sidebar-link svg {
    width: 18px;
    height: 18px;
  }

  .sidebar.sidebar-collapsed .sidebar-link:hover svg,
  html.sidebar-is-collapsed .sidebar .sidebar-link:hover svg {
    transform: scale(1.15);
    color: #ffffff;
  }

  .sidebar.sidebar-collapsed .sidebar-link.is-active:hover svg,
  html.sidebar-is-collapsed .sidebar .sidebar-link.is-active:hover svg {
    color: var(--sidebar-active-text);
  }

  /* =============================================================================
     INSTANT FAST FLOATING TOOLTIP (0ms delay, follows fast cursor, never clipped)
     ============================================================================= */
  .sidebar-floating-tooltip {
    position: fixed;
    z-index: 999999;
    background: #141b27;
    color: #f8fafc;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-sans);
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 2px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transform: translateY(-50%) translateX(0);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.05s ease, transform 0.05s ease;
  }

  .sidebar-floating-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(3px);
  }

  /* Tooltip arrow */
  .sidebar-floating-tooltip::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid #141b27;
  }

  /* Footer: center avatar when collapsed — hide expanded row, show collapsed */
  .sidebar.sidebar-collapsed .sidebar-profile-expanded,
  html.sidebar-is-collapsed .sidebar .sidebar-profile-expanded {
    display: none;
  }

  .sidebar.sidebar-collapsed .sidebar-profile-collapsed,
  html.sidebar-is-collapsed .sidebar .sidebar-profile-collapsed {
    display: flex;
    justify-content: center;
  }

  /* Footer padding when collapsed */
  .sidebar.sidebar-collapsed .sidebar-footer,
  html.sidebar-is-collapsed .sidebar .sidebar-footer {
    padding: 10px 6px;
  }

  /* Nav padding when collapsed: smaller horizontal */
  .sidebar.sidebar-collapsed .sidebar-nav,
  html.sidebar-is-collapsed .sidebar .sidebar-nav {
    padding: var(--space-md) 6px;
  }
}

/* =============================================================================
   6.2 SIDEBAR OVERLAY & MOBILE FREEZE SCROLL-LOCK
   ============================================================================= */
html.sidebar-open,
body.sidebar-open,
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}

@media (max-width: 1023px) {
  body.sidebar-open {
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
  }

  body.sidebar-open .app-main,
  body.sidebar-open .app-content {
    overflow: hidden !important;
    touch-action: none !important;
    pointer-events: none !important;
    user-select: none !important;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    z-index: 48 !important;
    background: rgba(0, 0, 0, 0.72) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-overlay.is-visible {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sidebar {
    z-index: 50 !important;
    height: 100vh !important;
    height: 100dvh !important;
    top: 0 !important;
    bottom: 0 !important;
    max-height: 100dvh !important;
  }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.sidebar-overlay.is-visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* =============================================================================
   7. HEADER
   ============================================================================= */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  background-color: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  gap: var(--space-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.dark .app-header {
  background-color: var(--color-canvas);
  border-bottom-color: var(--color-hairline);
}

.header-left { display: flex; align-items: center; gap: var(--space-md); min-width: 0; }
.header-right { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; }

.header-burger {
  display: none;
  padding: 7px;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--color-hairline);
  background: transparent;
  color: var(--color-ink-mute);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.header-burger svg { width: 18px; height: 18px; display: block; }
.header-burger:hover { border-color: var(--color-hairline-strong); color: var(--color-ink); }

@media (max-width: 1023px) {
  .header-burger { display: flex; align-items: center; }
}

.header-page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-mute);
  white-space: nowrap;
}

.header-chip {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--rounded-xs);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-hairline-strong);
  color: var(--color-ink-secondary);
  background: var(--color-canvas);
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
  box-sizing: border-box;
}

.header-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.header-chip.is-role {
  border-color: #cbd5e1;
  background-color: #f1f5f9;
  color: #334155;
}

.dark .header-chip.is-role {
  background-color: rgba(255, 255, 255, 0.05);
  color: #cccccc;
  border-color: rgba(255, 255, 255, 0.1);
}

.header-theme-btn {
  height: 34px;
  width: 34px;
  padding: 0;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--color-hairline-strong);
  background: var(--color-canvas);
  color: var(--color-ink-mute);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.header-theme-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.header-theme-btn:hover {
  border-color: var(--color-ink-mute);
  color: var(--color-ink);
  background-color: var(--color-canvas-soft);
}

.dark .header-theme-btn {
  background: var(--color-canvas);
  color: #fbbf24;
  border-color: var(--color-hairline-strong);
}

/* Zero-delay, zero-flash CSS icon switcher */
html:not(.dark) .header-theme-btn .theme-icon-sun {
  display: none !important;
}
html:not(.dark) .header-theme-btn .theme-icon-moon {
  display: block !important;
  color: var(--color-ink-mute);
}

html.dark .header-theme-btn .theme-icon-sun {
  display: block !important;
  color: #fbbf24;
}
html.dark .header-theme-btn .theme-icon-moon {
  display: none !important;
}

/* =============================================================================
   7.1 PAGE HEADER & HERO HEADINGS (Enterprise Design System)
   ============================================================================= */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }
}

.page-header-body {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.page-header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--rounded-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-1);
}

.page-header-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Icon Color Variants (Light & Dark) */
.page-header-icon.is-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.28);
}
.dark .page-header-icon.is-emerald {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.page-header-icon.is-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.28);
}
.dark .page-header-icon.is-blue {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.page-header-icon.is-indigo {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.28);
}
.dark .page-header-icon.is-indigo {
  background: rgba(99, 102, 241, 0.16);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.35);
}

.page-header-icon.is-violet {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.28);
}
.dark .page-header-icon.is-violet {
  background: rgba(139, 92, 246, 0.16);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.35);
}

.page-header-icon.is-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.28);
}
.dark .page-header-icon.is-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.page-header-icon.is-rose {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.28);
}
.dark .page-header-icon.is-rose {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.page-header-icon.is-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: #0891b2;
  border: 1px solid rgba(6, 182, 212, 0.28);
}
.dark .page-header-icon.is-cyan {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border-color: rgba(6, 182, 212, 0.35);
}

.page-header-text {
  min-width: 0;
  flex: 1;
}

.page-header-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-mute);
  margin-bottom: 3px;
  line-height: 1;
}

.page-header-tag .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: inline-block;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .page-title {
    font-size: 1.55rem;
  }
}

.page-subtitle {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-ink-mute);
  margin-top: 3px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

@media (min-width: 640px) {
  .page-subtitle {
    font-size: 13px;
  }
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 640px) {
  .page-header-actions {
    width: auto;
    justify-content: flex-end;
    flex-shrink: 0;
  }
}

.page-back-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rounded-md);
  flex-shrink: 0;
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  color: var(--color-ink-secondary);
  transition: all 0.15s ease;
  cursor: pointer;
}
.page-back-btn:hover {
  border-color: var(--color-hairline-strong);
  color: var(--color-ink);
  background: var(--color-canvas-soft);
  transform: translateX(-2px);
}
.page-back-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* =============================================================================
   8. BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--rounded-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary,
.btn-save {
  background-color: var(--color-primary);
  color: #ffffff !important;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
  transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary svg,
.btn-save svg {
  color: #ffffff !important;
}

.btn-primary:hover,
.btn-save:hover {
  background-color: var(--color-primary-deep);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.28);
}

.btn-primary:active,
.btn-save:active {
  background-color: #1e40af;
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}

.btn-secondary {
  background-color: var(--color-canvas);
  color: var(--color-ink-secondary);
  border-color: var(--color-hairline-strong);
  font-weight: 600;
}
.btn-secondary:hover {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
  border-color: var(--color-ink-mute);
}

.dark .btn-primary,
.dark .btn-save {
  background-color: #1a73e8 !important;
  color: #ffffff !important;
  border-color: #1a73e8 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
}

.dark .btn-primary:hover,
.dark .btn-save:hover {
  background-color: #1967d2 !important;
  border-color: #1967d2 !important;
}

.dark .btn-secondary {
  background-color: #303134;
  color: #e8eaed;
  border-color: #5f6368;
}

.dark .btn-secondary:hover {
  background-color: #3c4043;
  color: #ffffff;
  border-color: #8ab4f8;
}

.btn-danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.3);
  font-weight: 600;
}
.btn-danger:hover { background-color: var(--color-danger); color: white; border-color: var(--color-danger); }

.btn-danger-solid,
.btn-danger.btn-solid {
  background-color: var(--color-danger) !important;
  border-color: var(--color-danger) !important;
  color: #ffffff !important;
  font-weight: 700;
}
.btn-danger-solid:hover,
.btn-danger.btn-solid:hover {
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}
.btn-danger-solid svg,
.btn-danger-solid i,
.btn-danger.btn-solid svg,
.btn-danger.btn-solid i {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.btn-ghost {
  background: transparent;
  color: var(--color-ink-mute);
  border-color: transparent;
  padding: var(--space-sm) var(--space-sm);
  font-weight: 600;
}
.btn-ghost:hover { color: var(--color-ink); background-color: var(--color-canvas-soft); }
.dark .btn-ghost:hover { background-color: rgba(255,255,255,0.06); }

.btn-full { width: 100%; }
.btn-sm { padding: 6px var(--space-md); font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: var(--space-md) var(--space-xxl); font-size: 14px; }
.btn-lg svg { width: 18px; height: 18px; }

/* =============================================================================
   9. CARDS
   ============================================================================= */
.card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-1);
}

.dark .card {
  background-color: var(--color-canvas);
  border-color: var(--color-hairline);
}

.card-dark {
  background-color: var(--color-canvas-night);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--rounded-lg);
  padding: var(--space-xl);
  color: var(--color-on-dark);
}

.card-interactive {
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}
.card-interactive:hover {
  border-color: var(--color-hairline-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.card-interactive:active { transform: scale(0.99); }

.stat-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-1);
  transition: all 0.15s ease-in-out;
}

.dark .stat-card {
  background-color: var(--color-canvas);
  border-color: var(--color-hairline);
}

.stat-card:hover { box-shadow: var(--shadow-2); border-color: var(--color-hairline-strong); }

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--rounded-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card-icon svg { width: 20px; height: 20px; }

.stat-card-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-family: var(--font-mono);
}

.stat-card-footer {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-ink-mute);
  font-family: var(--font-mono);
  padding-top: var(--space-sm);
  margin-top: var(--space-md);
  border-top: 1px solid var(--color-hairline-cool);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =============================================================================
   10. FORM INPUTS & SELECTS
   ============================================================================= */
.form-input, .form-select {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-md);
  border-radius: var(--rounded-sm);
  border: 1px solid var(--color-hairline-strong);
  background-color: var(--color-canvas);
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.form-input {
  height: auto;
  min-height: 64px;
  padding: 8px var(--space-md);
  line-height: 1.5;
  resize: vertical;
}

.dark .form-input, .dark .form-select, .dark textarea.form-input {
  background-color: #202124;
  border-color: #3c4043;
  color: #e8eaed;
}

.form-input::placeholder, .form-select::placeholder {
  color: var(--color-ink-faint);
  font-weight: 400;
}

.form-input:focus, .form-select:focus, textarea.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.dark .form-input:focus, .dark .form-select:focus, .dark textarea.form-input:focus {
  border-color: #8ab4f8;
  box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.2);
}

.form-input-icon {
  position: relative;
}
.form-input-icon .icon-left {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-ink-mute);
  pointer-events: none;
  width: 16px;
  height: 16px;
}
.form-input-icon .form-input { padding-left: 38px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-secondary);
  margin-bottom: var(--space-xs);
}

.dark .form-label { color: #bdc1c6; }

/* Input with Fixed System Prefix Addon */
.input-group-addon {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.addon-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background-color: var(--color-canvas-soft);
  border: 1px solid var(--color-hairline-strong);
  border-right: none;
  border-radius: var(--rounded-sm) 0 0 var(--rounded-sm);
  color: var(--color-primary-deep);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  user-select: none;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.dark .addon-prefix {
  background-color: #181818;
  border-color: #2a2a2a;
  color: #34d399;
}
.addon-input {
  border-radius: 0 var(--rounded-sm) var(--rounded-sm) 0 !important;
  flex: 1;
  min-width: 0;
}
.uppercase {
  text-transform: uppercase;
}

/* =============================================================================
   11. BADGES / PILLS / TAGS
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px var(--space-sm);
  border-radius: var(--rounded-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  font-family: inherit;
  line-height: normal;
  text-decoration: none;
  vertical-align: middle;
}

button.badge {
  cursor: pointer;
  outline: none;
  font-family: inherit;
  line-height: inherit;
  transition: all 0.15s ease-in-out;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

button.badge:hover {
  filter: brightness(0.96);
  transform: translateY(-0.5px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

button.badge:active {
  transform: translateY(0);
}

button.badge:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.dark button.badge:hover {
  filter: brightness(1.18);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.badge-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--rounded-xs);
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  letter-spacing: 0.02em;
}

.dark .badge-mono {
  background-color: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-primary   { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-weight: 700; }
.badge-secondary { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; font-weight: 600; }
.badge-success   { background-color: #ecfdf5; color: #15803d; border: 1px solid #86efac; font-weight: 700; }
.badge-warning   { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; font-weight: 600; }
.badge-danger    { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; font-weight: 600; }
.badge-info      { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-weight: 600; }
.badge-amber     { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-weight: 600; }
.badge-muted     { background-color: var(--color-canvas-soft); color: var(--color-ink-mute); border: 1px solid var(--color-hairline); font-weight: 600; }

.dark .badge-primary   { background-color: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.dark .badge-secondary { background-color: rgba(255, 255, 255, 0.05); color: #94a3b8; border: 1px solid rgba(255, 255, 255, 0.1); }
.dark .badge-success   { background-color: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.dark .badge-warning   { background-color: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.dark .badge-danger    { background-color: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.dark .badge-info      { background-color: rgba(59, 130, 246, 0.1); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.dark .badge-amber     { background-color: rgba(245, 158, 11, 0.12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.22); }
.dark .badge-muted     { background-color: rgba(255,255,255,0.03); color: #888888; border: 1px solid #242424; }

/* =============================================================================
   12. TABLES (Enterprise Material Design 3)
   ============================================================================= */
.table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.table thead th,
.data-table thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-mute);
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--color-hairline);
  background-color: var(--color-canvas-soft);
  white-space: nowrap;
  vertical-align: middle;
}

.dark .table thead th,
.dark .data-table thead th {
  background-color: #28292c;
  border-bottom-color: #3c4043;
  color: #9aa0a6;
}

.table tbody td,
.data-table tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-hairline);
  color: var(--color-ink);
  vertical-align: middle;
  line-height: 1.45;
}

.dark .table tbody td,
.dark .data-table tbody td {
  border-bottom-color: #3c4043;
  color: #e8eaed;
}

.table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr,
.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.dark .table tbody tr:hover,
.dark .data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover td,
.data-table tbody tr:hover td {
  background-color: var(--color-canvas-soft);
}

.dark .table tbody tr:hover td,
.dark .data-table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
}

.cell-nowrap {
  white-space: nowrap !important;
}

.cell-currency {
  font-family: var(--font-mono);
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.cell-center {
  text-align: center !important;
}

.cell-right {
  text-align: right !important;
}

.table-wrapper {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  scroll-behavior: auto !important;
}

.pagination-bar .btn {
  transition: none !important;
  transform: none !important;
}

.dark .table-wrapper {
  background-color: var(--color-canvas);
  border-color: var(--color-hairline);
}

.table-scroll,
.table-responsive {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

/* Table Drag-to-Scroll (Grab Cursor with Crisp Black Outline) */
.table-grab-container.is-scrollable {
  cursor: -webkit-grab;
  cursor: grab;
  cursor: var(--cursor-grab);
}

.table-grab-container.is-grabbing {
  cursor: -webkit-grabbing !important;
  cursor: grabbing !important;
  cursor: var(--cursor-grabbing) !important;
  user-select: none !important;
}

.table-grab-container.is-grabbing * {
  cursor: -webkit-grabbing !important;
  cursor: grabbing !important;
  cursor: var(--cursor-grabbing) !important;
  user-select: none !important;
}

.table-grab-container input,
.table-grab-container select,
.table-grab-container textarea {
  user-select: auto;
  cursor: text;
}

.table-grab-container button,
.table-grab-container a,
.table-grab-container .sd-trigger,
.table-grab-container [role="button"] {
  cursor: pointer;
}

.input-rupiah,
.input-currency {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   13. MODAL & CENTRALIZED POPUP FREEZE/BLUR ENGINE
   ============================================================================= */
[x-cloak] {
  display: none !important;
}

/* Global Centralized Popup Freeze Engine */
html.ksnack-popup-freeze {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.ksnack-popup-freeze {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  padding-right: var(--ksnack-scrollbar-comp, 0px);
}

body.ksnack-popup-freeze .app-content {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* Peripheral Background Blur (Header & Sidebar Outside Modal Tree) */
body.ksnack-popup-freeze #app-sidebar,
body.ksnack-popup-freeze .app-header {
  filter: blur(4px);
  pointer-events: none !important;
  user-select: none !important;
  transition: filter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

body.ksnack-popup-freeze .app-header {
  padding-right: calc(var(--ksnack-scrollbar-comp, 0px) + 16px);
}

/* Universal Frosted Glass Modal Backdrops */
.modal-backdrop,
.tagihan-modal-backdrop,
.tagihan-modal-overlay,
.receipt-backdrop,
.confirm-overlay,
.m3-payment-backdrop,
.popup-blur-backdrop,
[data-popup-backdrop] {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  z-index: 99999 !important;
  background: rgba(15, 23, 42, 0.72) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  -ms-overflow-style: none;
  scrollbar-width: none;
  box-sizing: border-box !important;
}

.dark .modal-backdrop,
.dark .tagihan-modal-backdrop,
.dark .tagihan-modal-overlay,
.dark .receipt-backdrop,
.dark .confirm-overlay,
.dark .m3-payment-backdrop,
.dark .popup-blur-backdrop,
.dark [data-popup-backdrop] {
  background: rgba(3, 7, 18, 0.80) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.modal-backdrop::-webkit-scrollbar,
.tagihan-modal-backdrop::-webkit-scrollbar,
.receipt-backdrop::-webkit-scrollbar,
.confirm-overlay::-webkit-scrollbar,
.m3-payment-backdrop::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.modal-backdrop[style*="display: none"],
.modal-backdrop[style*="display:none"],
.tagihan-modal-backdrop[style*="display: none"],
.tagihan-modal-backdrop[style*="display:none"],
.receipt-backdrop[style*="display: none"],
.receipt-backdrop[style*="display:none"] {
  display: none !important;
}

.modal-box {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-xl);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  margin: auto;
  box-shadow: var(--shadow-3);
  position: relative;
  z-index: 10000;
  animation: modalPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-box::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dark .modal-box {
  background-color: var(--color-canvas) !important;
  border-color: var(--color-hairline) !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-hairline);
}

.dark .modal-header { border-bottom-color: var(--color-hairline); }

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.modal-box-lg {
  max-width: 900px;
  width: 95%;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.modal-tab-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--color-canvas-soft);
  border-bottom: 1px solid var(--color-hairline);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.modal-tab-nav::-webkit-scrollbar {
  display: none;
}

.modal-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--rounded-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.modal-tab-btn:hover {
  color: var(--color-ink);
  background: rgba(0, 0, 0, 0.05);
}

.modal-tab-btn.is-active {
  color: #ffffff !important;
  background: #1e3a8a !important; /* Deep Dark Navy Blue */
  border-color: #1e3a8a !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

.modal-tab-btn.is-active .badge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

.dark .modal-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.dark .modal-tab-btn.is-active {
  background: #1e3a8a !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.6);
}

.modal-tab-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1023px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box-lg {
    max-width: 100%;
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    animation: drawerSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .modal-tab-body {
    padding: 14px 16px 24px 16px;
  }
}

@keyframes drawerSlideUp {
  from {
    opacity: 0.7;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* =============================================================================
   14. FLASH NOTIFICATIONS (Toast - Antigravity Glassmorphism Card)
   ============================================================================= */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999999 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  width: calc(100% - 48px);
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    width: auto;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--rounded-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  font-size: 13px;
  color: var(--color-ink);
  pointer-events: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dark .toast {
  background-color: rgba(24, 24, 24, 0.95);
  border-color: #333333;
  color: #e5e5e5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
}

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success { border-left: 4px solid #10b981 !important; }
.toast-success .toast-icon { color: #10b981; }
.toast-error   { border-left: 4px solid #ef4444 !important; }
.toast-error   .toast-icon { color: #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b !important; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info    { border-left: 4px solid #3b82f6 !important; }
.toast-info    .toast-icon { color: #3b82f6; }

.toast-msg { flex: 1; line-height: 1.4; font-weight: 600; font-size: 13px; }
.toast-close {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-ink-mute);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.toast-close:hover { color: var(--color-ink); background: rgba(255,255,255,0.08); }
.toast-close svg { width: 14px; height: 14px; }

/* =============================================================================
   15. FOOTER
   ============================================================================= */
.app-footer {
  padding: var(--space-xl) var(--space-xl);
  text-align: center;
  font-size: 12px;
  color: var(--color-ink-mute);
  border-top: 1px solid var(--color-hairline);
  background-color: var(--color-canvas);
  flex-shrink: 0;
}

.dark .app-footer {
  background-color: var(--color-canvas);
  border-top-color: var(--color-hairline);
}

.app-footer a {
  color: var(--color-primary-deep);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s;
}
.app-footer a:hover { color: var(--color-primary); }

/* =============================================================================
   16. POS KASIR — PRODUCT CARDS
   ============================================================================= */
.product-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.dark .product-card {
  background-color: var(--color-canvas);
  border-color: var(--color-hairline);
}

.product-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.12), 0 1px 3px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

.product-card:active { transform: scale(0.99); }

.product-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.product-card-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.4;
  margin: 6px 0 2px;
}

.product-card-grup {
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--color-ink-mute);
  margin-top: 2px;
}

.product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  margin-top: var(--space-xs);
  border-top: 1px solid var(--color-hairline-cool);
}

.dark .product-card-foot { border-top-color: var(--color-hairline); }

.product-card-price {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--color-ink);
  letter-spacing: -0.02em;
}

.product-card-stock {
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-ink-mute);
  margin-top: 2px;
}

@media (max-width: 640px) {
  .product-card {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 12px;
  }
  .product-card-name {
    font-size: 12px;
    line-height: 1.35;
    margin: 4px 0 1px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
  }
  .product-card-grup {
    font-size: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-card-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 8px;
  }
  .product-card-price {
    font-size: 13.5px;
  }
  .product-card-stock {
    font-size: 10px;
  }
}

/* =============================================================================
   17. CODE BLOCKS
   ============================================================================= */
code, .code {
  font-family: var(--font-mono);
  font-size: 12px;
  background-color: var(--color-canvas-night);
  color: var(--color-on-dark);
  padding: 2px 6px;
  border-radius: var(--rounded-xs);
}

pre.code-block {
  background-color: var(--color-canvas-night);
  color: var(--color-on-dark);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--space-lg);
  border-radius: var(--rounded-sm);
  overflow-x: auto;
  line-height: 1.6;
}

/* =============================================================================
   18. ACTIVITY STREAM (Owner Page)
   ============================================================================= */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--rounded-md);
  transition: background-color 0.1s;
}
.activity-item:hover { background-color: var(--color-canvas-soft); }
.dark .activity-item:hover { background-color: rgba(255,255,255,0.03); }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--rounded-md);
  border: 1px solid var(--color-hairline);
  background-color: var(--color-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dark .activity-icon {
  background-color: var(--color-canvas-soft);
  border-color: var(--color-hairline);
}

.activity-icon svg { width: 15px; height: 15px; }

.activity-name { font-size: 13px; font-weight: 700; color: var(--color-ink); }
.activity-desc { font-size: 12.5px; font-weight: 400; color: var(--color-ink-secondary); line-height: 1.45; margin-top: 2px; }
.activity-time { font-size: 11px; font-family: var(--font-mono); color: var(--color-ink-mute); margin-left: auto; flex-shrink: 0; }

/* =============================================================================
   19. LIVE STATUS INDICATOR
   ============================================================================= */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-primary);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* =============================================================================
   20. SECTION HEADERS
   ============================================================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-hairline-cool);
}

.dark .section-header { border-bottom-color: var(--color-hairline); }

.section-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-mute);
  margin-top: 2px;
}

/* =============================================================================
   21. MOBILE BOTTOM BAR (POS Kasir)
   ============================================================================= */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  padding: var(--space-md) var(--space-lg);
  background-color: var(--color-canvas);
  border-top: 1px solid var(--color-hairline);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

.dark .mobile-bottom-bar {
  background-color: var(--color-canvas);
  border-top-color: #374151;
}

@media (max-width: 1023px) { .mobile-bottom-bar { display: flex; align-items: center; gap: var(--space-md); } }

/* =============================================================================
   22. CART DRAWER (Mobile)
   ============================================================================= */
.cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--color-canvas);
  border-top: 1px solid var(--color-hairline);
  border-radius: var(--rounded-xl) var(--rounded-xl) 0 0;
  padding: var(--space-xl);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
}

.dark .cart-drawer {
  background-color: var(--color-canvas);
  border-top-color: #374151;
}

/* =============================================================================
   23. COUNTER (Qty +/-)
   ============================================================================= */
.qty-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--color-canvas-soft);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--rounded-sm);
  padding: 3px;
}

.dark .qty-counter {
  background-color: var(--color-canvas-soft);
  border-color: #374151;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--color-hairline);
  background-color: var(--color-canvas);
  color: var(--color-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.1s;
}

.dark .qty-btn { background-color: var(--color-canvas); border-color: #374151; color: var(--color-on-dark); }
.qty-btn:hover { background-color: var(--color-hairline); }
.dark .qty-btn:hover { background-color: #374151; }

.qty-input {
  width: 38px;
  text-align: center;
  background: transparent;
  border: none;
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-ink);
  padding: 0;
}

.dark .qty-input { color: var(--color-on-dark); }
.qty-input:focus { outline: none; }

/* =============================================================================
   24. UTILITIES & STANDALONE ENGINE (Zero Runtime CDN)
   ============================================================================= */
.font-mono { font-family: var(--font-mono) !important; }
.font-sans { font-family: var(--font-sans) !important; }
.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.font-extrabold, .font-black { font-weight: 800 !important; }

.text-primary { color: var(--color-primary) !important; }
.text-ink { color: var(--color-ink) !important; }
.text-muted { color: var(--color-ink-mute) !important; }
.text-faint { color: var(--color-ink-faint) !important; }
.text-danger, .text-rose-500 { color: #ef4444 !important; }
.text-success, .text-emerald-600 { color: #10b981 !important; }
.text-emerald-800 { color: #065f46 !important; }
.text-warning { color: #f59e0b !important; }
.text-info { color: #3b82f6 !important; }
.text-white { color: #ffffff !important; }
.text-slate-500 { color: #64748b !important; }
.text-slate-900 { color: #0f172a !important; }

.dark .text-white { color: #ffffff !important; }
.dark .text-slate-900 { color: #f8fafc !important; }
.dark .text-slate-500 { color: #94a3b8 !important; }

.text-xs { font-size: 11px !important; }
.text-sm { font-size: 13px !important; }
.text-base { font-size: 14px !important; }
.text-lg { font-size: 16px !important; }
.text-xl { font-size: 18px !important; }
.text-2xl { font-size: 22px !important; }

/* TEXT ALIGNMENT */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-justify { text-align: justify !important; }

.bg-canvas { background-color: var(--color-canvas) !important; }
.bg-canvas-soft { background-color: var(--color-canvas-soft) !important; }
.bg-card { background-color: var(--color-canvas) !important; }
.bg-white { background-color: #ffffff !important; }
.bg-slate-100 { background-color: #f1f5f9 !important; }
.dark .bg-slate-800\/80 { background-color: rgba(30, 41, 59, 0.8) !important; }
.dark .bg-slate-800\/60 { background-color: rgba(30, 41, 59, 0.6) !important; }

.border { border: 1px solid var(--color-hairline) !important; }
.border-b { border-bottom: 1px solid var(--color-hairline) !important; }
.border-t { border-top: 1px solid var(--color-hairline) !important; }
.border-hairline { border-color: var(--color-hairline) !important; }

.rounded-sm { border-radius: var(--rounded-sm) !important; }
.rounded-md { border-radius: var(--rounded-md) !important; }
.rounded-lg { border-radius: var(--rounded-lg) !important; }
.rounded-xl { border-radius: var(--rounded-xl) !important; }
.rounded-full { border-radius: 9999px !important; }

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow-md { box-shadow: var(--shadow-2) !important; }
.shadow-lg { box-shadow: var(--shadow-3) !important; }

.opacity-50 { opacity: 0.5 !important; }
.opacity-60 { opacity: 0.6 !important; }
.opacity-70 { opacity: 0.7 !important; }
.opacity-80 { opacity: 0.8 !important; }
.opacity-90 { opacity: 0.9 !important; }

.cursor-pointer { cursor: pointer !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* FLEXBOX ENGINE */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.flex-row { flex-direction: row !important; }
.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-initial { flex: 0 1 auto !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.min-w-0 { min-width: 0 !important; }
.min-h-0 { min-height: 0 !important; }

.items-start { align-items: flex-start !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.items-stretch { align-items: stretch !important; }

.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-between { justify-content: space-between !important; }

/* GRID SYSTEM */
.grid { display: grid !important; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
.col-span-1 { grid-column: span 1 / span 1 !important; }
.col-span-2 { grid-column: span 2 / span 2 !important; }
.col-span-full { grid-column: 1 / -1 !important; }

/* GAP */
.gap-1 { gap: 4px !important; }
.gap-1\.5 { gap: 6px !important; }
.gap-2 { gap: 8px !important; }
.gap-2\.5 { gap: 10px !important; }
.gap-3 { gap: 12px !important; }
.gap-3\.5 { gap: 14px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 20px !important; }
.gap-6 { gap: 24px !important; }

/* SPACING (SPACE-Y) */
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 4px !important; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 8px !important; }
.space-y-2\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 10px !important; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 12px !important; }
.space-y-3\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 14px !important; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 16px !important; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 20px !important; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 24px !important; }

/* PADDING & MARGIN */
.p-0 { padding: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-2\.5 { padding: 10px !important; }
.p-3 { padding: 12px !important; }
.p-3\.5 { padding: 14px !important; }
.p-4 { padding: 16px !important; }
.p-5 { padding: 20px !important; }
.px-3\.5 { padding-left: 14px !important; padding-right: 14px !important; }
.py-3\.5 { padding-top: 14px !important; padding-bottom: 14px !important; }
.pb-24 { padding-bottom: 6rem !important; }
.pb-28 { padding-bottom: 7rem !important; }
.pt-1 { padding-top: 4px !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-1\.5 { margin-bottom: 6px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-2\.5 { margin-bottom: 10px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-3\.5 { margin-bottom: 14px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-5 { margin-bottom: 20px !important; }
.mb-6 { margin-bottom: 24px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-1\.5 { margin-top: 6px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-2\.5 { margin-top: 10px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-3\.5 { margin-top: 14px !important; }
.mt-4 { margin-top: 16px !important; }
.mt-5 { margin-top: 20px !important; }
.mt-6 { margin-top: 24px !important; }
.pt-1\.5 { padding-top: 6px !important; }
.pt-2\.5 { padding-top: 10px !important; }
.pt-3\.5 { padding-top: 14px !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.my-auto { margin-top: auto !important; margin-bottom: auto !important; }

/* SIZING */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }
.w-72 { width: 18rem !important; }
.w-80 { width: 20rem !important; }
.w-96 { width: 24rem !important; }
.h-full { height: 100% !important; }
.max-w-xs { max-width: 20rem !important; }

/* DISPLAY & VISIBILITY */
.block { display: block !important; }
.hidden { display: none !important; }
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.fixed { position: fixed !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.z-10 { z-index: 10 !important; }
.z-20 { z-index: 20 !important; }
.z-30 { z-index: 30 !important; }
.z-40 { z-index: 40 !important; }
.z-50 { z-index: 50 !important; }
.z-60 { z-index: 60 !important; }
.z-70 { z-index: 70 !important; }
.z-80 { z-index: 80 !important; }

.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* RESPONSIVE BREAKPOINTS (sm: >= 640px) */
@media (min-width: 640px) {
  .sm\:block { display: block !important; }
  .sm\:inline { display: inline !important; }
  .sm\:inline-block { display: inline-block !important; }
  .sm\:inline-flex { display: inline-flex !important; }
  .sm\:flex { display: flex !important; }
  .sm\:flex-row { flex-direction: row !important; }
  .sm\:flex-col { flex-direction: column !important; }
  .sm\:flex-initial { flex: 0 1 auto !important; }
  .sm\:items-center { align-items: center !important; }
  .sm\:justify-start { justify-content: flex-start !important; }
  .sm\:justify-center { justify-content: center !important; }
  .sm\:justify-end { justify-content: flex-end !important; }
  .sm\:justify-between { justify-content: space-between !important; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .sm\:col-span-1 { grid-column: span 1 / span 1 !important; }
  .sm\:col-span-2 { grid-column: span 2 / span 2 !important; }
  .sm\:w-auto { width: auto !important; }
  .sm\:w-72 { width: 18rem !important; }
  .sm\:w-80 { width: 20rem !important; }
  .sm\:max-w-xs { max-width: 20rem !important; }
  .sm\:p-3\.5 { padding: 14px !important; }
  .sm\:p-4 { padding: 16px !important; }
  .sm\:gap-3 { gap: 12px !important; }
  .sm\:gap-3\.5 { gap: 14px !important; }
  .sm\:gap-4 { gap: 16px !important; }
  .sm\:gap-5 { gap: 20px !important; }
  .sm\:space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 20px !important; }
  .sm\:hidden { display: none !important; }
}

/* RESPONSIVE BREAKPOINTS (md: >= 768px) */
@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:inline-block { display: inline-block !important; }
  .md\:inline-flex { display: inline-flex !important; }
  .md\:flex { display: flex !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .md\:hidden { display: none !important; }
}

/* RESPONSIVE BREAKPOINTS (lg: >= 1024px) */
@media (min-width: 1024px) {
  .lg\:block { display: block !important; }
  .lg\:inline-block { display: inline-block !important; }
  .lg\:inline-flex { display: inline-flex !important; }
  .lg\:flex { display: flex !important; }
  .lg\:flex-row { flex-direction: row !important; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .lg\:col-span-1 { grid-column: span 1 / span 1 !important; }
  .lg\:col-span-2 { grid-column: span 2 / span 2 !important; }
  .lg\:col-span-3 { grid-column: span 3 / span 3 !important; }
  .lg\:pb-4 { padding-bottom: 16px !important; }
  .lg\:hidden { display: none !important; }
  .show-mobile { display: none !important; }
}

@media (max-width: 1023px) {
  .hide-mobile { display: none !important; }
}

/* RESPONSIVE BREAKPOINTS (xl & 2xl: >= 1280px & 1536px) */
@media (min-width: 1280px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (min-width: 1536px) {
  .2xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* =============================================================================
   25. CATEGORY PILLS (Deep Dark Forest Green for Active State)
   ============================================================================= */
.category-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: var(--rounded-full);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1.2;
  border: 1px solid var(--color-hairline-strong);
  background-color: var(--color-canvas);
  color: var(--color-ink-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}

.category-pill:hover {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
  border-color: var(--color-ink-mute);
}

.category-pill.is-active {
  background-color: #1e3a8a !important; /* Deep Dark Navy Blue */
  color: #ffffff !important;
  border-color: #1e3a8a !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.35);
}

.category-pill.is-active:hover {
  background-color: #172554 !important;
  border-color: #172554 !important;
}

.dark .category-pill {
  background-color: #181818;
  color: #a3a3a3;
  border-color: #282828;
}

.dark .category-pill:hover {
  background-color: #222222;
  color: #ffffff;
  border-color: #383838;
}

.dark .category-pill.is-active {
  background-color: #1e3a8a !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.6);
}

.pos-store-filter-active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1.5px solid #3b82f6 !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
  font-weight: 700;
}

.dark .pos-store-filter-active {
  background: rgba(59, 130, 246, 0.16) !important;
  color: #93c5fd !important;
  border: 1.5px solid rgba(59, 130, 246, 0.45) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.pos-store-filter-inactive {
  background: var(--color-canvas) !important;
  color: var(--color-ink-mute) !important;
  border: 1px solid var(--color-hairline-strong) !important;
}

.dark .pos-store-filter-inactive {
  background: #181818 !important;
  color: #737373 !important;
  border: 1px solid #282828 !important;
}

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}

/* =============================================================================
   25. APP FOOTER & WATERMARK (AJSK Royal Blue)
   ============================================================================= */
.app-footer,
.login-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-mute);
}

.app-footer a,
.login-footer a {
  color: #2563eb !important; /* Royal Blue from rekap-mukholif */
  font-weight: 700 !important;
  text-decoration: none !important;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.app-footer a:hover,
.login-footer a:hover {
  color: #1d4ed8 !important;
  text-decoration: none !important;
  opacity: 0.85;
}

.dark .app-footer a,
.dark .login-footer a {
  color: #3b82f6 !important;
  text-decoration: none !important;
}

/* =============================================================================
   26. GLOBAL TOAST & FLASH NOTIFICATIONS (Desktop & Mobile Optimized)
   ============================================================================= */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999999 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 440px;
  width: calc(100% - 2.5rem);
}

@media (max-width: 640px) {
  .toast-container {
    top: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  word-break: break-word;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
}

.toast-close {
  background: transparent;
  border: none;
  color: currentColor;
  opacity: 0.65;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: opacity 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Dark Theme Colors */
.toast-success {
  background: rgba(6, 78, 59, 0.95);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.4);
}
.toast-success .toast-icon {
  color: #34d399;
}

.toast-error {
  background: rgba(136, 19, 55, 0.95);
  color: #fecdd3;
  border-color: rgba(244, 63, 94, 0.4);
}
.toast-error .toast-icon {
  color: #fb7185;
}

.toast-warning {
  background: rgba(120, 53, 15, 0.95);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}
.toast-warning .toast-icon {
  color: #fbbf24;
}

.toast-info {
  background: rgba(12, 74, 110, 0.95);
  color: #bae6fd;
  border-color: rgba(14, 165, 233, 0.4);
}
.toast-info .toast-icon {
  color: #38bdf8;
}

/* Light Theme Colors */
html:not(.dark) .toast-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.2);
}
html:not(.dark) .toast-error {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
  box-shadow: 0 10px 25px -5px rgba(244, 63, 94, 0.2);
}
html:not(.dark) .toast-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.2);
}
html:not(.dark) .toast-info {
  background: #f0f9ff;
  color: #075985;
  border-color: #bae6fd;
  box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.2);
}

/* =============================================================================
   27. MOBILE POS CART DRAWER & BOTTOM SHEET
   ============================================================================= */
.cart-drawer {
  background-color: var(--color-canvas);
  color: var(--color-ink);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 18px 20px 24px 20px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.45);
  border-top: 1px solid var(--color-hairline);
  animation: drawerSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-cart-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pos-desktop-cart {
  display: none !important;
}

/* Detail Modal Responsive Tables */
.detail-modal-table-wrap {
  display: block !important;
  border: 1px solid var(--color-hairline);
  border-radius: 14px;
  overflow: hidden;
  background: var(--color-canvas);
}

.detail-modal-cards-wrap {
  display: none !important;
}

@media (max-width: 639px) {
  .detail-modal-table-wrap {
    display: none !important;
  }
  .detail-modal-cards-wrap {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
  }
}

/* Unified Metric Stats Cards */
.metric-card {
  padding: 16px 18px;
  border-radius: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 82px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.metric-card-value {
  font-family: var(--font-mono);
  font-size: 16.5px;
  font-weight: 900;
  margin-top: 6px;
  line-height: 1.2;
}

.metric-card-neutral {
  background: var(--color-canvas-soft);
  border: 1px solid var(--color-hairline);
  color: var(--color-ink);
}
.metric-card-neutral .metric-card-title { color: var(--color-ink-mute); }

.metric-card-success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #059669;
}
.metric-card-success .metric-card-title { color: #059669; }

.metric-card-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
}
.metric-card-danger .metric-card-title { color: #dc2626; }

@media (max-width: 1023px) {
  .hide-mobile, .lg\:flex, .lg\:block, .lg\:inline-flex { display: none !important; }
  .mobile-only { display: block !important; }
  .pos-desktop-cart { display: none !important; }
}

@media (min-width: 1024px) {
  .hide-desktop, .lg\:hidden, .mobile-only { display: none !important; }
  .lg\:flex { display: flex !important; }
  .lg\:block { display: block !important; }
  .lg\:inline-flex { display: inline-flex !important; }
  .pos-desktop-cart {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 360px;
    flex-shrink: 0;
    padding: 0;
  }
  .mobile-cart-drawer-overlay {
    display: none !important;
  }
}

/* =============================================================================
   28. POS CATEGORY HORIZONTAL SCROLL & PRODUCT CARDS
   ============================================================================= */
.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.category-scroll-track {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  scrollbar-width: none;
  cursor: -webkit-grab;
  cursor: grab;
  cursor: var(--cursor-grab);
  will-change: scroll-position;
  transform: translateZ(0);
  overscroll-behavior-x: contain;
  user-select: none;
  -webkit-user-select: none;
}
.category-scroll-track:active {
  cursor: -webkit-grabbing;
  cursor: grabbing;
  cursor: var(--cursor-grabbing);
}
.category-scroll-track::-webkit-scrollbar {
  display: none;
}

.product-card {
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 165px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 165px;
  transform: translateZ(0);
}

.product-card:hover {
  border-color: var(--color-hairline-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dark .product-card:hover {
  border-color: #383838;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.product-card:active {
  transform: scale(0.985);
}

.product-card-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  overflow: hidden;
}

.product-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.product-card-sku {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--color-canvas-soft);
  color: var(--color-ink-secondary);
  border: 1px solid var(--color-hairline);
  white-space: nowrap;
}

.product-card-stock-pill {
  font-size: 10px;
  font-weight: 600;
  color: #047857;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.dark .product-card-stock-pill {
  background: #1c1c1c;
  border-color: #2e2e2e;
  color: #a3a3a3;
}
.product-card-stock-pill.is-empty {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #b91c1c !important;
}
.dark .product-card-stock-pill.is-empty {
  background: #2a1515 !important;
  border-color: #4a1d1d !important;
  color: #f87171 !important;
}

.product-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
  word-break: break-word;
  width: 100%;
}

.product-card-grup {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  letter-spacing: normal;
  text-transform: capitalize;
}

.product-card-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-hairline);
  width: 100%;
}

.product-card-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.product-card-price {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  color: #047857;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.dark .product-card-price {
  color: #34d399;
}

.product-card-unit {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--color-ink-mute);
  white-space: nowrap;
}

.btn-pos-add-full {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ecfdf5;
  color: #047857;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #a7f3d0;
  cursor: pointer;
  transition: all 0.12s ease;
  box-sizing: border-box;
}

.btn-pos-add-full svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0;
  display: inline-block;
}

.btn-pos-add-full:hover {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-pos-add-full:active {
  transform: scale(0.97);
}

.dark .btn-pos-add-full {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: none;
}

.dark .btn-pos-add-full:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.pos-stepper-full {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecfdf5;
  border: 1.5px solid #10b981;
  border-radius: 8px;
  padding: 0 3px;
  box-sizing: border-box;
}

.dark .pos-stepper-full {
  background: rgba(16, 185, 129, 0.14);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
}

.pos-stepper-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #10b981;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
  flex-shrink: 0;
}

.pos-stepper-btn:hover {
  background: #059669;
}

.dark .pos-stepper-btn {
  background: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.dark .pos-stepper-btn:hover {
  background: rgba(16, 185, 129, 0.5);
  color: #ffffff;
}

.pos-stepper-btn:active {
  transform: scale(0.88);
}

.pos-stepper-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #065f46;
  text-align: center;
  flex: 1;
}

.dark .pos-stepper-val {
  color: #a7f3d0;
}

.badge-out-of-stock-full {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--color-canvas-soft);
  color: #ef4444;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--color-hairline);
  box-sizing: border-box;
}

/* =============================================================================
   29. APP FOOTER (Seamless Minimal Watermark)
   ============================================================================= */
.app-footer {
  padding: 24px 16px calc(90px + env(safe-area-inset-bottom)) 16px;
  margin-top: auto;
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-ink-mute);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100%;
  box-sizing: border-box;
  clear: both;
}

.app-footer a {
  color: #2563eb !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  transition: opacity 0.15s ease;
}

.app-footer a:hover {
  opacity: 0.85;
  text-decoration: underline !important;
}

/* Hilangkan spinner panah atas/bawah pada input type number */
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}
.no-spinner {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* =============================================================================
   30. SEARCHABLE SELECT COMPONENT (.sd-*)
   ============================================================================= */
.sd-wrapper, .sd-trigger, .sd-value, .sd-arrow {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.sd-wrapper {
  position: relative;
  width: 100%;
}

.sd-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background-color: var(--color-canvas) !important;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md, 8px);
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease-in-out;
  font-size: 13px;
  gap: 8px;
  box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,0.04));
  color: var(--color-ink);
}

.sd-trigger:hover {
  border-color: var(--color-primary-soft, #3ecf8e);
  background-color: var(--color-canvas-soft) !important;
}

.sd-trigger:focus,
.sd-trigger.open {
  border-color: var(--color-primary, #10b981) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  outline: 0 !important;
}

.sd-trigger .sd-value {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-ink);
  font-weight: 600;
}

.sd-trigger .sd-value.sd-placeholder {
  color: var(--color-ink-mute);
  font-weight: 400;
}

.sd-trigger .sd-arrow {
  flex-shrink: 0;
  color: var(--color-ink-mute);
  transition: transform 0.2s ease;
}

.sd-trigger.open .sd-arrow {
  transform: rotate(180deg);
  color: var(--color-primary);
}

.sd-dropdown {
  display: none;
  position: fixed;
  background: var(--color-canvas, #ffffff);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: var(--rounded-md, 8px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 99999;
  overflow: hidden;
  animation: sdFadeIn 0.15s ease;
  min-width: 200px;
}

@keyframes sdFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sd-dropdown.open { display: block; }

.sd-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--color-hairline, #e2e8f0);
  position: sticky;
  top: 0;
  background: var(--color-canvas, #ffffff);
  z-index: 1;
}

.sd-search {
  width: 100%;
  padding: 6px 10px 6px 32px;
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: 6px;
  font-size: 12.5px;
  background: var(--color-canvas-soft, #f8fafc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
  color: var(--color-ink);
  transition: border-color 0.15s;
}

.sd-search:focus {
  border-color: var(--color-primary, #10b981);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.sd-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.sd-group-label {
  padding: 6px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary, #10b981);
  background: var(--color-canvas-soft, #f8fafc);
}

.sd-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--color-ink);
  transition: background 0.1s;
}

.sd-option:hover,
.sd-option.focused {
  background: var(--color-canvas-soft, #f1f5f9);
  color: var(--color-primary, #10b981);
}

.sd-option.selected {
  background: rgba(16, 185, 129, 0.08);
  font-weight: 700;
  color: var(--color-primary, #10b981);
}

.sd-option .sd-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  white-space: nowrap;
  font-weight: 600;
}

.sd-empty {
  padding: 16px;
  text-align: center;
  color: var(--color-ink-mute);
  font-size: 12px;
}

/* --- Reusable Alpine Searchable Dropdown Styles --- */
.dropdown-menu-searchable {
  background: var(--color-canvas, #ffffff);
  border: 1px solid var(--color-hairline, #e2e8f0);
  box-shadow: 0 14px 34px -4px rgba(0, 0, 0, 0.16), 0 6px 14px -4px rgba(0, 0, 0, 0.08);
  border-radius: var(--rounded-md, 12px);
  animation: sdFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .dropdown-menu-searchable {
  background: var(--color-canvas-soft, #1e293b);
  border-color: var(--color-hairline-strong, #334155);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6);
}

.searchable-option {
  transition: background-color 0.12s ease, border-color 0.12s ease;
  border-left: 3px solid transparent;
}

.searchable-option:hover {
  background-color: var(--color-canvas-soft, #f8fafc) !important;
}

.dark .searchable-option:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

.searchable-option.is-selected {
  background-color: rgba(99, 102, 241, 0.08) !important;
  border-left: 3px solid #6366f1 !important;
}

.dark .searchable-option.is-selected {
  background-color: rgba(99, 102, 241, 0.2) !important;
  border-left: 3px solid #818cf8 !important;
}

.searchable-option.is-active {
  background-color: rgba(99, 102, 241, 0.09) !important;
  border-left: 3px solid #6366f1 !important;
  outline: none !important;
}

.dark .searchable-option.is-active {
  background-color: rgba(99, 102, 241, 0.22) !important;
  border-left: 3px solid #818cf8 !important;
  outline: none !important;
}

/* =============================================================================
   31. KEYBOARD NAVIGATION SHORTCUTS BANNER (.keyboard-nav-info)
   ============================================================================= */
.keyboard-nav-info {
  background: var(--color-canvas-soft, #f8fafc);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-left: 4px solid var(--color-primary, #10b981) !important;
  border-radius: var(--rounded-md, 8px);
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}

/* Sembunyikan panduan keyboard navigation di layar mobile / sentuh kecil */
@media (max-width: 768px) {
  .keyboard-nav-info {
    display: none !important;
  }
}

.kbd-badge {
  background: var(--color-canvas, #ffffff);
  color: var(--color-ink, #1e293b);
  border: 1px solid var(--color-hairline, #cbd5e1);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
}

.dark .keyboard-nav-info {
  background: #28292c;
  border-color: #3c4043;
  border-left: 4px solid #8ab4f8 !important;
}

.dark .kbd-badge {
  background: #202124;
  color: #e8eaed;
  border-color: #5f6368;
}

/* =============================================================================
   32. UNIVERSAL ADAPTIVE THEME UTILITIES (Light & Dark Zero-Flicker)
   ============================================================================= */
.text-slate-50, .text-slate-100, .text-slate-200, .text-slate-300 {
  color: var(--color-ink) !important;
}

.text-slate-400, .text-slate-500 {
  color: var(--color-ink-mute) !important;
}

.bg-slate-900, .bg-slate-950 {
  background-color: var(--color-canvas-soft) !important;
}

.border-slate-700, .border-slate-800, .border-slate-900 {
  border-color: var(--color-hairline) !important;
}

.dark .text-slate-50, .dark .text-slate-100, .dark .text-slate-200, .dark .text-slate-300 {
  color: var(--color-ink) !important;
}

.dark .text-slate-400, .dark .text-slate-500 {
  color: var(--color-ink-mute) !important;
}

.dark .bg-slate-900, .dark .bg-slate-950 {
  background-color: var(--color-canvas-night-soft) !important;
}

.dark .border-slate-700, .dark .border-slate-800, .dark .border-slate-900 {
  border-color: var(--color-hairline) !important;
}

/* =============================================================================
   33. SKELETON SCREEN & SHIMMER LOADING ENGINE (GHOST UI)
   ============================================================================= */

/* --- Shimmer Animation Keyframes --- */
@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes appLoaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Base Skeleton Shimmer Element --- */
.skeleton-shimmer,
.skeleton-box,
.skeleton-circle,
.skeleton-line,
.skeleton-pill,
.skeleton-card {
  background: linear-gradient(
    90deg,
    rgba(226, 232, 240, 0.75) 0%,
    rgba(241, 245, 249, 0.95) 35%,
    rgba(248, 250, 252, 1) 50%,
    rgba(241, 245, 249, 0.95) 65%,
    rgba(226, 232, 240, 0.75) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.dark .skeleton-shimmer,
.dark .skeleton-box,
.dark .skeleton-circle,
.dark .skeleton-line,
.dark .skeleton-pill,
.dark .skeleton-card {
  background: linear-gradient(
    90deg,
    rgba(30, 41, 59, 0.85) 0%,
    rgba(51, 65, 85, 0.95) 35%,
    rgba(71, 85, 105, 0.85) 50%,
    rgba(51, 65, 85, 0.95) 65%,
    rgba(30, 41, 59, 0.85) 100%
  );
  background-size: 200% 100%;
}

.skeleton-circle {
  border-radius: 50% !important;
  flex-shrink: 0;
}

.skeleton-pill {
  border-radius: 9999px !important;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
}

/* --- Global Full-Page Ghost Skeleton Overlay --- */
#app-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: rgba(248, 250, 252, 0.76);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

.dark #app-page-loader {
  background: rgba(15, 23, 42, 0.78);
}

#app-page-loader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

html.has-pending-action #app-page-loader {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Floating Status Pill */
.skeleton-floating-status {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 10000000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 7px 16px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.dark .skeleton-floating-status {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
}

.skeleton-spinner-mini {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #f59e0b;
  animation: appLoaderSpin 0.65s linear infinite;
}

/* Skeleton Ghost Layout Canvas */
.skeleton-ghost-canvas {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  pointer-events: none;
}

.skeleton-ghost-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.skeleton-ghost-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.skeleton-ghost-card {
  background: var(--color-canvas, #ffffff);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: var(--rounded-lg, 14px);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}

.dark .skeleton-ghost-card {
  background: var(--color-canvas, #0f172a);
  border-color: var(--color-hairline, #1e293b);
}

.skeleton-ghost-table-wrap {
  background: var(--color-canvas, #ffffff);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: var(--rounded-lg, 14px);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.dark .skeleton-ghost-table-wrap {
  background: var(--color-canvas, #0f172a);
  border-color: var(--color-hairline, #1e293b);
}

.skeleton-ghost-table-head {
  padding: 14px 20px;
  background: var(--color-canvas-soft, #f8fafc);
  border-bottom: 1px solid var(--color-hairline, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 20px;
}

.skeleton-ghost-table-row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-hairline, #f1f5f9);
  display: flex;
  align-items: center;
  gap: 20px;
}

.dark .skeleton-ghost-table-row {
  border-bottom-color: rgba(30, 41, 59, 0.5);
}

/* =============================================================================
   34. ACTION PROCESSING & KINETIC SUCCESS MORPH ENGINE (#app-action-loader)
   ============================================================================= */
#app-action-loader {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 16px;
}

.dark #app-action-loader {
  background: rgba(9, 13, 22, 0.72);
}

#app-action-loader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- Action Frosted Glass Card --- */
.action-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 36px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25),
              0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  transform: scale(0.92) translateY(8px);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.28s ease;
  min-width: 240px;
  max-width: 320px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.dark .action-loader-card {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(51, 65, 85, 0.9);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

#app-action-loader.is-active .action-loader-card {
  transform: scale(1) translateY(0);
}

/* --- Visual Stage (Dual Orb Spinner -> Morph Checkmark) --- */
.action-visual-stage {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pulse Glow Ring */
.action-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(225, 29, 72, 0.3);
  animation: actionPulseGlow 1.6s ease-out infinite;
  transition: border-color 0.3s ease;
}

/* Outer Spinner Ring (Rose) */
.action-spinner-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #e11d48;
  border-right-color: #f43f5e;
  animation: appLoaderSpin 0.75s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Inner Spinner Ring (Amber) */
.action-spinner-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: #f59e0b;
  border-left-color: #fbbf24;
  animation: appLoaderSpinReverse 0.9s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Center Logo */
.action-center-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #ffffff;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.45);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* --- Morph Success Checkmark Circle --- */
.action-success-orb {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
  opacity: 0;
  transform: scale(0.4) rotate(-45deg);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.action-success-svg {
  width: 30px;
  height: 30px;
  stroke: #ffffff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 0.35s 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Morph Error X Circle --- */
.action-error-orb {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.45);
  opacity: 0;
  transform: scale(0.4) rotate(45deg);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.action-error-svg {
  width: 28px;
  height: 28px;
  stroke: #ffffff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.action-error-svg line {
  stroke-dasharray: 25;
  stroke-dashoffset: 25;
  transition: stroke-dashoffset 0.35s 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Success State Active Classes --- */
#app-action-loader.is-success .action-pulse-ring {
  border-color: rgba(16, 185, 129, 0.35);
  animation: actionPulseGlowSuccess 1.4s ease-out infinite;
}

#app-action-loader.is-success .action-spinner-outer,
#app-action-loader.is-success .action-spinner-inner,
#app-action-loader.is-success .action-center-logo {
  opacity: 0;
  transform: scale(0.6);
}

#app-action-loader.is-success .action-success-orb {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#app-action-loader.is-success .action-success-svg {
  stroke-dashoffset: 0;
}

#app-action-loader.is-success .action-loader-text {
  color: #10b981;
}

#app-action-loader.is-success .action-loader-bar {
  animation: none;
  left: 0;
  width: 100%;
  background: #10b981;
}

/* --- Error State Active Classes --- */
#app-action-loader.is-error .action-pulse-ring {
  border-color: rgba(239, 68, 68, 0.35);
  animation: actionPulseGlowError 1.4s ease-out infinite;
}

#app-action-loader.is-error .action-spinner-outer,
#app-action-loader.is-error .action-spinner-inner,
#app-action-loader.is-error .action-center-logo {
  opacity: 0;
  transform: scale(0.6);
}

#app-action-loader.is-error .action-error-orb {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#app-action-loader.is-error .action-error-svg line {
  stroke-dashoffset: 0;
}

#app-action-loader.is-error .action-loader-text {
  color: #ef4444;
}

#app-action-loader.is-error .action-loader-bar {
  animation: none;
  left: 0;
  width: 100%;
  background: #ef4444;
}

#app-action-loader.is-error .action-loader-card {
  animation: actionCardShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Action Text */
.action-loader-text {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-ink, #0f172a);
  letter-spacing: -0.01em;
  margin: 0;
  transition: color 0.2s ease;
}

/* Action Subtext (Optional brief description / reference) */
.action-loader-subtext {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  margin: -8px 0 0 0;
  line-height: 1.35;
  max-width: 260px;
  word-break: break-word;
}

.dark .action-loader-subtext {
  color: #94a3b8;
}

#app-action-loader.is-success,
#app-action-loader.is-error {
  cursor: pointer;
}

/* Action Progress Bar */
.action-loader-track {
  width: 140px;
  height: 3.5px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.action-loader-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(90deg, #e11d48, #f59e0b);
  border-radius: 999px;
  animation: appLoaderIndeterminate 1.3s infinite ease-in-out;
  transition: background 0.3s ease, width 0.3s ease, left 0.3s ease;
}

/* Animations */
@keyframes appLoaderSpinReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes actionPulseGlow {
  0% { transform: scale(0.88); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes actionPulseGlowSuccess {
  0% { transform: scale(0.88); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes actionPulseGlowError {
  0% { transform: scale(0.88); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes actionCardShake {
  10%, 90% { transform: scale(1) translate3d(-1px, 0, 0); }
  20%, 80% { transform: scale(1) translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: scale(1) translate3d(-4px, 0, 0); }
  40%, 60% { transform: scale(1) translate3d(4px, 0, 0); }
}

/* =============================================================================
   35. PRINT MEDIA OPTIMIZATIONS
   ============================================================================= */
@media print {
  #app-page-loader,
  #app-page-skeleton,
  #app-action-loader,
  .skeleton-floating-status,
  .modal-backdrop,
  .toast-container,
  .sidebar,
  .sidebar-overlay,
  .page-header-actions,
  .app-footer {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* =============================================================================
   36. MATERIAL DESIGN 3 (M3) DIALOG & POS CHECKOUT SYSTEM
   ============================================================================= */
.m3-dialog {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  background: var(--color-canvas, #ffffff);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.22), 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: m3DialogEnter 0.22s cubic-bezier(0.05, 0.7, 0.1, 1);
  border: 1px solid var(--color-hairline, rgba(226, 232, 240, 0.8));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.m3-dialog::-webkit-scrollbar {
  width: 5px;
}

.m3-dialog::-webkit-scrollbar-track {
  background: transparent;
}

.m3-dialog::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

.m3-dialog::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

.m3-drag-handle {
  display: none;
}

.dark .m3-dialog {
  background: #1e293b;
  border-color: rgba(51, 65, 85, 0.8);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

@keyframes m3DialogEnter {
  0% { opacity: 0; transform: scale(0.94) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* M3 Header */
.m3-dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.m3-dialog-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dark .m3-dialog-icon {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.m3-dialog-title-group {
  flex: 1;
  min-width: 0;
}

.m3-dialog-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-ink, #0f172a);
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.m3-dialog-subtitle {
  font-size: 12px;
  color: var(--color-ink-mute, #64748b);
  margin: 2px 0 0 0;
}

.m3-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-ink-mute, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.m3-icon-btn:hover {
  background: rgba(148, 163, 184, 0.15);
  color: var(--color-ink, #0f172a);
}

/* M3 Hero Total Tagihan (Tonal Container) */
.m3-hero-total {
  background: var(--color-canvas-soft, #f8fafc);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dark .m3-hero-total {
  background: #0f172a;
  border-color: #334155;
}

.m3-hero-total-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-mute, #64748b);
  margin-bottom: 2px;
}

.m3-hero-total-amount {
  font-size: 26px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 900;
  color: var(--color-ink, #0f172a);
  letter-spacing: -0.02em;
}

.m3-hero-total-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.dark .m3-hero-total-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

/* M3 Segmented Button Group */
.m3-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m3-section-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-ink-secondary, #475569);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.m3-segmented-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--color-canvas-soft, #f1f5f9);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
  border: 1px solid var(--color-hairline, #e2e8f0);
}

.dark .m3-segmented-group {
  background: #0f172a;
  border-color: #334155;
}

.m3-segment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--color-ink-mute, #64748b);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-segment-btn:hover {
  color: var(--color-ink, #0f172a);
}

.m3-segment-btn.is-selected {
  background: var(--color-canvas, #ffffff);
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.dark .m3-segment-btn.is-selected {
  background: #1e293b;
  color: #60a5fa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* M3 Text Field Area */
.m3-cash-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m3-text-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m3-text-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.m3-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-ink, #0f172a);
}

.m3-text-action-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.m3-text-action-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

.m3-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.m3-input-prefix {
  position: absolute;
  left: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--color-ink-mute, #94a3b8);
  pointer-events: none;
}

.m3-input-text {
  width: 100%;
  height: 46px;
  background: var(--color-canvas, #ffffff);
  border: 1.5px solid var(--color-hairline, #cbd5e1);
  border-radius: 12px;
  padding-left: 44px;
  padding-right: 14px;
  font-size: 19px;
  font-weight: 800;
  color: var(--color-ink, #0f172a);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .m3-input-text {
  background: #0f172a;
  border-color: #334155;
}

.m3-input-text:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* M3 Suggestion Chips Row */
.m3-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.m3-chip {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-hairline, #e2e8f0);
  background: var(--color-canvas-soft, #f8fafc);
  color: var(--color-ink, #0f172a);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dark .m3-chip {
  background: #0f172a;
  border-color: #334155;
}

.m3-chip:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

/* M3 Status Banner */
.m3-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.m3-status-banner.is-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #065f46;
}

.dark .m3-status-banner.is-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.m3-status-banner.is-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #991b1b;
}

.dark .m3-status-banner.is-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.m3-status-banner.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #b45309;
}

.dark .m3-status-banner.is-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.m3-drawer-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-canvas-soft, #f8fafc);
  border: 1px solid var(--color-hairline, #e2e8f0);
  border-radius: 12px;
  margin-bottom: 4px;
}

.dark .m3-drawer-indicator {
  background: rgba(30, 41, 59, 0.5);
  border-color: #334155;
}

.m3-drawer-indicator-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.m3-drawer-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dark .m3-drawer-icon-box {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.m3-drawer-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.m3-drawer-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-mute, #64748b);
  line-height: 1.1;
  white-space: nowrap;
}

.m3-drawer-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-ink, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.m3-drawer-indicator-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  text-align: right;
}

.m3-drawer-balance-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-ink-mute, #64748b);
  line-height: 1.1;
  white-space: nowrap;
}

.m3-drawer-balance-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-primary-deep, #1d4ed8);
  line-height: 1.3;
  white-space: nowrap;
}

.dark .m3-drawer-balance-val {
  color: #60a5fa;
}

.m3-drawer-shortage-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dark .m3-drawer-shortage-card {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.m3-shortage-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.m3-shortage-icon-box {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.2);
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.dark .m3-shortage-icon-box {
  color: #fbbf24;
}

.m3-shortage-body {
  flex: 1;
  min-width: 0;
}

.m3-shortage-title {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  line-height: 1.2;
}

.dark .m3-shortage-title {
  color: #fbbf24;
}

.m3-shortage-desc {
  font-size: 11px;
  color: #78350f;
  margin-top: 3px;
  line-height: 1.4;
}

.dark .m3-shortage-desc {
  color: #fde68a;
}

.m3-shortage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.m3-shortage-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: var(--color-canvas, #ffffff);
  color: #92400e;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dark .m3-shortage-btn {
  background: #1e293b;
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.m3-shortage-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #d97706;
}

.m3-shortage-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(217, 119, 6, 0.3);
  font-size: 11px;
  color: #78350f;
  cursor: pointer;
  user-select: none;
}

.dark .m3-shortage-checkbox-label {
  color: #fde68a;
  border-top-color: rgba(245, 158, 11, 0.25);
}

.m3-status-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
}

.m3-status-banner-amount {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

/* M3 QRIS Area */
.m3-qris-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(225, 29, 72, 0.06);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.m3-qris-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m3-qris-text {
  flex: 1;
}

.m3-qris-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--color-ink, #0f172a);
  margin-bottom: 2px;
}

.m3-qris-desc {
  font-size: 11.5px;
  color: var(--color-ink-secondary, #475569);
  line-height: 1.45;
}

/* M3 Dialog Actions */
.m3-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.m3-btn-outlined {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--color-hairline, #cbd5e1);
  background: transparent;
  color: var(--color-ink, #0f172a);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.m3-btn-outlined:hover {
  background: var(--color-canvas-soft, #f1f5f9);
}

.dark .m3-btn-outlined {
  border-color: #475569;
  color: #f1f5f9;
}

.m3-btn-filled {
  flex: 2;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-btn-filled:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.m3-btn-filled:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* M3 Suggestion Chips Responsive Flex */
.m3-chip {
  flex: 1 1 auto;
  text-align: center;
}

/* M3 Responsive Mobile & Tablet Rules */
@media (min-width: 641px) {
  .m3-payment-backdrop {
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
  }
}

@media (max-width: 640px) {
  .m3-payment-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .m3-dialog {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 0 !important;
    padding: 12px 16px 18px 16px !important;
    gap: 12px;
    animation: drawerSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .m3-drag-handle {
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--color-ink-mute, #cbd5e1);
    margin: 0 auto 6px auto;
    opacity: 0.6;
    flex-shrink: 0;
  }

  .m3-hero-total {
    padding: 12px 14px;
  }

  .m3-hero-total-amount {
    font-size: 22px;
  }

  .m3-dialog-actions {
    position: sticky;
    bottom: -18px;
    margin-bottom: -18px;
    padding-top: 10px;
    padding-bottom: 18px;
    background: var(--color-canvas, #ffffff);
    border-top: 1px solid var(--color-hairline, #e2e8f0);
    z-index: 20;
  }

  .dark .m3-dialog-actions {
    background: #1e293b;
    border-top-color: #334155;
  }
}

/* =============================================================================
   APP CONFIRM & ALERT MODAL DIALOG (High-Clarity, Responsive, Light & Dark)
   ============================================================================= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}

.dark .confirm-modal {
  background: #181f2c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.confirm-modal-body {
  padding: 24px 24px 18px;
}

.confirm-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.confirm-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.confirm-icon-box svg,
.confirm-icon-box i {
  width: 22px;
  height: 22px;
}

.confirm-icon-danger {
  background: #fee2e2;
  color: #e11d48;
  border: 1px solid #fecaca;
}
.dark .confirm-icon-danger {
  background: rgba(225, 29, 72, 0.18);
  color: #fb7185;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.confirm-icon-warning {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}
.dark .confirm-icon-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.confirm-icon-info,
.confirm-icon-primary {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
.dark .confirm-icon-info,
.dark .confirm-icon-primary {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.confirm-icon-success {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.dark .confirm-icon-success {
  background: rgba(22, 163, 74, 0.18);
  color: #4ade80;
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.confirm-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.confirm-close-btn svg,
.confirm-close-btn i {
  width: 18px;
  height: 18px;
}

.confirm-close-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.dark .confirm-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.dark .confirm-title {
  color: #f8fafc;
}

.confirm-message {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.55;
  white-space: pre-line;
}
.dark .confirm-message {
  color: #94a3b8;
}

.confirm-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  width: fit-content;
  max-width: 100%;
}
.confirm-account-pill svg,
.confirm-account-pill i {
  width: 14px;
  height: 14px;
  color: #2563eb;
  flex-shrink: 0;
}
.confirm-account-pill strong {
  font-weight: 700;
  color: #0f172a;
}
.dark .confirm-account-pill {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
.dark .confirm-account-pill svg,
.dark .confirm-account-pill i {
  color: #60a5fa;
}
.dark .confirm-account-pill strong {
  color: #f8fafc;
}

.confirm-subnotice {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: 10px;
  font-size: 12px;
  color: #b91c1c;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.confirm-subnotice svg,
.confirm-subnotice i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1.5px;
  color: #e11d48;
}
.dark .confirm-subnotice {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}
.dark .confirm-subnotice svg,
.dark .confirm-subnotice i {
  color: #fb7185;
}

.confirm-modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dark .confirm-modal-footer {
  background: #141a24;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.confirm-btn-cancel {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}
.confirm-btn-cancel:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}
.dark .confirm-btn-cancel {
  background: #232a38;
  border-color: #384252;
  color: #cbd5e1;
}
.dark .confirm-btn-cancel:hover {
  background: #2e3646;
  color: #ffffff;
  border-color: #4b5563;
}

.confirm-btn-action {
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
}
.confirm-btn-action svg,
.confirm-btn-action i {
  width: 15px;
  height: 15px;
}

.confirm-btn-action.btn-action-danger {
  background: #e11d48;
  color: #ffffff;
  border-color: #be123c;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}
.confirm-btn-action.btn-action-danger:hover {
  background: #be123c;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.45);
}
.confirm-btn-action.btn-action-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.confirm-btn-action.btn-action-warning {
  background: #d97706;
  color: #ffffff;
  border-color: #b45309;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}
.confirm-btn-action.btn-action-warning:hover {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.45);
}

.confirm-btn-action.btn-action-primary,
.confirm-btn-action.btn-action-info {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.confirm-btn-action.btn-action-primary:hover,
.confirm-btn-action.btn-action-info:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.confirm-btn-action.btn-action-success {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}
.confirm-btn-action.btn-action-success:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .confirm-modal {
    width: calc(100% - 24px);
    max-width: 100%;
    border-radius: 18px;
  }
  .confirm-modal-body {
    padding: 20px 18px 16px;
  }
  .confirm-header-row {
    gap: 10px;
    margin-bottom: 12px;
  }
  .confirm-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
  .confirm-icon-box svg,
  .confirm-icon-box i {
    width: 20px;
    height: 20px;
  }
  .confirm-title {
    font-size: 16px;
  }
  .confirm-message {
    font-size: 13px;
  }
  .confirm-modal-footer {
    padding: 12px 16px;
    flex-direction: row;
    gap: 8px;
  }
  .confirm-btn-cancel,
  .confirm-btn-action {
    flex: 1;
    justify-content: center;
    padding: 11px 12px;
    font-size: 13px;
  }
}





