/* Layout: soft kanban — a calm grey ground, rounded white task cards in three columns,
   people and in-progress work marked with a warm peach; the task opens as a floating sheet. */
:root {
  --paper: #f2f2f7;
  --sheet: #ffffff;
  --sheet-2: #f2f2f7;
  --ink: #1d1b2e;
  --ink-2: #45435a;
  --muted: #6c6a80;
  --rule: #ebeaf2;
  --rule-strong: #d6d4e3;
  --marker: #ffdcd0;
  --marker-ink: #8a2a12;
  --done: #16835a;
  --done-soft: #d9f3e7;
  --dropped: #9b99ad;
  --link: #4b3fd1;
  --danger: #d6343a;
  --scrim: rgba(29, 27, 46, 0.25);
  --shadow: 0 1px 2px rgba(29, 27, 46, 0.06), 0 12px 32px -18px rgba(29, 27, 46, 0.25);
  --shadow-lift: 0 1px 2px rgba(29, 27, 46, 0.08), 0 18px 40px -18px rgba(29, 27, 46, 0.35);

  --f-body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r: 18px;
  --r-lg: 22px;
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.86em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* peach highlighter band behind a word */
.mark-hl, .mark b i, .hero h1 i {
  font-style: normal;
  background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 94%, transparent 94%);
  padding: 0 2px;
}

/* ---------- top bar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.mark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  text-decoration: none !important;
  white-space: nowrap;
}
.mark b { font: 700 18px/1 var(--f-body); letter-spacing: -0.015em; }
.mark span { font-size: 12px; color: var(--muted); }
.bar .spacer { flex: 1; }
.bar-nav { display: flex; align-items: center; gap: 6px; }
.navlink {
  font-size: 14px;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 20px;
}
.navlink:hover { background: var(--sheet); text-decoration: none; color: var(--ink); }
.navlink[aria-current="page"] { color: var(--ink); background: var(--sheet); box-shadow: var(--shadow); }
.me { display: flex; align-items: center; gap: 8px; }
.me form { display: contents; }
.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.iconbtn:hover { background: var(--sheet); color: var(--ink); }

/* ---------- avatar ---------- */
.ava {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--sheet-2);
  font: 600 10px/1 var(--f-body);
  color: var(--ink-2);
  text-transform: uppercase;
}
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava.lg { width: 32px; height: 32px; font-size: 12px; }

/* ---------- board header ---------- */
.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 24px var(--gutter) 22px;
}
.repo-title { min-width: 0; }
.repo-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
.repo-pick .org { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.repo-pick .name {
  display: block;
  font: 700 clamp(24px, 3.2vw, 32px)/1.1 var(--f-body);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.repo-pick .caret {
  display: flex;
  flex: none;
  align-self: flex-end;
  margin-bottom: 5px;
  color: var(--muted);
}
.repo-pick .caret svg {
  display: block;
  transform-origin: center;
  transition: transform 0.15s;
}
.repo-pick[aria-expanded="true"] .caret svg { transform: rotate(180deg); }
.tally { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tally span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 11px;
  border-radius: 13px;
  background: var(--sheet);
  font-size: 12px;
  color: var(--ink-2);
}
.tally b { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.tally .t-work { background: var(--marker); color: var(--marker-ink); }
.tally .t-work b { color: var(--marker-ink); }
.tally .t-done { background: var(--done-soft); color: var(--done); }
.tally .t-done b { color: var(--done); }
.tally .muted { background: none; padding: 0 2px; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.board-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { position: relative; display: flex; align-items: center; }
.search input {
  width: min(280px, 70vw);
  height: 44px;
  padding: 0 40px 0 40px;
  border-radius: 22px;
  border: 0;
  background: var(--sheet);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: 14px var(--f-body);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--link) 25%, transparent); }
.search svg { position: absolute; left: 15px; color: var(--muted); pointer-events: none; }
.search kbd {
  position: absolute;
  right: 12px;
  font: 500 11px/1 var(--f-body);
  color: var(--muted);
  background: var(--sheet-2);
  border-radius: 6px;
  padding: 4px 7px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 0;
  background: var(--sheet);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }

@media (max-width: 540px) {
  .tools .search { flex-basis: 100%; }
  .board-filters { width: 100%; display: grid; grid-template-columns: auto 1fr; }
  .board-filters .chip { justify-content: center; }
}

/* Sort picker: the board's rounded sheet with a single selected order. */
.sort-trigger[data-active="true"] { background: var(--ink); color: #fff; }
.sort-trigger span { overflow: hidden; text-overflow: ellipsis; }
.sort-trigger svg { flex: none; }
.sort-trigger { max-width: 100%; }
.sort-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(340px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow-lift), 0 20px 60px -24px rgba(29, 27, 46, .3);
  overflow: auto;
  opacity: 0;
  translate: 0 -6px;
  transition: opacity .16s ease, translate .18s ease, display .18s allow-discrete, overlay .18s allow-discrete;
}
.sort-panel:popover-open { opacity: 1; translate: 0 0; }
@starting-style { .sort-panel:popover-open { opacity: 0; translate: 0 -6px; } }
.sort-panel h2 { margin: 2px 12px 12px; font-size: 16px; font-weight: 600; }
.sort-options { display: grid; gap: 4px; }
.sort-option { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; color: var(--ink-2); cursor: pointer; transition: background .16s ease, color .16s ease; }
.sort-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sort-option span { flex: 1; min-width: 0; }
.sort-option b { display: block; font-size: 14px; font-weight: 500; }
.sort-option small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.sort-option > svg { flex: none; opacity: 0; }
.sort-option:hover { background: var(--sheet-2); }
.sort-option:has(input:checked) { background: var(--sheet-2); color: var(--ink); }
.sort-option:has(input:checked) > svg { opacity: 1; }
.sort-option:has(input:focus-visible) { outline: 2px solid var(--link); outline-offset: 2px; }

/* repo dropdown */
.menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  left: 0;
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  max-height: 60vh;
  overflow: auto;
  padding: 8px;
  background: var(--sheet);
  border-radius: var(--r);
  box-shadow: var(--shadow-lift);
}
.menu a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  color: var(--ink);
}
.menu a:hover { background: var(--sheet-2); text-decoration: none; }
.menu a[aria-current="true"] { background: var(--ink); color: #fff; }
.menu a .r { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.menu a .c {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 26px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 13px;
  background: var(--sheet-2);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.menu a[aria-current="true"] .c { background: rgba(255, 255, 255, 0.18); color: #fff; }
.menu .c b { font-weight: 600; }

/* ---------- columns ---------- */
.tabs { display: none; }
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
  padding: 0 var(--gutter) 64px;
  align-items: start;
}
.col { min-width: 0; }
.col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 4px;
  margin-bottom: 8px;
}
.col-head h2 { margin: 0; font: 600 17px/1 var(--f-body); }
.col[data-col="in_progress"] .col-head h2 span { background: linear-gradient(transparent 50%, var(--marker) 50%, var(--marker) 95%, transparent 95%); padding: 0 2px; }
.col-head .n {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--sheet);
  box-shadow: var(--shadow);
  font: 600 12px/1 var(--f-body);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.col-head .toggle {
  margin-left: auto;
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.col-head .toggle:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.cards { display: flex; flex-direction: column; gap: 12px; }
.empty {
  padding: 24px 16px;
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- card ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  padding: 16px 16px 14px;
  border: 0;
  border-radius: var(--r);
  background: var(--sheet);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card[aria-current="true"] { box-shadow: var(--shadow-lift), 0 0 0 2px var(--ink); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card-top .age { margin-left: auto; font-variant-numeric: tabular-nums; }
.card-top .age.old { color: var(--danger); font-weight: 500; }
.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.p-low { --priority-ink: #526077; --priority-bg: #edf0f5; }
.p-medium { --priority-ink: #5145a0; --priority-bg: #eeeafa; }
.p-high { --priority-ink: #8a4a0b; --priority-bg: #fff0d6; }
.p-urgent { --priority-ink: #ad293f; --priority-bg: #fde8ed; }
.priority { color: var(--priority-ink, var(--muted)); background: var(--priority-bg, var(--sheet)); }
.priority svg { flex: none; }
.card h3 {
  margin: 0;
  font: 500 15px/1.4 var(--f-body);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.card .ex {
  margin: -3px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card .ex code { padding: 1px 4px; border-radius: 4px; background: var(--sheet-2); }
.card-foot { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.card-foot .who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-foot .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot .cnt { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.card-foot .cnt:first-of-type { margin-left: auto; }

.hl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 10px 4px 4px;
  border-radius: 12px;
  background: var(--marker);
  color: var(--marker-ink);
  font-size: 12px;
  font-weight: 500;
}
.hl .ava { width: 18px; height: 18px; background: rgba(255, 255, 255, 0.6); color: var(--marker-ink); }
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 10px 3px 8px;
  border-radius: 12px;
  background: var(--done-soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--done);
}
.card.is-dropped { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rule-strong); }
.card.is-dropped h3 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--dropped); }
.card.is-dropped .stamp { background: var(--sheet-2); color: var(--muted); }

/* ---------- drawer ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  z-index: 50;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(620px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sheet);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -30px rgba(29, 27, 46, 0.45);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.drawer.on { transform: none; }
.d-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 24px;
  border-bottom: 1px solid var(--rule);
}
.d-head .id { font-size: 13px; font-weight: 600; color: var(--muted); }
.d-scroll { flex: 1; overflow: auto; padding: 22px 24px 48px; overscroll-behavior: contain; }
.d-scroll h1 {
  margin: 0 0 18px;
  font: 600 23px/1.3 var(--f-body);
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--sheet-2);
  color: var(--ink-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-in_progress { background: var(--marker); color: var(--marker-ink); }
.pill.s-done { background: var(--done-soft); color: var(--done); }
.pill.s-dropped { color: var(--dropped); }
.meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 9px 18px;
  margin: 0 0 24px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--sheet-2);
  font-size: 13px;
}
.meta dt { color: var(--muted); align-self: center; }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.body {
  max-width: 68ch;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.6;
}
.body code, .note-text code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--sheet-2);
  white-space: pre-wrap;
}
.section-label { margin: 30px 0 12px; font: 600 15px/1 var(--f-body); }
.rel { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.rel a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 12px;
  color: var(--ink);
}
.rel a:hover { background: var(--sheet-2); text-decoration: none; }
.rel .id { font-size: 12px; color: var(--muted); flex: none; }
.rel .t { min-width: 0; overflow-wrap: anywhere; }
.rel .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--rule-strong); align-self: center; }
.rel .dot.s-in_progress { background: #f08a6c; }
.rel .dot.s-done { background: var(--done); }
.rel .is-closed .t { color: var(--muted); }

.log { position: relative; margin: 0; padding: 0; list-style: none; }
.log::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--rule); }
.log li { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 0 0 18px; }
.log li .ava { position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--sheet); }
.log .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; padding-top: 6px; }
.log .who b { font-weight: 600; }
.log .who time { color: var(--muted); font-size: 12px; }
.note-text { margin-top: 6px; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--sheet-2); white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
:is(.body, .note-text) :is(p, ul, ol, pre, blockquote, .markdown-table) { margin: 0 0 1em; }
:is(.body, .note-text) :is(h1, h2, h3, h4, h5, h6) { margin: 1.2em 0 .5em; font-size: 1.1em; line-height: 1.3; }
:is(.body, .note-text) h1 { font-size: 1.5em; }
:is(.body, .note-text) h2 { font-size: 1.3em; }
:is(.body, .note-text) :is(ul, ol) { padding-left: 1.5em; }
:is(.body, .note-text) li + li { margin-top: .3em; }
:is(.body, .note-text) pre { padding: 12px; border-radius: 8px; background: var(--sheet-2); overflow: auto; white-space: pre; }
:is(.body, .note-text) pre code { padding: 0; background: transparent; white-space: pre; }
:is(.body, .note-text) blockquote { padding-left: 14px; border-left: 3px solid var(--rule-strong); color: var(--muted); }
:is(.body, .note-text) > :first-child { margin-top: 0; }
:is(.body, .note-text) > :last-child { margin-bottom: 0; }
.markdown-table { max-width: 100%; overflow-x: auto; }
.markdown-table table { border-collapse: collapse; font-size: .9em; }
.markdown-table :is(th, td) { padding: 6px 10px; border: 1px solid var(--rule-strong); text-align: left; }
.file-preview { display: block; margin: 14px 0; white-space: normal; }
.file-preview img { display: block; max-width: 100%; max-height: 440px; border-radius: 12px; object-fit: contain; background: var(--sheet); }
.file-preview .file-caption { display: block; margin-top: 7px; font-size: 12px; }
.file-link { overflow-wrap: anywhere; }
.file-preview > a { display: block; cursor: zoom-in; }
.file-preview > a img { transition: box-shadow .15s; }
.file-preview > a:hover img { box-shadow: 0 0 0 3px var(--rule-strong); }

/* Native modal keeps keyboard focus inside the viewer and the task underneath. */
.photo-viewer {
  position: fixed; inset: 0; margin: 0; padding: 0; border: 0;
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  overflow: hidden;
  color: #f4f3fa; background: rgba(18, 17, 27, .97);
  font-family: var(--f-body);
}
.photo-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.photo-viewer::backdrop { background: rgba(18, 17, 27, .75); backdrop-filter: blur(8px); }
.photo-head { display: flex; align-items: center; gap: 20px; padding: max(18px, env(safe-area-inset-top)) 24px 18px; }
.photo-heading { min-width: 0; flex: 1; }
#photo-context { color: #aaa6ba; font-size: 12px; font-variant-numeric: tabular-nums; }
.photo-heading h2 { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 500; }
.photo-actions { display: flex; gap: 8px; }
.photo-btn {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff1c;
  border-radius: 50%; background: #ffffff09; color: #f4f3fa; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.photo-btn:hover { background: #ffffff20; border-color: #ffffff40; text-decoration: none; }
.photo-btn[aria-pressed="true"] { background: #ffffff25; }
.photo-viewer :focus-visible { outline: 2px solid #c7baff; outline-offset: 4px; }
.photo-content { position: relative; min-height: 0; }
.photo-stage { display: grid; place-items: center; width: 100%; height: 100%; padding: 16px 80px; overflow: hidden; overscroll-behavior: contain; }
#photo-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 8px; box-shadow: 0 12px 56px #0005; cursor: zoom-in; }
.photo-stage.zoomed { display: block; padding: 24px 80px; overflow: auto; }
.photo-stage.zoomed #photo-image { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
.photo-stage.loading #photo-image, .photo-stage.failed #photo-image { display: none; }
.photo-message { display: none; color: #aaa6ba; text-align: center; font-size: 14px; }
.photo-stage.loading .photo-message, .photo-stage.failed .photo-message { display: block; }
.photo-prev, .photo-next { position: absolute; top: calc(50% - 22px); background: #292735ee; }
.photo-prev { left: 20px; }
.photo-next { right: 20px; }
.photo-foot { display: grid; justify-items: center; gap: 14px; padding: 18px 24px max(20px, env(safe-area-inset-bottom)); }
.photo-thumbs { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; padding: 5px; }
.photo-thumbs:empty { display: none; }
.photo-thumbs button { flex: none; width: 56px; height: 56px; padding: 3px; border: 1px solid transparent; border-radius: 12px; background: none; opacity: .55; cursor: pointer; }
.photo-thumbs button[aria-current="true"] { border-color: #c7baff; opacity: 1; background: #c7baff18; }
.photo-thumbs img { display: block; width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.photo-hint { color: #aaa6ba; font-size: 12px; }
.photo-hint span { margin: 0 10px; color: #595465; }
@media (max-width: 600px) {
  .photo-head { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .photo-actions { gap: 4px; }
  .photo-btn { width: 40px; height: 40px; }
  .photo-heading h2 { font-size: 14px; }
  .photo-stage { padding: 12px 16px 64px; }
  .photo-stage.zoomed { padding: 16px; }
  .photo-prev, .photo-next { top: auto; bottom: 4px; }
  .photo-prev { left: calc(50% - 48px); }
  .photo-next { right: calc(50% - 48px); }
  .photo-hint { display: none; }
  .photo-foot { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .photo-btn, .file-preview > a img { transition: none; } }
.evt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 6px 0 0;
  padding: 3px 10px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 500;
  background: var(--sheet-2);
  color: var(--ink-2);
}
.evt.to-in_progress { background: var(--marker); color: var(--marker-ink); }
.evt.to-done { background: var(--done-soft); color: var(--done); }

/* ---------- plain pages (login, connect) ---------- */
.page { max-width: 760px; margin: 0 auto; padding: clamp(32px, 8vh, 88px) var(--gutter) 64px; }
.page.narrow { max-width: 540px; }
.hero h1 {
  margin: 0 0 12px;
  font: 700 clamp(30px, 5vw, 44px)/1.12 var(--f-body);
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero p { margin: 0 0 28px; color: var(--ink-2); font-size: 16px; max-width: 52ch; }
.panel {
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--sheet);
  box-shadow: var(--shadow);
}
.panel > * + * { margin-top: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 22px;
  border-radius: 23px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font: 600 14px/1 var(--f-body);
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--sheet-2); color: var(--ink-2); font-weight: 500; }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { color: var(--danger); }
.login-panel { display: grid; gap: 16px; }
.login-panel > * { margin: 0; }
.login-panel .btn { width: 100%; }
.login-panel .btn svg { flex: none; }
.login-panel p { text-align: center; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.err {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fde8e8;
  color: var(--danger);
  font-size: 14px;
}
.prompt {
  margin: 0;
  max-height: 46vh;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--sheet-2);
  font: 12.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-2);
}
.steps { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: var(--ink-2); font-size: 14px; counter-increment: s; }
.steps li::before {
  content: counter(s);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sheet);
  box-shadow: var(--shadow);
  font: 600 12px/1 var(--f-body);
  color: var(--ink);
}
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--sheet-2); font-size: 14px; }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .bar { gap: 6px; }
  .mark span { display: none; }
  .navlink { padding: 8px 10px; }
  .navlink[aria-current="page"] { display: none; }
  .navlink .wide { display: none; }
  .board-head { padding-top: 16px; }
  .tools { width: 100%; }
  .search { flex: 1 1 200px; min-width: 0; }
  .search input { width: 100%; }
  .search kbd { display: none; }
  .tabs {
    display: flex;
    gap: 4px;
    margin: 0 var(--gutter) 14px;
    padding: 4px;
    border-radius: 24px;
    background: var(--sheet);
    box-shadow: var(--shadow);
  }
  .tabs button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    border: 0;
    border-radius: 20px;
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
  }
  .tabs button b { font-weight: 600; font-variant-numeric: tabular-nums; }
  .tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .board .col { display: none; }
  .board .col.active { display: block; }
  .col-head { display: none; }
  .board .col.active .col-head:has(.toggle) { display: flex; }
  .board .col.active .col-head:has(.toggle) h2, .board .col.active .col-head:has(.toggle) .n { display: none; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); }
  .d-head { padding-left: 16px; }
  .d-scroll { padding: 18px 16px 40px; }
}
