/* Wall display manager — phone first. Palette from the Spectra 6 e-paper panel. */
:root {
  --paper: #EDEDEA;
  --paper-2: #FFFFFF;
  --ink: #1C1C1A;
  --ink-2: #5E5E59;
  --line: #CFCFC9;
  --red: #C8322B;
  --red-ink: #FFFFFF;
  --blue: #2B4C9B;
  --yellow: #E8B923;
  --green: #2E7D4F;
  --danger: #C8322B;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --tabbar: 64px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16171A;
    --paper-2: #202226;
    --ink: #ECEBE6;
    --ink-2: #A5A49E;
    --line: #34363B;
    --red: #E0483F;
    --blue: #7D9BE0;
    --yellow: #E8B923;
    --green: #5BB07F;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  padding-inline: 16px;
  padding-block: calc(var(--sat) + 8px) calc(var(--tabbar) + var(--sab) + 24px);
}
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { margin: 6px 0; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: 14px; margin: 2px 0 10px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.top { display: flex; align-items: center; justify-content: space-between; padding-block: 8px 12px; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 50%; cursor: pointer; color: var(--ink); line-height: 0; }
.icon-btn:active { background: var(--line); }
main { max-width: 760px; margin: 0 auto; }
.view[hidden] { display: none; }

/* ── On the wall ─────────────────────────────────────────────── */
.wall { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; padding: 12px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.panel { width: 96px; aspect-ratio: 9 / 16; background: var(--ink); border-radius: 6px; padding: 4px; border: 0; cursor: pointer; display: block; }
.panel:disabled { cursor: default; }
.panel:not(:disabled):active { transform: scale(.98); }
.panel-screen { position: relative; width: 100%; height: 100%; background: var(--paper-2); border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink); overflow: hidden; }
.panel-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.panel-screen img[hidden] { display: none; }
.panel.has-img .panel-screen span { position: relative; z-index: 1; background: rgba(28,28,26,.78); color: #fff; padding: 1px 5px; border-radius: 3px; }
.panel.has-img .panel-screen span:last-child { color: #ddd; }
.panel-screen span:first-child { font-weight: 700; font-size: 15px; }
.panel-screen span:last-child { font-size: 11px; color: var(--ink-2); }
.panel.off .panel-screen { background: #8E8E88; color: #3a3a37; }
.next { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.next li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; color: var(--ink-2); }
.next li b { color: var(--ink); font-weight: 500; }
.next li .menu-cafe, .next li .menu-bar { color: var(--ink); }

/* ── Grid ────────────────────────────────────────────────────── */
.grid-h { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.count { color: var(--ink-2); font-weight: 400; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-banners { grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } .grid-banners { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; width: 100%; padding: 0; border: 0; background: var(--paper-2); border-radius: var(--radius); overflow: hidden; text-align: left; cursor: pointer; box-shadow: 0 1px 0 var(--line); }
.tile:active { transform: translateY(1px); }
.tile .img { position: relative; flex: none; width: 100%; aspect-ratio: 4 / 5; background: var(--line); }
.grid-banners .tile .img { aspect-ratio: 3 / 1; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-banners .tile .img { background: #8E8E88; }
.grid-banners .tile img { object-fit: contain; }
.tile.off img { filter: grayscale(1) contrast(0.85) brightness(1.08); opacity: 0.8; }
.tile .body { padding: 8px 10px 10px; }
.tile .title { font-weight: 500; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .reason { color: var(--red); font-size: 13px; margin-top: 2px; }
.tile.off .reason { color: var(--ink-2); }
.tile .chips { margin-top: 6px; }
.owner { position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 500; padding: 3px 7px; border-radius: 4px; }
.managed { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.empty { grid-column: 1 / -1; color: var(--ink-2); padding: 20px 0; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font-size: 12px; line-height: 1; padding: 5px 7px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }
.chip.menu-cafe { background: var(--yellow); border-color: var(--yellow); color: #1C1C1A; }
.chip.menu-bar { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.weight { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.date { background: var(--paper-2); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + var(--sab)); padding-bottom: var(--sab); display: grid; grid-template-columns: repeat(3, 1fr); background: var(--paper-2); border-top: 1px solid var(--line); z-index: 20; }
.tabs button { background: none; border: 0; font-weight: 500; font-size: 15px; color: var(--ink-2); position: relative; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 24px; height: 3px; margin-left: -12px; border-radius: 2px; background: var(--red); }

/* ── Add ─────────────────────────────────────────────────────── */
.drop { display: block; position: relative; border: 2px dashed var(--line); border-radius: var(--radius); min-height: 180px; background: var(--paper-2); cursor: pointer; overflow: hidden; margin-top: 10px; }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-weight: 500; }
.drop-preview { display: block; position: relative; }
.drop-preview[hidden] { display: none; }
.drop-preview img { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #8E8E88; }
.crop-mask { position: absolute; pointer-events: none; border: 2px solid var(--red); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper-2); }
.seg button { border: 0; background: none; padding: 10px 6px; font-weight: 500; font-size: 14px; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
#folder-seg { margin: 12px 0; }
.actions { margin-top: 16px; }
.primary { width: 100%; padding: 14px; border: 0; border-radius: var(--radius); background: var(--red); color: var(--red-ink); font-weight: 700; font-size: 16px; }
.primary:disabled { opacity: .45; }
.secondary { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); font-weight: 500; }
.danger { color: var(--danger); border-color: var(--danger); }
.link { background: none; border: 0; padding: 12px; color: var(--blue); text-decoration: underline; width: 100%; }

/* ── Form ────────────────────────────────────────────────────── */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; color: var(--ink-2); font-weight: 500; padding: 0; }
.field input[type="text"], .field input[type="date"], .field input[type="time"] { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); color: var(--ink); min-width: 0; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dates label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.dates label[hidden] { display: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper-2); }
.stepper button { border: 0; background: none; font-size: 20px; }
.stepper output { display: grid; place-items: center; font-weight: 700; }
.chips button { font-size: 14px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.summary { color: var(--ink); font-size: 15px; margin: 0; }
.filename { display: grid; gap: 2px; margin: 0; font-size: 13px; color: var(--ink-2); }
.filename code { color: var(--ink); overflow-wrap: anywhere; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100% - 40px); height: auto; border-radius: 4px; background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,.6); }
.lightbox p { margin: 0; color: #ddd; font-size: 14px; }

/* ── Sheet ───────────────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column; background: var(--paper); border-radius: 16px 16px 0 0; z-index: 31; padding: 8px 16px calc(12px + var(--sab)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
@media (min-width: 760px) { .sheet { left: 50%; right: auto; width: 560px; margin-left: -280px; } }
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-body { overflow-y: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.sheet-thumb { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.sheet-thumb img { width: 64px; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; background: var(--line); }
.sheet-actions { display: grid; gap: 8px; padding-top: 10px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + var(--sab) + 12px); background: var(--ink); color: var(--paper); padding: 12px 14px; border-radius: 10px; font-weight: 500; z-index: 40; text-align: center; }
.toast.error { background: var(--red); color: #fff; }
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* ── Redesign 2026-09-16: Wall tab, status line, lock, today strip, pipeline ── */
.top-actions { display: flex; gap: 2px; }
.icon-btn.unlocked { color: var(--green); }
.status { margin: 4px 0 14px; padding: 12px 14px; border-radius: var(--radius); font-size: 16px; line-height: 1.4; background: var(--paper-2); border-left: 4px solid var(--line); }
.status a { color: inherit; }
.status[data-state="ok"] { border-left-color: var(--green); }
.status[data-state="unverified"], .status[data-state="closed"], .status[data-state="no-data"], .status[data-state="loading"] { border-left-color: var(--line); color: var(--ink-2); }
.status[data-state="stale"] { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--paper-2)); }
.status[data-state="pipeline"], .status[data-state="late"] { border-left-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, var(--paper-2)); }
.wall { grid-template-columns: 132px 1fr; }
.panel { width: 132px; }
.next li { grid-template-columns: 62px 1fr; cursor: pointer; border-radius: 6px; padding: 4px 4px; margin: 0 -4px; }
.next li:active { background: var(--line); }
.next li[data-noimage] { cursor: default; }
.regen-row { margin: 4px 0 16px; }
.regen-row .hint { margin-top: 6px; }
.secondary:disabled { opacity: .5; }
details.today, details.pipeline { border-top: 1px solid var(--line); padding: 10px 0; }
details summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '+'; font-family: var(--display, var(--font)); font-size: 20px; color: var(--ink-2); }
details[open] summary::after { content: '−'; }
details summary h2 { font-size: 17px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 6px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.strip button { flex: none; width: 72px; background: none; border: 0; padding: 0; text-align: center; scroll-snap-align: start; }
.strip img { width: 72px; aspect-ratio: 9/16; object-fit: cover; border-radius: 4px; background: var(--line); display: block; }
.strip span { display: block; font-size: 12px; color: var(--ink-2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.strip button.current img { outline: 2px solid var(--red); outline-offset: 1px; }
.pipeline-body { padding-top: 8px; font-size: 14px; }
.pipeline-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 12px; }
.pipeline-body dt { color: var(--ink-2); }
.pipeline-body dd { margin: 0; overflow-wrap: anywhere; }
.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.runs li { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.runs li .st { font-weight: 500; }
.runs li .st.failed, .runs li .st.partial { color: var(--red); }
.runs li .st.ok { color: var(--green); }
.runs li .err { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; }
.runs li .dur { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.images-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.primary.small, .link.small { width: auto; padding: 8px 14px; font-size: 14px; }
.grid-h { font-size: 16px; margin-top: 16px; }
.login { display: grid; gap: 10px; }
.login input { font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); color: var(--ink); }

/* ── "Won't show on the wall": Drive files the Pi will never push (LOW-720) ──
   Token meanings are inherited from .status above, not invented here: --red is
   "this data can't be trusted" (stale), --yellow is "known, act on it" (late).
   So the error state wears red and outranks the ignored state, and neither the
   clear nor the empty-folder state gets a panel at all. Colour is never the
   only signal — each state says what it is in words. Keep hint text at
   --ink-2 or darker; --ink-2 on the dark yellow tint is 4.76:1, with no room. */
.ignored { margin: 0 0 14px; }
.ignored[data-state="loading"], .ignored[data-state="clear"], .ignored[data-state="empty-folder"], .ignored[data-state="off"] { padding: 0; background: none; border: 0; }
.ignored[data-state="ignored"], .ignored[data-state="error"] { padding: 12px 14px; border-radius: var(--radius); background: var(--paper-2); border-left: 4px solid var(--line); }
.ignored[data-state="ignored"] { border-left-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, var(--paper-2)); }
.ignored[data-state="error"] { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--paper-2)); }
.ignored h2 { font-size: 17px; }
.ignored-list { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 4px; }
.ignored-list li { color: var(--ink); }
.ignored-list code { color: var(--ink); overflow-wrap: anywhere; } /* never truncate: the next action is finding this exact string in Drive */
.ignored-fix { font-size: 14px; color: var(--ink); margin: 0 0 6px; }
.ignored .hint { margin-bottom: 0; }

/* ── Desktop: Wall beside Images/Archive, tabs in the header ────────────── */
@media (min-width: 1000px) {
  body { padding-inline: 32px; padding-block: 8px 40px; }
  .top { max-width: 1440px; margin: 0 auto; padding-block: 12px 18px; }
  main { max-width: 1440px; display: grid; grid-template-columns: 500px minmax(0, 1fr); gap: 0 40px; align-items: start; }
  #view-wall { display: block !important; position: sticky; top: 12px; }
  .wall { grid-template-columns: 200px 1fr; gap: 20px; }
  .panel { width: 200px; }
  .panel-screen span:first-child { font-size: 20px; }
  .panel-screen span:last-child { font-size: 13px; }
  .next { font-size: 15px; }
  .next li { grid-template-columns: 70px 1fr; }
  details.today, details.pipeline { padding: 12px 0; }
  .strip img { width: 84px; }
  .strip button { width: 84px; }
  /* tabs become a segmented control in the header; the Wall tab is redundant */
  .tabs { position: static; height: auto; padding: 0; margin-right: 14px; grid-template-columns: none; grid-auto-flow: column; gap: 2px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .top-actions { align-items: center; }
  .tabs button { padding: 8px 18px; font-size: 14px; }
  .tabs button[data-tab="wall"] { display: none; }
  .tabs button[aria-current="page"] { background: var(--ink); color: var(--paper); }
  .tabs button[aria-current="page"]::after { display: none; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid-banners { grid-template-columns: repeat(2, 1fr); }
  .sheet { left: auto; right: 32px; bottom: 32px; width: 520px; margin-left: 0; border-radius: 16px; max-height: 88vh; }
  .toast { left: auto; right: 32px; bottom: 32px; width: 360px; }
}
@media (min-width: 1300px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .grid-banners { grid-template-columns: repeat(2, 1fr); }
}
