:root {
  --bg: #f6f1e7;
  --card: #fffdf7;
  --text: #3d2a17;
  --muted: #7d6a57;
  --accent: #7a2e12;
  --accent-text: #fff;
  --line: #e2d6c3;
  --error: #b3261e;
  --ok: #2e6b33;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.top { text-align: center; margin-bottom: 16px; }
.brand { margin: 0; font-weight: 900; font-size: 20px; letter-spacing: -0.5px; }
.brand span { color: var(--accent); }
h1 { margin: 6px 0 0; font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.intro { margin: 0 0 12px; }
.center { text-align: center; padding: 32px 0; }

.dish {
  margin: 0 0 14px;
  padding: 12px 14px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.dish legend { padding: 0 6px; font-weight: 700; }

label { display: block; margin-bottom: 10px; font-size: 15px; font-weight: 600; }

input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[aria-invalid] { border-color: var(--error); }

button {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }

.actions { display: flex; gap: 12px; margin-top: 12px; }
.actions button { flex: 1; }

.story {
  display: block;
  width: 100%;
  max-height: 70vh;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--line);
}

.feed {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  margin-top: 12px;
  border-radius: var(--radius);
  background: var(--line);
}
.label { margin: 16px 0 6px; font-weight: 700; }

.error { color: var(--error); font-weight: 600; margin: 4px 0 8px; }
.error:empty { display: none; }
.success { color: var(--ok); font-weight: 700; font-size: 20px; text-align: center; margin: 0 0 12px; }

.dish-list { padding-left: 20px; }
.dish-list li { margin-bottom: 6px; }

[hidden] { display: none !important; }

/* --- admin ------------------------------------------------------------------------------- */
.wrap.wide { max-width: 1100px; }
.admin h1 { font-size: 24px; margin: 16px 0; }
.admin h2 { font-size: 18px; margin: 0 0 8px; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.admin-nav .brand { margin-right: auto; }
.admin a { color: var(--accent); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.small { font-size: 14px; }
a.button { display: inline-block; text-decoration: none; text-align: center; border-radius: 12px; font-weight: 700; padding: 10px 16px; }
a.button.primary { color: var(--accent-text); }
button.small, a.button.small { width: auto; min-height: 40px; padding: 8px 14px; }
button.link { display: inline; width: auto; min-height: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; font-weight: 600; }
form.inline { display: inline; }
.admin-form { max-width: 520px; }
.admin-form button[type=submit] { margin-top: 8px; }
.colors { display: flex; gap: 16px; flex-wrap: wrap; }
.colors label { flex: 1; min-width: 120px; }
input[type=color] { padding: 4px; min-height: 48px; }
select { display: block; min-height: 44px; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 12px; }
.filters label { margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { margin: 0; font-size: 14px; }
.copy-row button { flex: none; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px; border-bottom: 1px solid var(--line); }
th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
tr.inactive td { color: var(--muted); }
table.counts td:not(:first-child), table.counts th:not(:first-child) { text-align: right; }
.err-text { color: var(--error); font-size: 13px; max-width: 260px; overflow-wrap: anywhere; margin: 4px 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--line); color: var(--text); }
.badge.published, .badge.ok { background: #dcecd9; color: var(--ok); }
.badge.partial, .badge.pending { background: #f6e7c1; color: #7a5a00; }
.badge.failed, .badge.error { background: #f6d6d3; color: var(--error); }

.flash { padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.flash.ok { background: #dcecd9; color: var(--ok); }
.flash.err { background: #f6d6d3; color: var(--error); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table-scroll table { min-width: 560px; }
.today-post { padding: 8px 0; border-bottom: 1px solid var(--line); }
.today-post:last-child { border-bottom: 0; }
.upcoming { margin: 0; padding-left: 18px; }
.upcoming li { margin: 4px 0; }
form.repost { margin-top: 8px; }

/* Phones: tables become cards, controls stack, bigger tap targets. */
@media (max-width: 700px) {
  .admin h1 { font-size: 22px; margin: 12px 0; }
  .admin-nav { gap: 0 2px; padding-bottom: 6px; }
  .admin-nav .brand { width: 100%; margin-bottom: 2px; }
  .admin-nav a, .admin-nav button.link { display: inline-block; padding: 10px 8px; min-height: 44px; }
  .card { padding: 12px; }
  .row-between a.button { width: 100%; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select, .filters input { width: 100%; }
  .filters button { width: 100%; }
  .copy-row { flex-direction: column; align-items: stretch; }
  .copy-row button { width: 100%; }
  .err-text { max-width: none; }

  table.posts thead, table.restaurants thead { display: none; }
  table.posts, table.restaurants { background: transparent; }
  table.posts tr, table.restaurants tr {
    display: block;
    margin-bottom: 12px;
    padding: 8px 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  table.posts td, table.restaurants td { display: block; border: 0; padding: 4px 12px; }
  table.posts td[data-label]::before, table.restaurants td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 13px;
  }
  table.restaurants td.name { font-size: 18px; font-weight: 700; }
  table.restaurants button.link, table.posts button.link { padding: 8px 0; }
  form.repost button { width: 100%; }
}

/* --- public page ------------------------------------------------------------------------- */
.public h1 { font-size: 28px; }
.gablec {
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--r-bg, var(--card));
  color: var(--r-text, var(--text));
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.gablec h2 {
  margin: 0 0 10px;
  font: 900 24px/1.15 Georgia, "Times New Roman", serif;
  color: var(--r-accent, var(--accent));
  overflow-wrap: anywhere;
}
.gablec .menu { list-style: none; margin: 0; padding: 0; }
.gablec .menu li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 12px;
  padding: 8px 0;
  border-top: 1px solid color-mix(in srgb, var(--r-text, var(--text)) 18%, transparent);
}
.gablec .menu li:first-child { border-top: 0; }
.gablec .dish-name { font-weight: 700; }
.gablec .price { color: var(--r-accent, var(--accent)); font-weight: 700; white-space: nowrap; }
.gablec .dish-desc { grid-column: 1 / -1; font-size: 15px; opacity: 0.85; }
.gablec .note { margin: 10px 0 0; color: var(--r-accent, var(--accent)); font-weight: 600; }
.gablec .links { margin: 10px 0 0; font-size: 15px; }
.gablec a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.gablec .links a { display: inline-block; padding: 6px 0; }
.card.empty { text-align: center; }
.public-footer { text-align: center; margin-top: 24px; }
.public-footer a, .card.empty a { color: var(--accent); }

/* --- weekly menu ------------------------------------------------------------------------- */
.week-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.week-tabs button { flex: 1; }
.week-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.day.locked { opacity: 0.75; }
.day .day-status { margin: 0 0 8px; }
.dish-row { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.dish-row:last-child { border-bottom: 0; }
.dish-row input { margin-top: 0; }
.day-actions { display: flex; align-items: center; gap: 16px; margin: 4px 0 10px; }
.day-preview-img { margin-bottom: 10px; }
.small-success { font-size: 17px; }
.week-link { display: block; text-align: center; margin: 8px 0 16px; font-weight: 700; color: var(--accent); }
.scheduled-banner { padding: 10px 14px; border-radius: 10px; background: #f6e7c1; color: #5a4300; margin: 0 0 14px; }

/* "Add to home screen" hint on the restaurant page */
.install-hint { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.install-hint p { margin: 0 0 10px; }
.install-hint .actions { margin-top: 0; }
.push-box { margin-top: 24px; }
.push-box .label { margin-top: 0; }
/* Admin: "Danas još nisu objavili" */
.missing-list { list-style: none; margin: 0; padding: 0; }
.missing-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.missing-list li:last-child { border-bottom: 0; }
.missing-list .button { margin-left: auto; }
.guide-link { margin-top: 18px; text-align: center; font-size: 0.85rem; color: var(--muted); }
