/* ================================================================
   1. ROOT VARIABLES
=============================================================== */
:root {
  --primary: #1a237e;
  --primary-light: #283593;
  --secondary: #3498db;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --gray: #95a5a6;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
  --radius: 12px;
  --transition: all 0.3s ease;
  --logo-scale: 1;

  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-dropdown: #ffffff;
  --bg-modal: #ffffff;
  --bg-total: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --border-color: #e0e0e0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --btn-primary: #3498db;
  --btn-primary-hover: #2980b9;
  --btn-success: #27ae60;
  --btn-success-hover: #219653;
  --btn-danger: #e74c3c;
  --btn-danger-hover: #c0392b;
  --btn-warning: #f39c12;
  --btn-warning-hover: #d68910;
  --btn-info: #00acc1;
  --btn-info-hover: #00838f;
  --btn-purple: #9b59b6;
}

/* ================================================================
   2. THEMES
=============================================================== */
[data-theme="light"] {
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-dropdown: #ffffff;
  --bg-modal: #ffffff;
  --bg-total: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --border-color: #e0e0e0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg-body: #0d1117;
  --bg-card: #161b22;
  --bg-header: #161b22;
  --bg-input: #0d1117;
  --bg-hover: #1c2333;
  --bg-dropdown: #161b22;
  --bg-modal: #161b22;
  --bg-total: #1c2333;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --border-color: #30363d;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* ================================================================
   3. COLORS
=============================================================== */
[data-color="blue"] { --btn-primary: #3498db; --btn-primary-hover: #2980b9; }
[data-color="green"] { --btn-primary: #27ae60; --btn-primary-hover: #219653; }
[data-color="red"] { --btn-primary: #e74c3c; --btn-primary-hover: #c0392b; }
[data-color="purple"] { --btn-primary: #9b59b6; --btn-primary-hover: #7d3c98; }
[data-color="orange"] { --btn-primary: #f39c12; --btn-primary-hover: #d68910; }
[data-color="teal"] { --btn-primary: #00acc1; --btn-primary-hover: #00838f; }

/* ================================================================
   4. GLOBAL
=============================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  transition: var(--transition);
  min-height: 150vh;
}

/* ================================================================
   5. CONTAINER
=============================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px;
  transition: transform 0.2s ease, width 0.2s ease;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
  min-height: 150vh;  /* ← ДОБАВИТЬ ЭТУ СТРОЧКУ (или 120vh) */
}


/* ================================================================
   6. HEADER
=============================================================== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-header);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  gap: 10px;
  border: 1px solid var(--border-color);
  min-height: 60px;
  flex-wrap: nowrap;
  width: 100%; /* ← ДОБАВИТЬ */
  box-sizing: border-box; /* ← ДОБАВИТЬ */
  overflow: visible; /* ← ДОБАВИТЬ */
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  padding: 0;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  
  /* ===== ДОБАВЬТЕ ЭТИ СТРОКИ ===== */
  transform: scale(var(--logo-scale, 1));
  transform-origin: left center;
  transition: transform 0.2s ease;
}

.logo .bolt {
  color: #f1c40f;
  flex-shrink: 0;
}

.logo .version {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 2px;
  flex-shrink: 0;
}

.logo .logo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
  font-size: 16px;  /* ← ДОБАВЬТЕ ЭТУ СТРОКУ И УМЕНЬШИТЕ ЗНАЧЕНИЕ */
}
.logo span {
  color: var(--btn-primary);
}
/* ================================================================
   7. USER BLOCK
=============================================================== */
.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-primary);
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.user-role {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ================================================================
   8. BUTTONS
=============================================================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-primary { background: var(--btn-primary); color: white; }
.btn-primary:hover { background: var(--btn-primary-hover); }

.btn-success { background: var(--btn-success); color: white; }
.btn-success:hover { background: var(--btn-success-hover); }

.btn-danger { background: var(--btn-danger); color: white; }
.btn-danger:hover { background: var(--btn-danger-hover); }

.btn-warning { background: var(--btn-warning); color: white; }
.btn-warning:hover { background: var(--btn-warning-hover); }

.btn-info { background: var(--btn-info); color: white; }
.btn-info:hover { background: var(--btn-info-hover); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ================================================================
   9. TABS
=============================================================== */
.tabs {
  display: flex;
  gap: 5px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 14px;
}

.tab-btn:hover {
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--btn-primary);
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ================================================================
   10. CARDS
=============================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

/* ================================================================
   11. TABLE
=============================================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -5px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 700px;
}

thead {
  background: var(--primary);
  color: white;
}

th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}

tr:hover td {
  background: rgba(52, 152, 219, 0.05);
}

/* ================================================================
   12. INPUTS
=============================================================== */
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
  background: var(--bg-input);
  color: var(--text-primary);
}

.form-control:focus {
  border-color: var(--btn-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* ================================================================
   13. MODAL
=============================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--bg-modal);
  border-radius: var(--radius);
  padding: 25px;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--btn-danger);
  transform: rotate(90deg);
}

.modal .form-group {
  margin-bottom: 12px;
}

.modal .form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
}

.modal .form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* ================================================================
   14. NOTIFICATIONS
=============================================================== */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  border-radius: var(--radius);
  color: white;
  font-weight: 500;
  z-index: 99999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  max-width: 400px;
  pointer-events: none;
}

.notification-success { background: var(--btn-success); }
.notification-error { background: var(--btn-danger); }
.notification-warning { background: var(--btn-warning); }
.notification-info { background: var(--btn-info); }

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ================================================================
   15. GLOBAL MODIFIERS PANEL
=============================================================== */
.global-modifiers-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 15px;
  align-items: center;
  border: 1px solid var(--border-color);
}

.global-modifier-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.global-modifier-item label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.global-modifier-item input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.global-modifier-item input[type="text"] {
  width: 150px;
}

/* ================================================================
   16. ESTIMATE TABLE
=============================================================== */
.estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.estimate-table th {
  background: var(--btn-primary);
  color: white;
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.estimate-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.estimate-table input {
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}

.estimate-table .price-input {
  width: 80px;
  text-align: right;
}

.estimate-table .quantity-input {
  width: 60px;
  text-align: center;
}

.estimate-table .total-cell {
  font-weight: 700;
  color: var(--btn-success);
  text-align: right;
  cursor: pointer;
}

.estimate-table .delete-btn {
  background: none;
  border: none;
  color: var(--btn-danger);
  cursor: pointer;
  font-size: 16px;
}

.estimate-table .search-cell {
  position: relative;
}

.estimate-table .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow);
}

.estimate-table .dropdown-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.estimate-table .dropdown-item:hover {
  background: var(--bg-hover);
}

.row-modifiers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

.modifier-badge {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.modifier-badge.coeff {
  background: var(--btn-primary);
  color: white;
}

.modifier-badge.discount {
  background: var(--btn-danger);
  color: white;
}

.modifier-badge.comment {
  background: var(--btn-warning);
  color: white;
}

/* ================================================================
   17. TOTALS
=============================================================== */
.totals {
  padding: 15px;
  background: var(--bg-total);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 15px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.total-row:last-child {
  font-size: 18px;
  font-weight: 700;
  padding-top: 10px;
  border-top: 2px solid var(--border-color);
  margin-top: 5px;
}

.total-value {
  font-weight: 600;
  color: var(--btn-success);
}

/* ================================================================
   18. PRICE LIST
=============================================================== */
.price-section {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.price-section .section-header {
  background: var(--btn-primary);
  color: white;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.price-section .section-header .count {
  background: rgba(255,255,255,0.2);
  padding: 1px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.price-section .section-body {
  display: none;
  padding: 8px 0;
}

.price-section .section-body.open {
  display: block;
}

        .price-item {
            display: grid;
            grid-template-columns: 50px 1fr 60px 80px;
            gap: 8px;
            padding: 8px 10px;
            border-bottom: 1px solid #eee;
            align-items: center;
            transition: background 0.2s;
            cursor: pointer;
            font-size: 0.85rem;
        }

.price-item:hover {
  background: var(--bg-hover);
}

.price-item .item-id {
  font-weight: 700;
  color: var(--btn-primary);
  font-size: 13px;
}

.price-item .item-name {
  font-size: 13px;
}

.price-item .item-unit {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
}

.price-item .item-price {
  text-align: right;
  font-weight: 600;
  color: var(--btn-success);
  font-size: 13px;
}

/* ================================================================
   19. STATUS
=============================================================== */
.status {
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 14px;
}

.status.success {
  background: #d4edda;
  color: #155724;
}

.status.error {
  background: #f8d7da;
  color: #721c24;
}

.status.info {
  background: #d1ecf1;
  color: #0c5460;
}

/* ================================================================
   20. MENU
=============================================================== */

.menu-container {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  margin-left: auto;
  overflow: visible; /* ← ДОБАВИТЬ */
}

.menu-dots {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px 12px;
  line-height: 1;
  transition: var(--transition);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.menu-dots:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 40px;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  min-width: 220px;
  padding: 8px 0;
  z-index: 1000;
}

.menu-dropdown.open {
  display: block;
}

.menu-dropdown .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}

.menu-dropdown .menu-item:hover {
  background: var(--bg-hover);
}

.menu-dropdown .menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 12px;
}

.menu-dropdown .menu-item i {
  width: 20px;
  text-align: center;
  color: var(--btn-primary);
}

/* ================================================================
   21. THEME & COLOR SELECTORS
=============================================================== */
.theme-selector,
.color-selector {
  padding: 6px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.theme-selector .label,
.color-selector .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  width: 100%;
  margin-bottom: 2px;
}

.theme-dot,
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--border-color);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-dot:hover,
.color-dot:hover {
  transform: scale(1.1);
}

.theme-dot.active,
.color-dot.active {
  border-color: var(--btn-primary);
  box-shadow: 0 0 0 2px var(--btn-primary);
}

.theme-dot .check,
.color-dot .check {
  font-size: 14px;
  color: white;
  display: none;
}

.theme-dot.active .check,
.color-dot.active .check {
  display: block;
}

/* ================================================================
   22. PRINT / PDF
=============================================================== */
.print-section {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
  border-left: 3px solid var(--btn-primary);
  background: var(--bg-card);
}

.print-section h4 {
  font-size: 14px;
  margin: 0 0 6px 0;
  color: var(--text-primary);
}

.print-section input,
.print-section textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}

.print-section textarea {
  min-height: 50px;
  resize: vertical;
}

.print-section .logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.print-section .logo-area img {
  max-height: 60px;
  max-width: 120px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px;
  background: white;
}

.print-section .logo-area input[type="file"] {
  padding: 4px;
  font-size: 12px;
  width: auto;
}

.print-preview-container {
  background: var(--bg-body);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.print-preview-content {
  background: white;
  padding: 20px;
  border-radius: 4px;
  color: #333;
  font-family: Arial, sans-serif;
  font-size: 12px;
  max-width: 210mm;
  margin: 0 auto;
}

.print-preview-content .header-preview {
  text-align: center;
  padding: 10px 0;
  border-bottom: 2px solid #1a237e;
  margin-bottom: 15px;
}

.print-preview-content .header-preview h1 {
  color: #1a237e;
  margin: 0;
  font-size: 22px;
}

.print-preview-content .header-preview .date {
  color: #666;
  font-size: 14px;
}

.print-preview-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 10px 0;
}

.print-preview-content table th {
  background: #1a237e;
  color: white;
  padding: 6px;
  text-align: left;
}

.print-preview-content table td {
  padding: 4px 6px;
  border-bottom: 1px solid #ddd;
}

/* ================================================================
   23. SCROLLBAR
=============================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--btn-primary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ================================================================
   24. BADGES
=============================================================== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(39, 174, 96, 0.2);
  color: var(--btn-success);
}

.badge-danger {
  background: rgba(231, 76, 60, 0.2);
  color: var(--btn-danger);
}

.badge-warning {
  background: rgba(243, 156, 18, 0.2);
  color: var(--btn-warning);
}

/* ================================================================
   25. LOADING
=============================================================== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-top-color: var(--btn-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================================================
   26. THEME TOGGLE
=============================================================== */
.theme-toggle {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: rotate(30deg);
}

/* ================================================================
   27. ZOOM CONTROLS
=============================================================== */
.zoom-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.zoom-controls .zoom-btn,
.zoom-controls .zoom-reset {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  font-size: 14px;
}

.zoom-controls .zoom-btn:hover,
.zoom-controls .zoom-reset:hover {
  background: var(--bg-hover);
}

/* ================================================================
   28. SETTINGS MODAL (SLIDERS)
=============================================================== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  transition: background 0.2s ease;
  width: 100%;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Цвета для слайдеров */
#logoSizeSlider::-webkit-slider-thumb { background: var(--btn-primary); }
#tableSizeSlider::-webkit-slider-thumb { background: var(--btn-success); }
#priceSizeSlider::-webkit-slider-thumb { background: var(--btn-warning); }
#buttonSizeSlider::-webkit-slider-thumb { background: var(--btn-danger); }
#modalSizeSlider::-webkit-slider-thumb { background: var(--btn-info); }
#scaleSlider::-webkit-slider-thumb { background: var(--btn-purple); }

#logoSizeSlider::-moz-range-thumb { background: var(--btn-primary); }
#tableSizeSlider::-moz-range-thumb { background: var(--btn-success); }
#priceSizeSlider::-moz-range-thumb { background: var(--btn-warning); }
#buttonSizeSlider::-moz-range-thumb { background: var(--btn-danger); }
#modalSizeSlider::-moz-range-thumb { background: var(--btn-info); }
#scaleSlider::-moz-range-thumb { background: var(--btn-purple); }

/* ================================================================
   29. SHARE LINK BOX
=============================================================== */
.share-link-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.share-link-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}

.share-link-box input:focus {
  outline: none;
  border-color: var(--btn-primary);
}

/* ================================================================
   30. SETTINGS TABS
=============================================================== */
.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.settings-tab {
  padding: 6px 14px;
  border: none;
  background: var(--bg-card);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  color: var(--text-secondary);
}

.settings-tab.active {
  background: var(--btn-primary);
  color: white;
}

.settings-content {
  display: none;
}

.settings-content.active {
  display: block;
}

/* ================================================================
   31. HIDDEN UTILITY
=============================================================== */
.hidden {
  display: none !important;
}


/* ================================================================
   33. PRINT STYLES
=============================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .header {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: white !important;
  }

  .menu-container,
  .menu-dots,
  .menu-dropdown,
  .tabs,
  .btn,
  .global-panel,
  #zoomIn,
  #zoomOut,
  #zoomReset,
  .zoomPercent,
  .controls {
    display: none !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: white !important;
    padding: 10px !important;
  }

  .estimate-table {
    font-size: 10px !important;
    min-width: auto !important;
  }

  .estimate-table th {
    background: #1a237e !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .estimate-table td {
    border-bottom: 1px solid #ddd !important;
  }

  .estimate-table input {
    border: none !important;
    background: transparent !important;
    color: black !important;
  }

  .totals {
    background: #f8f9fa !important;
    border: 1px solid #ddd !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .modal {
    display: none !important;
  }

  .modal.open {
    display: none !important;
  }

  .print-preview-container {
    max-height: none !important;
    overflow: visible !important;
  }

  .print-preview-content {
    background: white !important;
    color: black !important;
  }

  /* Разрывы страниц */
  .page-break {
    page-break-before: always;
  }

  .page-break-after {
    page-break-after: always;
  }

  /* Запрещаем разрыв внутри таблицы */
  table {
    page-break-inside: avoid;
  }

  /* Шапка таблицы на каждой странице */
  thead {
    display: table-header-group;
  }

  /* Запрещаем разрыв внутри строки */
  tr {
    page-break-inside: avoid;
  }
}
@media print {
  /* Отступ снизу первой страницы */
  .print-container > div:first-child {
    padding-bottom: 50px !important;
    margin-bottom: 30px !important;
    border-bottom: 2px dashed #ccc !important;
  }

  /* Отступ сверху второй страницы */
  .print-container > div:last-child {
    padding-top: 30px !important;
    margin-top: 10px !important;
  }

  /* Стиль для сообщения о продолжении */
  .print-container > div:first-child div:last-child {
    margin-top: 30px !important;
    padding-top: 15px !important;
    border-top: 2px dashed #999 !important;
    font-size: 11px !important;
    color: #666 !important;
    text-align: center !important;
    letter-spacing: 2px !important;
    font-weight: 600 !important;
  }
}
/* ================================================================
   32. АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ
=============================================================== */
@media (max-width: 768px) {
  .container {
    padding: 8px;
  }

  .header {
    padding: 6px 10px;
    min-height: 48px;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .logo {
    font-size: 13px;
    gap: 3px;
    flex: 1;
    min-width: 0;
    max-width: 65%;
  }

  .logo .logo-text {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
  }

  .logo .bolt {
    font-size: 12px;
  }

  .logo .version {
    font-size: 9px;
    margin-left: 2px;
  }

  .menu-dots {
    font-size: 20px;
    padding: 4px 8px;
    min-width: 36px;
    min-height: 36px;
  }

  /* ===== ВЫПАДАЮЩЕЕ МЕНЮ НА МОБИЛЬНЫХ ===== */
  .menu-dropdown {
    right: -5px;
    min-width: 200px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .menu-dropdown .menu-item {
    padding: 10px 14px;
    font-size: 13px;
  }

  .menu-dropdown .menu-item i {
    width: 18px;
    font-size: 14px;
  }
              .price-item {
                grid-template-columns: 35px minmax(100px, 1fr) 45px 60px;
                gap: 6px;
                padding: 6px 8px;
                font-size: 0.8rem;
            }
            
            .item-number {
                font-size: 0.8rem;
            }
            
            .item-name {
                font-size: 0.8rem;
            }
            
            .item-unit {
                font-size: 0.75rem;
            }
            
            .item-price {
                font-size: 0.8rem;
            }
}
        @media (max-width: 480px) {
            .price-item {
                grid-template-columns: 35px 1fr 35px 60px;
                gap: 4px;
                padding: 5px 6px;
                font-size: 0.75rem;
            }
            
            .tab {
                padding: 8px 10px;
                font-size: 0.85rem;
            }
            
            .btn {
                padding: 6px 10px;
                font-size: 0.8rem;
            }
        }
@media (max-width: 480px) {
    .container {
    padding: 2;
  }

  .header {
    padding: 4px 6px;
    min-height: 36px;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
  }

  .logo {
    font-size: 9px;
    gap: 2px;
    max-width: 50%;
    flex: 0 1 auto;
  }

  .logo .logo-text {
    font-size: 12px;
    max-width: 280px;
    text-align: left !important;
  }

  .logo .bolt {
    font-size: 12px;
  }

  .logo .version {
    font-size: 12px;
  }

  .menu-container {
    flex-shrink: 0;
    margin-left: auto;
    overflow: visible;
  }

  .menu-dots {
    font-size: 14px;
    padding: 2px 4px;
    min-width: 28px;
    min-height: 28px;
  }

  .menu-dropdown {
    right: -5px;
    min-width: 150px;
  }

  .menu-dropdown .menu-item {
    padding: 6px 8px;
    font-size: 11px;
  }

  .menu-dropdown .menu-item i {
    width: 14px;
    font-size: 11px;
  }
}
@media (max-width: 380px) {
  .header {
    padding: 2px 4px;
    min-height: 32px;
    gap: 0px;
  }

  .logo {
    font-size: 8px;
    max-width: 40%;
  }

  .logo .logo-text {
    font-size: 8px;
    max-width: 220px;
  }

  .logo .bolt {
    font-size: 8px;
  }

  .logo .version {
    font-size: 6px;
  }

  .menu-dots {
    font-size: 12px;
    padding: 1px 3px;
    min-width: 24px;
    min-height: 24px;
  }

  .menu-dropdown {
    right: -2px;
    min-width: 130px;
  }

  .menu-dropdown .menu-item {
    padding: 4px 6px;
    font-size: 10px;
  }

  .menu-dropdown .menu-item i {
    width: 12px;
    font-size: 10px;
  }
}
/* ================================================================
   ДЛЯ БОЛЬШИХ ТЕЛЕФОНОВ (Samsung S26 Ultra и др.)
=============================================================== */
@media (min-width: 401px) and (max-width: 768px) {
  .logo {
    font-size: 14px !important;
    gap: 4px !important;
    max-width: 70% !important;
  }
  
  .logo .logo-text {
    font-size: 12px !important;
    max-width: 280px !important;
  }
  
  .logo .bolt {
    font-size: 12px !important;
  }
  
  .logo .version {
    font-size: 12px !important;
  }
}

/* ================================================================
   АДАПТАЦИЯ ЛОГОТИПА В ЗАВИСИМОСТИ ОТ ЭКРАНА (CSS переменные)
=============================================================== */

@media (min-width: 481px) and (max-width: 768px) {
  :root {
    --logo-scale: 0.75;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --logo-scale: 0.85;
  }
}

@media (min-width: 1025px) {
  :root {
    --logo-scale: 1;
  }
}
/* ===== ФИКС ДЛЯ МЕНЮ НА ТЕЛЕФОНАХ ===== */
@media (max-width: 480px) {
  /* Фикс: делаем меню фиксированным, чтобы оно не обрезалось */
  .menu-dropdown {
    position: fixed !important;
    right: 10px !important;
    top: 50px !important;
    min-width: 180px !important;
    z-index: 99999 !important;
  }
  
  /* Убеждаемся, что контейнер не обрезает содержимое */
  .header {
    overflow: visible !important;
  }
  
  .menu-container {
    overflow: visible !important;
  }
}

/* ===== ФИКС ДЛЯ МЕНЮ НА ТЕЛЕФОНАХ ===== */
@media (max-width: 480px) {
  /* Фикс: делаем меню фиксированным, чтобы оно не обрезалось */
  .menu-dropdown {
    position: fixed !important;
    right: 10px !important;
    top: 50px !important;
    min-width: 180px !important;
    z-index: 99999 !important;
  }
  
  /* Убеждаемся, что контейнер не обрезает содержимое */
  .header {
    overflow: visible !important;
  }
  
  .menu-container {
    overflow: visible !important;
  }
}

/* Для всех мобильных */
@media (max-width: 768px) {
  .menu-dropdown {
    position: fixed !important;
    right: 10px !important;
    top: 55px !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
  }
}
/* ================================================================
   ИСПРАВЛЕНИЕ ДЛЯ МЕНЮ НА МОБИЛЬНЫХ
=============================================================== */

/* Для всех экранов до 768px */
@media (max-width: 768px) {
  .header {
    padding: 1px 2px !important; /* Добавляем отступы справа и слева */
    gap: 1px !important;
  }
  
  .logo {
    flex: 1 1 auto !important;     /* Позволяем сжиматься */
    min-width: 0 !important;
    max-width: calc(100% - 60px) !important; /* Оставляем место для кнопки (≈60px) */
    font-size: 12px !important;
  }
  
  .logo .logo-text {
    max-width: 500px !important;   /* Ограничиваем ширину текста */
    font-size: 14px !important;
  }
  
  .menu-container {
    flex: 0 0 auto !important;    /* Кнопка не сжимается */
    margin-left: auto !important;
    overflow: visible !important;
  }
  
  .menu-dots {
    padding: 4px 8px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    font-size: 22px !important;
  }
}

/* Для экранов уже 480px и меньше (самые маленькие) */
@media (max-width: 480px) {
  .header {
    padding: 1px 2px !important;
    gap: 2px !important;
  }
  
  .logo {
    max-width: calc(100% - 50px) !important;
    font-size: 9px !important;
  }
  
  .logo .logo-text {
    max-width: 280px !important;
    font-size: 12px !important;
  }
  
  .logo .bolt {
    font-size: 11px !important;
  }
  
  .menu-dots {
    padding: 2px 4px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    font-size: 18px !important;
  }
  
  /* Меню-выпадашка – фиксированное положение, чтобы не зависеть от контейнера */
  .menu-dropdown {
    position: fixed !important;
    right: 8px !important;
    top: 40px !important;
    min-width: 160px !important;
    max-width: 90vw !important;
    z-index: 99999 !important;
  }
}

/* Дополнительно: убираем возможное обрезание */
.container,
.header,
.menu-container {
  overflow: visible !important;
}
/* ===== РАСТЯГИВАЕМ КАТЕГОРИИ ПРАЙС-ЛИСТА ===== */

/* Убираем внешние отступы у секций */
.price-section {
  margin-left: 0 !important;
  margin-right: 0 !important;
  border-radius: 0 !important;  /* убираем скругление, чтобы было от края до края */
}

/* Убираем отступы у заголовка секции */
.price-section .section-header {
  padding: 10px 12px !important;  /* уменьшаем отступы */
  margin: 0 !important;
}

/* Убираем отступы у тела секции */
.price-section .section-body {
  padding: 0 !important;
}

/* Растягиваем строки товаров на всю ширину */
.price-item {
  grid-template-columns: 40px 1fr 50px 80px !important;  /* меняем ширину колонок */
  gap: 6px !important;
  padding: 6px 10px !important;  /* уменьшаем отступы */
  margin: 0 !important;
  width: 100% !important;
}

/* Для мобильных - ещё меньше отступов */
@media (max-width: 768px) {
  .price-section .section-header {
    padding: 8px 8px !important;
    font-size: 13px !important;
  }
  
  .price-item {
    grid-template-columns: 30px 1fr 30px 60px !important;
    gap: 4px !important;
    padding: 5px 6px !important;
    font-size: 12px !important;
  }
  
  .price-item .item-id {
    font-size: 11px !important;
  }
  
  .price-item .item-name {
    font-size: 11px !important;
  /*   white-space: nowrap !important;  запрещаем перенос */
    overflow: hidden !important;
    text-overflow: ellipsis !important;  /* обрезаем с троеточием */
  }
  
  .price-item .item-unit {
    font-size: 11px !important;
  }
  
  .price-item .item-price {
    font-size: 11px !important;
  }
}

/* Для самых маленьких экранов */
@media (max-width: 480px) {
  .price-section .section-header {
    padding: 6px 4px !important;
    font-size: 11px !important;
  }
  
  .price-item {
    grid-template-columns: 20px 1fr 20px 50px !important;
    gap: 2px !important;
    font-size: 10px !important;
  }
  
  .price-item .item-id {
    font-size: 11px !important;
  }
  
  .price-item .item-name {
    font-size: 10px !important;
    max-width: 250px !important;
  }
  
  .price-item .item-unit {
    font-size: 10px !important;
  }
  
  .price-item .item-price {
    font-size: 10px !important;
  }
}
/* ===== УВЕЛИЧИВАЕМ ВЫСОТУ СТРОК В ПРАЙС-ЛИСТЕ ===== */

/* Основной размер */
.price-item {
  padding: 10px 12px !important;  /* увеличили отступы сверху/снизу */
  min-height: 52px !important;    /* минимальная высота строки */
}

/* Название - 2 строки */
.price-item .item-name {
  line-height: 1.4 !important;    /* увеличили межстрочный интервал */
  max-height: calc(1.4em * 2.2) !important;  /* место для 2 строк + запас */
}

/* Для планшетов */
@media (max-width: 768px) {
  .price-item {
    padding: 8px 10px !important;
    min-height: 46px !important;
  }
  .price-item .item-name {
    font-size: 12px !important;
    line-height: 1.4 !important;
    max-height: calc(1.4em * 2.2) !important;
  }
}

/* Для телефонов */
@media (max-width: 480px) {
  .price-item {
    padding: 8px 8px !important;
    min-height: 42px !important;
  }
  .price-item .item-name {
    font-size: 11px !important;
    line-height: 1.3 !important;
    max-height: calc(1.3em * 2.2) !important;
  }
}
/* ================================================================
   СМЕТА - УМЕНЬШЕННЫЕ ОТСТУПЫ И ШИРИНА
=============================================================== */

/* Основная таблица */
.estimate-table {
  font-size: 12px !important;
  min-width: auto !important;
}

/* Заголовки - УМЕНЬШИЛИ отступы */
.estimate-table th {
  padding: 6px 4px !important;   /* было 10px 8px → уменьшили */
  font-size: 12px !important;    /* было 14px → уменьшили */
  white-space: nowrap !important;
}

/* Ячейки - УМЕНЬШИЛИ отступы */
.estimate-table td {
  padding: 4px 3px !important;   /* было 8px 6px → уменьшили */
  vertical-align: middle !important;
}

/* Поля ввода - УМЕНЬШИЛИ */
.estimate-table input {
  padding: 3px 4px !important;   /* было 6px 8px → уменьшили */
  font-size: 12px !important;    /* было 14px → уменьшили */
  border-radius: 4px !important;
}

/* Цена - УМЕНЬШИЛИ ширину */
.estimate-table .price-input {
  width: 65px !important;        /* было 90px → уменьшили */
  text-align: right !important;
}

/* Количество - УМЕНЬШИЛИ ширину */
.estimate-table .quantity-input {
  width: 45px !important;        /* было 70px → уменьшили */
  text-align: center !important;
}

/* Итоговая сумма - УМЕНЬШИЛИ */
.estimate-table .total-cell {
  font-size: 13px !important;    /* было 15px → уменьшили */
  padding: 4px 6px !important;   /* было 8px 10px → уменьшили */
}

/* Кнопка удалить - УМЕНЬШИЛИ */
.estimate-table .delete-btn {
  font-size: 14px !important;    /* было 18px → уменьшили */
  padding: 2px 4px !important;
}

/* Высота строки - УМЕНЬШИЛИ */
.estimate-table tr {
  height: 32px !important;       /* было 48px → уменьшили */
}

/* ===== ДЛЯ КАЖДОЙ КОЛОНКИ ОТДЕЛЬНО ===== */

.estimate-table {
  table-layout: fixed !important;  /* ← ГЛАВНОЕ! Фиксирует ширину колонок */
  width: 100% !important;
  min-width: 500px !important;
}

/* Ширина каждой колонки */
.estimate-table th:nth-child(1),
.estimate-table td:nth-child(1) {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(2),
.estimate-table td:nth-child(2) {
  width: auto !important;  /* Наименование — занимает всё оставшееся место */
  min-width: 100px !important;
}

.estimate-table th:nth-child(3),
.estimate-table td:nth-child(3) {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(4),
.estimate-table td:nth-child(4) {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  text-align: right !important;
}

.estimate-table th:nth-child(5),
.estimate-table td:nth-child(5) {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(6),
.estimate-table td:nth-child(6) {
  width: 80px !important;
  min-width: 80px !important;
  max-width: 80px !important;
  text-align: right !important;
}

.estimate-table th:nth-child(7),
.estimate-table td:nth-child(7) {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  text-align: center !important;
}

/* Поля ввода — занимают всю ширину ячейки */
.estimate-table .price-input,
.estimate-table .quantity-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Убираем лишние отступы */
.estimate-table th,
.estimate-table td {
  padding: 4px 3px !important;
  overflow: hidden !important;      /* ← текст не вылезает */
  white-space: nowrap !important;   /* ← текст в одну строку */
  text-overflow: ellipsis !important; /* ← если не влазит, появляется ... */
}
@media (max-width: 768px) {
  .estimate-table td:nth-child(3),
  .estimate-table th:nth-child(3) {
    width: 40px !important;
    min-width: 40px !important;
    padding: 3px 1px !important;   /* ← убрали padding-right */
  }
  .estimate-table td:nth-child(4),
  .estimate-table th:nth-child(4) {
    width: 50px !important;
    min-width: 50px !important;
    padding: 3px 1px !important;   /* ← убрали padding-left */
  }
  .estimate-table td:nth-child(5),
  .estimate-table th:nth-child(5) {
    width: 40px !important;
    min-width: 40px !important;
    padding: 3px 1px !important;
}
}

@media (max-width: 480px) {
	.estimate-table {
  font-size: 9px !important;
  table-layout: fixed !important;  /* ← ГЛАВНОЕ! Фиксирует ширину колонок */
  width: 100% !important;
  min-width: 400px !important;
}
/* Ширина каждой колонки */
.estimate-table th:nth-child(1),
.estimate-table td:nth-child(1) {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(2),
.estimate-table td:nth-child(2) {
  width: auto !important;  /* Наименование — занимает всё оставшееся место */
  min-width: 100px !important;
}

.estimate-table th:nth-child(3),
.estimate-table td:nth-child(3) {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(4),
.estimate-table td:nth-child(4) {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  text-align: right !important;
}

.estimate-table th:nth-child(5),
.estimate-table td:nth-child(5) {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  text-align: center !important;
}

.estimate-table th:nth-child(6),
.estimate-table td:nth-child(6) {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  text-align: right !important;
}

.estimate-table th:nth-child(7),
.estimate-table td:nth-child(7) {
  width: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  text-align: center !important;
}
}

@media (max-width: 480px) {
  .estimate-table th {
    padding: 3px 1px !important;
    font-size: 8px !important;
  }
  .estimate-table td {
    padding: 2px 1px !important;
  }
  .estimate-table input {
    padding: 1px 2px !important;
    font-size: 8px !important;
  }
  .estimate-table .price-input {
    width: 35px !important;
  }
  .estimate-table .quantity-input {
    width: 30px !important;
  }
  .estimate-table .total-cell {
    font-size: 9px !important;
    padding: 2px 3px !important;
  }
  .estimate-table .delete-btn {
    font-size: 10px !important;
  }
  .estimate-table tr {
    height: 24px !important;
  }
  
  .table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}
}
/* ===== ФИКС ДЛЯ ВЫПАДАЮЩЕГО СПИСКА В СМЕТЕ ===== */
.search-cell {
  position: relative !important;
  overflow: visible !important;
  max-height: 60px !important;
  min-width: 40px !important;
}

.estimate-table .dropdown {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important;
  background: var(--bg-dropdown, #ffffff) !important;
  border: 1px solid var(--border-color, #ccc) !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2) !important;
  max-height: 250px !important;
  overflow-y: auto !important;
  min-width: 200px !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  display: block !important;  /* ← ДОБАВЛЯЕМ, чтобы переопределить display: none */
}

.estimate-table .dropdown-item {
  padding: 8px 12px !important;
  cursor: pointer !important;
  border-bottom: 1px solid var(--border-color, #eee) !important;
  font-size: 13px !important;
  transition: background 0.15s !important;
  color: var(--text-primary, #333) !important;
}

.estimate-table .dropdown-item:hover {
  background: var(--bg-hover, #f0f0f0) !important;
}

.estimate-table .dropdown-item:last-child {
  border-bottom: none !important;
}

/* Для мобильных */
@media (max-width: 768px) {
  .estimate-table .dropdown {
    max-height: 180px !important;
    min-width: 150px !important;
  }
  .estimate-table .dropdown-item {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }
}
/* ================================================================
   ГАРАНТИРОВАННЫЙ ФИКС ДЛЯ ВЫПАДАЮЩЕГО СПИСКА (ПОСЛЕДНИЙ)
=============================================================== */

.search-cell {
  position: relative !important;
  overflow: visible !important;
}

.estimate-table .dropdown {
  display: none !important;  /* по умолчанию скрыт */
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999999 !important;
  background: #ffffff !important;
  border: 2px solid #3498db !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
  max-height: 250px !important;
  overflow-y: auto !important;
  min-width: 200px !important;
  padding: 4px 0 !important;
  margin: 0 !important;
}

/* Когда дропдаун открыт — добавляем класс JS */
.estimate-table .dropdown.open {
  display: block !important;
}

.estimate-table .dropdown-item {
  padding: 8px 12px !important;
  cursor: pointer !important;
  border-bottom: 1px solid #eee !important;
  font-size: 13px !important;
  transition: background 0.15s !important;
  color: #333 !important;
  background: #ffffff !important;
}

.estimate-table .dropdown-item:hover {
  background: #f0f0f0 !important;
}

.estimate-table .dropdown-item:last-child {
  border-bottom: none !important;
}
/* ================================================================
   ОКОНЧАТЕЛЬНЫЙ ФИКС ДЛЯ ДРОПДАУНА В СМЕТЕ
=============================================================== */

/* Убираем обрезание у родителя */
.estimate-table .search-cell {
  position: relative !important;
  overflow: visible !important;  /* ← ГЛАВНОЕ! */
}

/* Дропдаун — всегда видим, когда открыт */
.estimate-table .dropdown {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999999 !important;
  background: #ffffff !important;
  border: 2px solid #3498db !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
  max-height: 250px !important;
  overflow-y: auto !important;
  min-width: 200px !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  display: none !important;  /* скрыт по умолчанию */
}

/* Когда открыт — показываем */
.estimate-table .dropdown.open {
  display: block !important;
}

.estimate-table .dropdown-item {
  padding: 8px 12px !important;
  cursor: pointer !important;
  border-bottom: 1px solid #eee !important;
  font-size: 13px !important;
  transition: background 0.15s !important;
  color: #333 !important;
  background: #ffffff !important;
}

.estimate-table .dropdown-item:hover {
  background: #f0f0f0 !important;
}

.estimate-table .dropdown-item:last-child {
  border-bottom: none !important;
}
/* ===== ФИКС ДЛЯ ДРОПДАУНА ===== */
.estimate-table .search-cell {
  position: relative !important;
  overflow: visible !important;
}

.estimate-table .dropdown {
  display: none !important;
}

.estimate-table .dropdown[style*="display: block"] {
  display: block !important;
}

.estimate-table .dropdown-item {
  padding: 8px 12px !important;
  cursor: pointer !important;
  border-bottom: 1px solid #eee !important;
  background: white !important;
}

.estimate-table .dropdown-item:hover {
  background: #f0f0f0 !important;
}
/* ===== РАСТЯГИВАНИЕ КАТЕГОРИЙ С ОТСТУПАМИ 5% ===== */
@media (max-width: 768px) {
  /* Отступы 5% с каждой стороны */
  .container {
    padding: 0 2% !important;   /* ← 5% отступы слева и справа */
    max-width: 100% !important;
  }
  
  /* Убираем скругление и отступы у карточки */
  .card {
    padding: 10px 0 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Убираем отступы у секций */
  .price-section {
    margin: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
  
  /* Убираем отступы у заголовка */
  .price-section .section-header {
    padding: 10px 8px !important;
    margin: 0 !important;
  }
  
  /* Убираем отступы у строк товаров */
  .price-item {
    padding: 6px 8px !important;
    margin: 0 !important;
    width: 100% !important;
    gap: 6px !important;
  }
}
/* ================================================================
   ГЛОБАЛЬНАЯ ПАНЕЛЬ
=============================================================== */
.global-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-total);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    align-items: center;
    justify-content: space-between;
}

/* ЗУМ */
.global-zoom {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.global-zoom .btn {
    padding: 4px 8px;
    font-size: 13px;
    min-width: 30px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.global-zoom .btn:hover {
    background: var(--bg-hover);
}

/* НАСТРОЙКИ */
.global-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    align-items: center;
    justify-content: flex-start;
}

.global-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex: 0 1 auto;
    min-width: 100px;
    transition: border-color 0.2s;
}

.global-item:hover {
    border-color: var(--btn-primary);
}

.global-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.global-item label i {
    font-size: 13px;
}

.global-item input {
    border: none;
    background: transparent;
    padding: 4px 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    width: 60px;
    outline: none;
    text-align: center;
}

.global-item input:focus {
    outline: 2px solid var(--btn-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.global-item input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
}

/* Отдельные размеры для полей */
.global-discount input {
    width: 50px;
    color: #e74c3c;
}

.global-coeff input {
    width: 55px;
    color: #3498db;
}

.global-comment input {
    width: 140px;
    font-weight: 400;
    text-align: left;
    color: var(--text-secondary);
}

.global-comment {
    flex: 1 1 180px;
    min-width: 140px;
}

.global-comment input {
    width: 100%;
    font-weight: 400;
    text-align: left;
    color: var(--text-secondary);
}

/* ===== АДАПТАЦИЯ ДЛЯ ТЕЛЕФОНОВ ===== */
@media (max-width: 768px) {
    .global-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }
    
    .global-zoom {
        justify-content: flex-start;
        padding: 6px 12px;
        align-self: flex-start;
        width: 100%;
        max-width: 180px;
    }
    
    .global-settings {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
    }
    
    .global-item {
        flex: 0 1 auto;
        min-width: 0;
        padding: 4px 8px;
    }
    
    .global-item label {
        font-size: 10px;
        white-space: nowrap;
    }
    
    .global-item input {
        font-size: 12px;
        width: 40px;
        padding: 2px 4px;
    }
    
    .global-discount input {
        width: 35px;
    }
    
    .global-coeff input {
        width: 38px;
    }
    
    .global-comment {
        flex: 0 1 100%;
        min-width: 0;
        margin-top: 2px;
    }
    
    .global-comment input {
        width: 100%;
        min-width: 0;
        font-size: 12px;
        text-align: left;
    }
}

@media (max-width: 480px) {
    /* Создаем четкую сетку из 3 колонок: первые две по размеру контента, третья забирает остаток */
    .global-panel {
        display: grid !important;
        grid-template-columns: max-content max-content 1fr !important;
        /* Явно задаем карту расположения элементов (2 строки) */
        grid-template-areas: 
            "zoom discount ."
            "coeff comment ." !important;
        gap: 6px 8px !important;
        padding: 6px 8px !important;
    }
    
    /* Полностью нейтрализуем промежуточный контейнер */
    .global-settings {
        display: contents !important; 
    }

    /* === СТРОКА 1 === */
    .global-zoom {
        grid-area: zoom !important; /* Встает строго на место 'zoom' */
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
        padding: 2px 8px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 6px !important;
        background: var(--bg-card) !important;
        width: max-content !important;
    }
    
    .global-zoom span {
        font-size: 11px !important;
        min-width: 28px !important;
        text-align: center !important;
        font-weight: 600 !important;
    }
    
    .global-zoom .btn {
        padding: 2px 5px !important;
        font-size: 11px !important;
        min-width: 24px !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
        border-radius: 4px !important;
    }
    
    .global-zoom .btn:hover {
        background: var(--bg-hover) !important;
    }
    
    .global-discount {
        grid-area: discount !important; /* Встает строго на место 'discount' */
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 2px 6px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 6px !important;
        background: var(--bg-card) !important;
        width: max-content !important;
    }
    
    .global-discount label {
        font-size: 9px !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }
    
    .global-discount input {
        width: 40px !important;
        font-size: 11px !important;
        padding: 1px 3px !important;
        border: none !important;
        background: transparent !important;
        text-align: center !important;
    }

    /* === СТРОКА 2 === */
    .global-coeff {
        grid-area: coeff !important; /* Встает строго на место 'coeff' (под зум) */
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 2px 6px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 6px !important;
        background: var(--bg-card) !important;
        width: max-content !important;
    }
    
    .global-coeff label {
        font-size: 9px !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }
    
    .global-coeff input {
        width: 40px !important;
        font-size: 11px !important;
        padding: 1px 3px !important;
        border: none !important;
        background: transparent !important;
        text-align: center !important;
    }
    
    .global-comment {
        grid-area: comment !important; /* Встает строго на место 'comment' (под скидку) */
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 2px 6px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 6px !important;
        background: var(--bg-card) !important;
        width: max-content !important;
    }
    
    .global-comment label {
        font-size: 9px !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }
    
    .global-comment input {
        width: 130px !important;
        font-size: 11px !important;
        padding: 1px 3px !important;
        border: none !important;
        background: transparent !important;
        text-align: left;
    }
}
/* ================================================================
   ФИКС: МЕНЮ НЕ РАЗДВИГАЕТ КОНТЕЙНЕР
=============================================================== */


/* 3. ВЫПАДАЮЩЕЕ МЕНЮ — ПОЛНОСТЬЮ ВНЕ ПОТОКА */
.menu-dropdown {
    display: none !important;
    position: absolute !important;
    right: 0 !important;
    top: calc(100% + 2px) !important;  /* ← СРАЗУ ПОД КНОПКОЙ */
    background: var(--bg-dropdown, #ffffff) !important;
    border: 1px solid var(--border-color, #ddd) !important;
    border-radius: var(--radius, 12px) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
    min-width: 200px !important;
    max-width: 90vw !important;
    padding: 8px 0 !important;
    z-index: 9999999 !important;
    /* ← НЕ ВЛИЯЕТ НА РОДИТЕЛЯ */
    pointer-events: auto !important;
}

/* 4. ОТКРЫТОЕ МЕНЮ */
.menu-dropdown.open,
.menu-dropdown.active {
    display: block !important;
}

/* 5. ХЕДЕР — ФИКСИРОВАННАЯ ВЫСОТА */
.header {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 8px 16px !important;    /* ← ФИКСИРОВАННЫЙ ПАДДИНГ */
    min-height: 60px !important;     /* ← ФИКСИРОВАННАЯ ВЫСОТА */
    height: auto !important;         /* ← АВТО, НО НЕ МЕНЬШЕ min-height */
    overflow: visible !important;    /* ← НЕ ОБРЕЗАЕМ */
    position: relative !important;
    z-index: 99999 !important;
    box-sizing: border-box !important;
}

/* 6. КОНТЕЙНЕР — НЕ ОБРЕЗАЕТ */
.container {
    overflow: visible !important;
    position: relative !important;
    z-index: 9999 !important;
}

/* ===== ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 768px) {
    .header {
        min-height: 48px !important;
        padding: 4px 10px !important;
    }
    
    .menu-dots,
    button.menu-dots {
        font-size: 22px !important;
        padding: 2px 8px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        height: 36px !important;
    }
    
    .menu-dropdown {
        min-width: 160px !important;
        right: 0 !important;
        top: calc(100% + 2px) !important;
    }
}

@media (max-width: 480px) {
    .header {
        min-height: 36px !important;
        padding: 2px 6px !important;
    }
    
    .menu-dots,
    button.menu-dots {
        font-size: 18px !important;
        padding: 0px 4px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        height: 28px !important;
    }
    
    .menu-dropdown {
        min-width: 140px !important;
        right: 0 !important;
        top: calc(100% + 2px) !important;
        max-width: 90vw !important;
    }
}

/* ===== НАДЁЖНЫЙ СПОСОБ: ИСПОЛЬЗОВАТЬ position: fixed ДЛЯ МЕНЮ ===== */
/* Раскомментируйте, если position: absolute всё ещё раздвигает */

/*
.menu-dropdown.open,
.menu-dropdown.active {
    position: fixed !important;
    top: 50px !important;
    right: 10px !important;
    z-index: 9999999 !important;
    min-width: 200px !important;
    max-width: 90vw !important;
}
*/
    .pwa-install-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 99999;
        display: flex;
        align-items: center;
        gap: 10px;
        animation: slideInUp 0.5s ease-out;
    }
    
    @keyframes slideInUp {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .install-btn {
        background: linear-gradient(135deg, #f7971e, #ff6b6b);
        color: white;
        border: none;
        padding: 15px 25px;
        border-radius: 25px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        display: flex;
        align-items: center;
        gap: 10px;
        transition: all 0.3s ease;
    }
    
    .install-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    }
    
    .install-icon {
        font-size: 20px;
    }
    
    .close-install-btn {
        background: #f0f0f0;
        color: #666;
        border: none;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        cursor: pointer;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }
    
    .close-install-btn:hover {
        background: #e0e0e0;
        transform: scale(1.1);
    }
	@media (max-width: 768px) {
  .container {
    min-height: 140vh !important;
  }
}

/* Для маленьких телефонов */
@media (max-width: 480px) {
  .container {
    min-height: 160vh !important;
  }
}