:root {
  --bg: #faf8f3;
  --card: #ffffff;
  --fg: #23211c;
  --muted: #7a766b;
  --line: #e8e4d8;
  --accent: #f2c94c;
  --accent-ink: #23211c;
  --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1916;
    --card: #25231f;
    --fg: #f3f0e6;
    --muted: #9b968a;
    --line: #38352e;
    --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; font-size: 17px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* neprijavljen */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 22px; }
.login h1 { margin: 0; font-size: 32px; }
.login p { margin: 0; color: var(--muted); }
.error { color: var(--danger); min-height: 1.4em; margin: 0; }
.btn { min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

/* lupina */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.top { padding: calc(env(safe-area-inset-top) + 16px) 20px 8px; }
.top h1 { margin: 0; font-size: 26px; }
.top .date { color: var(--muted); font-size: 15px; text-transform: capitalize; }
.content { flex: 1; padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .empty, .empty { margin: 0; color: var(--muted); font-size: 15px; }
.hint { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
.hint p { margin: 0; font-size: 15px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.off { color: var(--muted); }
.list li .soon { font-size: 13px; }
.who { color: var(--muted); font-size: 15px; word-break: break-all; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; text-decoration: none; color: var(--muted); font-size: 12px; }
.tabbar a .ico { font-size: 22px; line-height: 1; }
.tabbar a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.tabbar a[aria-current="page"] .ico { background: var(--accent); border-radius: 12px; padding: 2px 14px; }

/* ---------- D1: seznam ---------- */
:root { --write: color-mix(in srgb, #2bb3a3 14%, var(--card)); --write-line: #2bb3a3; }
.net { position: fixed; z-index: 50; top: calc(env(safe-area-inset-top, 0px) + 8px); right: max(12px, env(safe-area-inset-right, 0px)); font-size: 13px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 35%, var(--card)); box-shadow: 0 2px 8px rgb(0 0 0 / .12); pointer-events: none; }
.content { min-width: 0; }
.cardlink { color: inherit; text-decoration: none; }
.cl { list-style: none; margin: 4px 0 8px; padding: 0; }
.cl li { padding: 3px 0; }
.qty { color: var(--muted); font-size: 15px; margin-left: 6px; }
.more-n { margin: 0 0 8px; }

.stick { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.shead { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.shead h2 { margin: 0; font-size: 19px; }
.menuwrap { position: relative; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.pop { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 8px 28px rgba(0,0,0,.18); z-index: 10; }
.pop button { display: block; width: 100%; text-align: left; min-height: 44px; padding: 0 12px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; }
.pop button:disabled { color: var(--muted); cursor: default; }
.pop button.danger, .btn.danger { color: var(--danger); }
.confirm { margin: 8px 12px; }
.confirm-row { display: flex; gap: 4px; }
.confirm-row button { text-align: center; }

.addbar { display: flex; gap: 8px; }
.addin, .sheet input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; font: inherit; font-size: 17px; color: var(--fg); background: var(--write); border: 1.5px solid color-mix(in srgb, var(--write-line) 50%, transparent); border-radius: 14px; caret-color: var(--write-line); outline: none; }
.addin:focus, .sheet input:focus { border-color: var(--write-line); }
.addbtn { width: 48px; min-height: 48px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 28px; line-height: 1; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:not(:empty) { margin-top: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 16px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
#cl-add .addbar { margin-top: 4px; }

.sech { margin: 14px 4px 4px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); cursor: pointer; touch-action: pan-y; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; background: var(--card); transition: max-height .22s ease, opacity .22s ease; max-height: 200px; }
.row.leaving { max-height: 0; opacity: 0; border-bottom-width: 0; }
.rowin { position: relative; display: flex; align-items: center; min-height: 56px; background: var(--card); will-change: transform; }
.row:last-child { border-bottom: 0; }
.row:active > .rowin { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.tick { width: 56px; min-height: 56px; flex: none; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.circ { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }
.row.done .circ { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.rtext { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 0; }
.row.done .nm { text-decoration: line-through; color: var(--muted); }
.note { color: var(--muted); font-size: 14px; width: 100%; }
.by { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 40%, var(--card)); font-size: 12px; font-weight: 600; }
.src { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #2bb3a3 22%, var(--card)); }
.bought-head { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 48px; margin: 16px 0 6px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 16px; font-weight: 600; cursor: pointer; text-align: left; }
.empty.big { margin: 24px 4px; font-size: 17px; }
.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--accent) 60%, var(--card)); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } #toast { transition: none; } .sheet { animation: none !important; } }

.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30%); opacity: .6; } }
.grab { height: 32px; margin: 0 -16px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.grab i { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.sheet .two { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.sheet .lbl { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
.secchips { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; max-width: 520px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #23211c; color: #fff; border-radius: 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: none; pointer-events: auto; }
#toast button { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; }

/* ---------- D1.1: več seznamov, zgodovina ---------- */
.fin { display: block; width: 100%; margin-top: 12px; }
.sheet-h { margin: 4px 0 0; font-size: 19px; }
.sheet-p { margin: 0; color: var(--muted); font-size: 15px; }
.still { margin-top: 8px; }
.stlink { color: var(--fg); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.hhead { justify-content: flex-start; gap: 4px; }
.hhead h2 { margin: 0; font-size: 19px; }
.back { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--fg); font-size: 30px; line-height: 1; }
.hrow { padding: 0; }
.hlink { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 8px 14px; color: inherit; text-decoration: none; }
.hsum { margin: 4px 4px 8px; }
.hactions { margin: 0 0 4px; }
.addto { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); margin-top: 16px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.addto .lbl { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.addto .fin { margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.row.pick .nm { text-decoration: none; color: var(--fg); }

/* ---------- D1.2: brez košarice, kretnje, čiščenje ---------- */
.shead { gap: 6px; }
.stitle { flex: 1; min-width: 0; margin: 0; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { color: var(--muted); font-size: 15px; font-weight: 400; margin-left: 4px; }
.backlink { display: inline-flex; align-items: center; min-height: 44px; padding-right: 6px; color: var(--fg); text-decoration: none; font-size: 17px; white-space: nowrap; }
.bigtitle { margin: 0; font-size: 30px; }
.sech { margin: 14px 4px 4px; font-size: 12px; font-weight: 500; letter-spacing: .03em; color: var(--muted); }
.by { width: 18px; height: 18px; font-size: 10px; }
.age { flex: none; margin-right: 14px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rtext { padding-right: 8px; }
.rtext.lpad { padding-left: 16px; padding-top: 12px; padding-bottom: 12px; }
.bought-head { color: var(--muted); font-weight: 500; }
.bought-head .chev { font-size: 14px; }
.addnote { margin-top: 6px; padding: 8px 12px; border-radius: 12px; font-size: 15px; background: color-mix(in srgb, var(--accent) 22%, var(--card)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.addnote .dbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.dbtn { min-height: 44px; padding: 0 14px; font-size: 15px; }
.licon { width: 56px; text-align: center; font-size: 22px; flex: none; }
.rowin .cnt { margin: 0 4px 0 auto; flex: none; }
.rowin .chev { color: var(--muted); font-size: 22px; margin: 0 14px 0 6px; flex: none; }
.newlist { display: block; width: 100%; margin-top: 14px; text-align: left; }
.rows.sep { margin-top: 24px; }
.vrni { flex: none; margin-right: 16px; font-weight: 600; }
.sheet-actions.col { flex-direction: column; }
.sheet-actions .btn.danger { border-color: var(--danger); }
.hrow .rowin { min-height: 56px; }
.hlink { flex: 1; }

/* swipe */
.swact { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.act { width: 88px; border: 0; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; padding: 0 4px; }
.act.grey { background: #8e8e93; }
.act.red { background: #b3261e; }

/* meni ob dolgem pritisku */
.ctx-back { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0); transition: background .15s; -webkit-touch-callout: none; user-select: none; }
.ctx-back.show { background: rgba(0,0,0,.45); }
.ctx-row { list-style: none; background: var(--card); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); overflow: hidden; border: 0; transform: scale(1); transition: transform .15s ease-out; cursor: default; }
.ctx-back.show .ctx-row { transform: scale(1.03); }
.ctx-menu { position: absolute; background: var(--card); border-radius: 14px; padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.35); opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s; }
.ctx-back.show .ctx-menu { opacity: 1; transform: none; }
.ctx-menu button { display: block; width: 100%; text-align: left; min-height: 46px; padding: 0 14px; border: 0; background: transparent; border-radius: 10px; font-size: 17px; cursor: pointer; }
.ctx-menu button + button { border-top: 1px solid var(--line); border-radius: 0; }
.ctx-menu button.danger { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .row, .ctx-row, .ctx-menu, .ctx-back { transition: none; } }
