:root {
  color-scheme: light;
  --bg: #f3f1ec;
  --ink: #1c1916;
  --muted: #6f675e;
  --panel: #fffcf8;
  --line: #e4ddd3;
  --accent: #1c1916;
  --accent-ink: #fffcf8;
  --rail: #161412;
  --rail-ink: #f6f1ea;
  --shadow: 0 16px 40px rgba(28, 25, 22, 0.08);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .text-btn { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  background: transparent;
  color: inherit;
  border: 0;
  text-align: left;
  font-family: Palatino, "Iowan Old Style", serif;
  font-size: 26px;
  letter-spacing: -0.03em;
  padding: 18px 16px 8px;
}
.rail nav { overflow: auto; flex: 1; padding: 8px; }
.rail-label { margin: 16px 10px 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #b7aea3; }
.rail-label:first-child { margin-top: 6px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; display: block; }
.rail nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
}
.rail nav button[aria-current="page"] { background: var(--rail-ink); color: var(--ink); }
.rail-foot { display: grid; gap: 6px; padding: 10px; border-top: 1px solid #2c2824; }
.rail-foot .project { display: grid; gap: 4px; font-size: 12px; color: #b7aea3; padding: 4px 2px 0; }
.project-row { display: flex; gap: 6px; }
.project-row select {
  flex: 1;
  min-width: 0;
  appearance: none;
  background-color: #241f1b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f6f1ea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  color: var(--rail-ink);
  border: 1px solid #3a342e;
  padding: 8px 40px 8px 10px;
}
.project-row button {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #3a342e;
  background: transparent;
  color: inherit;
  border-radius: 10px;
}
.project-row button .icon-check { display: none; }
.project-row button.armed { background: #8d1d1d; color: #fff; border-color: #8d1d1d; }
.project-row button.armed .icon-trash { display: none; }
.project-row button.armed .icon-check { display: block; }
.rail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid #2c2824;
}
.rail-actions button {
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #3a342e;
  border-radius: 12px;
  background: #241f1b;
  color: inherit;
}
.rail-actions button:hover { border-color: #6d645b; }
#sign-out {
  background: transparent;
  color: #b7aea3;
  border: 0;
  text-align: left;
  padding: 8px 8px 2px;
  font-size: 13px;
}
#user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#user-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#user-list button { border: 0; background: none; color: #9a4b24; padding: 0; }
#login { display: none; }
body.signed-out { display: block; }
body.signed-out .rail,
body.signed-out .workspace { display: none; }
body.signed-out #login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}
#login form {
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
  background: var(--panel);
  padding: 32px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
#login h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", serif;
  font-size: 36px;
  letter-spacing: -0.03em;
}
#login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
#login-form button { width: 100%; }
#login-error { color: #8d1d1d; margin: 0; }
#users-admin { display: grid; gap: 12px; margin-top: 18px; }
.rail-actions .icon { width: 22px; height: 22px; }
.rail-actions button[aria-current="page"] { background: var(--rail-ink); color: var(--ink); border-color: var(--rail-ink); }
.rail-foot input { background: #241f1b; color: var(--rail-ink); border: 1px solid #3a342e; }

input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.workspace { min-width: 0; }
.dashboard { padding: 28px 32px 48px; display: grid; gap: 28px; }
.dashboard h2, .tool-head h1, .stage h2 { font-family: Palatino, "Iowan Old Style", serif; font-weight: 500; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.cards button {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 6px;
  min-height: 96px;
}
.cards button:hover { border-color: var(--ink); }
.cards strong { font-size: 16px; }
.cards span { color: var(--muted); font-size: 13px; }

.tool-head { padding: 22px 24px 0; }
.tool-head .hint { max-width: 62ch; margin-top: 8px; }
.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  color: var(--muted);
  cursor: help;
  vertical-align: 1px;
}
.tip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 220px;
  height: 10px;
}
.tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 30;
  left: 0;
  top: calc(100% + 6px);
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow);
  pointer-events: auto;
  visibility: hidden;
}
.tip:hover::after,
.tip:focus::after,
.tip:focus-visible::after { visibility: visible; }
#space-label { margin: 0 0 2px; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.space-tabs { display: flex; gap: 8px; margin-top: 14px; }
.space-tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 14px; }
.space-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cards em { font-style: normal; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; padding: 16px 24px 40px; align-items: start; }
.stage, .options { display: grid; gap: 12px; align-content: start; }
.stage, .stage > * { min-width: 0; }
.options {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  position: sticky;
  top: 16px;
}
.options label, fieldset, #inspiration-box { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
#inspiration-row { display: flex; gap: 8px; align-items: center; }
#inspiration-preview { width: 72px; height: 54px; object-fit: cover; border-radius: 10px; }
.mini-drop {
  width: 88px;
  height: 54px;
  border: 1.5px dashed #c8b49a;
  border-radius: 10px;
  display: grid;
  place-items: center;
  position: relative;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  padding: 4px;
}
.mini-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
fieldset { border: 0; margin: 0; padding: 0; }
fieldset[data-field="mode"] { grid-template-columns: 1fr 1fr 1fr; }
fieldset[data-field="mode"] legend { grid-column: 1 / -1; }
fieldset[data-field="mode"] label {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  color: var(--ink);
}
fieldset[data-field="mode"] input { position: absolute; opacity: 0; }
fieldset[data-field="mode"] label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; }
.ticks .on { color: var(--ink); font-weight: 600; }
.picker-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; }
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.picker.expanded {
  max-height: 360px;
  overflow: auto;
  padding: 2px;
  align-content: start;
  grid-auto-rows: max-content;
}
.picker button {
  position: relative;
  aspect-ratio: 1 / 0.78;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #2c2824;
}
.picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker button span {
  position: absolute;
  z-index: 1;
  left: 5px;
  right: 5px;
  bottom: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  pointer-events: none;
}
.picker button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.color-row { display: flex; gap: 8px; align-items: center; }
#color-hex { width: 48px; padding: 4px; }
#mask-box { display: grid; gap: 8px; }
#brush-options { display: flex; gap: 8px; align-items: center; }
#brush-options button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
}
#brush-options button[data-shape] { display: flex; align-items: center; gap: 8px; }
#brush-options button[data-shape]::before {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  flex: none;
}
#brush-options button[data-shape="round"]::before { border-radius: 50%; }
#brush-options button[data-brush="erase"] { width: 36px; padding: 0; }
#brush-options button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#brush-size-label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.brush-size-head { display: flex; justify-content: space-between; align-items: baseline; }
#brush-size-value { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
#brush-size { width: 100%; padding: 0; }
#brush-cursor {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.95);
  background: rgba(37, 99, 235, 0.16);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 160ms ease, height 160ms ease;
  z-index: 2;
}
#brush-cursor.square { border-radius: 0; }
#brush-cursor.erase { border-color: #1c1916; background: rgba(28, 25, 22, 0.12); }
#brush-cursor.drawing { animation: brush-pop 180ms ease; }
@keyframes brush-pop {
  from { transform: translate(-50%, -50%) scale(0.72); }
  to { transform: translate(-50%, -50%) scale(1); }
}
#generate, #save-settings, #login-form button, #add-user {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
}
#generate { width: 100%; }
button:disabled { opacity: 0.55; cursor: wait; }

.chooser { display: grid; gap: 14px; }
.drop {
  min-height: 220px;
  border: 1.5px dashed #c8b49a;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
  color: var(--ink);
  text-align: center;
  padding: 28px 16px;
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #efe8df;
  color: #6d4e32;
}
.drop-quiet { color: var(--muted); }
.drop strong { font-size: 15px; }
.or {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 22px 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
}
.or::before, .or::after { content: ""; height: 1px; background: var(--line); }
.chooser-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  margin-bottom: 18px;
}
#chooser-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #241f1b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
#chooser-tabs button {
  border: 0;
  background: transparent;
  color: #cfc6bb;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 650;
}
#chooser-tabs button:hover { color: #fff; }
#chooser-tabs button[aria-selected="true"] {
  background: #f3ece3;
  color: #1c1916;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}
#chooser-tabs button[aria-selected="true"]:hover { color: #1c1916; }
.chooser-grid { display: flex; flex-wrap: wrap; gap: 12px; align-content: start; }
.chooser-grid button { border: 0; background: transparent; padding: 0; border-radius: 12px; }
.chooser-grid img { width: 168px; height: 112px; object-fit: cover; border-radius: 12px; display: block; }
.chooser-grid button:hover img, .chooser-grid button:focus-visible img { outline: 2px solid var(--ink); outline-offset: 2px; }
#loaded { position: relative; display: grid; border-radius: 18px; }
#thumb { width: 100%; height: auto; display: block; border-radius: 18px; background: var(--panel); }
#mask-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  cursor: crosshair;
  touch-action: none;
  opacity: 0.46;
}
.text-btn { background: none; border: 0; color: #9a4b24; padding: 0; justify-self: start; text-decoration: none; }
#status { min-height: 1.2em; margin: 0; color: #9a4b24; }
#status.error { color: #8d1d1d; }

.compare {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: var(--photo-ratio, 3 / 2);
  border-radius: 18px;
  overflow: hidden;
  background: #1c1612;
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
}
.compare img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
#before-clip { position: absolute; top: 0; bottom: 0; left: 0; width: var(--split, 50%); overflow: hidden; }
#before-clip img { width: var(--frame-width); height: var(--frame-height); max-width: none; }
.tag {
  position: absolute;
  top: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(22, 20, 18, 0.72);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.before-tag { left: 12px; }
.after-tag { right: 12px; }
#split-bar { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; transform: translateX(-50%); background: #fff; z-index: 3; }
#split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
}
#split-handle::before, #split-handle::after {
  content: "";
  position: absolute;
  top: 16px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #1c1916;
  border-left: 2px solid #1c1916;
}
#split-handle::before { left: 12px; transform: rotate(-45deg); }
#split-handle::after { right: 12px; transform: rotate(135deg); }
.photo-actions {
  display: inline-flex;
  align-items: stretch;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel);
}
.photo-actions:empty, .photo-actions:not(:has(:not([hidden]))) { display: none; }
.photo-actions > button,
.photo-actions > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: none;
}
.photo-actions > button:first-child,
.photo-actions > a:first-child,
.photo-actions > [hidden] + button,
.photo-actions > [hidden] + a { border-left: 0; }
.photo-actions > button:hover,
.photo-actions > a:hover { background: #f6f1ea; }
#favorite[aria-pressed="true"] { color: #b4233a; background: #fff6f5; }
#favorite.pop { animation: heart-pop 0.28s ease; }
.heart {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 252, 248, 0.92);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(28, 25, 22, 0.28);
}
.heart .icon { width: 16px; height: 16px; }
.heart[aria-pressed="true"] { color: #b4233a; }
.heart.pop { animation: heart-pop 0.28s ease; }
.heart:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@keyframes heart-pop {
  0% { transform: scale(0.82); }
  50% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.gallery-card .heart { position: absolute; top: 8px; right: 8px; z-index: 1; }
.history-card { position: relative; width: 140px; flex: none; }
.history-card .heart {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  place-items: center;
  place-content: center;
  align-items: center;
  justify-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: rgba(22, 20, 18, 0.45);
  color: #fff;
  box-shadow: none;
  opacity: 0;
}
.history-card .heart .icon { width: 12px; height: 12px; }
.history-card .heart[aria-pressed="true"] { background: #fff; color: #b4233a; }
.history-card:hover .heart,
.history-card:focus-within .heart,
.history-card .heart[aria-pressed="true"] { opacity: 1; }
.note {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  line-height: 1.5;
}
.note.pending { color: var(--muted); }
.note h2, .note h3, .note h4 { margin: 14px 0 6px; font-size: 15px; font-weight: 650; }
.note h2:first-child, .note h3:first-child, .note h4:first-child { margin-top: 0; }
.note p { margin: 0 0 8px; }
.note ul, .note ol { margin: 0 0 10px; padding-left: 1.2em; }
.note li + li { margin-top: 4px; }
.note a { color: #9a4b24; }
.uploads, .history { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.history { padding: 6px 6px 10px; }
#past { margin-top: 36px; }
#past h2 { margin: 0 0 22px; }
.uploads button { border: 2px solid transparent; background: transparent; padding: 0; border-radius: 12px; }
.uploads img { width: 88px; height: 66px; object-fit: cover; border-radius: 10px; display: block; }
.uploads button[aria-pressed="true"] { border-color: var(--ink); }
.pick-label { font-size: 12px; }
.gallery { padding: 8px 24px 48px; }
.gallery .tool-head { padding-left: 0; padding-right: 0; }
.gallery-toolbar { position: relative; margin-top: 14px; margin-bottom: 18px; }
.gallery .space-tabs { margin: 0; }
.gallery-manage {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.gallery-manage button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 14px;
}
.gallery-manage .text-btn { border: 0; background: none; padding: 0; }
#gallery-delete:not(:disabled) { background: #8d1d1d; color: #fff; border-color: #8d1d1d; }
#gallery-count { margin: 0; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.gallery-grid > button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  border-radius: 14px;
}
.gallery-grid > button > span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.gallery-card { position: relative; }
.gallery-card > button[data-design],
.gallery-card > button[data-upload] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  border-radius: 14px;
}
.gallery-grid img { width: 100%; height: 160px; object-fit: cover; border-radius: 14px; display: block; }
.gallery-card > button[data-design] > span,
.gallery-card > button[data-upload] > span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.gallery-card .tick {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  border: 2px solid #fff;
  background: rgba(22, 20, 18, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.gallery-card .tick:hover { background: #d48455; }
.gallery-card .tick[aria-checked="true"] { background: #c56a32; }
.gallery-card .tick:hover::after,
.gallery-card .tick[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.history button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  width: 140px;
  flex: none;
  text-align: left;
}
.history img { width: 140px; height: 96px; object-fit: cover; border-radius: 12px; display: block; }
.history button:focus { outline: none; }
.history-card:hover img,
.history button:hover img,
.history button:focus-visible img { box-shadow: 0 0 0 2px var(--ink); }
.history .pending {
  width: 140px;
  height: 96px;
  flex: none;
  overflow: hidden;
  border-radius: 12px;
  position: relative;
  background: #d7d0c6;
}
.history .pending img {
  width: 100%;
  height: 100%;
  filter: blur(14px);
  transform: scale(1.2);
}
.history .pending .spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(28, 25, 22, 0.2);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.history button > span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

dialog {
  border: 0;
  border-radius: 18px;
  padding: 22px;
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog form { display: grid; gap: 12px; }
dialog h2 { margin: 0; font-family: Palatino, serif; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 8px; align-items: center; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
code { font-size: 12px; }

@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .rail { position: relative; height: auto; min-width: 0; }
  .rail nav { display: flex; gap: 6px; overflow-x: auto; min-width: 0; align-items: center; }
  .rail-label { flex: none; margin: 0 2px 0 12px; white-space: nowrap; }
  .rail-label:first-child { margin-left: 4px; }
  .rail nav button { width: auto; flex: none; white-space: nowrap; }
  .rail-foot { grid-template-columns: 1fr; }
  .rail-foot .project, .rail-actions { grid-column: 1 / -1; }
  .work { grid-template-columns: 1fr; }
  .options { position: static; }
  .drop { min-height: 240px; }
  .dashboard { padding: 20px 16px 40px; }
}
