/* =================================================================
   Caffè — стили
   Палитра: Olive & Rust, зелёный сайдбар (Sage Muted)
   Адаптивный: десктоп (slide-over) + мобайл (bottom sheet + bottom nav)
   ================================================================= */

:root {
  --bg: #faf8f3;
  --surface: white;
  --sidebar-bg: #6b7761;
  --border: #e8e3d4;
  --border-hover: #d4cdb8;
  --hover: #f5f2ea;

  --text: #2f3525;
  --text-muted: #7a8068;
  --text-light: #9a9a8a;

  --accent: #b5533a;
  --accent-hover: #9d4530;
  --accent-bg: #f4e6dd;
  --olive: #6b7761;
  --olive-hover: #5a6651;
  --olive-bg: #edf0e9;
  --olive-border: #c8d0c0;

  --sidebar-text: #faf8f3;
  --sidebar-text-muted: rgba(250,248,243,0.65);
  --sidebar-text-dim: rgba(250,248,243,0.5);
  --sidebar-hover: rgba(255,255,255,0.1);
  --sidebar-active: rgba(255,255,255,0.18);
  --sidebar-border: rgba(255,255,255,0.15);

  --mobile-navbar-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ================================================
   ДЕСКТОП: ROOT GRID
   Три колонки: сайдбар | контент | slide-over
   ================================================ */
.root {
  display: grid;
  grid-template-columns: 240px 1fr 0px;
  min-height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.3s cubic-bezier(0.4,0,0.2,1);
}

.root.panel-open {
  grid-template-columns: 240px 1fr 420px;
}

/* ================================================
   САЙДБАР
   ================================================ */
.sidebar {
  background: var(--sidebar-bg);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.workspace {
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  border-radius: 4px; margin-bottom: 4px;
}

.workspace-icon {
  width: 20px; height: 20px;
  background: var(--accent); color: white;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.workspace-name {
  font-size: 13px; font-weight: 600; color: var(--sidebar-text); flex: 1;
}

.sidebar-section { margin-top: 16px; }

.sidebar-label {
  padding: 4px 10px;
  font-size: 11px; font-weight: 500;
  color: var(--sidebar-text-dim); margin-bottom: 2px;
}

.nav-item {
  padding: 6px 10px;
  display: flex; align-items: center; gap: 8px;
  border-radius: 4px; font-size: 14px;
  color: rgba(250,248,243,0.85);
  transition: background 0.1s;
}

.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text); }
.nav-item.active .nav-item-label { font-weight: 500; }

.nav-item-icon {
  font-size: 15px; width: 20px;
  display: flex; justify-content: center; flex-shrink: 0;
}

.nav-item-label { flex: 1; }

.sidebar-footer {
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.user-block {
  padding: 8px 10px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 4px; margin-bottom: 4px;
}

.avatar {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 13px; font-weight: 500; color: var(--sidebar-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.user-role {
  font-size: 11px; color: var(--sidebar-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.logout-form { margin: 0; }

.logout-btn {
  width: 100%; padding: 6px 10px;
  background: transparent; border: none;
  color: var(--sidebar-text-muted);
  font-size: 12px; border-radius: 4px;
  text-align: left; transition: all 0.1s;
}

.logout-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* ================================================
   ОСНОВНОЙ КОНТЕНТ
   ================================================ */
.main {
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.topbar {
  padding: 10px 32px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
  background: var(--bg);
  flex-shrink: 0; gap: 8px;
  min-height: 46px;
}

.topbar-left { flex: 1; display: flex; align-items: center; gap: 8px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.breadcrumb-item {
  padding: 2px 6px; border-radius: 3px;
}

.page-content {
  flex: 1;
  padding: 36px 40px 80px;
}

.page-hero { margin-bottom: 32px; }
.page-icon { font-size: 44px; line-height: 1; margin-bottom: 8px; }

h1 {
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text); margin: 0 0 4px; line-height: 1.15;
}

.page-subtitle {
  color: var(--text-muted); font-size: 14px; margin: 0;
}

.section-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ================================================
   КАРТОЧКИ — десктоп
   ================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px; margin-bottom: 40px;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px;
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 110px; color: var(--text);
}

.card:hover {
  background: var(--hover); border-color: var(--border-hover);
  transform: translateY(-1px);
}

.card-icon { font-size: 24px; line-height: 1; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Мобайл список модулей — скрыт на десктопе */
.mobile-module-list { display: none; }

/* ================================================
   SLIDE-OVER ПАНЕЛЬ (десктоп — третья колонка)
   ================================================ */
.slideover {
  background: white;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease 0s;
}

.root.panel-open .slideover {
  opacity: 1;
  transition: opacity 0.2s ease 0.15s;
}

.slideover-drag-handle { display: none; }

.slideover-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.slideover-title { font-size: 15px; font-weight: 600; flex: 1; }

.slideover-close {
  width: 28px; height: 28px;
  border: none; background: transparent; border-radius: 4px;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}

.slideover-close:hover { background: var(--hover); color: var(--text); }

.slideover-body {
  flex: 1; overflow-y: auto;
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.slideover-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ================================================
   OVERLAY
   ================================================ */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(47,53,37,0.4);
  z-index: 99; opacity: 0;
  transition: opacity 0.25s;
}

.overlay.show { opacity: 1; }

/* ================================================
   МОБАЙЛ BOTTOM NAVBAR — скрыт на десктопе
   ================================================ */
.mobile-navbar { display: none; }

/* ================================================
   ТАБЛИЦЫ
   ================================================ */
.table-wrap {
  background: white; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}

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

thead th {
  padding: 9px 14px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
  background: #fdfcf8;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s; cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--hover); }
tbody tr.selected { background: #f0eddf; }

td { padding: 11px 14px; font-size: 13px; }
.td-name { font-weight: 500; }

.row-actions {
  display: flex; gap: 4px; justify-content: flex-end;
  opacity: 0; transition: opacity 0.1s;
}
tbody tr:hover .row-actions { opacity: 1; }

/* ================================================
   BADGES
   ================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}
.badge-green { background: var(--olive-bg); color: #4a5a2e; }
.badge-rust { background: var(--accent-bg); color: var(--accent); }
.badge-gray { background: #f0ede6; color: var(--text-muted); }

/* ================================================
   КНОПКИ
   ================================================ */
.btn-primary {
  padding: 8px 16px;
  background: var(--accent); color: white;
  border: none; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  transition: background 0.15s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  padding: 8px 16px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}

.btn-secondary:hover { border-color: var(--border-hover); color: var(--text); }

.btn-icon {
  width: 28px; height: 28px;
  border: 1px solid var(--border); background: white;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  transition: all 0.1s;
}

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

/* ================================================
   ФОРМЫ
   ================================================ */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-label span { color: var(--accent); margin-left: 2px; }

.form-input {
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; /* предотвращает zoom на iOS */
  font-family: inherit; color: var(--text);
  transition: border-color 0.15s; width: 100%;
  background: white; -webkit-appearance: none;
}

.form-input:focus {
  outline: none; border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(139,148,102,0.12);
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a8068' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint { font-size: 11px; color: var(--text-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.form-section-label {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: -4px;
}

/* ================================================
   СООБЩЕНИЯ
   ================================================ */
.messages { margin-bottom: 16px; }

.message {
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin-bottom: 6px;
  background: var(--olive-bg); color: var(--text);
  border-left: 3px solid var(--olive);
}

.message.error,
.message.danger {
  background: var(--accent-bg);
  border-left-color: var(--accent);
  color: var(--accent-hover);
}

/* ================================================
   TOAST
   ================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--mobile-navbar-height) + var(--safe-bottom) + 12px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white;
  padding: 10px 18px; border-radius: 20px;
  font-size: 13px; z-index: 200;
  opacity: 0; transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none; white-space: nowrap;
}

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

/* ================================================
   СТРАНИЦА ВХОДА
   ================================================ */
.login-page {
  min-height: 100vh; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 40px 32px;
}

.login-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 32px;
}

.login-brand-name { font-size: 18px; font-weight: 700; color: var(--text); }
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 24px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.form-error {
  padding: 10px 12px;
  background: var(--accent-bg); border-left: 3px solid var(--accent);
  border-radius: 4px; color: var(--accent-hover); font-size: 13px;
}

/* ================================================
   МОБАЙЛ — медиа-запрос ≤ 768px
   ================================================ */
@media (max-width: 768px) {

  body { overflow: auto; height: auto; }

  /* Сбрасываем десктопный грид */
  .root {
    display: block;
    height: auto; min-height: 100vh;
  }

  .root.panel-open { /* не меняем layout */ }

  /* Сайдбар скрыт */
  .sidebar { display: none; }

  /* Контент на всю ширину */
  .main {
    border-right: none;
    min-height: 100vh;
    padding-bottom: calc(var(--mobile-navbar-height) + var(--safe-bottom));
  }

  .topbar { padding: 10px 16px; }
  .page-content { padding: 20px 16px calc(var(--mobile-navbar-height) + var(--safe-bottom) + 20px); }

  h1 { font-size: 26px; }
  .page-icon { font-size: 36px; }

  /* Карточки скрыты — показываем мобайл-список */
  .cards { display: none; }

  .mobile-module-list {
    display: flex; flex-direction: column; gap: 8px;
  }

  .mobile-module-item {
    background: white; border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
  }

  .mobile-module-item:active { background: var(--hover); }

  .mobile-module-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--olive-bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
  }

  .mobile-module-body { flex: 1; min-width: 0; }

  .mobile-module-title {
    font-size: 15px; font-weight: 600;
    color: var(--text); margin-bottom: 2px;
  }

  .mobile-module-desc { font-size: 12px; color: var(--text-muted); }

  .mobile-module-chevron {
    color: var(--text-light); font-size: 18px; flex-shrink: 0;
  }

  /* Таблицы — скрываем на мобайле (каждый модуль добавит мобайл-вариант) */
  .table-wrap { display: none; }

  /* SLIDE-OVER → BOTTOM SHEET */
  .slideover {
    position: fixed;
    bottom: 0; left: 0; right: 0; top: auto;
    height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    z-index: 100;
    opacity: 1;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  }

  .root.panel-open .slideover {
    transform: translateY(0);
  }

  .slideover-drag-handle {
    display: block;
    width: 36px; height: 4px;
    background: var(--border); border-radius: 2px;
    margin: 12px auto 0; flex-shrink: 0;
  }

  .slideover-footer {
    padding-bottom: calc(14px + var(--safe-bottom));
  }

  /* Overlay виден на мобайле */
  .overlay { display: block; }

  /* Bottom navbar */
  .mobile-navbar {
    display: block;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; border-top: 1px solid var(--border);
    z-index: 50;
    padding-bottom: var(--safe-bottom);
  }

  .mobile-navbar-inner {
    display: flex; justify-content: space-around;
    height: var(--mobile-navbar-height);
  }

  .mobile-nav-item {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px;
    padding: 4px 12px; flex: 1;
    color: var(--text-light); font-size: 10px; font-weight: 500;
    border: none; background: transparent;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    transition: color 0.1s;
  }

  .mobile-nav-item.active { color: var(--accent); }

  .mobile-nav-icon {
    font-size: 20px; line-height: 1;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
  }

  /* Toast выше navbar */
  .toast {
    bottom: calc(var(--mobile-navbar-height) + var(--safe-bottom) + 12px);
  }

  /* Форма — большие поля для пальцев */
  .form-input { padding: 12px 14px; }
  .btn-primary, .btn-secondary { padding: 12px 20px; font-size: 15px; }

  /* Страница входа */
  .login-card { padding: 32px 20px; border-radius: 16px; }
}

/* =================================================================
   PURCHASES — стили для модуля закупок
   ================================================================= */

/* ============ PAGE HERO ============ */
.page-hero { margin-bottom: 28px; }

/* ============ CONTROLS ROW ============ */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.period-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a8068' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--hover);
  border-radius: 8px;
  padding: 3px;
}

.mode-btn {
  padding: 5px 14px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.mode-btn.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(47, 53, 37, 0.08);
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  transition: all 0.2s;
}

.tab-badge.cook-badge { background: var(--olive-bg); color: #4a5a2e; }
.tab-badge.buyer-badge { background: var(--accent-bg); color: var(--accent); }
.tab-badge.zero { display: none; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ STATUS BAR ============ */
.status-bar {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border: 1px solid;
}

.status-bar.pending { background: #fff8e8; border-color: #f0d88a; color: #7a6020; }
.status-bar.sent { background: var(--olive-bg); border-color: #c8d4a0; color: #4a5a2e; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-bar.pending .status-dot { background: #e8b840; }
.status-bar.sent .status-dot { background: var(--olive); }

/* ============ CHECKLIST CARDS ============ */
.checklist-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--hover); }
.checklist-item.checked { background: #fdf9f7; }
.checklist-item.checked .item-name { color: var(--text-muted); }
.checklist-item.locked { cursor: default; }
.checklist-item.locked:hover { background: #fdf9f7; }

.checkbox {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  background: white;
}

.checklist-item.checked .checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.checklist-item.locked .checkbox { opacity: 0.7; }

.checkbox-check {
  color: white;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
}

.checklist-item.checked .checkbox-check { opacity: 1; }

.item-photo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  overflow: hidden;
}

.item-info { flex: 1; min-width: 0; }

.item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.item-default {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 1px;
}

.item-qty {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.qty-input {
  width: 60px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}

.qty-input:focus { outline: none; border-color: var(--olive); }

.qty-input:disabled {
  background: var(--hover);
  color: var(--text-muted);
  border-color: transparent;
}

.qty-unit { font-size: 12px; color: var(--text-muted); }

/* ============ PURCHASE CARDS ============ */
.purchase-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.purchase-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.purchase-item:last-child { border-bottom: none; }
.purchase-item:hover { background: var(--hover); }

.purchase-item.bought {
  background: #f8fdf8;
  cursor: default;
}

.purchase-item.bought:hover { background: #f8fdf8; }

.purchase-item.bought .item-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

.circle {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  background: white;
}

.purchase-item.bought .circle {
  background: #4a8a4a;
  border-color: #4a8a4a;
}

.circle-check {
  color: white;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
}

.purchase-item.bought .circle-check { opacity: 1; }

.item-qty-badge {
  flex-shrink: 0;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.purchase-item.bought .item-qty-badge {
  background: #e8f4e8;
  color: #4a8a4a;
}

/* ============ PROGRESS ============ */
.progress-wrap { margin-bottom: 20px; }

.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--olive);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ============ PAGE FOOTER ============ */
.page-footer {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-hint { font-size: 12px; color: var(--text-light); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

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

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-desc { font-size: 13px; }
.empty-state a { color: var(--accent); }

/* ============ HISTORY: DAY GROUPS ============ */
.day-group { margin-bottom: 28px; }

.day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.day-date { font-size: 13px; font-weight: 600; color: var(--text); }
.day-meta { font-size: 12px; color: var(--text-light); }
.day-line { flex: 1; height: 1px; background: var(--border); }

.history-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

.history-card-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: #fdfcf8;
  cursor: pointer;
}

.history-card-header:hover { background: var(--hover); }

.history-who { flex: 1; }
.history-who-name { font-size: 13px; font-weight: 600; color: var(--text); }
.history-who-time { font-size: 11px; color: var(--text-light); margin-top: 1px; }

.history-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--hover);
  padding: 2px 10px;
  border-radius: 10px;
}

.history-chevron {
  color: var(--text-light);
  font-size: 12px;
  transition: transform 0.2s;
}

.history-card.open .history-chevron { transform: rotate(90deg); }

.history-items { display: none; }
.history-card.open .history-items { display: block; }

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.history-item:last-child { border-bottom: none; }

.history-item-icon {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.history-item-qty {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============ HISTORY: POSITIONS TABLE ============ */
.positions-table {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.positions-table-header {
  display: grid;
  grid-template-columns: 1fr 80px 100px 140px;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: #fdfcf8;
}

.position-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 140px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
}

.position-row:last-child { border-bottom: none; }
.position-row:hover { background: var(--hover); }

.position-name-wrap { display: flex; align-items: center; gap: 10px; }
.position-icon { font-size: 17px; }
.position-name { font-size: 13px; font-weight: 500; }

.position-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}

.position-total {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.position-last { font-size: 11px; color: var(--text-light); }

/* ============ MOBILE overrides for purchases ============ */
@media (max-width: 768px) {
  .positions-table-header {
    grid-template-columns: 1fr 60px 100px;
  }
  .positions-table-header > :nth-child(3) { display: none; }
  .position-row {
    grid-template-columns: 1fr 60px 100px;
  }
  .position-row > :nth-child(3) { display: none; }

  /* Скрываем десктопную таблицу справочника, показываем карточки */
  .table-wrap { display: none; }
  .mobile-module-list { display: flex !important; }
}

/* ============ SEARCH / TYPEAHEAD ============ */
.search-wrap {
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(139,148,102,0.1);
}

/* ============ BTN-PRIMARY TEXT FIX ============ */
.btn-primary {
  color: white !important;
  -webkit-font-smoothing: antialiased;
  font-weight: 600;
  text-rendering: optimizeLegibility;
}

/* ============ CHECKLIST: COMMENT ============ */
.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.checklist-item.checked .checklist-item-row { background: #fdf9f7; }
.checklist-item-row:hover { background: var(--hover); }
.checklist-item.checked .checklist-item-row:hover { background: #fdf9f7; }
.checklist-item.locked .checklist-item-row { cursor: default; }

.comment-btn {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border: none; background: transparent;
  align-items: center; justify-content: center;
  font-size: 15px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
}

.comment-btn:hover { background: var(--hover); }
.comment-btn.has-comment { color: var(--olive); }
.comment-btn:not(.has-comment) { color: var(--text-light); }

.comment-area {
  display: none;
  padding: 0 16px 12px 62px;
  background: #fdf9f7;
}

.comment-area.open { display: block; }

.comment-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
  resize: none;
  line-height: 1.4;
  transition: border-color 0.15s;
}

.comment-input:focus { outline: none; border-color: var(--olive); }
.comment-input::placeholder { color: var(--text-light); }
.comment-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ============ CUSTOM ITEM ============ */
.btn-add-custom {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px; font-family: inherit;
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; transition: all 0.15s;
  width: 100%;
  margin-top: 8px;
}

.btn-add-custom:hover {
  border-color: var(--olive);
  color: var(--olive);
  background: var(--olive-bg);
}

.custom-name-input:focus { outline: none; }

/* ============ PURCHASE: CANCEL ============ */
.cancel-btn {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}

.cancel-btn:hover {
  border-color: #d44;
  color: #d44;
  background: #fde8e8;
}

.purchase-item.cancelled .circle {
  background: #d44;
  border-color: #d44;
}

.purchase-item.cancelled .circle-check { opacity: 1; }
.purchase-item.cancelled .item-name { color: var(--text-muted); text-decoration: line-through; }
.purchase-item.cancelled .item-qty-badge { background: #fde8e8; color: #b44; }
.purchase-item.cancelled { background: #fdf5f5; cursor: default; }
.purchase-item.cancelled:hover { background: #fdf5f5; }

/* ============ PURCHASE: BUYER COMMENT ============ */
.buyer-comment {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 1.4;
}

.purchase-item-body { flex: 1; min-width: 0; }

/* ============================================================
   RECIPES
   ============================================================ */

/* --- Фильтр-бар --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-group--right { margin-left: auto; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Сетка карточек --- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.recipe-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.recipe-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.recipe-card--archived { opacity: 0.6; }

.recipe-card-cover {
  position: relative;
  height: 140px;
  background: var(--bg-secondary);
  overflow: hidden;
}
.recipe-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.recipe-card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.recipe-card-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}
.recipe-card-badge--archived { background: #f3f0e8; color: #888; }

.recipe-card-body { padding: 12px 14px 14px; }
.recipe-card-zone { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.recipe-card-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; line-height: 1.3; }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.recipe-card-yield { font-size: 12px; color: var(--text-muted); }

/* --- Теги-пилюли --- */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--olive-bg);
  color: var(--olive);
  border: 1px solid var(--olive-border);
}

/* --- Страница детали --- */
.recipe-detail { max-width: 720px; }

.recipe-detail-header { margin-bottom: 24px; }
.recipe-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}
.recipe-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--olive-bg);
  border: 1px solid var(--olive-border);
  color: var(--olive);
}
.recipe-zone-badge--archived { background: #f3f0e8; color: #999; border-color: #e0ddd4; }

.recipe-detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
  line-height: 1.2;
}
.recipe-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.6;
}
.recipe-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.recipe-stat { display: flex; flex-direction: column; gap: 2px; }
.recipe-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.recipe-stat-value { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.recipe-detail-cover {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 28px;
  max-height: 340px;
}
.recipe-detail-cover img { width: 100%; height: 100%; object-fit: cover; }

.recipe-detail-body { display: flex; flex-direction: column; gap: 32px; }

/* --- Секции --- */
.recipe-section {}
.recipe-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.recipe-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* --- Ингредиенты --- */
.ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.ingredient-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  transition: background 0.1s;
}
.ingredient-row:last-child { border-bottom: none; }
.ingredient-row:hover { background: var(--bg-secondary); }
.ingredient-row--no-price { background: #fffbf5; }
.ingredient-row--no-price:hover { background: #fff5e8; }

.ingredient-emoji { font-size: 18px; flex-shrink: 0; width: 28px; text-align: center; }
.ingredient-name { flex: 1; font-size: 14px; color: var(--text-primary); }
.ingredient-link { color: var(--accent); text-decoration: none; }
.ingredient-link:hover { text-decoration: underline; }
.ingredient-note { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.ingredient-amount { font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.ingredient-no-price { font-size: 12px; color: #b5533a; opacity: 0.7; }

.cost-warning-banner {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff8f0;
  border: 1.5px solid #f0d8b8;
  font-size: 13px;
  color: #a0622a;
}
.cost-warning { cursor: help; font-size: 14px; }

/* --- Шаги --- */
.step-list { display: flex; flex-direction: column; gap: 20px; }
.step-row { display: flex; gap: 16px; align-items: flex-start; }
.step-number {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-body { flex: 1; padding-top: 4px; }
.step-desc { font-size: 14px; color: var(--text-primary); line-height: 1.6; margin: 0 0 10px; }
.step-image {
  border-radius: 10px;
  max-width: 100%;
  max-height: 300px;
  object-fit: cover;
}

/* --- Пустой стейт --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 16px; margin-bottom: 20px; }

/* --- Адаптив --- */
@media (max-width: 640px) {
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .recipe-detail-title { font-size: 22px; }
  .recipe-detail-stats { gap: 14px; }
  .filter-group--right { margin-left: 0; }
}

/* ============================================================
   RECIPE FORM
   ============================================================ */

.recipe-form-wrap { max-width: 720px; display: flex; flex-direction: column; gap: 20px; }

.form-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
}
.form-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-actions { display: flex; gap: 10px; padding-bottom: 40px; }

/* Теги-чекбоксы */
.tag-checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tag-checkbox-label:has(input:checked) {
  border-color: var(--accent);
  background: #fdf2ee;
  color: var(--accent);
}
.tag-checkbox-label input { width: 14px; height: 14px; accent-color: var(--accent); }

/* Превью изображения */
.form-image-preview img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  margin-bottom: 6px;
}

/* ── Строка ингредиента ── */
.ingredient-row-form {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
}
.ingredient-row-form-inner {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  align-items: start;
}
.ing-type-wrap { grid-column: 1; }
.ing-field-item,
.ing-field-subrecipe,
.ing-field-custom { grid-column: 2; margin: 0; }
.ing-amount-wrap {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.ing-amount { flex: 1; }
.ing-unit { width: 90px; flex-shrink: 0; }
.ing-note-wrap { grid-column: 1 / -1; }
.row-remove-btn {
  grid-column: 1 / -1;
  justify-self: end;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.row-remove-btn:hover { color: #d44; }

/* ── Строка шага ── */
.step-row-form {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
}
.step-row-form-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.step-number-label {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}
.step-body-wrap { flex: 1; }
.step-row-form .row-remove-btn { margin-top: 4px; }

@media (max-width: 640px) {
  .form-card { padding: 16px; }
  .ingredient-row-form-inner { grid-template-columns: 1fr; }
  .ing-type-wrap, .ing-field-item, .ing-field-subrecipe,
  .ing-field-custom, .ing-amount-wrap, .ing-note-wrap { grid-column: 1; }
}

/* ============================================================
   RECIPE NOTION-STYLE FORM
   ============================================================ */

.recipe-notion-form { max-width: 680px; padding-bottom: 60px; }

/* Обложка */
.rn-cover {
  height: 180px;
  background: var(--hover);
  border-radius: 12px;
  border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-bottom: 28px;
  transition: background .15s, border-color .15s;
  overflow: hidden;
  position: relative;
}
.rn-cover:hover { background: #ebe7db; border-color: var(--accent); }
.rn-cover-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-light); }
.rn-cover-icon { font-size: 22px; }
.rn-cover-placeholder span { font-size: 13px; }
.rn-cover-img { width: 100%; height: 100%; object-fit: cover; }
.rn-cover-change {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,.4); color: #fff;
  font-size: 12px; padding: 4px 10px; border-radius: 6px;
  cursor: pointer; border: none; font-family: inherit;
}

/* Название */
.rn-title {
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  border: none; outline: none;
  width: 100%;
  background: transparent;
  font-family: inherit;
  line-height: 1.2;
  margin-bottom: 14px;
}
.rn-title::placeholder { color: var(--text-light); }
.rn-error { font-size: 12px; color: #c0392b; margin: -10px 0 10px; }

/* Теги */
.rn-tags-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px; align-items: center;
}
.rn-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  background: var(--hover);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.rn-tag:hover { border-color: var(--accent); color: var(--accent); }
.rn-tag--on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
}

/* Мета */
.rn-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.rn-meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: 20px;
  font-size: 13px; color: var(--text-muted);
  background: var(--hover);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.rn-meta-pill:focus-within { border-color: var(--olive); }
.rn-meta-label { font-size: 11px; color: var(--text-light); }
.rn-meta-value { font-weight: 500; color: var(--text); font-size: 13px; }
.rn-meta-input {
  border: none; outline: none;
  background: transparent;
  font-size: 13px; color: var(--text);
  font-family: inherit;
}
.rn-meta-input::placeholder { color: var(--text-light); }
.rn-meta-select {
  border: none; outline: none;
  background: transparent;
  font-size: 13px; color: var(--text);
  font-family: inherit; cursor: pointer;
}

/* Секция-заголовок */
.rn-section-heading {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 28px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.rn-section-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Ингредиенты */
.rn-ing-list, .rn-step-list { display: flex; flex-direction: column; }
.rn-ing-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  cursor: default; transition: background .1s; position: relative;
}
.rn-ing-row:hover { background: var(--hover); }
.rn-bullet {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--olive); flex-shrink: 0;
}
.rn-ing-name { flex: 1; font-size: 14.5px; color: var(--text); }
.rn-ing-qty {
  font-size: 13px; color: var(--text-muted);
  background: var(--olive-bg);
  padding: 2px 9px; border-radius: 5px;
  border: 1px solid var(--olive-border);
  white-space: nowrap; font-weight: 500;
  color: var(--olive);
}

/* Шаги */
.rn-step-row {
  display: flex; gap: 12px;
  padding: 7px 10px; border-radius: 8px;
  transition: background .1s; align-items: flex-start;
}
.rn-step-row:hover { background: var(--hover); }
.rn-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.rn-step-text {
  flex: 1; font-size: 14.5px; color: var(--text);
  line-height: 1.6; border: none; outline: none;
  background: transparent; font-family: inherit;
  resize: none; min-height: 26px;
}
.rn-step-text::placeholder { color: var(--text-light); }
.rn-step-file {
  display: none;
}
.rn-step-img-preview img {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
}

/* Удалить кнопка */
.rn-row-del {
  opacity: 0; font-size: 18px; line-height: 1;
  color: var(--text-light); cursor: pointer;
  border: none; background: none; padding: 0 3px;
  transition: opacity .15s, color .15s; flex-shrink: 0;
}
.rn-ing-row:hover .rn-row-del,
.rn-step-row:hover .rn-row-del { opacity: 1; }
.rn-row-del:hover { color: var(--accent); }

/* Кнопка добавления */
.rn-add-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--text-muted);
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
  border: none; background: none; font-family: inherit;
  transition: color .15s, background .15s; margin-top: 4px;
}
.rn-add-btn:hover { color: var(--olive); background: var(--olive-bg); }
.rn-add-icon {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

/* Разделитель */
.rn-divider { height: 1px; background: var(--border); margin: 28px 0 16px; }

/* Дополнительно */
.rn-extra-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  cursor: pointer; border: none; background: none;
  font-family: inherit; padding: 4px 0;
  transition: color .15s; user-select: none;
}
.rn-extra-toggle:hover { color: var(--text-muted); }
.rn-extra-toggle svg { transition: transform .2s; }
.rn-extra-toggle.open svg { transform: rotate(180deg); }
.rn-extra-panel { display: none; }
.rn-extra-panel.open { display: block; }

/* Панель ингредиента */
.rn-ing-panel { display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 640px) {
  .rn-title { font-size: 24px; }
  .rn-cover { height: 130px; }
}

.rn-form-errors {
  background: #fdf0ee;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.rn-form-errors .rn-error { margin: 0; }

.rn-step-photo-btn {
  flex-shrink: 0;
  opacity: 0;
  font-size: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 3px;
  transition: opacity .15s;
  line-height: 1;
  margin-top: 3px;
}
.rn-step-row:hover .rn-step-photo-btn { opacity: 1; }

/* ── Inline добавление ингредиента ── */
.rn-ing-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--hover);
  border: 1.5px solid var(--border);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.rn-ing-search-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.rn-ing-search {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
.rn-ing-search::placeholder { color: var(--text-light); }
.rn-ing-search-input {
  width: 100%;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  box-shadow: none !important;
  -webkit-appearance: none;
  border-radius: 0;
  padding: 0;
}
.rn-ing-search-input::placeholder { color: var(--text-light); }

.rn-ing-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: -10px;
  right: -10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  z-index: 100;
  overflow: hidden;
  display: none;
}
.rn-ing-drop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.rn-ing-drop-item:last-child { border-bottom: none; }
.rn-ing-drop-item:hover { background: var(--hover); }
.rn-ing-drop-emoji { font-size: 16px; flex-shrink: 0; }
.rn-ing-drop-name { flex: 1; color: var(--text); }
.rn-ing-drop-supplier { font-size: 12px; color: var(--text-muted); }
.rn-ing-drop-custom { color: var(--accent); font-style: italic; }

.rn-ing-amount-inline {
  width: 60px !important;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  text-align: right;
  border-bottom: 1.5px solid var(--border);
  border-radius: 0;
  padding: 2px 4px;
}
.rn-ing-amount-inline:focus { border-bottom-color: var(--accent); }

.rn-ing-unit-inline {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
}

.rn-ing-confirm-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.rn-ing-confirm-btn:hover { background: var(--accent-hover); }

/* ── Кнопки формы внизу ── */
.rn-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Превью фото шага ── */
.rn-step-img-preview {
  position: relative;
  flex-shrink: 0;
}
.rn-step-img-preview img {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  display: block;
}
.rn-step-img-remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Inline редактирование ингредиента на месте ── */
.rn-ing-view {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  cursor: pointer;
}
.rn-ing-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}
.rn-ing-search-inline {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
.rn-ing-search-inline::placeholder { color: var(--text-light); }
.rn-ing-dropdown-inline {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  z-index: 100;
  overflow: hidden;
  display: none;
}

/* ── Вкладки рецептов ── */
.recipe-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.recipe-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.recipe-tab:hover { color: var(--text); }
.recipe-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Убираем зону из карточки — теперь она в табе */
.recipe-card-zone { display: none; }

/* ── Строка ингредиента в режиме редактирования — как панель добавления ── */
.rn-ing-row:has(.rn-ing-edit[style*="flex"]) {
  background: var(--hover);
  border: 1.5px solid var(--border);
  border-radius: 8px;
}
.rn-ing-edit {
  align-items: center;
  gap: 8px;
  width: 100%;
}
.rn-ing-edit .rn-ing-search-wrap {
  flex: 1;
  position: relative;
}
