/* Infinity Creative Invoicing System - Material Design 2025 */

:root {
  /* Core Colors - Keep existing scheme */
  --primary: #333;
  --primary-rgb: 51, 51, 51;
  --secondary: #666;
  --border: #ddd;
  --bg-light: #f8f9fa;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;

  /* Material Design Extensions */
  --surface: #ffffff;
  --surface-variant: #f5f5f5;
  --on-surface: #1a1a1a;
  --on-surface-variant: #666666;
  --outline: #e0e0e0;
  --outline-variant: #c4c4c4;

  /* Elevation Shadows */
  --elevation-1: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.12);
  --elevation-2: 0 3px 6px rgba(0,0,0,0.10), 0 3px 6px rgba(0,0,0,0.08);
  --elevation-3: 0 10px 20px rgba(0,0,0,0.12), 0 6px 6px rgba(0,0,0,0.08);
  --elevation-4: 0 14px 28px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.10);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

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

  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-light);
  color: var(--on-surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--surface-variant) 100%);
}

.login-box {
  background: var(--surface);
  padding: var(--space-xl) var(--space-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-3);
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.4s ease-out;
}

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

.login-box .logo {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.login-box .logo-symbol {
  font-size: 4rem;
  font-weight: 300;
  color: var(--primary);
  line-height: 1;
  display: block;
  margin-bottom: var(--space-xs);
}

.login-box h1 {
  text-align: center;
  margin-bottom: var(--space-xs);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--on-surface);
}

.login-box .subtitle {
  text-align: center;
  color: var(--on-surface-variant);
  margin-bottom: var(--space-xl);
  font-size: var(--text-sm);
}

/* Material Form Group */
.form-group {
  margin-bottom: var(--space-lg);
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--on-surface-variant);
  transition: var(--transition-fast);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--outline);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--surface);
  color: var(--on-surface);
  transition: var(--transition-fast);
  outline: none;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--outline-variant);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-group input::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.6;
}

/* Input with icon */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper input {
  padding-left: 44px;
}

.input-icon-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--on-surface-variant);
  font-size: 1rem;
}

.input-icon-wrapper input:focus + i,
.input-icon-wrapper input:focus ~ i {
  color: var(--primary);
}

/* Material Buttons */
.btn {
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: var(--transition-fast);
}

.btn:hover::after {
  opacity: 0.08;
}

.btn:active::after {
  opacity: 0.12;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  box-shadow: var(--elevation-1);
}

.btn-primary:hover {
  box-shadow: var(--elevation-2);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: var(--elevation-1);
}

.btn-success:hover {
  background: #218838;
  box-shadow: var(--elevation-2);
}

.btn-warning {
  background: var(--warning);
  color: #212529;
  box-shadow: var(--elevation-1);
}

.btn-warning:hover {
  background: #e0a800;
  box-shadow: var(--elevation-2);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: var(--elevation-1);
}

.btn-danger:hover {
  background: #c82333;
  box-shadow: var(--elevation-2);
}

.btn-secondary {
  background: var(--surface-variant);
  color: var(--on-surface);
  border: 1px solid var(--outline);
}

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

.btn-ghost {
  background: transparent;
  color: var(--on-surface);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Loading spinner */
.btn .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error Message */
.error-message {
  background: #fef2f2;
  color: var(--danger);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: none;
  font-size: var(--text-sm);
  border-left: 4px solid var(--danger);
  animation: shake 0.4s ease-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.error-message i {
  margin-right: var(--space-sm);
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--primary) 0%, #1a1a1a 100%);
  color: white;
  padding: var(--space-lg);
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--elevation-3);
  z-index: 100;
}

.sidebar-header {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: var(--space-lg);
}

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

.sidebar-logo .logo-symbol {
  font-size: 2.5rem;
  font-weight: 300;
  line-height: 1;
  opacity: 0.95;
}

.sidebar h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.sidebar .subtitle {
  font-size: var(--text-xs);
  opacity: 0.6;
  margin-top: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: var(--space-md);
  margin: 0;
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
  font-weight: 500;
  font-size: var(--text-sm);
  position: relative;
  overflow: hidden;
}

.sidebar nav a i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  opacity: 0.9;
}

.sidebar nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: white;
  transform: scaleY(0);
  transition: var(--transition-fast);
  border-radius: 0 2px 2px 0;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

.sidebar nav a.active::before {
  transform: scaleY(1);
}

.sidebar nav a.active i {
  opacity: 1;
}

.sidebar .logout-btn {
  margin-top: var(--space-sm);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: var(--space-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.sidebar .logout-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease-out;
}

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

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-xl);
  box-shadow: var(--elevation-4);
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-confirm {
  max-width: 450px;
  padding: 0;
}

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

.modal-confirm .modal-header {
  background: var(--surface-variant);
}

.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}

.modal-header h2 i {
  color: var(--warning);
}

.close-btn {
  background: transparent;
  border: none;
  width: 39px;
  height: 39px;
  font-size: 35px;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.close-btn:hover {
  background: var(--surface-variant);
  color: var(--on-surface);
}

.modal-body {
  padding: var(--space-xl);
}

.confirm-body {
  text-align: center;
  padding: var(--space-xl);
}

.confirm-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  font-size: 2rem;
}

.confirm-icon.danger {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
}

.confirm-icon.warning {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning);
}

.confirm-icon.success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.confirm-title {
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--on-surface);
}

.confirm-number {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--danger);
  margin-bottom: var(--space-sm);
}

.confirm-warning {
  font-size: var(--text-sm);
  color: var(--on-surface-variant);
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid var(--outline);
  background: var(--surface-variant);
}

.modal-actions .btn {
  flex: 1;
}

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

/* Invoice Preview */
.invoice-preview {
  background: white;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
  font-family: Arial, sans-serif;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #333;
}

.invoice-logo h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

.invoice-logo .subtitle {
  color: var(--secondary);
  font-size: 14px;
}

.invoice-meta { text-align: right; }

.invoice-meta .invoice-number {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
}

.invoice-badge {
  display: inline-block;
  padding: 5px 15px;
  border: 2px solid #333;
  font-weight: bold;
  margin-top: 10px;
}

.parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

.party h3 {
  font-size: 14px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #333;
}

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

.items-table th {
  background: #333;
  color: white;
  padding: 10px;
  text-align: left;
}

.items-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.totals {
  text-align: right;
  margin-top: 20px;
}

.totals .row {
  display: flex;
  justify-content: flex-end;
  gap: 50px;
  padding: 5px 0;
}

.totals .total-row {
  font-weight: bold;
  font-size: 18px;
  border-top: 2px solid #333;
  padding-top: 10px;
  margin-top: 10px;
}

.bank-info {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 30px;
}

.bank-info > div:last-child:nth-child(2) {
  /* When only 2 items, make 2-column layout */
  grid-column: auto;
}

.bank-info:has(> div:nth-child(3)) {
  /* When 3 items (with QR), use 3 columns */
  grid-template-columns: 1fr 1fr 1fr;
}

.bank-info:not(:has(> div:nth-child(3))) {
  /* When only 2 items, use 2 columns */
  grid-template-columns: 1fr 1fr;
}

.invoice-footer {
  margin-top: 30px;
  text-align: center;
  color: var(--secondary);
  font-size: 12px;
}

/* Filters */
.filters {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  padding: 0 var(--space-md);
  transition: var(--transition-fast);
}

.filter-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.filter-group i {
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

.filter-group select,
.filter-group input {
  border: none;
  background: transparent;
  padding: var(--space-sm) var(--space-xs);
  font-size: var(--text-sm);
  color: var(--on-surface);
  outline: none;
  min-width: 150px;
}

.filter-group select {
  cursor: pointer;
}

.search-group {
  flex: 1;
  min-width: 200px;
}

.search-group input {
  width: 100%;
}

.table-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

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

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--outline);
  background: var(--surface, #fff);
  color: var(--text-primary, #333);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: var(--surface-hover, #f5f5f5);
  border-color: var(--primary, #4f46e5);
}

.pagination-btn.active {
  background: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-secondary, #888);
  font-size: 0.85rem;
}

/* Actions */
.actions {
  display: flex;
  gap: var(--space-xs);
}

.actions .btn {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
}

/* Action Buttons */
.btn-action {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

/* Saved services */
.saved-services {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.service-chip {
  background: var(--surface-variant);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  cursor: pointer;
  border: 1px solid var(--outline);
  transition: var(--transition-fast);
}

.service-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.service-chip:hover { background: #e9ecef; }

/* Workflow Styles */
.workflow-content {
  max-width: 900px;
}

.workflow-section {
  margin-bottom: 40px;
}

.workflow-section h2 {
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.workflow-step {
  display: flex;
  margin-bottom: 30px;
  align-items: flex-start;
}

.step-number {
  background: var(--primary);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 20px;
  flex-shrink: 0;
}

.step-content h3 {
  margin-bottom: 10px;
  color: var(--primary);
}

.step-content ul {
  margin-top: 10px;
  padding-left: 20px;
}

.step-content li {
  margin-bottom: 5px;
}

.payment-method {
  background: var(--bg-light);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.payment-method h3 {
  color: var(--primary);
  margin-bottom: 10px;
}

.payment-method ol {
  margin-top: 10px;
  padding-left: 20px;
}

.payment-method li {
  margin-bottom: 8px;
}

.tip {
  background: #e8f4fd;
  border-left: 4px solid #0066cc;
  padding: 15px;
  margin-top: 15px;
  border-radius: 0 4px 4px 0;
}

.example {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.example h3 {
  background: var(--primary);
  color: white;
  padding: 15px;
  margin: 0;
}

.example-content {
  padding: 20px;
}

.example-content ol {
  margin-top: 10px;
  padding-left: 20px;
}

.example-content li {
  margin-bottom: 5px;
}

.important-notes {
  display: grid;
  gap: 15px;
}

.note {
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid;
}

.note.warning {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

.note.info {
  background: #d1ecf1;
  border-color: #17a2b8;
  color: #0c5460;
}

.note.success {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.note.tip {
  background: #e2e3e5;
  border-color: #6c757d;
  color: #383d41;
}

/* Main Content */
.main-content {
  min-width: 0; /* flex елемент - без това широко съдържание разпъва страницата и се появява хоризонтален скрол */
  margin-left: 260px;
  padding: var(--space-xl);
  flex: 1;
  background: var(--bg-light);
  min-height: 100vh;
}

/* Долната навигация е само за телефон (виж @media max-width 768px) - без това стоеше под
   съдържанието и на десктоп и добавяше 26px вертикален скрол на всеки таб */
.bottom-nav { display: none; }

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

.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--on-surface);
}

.page-header h1 i {
  color: var(--primary);
}

.page-description {
  color: var(--on-surface-variant);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
}

/* Card */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--elevation-1);
  margin-bottom: var(--space-lg);
}

.settings-card {
  margin-bottom: var(--space-lg);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

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

.card-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}

.card-description {
  color: var(--on-surface-variant);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.numbering-section {
  margin-bottom: var(--space-md);
}

.numbering-section h4 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--on-surface);
}

.numbering-section h4 i {
  color: var(--primary);
}

.input-readonly {
  background: var(--surface-variant) !important;
  cursor: not-allowed;
}

.warning-text {
  font-size: var(--text-xs);
  color: var(--warning);
  margin-top: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Info Boxes */
.info-box {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.info-box i {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box strong {
  display: block;
  margin-bottom: var(--space-xs);
}

.info-box p {
  margin: 0;
  font-size: var(--text-sm);
}

.info-success {
  background: rgba(40, 167, 69, 0.1);
  border-left: 4px solid var(--success);
}

.info-success i {
  color: var(--success);
}

.info-primary {
  background: rgba(33, 150, 243, 0.1);
  border-left: 4px solid var(--info);
}

.info-primary i {
  color: var(--info);
}

/* Accordion */
.accordion {
  cursor: pointer;
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  font-size: var(--text-lg);
  font-weight: 600;
  user-select: none;
}

.accordion-header i:first-child {
  color: var(--info);
}

.accordion-icon {
  margin-left: auto;
  transition: var(--transition-normal);
  color: var(--on-surface-variant);
}

.accordion[open] .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--outline);
}

.accordion-content h4 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.accordion-content h4 i {
  color: var(--primary);
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--outline);
}

table th {
  background: var(--surface-variant);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  z-index: 1;
}

table th.th-checkbox {
  width: 48px;
  text-align: center;
}

table th.th-actions {
  width: 150px;
  text-align: center;
}

table tbody tr {
  transition: var(--transition-fast);
}

table tbody tr:hover {
  background: var(--surface-variant);
}

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

table td {
  font-size: var(--text-sm);
  color: var(--on-surface);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge i {
  font-size: 0.625rem;
}

.badge-draft {
  background: var(--surface-variant);
  color: var(--on-surface-variant);
}

.badge-issued {
  background: rgba(255, 193, 7, 0.15);
  color: #856404;
}

.badge-paid {
  background: rgba(40, 167, 69, 0.15);
  color: #155724;
}

.badge-void {
  background: rgba(220, 53, 69, 0.15);
  color: #721c24;
}

.badge-cancelled {
  background: rgba(220, 53, 69, 0.15);
  color: #721c24;
}

.badge-manual {
  background: var(--surface-variant);
  color: var(--on-surface-variant);
}

.badge-mymenu {
  background: rgba(23, 162, 184, 0.15);
  color: #0c5460;
}

.badge-subscription {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

/* Книговъдец (knigovadec.com) — горското зелено от марката му. */
.badge-knigovadec {
  background: rgba(47, 118, 94, 0.15);
  color: #1f5a46;
  letter-spacing: 0.3px;
}

/* Mobile & Tablet Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
    padding: var(--space-md);
  }

  .main-content {
    margin-left: 220px;
    padding: var(--space-lg);
  }
}

@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
    padding-bottom: 80px; /* Space for bottom nav */
  }

  /* Hide desktop sidebar on mobile */
  .sidebar {
    display: none;
  }

  /* Bottom Navigation for mobile */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--outline);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    padding: var(--space-sm) 0;
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  }

  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    color: var(--on-surface-variant);
    text-decoration: none;
    font-size: var(--text-xs);
    transition: var(--transition-fast);
  }

  .bottom-nav a i {
    font-size: 1.25rem;
  }

  .bottom-nav a.active {
    color: var(--primary);
  }

  .bottom-nav a.active i {
    color: var(--primary);
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-md);
  }

  .page-header {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch;
  }

  .page-header h1 {
    font-size: var(--text-xl);
    text-align: center;
    justify-content: center;
  }

  .page-header .btn {
    width: 100%;
  }

  /* Filters responsive */
  .filters {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .search-group {
    min-width: 100%;
  }

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

  /* Cards */
  .card {
    padding: var(--space-md);
    margin: 0 calc(-1 * var(--space-md));
    border-radius: 0;
  }

  /* Table responsive */
  .table-container {
    margin: 0 calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  table {
    font-size: var(--text-sm);
  }

  table th, table td {
    padding: var(--space-sm) var(--space-xs);
  }

  /* Hide less important columns on mobile */
  table th:nth-child(1),
  table td:nth-child(1),
  table th:nth-child(7),
  table td:nth-child(7) {
    display: none;
  }

  .actions {
    flex-direction: row;
    gap: var(--space-xs);
  }

  .btn-action {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  /* Toast on mobile */
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: 90px; /* Above bottom nav */
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  /* Modal responsive */
  .modal-overlay {
    padding: var(--space-sm);
  }

  .modal {
    max-height: 90vh;
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
  }

  .modal-confirm {
    padding: 0;
  }

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

  .modal-header h2 {
    font-size: var(--text-lg);
  }

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

  .modal-actions {
    padding: var(--space-md);
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  /* Invoice preview responsive */
  .invoice-preview {
    padding: var(--space-lg);
    font-size: var(--text-sm);
  }

  .invoice-header {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }

  .invoice-meta {
    text-align: center;
  }

  .invoice-logo h1 {
    font-size: var(--text-xl);
  }

  .invoice-meta .invoice-number {
    font-size: var(--text-lg);
  }

  .parties {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .items-table th, .items-table td {
    padding: var(--space-sm) var(--space-xs);
    font-size: var(--text-xs);
  }

  .totals .row {
    flex-direction: column;
    gap: var(--space-xs);
    text-align: right;
  }

  .bank-info {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Saved services chips */
  .saved-services {
    gap: 5px;
  }

  .service-chip {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* Workflow responsive */
  .workflow-step {
    flex-direction: column;
    text-align: center;
  }

  .step-number {
    margin: 0 auto 15px auto;
  }

  .payment-method {
    padding: 15px;
  }

  .example-content {
    padding: 15px;
  }

  .important-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: 25px;
  }

  .login-box h1 {
    font-size: 20px;
  }

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

  .form-group input, .form-group select, .form-group textarea {
    padding: 14px;
    font-size: 16px;
  }

  table {
    font-size: 12px;
  }

  /* Show only essential columns */
  table th:nth-child(3),
  table td:nth-child(3) {
    display: none;
  }

  .invoice-preview {
    padding: 15px;
  }

  .items-table th:nth-child(3),
  .items-table td:nth-child(3),
  .items-table th:nth-child(4),
  .items-table td:nth-child(4) {
    display: none;
  }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .form-group input, .form-group select, .form-group textarea {
    min-height: 44px;
  }

  .sidebar nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .service-chip {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  table td, table th {
    min-height: 44px;
  }

  .close-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 28px;
  }
}

@media print {
  .sidebar, .page-header, .filters, .actions, .no-print, .modal-header { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
  .modal-overlay { position: static; background: none; }
  .modal { box-shadow: none; max-width: 100%; padding: 0; }
  .invoice-preview { box-shadow: none; }
}

/* Toast / Snackbar Styles */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-3);
  min-width: 300px;
  max-width: 450px;
  animation: toastSlideIn 0.3s ease-out;
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s ease-out forwards;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.toast-success .toast-icon {
  background: rgba(40, 167, 69, 0.15);
  color: var(--success);
}

.toast-error .toast-icon {
  background: rgba(220, 53, 69, 0.15);
  color: var(--danger);
}

.toast-warning .toast-icon {
  background: rgba(255, 193, 7, 0.15);
  color: var(--warning);
}

.toast-info .toast-icon {
  background: rgba(23, 162, 184, 0.15);
  color: var(--info);
}

.toast-content {
  flex: 1;
}

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

.toast-message {
  font-size: var(--text-sm);
  color: var(--on-surface-variant);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.toast-close:hover {
  background: var(--surface-variant);
  color: var(--on-surface);
}

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

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

/* Legacy toast support */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Accordion styles - deprecated, use .accordion class */
details:not(.accordion) {
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
}

details:not(.accordion) summary {
  outline: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

details:not(.accordion) summary::-webkit-details-marker {
  display: none;
}

details:not(.accordion) summary::before {
  content: '';
  display: none;
}

details:not(.accordion) summary:hover {
  color: var(--primary);
}

/* Print styles - only print the invoice preview */
@media print {
  body * {
    visibility: hidden;
  }

  #previewModal,
  #previewModal * {
    visibility: visible;
  }

  #previewModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: white;
  }

  #previewModal .modal {
    max-width: 100%;
    box-shadow: none;
    border: none;
  }

  #previewModal .modal-header,
  #previewModal .close-btn,
  #previewModal button {
    display: none !important;
  }

  #previewModal .modal-body {
    padding: 0;
  }
}

/* ============================================
   LOGS VIEW STYLES
   ============================================ */

/* Gaps Grid */
.gaps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.gap-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  border-radius: var(--radius-full);
  padding: 8px 12px;
  font-size: var(--text-sm);
  transition: var(--transition-fast);
}

.gap-chip:hover {
  border-color: var(--primary);
  box-shadow: var(--elevation-1);
}

.gap-number {
  font-weight: 600;
  font-family: 'Monaco', 'Consolas', monospace;
  color: var(--primary);
}

.gap-type {
  font-size: var(--text-xs);
  color: var(--on-surface-variant);
  padding: 2px 8px;
  background: white;
  border-radius: var(--radius-sm);
}

.gap-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  opacity: 0.6;
}

.gap-remove:hover {
  opacity: 1;
  background: rgba(220, 53, 69, 0.1);
}

.gaps-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.08), rgba(40, 167, 69, 0.04));
  border: 1px solid rgba(40, 167, 69, 0.2);
  border-radius: var(--radius-md);
  color: var(--success);
  font-size: var(--text-sm);
  margin-top: 15px;
}

.gaps-info i {
  font-size: 1rem;
}

.gaps-info strong {
  font-family: 'Monaco', 'Consolas', monospace;
}

/* Empty state for gaps */
.empty-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  color: var(--on-surface-variant);
  font-size: var(--text-sm);
}

.empty-state i {
  font-size: 1.5rem;
  color: var(--success);
}

/* Loading and empty cells */
.loading-cell,
.empty-cell {
  text-align: center;
  padding: 30px !important;
  color: var(--on-surface-variant);
}

.loading-cell i,
.empty-cell i {
  margin-right: 8px;
}

/* Card header with icon */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.card-header i {
  font-size: 1.25rem;
  color: var(--primary);
  opacity: 0.8;
}

.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-description {
  color: var(--on-surface-variant);
  font-size: var(--text-sm);
  margin: 0 0 20px 0;
}

/* Badge for logs */
.badge-issued {
  background: linear-gradient(135deg, #17a2b8, #138496);
  color: white;
}

/* Logs table improvements */
#logsTable tr td:first-child {
  font-size: var(--text-xs);
  color: var(--on-surface-variant);
  white-space: nowrap;
}

#logsTable tr td:nth-child(2) {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: var(--text-sm);
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--on-surface-variant);
}

.loading-spinner i {
  font-size: 1.25rem;
}
/* ===== Статистика (js/stats.js) =====
   Страницата тече надолу със скрол. Твърдото правило е да няма хоризонтален скрол:
   всички решетки са с minmax(0, …), а дългите имена се режат с многоточие. */
.st-view {
  --st-surface: #ffffff;
  --st-line: #ecebe6;
  --st-ink: #1a1a1a;
  --st-ink2: #52514e;
  --st-muted: #898781;
  --st-track: #f1f0ec;
  --st-revenue: #2a78d6;
  --st-profit: #1f9d55;
  --st-loss: #d03b3b;
  color: var(--st-ink);
}
.st-view.is-loading .st-pane { opacity: 0.55; transition: opacity 150ms; }
.st-muted { color: var(--st-muted); }
.st-desc { font-size: 12px; margin-top: 2px; line-height: 1.35; }
.st-empty { color: var(--st-muted); font-size: 13px; padding: 12px 0; text-align: center; }
.st-status { padding: 10px 14px; background: #fff4f4; color: #a71d2a; border-radius: var(--radius-md); margin: 0 0 12px; font-size: 13px; }

/* Шапка: заглавие · под-табове · период и ДДС в един ред */
.st-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.st-title { display: flex; align-items: baseline; gap: 12px; margin-right: auto; min-width: 0; }
.st-title h1 { font-size: 1.375rem; font-weight: 700; display: flex; align-items: center; gap: 10px; margin: 0; white-space: nowrap; }
.st-title h1 i { font-size: 1.1rem; color: var(--st-ink2); }
.st-range { font-size: 13px; color: var(--st-muted); white-space: nowrap; }

.st-tabs, .st-seg { display: inline-flex; background: #ecebe6; border-radius: 10px; padding: 3px; gap: 2px; }
.st-tabs button, .st-seg-btn {
  border: 0; background: transparent; color: var(--st-ink2); font: 500 13px/1 Inter, system-ui, sans-serif;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 0; width: auto;
}
.st-tabs button:hover, .st-seg-btn:hover { color: var(--st-ink); }
.st-tabs button[aria-selected="true"], .st-seg-btn[aria-checked="true"] {
  background: var(--st-surface); color: var(--st-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.st-tabs button:focus-visible, .st-seg-btn:focus-visible, .st-icon-btn:focus-visible { outline: 2px solid var(--st-revenue); outline-offset: 1px; }
.st-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.st-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--st-ink2); cursor: pointer; user-select: none; position: relative; }
.st-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.st-switch-track { width: 34px; height: 20px; border-radius: 10px; background: #d6d5cf; position: relative; transition: background 150ms; flex: none; }
.st-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 150ms; }
.st-switch input:checked + .st-switch-track { background: var(--st-revenue); }
.st-switch input:checked + .st-switch-track::after { transform: translateX(14px); }
.st-switch input:focus-visible + .st-switch-track { outline: 2px solid var(--st-revenue); outline-offset: 2px; }
.st-icon-btn { width: 34px; height: 34px; min-height: 0; padding: 0; border: 1px solid var(--st-line); background: var(--st-surface); border-radius: 8px; color: var(--st-ink2); cursor: pointer; }
.st-icon-btn:hover { color: var(--st-ink); border-color: #d6d5cf; }

/* Избор на месец: ‹ [месец] › */
.st-month { display: inline-flex; align-items: center; gap: 4px; }
.st-month-step { width: 28px; height: 34px; font-size: 11px; }
.st-select {
  height: 34px; min-height: 0; border: 1px solid var(--st-line); border-radius: 8px; background: var(--st-surface);
  color: var(--st-ink2); font: 500 13px Inter, system-ui, sans-serif; padding: 0 28px 0 10px; cursor: pointer; width: auto; max-width: 100%;
}
.st-select:hover { border-color: #d6d5cf; }
.st-select:focus-visible { outline: 2px solid var(--st-revenue); outline-offset: 1px; }
.st-select.is-active { border-color: var(--st-ink); color: var(--st-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.st-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-hint { cursor: help; border-bottom: 1px dotted var(--st-muted); }
.st-table td.st-uncounted { color: var(--st-muted); }

/* Карти */
.st-card { background: var(--st-surface); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.03); padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; }
.st-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.st-card-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--st-ink); }
.st-card-meta { font-size: 12.5px; color: var(--st-muted); font-weight: 400; }
.st-card-meta strong { color: var(--st-ink2); font-weight: 600; }

/* Ключови числа */
.st-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.st-kpi { background: var(--st-surface); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.03); padding: 12px 16px; min-width: 0; }
.st-kpi-label { font-size: 13px; color: var(--st-ink2); font-weight: 500; }
.st-kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 0; }
.st-kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; }
.st-kpi.is-pos .st-kpi-value { color: var(--st-profit); }
.st-kpi.is-neg .st-kpi-value { color: var(--st-loss); }
.st-kpi.is-warn .st-kpi-sub { color: #9a6700; }
.st-kpi-sub { font-size: 12.5px; color: var(--st-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-spark { width: 96px; height: 32px; flex: none; }

/* Обзор */
.st-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
.st-legend { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--st-ink2); }
.st-legend li { display: inline-flex; align-items: center; gap: 6px; }
.st-key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.st-trend-main { position: relative; height: 230px; }
.st-trend-sub-label { font-size: 11.5px; color: var(--st-muted); margin: 6px 0 0; }
.st-trend-profit { position: relative; height: 96px; }
.st-footnote { font-size: 11.5px; color: var(--st-muted); margin: 6px 0 0; min-height: 1em; }

.st-rank-box { min-height: 0; }
.st-rank { list-style: none; margin: 0; padding: 0; }
.st-rank-row {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(36px, 1fr) auto 34px; align-items: center; gap: 10px;
  font-size: 13px; padding: 5px 4px; border-radius: 6px;
}
.st-rank-row[hidden] { display: none; }
.st-rank-row.is-link { cursor: pointer; }
.st-rank-row.is-link:hover { background: #f6f5f2; }
.st-rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--st-ink); }
.st-rank-track { display: block; height: 8px; border-radius: 4px; background: var(--st-track); overflow: hidden; }
.st-rank-fill { display: block; height: 100%; border-radius: 4px; }
.st-rank-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.st-rank-share { font-variant-numeric: tabular-nums; color: var(--st-muted); text-align: right; font-size: 12px; }
.st-more { align-self: flex-start; margin-top: 6px; border: 0; background: none; padding: 2px 4px; min-height: 0; width: auto; color: var(--st-revenue); font: 500 12.5px Inter, system-ui, sans-serif; cursor: pointer; }
.st-more:hover { text-decoration: underline; }
.st-more[hidden] { display: none; }

/* Таблици в под-табовете */
.st-card-flow { padding: 18px 20px; }
.st-table th.num, .st-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-table td { vertical-align: top; }
.st-table td.actions { white-space: nowrap; }
.st-col-bar { width: 22%; }
.st-table td.st-cell-bar { vertical-align: middle; }
.st-client-row { cursor: pointer; }
.st-client-row:focus-visible { outline: 2px solid var(--st-revenue); outline-offset: -2px; }
.st-client-row.is-open { background: #f6f5f2; }
.st-chevron { width: 14px; font-size: 0.7rem; color: var(--st-muted); }
.st-client-detail td { background: #fbfaf8; }
.st-service-list { list-style: none; margin: 0; padding: 0 0 0 22px; display: grid; gap: 10px; }
.st-service-head { display: flex; justify-content: space-between; gap: 16px; max-width: 560px; }
.st-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #fdecec; color: #a71d2a; vertical-align: middle; }
.st-add { width: auto; padding: 8px 14px; font-size: 13px; }
.st-card-head-center { align-items: center; }
.st-card-intro { margin: -4px 0 12px; }
.st-table th, .st-table td { padding: 10px 14px; }
.st-table th { font-size: 11.5px; }

/* Един екран: изгледът заема височината на прозореца (при обзора main-content е с 20px отгоре и отдолу) */
/* Обзорът тече нормално надолу - собственикът иска скрол, а не натъпкан екран.
   Единственото твърдо правило е да няма хоризонтална лента. */
@media (min-width: 1200px) {
  .st-grid { align-items: start; }
  .st-trend-main { height: 300px; }
  .st-trend-profit { height: 120px; }
}
@media (min-width: 1200px) and (max-width: 1535px) {
  .st-range { display: none; }
  .st-kpi-value { font-size: 22px; }
  .st-spark { width: 72px; }
}

@media (max-width: 1199px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); }
  .st-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .st-head { gap: 10px; }
  .st-title { width: 100%; flex-wrap: wrap; row-gap: 2px; }
  .st-tabs { width: 100%; }
  .st-tabs button { flex: 1; }
  .st-controls { width: 100%; }
  .st-seg { overflow-x: auto; max-width: 100%; }
  .st-kpis { gap: 8px; }
  .st-kpi { padding: 10px 12px; }
  .st-kpi-value { font-size: 19px; }
  .st-kpi-main { flex-direction: column; align-items: flex-start; gap: 4px; }
  .st-spark { width: 100%; height: 26px; }
  .st-kpi-sub { white-space: normal; }
  .st-card { padding: 14px; }
  .st-legend { gap: 10px; }
  .st-trend-main { height: 200px; }
  .st-trend-profit { height: 90px; }
  .st-rank-row { grid-template-columns: minmax(0, 1fr) auto 32px; }
  .st-rank-row .st-rank-track { grid-column: 1 / -1; grid-row: 2; }
  .st-col-bar, .st-table td.st-cell-bar { display: none; }
}

/* Модалът за разход */
.stats-muted { color: var(--on-surface-variant); }
.stats-desc { font-size: var(--text-xs); margin-top: 2px; }
.stats-form-3 { grid-template-columns: 110px 1fr 1fr; }
.stats-exp-preview { min-height: 1.2em; margin: -8px 0 var(--space-md); font-size: var(--text-sm); }
.stats-inline-check { display: inline-flex; align-items: center; gap: var(--space-sm); cursor: pointer; }
.stats-inline-check input { width: 16px; height: 16px; }
#expenseForm .modal-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-md); }
@media (max-width: 768px) {
  .stats-form-3 { grid-template-columns: 1fr 1fr; }
  .stats-form-3 .form-group:first-child { grid-column: 1 / -1; }
}
