/* ==============================================================================
   ГБУ «Жилищник» — Фирменные стили Telegram Mini App
   Поддержка: Светлая и Тёмная темы (мягкий контраст, увеличенный шрифт)
============================================================================== */

:root {
  /* Базовая палитра — Светлая тема (Фирменный синий ГБУ Жилищник) */
  --brand-primary: #0D47A1;
  --brand-primary-hover: #1565C0;
  --brand-primary-light: #E3F2FD;
  --brand-accent: #D97706;
  --brand-accent-light: #FEF3C7;
  
  --bg-page: #F1F5F9;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-card-hover: #F8FAFC;
  
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-subtle: #64748B;
  --text-inverted: #FFFFFF;

  --border-light: #E2E8F0;
  --border-focus: #0D47A1;
  --border-accent: #F59E0B;

  --danger-color: #DC2626;
  --danger-bg: #FEE2E2;
  --success-color: #16A34A;
  --success-bg: #DCFCE7;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-drawer: 0 -4px 20px rgba(0, 0, 0, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Увеличенные шрифты для удобства неподготовленных пользователей */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 13px;
  --font-size-sm: 14.5px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
}

/* Тёмная тема — мягкий приятный контраст (не режет глаза) */
[data-theme="dark"] {
  --brand-primary: #3B82F6;
  --brand-primary-hover: #60A5FA;
  --brand-primary-light: #1E293B;
  --brand-accent: #F59E0B;
  --brand-accent-light: #2D2415;

  --bg-page: #0B132B;
  --bg-surface: #1E293B;
  --bg-subtle: #162033;
  --bg-card-hover: #24344D;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  --text-inverted: #0F172A;

  --border-light: #334155;
  --border-focus: #3B82F6;
  --border-accent: #F59E0B;

  --danger-color: #EF4444;
  --danger-bg: #451A1A;
  --success-color: #22C55E;
  --success-bg: #143521;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-drawer: 0 -4px 25px rgba(0, 0, 0, 0.6);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  color: var(--text-main);
  background-color: var(--bg-page);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}

.app-container {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.city-crest-icon {
  width: 32px;
  height: 32px;
  color: var(--brand-accent);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--brand-primary);
  line-height: 1.2;
}

.brand-sub {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.theme-icon {
  font-size: 18px;
}

/* Main Content */
.main-content {
  padding: 12px 14px;
}

/* Accordion Section (Meta Header) */
.meta-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--bg-surface);
  user-select: none;
  transition: background 0.15s ease;
}

.accordion-header:hover {
  background: var(--bg-subtle);
}

.accordion-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  font-size: 22px;
}

.accordion-headings {
  display: flex;
  flex-direction: column;
}

.accordion-title {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--text-main);
}

.accordion-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.accordion-arrow {
  font-size: 13px;
  color: var(--text-subtle);
  transition: transform 0.2s ease;
}

.accordion-header.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.accordion-body.open {
  display: block;
}

/* Form Controls */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

.form-row.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .form-row.two-cols {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Segmented Control */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  gap: 4px;
}

.segment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment-hint {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
}

.segment-btn.active {
  background: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

/* Chips Container */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-family: var(--font-base);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-check {
  display: none;
  font-weight: 700;
}

.chip-toggle.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF;
}

.chip-toggle.active .chip-check {
  display: inline-block;
}

/* Search Section */
.search-section {
  margin-bottom: 14px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  height: 50px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-subtle);
  margin-right: 10px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  color: var(--text-main);
}

.clear-btn {
  background: var(--border-light);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 8px;
}

/* Quick Search Suggestions */
.quick-tags-scroller {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-tags-scroller::-webkit-scrollbar {
  display: none;
}

.quick-label {
  font-size: var(--font-size-xs);
  color: var(--text-subtle);
  white-space: nowrap;
  font-weight: 500;
}

.quick-tag {
  white-space: nowrap;
  padding: 8px 14px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-tag:hover, .quick-tag.active {
  background: var(--brand-accent-light);
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  font-weight: 600;
}

/* Category Tabs */
.category-tabs-wrap {
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-tabs-wrap::-webkit-scrollbar {
  display: none;
}

.category-tabs {
  display: flex;
  gap: 8px;
  padding: 6px 2px;
}

.tab-btn {
  white-space: nowrap;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.tab-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.tab-count {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Results Meta Bar */
.results-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 4px;
  font-size: var(--font-size-sm);
  color: var(--text-subtle);
}

.filter-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Catalog Actions Bar */
.catalog-actions-bar {
  margin-top: 8px;
  display: flex;
  justify-content: stretch;
}

.btn-add-custom-job {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--brand-accent);
  background: var(--brand-accent-light);
  color: var(--brand-accent);
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-custom-job:hover {
  background: var(--brand-accent);
  color: #FFFFFF;
  border-style: solid;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-add-custom-job:active {
  transform: scale(0.98);
}

/* Catalog List */
.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Catalog Item Card */
.item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  position: relative;
}

.item-card.has-selected {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1.5px var(--brand-primary);
}

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge-code {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.badge-subcat {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.badge-unavailable {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-subtle);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.item-name {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
}

/* Clarification Details */
.item-clarification-toggle {
  font-size: var(--font-size-xs);
  color: var(--brand-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  user-select: none;
}

.item-clarification {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  line-height: 1.4;
  border-left: 3px solid var(--border-accent);
}

/* Item Bottom / Actions */
.item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 4px;
}

.price-block {
  display: flex;
  flex-direction: column;
}

.price-main {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}

.price-unit {
  font-size: var(--font-size-xs);
  color: var(--text-subtle);
}

/* Quantity Stepper Controller */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.step-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s ease;
}

.step-btn:active {
  transform: scale(0.92);
}

.step-btn.btn-plus {
  background: var(--brand-primary);
  color: #FFFFFF;
}

.step-input {
  width: 48px;
  height: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  text-align: center;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

/* Initial Add Button */
.btn-initial-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--brand-primary);
  color: #FFFFFF;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-initial-add:active {
  transform: scale(0.95);
}

/* Sticky Bottom Cart Bar */
.sticky-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 680px;
  margin: 0 auto;
  z-index: 50;
  background: var(--bg-surface);
  border-top: 1.5px solid var(--border-light);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-drawer);
}

.cart-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.cart-pill-badge {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-icon {
  font-size: 22px;
}

.count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--brand-accent);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
}

.cart-pricing {
  display: flex;
  flex-direction: column;
}

.cart-total-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.cart-total-sum {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--brand-primary);
  line-height: 1.2;
}

.btn-primary-action {
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--brand-primary);
  color: #FFFFFF;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
}

.btn-primary-action:active {
  transform: scale(0.96);
}

.arrow-right-icon {
  width: 18px;
  height: 18px;
}

/* Drawer / Modal */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}

.drawer-overlay.open {
  display: flex;
}

.drawer-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  max-height: 92vh;
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-drawer);
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-icon {
  font-size: 26px;
}

.drawer-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-main);
}

.drawer-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-drawer-add-custom {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand-accent);
  background: var(--brand-accent-light);
  color: var(--brand-accent);
  font-family: var(--font-base);
  font-size: var(--font-size-xs);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-drawer-add-custom:hover {
  background: var(--brand-accent);
  color: #FFFFFF;
}

.btn-close-drawer {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-close-drawer:hover {
  background: var(--border-light);
  color: var(--text-main);
}

.drawer-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Items in Drawer */
.estimate-items-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.drawer-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.drawer-item-card.is-custom-item {
  border-left: 4px solid var(--brand-accent);
  background: var(--bg-surface);
}

.drawer-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.drawer-item-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-custom-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-accent);
  background: var(--brand-accent-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-accent);
}

.drawer-item-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  flex: 1;
  margin: 0 4px;
}

.btn-item-delete {
  background: transparent;
  border: none;
  color: var(--danger-color);
  font-size: 20px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.btn-item-delete:hover {
  background: var(--danger-bg);
}

/* Edit Grid: Price per unit and Quantity */
.drawer-item-edit-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 10px;
  margin-top: 10px;
  background: var(--bg-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  align-items: center;
}

@media (max-width: 460px) {
  .drawer-item-edit-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.drawer-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
}

.price-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.price-input-wrapper:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.15);
}

.drawer-price-input {
  width: 90px;
  height: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

.drawer-price-input.price-modified {
  color: var(--brand-accent);
}

.unit-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-reset-price {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--brand-accent);
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s ease;
}

.btn-reset-price:hover {
  background: var(--brand-accent);
  color: #FFFFFF;
}

.price-change-hint {
  font-size: 11px;
  color: var(--brand-accent);
  font-weight: 600;
}

.drawer-item-subtotal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}

.subtotal-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.drawer-item-price {
  font-size: var(--font-size-lg);
  font-weight: 800;
  color: var(--brand-primary);
}

.drawer-item-note-input {
  width: 100%;
  margin-top: 10px;
  min-height: 40px;
  padding: 0 12px;
  font-family: var(--font-base);
  font-size: var(--font-size-xs);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.drawer-item-note-input:focus {
  border-color: var(--border-focus);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-subtle);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Calculation Card */
.calculation-summary-card {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.calc-card-title {
  font-size: var(--font-size-md);
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

.calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 8px;
}

.calc-val {
  font-weight: 600;
  color: var(--text-main);
}

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

.calc-row.discount-row .calc-val {
  color: var(--success-color);
}

.calc-row.grand-total-row {
  border-top: 1.5px dashed var(--border-light);
  margin-top: 10px;
  padding-top: 10px;
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-main);
}

.grand-total-val {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--brand-primary);
}

.calc-row.vat-row {
  font-size: var(--font-size-xs);
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.words-summary-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.words-title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.words-text {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--brand-primary);
}

/* Drawer Footer */
.drawer-footer {
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
}

.btn-primary-send-telegram {
  width: 100%;
  min-height: 56px;
  background: linear-gradient(135deg, #0D47A1 0%, #1565C0 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-lg, 14px);
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 71, 161, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-primary-send-telegram:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(13, 71, 161, 0.25);
  opacity: 0.95;
}

.btn-tg-main {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.btn-tg-icon {
  font-size: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-tg-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-tg-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #FFFFFF;
}

.btn-tg-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
  line-height: 1.25;
}

.drawer-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
}

.desktop-download-row {
  display: flex;
  gap: 8px;
}

.btn-desktop-download {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md, 10px);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-desktop-download:hover {
  background: var(--bg-card-hover);
}

.btn-link-danger {
  background: transparent;
  border: none;
  color: var(--danger-color);
  font-family: var(--font-base);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==============================================================================
   Modal: Добавление произвольной позиции («Своя работа»)
============================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.15s ease;
}

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

.modal-container {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 24px;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.btn-close-modal {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-close-modal:hover {
  background: var(--border-light);
  color: var(--text-main);
}

.modal-form {
  padding: 18px 20px;
  overflow-y: auto;
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

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

.unit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.unit-chip {
  padding: 8px 14px;
  min-height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unit-chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.unit-chip.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-submit-custom {
  flex: 1;
  justify-content: center;
  background: var(--brand-primary);
}

.btn-secondary-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary-action:hover {
  background: var(--border-light);
  color: var(--text-main);
}

/* ==============================================================================
   Catalog Infinite Scroll / Load More
============================================================================== */
.catalog-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0 24px;
}

.btn-load-more {
  min-height: 48px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand-primary);
  background: var(--bg-surface);
  color: var(--brand-primary);
  font-family: var(--font-base);
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-load-more:hover {
  background: var(--brand-primary-light);
  transform: translateY(-1px);
}

/* Zero horizontal scroll guarantee */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 680px;
  overflow-x: hidden;
}
