/* ========================================================
   INVENTORY SYSTEM - MODERN MOBILE-FIRST CSS DESIGN SYSTEM
   Sederhana, Ringan, Cepat, Responsif
   ======================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-dark: #1e40af;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-text: #065f46;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-text: #92400e;
  
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-text: #991b1b;
  
  --role-admin: #2563eb;
  --role-owner: #7c3aed;
  --role-owner-light: #f5f3ff;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bottom-nav-height: 56px;
  --header-height: 52px;

  /* Red-Orange Glassmorphism Design Tokens */
  --accent-orange: #ea580c;
  --accent-orange-hover: #c2410c;
  --accent-orange-light: #fff7ed;
  --accent-orange-glow: rgba(234, 88, 12, 0.15);
  --accent-orange-border: rgba(234, 88, 12, 0.25);
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(234, 88, 12, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(234, 88, 12, 0.08);
}

/* ========================================================
   TYPOGRAPHY & FONT SIZE SCALING SYSTEM
   ======================================================== */
html {
  font-size: 14px;
}
@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}
html[data-font-size="sm"] {
  font-size: 12.5px;
}
@media (min-width: 768px) {
  html[data-font-size="sm"] {
    font-size: 13.5px;
  }
}
html[data-font-size="md"] {
  font-size: 14px;
}
@media (min-width: 768px) {
  html[data-font-size="md"] {
    font-size: 15px;
  }
}
html[data-font-size="lg"] {
  font-size: 15.5px;
}
@media (min-width: 768px) {
  html[data-font-size="lg"] {
    font-size: 16.5px;
  }
}

/* ========================================================
   DARK THEME COLOR PALETTE (PREMIUM MIDNIGHT ACCENT)
   ======================================================== */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;
  --primary-dark: #93c5fd;
  
  --success: #10b981;
  --success-light: #064e3b;
  --success-text: #6ee7b7;
  
  --warning: #f59e0b;
  --warning-light: #451a03;
  --warning-text: #fde68a;
  
  --danger: #ef4444;
  --danger-light: #450a0a;
  --danger-text: #fca5a5;
  
  --role-admin: #3b82f6;
  --role-owner: #c084fc;
  --role-owner-light: #2e1065;

  --bg: #0b0f19;
  --surface: #111827;
  --surface-subtle: #1f2937;
  --border: #374151;
  --border-focus: #ea580c;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6);

  /* Red-Orange Glassmorphism in Dark Mode */
  --accent-orange: #fb923c;
  --accent-orange-hover: #ea580c;
  --accent-orange-light: #431407;
  --accent-orange-glow: rgba(251, 146, 60, 0.22);
  --accent-orange-border: rgba(251, 146, 60, 0.35);
  --glass-bg: rgba(17, 24, 39, 0.82);
  --glass-border: rgba(251, 146, 60, 0.22);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .login-screen-overlay {
  background: #0b0f19;
  color: #f9fafb;
}

[data-theme="dark"] .login-topbar {
  background: #111827;
  border-bottom: 1px solid #1f2937;
}

[data-theme="dark"] .login-brand-badge {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

[data-theme="dark"] .login-underline-input {
  border-bottom-color: #4b5563;
  color: #f9fafb;
}

[data-theme="dark"] .login-underline-input:focus {
  border-bottom-color: #f59e0b;
}

[data-theme="dark"] .splash-container {
  background: #0b0f19;
}

[data-theme="dark"] .splash-title {
  color: #f59e0b;
}

[data-theme="dark"] .splash-tagline {
  color: #9ca3af;
}

[data-theme="dark"] .btn-login-back {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

[data-theme="dark"] .badge-role.admin {
  background: #1e293b;
  color: #93c5fd;
  border-color: #2563eb;
}

[data-theme="dark"] .badge-role.owner {
  background: #2e1065;
  color: #e9d5ff;
  border-color: #7c3aed;
}

[data-theme="dark"] .btn-logout {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

[data-theme="dark"] .btn-outline {
  border-color: var(--border);
  color: var(--text-main);
  background: var(--surface);
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--surface-subtle);
  border-color: var(--border-focus);
}

[data-theme="dark"] .form-control {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--border-focus);
  background: var(--surface);
}

[data-theme="dark"] .table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border-color: var(--border);
}

[data-theme="dark"] .table td {
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .table tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .btn-guide-pill {
  background: rgba(31, 41, 55, 0.85);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

[data-theme="dark"] .btn-guide-pill:hover {
  background: #1f2937;
  color: #f59e0b;
}

[data-theme="dark"] .guide-card-gold {
  background: linear-gradient(135deg, #2b1f06 0%, #3f2f0a 100%);
  border-color: #92400e;
  color: #fef3c7;
}

[data-theme="dark"] .guide-rules-box {
  background: #2b1f06;
  border-left-color: #f59e0b;
}

[data-theme="dark"] .guide-tabs-nav {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .btn-guide-tab {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

[data-theme="dark"] .btn-guide-tab:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .btn-guide-tab.active {
  background: #1e293b;
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 10px rgba(251, 191, 36, 0.12);
}

[data-theme="dark"] .guide-item-title {
  color: #fbbf24;
}

[data-theme="dark"] .empty-state-modern {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-confirm-content {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .bottom-nav {
  background: var(--surface);
  border-top-color: var(--border);
}

[data-theme="dark"] .chart-card {
  background: var(--surface);
  border-color: var(--border);
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
  background-image: radial-gradient(circle at 5% 0%, rgba(249, 115, 22, 0.04) 0%, transparent 45%),
                    radial-gradient(circle at 95% 95%, rgba(234, 88, 12, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
}

[data-theme="dark"] body {
  background-image: radial-gradient(circle at 5% 0%, rgba(249, 115, 22, 0.07) 0%, transparent 45%),
                    radial-gradient(circle at 95% 95%, rgba(194, 65, 12, 0.07) 0%, transparent 45%);
  background-attachment: fixed;
}

.sidebar-header-label {
  display: none;
}

/* ========================================================
   HEADER & TOP BAR (COMPACT & UNCLUTTERED)
   ======================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 6px;
  box-shadow: 0 4px 20px rgba(234, 88, 12, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.brand-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text-wrap {
  min-width: 0;
  overflow: hidden;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.brand-subtitle {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.header-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0;
  transition: all 0.15s ease;
  user-select: none;
}

.header-icon-btn:active {
  transform: scale(0.92);
  background: var(--border);
}

.font-indicator {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: -0.05em;
  color: var(--text-main);
}

.badge-role {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  height: 28px;
  white-space: nowrap;
  transition: transform 0.15s ease;
}

.badge-role:active {
  transform: scale(0.96);
}

.badge-role.admin {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border);
}

.badge-role.owner {
  background: var(--role-owner-light);
  color: var(--role-owner);
  border: 1px solid #ddd6fe;
}

.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  height: 28px;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #94a3b8;
  flex-shrink: 0;
}

.conn-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 0 2px var(--success-light);
}

.conn-dot.mock {
  background-color: var(--warning);
}

.header-action-btn {
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 8px;
  white-space: nowrap;
  cursor: pointer;
}

.btn-logout {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid #fecaca;
  transition: all 0.15s ease;
}

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

/* ========================================================
   LAYOUT CONTAINER
   ======================================================== */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 12px 14px;
}

/* ========================================================
   TAB NAVIGATION (DESKTOP / MOBILE)
   ======================================================== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation (Mobile First) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  flex: 1 0 auto;
  min-width: 46px;
  max-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  transition: all 0.15s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  transition: transform 0.15s ease, stroke 0.15s ease;
}

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

.nav-item.active svg {
  stroke: var(--primary);
  transform: translateY(-1px);
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: transparent;
  border-radius: 0 0 3px 3px;
  transition: background-color 0.15s ease;
}

.nav-item.active::before {
  background: var(--primary);
}

/* ========================================================
   DASHBOARD STATS & KPI CARDS
   ======================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-orange-border);
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.1);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.kpi-desc {
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.kpi-card.kpi-safe {
  border-left: 3px solid #10b981;
}

.kpi-card.kpi-safe .kpi-value {
  color: #059669;
}

[data-theme="dark"] .kpi-card.kpi-safe .kpi-value {
  color: #34d399;
}

.kpi-card.warning {
  border-left: 3px solid #f59e0b;
}

.kpi-card.warning .kpi-value {
  color: var(--warning-text);
}

.kpi-card.danger {
  border-left: 3px solid #ef4444;
}

.kpi-card.danger .kpi-value {
  color: var(--danger-text);
}

.kpi-card.kpi-accent {
  border-left: 3px solid #ea580c;
}

.item-card.item-card-habis {
  border-left: 4px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.04);
}

.item-card.item-card-menipis {
  border-left: 4px solid #f59e0b !important;
  background: rgba(245, 158, 11, 0.04);
}

/* ========================================================
   BUTTONS & ACTION BARS
   ======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 42px;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--surface-subtle);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  min-height: 34px;
}

.action-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

/* ========================================================
   SEARCH, FILTER, & FORMS
   ======================================================== */
.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 180px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-subtle);
}

.select-filter {
  padding: 10px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ========================================================
   DATA CARDS & LISTS (MOBILE VIEW)
   ======================================================== */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-sku {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--surface-subtle);
  padding-top: 10px;
}

.stock-figure {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.stock-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-aman {
  background: var(--success-light);
  color: var(--success-text);
}

.badge-menipis {
  background: var(--warning-light);
  color: var(--warning-text);
}

.badge-habis {
  background: var(--danger-light);
  color: var(--danger-text);
}

.badge-kategori-inner {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-kategori-outer,
.badge-kategori-auther {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Phase 3: Expired Status Badges */
.badge-exp-none {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-exp-safe {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-exp-warn {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-exp-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulse 1.5s infinite;
}

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

/* Phase 3: Stock Adjustment Chip */
.selisih-chip {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.selisih-chip.plus {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid #a7f3d0;
}

.selisih-chip.minus {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid #fecaca;
}

.selisih-chip.zero {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Export Excel Button */
.btn-export {
  background: #107c41;
  color: #fff;
  border: 1px solid #0b5a2f;
  font-size: 0.8rem;
  padding: 8px 14px;
}

.btn-export:hover {
  background: #0b5a2f;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-filters .select-filter {
  flex: 1;
  min-width: 140px;
}

/* Minimalist Compact Date Range & Reset Control */
.date-range-compact {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px 8px;
  gap: 4px;
  height: 38px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.date-range-compact:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.date-range-icon {
  font-size: 0.8rem;
  opacity: 0.7;
  user-select: none;
  line-height: 1;
}

.date-input-compact {
  border: none !important;
  background: transparent !important;
  font-size: 0.76rem !important;
  font-family: inherit;
  color: var(--text-main);
  padding: 0 !important;
  width: 108px;
  min-width: 95px;
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
  user-select: none;
  padding: 0 2px;
  line-height: 1;
}

.btn-reset-compact {
  height: 38px !important;
  padding: 0 10px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-md) !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ========================================================
   TABLES (RESPONSIVE WRAPPER)
   ======================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.table-custom th {
  background: var(--surface-subtle);
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-custom td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

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

.table-custom tr:hover {
  background-color: #f8fafc;
}

/* ========================================================
   MODAL DIALOG (MOBILE BOTTOM-SHEET / DESKTOP CENTER)
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* ========================================================
   TOAST NOTIFICATION
   ======================================================== */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.2s ease-out;
  pointer-events: auto;
}

.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }

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

/* ========================================================
   EMPTY STATE & NOTICE CHIPS
   ======================================================== */
.empty-state {
  text-align: center;
  padding: 36px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.empty-state svg {
  width: 44px;
  height: 44px;
  stroke: var(--text-subtle);
  margin-bottom: 12px;
}

.owner-banner {
  background: var(--role-owner-light);
  border: 1px solid #ddd6fe;
  color: #5b21b6;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================================
   DESKTOP RESPONSIVE ENHANCEMENTS (>= 768px)
   ======================================================== */
@media (min-width: 768px) {
  body {
    padding-bottom: 24px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal-content {
    border-radius: var(--radius-lg);
    transform: scale(0.95);
  }

  .modal-overlay.active .modal-content {
    transform: scale(1);
  }

  /* Desktop Left-Hand Sidebar Navigation (Glassmorphic) */
  .bottom-nav {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: 220px;
    height: calc(100vh - var(--header-height));
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    border-top: none;
    box-shadow: 4px 0 20px rgba(234, 88, 12, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 16px 10px;
    gap: 6px;
    z-index: 35;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0;
  }

  [data-theme="dark"] .bottom-nav {
    background: rgba(17, 24, 39, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(251, 146, 60, 0.22);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar-header-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-orange);
    padding: 6px 12px 10px;
    opacity: 0.85;
  }

  .nav-item {
    flex: initial;
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: 40px;
    padding: 0 12px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
  }

  .nav-item::before {
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    right: auto;
    width: 3.5px;
    height: auto;
    border-radius: 0 4px 4px 0;
    background: transparent;
    transition: background-color 0.2s ease;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    transition: transform 0.2s ease, stroke 0.2s ease;
  }

  .nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-item:hover {
    background: rgba(249, 115, 22, 0.08);
    color: var(--accent-orange);
    transform: translateX(2px);
  }

  .nav-item.active {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.12), rgba(249, 115, 22, 0.18));
    color: var(--accent-orange);
    border: 1px solid rgba(234, 88, 12, 0.28);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.1);
    font-weight: 700;
  }

  .nav-item.active::before {
    background: var(--accent-orange);
  }

  .nav-item.active svg {
    stroke: var(--accent-orange);
    transform: scale(1.05);
  }

  [data-theme="dark"] .nav-item:hover {
    background: rgba(249, 115, 22, 0.14);
    color: #fb923c;
  }

  [data-theme="dark"] .nav-item.active {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.22), rgba(249, 115, 22, 0.3));
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.35);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25);
  }

  [data-theme="dark"] .nav-item.active svg {
    stroke: #fb923c;
  }

  /* Desktop App Container Margin Adjustment */
  .app-container {
    margin-left: 220px;
    max-width: calc(100% - 220px);
    padding: 20px 26px;
    padding-right: 84px; /* Space for the right floating action dock */
  }

  /* Hide the old wide banner quick actions on desktop */
  .quick-actions {
    display: none !important;
  }
}

/* ========================================================
   FLOATING ACTION DOCK (MINIMALIST 3D MINI-BUTTONS & RED-ORANGE GLASS)
   ======================================================== */
.floating-action-dock {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--accent-orange-border);
  border-radius: var(--radius-full);
  box-shadow: 0 12px 36px rgba(234, 88, 12, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .floating-action-dock {
  background: rgba(17, 24, 39, 0.82);
  border-color: rgba(251, 146, 60, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(234, 88, 12, 0.18);
}

.floating-mini-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  padding: 0;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-mini-btn:hover {
  transform: scale(1.14) translateY(-1px);
}

.floating-mini-btn:active {
  transform: scale(0.95);
}

/* 3D Spherical Lighting Effect for Mini-Buttons */
.icon-3d {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12),
              inset 0 1.5px 1.5px rgba(255, 255, 255, 0.65),
              inset 0 -2px 4px rgba(0, 0, 0, 0.15);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.icon-3d.emerald {
  background: linear-gradient(145deg, #34d399 0%, #10b981 50%, #047857 100%);
  color: #fff;
  border: 1px solid rgba(52, 211, 153, 0.5);
}

.icon-3d.crimson {
  background: linear-gradient(145deg, #f87171 0%, #ef4444 50%, #b91c1c 100%);
  color: #fff;
  border: 1px solid rgba(248, 113, 113, 0.5);
}

.icon-3d.amber {
  background: linear-gradient(145deg, #fcd34d 0%, #f59e0b 50%, #b45309 100%);
  color: #fff;
  border: 1px solid rgba(252, 211, 77, 0.5);
}

.icon-3d.blue {
  background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 50%, #1d4ed8 100%);
  color: #fff;
  border: 1px solid rgba(96, 165, 250, 0.5);
}

.icon-3d.orange-flame {
  background: linear-gradient(145deg, #fb923c 0%, #ea580c 50%, #c2410c 100%);
  color: #fff;
  border: 1px solid rgba(251, 146, 60, 0.6);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35),
              inset 0 1.5px 1.5px rgba(255, 255, 255, 0.75),
              inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

/* Tooltip on hover */
.floating-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.floating-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(15, 23, 42, 0.92);
}

.floating-mini-btn:hover .floating-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Mobile Responsiveness for Floating Dock */
@media (max-width: 767px) {
  .floating-action-dock {
    right: 12px;
    bottom: calc(var(--bottom-nav-height) + 16px);
    top: auto;
    transform: none;
    flex-direction: column;
    padding: 6px 4px;
    gap: 6px;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.18);
  }
  .floating-mini-btn {
    width: 36px;
    height: 36px;
  }
  .icon-3d {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .floating-tooltip {
    display: none;
  }
}

/* ========================================================
   PHASE 4: ANGKAStock BRANDING & AUTH SCREEN
   Tema Emas Elegan, Mobile-First & Responsif
   ======================================================== */

.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #fceda7 0%, #ecd079 40%, #e2be62 70%, #d4a745 100%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px 20px;
}

.login-screen-overlay.hidden {
  display: none !important;
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.btn-login-back {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #c2410c;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

.login-brand-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-brand-badge img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.login-brand-badge span {
  font-size: 0.65rem;
  font-weight: 800;
  color: #78350f;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.login-content-box {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 0;
}

.login-heading-hi {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ea580c;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.login-heading-welcome {
  font-size: 1.9rem;
  font-weight: 800;
  color: #ea580c;
  margin-bottom: 36px;
  letter-spacing: -0.02em;
}

.login-field-group {
  margin-bottom: 28px;
  text-align: center;
}

.login-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ea580c;
  margin-bottom: 4px;
}

.login-underline-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(217, 119, 6, 0.45);
  font-size: 1.35rem;
  font-weight: 800;
  color: #292524;
  text-align: center;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.2s;
  letter-spacing: 0.03em;
}

.login-underline-input:focus {
  border-bottom-color: #c2410c;
}

.login-pin-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-pin-wrapper input {
  letter-spacing: 0.25em;
}

.btn-toggle-pin {
  position: absolute;
  right: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #c2410c;
  padding: 4px;
}

.login-remember-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 28px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #78350f;
}

.login-remember-row input[type="checkbox"] {
  accent-color: #ea580c;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.btn-gold-login {
  width: 100%;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #78350f;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 14px 20px;
  border-radius: 9999px;
  border: none;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gold-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.45);
}

.btn-gold-login:active {
  transform: translateY(0);
}

.login-preset-roles {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #78350f;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover, .preset-chip.active {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
}

.login-pwa-box {
  text-align: center;
  margin-top: 14px;
}

.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #92400e;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-install-pwa:hover {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.login-footer-copy {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #78350f;
  letter-spacing: 0.05em;
  padding-top: 16px;
}

/* SPLASH VIEW (ANGKAStock COVER) */
.splash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  margin: auto;
}

.splash-logo {
  width: 90px;
  height: 90px;
  margin-bottom: 16px;
}

.splash-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #451a03;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.splash-tagline {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ea580c;
  margin-bottom: 32px;
}

.btn-splash-open {
  padding: 10px 48px;
  border-radius: 9999px;
  border: 2px solid #ea580c;
  background: rgba(255, 255, 255, 0.3);
  color: #c2410c;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.btn-splash-open:hover {
  background: #ea580c;
  color: #fff;
}

/* TOP HEADER USER & LOGOUT */
.btn-logout {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* OWNER GRAFIK & ANALYTICS */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-legend {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.svg-chart-container {
  width: 100%;
  overflow-x: auto;
}

/* ROLE ACCESS CONTROL HELPERS */
body.role-owner .admin-only {
  display: none !important;
}

body.role-admin .owner-only {
  display: none !important;
}

body.role-owner .admin-action-btn {
  display: none !important;
}

/* ========================================================
   PHASE 5: UI/UX POLISH, STATES, ACCESSIBILITY & PERFORMANCE
   ======================================================== */

/* 1. Global Progress Loading Bar */
.global-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, #d49f2b, #f59e0b, #10b981);
  background-size: 200% 100%;
  animation: progressAnimation 1.2s infinite linear;
}

@keyframes progressAnimation {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 2. Button Loading Spinners */
.btn.is-loading,
.btn-gold-login.is-loading {
  pointer-events: none;
  opacity: 0.85;
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: currentColor;
  animation: btnSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* 3. Skeleton Shimmer Loaders */
.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  display: block;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.full { width: 100%; }

/* 4. Modern Confirmation Dialog (Phase 5) */
.modal-confirm-content {
  max-width: 420px;
  text-align: center;
  padding: 24px 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-confirm-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
  line-height: 1;
}

.modal-confirm-message {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 8px 0 20px;
  line-height: 1.5;
}

.modal-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-confirm-actions button {
  flex: 1;
  padding: 10px 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* 5. Rich Empty State Cards */
.empty-state-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 12px 0;
  transition: border-color 0.2s;
}

.empty-state-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  line-height: 1;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.4;
  margin-bottom: 14px;
}

/* 6. Form Validation & Error States */
.form-control.is-invalid,
.login-underline-input.is-invalid {
  border-color: var(--danger) !important;
  background-color: #fef2f2 !important;
}

.field-feedback {
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

.field-feedback.error {
  color: var(--danger-text);
}

.field-feedback.success {
  color: var(--success-text);
}

/* 7. Accessibility & Keyboard Navigation */
:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--border-focus) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 8. Mobile & Compact Responsive Enhancements */
@media (max-width: 640px) {
  .top-header {
    height: 48px;
    padding: 0 8px;
    gap: 4px;
  }
  .brand-subtitle {
    display: none;
  }
  .brand-title {
    font-size: 0.85rem;
    max-width: 120px;
  }
  .conn-status {
    padding: 4px 6px;
  }
  .conn-status .conn-text {
    display: none;
  }
  .badge-role .role-phone-desktop {
    display: none;
  }
  .badge-role {
    padding: 2px 7px;
    font-size: 0.7rem;
    height: 26px;
  }
  .header-action-btn .btn-text-desktop {
    display: none;
  }
  .header-action-btn {
    padding: 0;
    width: 28px;
    height: 28px;
  }
  .header-icon-btn {
    width: 28px;
    height: 28px;
  }
  .header-actions {
    gap: 4px;
  }
  .app-container {
    padding: 10px 8px;
  }
  .card-item {
    padding: 10px;
  }
  .modal-confirm-content {
    margin: 16px;
    width: calc(100% - 32px);
  }
  .toolbar-filters {
    gap: 6px;
  }
  .search-box {
    min-width: 100% !important;
  }
  .kpi-grid {
    gap: 8px;
    margin-bottom: 12px;
  }
  .kpi-card {
    padding: 10px;
  }
  .kpi-value {
    font-size: 1.3rem;
  }
  .quick-actions {
    gap: 6px;
    margin-bottom: 14px;
  }
}

/* 9. Guide Modal & Button Styles */
.btn-guide-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(217, 119, 6, 0.4);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #92400e;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-guide-pill:hover {
  background: #ffffff;
  color: #b45309;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
  transform: translateY(-1px);
}

.guide-tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-top: 10px;
  margin-bottom: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.guide-tabs-nav::-webkit-scrollbar {
  display: none;
}

.btn-guide-tab {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-guide-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.btn-guide-tab.active {
  background: var(--surface);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.25);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(217, 119, 6, 0.1);
}

.guide-card-gold {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 12px;
}

.guide-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.guide-box-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.guide-box strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.guide-box p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guide-list-item {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.guide-list-item:last-child {
  border-bottom: none;
}

.guide-item-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #92400e;
  margin-bottom: 3px;
}

.guide-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.guide-step-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.guide-step-badge {
  background: #d97706;
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 9999px;
  white-space: nowrap;
}

.guide-step-card strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.guide-step-card p {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guide-rules-box {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px;
}

/* ==========================================
   ADVANCED FILTER & REPORTING ENHANCEMENTS
   ========================================== */
.preset-pill {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.preset-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.preset-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(194, 65, 12, 0.25);
}

.field-feedback.warning {
  color: #92400e;
  background: #fef3c7;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #fde68a;
  line-height: 1.35;
  margin-top: 5px;
}

.field-feedback.error {
  color: #b91c1c;
  background: #fef2f2;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  line-height: 1.35;
  margin-top: 5px;
}

.field-feedback.success {
  color: #15803d;
  background: #f0fdf4;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
  line-height: 1.35;
  margin-top: 5px;
}

.item-preview-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  animation: fadeIn 0.2s ease;
}

.item-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.date-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


