/* ================================================================
   SMART INVOICE GENERATOR PRO — Complete Stylesheet
   ================================================================
   Features: Light/Dark theme, glassmorphism, micro-animations,
   5 invoice templates, responsive layout, print styles
   ================================================================ */

/* ================================================================
   1. CSS VARIABLES & THEMING
   ================================================================ */
:root {
  /* ---- Primary Palette ---- */
  --primary:              #6C63FF;
  --primary-light:        #8B83FF;
  --primary-dark:         #5A52D5;
  --primary-rgb:          108, 99, 255;
  --primary-gradient:     linear-gradient(135deg, #6C63FF 0%, #5A52D5 100%);

  /* ---- Accent / Secondary ---- */
  --accent:               #A855F7;
  --accent-light:         #C084FC;
  --accent-dark:          #7C3AED;

  /* ---- Semantic Colors ---- */
  --success:              #22C55E;
  --success-light:        #4ADE80;
  --success-dark:         #16A34A;
  --success-gradient:     linear-gradient(135deg, #22C55E 0%, #16A34A 100%);

  --info:                 #3B82F6;
  --info-light:           #60A5FA;
  --info-dark:            #2563EB;
  --info-gradient:        linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);

  --warning:              #F59E0B;
  --warning-light:        #FBBF24;
  --warning-dark:         #D97706;

  --danger:               #EF4444;
  --danger-light:         #F87171;
  --danger-dark:          #DC2626;
  --danger-gradient:      linear-gradient(135deg, #EF4444 0%, #DC2626 100%);

  /* ---- Neutral Palette ---- */
  --bg-body:              #F0F2F5;
  --bg-surface:           #FFFFFF;
  --bg-surface-2:         #F8F9FA;
  --bg-hover:             #F1F3F5;
  --bg-active:            #E8EAED;

  --text-primary:         #1A1D23;
  --text-secondary:       #5F6368;
  --text-muted:           #9AA0A6;
  --text-inverse:         #FFFFFF;

  --border-color:         #E0E3E8;
  --border-light:         #ECEEF1;
  --divider:              #E0E3E8;

  /* ---- Shadows ---- */
  --shadow-xs:            0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:            0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md:            0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:            0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-xl:            0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow:          0 0 20px rgba(var(--primary-rgb), 0.25);
  --shadow-card-hover:    0 8px 30px rgba(0, 0, 0, 0.12);

  /* ---- Glassmorphism ---- */
  --glass-bg:             rgba(255, 255, 255, 0.72);
  --glass-border:         rgba(255, 255, 255, 0.3);
  --glass-blur:           16px;

  /* ---- Border Radius ---- */
  --radius-sm:            6px;
  --radius-md:            10px;
  --radius-lg:            16px;
  --radius-xl:            24px;
  --radius-full:          9999px;

  /* ---- Spacing ---- */
  --space-xs:             4px;
  --space-sm:             8px;
  --space-md:             16px;
  --space-lg:             24px;
  --space-xl:             32px;
  --space-2xl:            48px;

  /* ---- Typography ---- */
  --font-family:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:            'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-xs:              0.7rem;
  --font-sm:              0.8rem;
  --font-base:            0.9rem;
  --font-md:              1rem;
  --font-lg:              1.15rem;
  --font-xl:              1.35rem;
  --font-2xl:             1.75rem;
  --font-3xl:             2.25rem;

  /* ---- Layout ---- */
  --sidebar-width:        260px;
  --header-height:        64px;

  /* ---- Transitions ---- */
  --transition-fast:      0.15s ease;
  --transition-base:      0.25s ease;
  --transition-slow:      0.4s ease;
  --transition-theme:     background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;

  /* ---- Sidebar ---- */
  --sidebar-bg:           linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  --sidebar-text:         rgba(255, 255, 255, 0.8);
  --sidebar-text-active:  #FFFFFF;
  --sidebar-hover-bg:     rgba(255, 255, 255, 0.08);
  --sidebar-active-bg:    rgba(255, 255, 255, 0.14);
  --sidebar-border:       rgba(255, 255, 255, 0.08);

  /* ---- Stat Card Gradients ---- */
  --stat-1-gradient:      linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --stat-2-gradient:      linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  --stat-3-gradient:      linear-gradient(135deg, #0cebeb 0%, #20e3b2 50%, #29ffc6 100%);
  --stat-4-gradient:      linear-gradient(135deg, #f093fb 0%, #f5576c 100%);

  /* ---- Scrollbar ---- */
  --scrollbar-track:      #F0F2F5;
  --scrollbar-thumb:      #C4C9D0;
  --scrollbar-thumb-hover:#A0A6AE;
}

/* ==================== DARK THEME ==================== */
[data-theme='dark'] {
  --primary:              #7C74FF;
  --primary-light:        #9B94FF;
  --primary-dark:         #6C63FF;
  --primary-rgb:          124, 116, 255;

  --bg-body:              #0f0f23;
  --bg-surface:           #1a1a2e;
  --bg-surface-2:         #16213e;
  --bg-hover:             #1f2940;
  --bg-active:            #253350;

  --text-primary:         #E8EAED;
  --text-secondary:       #9AA0A6;
  --text-muted:           #6B7280;
  --text-inverse:         #1A1D23;

  --border-color:         #2A3142;
  --border-light:         #232B3B;
  --divider:              #2A3142;

  --shadow-xs:            0 1px 2px rgba(0, 0, 0, 0.20);
  --shadow-sm:            0 2px 6px rgba(0, 0, 0, 0.30);
  --shadow-md:            0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg:            0 8px 24px rgba(0, 0, 0, 0.40);
  --shadow-xl:            0 16px 48px rgba(0, 0, 0, 0.50);
  --shadow-card-hover:    0 8px 30px rgba(0, 0, 0, 0.45);

  --glass-bg:             rgba(26, 26, 46, 0.72);
  --glass-border:         rgba(255, 255, 255, 0.06);

  --sidebar-bg:           linear-gradient(180deg, #0a0a1a 0%, #12122b 50%, #1a1a3e 100%);
  --sidebar-hover-bg:     rgba(255, 255, 255, 0.06);
  --sidebar-active-bg:    rgba(124, 116, 255, 0.18);
  --sidebar-border:       rgba(255, 255, 255, 0.05);

  --scrollbar-track:      #16213e;
  --scrollbar-thumb:      #2A3142;
  --scrollbar-thumb-hover:#3A4556;
}

/* ================================================================
   2. RESET & BASE
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: var(--transition-theme);
  overflow: hidden;
}

::selection {
  background: rgba(var(--primary-rgb), 0.25);
  color: var(--text-primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
}

/* ================================================================
   3. LAYOUT — App Container
   ================================================================ */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ================================================================
   4. SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ---- Sidebar Header / Logo ---- */
.sidebar-header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--sidebar-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--font-lg);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.logo-text b {
  font-weight: 700;
  color: #FFFFFF;
}

/* ---- Sidebar Navigation ---- */
.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: var(--font-base);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
  border-left-color: rgba(255, 255, 255, 0.3);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  border-left-color: #FFFFFF;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.03);
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--sidebar-border);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  width: 100%;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: var(--font-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text-active);
}

.theme-toggle i {
  font-size: 0.95rem;
}

.sidebar-brand {
  text-align: center;
  margin-top: var(--space-sm);
}

.sidebar-brand small {
  color: rgba(255, 255, 255, 0.35);
  font-size: var(--font-xs);
}

/* ================================================================
   5. MAIN CONTENT
   ================================================================ */
.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================================
   6. TOP HEADER
   ================================================================ */
.top-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: var(--transition-theme);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.15rem;
  transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-title {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0 var(--space-md);
  transition: all var(--transition-fast);
}

.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.header-search i {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-search input {
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: var(--font-sm);
  color: var(--text-primary);
  width: 200px;
  outline: none;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

/* ================================================================
   7. VIEWS
   ================================================================ */
.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view-content {
  padding: var(--space-xl);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.view-header h2 {
  font-size: var(--font-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.view-header h2 i {
  color: var(--primary);
}

.view-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ================================================================
   8. CARDS
   ================================================================ */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), var(--transition-theme);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
  font-size: var(--font-base);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-header h3 i {
  color: var(--primary);
  font-size: 0.9rem;
}

.card-body {
  padding: var(--space-lg);
}

/* ================================================================
   9. STAT CARDS
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: default;
  border: none;
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.stat-card-1 { background: var(--stat-1-gradient); }
.stat-card-2 { background: var(--stat-2-gradient); }
.stat-card-3 { background: var(--stat-3-gradient); }
.stat-card-4 { background: var(--stat-4-gradient); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

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

.stat-info p {
  font-size: var(--font-xs);
  font-weight: 500;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  white-space: nowrap;
}

.stat-info h3 {
  font-size: var(--font-2xl);
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
}

.stat-trend {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 0.85rem;
  opacity: 0.5;
}

.counter {
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   10. BUTTONS
   ================================================================ */

/* ---- Base Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease, opacity 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.btn:active::after {
  width: 250px;
  height: 250px;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0s;
}

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

.btn i {
  font-size: 0.85rem;
}

/* ---- Button Variants ---- */
.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-gradient);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

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

.btn-info {
  background: var(--info-gradient);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-info:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #A855F7 0%, #7C3AED 100%);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(107, 114, 128, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-gradient);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

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

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.08);
  transform: translateY(-1px);
}

/* ---- Button Sizes ---- */
.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-xs);
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ---- Button Glow ---- */
.btn-glow {
  animation: glow 2.5s ease-in-out infinite;
}

/* ---- Icon Button ---- */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  flex-shrink: 0;
}

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

.btn-icon-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ================================================================
   11. FORMS
   ================================================================ */
.form-section {
  margin-bottom: var(--space-lg);
}

.form-section-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.form-section-title i {
  color: var(--primary);
  font-size: 0.85rem;
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.form-group label i {
  margin-right: 4px;
  font-size: 0.7rem;
  color: var(--primary);
}

.required {
  color: var(--danger) !important;
  font-weight: 700;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--font-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-control::placeholder {
  color: var(--text-muted);
}

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

.select-styled {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239AA0A6' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ---- Form Layout ---- */
.form-row {
  display: grid;
  gap: var(--space-lg);
}

.form-row-2 {
  grid-template-columns: 1fr 1fr;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row-2-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-card {
  margin-bottom: 0;
}

/* ---- Form Actions ---- */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  flex-wrap: wrap;
}

.form-actions-left,
.form-actions-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.invoice-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ================================================================
   12. DATA TABLE
   ================================================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

.data-table thead th {
  text-align: left;
  padding: 12px var(--space-md);
  font-size: var(--font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(even) {
  background: var(--bg-surface-2);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody td {
  padding: 12px var(--space-md);
  color: var(--text-primary);
  vertical-align: middle;
}

/* ================================================================
   13. ITEMS TABLE (Invoice Form)
   ================================================================ */
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

.items-table thead th {
  text-align: left;
  padding: 10px var(--space-sm);
  font-size: var(--font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.items-table tbody td {
  padding: 6px var(--space-sm);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

.items-table input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--font-sm);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.items-table input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.items-table input::placeholder {
  color: var(--text-muted);
}

.items-table .item-total {
  font-weight: 600;
  color: var(--text-primary);
  padding: 8px 10px;
  white-space: nowrap;
}

.items-table .btn-icon-sm {
  color: var(--text-muted);
}

.items-table .btn-icon-sm:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Column widths */
.col-name  { width: 20%; min-width: 140px; }
.col-desc  { width: 25%; min-width: 140px; }
.col-qty   { width: 8%; min-width: 70px; }
.col-price { width: 12%; min-width: 90px; }
.col-tax   { width: 8%; min-width: 70px; }
.col-disc  { width: 8%; min-width: 70px; }
.col-total { width: 12%; min-width: 100px; }
.col-action{ width: 5%; min-width: 40px; text-align: center; }

.empty-items-msg {
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.empty-items-msg i {
  margin-right: 4px;
  color: var(--info);
}

/* ================================================================
   14. TOTALS CARD
   ================================================================ */
.totals-card .card-body {
  padding: var(--space-md) var(--space-lg);
}

.totals-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: var(--font-sm);
}

.total-row span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.total-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tax-value {
  color: var(--warning-dark);
}

.discount-value {
  color: var(--success);
}

.total-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-xs) 0;
}

.total-row-grand {
  padding: var(--space-md) var(--space-sm);
  background: rgba(var(--primary-rgb), 0.06);
  border-radius: var(--radius-md);
  margin: var(--space-xs) 0;
}

.total-row-grand span:first-child {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--text-primary);
}

.total-row-grand .total-value {
  font-size: var(--font-xl);
  font-weight: 800;
  color: var(--primary);
}

.total-row-balance {
  padding: var(--space-md) var(--space-sm);
  background: rgba(239, 68, 68, 0.06);
  border-radius: var(--radius-md);
  margin-top: var(--space-xs);
}

.total-row-balance span:first-child {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--text-primary);
}

.total-row-balance .total-value {
  font-size: var(--font-xl);
  font-weight: 800;
  color: var(--danger);
}

.amount-paid-group {
  margin-bottom: var(--space-xs);
}

.amount-paid-group label {
  font-size: var(--font-xs) !important;
}

/* ================================================================
   15. LOGO UPLOAD AREA
   ================================================================ */
.logo-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-md);
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-upload-area:hover,
.logo-upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
}

.logo-upload-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
}

.logo-placeholder i {
  font-size: 2rem;
  color: var(--primary);
  opacity: 0.6;
}

.logo-placeholder p {
  font-size: var(--font-sm);
  font-weight: 500;
}

.logo-placeholder small {
  font-size: var(--font-xs);
  opacity: 0.7;
}

.logo-preview-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-preview-container img {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.logo-preview-container .btn-icon-sm {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: #FFFFFF;
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  box-shadow: var(--shadow-sm);
}

.logo-preview-container .btn-icon-sm:hover {
  background: var(--danger-dark);
  color: #FFFFFF;
}

/* ================================================================
   16. STATUS BADGES
   ================================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-paid {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success-dark);
}

.status-pending {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning-dark);
}

.status-overdue {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-dark);
}

[data-theme='dark'] .status-paid {
  background: rgba(34, 197, 94, 0.18);
  color: var(--success-light);
}

[data-theme='dark'] .status-pending {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warning-light);
}

[data-theme='dark'] .status-overdue {
  background: rgba(239, 68, 68, 0.18);
  color: var(--danger-light);
}

/* ---- Status Radio in Form ---- */
.status-options {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.status-radio {
  cursor: pointer;
}

.status-radio input[type="radio"] {
  display: none;
}

.status-radio .status-badge {
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
  padding: 6px 16px;
}

.status-radio .status-badge:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.status-radio input[type="radio"]:checked + .status-badge {
  border-color: currentColor;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.status-card .card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

/* ================================================================
   17. FILTER BAR
   ================================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box i {
  color: var(--text-muted);
  font-size: 0.85rem;
  position: absolute;
  left: 12px;
  pointer-events: none;
}

.search-box .form-control {
  padding-left: 36px;
}

.filter-buttons {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
}

.filter-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.filter-paid.active {
  background: var(--success);
  border-color: var(--success);
}

.filter-pending.active {
  background: var(--warning);
  border-color: var(--warning);
  color: #1A1D23;
}

.filter-overdue.active {
  background: var(--danger);
  border-color: var(--danger);
}

.filter-btn i {
  font-size: 0.7rem;
}

/* ================================================================
   18. INVOICES GRID
   ================================================================ */
.invoices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.invoice-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.invoice-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.invoice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.invoice-card-header strong {
  font-size: var(--font-base);
  color: var(--primary);
  font-weight: 700;
}

.invoice-card-body {
  padding: var(--space-lg);
  flex: 1;
}

.invoice-card-client {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.invoice-card-amount {
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  font-variant-numeric: tabular-nums;
}

.invoice-card-date {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.invoice-card-date i {
  margin-right: 4px;
}

.invoice-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface-2);
}

/* ================================================================
   19. SETTINGS
   ================================================================ */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-info {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.settings-info i {
  color: var(--info);
  margin-top: 2px;
  flex-shrink: 0;
}

/* ---- Theme Options ---- */
.theme-options {
  display: flex;
  gap: var(--space-sm);
}

.theme-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  transition: all var(--transition-fast);
}

.theme-option:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.theme-option.active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
}

.theme-option i {
  font-size: 1rem;
}

/* ---- Keyboard Shortcuts ---- */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

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

.shortcut-item span {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

/* ---- Danger Zone ---- */
.danger-zone {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.03);
}

.danger-zone h4 {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--danger);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.danger-zone h4 i {
  font-size: 0.85rem;
}

/* ================================================================
   20. MODALS
   ================================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-container {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 640px;
  width: 92%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease, slideInUp 0.3s ease;
  overflow: hidden;
}

.modal-lg {
  max-width: 900px;
}

.modal-sm {
  max-width: 480px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: var(--font-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modal-header h3 i {
  color: var(--primary);
}

.modal-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.zoom-level {
  font-family: var(--font-mono);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
  user-select: none;
}

.modal-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 var(--space-xs);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.confirm-text {
  font-size: var(--font-base);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ================================================================
   21. INVOICE PREVIEW
   ================================================================ */
.preview-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-lg);
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
  overflow: auto;
  min-height: 400px;
}

.invoice-preview {
  width: 210mm;
  min-height: 297mm;
  background: #FFFFFF;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 0;
  color: #1A1D23;
  font-size: 10pt;
  line-height: 1.5;
  transform-origin: top center;
  transition: transform 0.2s ease;
  overflow: hidden;
}

/* ---- Invoice Preview Internal Elements ---- */
.inv-header {
  padding: 32px 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.inv-company-info,
.inv-client-info {
  line-height: 1.6;
}

.inv-company-info h2 {
  font-size: 18pt;
  margin-bottom: 4px;
  color: inherit;
}

.inv-company-info p,
.inv-client-info p {
  font-size: 9pt;
  margin: 1px 0;
}

.inv-client-info {
  text-align: right;
}

.inv-client-info h3 {
  font-size: 11pt;
  margin-bottom: 4px;
  color: inherit;
}

.inv-details {
  padding: 0 40px;
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
}

.inv-detail-item {
  font-size: 9pt;
}

.inv-detail-item strong {
  display: block;
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  margin-bottom: 2px;
}

.inv-items-table {
  width: calc(100% - 80px);
  margin: 0 40px 24px;
  border-collapse: collapse;
  font-size: 9pt;
}

.inv-items-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 7pt;
  letter-spacing: 0.5px;
}

.inv-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.inv-items-table tfoot td {
  border-bottom: none;
  padding: 6px 12px;
}

.inv-totals {
  padding: 0 40px;
  margin-bottom: 24px;
  display: flex;
  justify-content: flex-end;
}

.inv-totals-grid {
  width: 240px;
}

.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 9pt;
}

.inv-total-row.grand-total {
  font-size: 13pt;
  font-weight: 800;
  padding: 8px 0;
  border-top: 2px solid;
  margin-top: 4px;
}

.inv-footer {
  padding: 24px 40px;
  font-size: 8pt;
  color: #666;
  border-top: 1px solid #eee;
  margin-top: auto;
}

.inv-footer h4 {
  font-size: 9pt;
  margin-bottom: 4px;
  color: #444;
}

.inv-logo img {
  max-height: 50px;
  max-width: 150px;
  object-fit: contain;
}

/* ================================================================
   22. TEMPLATE: MODERN
   ================================================================ */
.template-modern .inv-header {
  background: linear-gradient(135deg, #6C63FF 0%, #5A52D5 100%);
  color: #FFFFFF;
  border-radius: 0;
}

.template-modern .inv-header h2,
.template-modern .inv-header h3 {
  color: #FFFFFF;
}

.template-modern .inv-header p {
  color: rgba(255, 255, 255, 0.85);
}

.template-modern .inv-items-table th {
  background: #f8f7ff;
  color: #5A52D5;
  border-bottom: 2px solid #6C63FF;
}

.template-modern .inv-total-row.grand-total {
  color: #6C63FF;
  border-top-color: #6C63FF;
}

.template-modern .inv-footer {
  border-top-color: #e8e6ff;
}

/* ================================================================
   23. TEMPLATE: CORPORATE
   ================================================================ */
.template-corporate .inv-header {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #FFFFFF;
}

.template-corporate .inv-header h2,
.template-corporate .inv-header h3 {
  color: #FFFFFF;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.template-corporate .inv-header p {
  color: rgba(255, 255, 255, 0.8);
}

.template-corporate .inv-items-table th {
  background: #e8eaf6;
  color: #1a237e;
  border-bottom: 2px solid #1a237e;
}

.template-corporate .inv-items-table td {
  border-bottom-color: #c5cae9;
}

.template-corporate .inv-total-row.grand-total {
  color: #1a237e;
  border-top-color: #1a237e;
}

.template-corporate .inv-footer {
  border-top: 2px solid #1a237e;
  color: #455a64;
}

.template-corporate .inv-detail-item strong {
  color: #1a237e;
}

/* ================================================================
   24. TEMPLATE: MINIMAL
   ================================================================ */
.template-minimal .inv-header {
  background: transparent;
  color: #1A1D23;
  border-bottom: 1px solid #e0e0e0;
}

.template-minimal .inv-header h2,
.template-minimal .inv-header h3 {
  color: #1A1D23;
}

.template-minimal .inv-header p {
  color: #666;
}

.template-minimal .inv-items-table th {
  background: transparent;
  color: #999;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
}

.template-minimal .inv-items-table td {
  border-bottom: 1px solid #f0f0f0;
}

.template-minimal .inv-total-row.grand-total {
  color: #1A1D23;
  border-top-color: #333;
}

.template-minimal .inv-footer {
  border-top: 1px solid #e0e0e0;
  color: #999;
}

/* ================================================================
   25. TEMPLATE: PREMIUM
   ================================================================ */
.template-premium .inv-header {
  background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  color: #FFFFFF;
  border-bottom: 3px solid #D4AF37;
}

.template-premium .inv-header h2,
.template-premium .inv-header h3 {
  color: #D4AF37;
}

.template-premium .inv-header p {
  color: rgba(255, 255, 255, 0.75);
}

.template-premium .inv-items-table th {
  background: #2d2d2d;
  color: #D4AF37;
  border-bottom: 2px solid #D4AF37;
}

.template-premium .inv-items-table td {
  border-bottom: 1px solid #e8e0cc;
}

.template-premium .inv-total-row.grand-total {
  color: #D4AF37;
  border-top-color: #D4AF37;
}

.template-premium .inv-footer {
  border-top: 2px solid #D4AF37;
  background: #faf8f0;
}

.template-premium .inv-detail-item strong {
  color: #D4AF37;
}

/* ================================================================
   26. TEMPLATE: CREATIVE
   ================================================================ */
.template-creative .inv-header {
  background: linear-gradient(135deg, #ff6b6b 0%, #ffa07a 100%);
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}

.template-creative .inv-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.template-creative .inv-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

.template-creative .inv-header h2,
.template-creative .inv-header h3 {
  color: #FFFFFF;
  position: relative;
  z-index: 1;
}

.template-creative .inv-header p {
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 1;
}

.template-creative .inv-items-table th {
  background: #fff5f5;
  color: #ff6b6b;
  border-bottom: 2px solid #ff6b6b;
}

.template-creative .inv-total-row.grand-total {
  color: #ff6b6b;
  border-top-color: #ff6b6b;
}

.template-creative .inv-footer {
  border-top: 2px solid #ff6b6b;
  background: #fff9f7;
}

/* ================================================================
   27. TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
  max-width: 380px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--text-muted);
  animation: slideInRight 0.35s ease;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  transition: var(--transition-theme);
}

.toast.removing {
  animation: fadeOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.toast-title {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 0 var(--radius-md);
  animation: toastProgress 4s linear forwards;
}

/* Toast Variants */
.toast-success {
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-success .toast-progress {
  background: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-error .toast-progress {
  background: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-warning .toast-progress {
  background: var(--warning);
}

.toast-info {
  border-left-color: var(--info);
}

.toast-info .toast-icon {
  color: var(--info);
}

.toast-info .toast-progress {
  background: var(--info);
}

/* ================================================================
   28. LOADING OVERLAY
   ================================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  color: #FFFFFF;
}

.loading-content p {
  font-size: var(--font-base);
  font-weight: 500;
  opacity: 0.9;
}

/* ---- Spinner ---- */
.spinner {
  width: 64px;
  height: 64px;
  position: relative;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--primary);
  animation-duration: 1.0s;
}

.spinner-ring:nth-child(2) {
  inset: 6px;
  border-right-color: var(--accent);
  animation-duration: 1.4s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  inset: 12px;
  border-bottom-color: var(--success);
  animation-duration: 1.8s;
}

/* ================================================================
   29. EMPTY STATES
   ================================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.empty-state h4 {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state p {
  font-size: var(--font-sm);
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.6;
}

/* ================================================================
   30. QUICK ACTIONS
   ================================================================ */
.quick-actions-grid {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  flex: 1;
  min-width: 140px;
}

.quick-action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.quick-action-card:hover .qa-icon {
  color: var(--primary);
  transform: scale(1.1);
}

.qa-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.quick-action-card span {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ================================================================
   31. MISC ELEMENTS
   ================================================================ */
.view-all-link {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.view-all-link:hover {
  color: var(--primary-light);
  gap: 8px;
}

.view-all-link i {
  font-size: 0.65rem;
  transition: transform var(--transition-fast);
}

.view-all-link:hover i {
  transform: translateX(2px);
}

.recent-invoices-card .card-body {
  padding: 0;
}

.recent-invoices-card .data-table {
  margin: 0;
}

.recent-invoices-card .empty-state {
  padding: var(--space-xl);
}

/* ================================================================
   32. ANIMATIONS (Keyframes)
   ================================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

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

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.25); }
  50%      { box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.45); }
}

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

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

@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ---- Utility Classes ---- */
.fade-in {
  animation: fadeIn 0.4s ease, slideInUp 0.5s ease;
}

/* Staggered animation delays for child elements */
.fade-in > *:nth-child(1) { animation-delay: 0s; }
.fade-in > *:nth-child(2) { animation-delay: 0.05s; }
.fade-in > *:nth-child(3) { animation-delay: 0.10s; }
.fade-in > *:nth-child(4) { animation-delay: 0.15s; }
.fade-in > *:nth-child(5) { animation-delay: 0.20s; }
.fade-in > *:nth-child(6) { animation-delay: 0.25s; }

/* ================================================================
   33. SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ================================================================
   34. RESPONSIVE — Tablet (768px – 1024px)
   ================================================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }

  .invoices-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .top-header {
    padding: 0 var(--space-md);
  }

  .header-search input {
    width: 150px;
  }

  .view-content {
    padding: var(--space-lg);
  }
}

/* ================================================================
   35. RESPONSIVE — Mobile (< 768px)
   ================================================================ */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-info h3 {
    font-size: var(--font-xl);
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .form-row-2-inner {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }

  .header-actions .btn span {
    display: none;
  }

  .header-actions .btn {
    padding: 10px 12px;
  }

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

  .form-actions-left,
  .form-actions-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .form-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  .invoices-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .view-actions {
    width: 100%;
  }

  .view-actions .select-styled {
    flex: 1;
  }

  .view-content {
    padding: var(--space-md);
  }

  .table-responsive {
    margin: 0 calc(-1 * var(--space-md));
    padding: 0 var(--space-md);
  }

  .quick-actions-grid {
    flex-direction: column;
  }

  .modal-container {
    width: 96%;
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }

  .modal-controls {
    gap: 0;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .preview-wrapper {
    padding: var(--space-sm);
  }

  .invoice-preview {
    width: 100%;
    min-height: auto;
    font-size: 8pt;
  }

  .inv-header {
    padding: 20px;
    flex-direction: column;
    gap: var(--space-md);
  }

  .inv-client-info {
    text-align: left;
  }

  .inv-details {
    padding: 0 20px;
    flex-wrap: wrap;
  }

  .inv-items-table {
    width: calc(100% - 40px);
    margin: 0 20px 16px;
    font-size: 8pt;
  }

  .inv-totals {
    padding: 0 20px;
  }

  .inv-footer {
    padding: 16px 20px;
  }

  .page-title {
    font-size: var(--font-md);
  }

  .top-header {
    padding: 0 var(--space-md);
  }

  .toast-container {
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
}

/* ================================================================
   36. RESPONSIVE — Small Mobile (< 480px)
   ================================================================ */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .status-options {
    flex-direction: column;
  }

  .form-actions .btn span {
    display: none;
  }

  .form-actions .btn {
    min-width: auto;
    padding: 10px 14px;
  }

  .view-content {
    padding: var(--space-sm);
  }

  .invoice-card-amount {
    font-size: var(--font-xl);
  }

  .modal-header h3 span {
    display: none;
  }
}

/* ================================================================
   37. PRINT STYLES
   ================================================================ */
@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  .sidebar,
  .sidebar-overlay,
  .top-header,
  .toast-container,
  .loading-overlay,
  .modal-overlay,
  .modal-header,
  .modal-footer,
  .modal-controls,
  .form-actions,
  .filter-bar,
  .quick-actions-grid,
  .stats-grid,
  .recent-invoices-card,
  .view-header,
  .sidebar-footer,
  .mobile-menu-toggle,
  .btn,
  button {
    display: none !important;
  }

  .app-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .modal {
    position: static !important;
    display: block !important;
  }

  .modal-container {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    animation: none !important;
  }

  .modal-body {
    padding: 0 !important;
    overflow: visible !important;
  }

  .preview-wrapper {
    background: #FFFFFF !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .invoice-preview {
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    transform: none !important;
    page-break-inside: avoid;
  }

  .view {
    display: none !important;
  }

  @page {
    margin: 10mm;
    size: A4;
  }
}
