:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --text: #1f2328;
  --muted: #676e76;
  --border: #dcd8d0;
  --accent: #1d5fd1;
  --accent-text: #ffffff;
  --danger: #b42318;
  --ok: #1a7f37;
  --chip: #eceae4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.05);
  --radius: 10px;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1e2125;
    --surface-2: #25292e;
    --text: #e8e6e3;
    --muted: #9aa1a9;
    --border: #353a41;
    --accent: #6ea2ff;
    --accent-text: #0d1117;
    --danger: #ff7b72;
    --ok: #56d364;
    --chip: #2c3137;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* `hidden` must win over any display rule below (e.g. .receipt-img). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-wrap: anywhere;
}

h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0.4rem 0; }
a { color: var(--accent); }
code, .code { font-family: var(--mono); font-size: 0.88em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 0.83rem; margin-top: 0.25rem; }
.booting { padding: 2rem; color: var(--muted); }

/* --- header ---------------------------------------------------------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand img { background: #fff; border-radius: 5px; }
nav { display: flex; gap: 0.25rem; margin-left: auto; }
nav:empty { display: none; }
.who { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
@media (max-width: 520px) {
  .who .badge { display: none; }
  .top-inner { gap: 0.5rem 1rem; }
  .top-inner nav { order: 3; width: 100%; margin-left: 0; }
  .top-inner nav a { flex: 1; text-align: center; }
  .top-inner .lang-switch { margin-left: auto; }
  /* friends: brand + language on top, their buttons below */
  .top-inner .who { order: 3; width: 100%; justify-content: flex-end; margin-left: 0; }
}
.lang-switch button { padding: 0.25rem 0.55rem; font-size: 0.8rem; font-weight: 600; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-gap { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.6rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-weight: 500;
}
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--text); color: var(--bg); }

main { max-width: 1180px; margin: 0 auto; padding: 1rem 1rem 4rem; }

.view-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.4rem 0 0.8rem; }
.view-head .btn { margin-left: auto; }
.back { text-decoration: none; }

/* --- cards / layout ---------------------------------------------------------- */
.card, .preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; min-width: 0; flex: 1 1 12rem; }
.part .card-head { flex-wrap: nowrap; align-items: flex-start; }
.part .card-title { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.card-body { padding: 0.8rem 0.9rem; }
.card-body + .card-body { padding-top: 0; }
.tools { margin-left: auto; display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }

.composer, .builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 1.2rem;
  align-items: start;
}
.builder-grid.single { grid-template-columns: minmax(0, 1fr); }
.col-side { position: sticky; top: 4.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 0.8rem; }
.devices-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1rem; align-items: start; }

@media (max-width: 860px) {
  .composer, .builder-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* --- controls ------------------------------------------------------------------ */
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="password"], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  min-height: 2.4rem;
}
textarea { resize: vertical; min-height: 4.5rem; }
textarea.code { font-family: var(--mono); font-size: 0.85rem; line-height: 1.4; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="search"] { margin-bottom: 0.4rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font: inherit;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  min-height: 2.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.subtle { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 0.25rem 0.6rem; min-height: 2rem; font-size: 0.85rem; }
.btn.big { padding: 0.65rem 1.5rem; font-size: 1.05rem; font-weight: 600; }
.btn.add { margin-top: 0.4rem; background: transparent; border-style: dashed; color: var(--accent); }

.icon {
  font: inherit;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.icon:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon:disabled { opacity: 0.3; cursor: default; }
.icon.remove:hover:not(:disabled) { color: var(--danger); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  margin-left: 0.3rem;
  vertical-align: middle;
}
.badge.active { color: var(--ok); }
.badge.revoked, .badge.expired, .badge.old { color: var(--danger); }
.badge.unused { color: var(--accent); }
.chip { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.chips { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { font: inherit; border: 0; background: transparent; color: var(--muted); padding: 0.4rem 0.9rem; cursor: pointer; }
.segmented button.active { background: var(--text); color: var(--bg); }

/* --- generated forms ---------------------------------------------------------- */
.fields { display: flex; flex-direction: column; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.label { font-weight: 600; font-size: 0.88rem; }
.req { color: var(--danger); }
.field.check { flex-direction: row; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.field.check input { width: 1.2rem; height: 1.2rem; }
/* a checkbox with a long label: the text wraps beside it, not under it */
label.field.check { flex-wrap: nowrap; align-items: flex-start; }
label.field.check input { flex: none; margin-top: 0.1rem; }
fieldset.group { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.7rem 0.7rem; margin: 0; min-width: 0; }
fieldset.group legend { font-weight: 600; font-size: 0.88rem; padding: 0 0.3rem; }
.array-head { display: flex; align-items: baseline; gap: 0.5rem; }
.array-head .count { color: var(--muted); font-size: 0.8rem; }
.array-items { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.array-item { display: flex; gap: 0.3rem; align-items: flex-start; }
.array-items:not(.scalar) .array-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.array-item-body { flex: 1; min-width: 0; }
.array-item-tools { display: flex; gap: 0.1rem; }
.array-items.scalar .array-item-tools { align-self: center; }

.field-error, .block-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.2rem; white-space: pre-wrap; }
.block-error { margin: 0 0 0.5rem; }
.invalid > input, .invalid > textarea, .invalid > select, .invalid .array-item-body input, .invalid > .rich-field > input, .invalid > .rich-field > textarea { border-color: var(--danger); }
.block.invalid { border-color: var(--danger); }
.form-errors { color: var(--danger); font-size: 0.88rem; margin-bottom: 0.6rem; }
.image-input { display: flex; flex-direction: column; gap: 0.4rem; border-radius: 8px; }
.image-input:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; }
.image-thumb { max-width: 100%; max-height: 10rem; object-fit: contain; align-self: flex-start; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.image-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.image-controls input[type="file"] { max-width: 100%; font: inherit; font-size: 0.85rem; }

.crop { display: flex; flex-direction: column; gap: 0.4rem; }
.crop-stage { position: relative; align-self: flex-start; max-width: 100%; line-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 4px; }
.crop-img { display: block; max-width: 100%; max-height: 22rem; }
.crop-frame { position: absolute; box-sizing: border-box; border: 2px solid #fff; outline: 1px solid #000; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); cursor: move; touch-action: none; }
.crop-handle { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #000; cursor: nwse-resize; touch-action: none; }

/* --- composer --------------------------------------------------------------- */
.parts .card-body { padding-top: 0.8rem; }
.empty { text-align: center; padding: 2rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.add-row { display: flex; gap: 0.5rem; margin: 0.6rem 0 1rem; flex-wrap: wrap; }
.add-row select { flex: 1; min-width: 12rem; }
.add-more { width: 100%; border-style: dashed; background: transparent; color: var(--accent); margin-bottom: 1rem; min-height: 2.8rem; }
.empty-title { font-weight: 600; font-size: 1.05rem; }
.part-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; flex: 0 0 auto; border-radius: 8px; background: var(--chip); color: var(--accent); }
.part-icon svg { width: 20px; height: 20px; }
.print-go { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.paper-length { white-space: nowrap; }
.preview-card { padding: 0.8rem; }
.preview-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.paper {
  position: relative;
  background: #fff;
  border-radius: 3px;
  min-height: 160px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 6px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  justify-content: center;
  /* not stretch: a short receipt keeps its own height */
  align-items: flex-start;
  overflow: hidden;
  transition: opacity 0.15s;
}
.paper::after {
  /* torn edge */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: linear-gradient(-45deg, var(--surface) 4px, transparent 0), linear-gradient(45deg, var(--surface) 4px, transparent 0);
  background-size: 10px 8px;
}
.paper.loading { opacity: 0.55; }
.receipt-img { display: block; width: 100%; max-width: 420px; height: auto; image-rendering: auto; }
.preview-msg { padding: 1.2rem; color: #676e76; font-size: 0.9rem; align-self: center; text-align: center; }
.preview-msg.error { color: #b42318; }
.print-row { display: flex; align-items: center; gap: 0.8rem; justify-content: space-between; margin: 0.9rem 0 0.4rem; flex-wrap: wrap; }
.wait-note { color: var(--muted); max-width: 16rem; text-align: right; }
.later-list { margin: 0.2rem 0 0.6rem; }
.later-list ul { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.later-list li { display: flex; gap: 0.5rem; justify-content: space-between; align-items: baseline; padding: 0.15rem 0; }
.later-list li .linklike { flex: none; white-space: nowrap; }
.later-option { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; flex-wrap: wrap; }
.later-option input[type="datetime-local"] { flex: 1 1 12rem; min-width: 0; }
.messages-holder { max-width: 1180px; margin: 0.8rem auto 0; padding: 0 1rem; }
.messages-card { border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); padding: 0.8rem 1rem; display: grid; gap: 0.5rem; justify-items: start; }
.messages-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.messages-card li { display: grid; gap: 0.1rem; }
.msg-line { white-space: pre-wrap; }
.pause-note { margin: 0.4rem 0 0.8rem; padding: 0.5rem 0.8rem; border-left: 3px solid var(--accent); color: var(--text); white-space: pre-wrap; }
.note-input { width: 100%; }
.message-form { display: grid; gap: 0.4rem; margin-top: 0.5rem; }
.message-history ul { margin: 0.3rem 0 0; padding-left: 1rem; }
.badge.role-local { color: var(--accent); }
.draft-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.draft-bar { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.7rem; }
.draft-tab {
  font: inherit;
  font-size: 0.85rem;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.draft-tab.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.draft-tab.new { border-style: dashed; color: var(--muted); }
.recent { margin-top: 0.9rem; text-align: left; }
.recent ul { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.recent li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.3rem 0; border-top: 1px solid var(--border); }
.recent li .linklike { flex: 1; }
.recent li .forget { align-self: center; }
.linklike { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.print-row select { width: auto; min-height: 2rem; padding: 0.2rem 0.4rem; }
.try-form { margin-bottom: 0.8rem; }

/* --- template tiles (picker.js) ------------------------------------------------- */
.tile-search { margin-bottom: 0.6rem; }
.tile-group + .tile-group { margin-top: 0.9rem; }
.tile-group h3 { margin: 0 0 0.45rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.5rem; }
.tile {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.65rem;
  cursor: pointer;
  min-height: 3.6rem;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.tile:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07); transform: translateY(-1px); }
.tile:active { transform: none; }
.tile-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 9px; background: var(--chip); color: var(--accent); }
.tile:hover .tile-icon { background: var(--accent); color: var(--accent-text); }
.tile-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.tile-name { font-weight: 600; line-height: 1.25; }
.tile-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-picker.compact .tiles { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.4rem; }
.tile-picker.compact .tile { min-height: 0; padding: 0.4rem 0.5rem; align-items: center; }
.tile-picker.compact .tile-icon { width: 1.9rem; height: 1.9rem; }
.tile-picker.compact .tile-icon svg { width: 18px; height: 18px; }
@media (max-width: 520px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { flex-direction: column; gap: 0.35rem; }
  .tile-picker.compact .tile { flex-direction: row; }
}
.add-block { margin: 0.6rem 0 0.2rem; }
.add-block .add-row { margin: 0; }
.add-tiles { margin-top: 0.5rem; padding: 0.6rem; border: 1px dashed var(--border); border-radius: 9px; background: var(--surface-2); }
.block-kind { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.block-kind strong { color: var(--text); }

/* --- builder ------------------------------------------------------------------- */
.blocks { display: flex; flex-direction: column; gap: 0.6rem; }
.blocks .blocks { margin-top: 0.5rem; padding-left: 0.7rem; border-left: 3px solid var(--border); }
.block { border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.block.group { background: var(--surface-2); }
.block-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; flex-wrap: wrap; }
.block-head select { width: min(100%, 17rem); flex: 0 1 auto; min-height: 2.1rem; font-weight: 600; }
.block-kind { padding-left: 0.3rem; }
.block-body { padding: 0 0.6rem 0.6rem; }
.bindings { display: grid; gap: 0.5rem; margin-bottom: 0.4rem; }
.binding { display: grid; grid-template-columns: minmax(6rem, 10rem) 1fr; align-items: center; gap: 0.5rem; }
@media (max-width: 520px) { .binding { grid-template-columns: 1fr; gap: 0.15rem; } }
details.options summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; padding: 0.2rem 0; }
details.options .opt { display: grid; grid-template-columns: minmax(6rem, 14rem) 1fr; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
@media (max-width: 520px) { details.options .opt { grid-template-columns: 1fr; gap: 0.15rem; } }
.fields-table { width: 100%; border-collapse: collapse; }
.fields-table th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 0.2rem 0.3rem; }
.fields-table td { padding: 0.3rem; border-top: 1px solid var(--border); vertical-align: middle; }
.fields-table input { min-height: 2rem; padding: 0.25rem 0.4rem; }
.save-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.save-row .btn.danger { margin-left: auto; }
.json-editor summary { cursor: pointer; list-style: none; }

/* --- templates list ------------------------------------------------------------------ */
.tpl .card-body p:first-child { margin-top: 0; }
.field-list { margin: 0.3rem 0; padding-left: 1.1rem; }
.field-list li { margin: 0.1rem 0; overflow-wrap: anywhere; }
.badge.blocks { color: var(--accent); }
details.source summary { cursor: pointer; color: var(--muted); margin-top: 0.4rem; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; overflow: auto; max-height: 22rem; margin: 0.4rem 0 0; }

/* --- devices ------------------------------------------------------------------------- */
.login-form { display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-start; }
.login-form .field { width: 100%; }
.login-list, .queue-list { list-style: none; margin: 0; padding: 0; }
.login-list li, .queue-list li { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.login-list li:first-child, .queue-list li:first-child { border-top: 0; }
.queue-list li { display: block; }
.login.revoked strong, .login.expired strong, .login.old strong { text-decoration: line-through; color: var(--muted); }
.login-list li.login { align-items: flex-start; flex-wrap: wrap; }
.login-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1 1 14rem; }
.login-name { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.login-name .icon { width: 1.7rem; height: 1.7rem; font-size: 0.9rem; }
.login-actions { display: flex; gap: 0.35rem; align-items: flex-start; flex-wrap: wrap; }
.rename { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.rename input { width: auto; flex: 1 1 10rem; min-height: 2rem; padding: 0.25rem 0.45rem; }
.badge.paused { color: #b26b00; }
.paper-use { display: flex; gap: 0.3rem 0.9rem; flex-wrap: wrap; }
.paper-stat b { font-variant-numeric: tabular-nums; }
.pause-menu { position: relative; }
.pause-menu summary { list-style: none; }
.pause-menu summary::-webkit-details-marker { display: none; }
.pause-options {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  min-width: 14rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.pause-options > .btn { justify-content: flex-start; }
@media (max-width: 640px) {
  .pause-options { position: static; margin-top: 0.3rem; box-shadow: none; min-width: 0; }
  .login-actions { width: 100%; }
}
.pause-date { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; padding: 0.2rem 0.3rem; }
.pause-date input { width: auto; min-height: 2rem; padding: 0.2rem 0.3rem; flex: 1; }
.friends-card { grid-column: 1 / -1; }
.role-choice { display: grid; grid-template-columns: 1fr; gap: 0.4rem; }
.role-option { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.55rem 0.6rem; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.role-option input { margin-top: 0.2rem; }
.role-option span { display: flex; flex-direction: column; gap: 0.1rem; }
.friend-toggle { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0.2rem 0 0.4rem; cursor: pointer; }
.friend-toggle input { width: 1.1rem; height: 1.1rem; }
.badge.friends { color: var(--ok); }

/* --- login screen ---------------------------------------------------------------------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { max-width: 440px; width: 100%; }
.login-card h1 { margin-bottom: 0.4rem; }
.login-card details summary { cursor: pointer; color: var(--muted); }
.token-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }

/* On a phone the preview (and its Print button) sits below the forms -
   keep a Print button in reach while filling them in. */
.mobile-print { display: none; }
@media (max-width: 860px) {
  .mobile-print {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
  }
  .mobile-print .btn { flex: 0 0 auto; }
  main { padding-bottom: 6rem; }
  .toast { bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }
}

/* --- toast ---------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  max-width: min(92vw, 520px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .toast, .paper { transition: none; }
}

/* --- paper allowance (friends) ---------------------------------------------------------- */
.paper-meter { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.2rem 0 0.9rem; margin-bottom: 0.8rem; border-bottom: 1px solid var(--border); }
.meter-row { display: flex; flex-direction: column; gap: 0.2rem; }
.meter-text { display: flex; justify-content: space-between; gap: 0.5rem; }
.meter-text b { font-variant-numeric: tabular-nums; }
.meter-bar { height: 7px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.budget-note { margin-top: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 8px; background: var(--surface-2); }
.budget-note.error { color: var(--danger); }
.budget-note.warn { color: #b26b00; }
.mobile-left { display: flex; flex-direction: column; gap: 0.1rem; }
.limit-line { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.limit-edit { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.2rem 0; max-width: 28rem; }
.limit-custom, .limit-defaults { display: flex; gap: 0.4rem 0.8rem; align-items: center; flex-wrap: wrap; }
.limit-custom input, .limit-defaults input { width: 5.5rem; min-height: 2rem; padding: 0.2rem 0.4rem; }
.limit-defaults { padding: 0.6rem 0.7rem; margin: 0.4rem 0 0.8rem; border: 1px dashed var(--border); border-radius: 9px; }
.limit-defaults .hint { flex-basis: 100%; margin: 0; }
.delivery { display: flex; }
.delivery button { flex: 1; }
.invite-result { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; padding: 0.7rem; border: 1px solid var(--accent); border-radius: 9px; background: var(--surface-2); }
.invite-link { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.invite-link input { flex: 1 1 14rem; font-family: var(--mono); font-size: 0.8rem; }
.confirm-dialog { border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.2rem; max-width: min(92vw, 26rem); background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.confirm-dialog h2 { margin: 0 0 0.4rem; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.15rem; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

/* --- rich text (form.js) ---------------------------------------------------------------- */
.rich-field { display: flex; flex-direction: column; gap: 0.25rem; }
.rich-bar { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.rich-btn { font: inherit; width: 1.9rem; height: 1.7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 0.85rem; line-height: 1; }
.rich-btn:hover { border-color: var(--accent); }
.rich-b { font-weight: 800; }
.rich-i { font-style: italic; font-family: Georgia, serif; }
.rich-u { text-decoration: underline; }
.rich-s { text-decoration: line-through; }
.align-group { display: inline-flex; gap: 0.2rem; margin-left: 0.35rem; padding-left: 0.45rem; border-left: 1px solid var(--border); }
.align-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.align-btn svg { width: 1.05rem; height: 1.05rem; }
.align-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.rich-hint { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-left: 0.3rem; }
.name-toggle { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.name-toggle input { width: 1.05rem; height: 1.05rem; }

/* --- another device (devicelink.js) ----------------------------------------------------- */
.device-dialog { max-width: min(94vw, 24rem); }
.device-warning { padding: 0.55rem 0.65rem; border-radius: 8px; background: rgba(180, 35, 24, 0.08); color: var(--danger); font-size: 0.88rem; }
.device-body { display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch; }
.device-qr { align-self: center; width: 220px; height: 220px; image-rendering: pixelated; background: #fff; border-radius: 6px; }
.device-countdown { font-variant-numeric: tabular-nums; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* --- admin: print alignment -------------------------------------------------------------- */
.align-cal { display: flex; flex-direction: column; gap: 0.7rem; }
.align-cal p { margin: 0; }
.cal-step { display: flex; gap: 0.7rem; align-items: flex-start; }
.cal-step > div { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; flex: 1; align-items: flex-start; }
.cal-num { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.cal-fold { font-size: 0.92rem; }
.cal-form { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; width: 100%; }
.cal-readings { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem; width: 100%; }
.cal-reading { display: flex; flex-direction: column; gap: 0.25rem; }
.cal-reading input { width: 7rem; }
.tone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.7rem; width: 100%; }
.tone-item { margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.tone-item figcaption { display: flex; flex-direction: column; font-size: 0.85rem; }
.tone-chart { width: 100%; aspect-ratio: 1; display: block; }
.tone-none { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); font-size: 0.85rem; }
.tone-frame { fill: var(--surface-2); stroke: var(--border); stroke-width: 0.6; }
.tone-target { stroke: var(--muted); stroke-width: 0.6; stroke-dasharray: 2 2; }
.tone-dot.h { fill: #3b82f6; }
.tone-dot.v { fill: #f59e0b; }
.tone-curve { fill: none; stroke: var(--text); stroke-width: 1.2; }
.corr-default { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start; }
.corr-kind { margin: 0.4rem 0 0 0; font-size: 1rem; }
.tone-check { width: 100%; }
.tone-check summary { cursor: pointer; font-weight: 600; }
.tone-check-img img { display: block; max-width: 100%; max-height: 70vh; margin-top: 0.4rem; border: 1px solid var(--border); border-radius: 6px; }

/* --- admin: Claude credit ---------------------------------------------------------------- */
.section-title { margin-top: 1.6rem; }
.credit-card { grid-column: 1 / -1; }
.credit { display: flex; flex-direction: column; gap: 0.8rem; }
.credit-estimate { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.credit-estimate > div { flex-basis: 100%; }
.credit-amount { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.credit-estimate.low .credit-amount { color: var(--danger); }
.credit-form { display: flex; flex-direction: column; gap: 0.3rem; max-width: 26rem; }
.credit-form input { width: 9rem; }
.credit-sub { margin: 0.4rem 0 0; font-size: 0.95rem; }
.table-scroll { overflow-x: auto; }
.credit-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; overflow-wrap: normal; }
.credit-table th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 0.25rem 0.4rem; }
.credit-table td { padding: 0.35rem 0.4rem; border-top: 1px solid var(--border); vertical-align: top; }
.credit-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.credit-table .nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  /* one charge per stacked row: when + cost, then reason, then tokens */
  .credit-table thead { display: none; }
  .credit-table tr { display: grid; grid-template-columns: 1fr auto; gap: 0.05rem 0.6rem; padding: 0.5rem 0; border-top: 1px solid var(--border); }
  .credit-table td { border: 0; padding: 0; }
  .credit-table td:nth-child(1) { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 0.8rem; }
  .credit-table td:nth-child(4) { grid-column: 2; grid-row: 1; }
  .credit-table td:nth-child(2), .credit-table td:nth-child(3) { grid-column: 1 / -1; }
  .credit-sets td:nth-child(2) { text-align: left; }
}
.reissue { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.4rem; padding: 0.6rem; border: 1px dashed var(--border); border-radius: 9px; }
.reissue select { width: auto; min-height: 2rem; padding: 0.2rem 0.4rem; }
.extra-badge { font-size: 0.78rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--chip); color: var(--ok); font-weight: 600; }

/* --- the planner (planner*.js) --- */
nav + .who { margin-left: 0.5rem; }
.planner .view-head { gap: 0.6rem 1rem; }
.planner-tabs { margin-left: auto; }
.planner-tabs a { padding: 0.4rem 0.8rem; color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.planner-tabs a.active { background: var(--text); color: var(--bg); }
.planner-cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; }
.planner .ec {
  --ec-bg-color: var(--surface);
  --ec-text-color: var(--text);
  --ec-border-color: var(--border);
  --ec-button-bg-color: var(--surface);
  --ec-button-border-color: var(--border);
  --ec-button-text-color: var(--text);
  --ec-button-active-bg-color: var(--text);
  --ec-button-active-border-color: var(--text);
  --ec-button-active-text-color: var(--bg);
  --ec-today-bg-color: var(--surface-2);
  --ec-highlight-color: var(--chip);
  --ec-event-bg-color: #7a8793;
  --ec-now-indicator-color: var(--danger);
  color-scheme: inherit;
  font-size: 0.85rem;
}
.planner .ec-event.past { opacity: 0.55; }
.unproven { color: var(--danger); }
.plan-how { cursor: help; }
/* the whole day shows (height: auto), so nothing in it scrolls - but the dot on the line for the
   time of day reaches 5px past the last hour, which made the box scroll in the day's last minutes */
.planner .ec-main { overflow: hidden; }
/* the page's own nav and h2 rules aren't the calendar's */
.planner nav.ec-toolbar { margin-left: 0; }
.planner .ec h2.ec-title { margin: 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.05rem; }
.ev-time { font-size: 0.72rem; opacity: 0.85; }
.ev-title { font-weight: 600; font-size: 0.8rem; line-height: 1.15; }
.ev-piece { font-size: 0.74rem; line-height: 1.15; }
.week-bar { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.6rem; }
.missing-row { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; margin: 0.15rem 0; }
.ev-piece.undone { text-decoration: line-through; opacity: 0.7; }
.paper-slot.asked { border-left: 3px solid var(--accent); padding-left: 0.5rem; }
.slot-question { margin: 0.1rem 0 0.3rem; font-size: 0.9rem; color: var(--accent); }
.something-else { margin: 0.2rem 0 0.4rem 2.2rem; }
.why { margin: 0.2rem 0 0.6rem 0.8rem; padding: 0.4rem 0.7rem; border-left: 3px solid var(--danger); background: var(--surface); font-size: 0.9rem; }
.why p { margin: 0.2rem 0; }
.why h4 { margin: 0.5rem 0 0.15rem; font-size: 0.85rem; color: var(--muted); }
.why ul { margin: 0; padding-left: 1.1rem; }
.why .why-new { color: var(--danger); }
.missing-more > summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0; }
.missing-holder > .missing { border: 1px solid var(--danger); border-radius: var(--radius); background: var(--surface); padding: 0.6rem 0.8rem; margin: 0 0 0.7rem; }
.missing-holder > .missing h3 { margin: 0 0 0.3rem; font-size: 0.95rem; color: var(--danger); }
.field .segmented { align-self: flex-start; }
.planner .ec-button { white-space: nowrap; }
dialog.sheet { border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; width: min(34rem, calc(100vw - 1.2rem)); max-height: calc(100dvh - 1.5rem); overflow: auto; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.sheet h2 { margin: 0 0 0.6rem; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.15rem; }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.marker-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.marker-chip { font: inherit; font-size: 0.88rem; min-height: 2.2rem; padding: 0.25rem 0.8rem; border-radius: 999px; border: 2px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.marker-chip.on { font-weight: 600; }
.new-marker summary { color: var(--accent); cursor: pointer; margin-top: 0.35rem; }
.new-marker input[type="text"] { flex: 1 1 10rem; width: auto; }
.at-least { display: grid; gap: 0.3rem; }
.at-least .row-gap { margin-top: 0; }
.at-least .hours { width: 5.5rem; }
.between { align-items: center; margin-top: 0; }
.between input { width: 7.5rem; }
.at-least select { width: auto; flex: 1 1 8rem; }
/* a setting with "Inherit" (planner-how.js): the toggle sits at the end of the label's line */
.setting { position: relative; min-width: 0; }
.inherit-toggle { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.inherit-toggle input { width: 1rem; height: 1rem; margin: 0; }
.setting > .field > .label { padding-right: 5.5rem; }
.inherited-value { color: var(--muted); }
.lead { align-items: center; margin-top: 0; }
.lead select { width: auto; }
.lead .hours { width: 5.5rem; }
fieldset.group:not(.how-done) > .setting + .setting { margin-top: 0.6rem; }
/* how it's done, and how something repeats (planner-todo.js) */
fieldset.how-done { display: flex; flex-direction: column; gap: 0.6rem; }
.how-done .segmented, .fields > .field > .segmented { flex-wrap: wrap; }
.times-of-day { display: grid; gap: 0.3rem; }
.times-of-day .row-gap, .repeat-after .row-gap { margin-top: 0; align-items: center; }
.repeat-after input.days { width: 4.2rem; }
.todo-add { margin-bottom: 0.4rem; }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.todo-row { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; cursor: pointer; }
.todo-row:hover { border-color: var(--muted); }
.todo-name { font-weight: 600; }
details.finished { margin-top: 1rem; }
details.finished summary { cursor: pointer; color: var(--muted); margin-bottom: 0.4rem; }
.marker-list { list-style: none; margin: 0 0 0.4rem; padding: 0; display: grid; gap: 0.4rem; }
.marker-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.marker-row input[type="text"] { flex: 1 1 10rem; width: auto; }
input[type="color"] { width: 2.5rem; height: 2.3rem; padding: 0.15rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.settings-fields { max-width: 34rem; }
/* Today: drawn like the receipt */
.day-paper { background: #fff; color: #111; max-width: 420px; margin: 0 auto 0.8rem; padding: 1rem 1.1rem 1.4rem; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); font-weight: 600; }
.day-paper .paper-title { color: #111; text-transform: none; letter-spacing: 0; font-size: 1.35rem; margin: 0 0 0.6rem; }
.paper-slot { margin: 0.6rem 0; }
.paper-piece { display: flex; gap: 0.55rem; align-items: center; margin: 0.4rem 0 0 0.9rem; }
.paper-piece .box { width: 1.15rem; height: 1.15rem; border: 2px solid #111; border-radius: 2px; flex: 0 0 auto; }
.paper-section { margin-top: 1rem; }
.day-paper .paper-section h3 { font-size: 1.02rem; margin: 0 0 0.3rem; color: #111; }
@media (max-width: 520px) {
  .planner-tabs { margin-left: 0; width: 100%; }
  /* as wide as their words ("Einstellungen" broke in two at equal widths) */
  .planner-tabs a { flex: 1 1 auto; text-align: center; padding: 0.45rem 0.3rem; white-space: nowrap; font-size: 0.85rem; }
}
.paper-piece .tick { width: 1.6rem; height: 1.6rem; flex: 0 0 auto; border: 2px solid #111; border-radius: 3px; background: #fff; color: #111; font: inherit; font-weight: 700; line-height: 1; padding: 0; cursor: pointer; }
.paper-piece .tick.on { background: #111; color: #fff; }
.paper-piece.done > span { text-decoration: line-through; color: #555; }
.day-paper .paper-warning { border: 2px solid #111; padding: 0.4rem 0.6rem; }
.notice { border-left: 3px solid var(--accent); padding: 0.3rem 0.7rem; margin: 0 0 0.8rem; }
.day-finished { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; }
.day-paper .btn { color: #111; background: #fff; border-color: #999; }
/* Access: long or growing sections collapse (devices.js) */
details.collapsible > summary { cursor: pointer; list-style: none; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before { content: "▸"; color: var(--muted); margin-right: 0.1rem; transition: transform 0.15s; }
details.collapsible[open] > summary::before { transform: rotate(90deg); }
details.collapsible:not([open]) > summary { border-bottom: 0; }
.chip.count:empty { display: none; }
.chip.count.waiting { background: var(--accent); color: var(--accent-text); }
.card-tools { display: flex; justify-content: flex-end; gap: 0.3rem; margin-bottom: 0.4rem; }
.only-for summary { cursor: pointer; }
.ev-only { font-size: 0.72rem; font-style: italic; opacity: 0.9; }
details.collapsible > summary { flex-wrap: nowrap; }
details.collapsible > summary strong { min-width: 0; }
/* Ticking a box (celebrate.js throws the sparks and confetti) */
.celebrate { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
.paper-piece.just .tick { animation: tick-pop 0.42s cubic-bezier(0.2, 1.8, 0.4, 1); }
.paper-piece.just > span { animation: tick-strike 0.5s ease-out; }
.paper-piece.just { animation: tick-glow 0.9s ease-out; border-radius: 4px; }
@keyframes tick-pop {
  0% { transform: scale(0.55) rotate(-12deg); }
  60% { transform: scale(1.28) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes tick-strike {
  from { color: #111; text-decoration-color: transparent; }
  to { color: #555; text-decoration-color: currentColor; }
}
@keyframes tick-glow {
  from { background: #fff1a8; }
  to { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .paper-piece.just, .paper-piece.just .tick, .paper-piece.just > span { animation: none; }
}
/* Golden days: every task that day ticked off (the week, and today's paper) */
.golden-head { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-weight: 700; color: #4a3300; background: linear-gradient(135deg, #fff1a8, #f5c542 45%, #d99a00); box-shadow: 0 0 0 1px #c98f00, 0 0 8px rgba(245, 197, 66, 0.7); }
.ec-bg-event.golden-day { --ec-bg-event-opacity: 1; background: linear-gradient(180deg, rgba(255, 214, 80, 0.38), rgba(255, 214, 80, 0.12)); }
.day-paper.golden { position: relative; box-shadow: 0 0 0 2px #e0b000, 0 0 18px rgba(245, 197, 66, 0.55); }
.golden-stamp { position: absolute; top: -0.85rem; right: 0.8rem; padding: 0.15rem 0.6rem; border: 2px solid #b07d00; border-radius: 999px; color: #4a3300; background: linear-gradient(135deg, #fff1a8, #f5c542 50%, #e0a800); font-size: 0.85rem; transform: rotate(6deg); }
.golden-stamp.fresh { animation: stamp-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes stamp-in { from { transform: scale(2.2) rotate(-10deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .golden-stamp.fresh { animation: none; } }
/* Projects: phases one after another (planner-todo.js) */
.phase-steps { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; gap: 0.1rem; }
.phase-step.finished { text-decoration: line-through; color: var(--muted); }
.phase-break { color: var(--muted); font-style: italic; padding-left: 1.1rem; }
.phase-list { display: grid; gap: 0.35rem; }
.phase-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.phase-row input[type="text"] { flex: 1 1 9rem; width: auto; min-width: 0; }
.phase-row input.hours { width: 4.6rem; }
.phase-num { font-weight: 600; min-width: 1.3rem; }
.phase-done { display: inline-flex; gap: 0.25rem; align-items: center; font-size: 0.85rem; }
.phase-gap { padding-left: 1.7rem; color: var(--muted); font-size: 0.9rem; align-items: center; margin: 0; }
.phase-gap input.days { width: 4.2rem; }
.phase-more { display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: center; padding-left: 1.7rem; }
.phase-settings { margin: 0.1rem 0 0.5rem 1.7rem; padding-left: 0.6rem; border-left: 2px solid var(--border); }
