:root {
  --blue: #2a9df4;
  --blue-dark: #1568b0;       /* besedilo, povezave, obrobe fokusa (kontrast >= 4.5 na svetli podlagi) */
  --blue-strong: #1a6fbd;     /* ozadja z belim besedilom (gumbi, zgornja vrstica) */
  --blue-strong-2: #14609f;
  --btn-hover: #14609f;
  --blue-light: #e8f4fd;
  --blue-soft: #cfe7fb;
  --white: #ffffff;
  --text: #1c2b3a;
  --muted: #4b5d6f;
  --bg: #e8f4fd;
  --surface: #ffffff;
  --input-bg: #ffffff;
  --toast-bg: #1c2b3a;
  --border: #d6e6f3;
  --danger: #b83232;
  --warn: #f0a52a;
  --ok: #2fb67c;
  --radius: 14px;
  color-scheme: light;
  --shadow: 0 4px 18px rgba(42, 157, 244, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; line-height: 1.45; }
.muted { color: var(--muted); font-size: .9rem; }
.hidden { display: none !important; }

/* Layout */
.topbar {
  background: var(--blue-strong); color: #fff;
  padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.topbar .brand { font-weight: 800; font-size: 1.2rem; letter-spacing: .3px; display: flex; gap: .5rem; align-items: center; }
.topbar .brand img { width: 28px; height: 28px; }
.topbar button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 10px; padding: .4rem .7rem; }
main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; justify-content: space-around; z-index: 10;
  padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; padding: .25rem 0;
}
.tabbar a span { display: block; font-size: 1.35rem; line-height: 1.2; }
.tabbar a.active { color: var(--blue-dark); font-weight: 700; }

/* Cards & elements */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card.accent { background: linear-gradient(135deg, var(--blue-strong), var(--blue-strong-2)); color: #fff; border: 0; }
.card.accent .muted { color: rgba(255,255,255,.85); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--blue-strong); color: #fff; border: 0; border-radius: 12px; padding: .7rem 1.1rem;
  font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; min-height: 44px;
}
.btn:hover { background: var(--btn-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--blue-dark); border: 2px solid var(--blue-soft); }
.btn.secondary:hover { background: var(--blue-light); }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn.danger:hover { background: #f9d9d9; }
.btn.small { padding: .4rem .7rem; min-height: 36px; font-size: .85rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.big { padding: 1.1rem; font-size: 1.05rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; font-size: .85rem; color: var(--muted); margin: .6rem 0 .25rem; font-weight: 600; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1.5px solid var(--border); border-radius: 10px; background: var(--input-bg); color: var(--text);
  outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { min-height: 70px; resize: vertical; }
.chip { display: inline-block; background: var(--blue-light); color: var(--blue-dark); border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; }
.chip.warn { background: #fff4e0; color: #8a5600; }
.chip.danger { background: #fdecec; color: #b83232; }
.chip.ok { background: #e6f7ef; color: #1c7a50; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.7rem; color: var(--blue-dark); }
.stat.on-accent b { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .7rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { font-size: .8rem; color: var(--muted); }
.actions-bar { position: sticky; bottom: 4.2rem; background: var(--surface); padding: .6rem; border-radius: 12px; box-shadow: var(--shadow); }
.alert { padding: .7rem .9rem; border-radius: 10px; margin-bottom: .8rem; font-size: .9rem; }
.alert.error { background: #fdecec; color: #8f2c2c; }
.alert.info { background: var(--blue-light); color: var(--blue-dark); }
.alert.ok { background: #e6f7ef; color: #1c7a50; }
.toast {
  position: fixed; left: 50%; bottom: 5.2rem; transform: translateX(-50%); background: var(--toast-bg); color: #fff;
  padding: .6rem 1rem; border-radius: 10px; font-size: .9rem; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: .5rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.capture-tile {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.4rem 1rem; text-align: center;
  background: var(--surface); border: 2px dashed var(--blue-soft); border-radius: var(--radius); cursor: pointer; color: var(--blue-dark); font-weight: 700;
}
.capture-tile:hover { background: var(--blue-light); }
.capture-tile .icon { font-size: 2.2rem; }
.capture-tile { position: relative; }
.capture-tile input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }  /* ostane dosegljiv s tipkovnico */
.auth-wrap { max-width: 400px; margin: 2.5rem auto; }
.auth-logo { text-align: center; margin-bottom: 1.2rem; }
.auth-logo img { width: 72px; height: 72px; }
.auth-logo h1 { color: var(--blue-dark); margin-top: .4rem; }
.check { width: 22px; height: 22px; accent-color: var(--blue); }
details summary { cursor: pointer; color: var(--blue-dark); font-weight: 600; font-size: .9rem; }
.steps { padding-left: 1.2rem; margin: .4rem 0; }
.steps li { margin-bottom: .35rem; line-height: 1.4; }
.progress { height: 8px; background: var(--blue-light); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); }

/* Dodatki: nazaj, admin, tabele */
.topbar .left { display: flex; align-items: center; gap: .6rem; }
.topbar .brand { cursor: pointer; user-select: none; }
.topbar .back { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 10px; padding: .4rem .6rem; font-weight: 700; }
.tabbar a.admin { color: #8a5600; }
.tabbar a.admin.active { color: #5e3b00; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.tbl th, table.tbl td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.tbl-wrap { overflow-x: auto; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--blue-light); padding: .2rem .5rem; border-radius: 6px; letter-spacing: .1em; font-weight: 700; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; }
.pro-badge { background: linear-gradient(135deg,#f0a52a,#e07d10); color: #2b1a00; }
.log li { align-items: flex-start; }
.log .time { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.mini { font-size: .75rem; }
.tbl select, .tbl input { min-width: 86px; padding: .3rem .4rem; width: auto; }

/* Grafi: stolpci po dnevih (admin) in vodoravni stolpci (uvidi) */
.bars-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.bars-row:last-child { border-bottom: 0; }
.bars-label { flex: 0 0 150px; font-size: .85rem; font-weight: 600; }
.bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; background: var(--blue-light); border-radius: 3px; overflow: hidden; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--blue); border-radius: 3px 3px 0 0; }
.hbar-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.hbar-label { flex: 0 0 130px; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar { flex: 1; height: 12px; background: var(--blue-light); border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; min-width: 2px; background: var(--ok); border-radius: 99px; }
.hbar i.warn { background: var(--warn); }
.hbar i.danger { background: var(--danger); }
.hbar-val { flex: 0 0 auto; font-size: .8rem; white-space: nowrap; }
@media (max-width: 480px) { .bars-label, .hbar-label { flex-basis: 95px; } }
/* Zaloga: orodna vrstica (iskanje, filter, razvrščanje), urejanje v vrstici, klikljive vrstice */
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .6rem .75rem; }
.toolbar input, .toolbar select { width: auto; flex: 1 1 130px; min-width: 0; padding: .5rem .7rem; }
.toolbar input[type=search] { flex: 2 1 170px; }
.list li.editing { flex-wrap: wrap; }
.edit-panel { flex-basis: 100%; background: var(--blue-light); border: 1px solid var(--border); border-radius: 10px; padding: .2rem .8rem .8rem; margin-top: .4rem; }
.edit-panel label { margin-top: .5rem; }
.edit-panel input, .edit-panel select { padding: .5rem .7rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--danger); text-decoration: underline; cursor: pointer; font-size: .85rem; }
.list li.link { cursor: pointer; border-radius: 8px; transition: background .15s; }
.list li.link:hover { background: var(--blue-light); }

/* ---------- Dostopnost ---------- */
.skip-link {
  position: absolute; left: .5rem; top: -4rem; z-index: 100; background: var(--surface); color: var(--blue-dark);
  padding: .7rem 1rem; border-radius: 10px; font-weight: 700; box-shadow: var(--shadow); border: 2px solid var(--blue-dark);
}
.skip-link:focus { top: .5rem; }
main:focus { outline: none; }
html body :focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 2px; }
html body .topbar :focus-visible { outline-color: #fff; }
html body .card.accent :focus-visible { outline-color: #fff; }
.capture-tile:focus-within { outline: 3px solid var(--blue-dark); outline-offset: 2px; }
/* ikonski gumbi v seznamih: dovolj velika tarča */
.list li .btn.small, .list li > button { min-width: 44px; }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Temni način ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1b26;
    --surface: #16232f;
    --input-bg: #0f1b26;
    --text: #e6eef5;
    --muted: #a9bccd;
    --border: #27384a;
    --blue-light: #1b2c3c;
    --blue-soft: #2b4a66;
    --blue-dark: #7cc0f7;
    --btn-hover: #155d9e;
    --danger: #ff9b9b;
    --toast-bg: #2b4a66;
    --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  }
  .topbar { background: #12456f; }
  .card.accent { background: linear-gradient(135deg, #1a6fbd, #12456f); }
  .btn.danger { background: #3d1d1f; color: #ff9b9b; }
  .btn.danger:hover { background: #4d2527; }
  .btn.secondary { color: var(--blue-dark); }
  .chip.warn { background: #3a2c10; color: #f5c26b; }
  .chip.danger { background: #3d1d1f; color: #ff9b9b; }
  .chip.ok { background: #12342a; color: #6fe0aa; }
  .alert.error { background: #3d1d1f; color: #ffb4b4; }
  .alert.ok { background: #12342a; color: #6fe0aa; }
  .alert.info { background: var(--blue-light); color: var(--blue-dark); }
  .tabbar a.admin { color: #f5c26b; }
  .tabbar a.admin.active { color: #ffd98f; }
  .hbar i.danger { background: #e05252; }
  .preview { opacity: .95; }
  input::placeholder, textarea::placeholder { color: #7f93a6; }
  input:focus, select:focus, textarea:focus { border-color: var(--blue-dark); }
  html body .topbar :focus-visible, html body .card.accent :focus-visible { outline-color: #fff; }
}

/* Preklopnik jezika SL / EN */
.lang-switch { display: inline-flex; border: 1.5px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--white); }
.lang-switch button { background: transparent; border: 0; border-radius: 0; padding: .35rem .75rem; min-height: 34px; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--blue-strong, var(--blue-dark)); color: #fff; }
.topbar .right { display: flex; align-items: center; gap: .5rem; }
.topbar .lang-switch { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.12); }
.topbar .lang-switch button { background: transparent; color: #fff; border-radius: 0; padding: .3rem .55rem; min-height: 32px; }
.topbar .lang-switch button[aria-pressed="true"] { background: #fff; color: var(--blue-strong, var(--blue-dark)); }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: .2rem; }
@media (max-width: 360px) { .topbar .brand { font-size: 1rem; } .topbar .lang-switch button { padding: .3rem .45rem; } }

/* Izbira časa za kuhanje (recepti) */
.time-pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip-btn { border: 1.5px solid var(--border); background: var(--white); color: var(--blue-dark); border-radius: 999px; padding: .35rem .8rem; min-height: 36px; font-weight: 700; font-size: .85rem; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--blue-strong, var(--blue-dark)); border-color: var(--blue-strong, var(--blue-dark)); color: #fff; }
.time-pick input[type=number] { width: 9.5rem; min-height: 36px; padding: .3rem .6rem; }

/* Makrohranila: barve (preverjene za barvno slepoto, svetli in temni način) */
:root { --m-protein: #2a78d6; --m-carbs: #eb6834; --m-fat: #1baf7a; --m-empty: #dbe7f2; }
@media (prefers-color-scheme: dark) { :root { --m-protein: #3987e5; --m-carbs: #d95926; --m-fat: #199e70; --m-empty: #27384a; } }
.macro { display: flex; gap: .9rem; align-items: center; margin: .3rem 0 .7rem; }
.macro svg { flex: none; }
.macro svg path, .macro svg circle.slice, .list svg path, .list svg circle.slice { stroke: var(--surface, #fff); stroke-width: 2; stroke-linejoin: round; }
.macro .legend { list-style: none; margin: 0; padding: 0; font-size: .85rem; display: grid; gap: .15rem; }
.macro .legend li { display: flex; align-items: center; gap: .4rem; color: var(--text); }
.macro .legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.macro .legend .v { color: var(--muted); }
.macro .kcal { font-weight: 700; color: var(--text); margin-bottom: .15rem; }
.meter { margin: .55rem 0; }
.meter .lbl { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; margin-bottom: .2rem; }
.meter .lbl b { font-weight: 600; }
.meter .track { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--mc) 18%, transparent); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 999px; background: var(--mc); }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.day-nav h1 { margin: 0; font-size: 1.25rem; text-align: center; flex: 1; }

/* Ozek zaslon: ko je viden gumb Nazaj, v glavi ostane samo ikona (prostor za SL | EN) */
@media (max-width: 440px) { .topbar .left:has(.back:not(.hidden)) .brand-txt { display: none; } }

/* Obvestilo z dejanjem (npr. Razveljavi) */
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: .6rem; }
.toast button { background: transparent; border: 1.5px solid rgba(255,255,255,.7); color: #fff; border-radius: 8px; padding: .25rem .6rem; font-weight: 700; cursor: pointer; min-height: 32px; }
/* Pojedel sem: izbira porcij */
.ate-group { display: inline-flex; gap: .3rem; align-items: center; }
.ate-group select { width: auto; min-height: 34px; padding: .25rem .4rem; font-size: .85rem; }
