:root {
  --bg-dark: #1B332B;
  --bg-card: #F4F1EA;
  --text-dark: #1B332B;
  --text-light: #F4F1EA;
  --accent: #C6A87C;
  --input-bg: #FFFFFF;
  --border: #D8D2C4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-dark); 
  color: var(--text-light);
  font-family: 'Montserrat', sans-serif; 
  line-height: 1.5;
  padding: 20px; 
  min-height: 100vh;
}
.container { max-width: 1000px; margin: 0 auto; }

.header { text-align: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid rgba(244, 241, 234, 0.2); }
.header-top { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.site-logo { height: 48px; width: auto; border-radius: 8px; }
h1 { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; margin: 0; }
.subtitle { font-size: 13px; color: var(--text-light); opacity: 0.8; font-style: italic;}

.guide-section {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center;
  background: rgba(244, 241, 234, 0.05); border: 1px solid rgba(244, 241, 234, 0.1);
  border-radius: 12px; padding: 20px; margin-bottom: 24px; color: var(--text-light);
}
.guide-text h2 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--accent); margin-bottom: 10px; }
.guide-text p { font-size: 13px; color: #ccc; margin-bottom: 12px; line-height: 1.5; }
.guide-rules { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.guide-rules li { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500;}
.guide-rules .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.guide-note {
  background: rgba(198, 168, 124, 0.15);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: #E8E2D9;
  font-weight: 500;
  line-height: 1.6;
}

.guide-image { width: 100%; height: 100%; max-height: 220px; border-radius: 8px; object-fit: contain; background-color: #12241E; }

.calculator-wrapper {
  background: #ffffff; border-radius: 16px; padding: 24px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 2px var(--accent);
  margin-bottom: 32px; color: var(--text-dark);
}
.calc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 12px; }
.calc-header h2 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--text-dark); margin: 0; }
.calc-icon { width: 36px; height: 36px; background: var(--bg-dark); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 18px; }

.food-list { display: flex; flex-direction: column; gap: 12px; }
.food-item {
  display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 1fr 1fr 1fr 36px;
  gap: 8px; align-items: end; background: #FAFAF8;
  padding: 12px; border-radius: 10px; border: 1px solid var(--border); position: relative;
}
.field-group { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field-group label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #5A6B62; font-weight: 600; white-space: nowrap;}

input, select {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text-dark);
  padding: 8px 10px; border-radius: 6px; font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 500;
  width: 100%; transition: border-color 0.2s;
}
input:focus { outline: none; border-color: var(--accent); }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Обновленные кнопки */
.btn { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 12px; padding: 12px 24px; border-radius: 8px; border: none; cursor: pointer; transition: all 0.2s; text-transform: uppercase; }
.btn-primary { background: var(--bg-dark); color: var(--accent); }
.btn-primary:hover { background: #12241E; }
.btn-outline { background: transparent; border: 1px solid var(--bg-dark); color: var(--bg-dark); }
.btn-outline:hover { background: rgba(27, 51, 43, 0.05); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  align-items: center;
}
.actions #calcBtn {
  border: none;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
}

.btn-remove { background: transparent; border: 1px solid var(--border); color: #999; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; align-self: end; }
.btn-remove:hover { border-color: #d32f2f; color: #d32f2f; }

#results { display: none; background: var(--bg-card); padding: 24px; border-radius: 16px; margin-bottom: 24px; color: var(--text-dark); }

.overall-status {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; border-radius: 12px; margin-bottom: 24px;
  font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700;
  transition: background 0.3s, color 0.3s;
}
.overall-status.green { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.overall-status.yellow { background: #FFF8E1; color: #F57C00; border: 1px solid #FFE082; }
.overall-status.red { background: #FFEBEE; color: #C62828; border: 1px solid #FFCDD2; }
.status-icon { font-size: 24px; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.pie-chart { width: 180px; height: 180px; border-radius: 50%; margin: 0 auto 16px; 
  background: conic-gradient(var(--prot-color) 0% var(--prot-pct), var(--fat-color) var(--prot-pct) calc(var(--prot-pct) + var(--fat-pct)), var(--carb-color) calc(var(--prot-pct) + var(--fat-pct)) 100%); 
  position: relative; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pie-chart::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 90px; height: 90px; background: var(--bg-card); border-radius: 50%; }

.legend { display: flex; flex-direction: column; gap: 6px; max-width: 250px; margin: 0 auto; color: var(--text-dark); }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;}
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-pct { font-weight: 700; margin-left: auto; }

.fiber-bar-container { margin-top: 20px; padding: 16px; background: #FAFAF8; border-radius: 10px; border: 1px solid var(--border); }
.fiber-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-dark);}
.fiber-progress { width: 100%; height: 12px; background: #E0E0E0; border-radius: 6px; overflow: hidden; }
.fiber-fill { height: 100%; background: #4CAF50; transition: width 0.5s ease-in-out; }
.fiber-text { font-size: 11px; color: #777; margin-top: 6px; text-align: right; }

.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 13px; font-weight: 500; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; }

.verdict { margin-top: 24px; padding: 16px; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 500;
  background: #FAFAF8; border: 1px solid var(--border); color: var(--text-dark); line-height: 1.5;}
.verdict ul { list-style: none; margin-top: 8px; text-align: left; display: inline-block; font-size: 13px; }
.verdict li { margin-bottom: 6px; display: flex; align-items: flex-start; gap: 8px;}
.verdict li::before { content: '•'; color: var(--accent); font-weight: bold;}

.cta { background: #12241E; border: 1px solid var(--accent); border-radius: 16px; padding: 32px 24px; text-align: center; margin-top: 32px; }
.cta h2 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--accent); margin-bottom: 10px; }
.cta p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }
.cta .btn { font-size: 14px; padding: 14px 32px; background: var(--accent); color: var(--bg-dark); text-decoration: none; display: inline-block;}
.cta .btn:hover { background: #D4BA92; }

.autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--input-bg); border: 1px solid var(--accent); border-radius: 6px; margin-top: 4px; max-height: 200px; overflow-y: auto; z-index: 100; list-style: none; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.autocomplete-list li { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-list li:hover { background: #F0EFEA; }
.ac-name { font-weight: 600; font-size: 12px; color: var(--text-dark); }
.ac-meta { font-size: 10px; color: #777; margin-top: 2px; }
.empty-state { text-align: center; padding: 24px; color: #777; font-style: italic; font-size: 13px;}

@media (max-width: 860px) {
  .guide-section { grid-template-columns: 1fr; }
  .food-item { grid-template-columns: 1fr 1fr; gap: 8px; }
  .food-item .field-group:nth-child(1) { grid-column: 1 / -1; }
  .btn-remove { grid-column: 1 / -1; width: 100%; height: 32px; }
  
  .actions { flex-direction: column; align-items: stretch; }
  .actions #calcBtn { margin-left: 0; width: 100%; }
}