/* Werkbank: a repair bench, not a SaaS dashboard.
   Base is the grey-green of an anti-static mat; the one loud thing is the kraft price tag. */
:root {
  --paper: #EEF0EC;
  --surface: #FBFCFA;
  --ink: #1D2624;
  --muted: #5F6C68;
  --line: #D3D9D4;
  --mat: #2F6B62;
  --mat-ink: #F3F7F5;
  --mat-soft: #DCE8E4;
  --rail: #2F6B62;
  --rail-ink: #F3F7F5;
  --tag: #E2C48A;
  --tag-edge: #C9A764;
  --tag-ink: #3A2E17;
  --alert: #B4442F;
  --alert-soft: #F4E1DC;
  --ok: #3F7A3A;
  --radius-s: 4px;
  --radius-m: 8px;
  --shadow-tag: 0 1px 0 rgba(58, 46, 23, .25), 0 6px 14px -8px rgba(58, 46, 23, .45);
  --font: 'Archivo', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121917; --surface: #1A2421; --ink: #E4EAE6; --muted: #98A6A1; --line: #2C3A36;
    --mat: #5FA597; --mat-ink: #0E1513; --mat-soft: #1F3530; --rail: #183530; --rail-ink: #DDE9E5; --tag: #CDAE70; --tag-edge: #A88B50; --tag-ink: #2A2010;
    --alert: #E07A62; --alert-soft: #3A221C; --ok: #7DBA74; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121917; --surface: #1A2421; --ink: #E4EAE6; --muted: #98A6A1; --line: #2C3A36;
  --mat: #5FA597; --mat-ink: #0E1513; --mat-soft: #1F3530; --rail: #183530; --rail-ink: #DDE9E5; --tag: #CDAE70; --tag-edge: #A88B50; --tag-ink: #2A2010;
  --alert: #E07A62; --alert-soft: #3A221C; --ok: #7DBA74; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font); font-variation-settings: 'wdth' 100;
  font-feature-settings: 'tnum' 1;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--mat); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 750; font-variation-settings: 'wdth' 118; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-variation-settings: 'wdth' 110; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--alert); }
.pos { color: var(--ok); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.rail {
  background: var(--rail); color: var(--rail-ink); padding: 24px 16px; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 24px; font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 1.15rem; text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.rail a.nav {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: var(--radius-s);
  text-decoration: none; font-weight: 550; opacity: .82;
}
.rail a.nav:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.rail a.nav[aria-current="page"] { opacity: 1; background: var(--rail-ink); color: var(--rail); }
.rail .count { font-size: .8rem; background: var(--tag); color: var(--tag-ink); border-radius: 99px; padding: 0 7px; font-weight: 700; }
.rail .foot { margin-top: auto; font-size: .8rem; opacity: .7; padding: 0 10px; }
main { padding: 32px clamp(16px, 4vw, 48px) 96px; max-width: 1280px; width: 100%; margin-inline: auto; justify-self: center; }
.pagehead { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; margin-bottom: 28px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; top: auto; z-index: 20; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 0;
  }
  .brand, .rail .foot { display: none; }
  .rail a.nav { flex-direction: column; gap: 2px; font-size: .78rem; padding: 8px 6px; min-width: 56px; font-weight: 700; }
  .rail a.nav[href="#/log"] { display: none; }
  main { padding: 20px 16px 110px; }
}

/* ---------- buttons & forms ---------- */
button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius-s); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px;
}
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--mat); border-color: var(--mat); color: var(--mat-ink); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--alert); }
button.ghost { background: transparent; border-color: transparent; padding-inline: 8px; }
button.ghost:hover { background: var(--mat-soft); }
button:disabled { opacity: .5; cursor: progress; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label.field { display: grid; gap: 4px; font-size: .875rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 8px 10px; width: 100%; min-height: 40px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--mat); outline: none; box-shadow: 0 0 0 3px var(--mat-soft); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.grid-form .wide { grid-column: 1 / -1; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; }
.panel + .panel { margin-top: 20px; }
.panel > h2 { margin-bottom: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- the bench sentence ---------- */
.bench-line {
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.1rem); line-height: 1.25; font-weight: 500; max-width: 30ch;
  font-variation-settings: 'wdth' 108; margin: 0 0 8px;
}
.bench-line strong { font-weight: 800; }
.bench-line .warn { color: var(--alert); }
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); margin: 24px 0 36px; }
.ledger div { padding: 12px 16px 14px 0; }
.ledger div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.ledger dt { font-size: .85rem; color: var(--muted); }
.ledger dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; font-variation-settings: 'wdth' 90; }
@media (max-width: 640px) {
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger div:nth-child(3) { border-left: 0; padding-left: 0; }
  .ledger div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- pipeline with price tags ---------- */
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 20px; padding-bottom: 12px; }
@media (max-width: 640px) { .lanes { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; margin-right: -16px; padding-right: 16px; } }
.lane { scroll-snap-align: start; min-height: 160px; }
.lane > header { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.lane > header h3 { font-size: .95rem; }
.lane .empty { color: var(--muted); font-size: .85rem; padding: 6px 2px; }

.tag {
  --rot: -.6deg;
  position: relative; display: block; text-decoration: none; color: var(--tag-ink);
  background: var(--tag); padding: 14px 14px 12px 34px; margin-bottom: 14px;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
  filter: drop-shadow(0 1px 0 var(--tag-edge)) drop-shadow(0 5px 6px rgba(58, 46, 23, .22));
  transform: rotate(var(--rot)); transition: transform .15s ease;
}
.tag:nth-child(even) { --rot: .7deg; }
.tag:hover, .tag:focus-visible { transform: rotate(0) translateY(-2px); }
.tag::before { /* punched hole */
  content: ''; position: absolute; left: 12px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}
.tag .t-title { font-weight: 700; line-height: 1.25; display: block; font-variation-settings: 'wdth' 96; }
.tag .t-price { display: block; font-size: 1.5rem; font-weight: 800; font-variation-settings: 'wdth' 75; margin-top: 6px; line-height: 1; }
.tag .t-price small { font-size: .8rem; font-weight: 600; font-variation-settings: 'wdth' 100; opacity: .75; margin-left: 4px; }
.tag .t-meta { display: block; font-size: .8rem; margin-top: 6px; opacity: .8; }
.tag.stale { outline: 2px dashed var(--alert); outline-offset: 3px; }

/* ---------- finds ---------- */
.finds { list-style: none; margin: 0; padding: 0; }
.find { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.find:first-child { padding-top: 0; }
.find .thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-s); background: var(--mat-soft); }
.find h3 a { text-decoration: none; }
.find h3 a:hover { text-decoration: underline; }
.find .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .875rem; color: var(--muted); margin: 4px 0 6px; }
.find .facts .price { color: var(--ink); font-weight: 700; }
.find .ai { font-size: .9rem; border-left: 3px solid var(--mat); padding-left: 10px; margin: 6px 0; }
.find details { font-size: .85rem; color: var(--muted); }
.find details summary { cursor: pointer; }
.find .actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.score { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .875rem; }
.score .bar { width: 64px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--mat); }
.score.low .bar i { background: var(--muted); }
@media (max-width: 640px) {
  .find { grid-template-columns: 72px minmax(0, 1fr); }
  .find .thumb { width: 72px; height: 56px; }
  .find .actions { grid-column: 1 / -1; flex-direction: row; }
  .find .actions > * { flex: 1; justify-content: center; }
}
.mini-finds .find { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; }
.mini-finds .thumb, .mini-finds .actions, .mini-finds details, .mini-finds .ai { display: none; }

/* ---------- tables & lists ---------- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: 0 10px 8px 0; border-bottom: 2px solid var(--ink); }
td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
.scroll-x { overflow-x: auto; }
.feed { list-style: none; margin: 0; padding: 0; font-size: .925rem; }
.feed li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed time { color: var(--muted); font-size: .825rem; padding-top: 2px; }
.feed .warn { color: var(--alert); }
.feed .error { color: var(--alert); font-weight: 600; }
pre.logs { font-size: .78rem; line-height: 1.45; max-height: 420px; overflow: auto; background: var(--paper); padding: 12px; border-radius: var(--radius-s); white-space: pre-wrap; word-break: break-word; }

/* ---------- item detail ---------- */
.steps { display: flex; flex-wrap: wrap; gap: 0; margin: 4px 0 28px; counter-reset: s; }
.steps button {
  border-radius: 0; border-right-width: 0; min-height: 44px; font-weight: 550; counter-increment: s; gap: 8px;
}
.steps button::before { content: counter(s); font-size: .75rem; width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; }
.steps button:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.steps button:last-child { border-right-width: 1px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.steps button.done { background: var(--mat-soft); }
.steps button.current { background: var(--mat); color: var(--mat-ink); border-color: var(--mat); }
@media (max-width: 760px) { .steps button { flex: 1 1 33%; border-right-width: 1px; border-radius: 0 !important; } }

.money { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: .95rem; }
.money .total { border-top: 2px solid var(--ink); padding-top: 8px; font-weight: 800; font-size: 1.15rem; }
.drafts { list-style: none; padding: 0; margin: 0 0 14px; }
.drafts li { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; margin-bottom: 10px; background: var(--paper); }
.drafts li.sent { opacity: .6; }
.drafts p { white-space: pre-wrap; margin-bottom: 8px; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* ---------- misc ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }
.notice { background: var(--alert-soft); color: var(--ink); border-left: 4px solid var(--alert); padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 20px; }
.hint { background: var(--mat-soft); padding: 10px 14px; border-radius: var(--radius-s); font-size: .9rem; }
.empty-state { padding: 28px 0; color: var(--muted); }
.empty-state strong { color: var(--ink); display: block; font-size: 1.05rem; margin-bottom: 4px; }
.pill { display: inline-block; font-size: .78rem; font-weight: 650; padding: 1px 8px; border-radius: 99px; background: var(--mat-soft); color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 18px; height: 18px; min-height: 0; accent-color: var(--mat); }

dialog { border: 0; border-radius: var(--radius-m); padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(18, 25, 23, .45); }
dialog form { padding: 24px; }
dialog h2 { margin-bottom: 16px; }
dialog .row { justify-content: flex-end; margin-top: 20px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius-s); font-weight: 600; transition: .2s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--alert); color: #fff; }
@media (max-width: 820px) { #toast { bottom: 92px; } }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--mat); }
.login form { width: min(360px, 100%); }
.login .tag { --rot: -2deg; padding: 28px 24px 24px 44px; margin: 0; }
.login .tag::before { left: 16px; width: 14px; height: 14px; margin-top: -7px; background: var(--mat); }
.login h1 { color: var(--tag-ink); margin-bottom: 4px; }
.login p { color: var(--tag-ink); opacity: .8; }
.login input { background: #FFF9EC; border-color: var(--tag-edge); color: #2A2010; }
.login button { width: 100%; margin-top: 10px; justify-content: center; background: var(--tag-ink); border-color: var(--tag-ink); color: var(--tag); }
.login .err { color: #8A2414; font-weight: 600; min-height: 1.5em; margin: 8px 0 0; }


/* ======================================================================
   Heute: the phone screen. Chunky, friendly, one thing at a time.
   Theme: a workbench with kraft price tags. Buttons sit on a darker
   ledge and sink when pressed. Spacing on an 8px rhythm.
   ====================================================================== */
:root {
  --mat-ledge: #1F4A43;
  --line-ledge: #C3CCC7;
  --tag-ledge: #B08E4E;
  --tag-light: #F3E3BF;
  --r-card: 22px;
  --r-btn: 16px;
  --gap: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --mat-ledge: #2E5F56; --line-ledge: #0B110F; --tag-ledge: #7E6534; --tag-light: #3A3020; }
}
:root[data-theme="dark"] { --mat-ledge: #2E5F56; --line-ledge: #0B110F; --tag-ledge: #7E6534; --tag-light: #3A3020; }

.today { max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--gap); }
.today > * { margin: 0; }
.today-head { display: flex; flex-direction: column; gap: var(--gap); }
.today-head > * { margin: 0; }
.today-cols { display: flex; flex-direction: column; gap: var(--gap); }
.today-cols .col-main, .today-cols .col-side { display: contents; }
.blk { display: flex; flex-direction: column; gap: 12px; }
.blk > * { margin: 0; }
@media (min-width: 1000px) {
  .today { max-width: 1120px; gap: 28px; }
  .today-head { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'hello phases' 'sub phases'; column-gap: 32px; row-gap: 6px; align-items: end; }
  .today-head .hello { grid-area: hello; }
  .today-head .sub { grid-area: sub; margin-top: 0; }
  .today-head .phases { grid-area: phases; width: 380px; align-self: center; }
  .today-cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  .today-cols .col-main, .today-cols .col-side { display: flex; flex-direction: column; gap: 24px; }
  .today-cols .col-side { position: sticky; top: 24px; }
  .stack-card { display: grid; grid-template-columns: 1fr 1fr; }
  .stack-card .photo { min-height: 100%; }
  .stack-card .pic, .stack-card .pic.none { height: 100%; aspect-ratio: auto; min-height: 280px; }
  .stack-card .ptag { bottom: 18px; left: 14px; }
  .stack-card .body { padding: 20px; justify-content: center; }
}

/* greeting row */
.hello { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hello .date { margin: 0 0 2px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.hello h1 { font-size: clamp(1.75rem, 1.3rem + 2.4vw, 2.3rem); font-weight: 800; font-variation-settings: 'wdth' 112; line-height: 1.1; }
.today .sub { color: var(--muted); font-size: 1.05rem; line-height: 1.45; margin-top: -6px; }

/* the streak lives on a little price tag */
.streak {
  flex-shrink: 0; position: relative; display: grid; justify-items: center; align-content: center;
  min-width: 68px; padding: 10px 10px 8px 20px; margin-top: 4px; color: var(--tag-ink); background: var(--tag);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  filter: drop-shadow(0 3px 0 var(--tag-ledge)); transform: rotate(3deg);
}
.streak::before { content: ''; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--paper); }
.streak b { font-size: 1.35rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.streak small { font-size: .72rem; font-weight: 700; opacity: .8; }
.streak.off { filter: grayscale(.8) drop-shadow(0 3px 0 var(--tag-ledge)); opacity: .7; }

/* phase switcher */
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--r-btn); padding: 4px; }
.phases button { min-height: 44px; border: 0; border-radius: 11px; background: transparent; justify-content: center; font-weight: 750; color: var(--muted); gap: 6px; }
.phases button[aria-pressed="true"] { background: var(--mat); color: var(--mat-ink); }

/* section headings outside cards give the page its rhythm */
.sec { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 800; margin: 8px 0 -4px !important; }
.sec .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--tag-light); font-size: 1.15rem; }
.sec small { margin-left: auto; font-size: .9rem; font-weight: 650; color: var(--muted); font-variation-settings: 'wdth' 100; }

.card { background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--r-card); padding: 18px; }

/* chunky buttons */
.chunk {
  font: inherit; font-weight: 800; font-size: 1.1rem; font-variation-settings: 'wdth' 105; letter-spacing: .005em;
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 58px; padding: 12px 18px; border-radius: var(--r-btn); cursor: pointer; text-decoration: none;
  border: 2px solid var(--line); border-bottom: 6px solid var(--line-ledge); background: var(--surface); color: var(--ink);
  transition: transform .06s ease, border-bottom-width .06s ease, margin .06s ease;
}
.chunk:active { transform: translateY(4px); border-bottom-width: 2px; margin-bottom: 4px; }
.chunk.go { background: var(--mat); color: var(--mat-ink); border-color: var(--mat-ledge); }
.chunk.tagc { background: var(--tag); color: var(--tag-ink); border-color: var(--tag-ledge); }
.chunk.small { min-height: 50px; font-size: 1rem; border-bottom-width: 4px; }
.chunk.danger { color: var(--alert); }
.chunk:disabled { opacity: .55; }
.chunk .e { font-size: 1.4rem; line-height: 1; }
.pair { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }

/* find stack: photo with a price tag stuck on it */
.stack-head { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: .95rem; }
.progress { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; flex: 1; }
.progress i { display: block; height: 100%; min-width: 12px; background: var(--mat); border-radius: 99px; transition: width .3s ease; }
.stack-card { padding: 0; overflow: hidden; }
.stack-card .photo { position: relative; background: var(--mat-soft); }
.stack-card .pic { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; display: block; }
.stack-card .pic.none { display: grid; place-items: center; font-size: 4.5rem; aspect-ratio: 16 / 8; }
.stack-card .ptag {
  position: absolute; left: 14px; bottom: -18px; padding: 8px 16px 8px 30px; background: var(--tag); color: var(--tag-ink);
  font-size: 1.9rem; font-weight: 800; font-variation-settings: 'wdth' 78; line-height: 1;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
  filter: drop-shadow(0 3px 0 var(--tag-ledge)); transform: rotate(-3deg);
}
.stack-card .ptag::before { content: ''; position: absolute; left: 11px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--surface); }
.stack-card .body { padding: 34px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.stack-card h3 { font-size: 1.25rem; font-weight: 800; line-height: 1.25; font-variation-settings: 'wdth' 100; }
.stack-card .where { color: var(--muted); font-size: 1rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.fit { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; font-size: .9rem; padding: 5px 12px; border-radius: 99px; background: var(--paper); color: var(--muted); }
.fit.good { background: var(--mat-soft); color: var(--mat); }
.stack-card .ai { margin: 0; font-size: .98rem; background: var(--paper); border-radius: 14px; padding: 10px 12px; }
.stack-card .pair { margin-top: 8px; }
.stack-card .link { align-self: center; margin-top: 2px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.cheer { text-align: center; padding: 30px 20px; }
.cheer .big { font-size: 3.4rem; line-height: 1; margin-bottom: 10px; }
.cheer h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.cheer p { color: var(--muted); margin: 0; }

/* next steps: each project is its own card with its journey */
.step-card { display: flex; flex-direction: column; gap: 14px; }
.step-card.stale { border-color: var(--alert); }
.step-top { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; }
.step-top .icon { width: 52px; height: 52px; border-radius: 16px; background: var(--tag); box-shadow: 0 3px 0 var(--tag-ledge); display: grid; place-items: center; font-size: 1.6rem; }
.step-top h3 { font-size: 1.1rem; font-weight: 800; line-height: 1.25; font-variation-settings: 'wdth' 100; }
.step-top p { margin: 3px 0 0; color: var(--muted); font-size: .95rem; }
.step-top p.late { color: var(--alert); font-weight: 750; }
.journey { display: flex; align-items: center; gap: 0; padding: 0 4px; }
.journey i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.journey i.done { background: var(--mat); }
.journey i.now { background: var(--tag); box-shadow: 0 0 0 4px var(--tag-light); width: 18px; height: 18px; }
.journey b { flex: 1; height: 4px; background: var(--line); }
.journey b.done { background: var(--mat); }
.journey-labels { display: flex; justify-content: space-between; font-size: .75rem; font-weight: 650; color: var(--muted); margin-top: -8px; }

/* agenda as a little timeline */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; }
.agenda li + li { border-top: 2px dashed var(--line); }
.agenda .t { font-weight: 800; font-size: 1.1rem; font-variation-settings: 'wdth' 85; line-height: 1.1; }
.agenda .t small { display: block; font-weight: 600; font-size: .78rem; color: var(--muted); font-variation-settings: 'wdth' 100; margin-top: 2px; }
.agenda .what { font-weight: 700; line-height: 1.3; }
.agenda .what small { display: block; color: var(--muted); font-weight: 500; font-size: .9rem; }
.agenda li.mine .t { color: var(--mat); }
.agenda li.other .what { font-weight: 550; color: var(--muted); }
.agenda li.done .what { text-decoration: line-through; opacity: .55; }
.agenda li.allday { grid-template-columns: 58px 1fr; }
.agenda li.allday .t { font-size: .8rem; color: var(--muted); }
.agenda .tick { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); font-size: 1.1rem; }
.agenda li.done .tick { background: var(--mat); color: var(--mat-ink); border-color: var(--mat-ledge); }
.empty-day { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 0; }
.empty-day span { font-size: 1.6rem; }
.free { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--paper); }
.free p { margin: 0 0 8px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.free-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.free-chips button { border: 2px dashed var(--mat); color: var(--mat); background: var(--mat-soft); border-radius: 12px; font-weight: 750; min-height: 44px; padding: 8px 14px; }
.cal-off { font-size: .9rem; color: var(--muted); margin: 12px 0 0; }

/* done today */
.done-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.done-list li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; font-weight: 600; line-height: 1.35; }
.done-list li::before { content: '✓'; width: 28px; height: 28px; border-radius: 50%; background: var(--mat); color: var(--mat-ink); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.done-list small { display: block; color: var(--muted); font-weight: 500; }

/* bottom sheet */
dialog.sheet { width: min(540px, 100vw); max-width: 100vw; margin: auto auto 0; border-radius: 26px 26px 0 0; max-height: 92dvh; padding: 0; }
@media (min-width: 821px) { dialog.sheet { margin: auto; border-radius: 26px; } }
dialog.sheet form { padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
dialog.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
dialog.sheet h2 { font-size: 1.4rem; font-weight: 800; margin: 0; }
dialog.sheet .meta { color: var(--muted); margin: 4px 0 0; }
.sheet .q { font-weight: 800; font-size: 1rem; margin: 20px 0 10px; display: flex; gap: 8px; align-items: baseline; }
.sheet .q small { font-weight: 600; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tiles label, .choices label { cursor: pointer; }
.tiles input, .choices input { position: absolute; opacity: 0; pointer-events: none; }
.tiles span {
  display: grid; justify-items: center; gap: 6px; padding: 12px 2px 10px; border-radius: var(--r-btn); border: 2px solid var(--line); border-bottom-width: 5px;
  font-weight: 750; font-size: .82rem; background: var(--surface); text-align: center;
}
.tiles span b { font-size: 1.75rem; font-weight: 400; line-height: 1; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices span { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 14px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; font-weight: 700; background: var(--surface); }
.tiles input:checked + span, .choices input:checked + span { border-color: var(--mat); background: var(--mat-soft); color: var(--mat); }
.tiles input:focus-visible + span, .choices input:focus-visible + span { outline: 2px solid var(--mat); outline-offset: 2px; }
.sheet .actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 18px; margin-top: 4px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- phone polish for the rest of the app ---------- */
.rail .ni { display: none; }
@media (max-width: 820px) {
  body { font-size: 16.5px; }
  main { padding: 18px 16px calc(112px + env(safe-area-inset-bottom)); }
  .rail {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 4px; background: var(--surface); color: var(--ink);
    border-top: 2px solid var(--line); box-shadow: 0 -6px 20px -12px rgba(0, 0, 0, .25);
  }
  .rail a.nav { flex: 1; flex-direction: column; justify-content: center; gap: 2px; font-size: .72rem; padding: 6px 2px; min-height: 58px; border-radius: 14px; font-weight: 750; opacity: 1; color: var(--muted); position: relative; }
  .rail a.nav:hover { background: transparent; }
  .rail a.nav[aria-current="page"] { background: var(--mat-soft); color: var(--mat); }
  .rail .ni { display: block; font-size: 1.45rem; line-height: 1; }
  .rail .count { position: absolute; top: 2px; right: calc(50% - 22px); font-size: .7rem; padding: 0 6px; line-height: 1.5; }
  .rail .nl-long { display: none; }
  .pagehead { margin-bottom: 20px; }
  .pagehead h1 { font-weight: 800; }
  .panel { border-radius: 20px; border-width: 2px; border-bottom-width: 4px; padding: 18px; }
  .panel + .panel { margin-top: 16px; }
  .split { gap: 16px; }
  .split > aside > .panel:first-child { margin-top: 0; }
  button.primary, .btn.primary { border-bottom: 4px solid var(--mat-ledge); border-radius: 14px; min-height: 48px; font-weight: 750; }
  button, .btn { border-radius: 12px; min-height: 44px; }
  .ledger { border-radius: 20px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); margin: 0 0 24px; }
  .ledger div { padding: 14px 16px; }
  .ledger div:nth-child(3) { border-left: 0; padding-left: 16px; }
  .tag { margin-bottom: 18px; }
  .find { padding: 16px 0; }
  .find .actions button { min-height: 48px; border-radius: 14px; }
}
@media (min-width: 821px) { .rail .nl-short, .m-only { display: none !important; } }
@media (max-width: 820px) {
  .pagehead > .row { width: 100%; }
  .pagehead > .row > #plan-item { flex: 1 1 100%; justify-content: center; min-height: 52px; font-size: 1.05rem; background: var(--tag); color: var(--tag-ink); border-color: var(--tag-ledge); }
  .pagehead > .row > .danger { flex: 1; justify-content: center; }
  .steps { flex-wrap: nowrap; overflow-x: auto; gap: 8px; margin: 0 -16px 24px; padding: 2px 16px 6px; scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .steps button, .steps button:first-child, .steps button:last-child { flex: 0 0 auto; border-radius: 99px !important; border-width: 2px !important; border-bottom-width: 4px !important; min-height: 44px; padding: 6px 14px 6px 8px; white-space: nowrap; }
  .steps button.done { color: var(--mat); border-color: var(--mat-soft); }
  .steps button.current { border-color: var(--mat-ledge); }
  input, select, textarea { min-height: 48px; border-radius: 12px; border-width: 2px; }
  .grid-form { gap: 16px; }
  .back { font-weight: 700; color: var(--mat); }
}

/* ---------- the same chunky theme on wide screens ---------- */
@media (min-width: 821px) {
  /* sidebar with icons */
  .rail { padding: 24px 14px; gap: 6px; }
  .rail .ni { display: inline-block; width: 26px; font-size: 1.15rem; line-height: 1; }
  .rail a.nav { justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; font-weight: 650; }
  .rail a.nav .count { margin-left: auto; }
  .rail a.nav[aria-current="page"] { box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }

  main { padding: 36px clamp(24px, 4vw, 56px) 80px; }
  .pagehead h1 { font-weight: 800; }
  .panel { border-radius: 22px; border-width: 2px; border-bottom-width: 4px; padding: 22px; }
  .panel + .panel { margin-top: 20px; }
  .split { gap: 28px; }
  button, .btn { border-radius: 12px; min-height: 44px; border-width: 2px; }
  button.primary, .btn.primary { border-bottom: 4px solid var(--mat-ledge); border-radius: 14px; font-weight: 750; padding-inline: 18px; }
  button.primary:active, .btn.primary:active { transform: translateY(2px); border-bottom-width: 2px; }
  input, select, textarea { border-radius: 12px; border-width: 2px; }
  .ledger { border-radius: 22px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); }
  .ledger div { padding: 16px 20px; }
  .ledger div + div { padding-left: 20px; }
  .bench-line { max-width: 34ch; }
  #plan-item { background: var(--tag); color: var(--tag-ink); border-color: var(--tag-ledge); }

  /* project status as a row of pills instead of a boxy table */
  .steps { gap: 8px; }
  .steps button, .steps button:first-child, .steps button:last-child {
    border-radius: 99px !important; border-width: 2px !important; border-bottom-width: 4px !important;
    padding: 6px 16px 6px 8px; min-height: 44px;
  }
  .steps button.done { color: var(--mat); border-color: var(--mat-soft); }
  .steps button.current { border-color: var(--mat-ledge); }

  .find .actions button { border-radius: 14px; min-height: 46px; }
  .lanes { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* find card: photo left, details right on wide screens */
@media (min-width: 1000px) {
  .stack-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stack-card .photo { height: 100%; }
  .stack-card .pic, .stack-card .pic.none { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
  .stack-card .photo { min-height: 300px; }
}
@media (min-width: 1000px) { .stack-card .photo .ptag { bottom: 18px; left: 14px; z-index: 1; } }

.market { margin-top: 16px; padding-top: 14px; border-top: 2px dashed var(--line); font-size: .95rem; }
.market p { margin: 0 0 6px; }
.market .row { margin-top: 10px; }

/* notification prompt */
.push-card { display: flex; flex-direction: column; gap: 14px; border-color: var(--tag-edge); background: linear-gradient(0deg, var(--surface), var(--surface)); }
.push-card .pc-top { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: start; }
.push-card .pc-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--tag); box-shadow: 0 3px 0 var(--tag-ledge); display: grid; place-items: center; font-size: 1.4rem; }
.push-card h3 { font-size: 1.1rem; font-weight: 800; font-variation-settings: 'wdth' 100; margin: 0 0 2px; }
.push-card p { margin: 0; color: var(--muted); }
#push-slot:empty { display: none; }
