/* ========== BST Warehouse OS — Premium UI Design ========== */

/* ---------- Design Tokens ---------- */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #F0F1F5;
  --bg-white: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F6FA;
  --surface-3: #EAECF2;

  /* Text */
  --text: #1A1D29;
  --text-secondary: #4A4E5C;
  --text-muted: #8B8FA3;
  --text-white: #FFFFFF;

  /* Brand — vibrant gradient blues */
  --primary: #0066FF;
  --primary-hover: #0052D4;
  --primary-light: rgba(0, 102, 255, 0.10);
  --primary-glow: rgba(0, 102, 255, 0.35);
  --primary-grad: linear-gradient(135deg, #0066FF, #00B4D8);

  /* Semantic */
  --success: #22C55E;
  --success-grad: linear-gradient(135deg, #22C55E, #16A34A);
  --success-light: rgba(34, 197, 94, 0.12);
  --warning: #F59E0B;
  --warning-grad: linear-gradient(135deg, #F59E0B, #F97316);
  --warning-light: rgba(245, 158, 11, 0.12);
  --danger: #EF4444;
  --danger-grad: linear-gradient(135deg, #EF4444, #DC2626);
  --danger-light: rgba(239, 68, 68, 0.12);
  --info: #0EA5E9;
  --info-light: rgba(14, 165, 233, 0.12);
  --accent: #8B5CF6;
  --accent-grad: linear-gradient(135deg, #8B5CF6, #6366F1);

  /* Borders */
  --border: rgba(20, 30, 60, 0.10);
  --border-light: rgba(20, 30, 60, 0.05);

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08), 0 1px 6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.12), 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.18), 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 4px 20px rgba(0, 102, 255, 0.25);

  /* Radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-2xl: 28px;

  /* Layout */
  --sidebar-width: 264px;
  --header-height: 60px;

  /* Typography */
  --font: -apple-system, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;

  /* Motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.18s;
  --dur: 0.28s;
  --dur-slow: 0.45s;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100dvh;
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--bg);
  /* Animated gradient mesh background — slowly drifting aurora */
  background-image:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(0, 102, 255, 0.07), transparent),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(139, 92, 246, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 80% 0%, rgba(14, 165, 233, 0.05), transparent),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(34, 197, 94, 0.04), transparent);
  background-attachment: fixed;
  background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%;
  animation: bgDrift 30s ease-in-out infinite;
}

@keyframes bgDrift {
  0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
  25% { background-position: 30% 20%, -20% 10%, 10% -10%, -10% 20%; }
  50% { background-position: 50% 50%, -30% 30%, 20% -20%, -20% 10%; }
  75% { background-position: 20% 30%, -10% 20%, 10% -10%, -30% 30%; }
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ---------- Scrollbar — thin & elegant ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.25); }

/* ========================================
   LAYOUT
   ======================================== */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------- Sidebar — glassmorphism ---------- */
.sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  position: relative;
}

/* Subtle gradient sheen on sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 102, 255, 0.03) 0%, transparent 30%, transparent 70%, rgba(139, 92, 246, 0.02) 100%);
  pointer-events: none;
  z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-logo {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary-grad);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

/* Shimmer sweep on logo */
.sidebar-logo .logo-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { left: -100%; }
  50% { left: 120%; }
}

.sidebar-logo .logo-text {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  -webkit-overflow-scrolling: touch;
}

.sidebar-mode {
  padding: 0 0 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-mode .form-label {
  margin: 0 0 5px 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-mode .form-select {
  min-height: 40px;
  font-size: 13px;
  font-weight: 600;
}

.nav-group {
  margin-bottom: 6px;
  animation: slideInLeft 0.4s var(--ease-out) both;
}

.nav-group:nth-child(2) { animation-delay: 0.05s; }
.nav-group:nth-child(3) { animation-delay: 0.10s; }
.nav-group:nth-child(4) { animation-delay: 0.15s; }
.nav-group:nth-child(5) { animation-delay: 0.20s; }

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

.nav-group-title {
  margin: 0 8px 4px;
  padding: 6px 0 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth), transform var(--dur-fast) var(--ease-smooth);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(0, 102, 255, 0.06);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.active {
  color: #ffffff;
  background: var(--primary-grad);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Active indicator bar — now a glowing left accent */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  border-radius: 0 3px 3px 0;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  animation: growIn 0.35s var(--ease-spring);
}

@keyframes growIn {
  from { height: 0; opacity: 0; }
  to { height: 60%; opacity: 1; }
}

.nav-item .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.nav-item:hover .nav-icon {
  background: rgba(0, 102, 255, 0.10);
  color: var(--primary);
  transform: scale(1.08);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
}

.nav-badge {
  min-width: 22px;
  min-height: 22px;
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--danger-grad);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.nav-sub { padding-left: 16px; }
.nav-sub .nav-item { padding-left: 50px; font-size: 13px; }

/* ---------- Topbar ---------- */
.topbar {
  min-height: var(--header-height);
  background: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  z-index: 20;
  position: sticky;
  top: 0;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.topbar-breadcrumb {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-date,
.topbar-pending,
.topbar-user {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.topbar-pending {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.15);
}

.topbar-pending strong {
  color: var(--warning);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.topbar-user {
  background: var(--primary-light);
  border-color: rgba(0, 102, 255, 0.12);
  color: var(--primary);
  font-weight: 600;
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 32px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Page transition ---------- */
.content > * {
  animation: pageIn 0.4s var(--ease-out) both;
}

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

/* ========================================
   CARDS
   ======================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease-smooth), transform var(--dur) var(--ease-spring), border-color var(--dur) var(--ease-smooth);
  position: relative;
}

/* Gradient top accent line on hover */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--info), var(--accent));
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity var(--dur) var(--ease-smooth), transform var(--dur) var(--ease-spring);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(0, 102, 255, 0.12);
}

.card:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

.card-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.card-body { padding: 22px; }

.card-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========================================
   STAT CARDS — premium with gradient icons
   ======================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  min-height: 104px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-smooth);
  position: relative;
  overflow: hidden;
  animation: statIn 0.5s var(--ease-spring) both;
}

/* Stagger stat cards */
.stat-card:nth-child(1) { animation-delay: 0.00s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }
.stat-card:nth-child(5) { animation-delay: 0.24s; }
.stat-card:nth-child(6) { animation-delay: 0.30s; }
.stat-card:nth-child(7) { animation-delay: 0.36s; }
.stat-card:nth-child(8) { animation-delay: 0.42s; }

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

.stat-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

/* Gradient glow ring on hover */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--info), var(--accent));
  opacity: 0;
  transform: scaleX(0.2);
  transition: opacity var(--dur) var(--ease-smooth), transform var(--dur) var(--ease-spring);
}

.stat-card:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Number scales up on hover */
.stat-card:hover .stat-value {
  transform: scale(1.04);
}

.stat-value {
  color: var(--text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur) var(--ease-spring);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: 0 0 auto;
  transition: transform var(--dur) var(--ease-spring);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-4deg);
}

.stat-icon.blue {
  background: var(--primary-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25);
}

.stat-icon.green {
  background: var(--success-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.stat-icon.orange {
  background: var(--warning-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.stat-icon.red {
  background: var(--danger-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

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

.stat-value {
  color: var(--text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

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

/* ========================================
   BUTTONS — premium with gradient & ripple
   ======================================== */
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-smooth);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.btn:hover {
  background: var(--surface-2);
  border-color: rgba(20, 30, 60, 0.16);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: scale(0.96);
  transition: transform 0.08s var(--ease-spring);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary-grad);
  color: var(--text-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.25);
  position: relative;
  overflow: hidden;
}

/* Sheen sweep on hover */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transition: left 0.5s var(--ease-smooth);
}

.btn-primary:hover::after {
  left: 120%;
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(0, 102, 255, 0.40);
  filter: brightness(1.06);
}

.btn-primary:active {
  filter: brightness(0.96);
}

.btn-success {
  background: var(--success-grad);
  color: var(--text-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.btn-success:hover {
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35);
  filter: brightness(1.06);
}

.btn-danger {
  background: var(--danger-grad);
  color: var(--text-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
  filter: brightness(1.06);
}

.btn-warning {
  background: var(--warning-grad);
  color: var(--text-white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  min-height: 48px;
  padding: 0 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-text {
  min-height: 32px;
  padding: 0 8px;
  background: transparent;
  border: 0;
  color: var(--primary);
  font-weight: 600;
}

.btn-text:hover {
  background: var(--primary-light);
  transform: none;
  box-shadow: none;
}

.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: var(--danger-light); }

.btn-group { display: flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn + .btn { margin-left: 0.5px; }

/* ========================================
   FORMS
   ======================================== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.form-label .required,
.required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  transition: border-color var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-fast) var(--ease-smooth), background var(--dur-fast) var(--ease-smooth);
  outline: none;
  letter-spacing: -0.01em;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: rgba(0, 102, 255, 0.25);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.toolbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12), 0 0 16px rgba(0, 102, 255, 0.08);
  background-color: var(--surface);
}

/* Select dropdown arrow enhancement */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238B8FA3' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
}

.form-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230066FF' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
}

.form-textarea {
  min-height: 84px;
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

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

.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.form-inline .form-group { margin-bottom: 0; }
.form-inline .form-group:last-child { flex: 0 0 auto; }

.form-hint {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.form-error {
  margin-top: 5px;
  color: var(--danger);
  font-size: 12px;
}

/* Custom checkbox */
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========================================
   TABLES — premium with gradient header
   ======================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
}

thead th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text-muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: top;
  font-weight: 400;
}

tbody tr {
  transition: background var(--dur-fast) var(--ease-smooth);
  position: relative;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(0, 102, 255, 0.06) 0%, rgba(0, 102, 255, 0.02) 40%, transparent 100%);
}

/* Left accent bar on hover */
tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

tbody tr:last-child td { border-bottom: 0; }

.text-right { text-align: right; }
.text-center { text-align: center; }

.text-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ========================================
   STATUS TAGS
   ======================================== */
.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0;
}

.tag-pending,
.tag-counting {
  background: var(--warning-light);
  color: var(--warning);
}

.tag-approved,
.tag-completed {
  background: var(--success-light);
  color: var(--success);
}

.tag-rejected {
  background: var(--danger-light);
  color: var(--danger);
}

.tag-draft {
  background: rgba(20, 30, 60, 0.06);
  color: var(--text-muted);
}

.tag-printed,
.tag-adjusted {
  background: var(--info-light);
  color: var(--info);
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

/* ========================================
   TOOLBAR / SEARCH
   ======================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.toolbar-search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px 8px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.toolbar-search input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}

.toolbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.toolbar-spacer { flex: 1; }

/* ========================================
   MODAL — premium floating sheet
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: overlayIn 0.25s var(--ease-out);
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(90vw, 800px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s var(--ease-spring);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

@keyframes modalIn {
  from { transform: scale(0.88) translateY(24px); opacity: 0; }
  60% { transform: scale(1.02) translateY(-4px); opacity: 1; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-lg { width: min(94vw, 1000px); max-width: 1000px; }
.modal-xl { width: min(96vw, 1200px); max-width: 1200px; }
.modal-sm { width: min(92vw, 500px); max-width: 500px; }

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

.modal-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: var(--surface-3);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(90deg);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-top: 1px solid var(--border-light);
}

/* ========================================
   TOAST — premium notification
   ======================================== */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: min(340px, calc(100vw - 48px));
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  color: #ffffff;
  background: rgba(26, 29, 41, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: toastIn 0.35s var(--ease-spring);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast > span:first-child {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-success {
  background: rgba(34, 197, 94, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}

.toast-error {
  background: rgba(239, 68, 68, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}

.toast-warning {
  background: rgba(245, 158, 11, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}

.toast-info {
  background: rgba(14, 165, 233, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}

@keyframes toastIn {
  from { transform: translateX(120%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* Toast progress bar — auto-dismiss countdown */
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastProgress 3s linear forwards;
  transform-origin: left;
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.toast { position: relative; overflow: hidden; }

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.empty-state .empty-text {
  font-size: 14px;
  font-weight: 500;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px 22px;
}

.pagination .page-info {
  margin-right: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.pagination button {
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-smooth);
}

.pagination button:not(:disabled):hover {
  background: var(--surface-2);
  border-color: rgba(0, 102, 255, 0.2);
  color: var(--primary);
}

.pagination button.active {
  background: var(--primary-grad);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.25);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ========================================
   TABS — segmented control with sliding indicator
   ======================================== */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  overflow-x: auto;
  position: relative;
}

.tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 7px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 0;
  margin-bottom: 0;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-smooth);
  position: relative;
  z-index: 1;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

.tab.active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04), 0 0 12px rgba(0, 102, 255, 0.08);
}

/* Tab active glow underline */
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 20%;
  right: 20%;
  height: 2px;
  border-radius: 99px;
  background: var(--primary-grad);
  animation: tabUnderline 0.3s var(--ease-spring);
}

@keyframes tabUnderline {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ========================================
   PRINT TEMPLATE
   ======================================== */
.print-template-preview {
  margin: 20px 0;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
}

.print-format-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.print-format-card {
  min-height: 120px;
  padding: 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur) var(--ease-spring);
  text-align: center;
}

.print-format-card:hover {
  border-color: rgba(0, 102, 255, 0.3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
}

.print-format-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}

.print-format-card .format-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.print-format-card .format-name {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.print-format-card .format-desc {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* ========================================
   DIFF
   ======================================== */
.diff-positive {
  color: var(--success);
  font-weight: 700;
}

.diff-negative {
  color: var(--danger);
  font-weight: 7;
}

.diff-zero {
  color: var(--text-muted);
}

/* ========================================
   UTILITY ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .content { padding: 24px; }

  .print-format-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--surface);
  }

  .sidebar::before { display: none; }

  .sidebar-logo { min-height: 48px; }
  .sidebar-nav { padding: 8px; }
  .nav-group { margin-bottom: 4px; }
  .nav-group[data-group="main"],
  .nav-group[data-group="customer"],
  .nav-group[data-group="warehouse"],
  .nav-group[data-group="data"] { display: block; }
  .nav-group .nav-group-title { margin-bottom: 4px; }
  .nav-group {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 6px;
  }
  .nav-item {
    display: inline-flex;
    min-width: calc(50% - 4px);
    margin: 0 4px 4px 0;
  }
  .nav-item:hover { transform: none; }

  .main-area { overflow: visible; }

  .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--surface);
    position: static;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .content {
    padding: 16px;
    overflow: visible;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  /* Disable stagger on mobile for performance */
  .stat-card,
  .nav-group {
    animation: none;
  }
}

@media (max-width: 560px) {
  body { font-size: 14px; }

  .stats-row,
  .form-row,
  .print-format-options {
    grid-template-columns: 1fr;
  }

  .nav-item {
    min-width: 100%;
    margin-right: 0;
  }

  .topbar-date,
  .topbar-pending,
  .topbar-user {
    width: 100%;
    justify-content: center;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-search {
    max-width: none;
    width: 100%;
  }

  .btn { width: 100%; }
  .btn-group .btn { width: auto; }

  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }

  .modal,
  .modal-lg,
  .modal-xl,
  .modal-sm {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

/* ========================================
   PREMIUM ENHANCEMENTS — v2
   ======================================== */

/* ---------- Table row staggered entrance ---------- */
@keyframes rowFadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

tbody tr[data-fee-row],
tbody tr[data-bill-status] {
  animation: rowFadeInUp 0.3s var(--ease-out) both;
}

tbody tr[data-fee-row]:nth-child(1), tbody tr[data-bill-status]:nth-child(1) { animation-delay: 0.00s; }
tbody tr[data-fee-row]:nth-child(3), tbody tr[data-bill-status]:nth-child(3) { animation-delay: 0.03s; }
tbody tr[data-fee-row]:nth-child(5), tbody tr[data-bill-status]:nth-child(5) { animation-delay: 0.06s; }
tbody tr[data-fee-row]:nth-child(7), tbody tr[data-bill-status]:nth-child(7) { animation-delay: 0.09s; }
tbody tr[data-fee-row]:nth-child(9), tbody tr[data-bill-status]:nth-child(9) { animation-delay: 0.12s; }
tbody tr[data-fee-row]:nth-child(11), tbody tr[data-bill-status]:nth-child(11) { animation-delay: 0.15s; }
tbody tr[data-fee-row]:nth-child(13), tbody tr[data-bill-status]:nth-child(13) { animation-delay: 0.18s; }
tbody tr[data-fee-row]:nth-child(15), tbody tr[data-bill-status]:nth-child(15) { animation-delay: 0.21s; }
tbody tr[data-fee-row]:nth-child(17), tbody tr[data-bill-status]:nth-child(17) { animation-delay: 0.24s; }
tbody tr[data-fee-row]:nth-child(19), tbody tr[data-bill-status]:nth-child(19) { animation-delay: 0.27s; }
tbody tr[data-fee-row]:nth-child(21), tbody tr[data-bill-status]:nth-child(21) { animation-delay: 0.30s; }
tbody tr[data-fee-row]:nth-child(23), tbody tr[data-bill-status]:nth-child(23) { animation-delay: 0.33s; }
tbody tr[data-fee-row]:nth-child(25), tbody tr[data-bill-status]:nth-child(25) { animation-delay: 0.36s; }
tbody tr[data-fee-row]:nth-child(27), tbody tr[data-bill-status]:nth-child(27) { animation-delay: 0.39s; }
tbody tr[data-fee-row]:nth-child(29), tbody tr[data-bill-status]:nth-child(29) { animation-delay: 0.42s; }

/* ---------- Fee card input focus glow ---------- */
.fee-card-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-smooth),
              box-shadow var(--dur-fast) var(--ease-smooth);
}

/* ---------- Fee stat card ---------- */
.fee-stat-card {
  animation: statIn 0.5s var(--ease-spring) both;
}

/* ---------- Tab active pop ---------- */
.tab.active {
  animation: tabPop 0.3s var(--ease-spring);
}

@keyframes tabPop {
  0% { transform: scale(0.95); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ---------- Ripple effect on buttons ---------- */
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--ease-smooth), height 0.4s var(--ease-smooth);
  pointer-events: none;
  z-index: 0;
}

.btn:active::before {
  width: 300px;
  height: 300px;
  transition: 0s;
  opacity: 0;
}

/* ---------- Skeleton loading shimmer ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer-skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* ---------- Number count-up pulse ---------- */
@keyframes numberPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); color: var(--primary); }
  100% { transform: scale(1); }
}

.stat-value.updated {
  animation: numberPulse 0.6s var(--ease-spring);
}

/* ---------- Tag entrance animation ---------- */
.tag {
  animation: tagIn 0.3s var(--ease-spring) both;
}

@keyframes tagIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Modal body content enhanced stagger ---------- */
.modal-body > .form-group,
.modal-body > .form-row,
.modal-body > div {
  animation: modalContentIn 0.35s var(--ease-out) both;
}

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

/* ---------- Empty state float animation ---------- */
.empty-state .empty-icon {
  animation: emptyFloat 3s ease-in-out infinite;
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---------- Pagination active pulse ---------- */
.pagination button.active {
  animation: pageActivePulse 0.4s var(--ease-spring);
}

@keyframes pageActivePulse {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ---------- Card header gradient accent ---------- */
.card-header {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

/* ---------- Search icon focus animation ---------- */
.toolbar-search:focus-within .search-icon {
  color: var(--primary);
  transform: translateY(-50%) scale(1.15);
}

.toolbar-search .search-icon {
  transition: color var(--dur-fast) var(--ease-smooth), transform var(--dur-fast) var(--ease-spring);
}

/* ---------- Print format card selected glow ---------- */
.print-format-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12), 0 4px 20px rgba(0, 102, 255, 0.10);
  animation: cardSelectedPop 0.35s var(--ease-spring);
}

@keyframes cardSelectedPop {
  0% { transform: scale(0.98); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ---------- Nav icon micro-bounce on nav-item hover ---------- */
.nav-item:hover .nav-icon {
  animation: navIconBounce 0.4s var(--ease-spring);
}

@keyframes navIconBounce {
  0%, 100% { transform: scale(1.08); }
  50% { transform: scale(1.18) rotate(-6deg); }
}

/* ---------- Badge bounce on update ---------- */
.nav-badge.updated {
  animation: badgeBounce 0.5s var(--ease-spring);
}

@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.95); }
}

/* ---------- Topbar user avatar gradient ring ---------- */
.topbar-user {
  position: relative;
}

.topbar-user::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius);
  background: var(--primary-grad);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--dur-fast) var(--ease-smooth);
}

.topbar-user:hover::before {
  opacity: 0.15;
}

/* ---------- Form label floating effect ---------- */
.form-group:focus-within .form-label {
  color: var(--primary);
  transition: color var(--dur-fast) var(--ease-smooth);
}

.form-label {
  transition: color var(--dur-fast) var(--ease-smooth);
}

/* ---------- Content area smooth scroll ---------- */
.content {
  scroll-behavior: smooth;
}

/* ---------- Print format card hover icon rotate ---------- */
.print-format-card:hover .format-icon {
  transform: scale(1.15) rotate(-5deg);
  transition: transform var(--dur) var(--ease-spring);
}

.print-format-card .format-icon {
  transition: transform var(--dur) var(--ease-spring);
}

/* ---------- Smooth page transition v2 ---------- */
.content > * {
  animation: pageInEnhanced 0.45s var(--ease-out) both;
}

@keyframes pageInEnhanced {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Staggered card entrance in content ---------- */
.content > .card:nth-child(1) { animation-delay: 0.00s; }
.content > .card:nth-child(2) { animation-delay: 0.05s; }
.content > .card:nth-child(3) { animation-delay: 0.10s; }
.content > .card:nth-child(4) { animation-delay: 0.15s; }
.content > .card:nth-child(5) { animation-delay: 0.20s; }
.content > .stats-row:nth-child(1) { animation-delay: 0.00s; }

/* ---------- Danger button sheen ---------- */
.btn-danger::after,
.btn-success::after,
.btn-warning::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: left 0.5s var(--ease-smooth);
  pointer-events: none;
}

.btn-danger:hover::after,
.btn-success:hover::after,
.btn-warning:hover::after {
  left: 120%;
}

.btn-danger, .btn-success, .btn-warning {
  position: relative;
  overflow: hidden;
}

/* ---------- Modal close button enhanced ---------- */
.modal-close {
  transition: all var(--dur-fast) var(--ease-spring), background var(--dur-fast) var(--ease-smooth);
}

.modal-close:hover {
  background: var(--danger);
  color: #ffffff;
  transform: rotate(90deg) scale(1.1);
}

/* ---------- Stat icon gradient glow on hover ---------- */
.stat-card:hover .stat-icon {
  filter: brightness(1.1) drop-shadow(0 4px 12px rgba(0, 102, 255, 0.2));
}

/* ---------- Smooth scrollbar with gradient ---------- */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 102, 255, 0.2), rgba(139, 92, 246, 0.2));
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 102, 255, 0.35), rgba(139, 92, 246, 0.35));
}

/* ---------- Reduced motion: disable non-essential animations ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .modal {
    animation: overlayIn 0.15s ease both;
  }

  .sidebar-logo .logo-icon::after {
    animation: none;
  }

  .nav-badge {
    animation: none;
  }
}

@media print {
  .sidebar,
  .topbar,
  .btn,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .app-layout,
  .main-area {
    display: block !important;
    min-height: auto !important;
  }

  .content {
    padding: 0 !important;
    overflow: visible !important;
  }

  .card {
    border: 0 !important;
    box-shadow: none !important;
  }

  body {
    background: #ffffff !important;
  }
}
