/* ============================================
   CSS Custom Properties - Темы оформления
   ============================================ */

/* Светлая тема по умолчанию */
[data-theme="light-default"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e8e8e8;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #4a90d9;
  --bg-tab: #f0f0f0;
  --bg-tab-active: #4a90d9;
  --bg-button: #4a90d9;
  --bg-button-hover: #3a7bc8;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #f8f9fa;
  
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --text-header: #ffffff;
  --text-tab: #6c757d;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #4a90d9;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #212529;
  
  --border-primary: #dee2e6;
  --border-input: #ced4da;
  --border-card: #dee2e6;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #4a90d9;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.15);
  
  --accent: #4a90d9;
  --accent-hover: #3a7bc8;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Светлая тёплая оранжевая */
[data-theme="light-warm-orange"] {
  --bg-primary: #fff8f0;
  --bg-secondary: #fff0e0;
  --bg-tertiary: #ffe8d0;
  --bg-card: #fffaf5;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #e8722a;
  --bg-tab: #fff0e0;
  --bg-tab-active: #e8722a;
  --bg-button: #e8722a;
  --bg-button-hover: #d4611f;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #fff5eb;
  
  --text-primary: #3d2b1f;
  --text-secondary: #6b5344;
  --text-muted: #9a8577;
  --text-header: #ffffff;
  --text-tab: #6b5344;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #e8722a;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #3d2b1f;
  
  --border-primary: #e0c8b0;
  --border-input: #d4b896;
  --border-card: #e0c8b0;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #e8722a;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.12);
  
  --accent: #e8722a;
  --accent-hover: #d4611f;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Светлая тёплая коричневая */
[data-theme="light-warm-brown"] {
  --bg-primary: #faf6f1;
  --bg-secondary: #f0e8dc;
  --bg-tertiary: #e6d8c8;
  --bg-card: #fdfbf8;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #8b5e3c;
  --bg-tab: #f0e8dc;
  --bg-tab-active: #8b5e3c;
  --bg-button: #8b5e3c;
  --bg-button-hover: #7a5030;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #f5ede3;
  
  --text-primary: #3d2b1f;
  --text-secondary: #6b5344;
  --text-muted: #9a8577;
  --text-header: #ffffff;
  --text-tab: #6b5344;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #8b5e3c;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #3d2b1f;
  
  --border-primary: #d4c0a8;
  --border-input: #c8b098;
  --border-card: #d4c0a8;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #8b5e3c;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.12);
  
  --accent: #8b5e3c;
  --accent-hover: #7a5030;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Светлая тёплая бежевая */
[data-theme="light-warm-beige"] {
  --bg-primary: #fdfbf7;
  --bg-secondary: #f5f0e6;
  --bg-tertiary: #ebe4d6;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #a0845c;
  --bg-tab: #f5f0e6;
  --bg-tab-active: #a0845c;
  --bg-button: #a0845c;
  --bg-button-hover: #8e734d;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #f7f2e8;
  
  --text-primary: #3d3528;
  --text-secondary: #6b6050;
  --text-muted: #9a9080;
  --text-header: #ffffff;
  --text-tab: #6b6050;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #a0845c;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #3d3528;
  
  --border-primary: #ddd4c4;
  --border-input: #d0c4b0;
  --border-card: #ddd4c4;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #a0845c;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.1);
  
  --accent: #a0845c;
  --accent-hover: #8e734d;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Светлая холодная лавандовая */
[data-theme="light-cool-lavender"] {
  --bg-primary: #f8f6fc;
  --bg-secondary: #f0ecf8;
  --bg-tertiary: #e6e0f4;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #7b68ae;
  --bg-tab: #f0ecf8;
  --bg-tab-active: #7b68ae;
  --bg-button: #7b68ae;
  --bg-button-hover: #6a5899;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #f3eef9;
  
  --text-primary: #2d2640;
  --text-secondary: #5a5070;
  --text-muted: #8a80a0;
  --text-header: #ffffff;
  --text-tab: #5a5070;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #7b68ae;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #2d2640;
  
  --border-primary: #d4cce6;
  --border-input: #c8bcd8;
  --border-card: #d4cce6;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #7b68ae;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.1);
  
  --accent: #7b68ae;
  --accent-hover: #6a5899;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Светлая холодная салатовая */
[data-theme="light-cool-green"] {
  --bg-primary: #f6fcf6;
  --bg-secondary: #ecf8ec;
  --bg-tertiary: #e0f0e0;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-header: #5a9e5a;
  --bg-tab: #ecf8ec;
  --bg-tab-active: #5a9e5a;
  --bg-button: #5a9e5a;
  --bg-button-hover: #4d8a4d;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #c82333;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #218838;
  --bg-badge: #6c757d;
  --bg-expired: #f8d7da;
  --bg-expiring: #fff3cd;
  --bg-shopping-item: #eef8ee;
  
  --text-primary: #1f3d1f;
  --text-secondary: #4a6b4a;
  --text-muted: #7a9a7a;
  --text-header: #ffffff;
  --text-tab: #4a6b4a;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #5a9e5a;
  --text-expired: #721c24;
  --text-expiring: #856404;
  --text-input: #1f3d1f;
  
  --border-primary: #c8e6c8;
  --border-input: #b8d8b8;
  --border-card: #c8e6c8;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #5a9e5a;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.1);
  
  --accent: #5a9e5a;
  --accent-hover: #4d8a4d;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Тёмная OLED */
[data-theme="dark-oled"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #141414;
  --bg-card: #0d0d0d;
  --bg-input: #1a1a1a;
  --bg-modal-overlay: rgba(0, 0, 0, 0.8);
  --bg-header: #1a1a1a;
  --bg-tab: #0a0a0a;
  --bg-tab-active: #4a90d9;
  --bg-button: #4a90d9;
  --bg-button-hover: #5aa0e9;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #e04b59;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #34c759;
  --bg-badge: #333333;
  --bg-expired: #2d1215;
  --bg-expiring: #2d2400;
  --bg-shopping-item: #0d0d0d;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --text-header: #ffffff;
  --text-tab: #a0a0a0;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #6ab0ff;
  --text-expired: #ff6b6b;
  --text-expiring: #ffd43b;
  --text-input: #ffffff;
  
  --border-primary: #222222;
  --border-input: #333333;
  --border-card: #222222;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #4a90d9;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.5);
  
  --accent: #4a90d9;
  --accent-hover: #5aa0e9;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Тёмная синяя */
[data-theme="dark-blue"] {
  --bg-primary: #0d1b2a;
  --bg-secondary: #1b2838;
  --bg-tertiary: #253545;
  --bg-card: #152232;
  --bg-input: #1b2838;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-header: #1b3a5c;
  --bg-tab: #1b2838;
  --bg-tab-active: #4a90d9;
  --bg-button: #4a90d9;
  --bg-button-hover: #5aa0e9;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #e04b59;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #34c759;
  --bg-badge: #253545;
  --bg-expired: #3d1518;
  --bg-expiring: #3d3000;
  --bg-shopping-item: #152232;
  
  --text-primary: #e0e8f0;
  --text-secondary: #8899aa;
  --text-muted: #556677;
  --text-header: #ffffff;
  --text-tab: #8899aa;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #6ab0ff;
  --text-expired: #ff6b6b;
  --text-expiring: #ffd43b;
  --text-input: #e0e8f0;
  
  --border-primary: #2a4055;
  --border-input: #334d66;
  --border-card: #2a4055;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #4a90d9;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  --accent: #4a90d9;
  --accent-hover: #5aa0e9;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Тёмная зелёная */
[data-theme="dark-green"] {
  --bg-primary: #0d1f0d;
  --bg-secondary: #1a2e1a;
  --bg-tertiary: #253d25;
  --bg-card: #142814;
  --bg-input: #1a2e1a;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-header: #1a3d1a;
  --bg-tab: #1a2e1a;
  --bg-tab-active: #5a9e5a;
  --bg-button: #5a9e5a;
  --bg-button-hover: #6aae6a;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #e04b59;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #34c759;
  --bg-badge: #253d25;
  --bg-expired: #3d1518;
  --bg-expiring: #3d3000;
  --bg-shopping-item: #142814;
  
  --text-primary: #e0f0e0;
  --text-secondary: #88aa88;
  --text-muted: #557755;
  --text-header: #ffffff;
  --text-tab: #88aa88;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #6abf6a;
  --text-expired: #ff6b6b;
  --text-expiring: #ffd43b;
  --text-input: #e0f0e0;
  
  --border-primary: #2a552a;
  --border-input: #336633;
  --border-card: #2a552a;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #5a9e5a;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  --accent: #5a9e5a;
  --accent-hover: #6aae6a;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Тёмная серая (графит) */
[data-theme="dark-grey"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2e2e2e;
  --bg-card: #202020;
  --bg-input: #2a2a2a;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-header: #2a2a2a;
  --bg-tab: #242424;
  --bg-tab-active: #4a90d9;
  --bg-button: #4a90d9;
  --bg-button-hover: #5aa0e9;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #e04b59;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #34c759;
  --bg-badge: #333333;
  --bg-expired: #3d1518;
  --bg-expiring: #3d3000;
  --bg-shopping-item: #202020;
  
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --text-header: #ffffff;
  --text-tab: #a0a0a0;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #6ab0ff;
  --text-expired: #ff6b6b;
  --text-expiring: #ffd43b;
  --text-input: #e0e0e0;
  
  --border-primary: #333333;
  --border-input: #444444;
  --border-card: #333333;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #4a90d9;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  --accent: #4a90d9;
  --accent-hover: #5aa0e9;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Тёмная бордовая */
[data-theme="dark-maroon"] {
  --bg-primary: #1a0d0d;
  --bg-secondary: #2e1a1a;
  --bg-tertiary: #3d2525;
  --bg-card: #281414;
  --bg-input: #2e1a1a;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-header: #3d1a1a;
  --bg-tab: #2e1a1a;
  --bg-tab-active: #9e5a5a;
  --bg-button: #9e5a5a;
  --bg-button-hover: #ae6a6a;
  --bg-button-danger: #dc3545;
  --bg-button-danger-hover: #e04b59;
  --bg-button-success: #28a745;
  --bg-button-success-hover: #34c759;
  --bg-badge: #3d2525;
  --bg-expired: #4d1518;
  --bg-expiring: #3d3000;
  --bg-shopping-item: #281414;
  
  --text-primary: #f0e0e0;
  --text-secondary: #aa8888;
  --text-muted: #775555;
  --text-header: #ffffff;
  --text-tab: #aa8888;
  --text-tab-active: #ffffff;
  --text-button: #ffffff;
  --text-button-danger: #ffffff;
  --text-link: #bf6a6a;
  --text-expired: #ff6b6b;
  --text-expiring: #ffd43b;
  --text-input: #f0e0e0;
  
  --border-primary: #552a2a;
  --border-input: #663333;
  --border-card: #552a2a;
  --border-expired: #dc3545;
  --border-expiring: #ffc107;
  --border-focus: #9e5a5a;
  
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  --accent: #9e5a5a;
  --accent-hover: #ae6a6a;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* ============================================
   Базовые стили
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================
   Экран авторизации
   ============================================ */

.auth-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  padding: 20px;
}

.auth-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-card);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 1.75rem;
  color: var(--text-primary);
}

.auth-container .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-primary);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-input);
  color: var(--text-input);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.form-group .checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--bg-button);
  color: var(--text-button);
}

.btn-primary:hover {
  background: var(--bg-button-hover);
}

.btn-danger {
  background: var(--bg-button-danger);
  color: var(--text-button-danger);
}

.btn-danger:hover {
  background: var(--bg-button-danger-hover);
}

.btn-success {
  background: var(--bg-button-success);
  color: var(--text-button);
}

.btn-success:hover {
  background: var(--bg-button-success-hover);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.875rem;
}

.btn-icon {
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 50%;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.auth-error {
  background: var(--bg-expired);
  color: var(--text-expired);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.auth-error.visible {
  display: block;
}

/* ============================================
   Основной экран приложения
   ============================================ */

.app-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}

.app-screen.visible {
  display: flex;
}

/* Шапка */
.app-header {
  background: var(--bg-header);
  color: var(--text-header);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-header);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Навигация (вкладки) */
.app-nav {
  display: flex;
  background: var(--bg-tab);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 57px;
  z-index: 99;
}

.nav-tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-tab);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nav-tab .tab-icon {
  font-size: 1.25rem;
}

.nav-tab.active {
  color: var(--text-tab-active);
  border-bottom-color: var(--accent);
  background: var(--bg-tab-active);
}

.nav-tab .badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Контент */
.app-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   Фильтры и поиск
   ============================================ */

.filters-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
}

.search-input {
  position: relative;
  margin-bottom: 12px;
}

.search-input input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-input);
  color: var(--text-input);
}

.search-input .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row select {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-input);
  color: var(--text-input);
}

/* ============================================
   Карточки товаров
   ============================================ */

.items-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.item-card {
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  transition: all 0.2s;
}

.item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.item-card.expired {
  border-color: var(--border-expired);
  border-width: 2px;
}

.item-card.expiring {
  border-color: var(--border-expiring);
}

.card-category {
  flex: 0 0 25%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  text-align: center;
}

.card-category .category-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.card-category .category-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-content {
  flex: 0 0 75%;
  padding: 16px;
  background: var(--bg-card);
}

.item-card.expired .card-content {
  background: var(--bg-expired);
}

.item-card.expiring .card-content {
  background: var(--bg-expiring);
}

.item-subcategory {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-primary);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.item-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.item-quantity {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.item-card.expired .item-quantity {
  color: var(--danger);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.item-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.item-batches {
  margin-bottom: 12px;
}

.batch-item {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.batch-item.expired {
  background: var(--bg-expired);
  color: var(--text-expired);
}

.batch-item.expiring {
  background: var(--bg-expiring);
  color: var(--text-expiring);
}

.batch-info {
  flex: 1;
}

.batch-quantity {
  font-weight: 600;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.item-actions .btn {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.8rem;
}


/* Пустое состояние */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  min-height: 300px;
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

/* ============================================
   Список покупок
   ============================================ */

.shopping-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopping-item {
  background: var(--bg-shopping-item);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.shopping-item-info {
  flex: 1;
}

.shopping-item-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.shopping-item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.shopping-item-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   Список выбора товара (модалка)
   ============================================ */

.select-item-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.select-item {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.select-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
}

.select-item:active {
  background: var(--bg-active);
}

.select-item-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.select-item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============================================
   Профиль
   ============================================ */

.profile-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
}

.profile-section h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-primary);
}

.profile-info .info-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-info .info-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Выбор темы */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.theme-option {
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.theme-option:hover {
  border-color: var(--accent);
}

.theme-option.active {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.theme-option .theme-preview {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.theme-option .theme-name {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Превью тем */
.theme-preview-light-default { background: linear-gradient(135deg, #ffffff 50%, #f5f5f5 50%); }
.theme-preview-light-warm-orange { background: linear-gradient(135deg, #fff8f0 50%, #fff0e0 50%); }
.theme-preview-light-warm-brown { background: linear-gradient(135deg, #faf6f1 50%, #f0e8dc 50%); }
.theme-preview-light-warm-beige { background: linear-gradient(135deg, #fdfbf7 50%, #f5f0e6 50%); }
.theme-preview-light-cool-lavender { background: linear-gradient(135deg, #f8f6fc 50%, #f0ecf8 50%); }
.theme-preview-light-cool-green { background: linear-gradient(135deg, #f6fcf6 50%, #ecf8ec 50%); }
.theme-preview-dark-oled { background: linear-gradient(135deg, #000000 50%, #0a0a0a 50%); }
.theme-preview-dark-blue { background: linear-gradient(135deg, #0d1b2a 50%, #1b2838 50%); }
.theme-preview-dark-green { background: linear-gradient(135deg, #0d1f0d 50%, #1a2e1a 50%); }
.theme-preview-dark-grey { background: linear-gradient(135deg, #1a1a1a 50%, #242424 50%); }
.theme-preview-dark-maroon { background: linear-gradient(135deg, #1a0d0d 50%, #2e1a1a 50%); }

/* ============================================
   Модальные окна
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-modal-overlay);
  display: none;
  justify-content: center;
  align-items: flex-end;
  z-index: 1000;
  padding: 0;
}

.modal-overlay.visible {
  display: flex;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.modal {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.3s ease;
}

@media (min-width: 768px) {
  .modal {
    border-radius: 16px;
    animation: fadeIn 0.3s ease;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-primary);
}

.modal-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   Сканер штрихкода
   ============================================ */

.scanner-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

#scanner-reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.scanner-result {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  text-align: center;
}

.scanner-result .barcode-value {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
}

/* ============================================
   Уведомления
   ============================================ */

.notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-card);
  z-index: 2000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}

.notification.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.notification.success {
  border-color: var(--success);
}

.notification.error {
  border-color: var(--danger);
}

.notification.warning {
  border-color: var(--warning);
}

/* ============================================
   Кнопка добавления товара (FAB)
   ============================================ */

.fab-button {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-button);
  color: var(--text-button);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-button:hover {
  background: var(--bg-button-hover);
  transform: scale(1.05);
}

.fab-button:active {
  transform: scale(0.95);
}

/* ============================================
   Динамические строки партий
   ============================================ */

.batch-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.batch-row .form-group {
  margin-bottom: 0;
}

.batch-row .remove-batch {
  align-self: center;
  margin-top: 12px;
}

.add-batch-row {
  margin-top: 12px;
}

/* ============================================
   Локация хранения
   ============================================ */

.storage-locations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.location-tag {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================
   Адаптивность
   ============================================ */

@media (max-width: 480px) {
  .auth-container {
    padding: 24px;
  }
  
  .item-actions .btn {
    font-size: 0.75rem;
    padding: 6px 8px;
  }
  
  .filter-row {
    flex-direction: column;
  }
  
  .filter-row select {
    min-width: 100%;
  }
  
  .batch-row {
    grid-template-columns: 1fr;
  }
  
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .item-card {
    flex-direction: column;
  }
  
  .card-category {
    flex: none;
    flex-direction: row;
    gap: 8px;
    padding: 12px;
  }
  
  .card-category .category-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
  }
  
  .card-content {
    flex: none;
  }
}

@media (min-width: 768px) {
  .app-content {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
  }
  
  .items-list {
    gap: 16px;
  }
}

/* ============================================
   Утилиты
   ============================================ */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Спиннер загрузки */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-primary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-modal-overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* Чекбокс в стиле iOS */
.toggle-checkbox {
  appearance: none;
  width: 48px;
  height: 26px;
  background: var(--border-input);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-checkbox::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-checkbox:checked {
  background: var(--accent);
}

.toggle-checkbox:checked::after {
  transform: translateX(22px);
}

/* Список с чекбоксами */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border-card);
}

.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Разделитель */
.divider {
  height: 1px;
  background: var(--border-primary);
  margin: 16px 0;
}
