/* ==========================================
   KRAKENOS DESIGN SYSTEM
   White-label ready — все цвета через CSS Variables
   ========================================== */

:root {
  /* === Базовые цвета (переопределяются темой) === */
  --primary: #e94560;
  --primary-hover: #ff6b6b;
  --primary-light: rgba(233, 69, 96, 0.1);
  --primary-dark: #c73a52;

  /* === Фоны === */
  --bg-base: #0f0f1a;
  --bg-surface: #1a1a2e;
  --bg-elevated: #252540;
  --bg-overlay: rgba(0, 0, 0, 0.95);

  /* === Текст === */
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b80;
  --text-inverse: #0f0f1a;

  /* === Границы === */
  --border-color: #2a2a40;
  --border-light: rgba(255, 255, 255, 0.06);

  /* === Статусы === */
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.1);

  /* === Типографика === */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', Monaco, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 32px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* === Отступы === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* === Радиусы === */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* === Тени === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(233, 69, 96, 0.2);

  /* === Layout === */
  --sidebar-width: 280px;
  --sidebar-collapsed: 64px;
  --header-height: 64px;
  --content-max-width: 1400px;

  /* === Анимации === */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* === Z-index === */
  --z-sidebar: 100;
  --z-header: 50;
  --z-modal: 200;
  --z-toast: 300;
  --z-dropdown: 150;
}

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

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   AUTH SCREEN
   ========================================== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  padding: var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.auth-logo .accent {
  color: var(--primary);
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
}

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

.auth-error {
  color: var(--error);
  font-size: var(--font-size-sm);
  text-align: center;
  padding: var(--space-3);
  background: var(--error-bg);
  border-radius: var(--radius-md);
}

/* ==========================================
   APP LAYOUT
   ========================================== */
.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

.app.hidden,
.auth-screen.hidden {
  display: none !important;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed);
}

.content-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.content-header h1 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

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

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

/* ==========================================
   FORMS
   ========================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* Позиция накладной (invoices.js itemRowHtml): строго одна строка —
   [Ингредиент 1fr][Кол-во 90][Ед. 80][Цена 110][Сумма 90][🗑 36].
   .form-row с auto-fit/minmax(200px) разносил 6 полей на 3 строки.
   Перенос на 2 колонки — только <720px. НЕ переводить на .form-row. */
.invoice-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 80px 120px 140px 36px;
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-3);
}
.invoice-item .form-group { min-width: 0; }
.invoice-item .item-total {
  padding: 8px 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.invoice-item-del .btn { width: 36px; padding-left: 0; padding-right: 0; }
@media (max-width: 720px) {
  .invoice-item { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .invoice-item .form-group:first-child { grid-column: 1 / -1; }
}

/* [34] invoice_vat_types (2026-08-05): строка ТТН — 8 колонок
   [Ингредиент 1fr][Кол 70][Ед 64][Цена 90][НДС% 64][Σ НДС 80][С НДС 90][🗑 36] */
.invoice-item-ttn {
  grid-template-columns: minmax(0, 1fr) 100px 64px 100px 70px 80px 120px 36px;
  gap: var(--space-2);
}
.invoice-item-ttn .item-vat-sum {
  padding: 8px 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

/* [40] invoice_price_reference (2026-08-06): инфо-строка под позицией
   накладной — остаток склада, ср. цена прошлых поступлений и разница
   цены к средней. Во всю ширину grid-строки, только в форме ввода. */
.invoice-item .item-stock-info {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 2px 2px 0;
  min-height: 18px;
}
.invoice-item .item-stock-info b { font-weight: 600; color: var(--text-secondary); }
.invoice-item .item-stock-info .isi-new { color: var(--text-secondary); }
.invoice-item .item-stock-info .isi-up { color: #e5484d; font-weight: 600; }
.invoice-item .item-stock-info .isi-down { color: #30a46c; font-weight: 600; }
.invoice-item .item-stock-info .isi-eq { color: var(--text-muted); }
/* [43] ingredient_name_mapping: бейдж привязки «🔗 → позиция каталога»
   и ссылка «Привязать к каталогу» для свободных названий */
.invoice-item .item-stock-info .isi-map { color: #7c5cf0; font-weight: 500; }
.invoice-item .item-stock-info .isi-link {
  color: var(--color-primary, #4a7cf7);
  text-decoration: none;
  border-bottom: 1px dashed var(--color-primary, #4a7cf7);
}
.invoice-item .item-stock-info .isi-link:hover { opacity: .8; }
@media (max-width: 720px) {
  .invoice-item .item-stock-info { padding-top: 4px; }
}

/* [34] Выбор типа накладной (addInvoice → inv-type-card) */
.inv-type-chooser {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.inv-type-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: border-color .15s ease, transform .15s ease;
}
.inv-type-card:hover {
  border-color: var(--color-primary, #4a7cf7);
  transform: translateY(-2px);
}
.inv-type-icon { font-size: 28px; line-height: 1; }
.inv-type-title { font-weight: 600; font-size: 14px; }
.inv-type-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
@media (max-width: 720px) {
  .inv-type-chooser { grid-template-columns: 1fr; }
  .invoice-item-ttn { grid-template-columns: 1fr 1fr; }
  .invoice-item-ttn .form-group:first-child { grid-column: 1 / -1; }
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-success {
  background: var(--success);
  color: var(--text-inverse);
}

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

.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-lg);
}

.btn-block {
  width: 100%;
}

.btn-loader {
  animation: spin 1s linear infinite;
}

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

/* ==========================================
   CARDS
   ========================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

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

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* ==========================================
   STATS / METRICS
   ========================================== */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.stat-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.stat-change {
  font-size: var(--font-size-xs);
  margin-top: var(--space-2);
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }

/* ==========================================
   BADGES
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

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

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

/* ==========================================
   LOADING STATES
   ========================================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  gap: var(--space-4);
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* ==========================================
   EMPTY STATES
   ========================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
  max-width: 400px;
}

/* ==========================================
   UTILITIES
   ========================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
  }

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

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

@media (max-width: 640px) {
  .content-body {
    padding: var(--space-4);
  }

  .content-header {
    padding: 0 var(--space-4);
  }

  .auth-card {
    padding: var(--space-6);
  }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}
/* modal.js ставит класс modal-lg при size:'lg' (накладные, локации,
   организация) — раньше класс не был определён и «lg» был 560px,
   из-за чего позиции накладной не влезали в одну строку. */
.modal-lg { max-width: 1000px; }
.modal-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}
.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}
.modal-body {
    padding: var(--space-5);
}
.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}
.hidden { display: none !important; }

/* ==========================================
   MODULE TOOLBAR — unified toolbar for all modules
   ========================================== */
.module-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.module-toolbar .module-search-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.module-toolbar .module-search {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.module-toolbar .module-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-transparent, rgba(99,102,241,0.15));
}

.module-toolbar .module-search::placeholder {
  color: var(--text-muted);
}

.module-toolbar .module-filter {
  min-width: 180px;
  margin: 0;
}

.module-toolbar .module-filter select,
.module-toolbar .module-filter input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.module-toolbar .module-filter select:focus,
.module-toolbar .module-filter input:focus {
  outline: none;
  border-color: var(--primary);
}

.module-toolbar .module-counter {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.module-toolbar .module-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-secondary);
}

.module-toolbar .module-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .module-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .module-toolbar .module-search-wrap {
    min-width: auto;
    width: 100%;
  }
  .module-toolbar .module-filter {
    min-width: auto;
    width: 100%;
  }
  .module-toolbar .module-counter {
    margin-left: 0;
    text-align: center;
  }
}

/* Module filter label inline */
.module-filter label {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 0;
  vertical-align: middle;
}

.module-filter select,
.module-filter input {
  display: inline-block;
  vertical-align: middle;
}

/* Ingredients toolbar fix - single line */
.ingredients-layout .module-toolbar {
  flex-wrap: nowrap;
  gap: var(--space-2);
}

.ingredients-layout .module-toolbar .module-filter {
  min-width: 140px;
  flex: 0 0 auto;
}

.ingredients-layout .module-toolbar .module-filter select {
  min-width: 140px;
}

.ingredients-layout .module-toolbar .module-search-wrap {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}

.ingredients-layout .module-toolbar .module-search {
  min-width: 160px;
}

.ingredients-layout .module-toolbar .icat-manage-link {
  white-space: nowrap;
  font-size: 12px;
}

/* Module filter inline layout */
.module-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-filter label {
  margin: 0;
  white-space: nowrap;
}

.module-filter select,
.module-filter input {
  flex: 1;
  min-width: 120px;
}

/* Ingredients toolbar - enforce single line */
.ingredients-layout .module-toolbar {
  flex-wrap: nowrap !important;
  gap: 8px !important;
}

.ingredients-layout .module-toolbar .module-filter {
  flex: 0 0 auto;
  min-width: auto;
  max-width: 200px;
}

.ingredients-layout .module-toolbar .module-search-wrap {
  flex: 1 1 auto;
  min-width: 150px;
  max-width: 300px;
}

.ingredients-layout .module-toolbar .module-counter {
  margin-left: auto;
  flex-shrink: 0;
}

/* Move search to the right in ingredients */
.ingredients-layout .module-toolbar .module-search-wrap {
  margin-left: auto;
}


/* Data Table (added 2026-08-11) */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

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

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

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

.data-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* ==========================================
   UNIVERSAL GRID LIST (for ingredients, semifinished, etc.)
   ========================================== */
.grid-listhead {
  display: grid;
  gap: var(--space-2);
  align-items: center;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border-color);
}

.grid-row {
  display: grid;
  gap: var(--space-2);
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all .15s ease;
}

.grid-row:hover {
  border-color: var(--primary);
  background: var(--bg-elevated);
}

.grid-row.dim {
  opacity: .55;
}

.grid-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cell modifiers */
.grid-cell-id {
  font-size: 11px;
  color: var(--text-muted);
}

.grid-cell-name {
  font-weight: 500;
  word-break: break-word;
}

.grid-cell-price {
  font-weight: 600;
  color: var(--accent);
}

.grid-cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.grid-cell-status .badge {
  font-size: 11px;
  padding: 2px 8px;
}
