/* Obědy – vzhled podle autronic.cz: bílá, zlatohnědá #BF8C59, tmavě hnědá #3D2F1A, písmo Montserrat. */
:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #fbf7f2;
  --line: #e4ded6;
  --text: #2f2a24;
  --muted: #7a726a;
  --gold: #bf8c59;
  --gold-dark: #9f7347;
  --gold-soft: #fbeddf;
  --brown: #3d2f1a;
  --ok: #0a8a00;
  --ok-soft: #def2e8;
  --warn: #b26a00;
  --warn-soft: #fff3e0;
  --error: #c62828;
  --error-soft: #ffe8e8;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { color: var(--brown); line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
a { color: var(--gold-dark); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--error); min-height: 1.2em; margin: 8px 0 0; }
.error:empty { margin: 0; min-height: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
[hidden] { display: none !important; }

/* ===== Tlačítka a pole ===== */
.btn, button {
  font: inherit;
  cursor: pointer;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--gold-dark); text-decoration: underline; font-weight: 600; }

label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* bez automatického zoomu na iPhonu */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(191, 140, 89, 0.3);
}
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); display: inline-block; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ===== Přihlášení ===== */
.login-page { min-height: 100vh; background: linear-gradient(180deg, var(--gold-soft) 0%, var(--bg) 320px) no-repeat, var(--bg); }
.login { max-width: 400px; margin: 0 auto; padding: 48px 16px; text-align: center; }
.login-logo { width: 180px; height: auto; }
.login h1 { margin: 20px 0 4px; font-size: 28px; }
.login form { margin-top: 24px; text-align: left; }
.hint { margin: 0 0 12px; padding: 10px 12px; background: var(--gold-soft); border-radius: var(--radius); font-size: 14px; }

/* ===== Horní lišta ===== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner, .tabs, .wrap { max-width: 920px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 110px; height: auto; }
.brand span { padding-left: 12px; border-left: 1px solid var(--line); color: var(--brown); font-weight: 700; font-size: 18px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; text-align: right; }
.who #me { font-weight: 600; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
}
.tabs button.active { color: var(--brown); border-bottom-color: var(--gold); }
.tabs button[data-admin] { color: var(--gold-dark); }

.wrap { padding-top: 16px; padding-bottom: 48px; }

/* ===== Lišta nad obsahem (týden, osoba) ===== */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.bar .grow { flex: 1; }
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav strong { min-width: 150px; text-align: center; }
.bar select { width: auto; margin: 0; min-width: 200px; }

.summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 14px; padding: 12px 16px;
  background: var(--brown); color: #fff; border-radius: var(--radius);
}
.summary strong { font-size: 20px; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--error-soft); color: var(--error); }
.badge.info { background: var(--gold-soft); color: var(--gold-dark); }

/* ===== Výběr dne Po–Pá ===== */
.daychips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.daychips button {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.daychips .dn { font-weight: 700; text-transform: capitalize; color: var(--brown); }
.daychips .dd { font-size: 12px; color: var(--muted); }
.daychips .ds { font-size: 12px; font-weight: 600; color: var(--gold-dark); white-space: nowrap; }
.daychips button.active { background: var(--gold); border-color: var(--gold); }
.daychips button.active span { color: #fff; }

/* ===== Den s jídly ===== */
.day { margin-bottom: 14px; padding: 0; overflow: hidden; }
.day.past .day-head { background: #efebe6; }
.day-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.day-head h3 { text-transform: capitalize; }
.day-head .day-total { font-weight: 700; }
.day.today .day-head { background: var(--gold-soft); }
.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
/* Objednané jídlo: celý řádek zelený (i po uzávěrce) */
.item.chosen { background: var(--ok-soft); box-shadow: inset 4px 0 0 var(--ok); }
.item.chosen .item-name { font-weight: 700; }
.code {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--gold-soft); color: var(--gold-dark); font-weight: 700;
}
.item.chosen .code { background: var(--ok); color: #fff; }
.item.locked:not(.chosen) { color: var(--muted); }
.order-btn {
  min-width: 118px; min-height: 38px; padding: 6px 12px;
  border: 1px solid var(--gold); border-radius: var(--radius);
  background: var(--surface); color: var(--gold-dark); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.order-btn:hover { background: var(--gold-soft); }
.order-btn.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.order-btn.on:hover { background: #087000; }
.order-group {
  display: flex; align-items: center; min-width: 118px; height: 38px;
  border-radius: var(--radius); overflow: hidden; background: var(--ok); color: #fff;
}
.order-group button {
  width: 34px; height: 100%; border: 0; background: transparent; color: #fff; font-size: 18px; font-weight: 700;
}
.order-group button:hover:not(:disabled) { background: #087000; }
.order-group button:disabled { color: rgba(255, 255, 255, 0.4); cursor: default; }
.order-group span { flex: 1; text-align: center; font-weight: 700; font-size: 14px; white-space: nowrap; padding: 0 4px; }
.order-btn.static { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.order-btn.static:hover { background: var(--ok); }
.item-name { font-weight: 500; }
.item-meta { color: var(--muted); font-size: 12px; }
.item-side { display: flex; align-items: center; gap: 10px; }
.price { text-align: right; font-weight: 600; white-space: nowrap; }
.price small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: var(--surface); font-size: 18px; font-weight: 700; color: var(--gold-dark); }
.stepper button:hover:not(:disabled) { background: var(--gold-soft); }
.stepper button:disabled { color: #ccc; cursor: default; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }
.lock { font-size: 12px; color: var(--muted); white-space: nowrap; }
.day-note { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.day-note input { margin: 0; font-size: 14px; }
.empty { padding: 16px; color: var(--muted); }

@media (max-width: 560px) {
  .item { grid-template-columns: 32px 1fr; }
  .item-side { grid-column: 2; justify-content: space-between; }
  .brand img { width: 84px; }
  .brand span { font-size: 16px; }
  .who { font-size: 13px; gap: 8px; }
  .who #me { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .weeknav strong { min-width: 0; }
  .bar select { min-width: 0; width: 100%; }
}

/* ===== Tabulky (admin, vyúčtování) ===== */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  padding: 10px 12px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
tr.grp td { background: var(--surface-2); font-weight: 700; color: var(--brown); font-size: 13px; }
tr.paid td { color: var(--muted); }
tfoot td { font-weight: 700; background: var(--surface-2); }
td input:not([type="checkbox"]), td select { margin: 0; padding: 6px 8px; font-size: 14px; }

.vyloha-price { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; font-weight: 400; color: var(--muted); }
.vyloha-price input { width: 72px; margin: 0; padding: 4px 6px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stack > * + * { margin-top: 14px; }
.counts { list-style: none; margin: 0; padding: 0; }
.counts li { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.counts li:last-child { border-bottom: 0; }
.counts .q { font-size: 18px; font-weight: 700; }
.counts li.zero { color: #b5ada5; }
.counts li.zero .q { font-weight: 400; }
pre.copy { white-space: pre-wrap; margin: 0; padding: 12px; background: var(--surface-2); border-radius: var(--radius); font: 13px/1.5 ui-monospace, Consolas, monospace; }
.phone { font-size: 20px; font-weight: 700; text-decoration: none; }

/* ===== Patička ===== */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1; width: 100%; }
.site-footer {
  padding: 18px 16px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer a { color: var(--gold-dark); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.login-page .site-footer { border-top: 0; }

/* ===== Hláška dole ===== */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: var(--radius);
  background: var(--brown); color: #fff; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--error); }
