/* Reset and Global Styles */
:root {
  --primary: #0284c7; /* Sky/Corporate Blue Vyapar style */
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  
  --vyapar-green: #00a86b; /* Outward Sales Emerald */
  --vyapar-green-hover: #008f5a;
  --vyapar-green-light: #ecfdf5;
  
  --vyapar-purple: #7c3aed; /* Inward Purchase Violet */
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  
  --bg-main: #f1f5f9; /* Soft grey background */
  --bg-sidebar: #1e293b; /* Dark Navy Sidebar for premium look */
  --bg-card: #ffffff;
  --border-color: #cbd5e1; /* Slate borders */
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-white: #ffffff;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 20px -3px rgba(15, 23, 42, 0.08);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --transition-fast: 0.12s ease;
  --transition-normal: 0.22s ease;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
  height: 100vh;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Styles (Premium Navy Sidebar) */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-container {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--vyapar-green), #34d399);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 168, 107, 0.3);
}

.brand-icon {
  color: var(--text-white);
  width: 22px;
  height: 22px;
}

.brand-info h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
}

.brand-info span {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-white);
}

.nav-btn.active {
  background-color: var(--vyapar-green);
  color: var(--text-white);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 168, 107, 0.2);
}

.nav-btn i {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.seller-mini-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: var(--radius-md);
}

.mini-logo {
  width: 32px;
  height: 32px;
  background-color: var(--vyapar-green);
  color: var(--text-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
}

.mini-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-info h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-white);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-info p {
  font-size: 9px;
  color: #94a3b8;
}

/* Main Content Layout */
.app-content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100%;
  overflow: hidden;
}

.content-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background-color: #ffffff;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-left h1 {
  font-size: 20px;
  font-weight: 700;
}

.header-left p {
  font-size: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.dot-active {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.content-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Helper styles */
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-align-center { display: flex; align-items: center; }
.gap-xs { gap: 6px; }
.gap-sm { gap: 10px; }
.mt-xs { margin-top: 6px; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 24px; }
.mb-xs { margin-bottom: 6px; }
.mr-md { padding-right: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.bold-text { font-weight: 600; }
.hidden { display: none !important; }
.danger-text { color: var(--danger) !important; }
.w-100 { width: 100%; }
.w-55 { width: 55%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.align-top { vertical-align: top; }
.text-uppercase { text-transform: uppercase; }

/* Buttons */
.btn {
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background-color: var(--vyapar-green);
  color: var(--text-white);
  box-shadow: 0 2px 4px rgba(0, 168, 107, 0.15);
}

.btn-primary:hover {
  background-color: var(--vyapar-green-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-main);
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background-color: var(--vyapar-green);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-white);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-btn:hover {
  background-color: var(--vyapar-green-hover);
  transform: translateY(-1px);
}

.quick-action-btn i { width: 14px; height: 14px; }

/* Tab Management */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-pane.active {
  display: block;
}

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

/* Stats Cards styling */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

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

.stat-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-trend {
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-neutral { color: var(--warning); }
.stat-trend i { width: 10px; height: 10px; }

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper i { width: 20px; height: 20px; }
.sales-bg { background-color: #ecfdf5; color: var(--vyapar-green); }
.tax-bg { background-color: #faf5ff; color: #a855f7; }
.invoice-bg { background-color: #fef3c7; color: #d97706; }
.customers-bg { background-color: #eff6ff; color: #3b82f6; }

/* Secondary mini cards */
.mini-stat-card {
  background-color: var(--bg-card);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.mini-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  background-color: var(--bg-main);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Dashboard Content Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 20px;
}

.grid-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-action-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.card-action-link:hover {
  text-decoration: underline;
}

/* Quick Catalog List */
.quick-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.catalog-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  transition: background-color var(--transition-fast);
}

.catalog-item-row:hover {
  background-color: var(--primary-light);
}

.catalog-item-info h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.catalog-item-info span {
  font-size: 9px;
  color: var(--text-muted);
}

.catalog-item-price {
  text-align: right;
}

.catalog-item-price p {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.catalog-item-price span {
  font-size: 9px;
  background-color: var(--bg-card);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* General Tables styling */
.table-container {
  width: 100%;
  overflow-x: auto;
}

.scrollable-table {
  max-height: 320px;
  overflow-y: auto;
}

.scrollable-table::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.autocomplete-suggestions::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.scrollable-table::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.autocomplete-suggestions::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: var(--radius-full);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.4);
}

.interactive-table tbody tr {
  cursor: pointer;
}
.interactive-table tbody tr:hover {
  background-color: var(--primary-light) !important;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-warning { background-color: #fef3c7; color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-violet { background-color: #f3e8ff; color: #7c3aed; }

/* Table Action buttons */
.table-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

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

.btn-icon.delete-btn:hover {
  color: var(--danger);
  background-color: var(--danger-light);
  border-color: var(--danger);
}

.btn-icon i {
  width: 14px;
  height: 14px;
}

.btn-icon * {
  pointer-events: none;
}

/* Autocomplete suggestions */
.relative-container {
  position: relative;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 1px;
  display: none;
}

.autocomplete-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-fast);
}

/* Highlight style for arrow keys navigation */
.autocomplete-suggestion.highlighted {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
  font-weight: 600;
}

.autocomplete-suggestion:hover {
  background-color: var(--bg-main);
}

.autocomplete-suggestion .sugg-code {
  font-weight: 600;
  color: var(--primary);
}

.autocomplete-suggestion .sugg-name {
  color: var(--text-main);
  flex-grow: 1;
  padding-left: 8px;
}

.autocomplete-suggestion .sugg-state {
  font-size: 10px;
  color: var(--text-muted);
}

/* Form Styles */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
select {
  font-family: var(--font-sans);
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  background-color: var(--bg-card);
  transition: all var(--transition-fast);
  color: var(--text-main);
  height: 38px;
}

input[readonly] {
  background-color: #f8fafc;
  color: var(--text-muted);
  cursor: not-allowed;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.input-with-icon input {
  padding-left: 32px;
  width: 100%;
}

/* GST applicability badge in billing form */
.gst-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px dashed var(--primary);
  height: 38px;
}

/* Billing specific layout (Vyapar App Inspired UI) */
.billing-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.billing-grid {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 20px;
  align-items: flex-start;
}

.billing-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.billing-bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

@media (min-width: 1024px) {
  .billing-top-grid {
    grid-template-columns: 1.2fr 1fr;
  }
  .billing-bottom-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

.billing-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.billing-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.card-section-title i {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.card-section-title h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Vyapar Inspired Line Items continuous grid spreadsheet cells */
.billing-items-table {
  width: 100%;
  min-width: 950px;
  border-collapse: collapse;
  text-align: left;
}

.billing-items-table th {
  padding: 8px 10px;
  background-color: #f1f5f9;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid var(--border-color);
}

.billing-items-table td {
  padding: 0; /* Continuous grid layout */
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

.billing-items-table input,
.billing-items-table select {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: none !important; /* Remove individual borders */
  border-radius: 0 !important; /* Continuous grid layout */
  background-color: transparent;
  height: 34px;
}

.billing-items-table input:focus,
.billing-items-table select:focus {
  background-color: #f8fafc;
  outline: 2px solid var(--primary);
  z-index: 10;
  position: relative;
  box-shadow: none;
}

.sr-no-cell {
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  background-color: #f8fafc;
  font-size: 11px;
}

.row-item-taxable {
  background-color: #f8fafc;
  font-size: 12px;
  padding: 0 10px;
}

.billing-items-table .row-delete-btn {
  border: none;
  background: transparent;
  border-radius: 0;
  width: 100%;
  height: 34px;
  color: var(--text-muted);
}
.billing-items-table .row-delete-btn:hover {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* Summary Box Styling (Vyapar App Inspired) */
.summary-card {
  padding: 24px;
  border: 2px solid var(--border-color);
  background-color: #ffffff;
}

.summary-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.tax-line {
  font-size: 12px;
  padding-left: 10px;
  color: #64748b;
  position: relative;
}

.tax-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 2px;
  background-color: var(--border-color);
}

.grand-total-line {
  font-size: 18px;
  color: #ffffff; /* Vyapar styled solid block for grand total */
  background-color: var(--vyapar-green);
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.grand-total-line span {
  color: #ffffff;
}

/* Toggle colors for purchase invoice types */
#billingTab:has(#billInvoiceType[value="Purchase"]) .grand-total-line {
  background-color: var(--vyapar-purple);
}
#billingTab:has(#billInvoiceType[value="Purchase"]) .btn-primary {
  background-color: var(--vyapar-purple);
}

.amount-words-box {
  margin-top: 20px;
  background-color: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--border-color);
}

.amount-words-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.amount-words-content {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-main);
}

.billing-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.billing-actions-grid .btn-primary {
  grid-column: span 1;
}

.sticky-card {
  position: sticky;
  top: 20px;
}

/* Settings Forms elements */
.settings-grid {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 20px;
}

.settings-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logo-upload-card {
  text-align: center;
}

.logo-preview-area {
  width: 100%;
  height: 120px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-main);
}

.logo-preview-area img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.no-logo-text {
  padding: 15px;
  color: var(--text-muted);
}

.no-logo-text i {
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
}

.no-logo-text p {
  font-size: 10px;
  line-height: 1.4;
}

/* Modals styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: modalFadeIn 0.2s ease;
}

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

.modal-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.wide-modal {
  max-width: 800px;
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
}

.modal-separator {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 16px 0;
}

.section-subtitle {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* Ledger Modal Banner styles */
.ledger-info-banner {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.ledger-summary-bal {
  text-align: right;
}

.ledger-summary-bal span {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
}

.ledger-summary-bal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

/* State overrides UI in modal */
.state-override-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background-color: var(--bg-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.state-override-item select {
  flex: 2;
  padding: 4px 8px;
  font-size: 12px;
  height: 32px;
}

.state-override-item input {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  height: 32px;
}

/* ==================================================== */
/* INVOICE DESIGN TEMPLATE SYSTEMS (For print & preview)*/
/* ==================================================== */
.template-classic {
  --invoice-primary: #0284c7;
  --invoice-bg-light: #f0f9ff;
  --invoice-border: #cbd5e1;
  --invoice-font: 'Outfit', sans-serif;
}
.template-classic .invoice-title h1 {
  color: var(--invoice-primary) !important;
}
.template-classic th {
  background-color: #f1f5f9 !important;
}

.template-modern {
  --invoice-primary: #1e293b;
  --invoice-bg-light: #f1f5f9;
  --invoice-border: #94a3b8;
  --invoice-font: 'Courier New', Courier, monospace;
}
.template-modern * {
  font-family: var(--invoice-font) !important;
}
.template-modern .invoice-title h1 {
  color: var(--invoice-primary) !important;
  font-weight: 900 !important;
}
.template-modern th {
  background-color: var(--invoice-primary) !important;
  color: #ffffff !important;
}
.template-modern .print-items-table th, 
.template-modern .print-items-table td,
.template-modern .print-gst-breakdown th,
.template-modern .print-gst-breakdown td {
  border: 1px solid #64748b !important;
}

.template-minimalist {
  --invoice-primary: #008b8b;
  --invoice-bg-light: #f0fdfa;
  --invoice-border: #ccfbf1;
  --invoice-font: 'Outfit', sans-serif;
}
.template-minimalist .invoice-title h1 {
  color: var(--invoice-primary) !important;
  letter-spacing: 2px;
}
.template-minimalist th {
  background-color: var(--invoice-bg-light) !important;
  color: var(--invoice-primary) !important;
  border-bottom: 2px solid var(--invoice-primary) !important;
}
.template-minimalist td {
  border: none !important;
  border-bottom: 1px solid var(--invoice-border) !important;
}

#invoiceViewerPrintContext {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* PDF PRINTING STYLES */
.print-container {
  display: none;
  background-color: #ffffff;
  color: #000000;
  width: 210mm;
  min-height: 297mm;
  padding: 15mm;
  font-family: var(--font-sans);
  box-sizing: border-box;
}

.invoice-box {
  width: 100%;
}

.border-none { border: none !important; }
.w-100 { width: 100%; }
.header-table { margin-bottom: 10px; }

#printLogoContainer img {
  max-height: 55px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 8px;
}

.seller-details h2 {
  font-size: 16px;
  margin-bottom: 3px;
  color: #000000;
}

.seller-details p, .customer-details p, .consignee-details p {
  font-size: 10px;
  line-height: 1.4;
  margin-bottom: 1px;
  color: #334155;
}

.invoice-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.invoice-meta-info {
  display: inline-block;
  text-align: left;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background-color: #f8fafc;
}

.meta-inner-table td {
  font-size: 10px;
  padding: 2px 4px;
  border: none;
}

.print-divider {
  border: 0;
  height: 1px;
  background-color: #cbd5e1;
  margin: 12px 0;
}

.billing-details-table {
  margin-bottom: 16px;
  border-collapse: collapse;
}

.billing-details-table td {
  border: 1px solid #cbd5e1;
  padding: 10px;
  background-color: #ffffff;
  border-radius: var(--radius-sm);
}

.billing-details-table td:first-child {
  border-right: none;
}

.section-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 3px;
}

.print-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.print-items-table th, .print-items-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  font-size: 10px;
}

.print-items-table th {
  background-color: #f1f5f9;
  font-weight: 700;
  text-transform: uppercase;
}

.print-items-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.totals-summary-table {
  margin-bottom: 16px;
  border-collapse: collapse;
}

.table-sub-title {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
  color: #334155;
}

.print-gst-breakdown {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.print-gst-breakdown th, .print-gst-breakdown td {
  border: 1px solid #cbd5e1;
  padding: 5px 6px;
  font-size: 9px;
  text-align: right;
}

.print-gst-breakdown th {
  background-color: #f1f5f9;
  text-align: center;
  font-weight: 700;
}

.bank-details-box {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px;
  background-color: #f8fafc;
}

.bank-title {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 3px;
  color: #334155;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 2px;
}

.bank-details-box p {
  font-size: 9px;
  margin-bottom: 1px;
}

.print-totals-calculation {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cbd5e1;
}

.print-totals-calculation td {
  padding: 6px 10px;
  font-size: 10px;
  border-bottom: 1px solid #cbd5e1;
}

.print-totals-calculation tr:last-child td {
  border-bottom: none;
}

.grand-total-row {
  background-color: #f1f5f9;
}

.grand-total-row td {
  font-size: 12px;
}

.print-amount-words {
  margin-top: 8px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background-color: #f8fafc;
}

.print-amount-words span {
  font-size: 8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.print-amount-words p {
  font-size: 10px;
  margin-top: 1px;
}

.terms-signature-table {
  margin-top: 20px;
}

.terms-conditions {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background-color: #fafafa;
}

.terms-title {
  font-size: 8px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 3px;
}

.terms-conditions li {
  font-size: 8px;
  margin-bottom: 1px;
  line-height: 1.3;
}

.signature-box p {
  font-size: 9px;
}

.signature-space { height: 40px; }

.auth-signatory {
  font-size: 8px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 3px;
  width: 140px;
}

/* PC LAYOUT OPTIMIZATIONS */
@media (min-width: 1200px) {
  .app-sidebar { width: 260px; }
  .content-body { max-width: 1560px; margin-left: auto; margin-right: auto; }
  .billing-grid { grid-template-columns: 2.3fr 1fr; }
}

@media print {
  body { background-color: #ffffff !important; }
  .app-container { display: none !important; }
  .modal-backdrop { display: none !important; }
  .print-container { display: block !important; padding: 0 !important; margin: 0 !important; }
}
