:root {
  --bg: #FDFBF7;
  --card: #FFFFFF;
  --line: #E0DCD3;
  --text: #3E2723;
  --muted: #795548;
  --soft: #A1887F;
  --green: #2E7D32;
  --green-2: #4CAF50;
  --green-bg: #E8F5E9;
  --orange: #E65100;
  --orange-bg: #FFF3E0;
  --blue: #1565C0;
  --blue-bg: #E3F2FD;
  --pink: #C2185B;
  --pink-bg: #FCE4EC;
  --chip: #EFEBE1;
  --radius: 14px;
  font-family: "Avenir Next", "Avenir", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 16px; -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
input, textarea { font: inherit; color: var(--text); }
a { color: var(--green); }

/* ---------- hlavička */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 12px;
}
.logo { font-size: 26px; font-weight: 800; color: var(--green); white-space: nowrap; }
.head-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status { background: #F0ECE3; color: var(--muted); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.status.busy { background: var(--orange-bg); color: var(--orange); }
.user-btn { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--muted); font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- rozložení */
.app {
  display: grid; grid-template-columns: minmax(280px, 2fr) 3fr; gap: 20px;
  padding: 0 24px; height: calc(100vh - 66px - 150px); min-height: 380px;
}
.chat-col, .panel-col { display: flex; flex-direction: column; min-height: 0; }
.col-title { color: var(--muted); font-weight: 700; margin: 4px 0 10px; }
.chat {
  flex: 1; overflow-y: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.msg { margin: 0 0 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg b { color: var(--green); }
.msg.you b { color: var(--text); }
.msg.err { color: #B71C1C; }
.msg.err b { color: #B71C1C; }
.msg.bot { color: var(--muted); font-size: 14px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px; font-weight: 700; color: var(--muted); font-size: 15px;
}
.tab.active { background: var(--green-2); border-color: #388E3C; color: #fff; }
/* Na počítači záložky vyplní celou šířku panelu rovnoměrně, stejně jako v desktopové aplikaci */
@media (min-width: 861px) { .tab { flex: 1 0 auto; text-align: center; white-space: nowrap; } }
.tab.mobile-only { display: none; }
.panel {
  flex: 1; overflow-y: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.view { display: none; }
.view.active { display: block; }

/* ---------- jídelníček */
.day { margin-bottom: 22px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-title { color: var(--green); font-size: 21px; font-weight: 800; }
.day-sum { color: var(--green-2); font-weight: 700; font-size: 15px; margin: 4px 0 8px; }
.meal { padding: 7px 0; border-bottom: 1px dashed #EEE9DF; }
.meal:last-child { border-bottom: none; }
.meal-type { font-weight: 700; }
.meal-name { font-style: italic; }
.meal-macros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.small-btn { background: var(--chip); color: #5D4037; border: none; border-radius: 7px; padding: 4px 9px; font-size: 13px; }
.dessert-btn { background: var(--pink-bg); color: var(--pink); border: none; border-radius: 12px; padding: 6px 12px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.note { color: var(--soft); font-size: 13px; line-height: 1.4; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; line-height: 1.5; }

/* ---------- recepty */
.recipe { margin-bottom: 16px; }
.recipe h4 { margin: 0 0 4px; }
.recipe ol { margin: 4px 0 0 0; padding-left: 22px; line-height: 1.5; }
.recipe .ingr { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- nákup a spíž */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.list-head h3 { margin: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost-btn { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; color: var(--muted); font-size: 14px; font-weight: 600; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #F3EFE7; }
.item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green-2); flex: 0 0 auto; }
.item label { flex: 1; line-height: 1.35; }
.item.done label { color: #BCAAA4; text-decoration: line-through; }
.mark { color: var(--muted); font-size: 13px; white-space: nowrap; }
.mark.warn { color: #C62828; }
.del-btn { background: none; border: none; font-size: 15px; padding: 4px 8px; border-radius: 50%; }
.del-btn:hover { background: #FFEBEE; }
.section-title { color: var(--muted); font-weight: 700; margin: 16px 0 4px; }
.add-row { display: flex; gap: 8px; margin-bottom: 8px; }
.add-row input { flex: 1; min-width: 0; }

/* ---------- profil */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; color: #5D4037; margin-bottom: 6px; font-size: 15px; }
.input, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; background: var(--bg); font-size: 16px;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { outline: none; border-color: var(--green-2); }
.shop-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.shop-btn { background: #fff; color: #5D4037; border: 1px solid var(--line); border-radius: 10px; padding: 10px 20px; font-weight: 700; font-size: 16px; }
.shop-btn.active { background: var(--green-2); color: #fff; border-color: #388E3C; }
.shop-status { font-size: 14px; color: var(--muted); }
.primary { background: var(--green-2); color: #fff; border: none; border-radius: 10px; padding: 13px 18px; font-weight: 700; font-size: 16px; width: 100%; }
.danger-link { background: none; border: none; color: #B71C1C; text-decoration: underline; padding: 0; font-size: 14px; }

/* ---------- akce a vstup dole */
.bottom { padding: 14px 24px 18px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.action {
  border-radius: 999px; padding: 13px 10px; font-weight: 800; font-size: 16px; border: 2px solid; background: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.a-new { border-color: #A5D6A7; color: var(--green); }
.a-zero { border-color: #FFB74D; color: var(--orange); background: var(--orange-bg); }
.a-deals { border-color: var(--green-2); color: var(--green); background: var(--green-bg); }
.a-order { border-color: #64B5F6; color: var(--blue); background: var(--blue-bg); }
.input-row { display: flex; gap: 10px; }
.input-row input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 999px; padding: 13px 20px; background: #fff; font-size: 16px; }
.input-row input:focus { outline: none; border-color: var(--green-2); }
.mic { background: #fff; border: 2px solid var(--line); border-radius: 999px; width: 50px; flex: 0 0 50px; font-size: 20px; }
.mic.listening { border-color: #E53935; background: #FFEBEE; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 6px rgba(229, 57, 53, .18); } }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; } }
.send { background: var(--green-2); color: #fff; border: none; border-radius: 999px; padding: 0 26px; font-weight: 800; font-size: 16px; }

/* ---------- okno 'Na kolik dní?' */
.modal-back { position: fixed; inset: 0; background: rgba(62, 39, 35, .35); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal-back.open { display: flex; }
.modal { background: var(--bg); border-radius: 18px; padding: 24px; max-width: 460px; width: 100%; }
.modal h3 { color: var(--green); margin: 0 0 6px; font-size: 21px; }
.modal p { color: var(--muted); margin: 0 0 16px; line-height: 1.4; }
.days-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.day-btn { background: #fff; color: #5D4037; border: 1px solid var(--line); border-radius: 10px; padding: 12px 6px; font-weight: 700; }
.day-btn.default { background: var(--green-2); color: #fff; border-color: #388E3C; }
.modal .cancel { background: none; border: none; color: var(--muted); margin-top: 14px; float: right; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 15px; display: none; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* ---------- telefon a tablet na výšku */
.user-menu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(62, 39, 35, .15); padding: 6px; min-width: 210px; z-index: 20; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 10px; padding: 10px 12px; font-size: 15px; color: inherit; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: #F5F1EA; }
.menu-item.active { font-weight: 700; color: var(--green); }
.menu-item.active::after { content: " ✓"; }
.menu-item.muted { color: var(--muted); font-size: 14px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.count-select { width: auto; min-width: 140px; }
.member { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fff; }
.member-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; color: var(--green); }
.member-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.member-grid .wide { grid-column: span 2; }
.member-grid .full { grid-column: 1 / -1; }
.member-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.member-grid .input { width: 100%; box-sizing: border-box; }
.member-kcal { font-size: 13px; color: var(--muted); font-weight: 600; }
.portions { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.family-day { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.report-btn { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.report-btn:hover { color: var(--green); border-color: var(--green-2); }
.report-modal textarea { min-height: 110px; width: 100%; box-sizing: border-box; }
.report-file { display: inline-block; margin-top: 12px; color: var(--green); font-weight: 600; cursor: pointer; }
.report-file input { display: block; margin-top: 6px; font-size: 13px; max-width: 100%; }
.report-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.report-actions .cancel { float: none; margin-top: 0; }
.report-actions .primary { width: auto; }
@media (max-width: 860px) {
  .member-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-label { display: none; }
  header { padding: 10px 16px; }
  .logo { font-size: 22px; }
  .app { display: block; padding: 0 16px; height: auto; min-height: 0; }
  .chat-col { display: none; }
  .chat-col.shown { display: flex; }
  .chat-col .col-title { display: none; }
  .tab.mobile-only { display: block; }
  .panel { overflow: visible; padding: 16px; }
  .chat { max-height: none; min-height: 50vh; }
  .bottom { position: sticky; bottom: 0; background: var(--bg); padding: 10px 16px 14px; border-top: 1px solid var(--line); }
  .actions { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
  .action { font-size: 14px; padding: 10px 6px; }
  .send { padding: 0 18px; }
}

@media print {
  header, .bottom, .tabs, .chat-col, .list-head .btn-row, .no-print { display: none !important; }
  .app { display: block; height: auto; padding: 0; }
  .panel { border: none; overflow: visible; }
}
