/* App chrome — theme tokens borrowed from Calendar Machine UI (dark) with a matching light set.
   The calendar pages themselves are styled in calendar.css and never change with the theme. */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111214;
  --surface: #1a1c1f;
  --surface2: #22252a;
  --border: #2d3038;
  --accent: #72eec9;   /* bright mint: the default look. The text on it is dark, because the colour is light */
  --accent-dim: color-mix(in srgb, var(--accent) 45%, var(--surface)); /* follows the accent, whatever the user picks */
  --accent-text: #14181f;
  --text: #e2e4e9;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --success: #34c77b;
  --danger: #e05252;
  --stage: #0b0c0e;
  --shadow: 0 2px 12px rgba(0, 0, 0, .5);
  --radius: 6px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface2: #f3f5f8;
  --border: #dcdfe6;
  --accent: #0b7f5f;   /* the same mint, deepened so headings stay readable on white */
  --accent-dim: color-mix(in srgb, var(--accent) 45%, var(--surface));
  --accent-text: #ffffff;
  --text: #1c2030;
  --text-muted: #8a91a0;
  --text-dim: #5b6272;
  --success: #1f9d5c;
  --danger: #c93a3a;
  --stage: #dfe3ea;
  --shadow: 0 2px 12px rgba(20, 30, 60, .18);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── top bar ── */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px; min-height: 66px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
}
.topbar h1 { margin: 0; line-height: 0; }
/* logo: white on the dark theme, black on the light theme; deliberately NOT the accent colour */
.brand-logo { display: block; height: 50px; width: auto; fill: #fff; }
:root[data-theme="light"] .brand-logo { fill: #000; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }

.theme-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); cursor: pointer; margin-right: 4px; }
.ts-ico { font-size: 14px; line-height: 1; }

/* ── buttons ── */
button {
  font: inherit; font-size: 12px; font-weight: 600; border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text-dim);
  transition: color .15s, border-color .15s, background .15s;
}
button:hover:not(:disabled) { color: var(--text); border-color: var(--accent-dim); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
a.btn-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
a.btn-link.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
a.btn-link.primary:hover { filter: brightness(1.1); }
button.primary:hover:not(:disabled) { color: var(--accent-text); filter: brightness(1.1); }
button.small { padding: 4px 10px; font-size: 11px; }
button.danger:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
button:disabled { opacity: .4; cursor: default; } /* no "no entry" cursor: it sat on top of the hover hint. The faded look already says disabled. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── switches (same pattern as Calendar Machine) ── */
.toggle { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 18px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle.sm { width: 28px; height: 16px; }
.toggle.sm .toggle-slider::before { width: 10px; height: 10px; }
.toggle.sm input:checked + .toggle-slider::before { transform: translateX(12px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--text-dim); font-size: 12px; cursor: pointer; }

/* ── layout ── */
.shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.panel { overflow-y: auto; padding: 8px 14px 24px; background: var(--surface); border-right: 1px solid var(--border); }

details { border-bottom: 1px solid var(--border); }
summary {
  list-style: none; cursor: pointer; padding: 12px 0 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--accent); display: flex; align-items: center; gap: 7px;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: '\2022'; font-size: 16px; line-height: 1; }          /* bullet point */
details:not([open]) summary::before { content: '\25E6'; }                        /* hollow bullet when folded away */
summary:hover { filter: brightness(1.15); }
.sec-body { padding: 4px 0 14px; }

.row { display: flex; margin-top: 8px; }
.row.gap { gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.row.center { justify-content: center; }
.sec-body > select + .row { margin-top: 10px; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.field > span.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-head label { font-size: 11px; color: var(--text-dim); cursor: pointer; }
.name-lines-btn { font-size: 11px; flex-shrink: 0; }
.field em { color: var(--text-muted); font-style: normal; }
.hint { color: var(--text-muted); font-size: 11px; line-height: 1.5; margin: 0 0 8px; display: block; }

input[type=date], input[type=number], input[type=text], select, textarea {
  width: 100%; font: inherit; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface2); color: var(--text); outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .45; cursor: default; }
select option { background: var(--surface); color: var(--text); }

/* ── line combobox (type a number or pick from dropdown) ── */
.combo { position: relative; }
.combo input { padding-right: 30px; }
.combo-btn {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 28px; padding: 0;
  border: 0; border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  background: transparent; color: var(--text-dim); display: flex; align-items: center; justify-content: center;
}
.combo-btn:hover:not(:disabled) { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.combo-btn svg { width: 12px; height: 12px; }
.combo-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  max-height: 220px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.combo-menu[hidden] { display: none; }
.combo-opt {
  display: block; width: 100%; text-align: left; padding: 5px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.combo-opt[hidden] { display: none; }
.combo-opt:hover { background: var(--surface2); color: var(--text); border-color: transparent; }
.combo-opt.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface2)); color: var(--accent); font-weight: 700; }
.combo-opt.swap-opt { font-weight: 600; }
.combo-swp { color: var(--accent); font-weight: 800; font-size: 11px; letter-spacing: .03em; margin-right: 2px; }
.combo-num { display: inline-block; min-width: 22px; color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.combo-opt.on .combo-num { color: var(--accent); }
.combo-muted { color: var(--text-muted); font-weight: 500; font-size: 11px; }
.combo-sep { height: 1px; margin: 4px 2px; background: var(--border); }

/* ── bi-weekly line swaps ── */
.swap-tick {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 8px; padding: 6px 9px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface2);
  color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.swap-tick[hidden] { display: none; }
.swap-tick:hover { border-color: var(--accent-dim); color: var(--text); }
.swap-tick.on {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  background: color-mix(in srgb, var(--accent) 14%, var(--surface2));
  color: var(--accent);
}
.swap-tick input[type=checkbox] {
  width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; flex-shrink: 0;
}
#swap-pairs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
#swap-pairs:empty { margin-bottom: 0; }
.swap-pair-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: var(--radius);
  background: var(--surface2); border: 1px solid var(--border); transition: border-color .15s, background .15s;
}
.swap-pair-row.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface2));
}
.swap-pair-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--accent);
  padding: 2px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, transparent); flex-shrink: 0;
}
.swap-pair-jumps { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
button.swap-jump {
  padding: 3px 8px; font-size: 11px; font-weight: 700; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  max-width: 102px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.swap-jump:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--text); }
button.swap-jump.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.swap-picker { display: flex; align-items: flex-end; gap: 5px; }
.swap-col { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.swap-col > span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.swap-picker select { width: 100%; min-width: 0; padding: 5px 6px; }
.swap-link-sep { color: var(--text-muted); font-size: 12px; font-weight: 700; flex-shrink: 0; padding-bottom: 6px; }
.swap-picker > button { flex-shrink: 0; padding: 6px 10px; }
.swap-picker.odd-disabled { opacity: .65; }
input[type=range] { width: 100%; accent-color: var(--accent); }


.seg { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; background: var(--surface2); }
.seg button.on { background: var(--accent); color: var(--accent-text); }

.error { color: var(--danger); font-size: 12px; margin: 6px 0 0; }

.colors label { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--text-dim); font-size: 12px; }

/* ── tag colour rules ── */
#rules { display: flex; flex-direction: column; gap: 6px; }
.rule-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius);
  background: var(--surface2); border: 1px solid var(--border); transition: border-color .15s, opacity .15s;
}
.rule-row:hover { border-color: var(--accent-dim); }
.rule-row.disabled .id-chip, .rule-row.disabled .rule-label { opacity: .45; }
.id-chip {
  font: 800 10px Verdana, Geneva, Tahoma, sans-serif; padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
  min-width: 34px; text-align: center;
}
.rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rule-label { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-meta { font-size: 10px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; }
.rule-row { position: relative; }
.rule-actions {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; gap: 1px;
  opacity: 0; pointer-events: none; transition: opacity .12s; background: var(--surface2); padding-left: 6px;
  box-shadow: -8px 0 8px var(--surface2);
}
.rule-row:hover .rule-actions, .rule-row:focus-within .rule-actions { pointer-events: auto; }
.rule-row:hover .rule-actions, .rule-row:focus-within .rule-actions { opacity: 1; }
@media (hover: none) { .rule-actions { opacity: 1; } }
.icon-btn {
  width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; color: var(--text-muted); border-radius: 4px;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--surface); border-color: var(--border); }
.icon-btn.del:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.icon-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── profiles ── */
.profiles { list-style: none; margin: 8px 0 0; padding: 0; }
.profiles li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.profiles .swatches { display: flex; }
.profiles .swatches i { width: 12px; height: 12px; border: 1px solid var(--border); margin-right: -3px; border-radius: 50%; }
.profiles button.name { flex: 1; text-align: left; border: 0; background: none; padding: 4px; color: var(--text-dim); }
.profiles button.name:hover { color: var(--accent); }
.profiles button.x { border: 0; background: none; color: var(--text-muted); padding: 2px 6px; }
.profiles button.x:hover { color: var(--danger); }

.foot { color: var(--text-muted); font-size: 11px; margin: 14px 0 0; }

/* ── demo banner: floats over the preview, lets clicks and scrolling through ── */
.demo-banner {
  position: absolute; z-index: 20; left: 50%; top: 52%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 48px)); padding: 18px 26px; text-align: center; pointer-events: none;
  background: color-mix(in srgb, var(--surface) 78%, transparent); border: 2px solid var(--accent); border-radius: 14px;
  backdrop-filter: blur(3px); box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.demo-banner[hidden] { display: none; }
.demo-banner strong { display: block; font-size: 30px; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.demo-banner span { display: block; font-size: 15px; line-height: 1.5; color: var(--text); }

/* ── preview ── */
.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.has-roster { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.roster-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 16px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 60%, var(--border));
}
.roster-bar[hidden] { display: none; }
.roster-bar-mid {
  display: flex; align-items: center; justify-content: center; gap: 9px; flex: 1; min-width: 0;
  color: var(--accent); font-size: 16px; font-weight: 800; letter-spacing: .04em;
}
.roster-bar-pos { text-transform: uppercase; white-space: nowrap; font-size: 13px; letter-spacing: .09em; opacity: .86; }
.roster-bar-sep { opacity: .55; }
.roster-bar-name-btn {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0;
  padding: 2px 9px; margin: -2px -4px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--accent); font-size: 17px; font-weight: 800; letter-spacing: .01em;
  cursor: text;
}
.roster-bar-name-btn:hover,
.roster-bar-name-btn:focus-visible {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent); outline: none;
}
.roster-bar-name-btn[hidden] { display: none; }
.roster-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-bar-pen {
  width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; opacity: .62; transition: opacity .14s;
}
.roster-bar-name-btn:hover .roster-bar-pen,
.roster-bar-name-btn:focus-visible .roster-bar-pen { opacity: 1; }
input.roster-bar-input {
  width: min(340px, 50vw); flex: 0 1 340px; max-width: 100%; padding: 3px 12px;
  border: 2px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 700; text-align: center; outline: none;
}
input.roster-bar-input:focus { border-color: var(--accent); }
input.roster-bar-input[hidden] { display: none; }
.roster-nav {
  width: 40px; height: 32px; padding: 0; flex-shrink: 0; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); border: 1px solid var(--accent); color: var(--accent-text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 32%, transparent);
}
.roster-nav[hidden] { display: none; }
.roster-nav:hover:not(:disabled) { color: var(--accent-text); filter: brightness(1.1); border-color: var(--accent); }
.roster-nav:disabled {
  background: var(--surface2); border-color: var(--border); color: var(--text-muted);
  opacity: .42; box-shadow: none; cursor: default;
}
.roster-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.preview-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 12px;
}
#preview-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom { display: flex; gap: 6px; flex-shrink: 0; }
.swap-bar {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}
.swap-bar[hidden] { display: none; }
.swap-bar-badge {
  padding: 2px 7px; border-radius: 4px; background: var(--accent); color: var(--accent-text);
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; flex-shrink: 0;
}
.swap-bar-text {
  flex: 1; min-width: 0; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.swap-bar-off { flex-shrink: 0; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
button.swap-bar-off:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 22%, var(--surface2)); border-color: var(--accent); color: var(--accent); }
.stage { flex: 1; overflow: auto; padding: 16px; background: var(--stage); }
/* .scaler is a plain, explicitly-sized box (its width/height are set in JS to the
   scaled footprint) so .stage's scrollbars match the visible content exactly; the
   actual scaling happens one level in, on .scale-inner, so .stage never has to infer
   a scrollable area from a transform (which both Chrome and Firefox get wrong — the
   scroll area ends up sized to the pre-scale content, leaving blank space to scroll into). */
.scaler { overflow: hidden; }
.scale-inner { width: 2204px; transform-origin: top left; }
.empty { margin: auto; max-width: 480px; padding: 24px; text-align: center; color: var(--text-muted); }
.empty h1 { color: var(--text); font-size: 20px; margin: 0 0 8px; font-weight: 600; }
.empty .empty-howto { margin: 14px 0 0; }
.empty .howto { margin-right: 0; }
@media screen { .stage .page-container { box-shadow: var(--shadow); margin-bottom: 18px; } }

/* ── dialogs ── */
dialog {
  border: 1px solid var(--border); border-radius: 10px; padding: 0; width: min(620px, 94vw);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(5, 7, 12, .6); }
.dlg { padding: 18px 20px; }
.dlg h2 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.steps { padding-left: 18px; margin: 0 0 14px; color: var(--text-dim); }
.steps li { margin-bottom: 10px; }
.steps strong { color: var(--text); }
.steps li div { margin-top: 6px; display: flex; gap: 8px; }
pre#prompt-view { max-height: 200px; overflow: auto; background: var(--surface2); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius); font-size: 11px; white-space: pre-wrap; color: var(--text-dim); }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; resize: vertical; }
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 10px; font-size: 11px; }
.chip.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface2)); border-color: var(--accent); color: var(--text); }

.dropveil {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--accent) 80%, #000); color: var(--accent-text); z-index: 50;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
}
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; font-size: 12px;
}

/* ── round colour swatches ── */
input[type=color] {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; padding: 0; border: 2px solid var(--border);
  border-radius: 50%; background: none; cursor: pointer; flex-shrink: 0; overflow: hidden;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
input[type=color]:hover { border-color: var(--accent-dim); }

/* ── extras ── */
button.big { font-size: 15px; padding: 12px 28px; border-radius: 10px; }
/* tip button: accent outline (was PayPal yellow; PayPal is not used) */
button.donate, a.btn-link.tip { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--accent); }
button.donate:hover:not(:disabled), a.btn-link.tip:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 26%, transparent); border-color: var(--accent); }
button.howto {
  margin-right: auto; background: #ff2d4d; border-color: #ff2d4d; color: #fff; font-weight: 700;
  padding: 9px 16px; border-radius: 10px; animation: howto-pulse 1.8s ease-out infinite;
}
button.howto:hover:not(:disabled) { background: #e8112f; border-color: #e8112f; color: #fff; filter: none; }
@keyframes howto-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 45, 77, .55); }
  70% { box-shadow: 0 0 0 13px rgba(255, 45, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 45, 77, 0); }
}
@media (prefers-reduced-motion: reduce) { button.howto { animation: none; } }
.row.wrap { flex-wrap: wrap; }
.roster-head { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; }
.roster-info { margin: 0; color: var(--text-dim); font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-head .icon-btn[hidden] { display: none; }
.needs-roster { transition: opacity .15s; }
.no-roster .needs-roster { opacity: .4; }
.hint.inline { display: inline; margin: 0 0 0 10px; }
.grow { flex: 1; }

/* day box preview (top half, like Calendar Machine) */
.examples { position: relative; padding: 10px 14px 6px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.share-preview-btn {
  position: absolute; left: 14px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 12px; font-weight: 700; letter-spacing: .01em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .12s, color .15s;
}
.share-preview-btn svg { width: 15px; height: 15px; flex: none; }
.share-preview-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface2));
  border-color: var(--accent);
  transform: translateY(-1px);
}
.share-preview-btn.is-copied {
  background: #22e06b; border-color: #22e06b; color: #032a12;
}
@media (max-width: 1220px) {
  .share-preview-btn { position: static; margin-top: 6px; }
}
.ex-label { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.ex-row { display: flex; justify-content: center; gap: 14px; }
.ex-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ex-frame { box-shadow: var(--shadow); line-height: 0; }
.ex-frame .day-box { width: 314px; height: 307px; line-height: normal; }
.ex-name { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text); opacity: .9; }
.pinfo { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }

/* hover hints */
.hint-tip {
  position: fixed; z-index: 100; max-width: 260px; padding: 6px 10px; border-radius: 6px; font-size: 11px; line-height: 1.4;
  background: var(--text); color: var(--bg); pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

/* roster grid */
dialog.wide { width: min(1200px, 96vw); height: min(810px, 92vh); }
dialog.grid-islands { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.gridwrap { display: flex; flex-direction: column; height: 100%; gap: 10px; }
.grid-island-top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-shrink: 0;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.grid-name-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent); white-space: nowrap; flex-shrink: 0;
}
.grid-island-top input[type=text] {
  flex: 1; min-width: 180px; max-width: 420px; font-size: 13px; font-weight: 600; padding: 6px 10px;
}
.grid-week-group { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.grid-seg { width: 168px; flex-shrink: 0; }
.grid-seg button { padding: 5px 10px; font-size: 12px; }
.grid-island-main {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.grid-island-main.has-bottom-fade::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 148px;
  pointer-events: none; z-index: 5;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 0%, transparent) 0%,
    color-mix(in srgb, var(--bg) 42%, transparent) 42%,
    color-mix(in srgb, var(--bg) 86%, transparent) 78%,
    var(--bg) 98%);
}
.grid-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.grid-err { padding: 6px 14px; margin: 0; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.grid-scroll { flex: 1; overflow: auto; background: var(--bg); }
#roster-grid { border-collapse: collapse; font-size: 11px; white-space: nowrap; }
#roster-grid th, #roster-grid td { border: 1px solid var(--border); padding: 3px 6px; min-width: 56px; height: 24px; text-align: center; }
#roster-grid th { background: var(--surface2); color: var(--text-dim); font-weight: 600; position: sticky; z-index: 3; }
#roster-grid thead tr:nth-child(1) th { top: 0; font-weight: 400; color: var(--text-muted); }
#roster-grid thead tr:nth-child(2) th { top: 25px; }
#roster-grid thead tr:nth-child(3) th { top: 50px; }
#roster-grid .gutter { min-width: 44px; background: var(--surface2); color: var(--text-muted); position: sticky; left: 0; z-index: 2; }
#roster-grid thead .gutter { z-index: 4; }
#roster-grid td.cell { background: var(--surface); color: var(--text); cursor: cell; outline: none; }
#roster-grid td.dstart, #roster-grid th.dstart, #roster-grid th.dayhead { border-left: 2px solid var(--accent-dim); }
#roster-grid td.cell:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
#roster-grid td.cell.sel, #roster-grid td.cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

/* roster grid: column reorder, delete and reset controls */
button.reset-cols {
  background: #f5a623; border-color: #f5a623; color: #1a1a1a; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 10px rgba(245, 166, 35, .32);
}
button.reset-cols:hover:not(:disabled) {
  background: #ffb73d; border-color: #ffb73d; color: #1a1a1a; filter: none;
}
#roster-grid th.sub, #roster-grid th.letter { padding: 3px 6px; }
#roster-grid th .sub-lbl { display: inline-block; transition: transform .12s ease; }
#roster-grid th.removable:hover .sub-lbl,
#roster-grid th.removable:focus-within .sub-lbl { transform: translateX(-6px); }
#roster-grid th .sub-x {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; padding: 0; border: 0; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted); font-size: 12px; line-height: 1; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .12s ease, color .12s ease, background .12s ease;
  cursor: pointer;
}
#roster-grid th.removable:hover .sub-x,
#roster-grid th.removable:focus-within .sub-x { opacity: 1; pointer-events: auto; }
#roster-grid th .sub-x:hover,
#roster-grid th .sub-x:focus-visible { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); outline: none; }
#roster-grid th.will-remove { background: color-mix(in srgb, var(--danger) 18%, var(--surface2)); color: var(--danger); }
#roster-grid th.movable { cursor: grab; touch-action: none; }
#roster-grid th.movable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#roster-grid.col-dragging, #roster-grid.col-dragging th.sub, #roster-grid.col-dragging th.letter { cursor: grabbing; }
#roster-grid th.is-dragging { background: color-mix(in srgb, var(--accent) 24%, var(--surface2)); color: var(--text); }
#roster-grid th.drop-left { box-shadow: inset 3px 0 0 var(--accent); }
#roster-grid th.drop-right { box-shadow: inset -3px 0 0 var(--accent); }
@media (hover: none) {
  #roster-grid th.removable .sub-x { opacity: 1; pointer-events: auto; }
  #roster-grid th.removable .sub-lbl { transform: translateX(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  #roster-grid th .sub-lbl, #roster-grid th .sub-x { transition: none; }
  #roster-grid.shift-left tbody tr.rot-row td.cell,
  #roster-grid.shift-right tbody tr.rot-row td.cell,
  #roster-grid.shift-left thead th.dayhead,
  #roster-grid.shift-right thead th.dayhead { animation: none; }
}
#roster-grid.shift-left tbody tr.rot-row td.cell { animation: grid-shift-left .55s cubic-bezier(.22, 1, .36, 1); }
#roster-grid.shift-right tbody tr.rot-row td.cell { animation: grid-shift-right .55s cubic-bezier(.22, 1, .36, 1); }
#roster-grid.shift-left thead th.dayhead,
#roster-grid.shift-right thead th.dayhead { animation: grid-head-flash .55s ease-out; }
@keyframes grid-shift-left {
  0% { transform: translateX(26px); background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
  100% { transform: none; background: var(--surface); }
}
@keyframes grid-shift-right {
  0% { transform: translateX(-26px); background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
  100% { transform: none; background: var(--surface); }
}
@keyframes grid-head-flash {
  0% { background: color-mix(in srgb, var(--accent) 38%, var(--surface2)); color: var(--text); }
  100% { background: var(--surface2); }
}

@media (max-width: 800px) {
  body { overflow: auto; }
  .shell { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--border); max-height: 55vh; }
  .grid2 { grid-template-columns: 1fr; }
}

@media print {
  html, body { display: block; background: #fff; height: auto; overflow: visible; margin: 0; padding: 0; }
  .topbar, .panel, .roster-bar, .swap-bar, .preview-bar, .examples, .empty, dialog, .dropveil, .toast, .hint-tip, .demo-banner { display: none !important; }
  .shell, .preview, .has-roster { display: block; }
  .stage { display: block; overflow: visible; padding: 0; background: #fff; }
  .scaler { overflow: visible; width: auto !important; height: auto !important; }
  .scale-inner { transform: none !important; width: auto !important; }
}
dialog.narrow { width: min(420px, 92vw); }

/* roster grid: selection model */
.grid-scroll { outline: none; user-select: none; -webkit-user-select: none; }
#roster-grid td.cell { padding: 0 6px; position: relative; }
#roster-grid td.cell.sel { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); outline: none; }
#roster-grid td.cell.anchor { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
#roster-grid td.cell:focus { outline: none; }
#roster-grid th.letter:not(.movable), #roster-grid td.gutter { cursor: pointer; }
#roster-grid th.letter:not(.will-remove):not(.is-dragging):hover, #roster-grid td.gutter:hover { color: var(--text); background: var(--border); }
#roster-grid input.cell-edit {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 2px solid var(--accent); border-radius: 0; padding: 0 5px;
  background: var(--surface); color: var(--text); font: inherit; text-align: center; outline: none; user-select: text; -webkit-user-select: text;
}
.namebox {
  min-width: 70px; padding: 3px 10px; text-align: center; font: 600 11px ui-monospace, Menlo, monospace;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--accent);
}

/* line names single-column spreadsheet dialog */
dialog.names-dlg { width: min(640px, 94vw); height: min(740px, 90vh); }
#names-scroll { scroll-padding-top: 58px; }
.names-island-top { justify-content: flex-start; flex-wrap: wrap; }
.names-comm-group { display: flex; align-items: center; gap: 6px; }
.names-comm-group input[type=date] { width: 150px; font-size: 13px; font-weight: 600; padding: 5px 8px; }
button.names-wk-step { width: 28px; height: 29px; padding: 0; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.names-day-pill {
  margin-left: auto; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
}
#names-grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
#names-grid thead { position: sticky; top: 0; z-index: 10; background: var(--surface2); }
#names-grid th, #names-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); height: 28px; box-sizing: border-box; }
#names-grid th { background: var(--surface2); color: var(--text-dim); font-weight: 600; height: 25px; text-align: center; padding: 3px 8px; }
#names-grid thead tr:nth-child(1) th { font-weight: 400; color: var(--text-muted); }
#names-grid .gutter { width: 52px; min-width: 52px; background: var(--surface2); color: var(--text-muted); text-align: center; position: sticky; left: 0; z-index: 2; padding: 0 6px; font-variant-numeric: tabular-nums; }
#names-grid thead .gutter { z-index: 11; }
#names-grid td.gutter.hdr-active {
  background: color-mix(in srgb, var(--accent) 24%, var(--surface2));
  color: var(--accent); font-weight: 700;
}
#names-grid th.names-head { border-left: 2px solid var(--accent-dim); text-align: left; padding-left: 12px; }
#names-grid td.cell {
  background: var(--surface); color: var(--text); cursor: cell; outline: none;
  border-left: 2px solid var(--accent-dim); padding: 0 12px; text-align: left;
  position: relative; overflow: hidden; text-overflow: ellipsis;
}
#names-grid td.cell:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
#names-grid td.cell.sel { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); outline: none; }
#names-grid td.cell.anchor { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
#names-grid td.cell.fill-preview {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}
#names-grid .fill-handle {
  position: absolute; bottom: 0; right: 0; width: 9px; height: 9px;
  background: var(--accent); border: 2px solid var(--surface);
  cursor: crosshair; z-index: 6; pointer-events: auto;
}
#names-grid th.letter, #names-grid td.gutter, #names-grid th.corner { cursor: pointer; }
#names-grid th.letter:hover, #names-grid td.gutter:not(.hdr-active):hover, #names-grid th.corner:hover { color: var(--text); background: var(--border); }
#names-grid input.cell-edit {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 2px solid var(--accent); border-radius: 0; padding: 0 11px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; outline: none; user-select: text; -webkit-user-select: text;
}
#names-grid tbody.names-tail { pointer-events: none; user-select: none; }
#names-grid tbody.names-tail td.tail-gutter {
  width: 52px; min-width: 52px; background: var(--surface2); color: var(--text-muted);
  text-align: center; padding: 0 6px;
}
#names-grid tbody.names-tail td.tail-cell {
  background: var(--surface); border-left: 2px solid var(--accent-dim); padding: 0 12px;
}
#names-grid.shift-down tbody td.cell:not(:empty) { animation: names-shift-down .52s cubic-bezier(.22, 1, .36, 1); }
#names-grid.shift-up tbody td.cell:not(:empty) { animation: names-shift-up .52s cubic-bezier(.22, 1, .36, 1); }
@keyframes names-shift-down {
  0% { transform: translateY(-28px); background: color-mix(in srgb, var(--accent) 32%, var(--surface)); }
  100% { transform: none; background: var(--surface); }
}
@keyframes names-shift-up {
  0% { transform: translateY(28px); background: color-mix(in srgb, var(--accent) 32%, var(--surface)); }
  100% { transform: none; background: var(--surface); }
}
button.names-wk-step, .names-comm-group input[type=date] { transition: transform .14s, background .16s, border-color .16s, box-shadow .16s; }
button.names-wk-step.tut-press {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); transform: scale(.9);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 42%, transparent);
}
.names-comm-group input[type=date].tut-date-flash {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface2));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent);
}
#names-grid td.cell.tut-lead {
  color: var(--accent); font-weight: 700;
}
#names-grid td.cell.tut-pop { animation: names-tut-pop .24s cubic-bezier(.2, 1.25, .4, 1); }
@keyframes names-tut-pop {
  0% { opacity: .25; transform: translateY(-6px); background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
  100% { opacity: 1; transform: none; }
}
.tut-paste-chip {
  position: fixed; z-index: 25; padding: 3px 9px; border-radius: 999px; pointer-events: none;
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 800; letter-spacing: .03em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .42); animation: coach-pop .22s cubic-bezier(.2, 1.3, .4, 1);
}
.tut-paste-chip[hidden] { display: none; }
.coach-arrow.coach-dyn-arrow {
  left: 0; top: 0; width: 100vw; height: 100vh; transform: none; pointer-events: none;
}
.coach.in .coach-arrow.comm-dyn-arrow { animation: comm-bob-down 1.3s ease-in-out .7s infinite, coach-fade .3s ease .3s both; }
@keyframes comm-bob-down { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
#names-coach-card { cursor: default; }
.coach-kicker {
  display: inline-block; align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent-text) 14%, transparent); color: var(--accent-text); margin-bottom: 2px;
}
#names-coach-card .coach-actions { flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#names-coach-card .coach-actions .primary {
  background: var(--surface); border-color: var(--surface); color: var(--text);
}
#names-coach-card .coach-actions .primary:hover:not(:disabled) { filter: brightness(1.08); }
#names-coach-card .coach-actions .ghost {
  background: color-mix(in srgb, var(--accent-text) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent-text) 32%, transparent);
  color: var(--accent-text);
}
#names-coach-card .coach-actions .ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-text) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent-text) 55%, transparent);
  color: var(--accent-text);
}
@media (prefers-reduced-motion: reduce) {
  #names-grid.shift-down tbody td.cell, #names-grid.shift-up tbody td.cell, #names-grid td.cell.tut-pop, .tut-paste-chip, .coach.in .coach-arrow.comm-dyn-arrow { animation: none; }
  button.names-wk-step, .names-comm-group input[type=date] { transition: none; }
}

/* print tips dialog */
.notice { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); font-size: 12px; line-height: 1.5; border: 1px solid var(--border); background: var(--surface2); color: var(--text-dim); }
.notice.ok { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: color-mix(in srgb, var(--success) 10%, var(--surface2)); color: var(--text); }
.notice.warn { border-color: color-mix(in srgb, #f5a623 55%, transparent); background: color-mix(in srgb, #f5a623 12%, var(--surface2)); color: var(--text); }
.tips { margin: 0 0 12px; padding-left: 18px; color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.tips strong { color: var(--text); }

/* grid coach mark */
.coach { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.coach-card {
  position: fixed; left: var(--card-x, calc(var(--ax) + 175px)); top: var(--card-y, calc(var(--ay) + 70px)); width: 290px; pointer-events: auto; cursor: pointer;
  background: var(--accent); color: var(--accent-text); padding: 12px 14px; border-radius: 12px; font-size: 12px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 4px;
}
.coach-card strong { font-size: 15px; }
.coach-card em { font-style: normal; opacity: .75; font-size: 10px; margin-top: 2px; }
.coach-arrow {
  position: fixed; left: var(--arr-x, calc(var(--ax) + 14px)); top: var(--arr-y, calc(var(--ay) + 12px)); width: 150px; height: 90px; color: var(--accent);
  transform: scale(var(--sx, 1), var(--sy, 1));
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}
.coach.no-arrow .coach-arrow { display: none; }
.coach-cols[hidden] { display: none; }
.coach-card-cols { left: var(--cx, 620px); top: var(--cy, 290px); width: 264px; }
.coach-col-arrow {
  position: fixed; left: 0; top: 0; pointer-events: none; color: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}
.coach.in .coach-card { animation: coach-pop .5s cubic-bezier(.2, 1.3, .4, 1) .15s both; }
.coach.in .coach-arrow { animation: coach-bob 1.3s ease-in-out .7s infinite, coach-fade .3s ease .3s both; }
.coach.in .coach-col-arrow { animation: coach-bob-up 1.3s ease-in-out .7s infinite, coach-fade .3s ease .3s both; }
@keyframes coach-pop { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes coach-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes coach-bob { 0%, 100% { transform: scale(var(--sx, 1), var(--sy, 1)) translate(0, 0); } 50% { transform: scale(var(--sx, 1), var(--sy, 1)) translate(-9px, -7px); } }
@keyframes coach-bob-up { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(0, -7px); } }
#roster-grid td.cell.coach-pulse, #names-grid td.cell.coach-pulse { position: relative; z-index: 4; }
#roster-grid th.coach-pulse { z-index: 5; }
#roster-grid td.cell.coach-pulse, #roster-grid th.coach-pulse, #names-grid td.cell.coach-pulse { animation: coach-pulse 1.4s ease-out infinite; }
#roster-grid td.cell.coach-pulse.warn-pulse { animation: coach-pulse-warn 1.4s ease-out infinite; background: color-mix(in srgb, #f5a623 24%, var(--surface)); }
@keyframes coach-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent), inset 0 0 0 2px var(--accent); }
  100% { box-shadow: 0 0 0 14px transparent, inset 0 0 0 2px var(--accent); }
}
@keyframes coach-pulse-warn {
  0% { box-shadow: 0 0 0 0 rgba(245, 166, 35, .85), inset 0 0 0 2px #f5a623; }
  100% { box-shadow: 0 0 0 14px transparent, inset 0 0 0 2px #f5a623; }
}
#n-comm-label.coach-glow {
  border-radius: 6px; padding: 3px 7px; margin: -3px -7px;
  animation: coach-text-glow 1.4s ease-out infinite;
}
@keyframes coach-text-glow {
  0% {
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 85%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 75%, transparent);
  }
  50% {
    text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 95%, transparent), 0 0 26px color-mix(in srgb, var(--accent) 65%, transparent);
  }
  100% {
    text-shadow: 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: 0 0 0 12px transparent;
  }
}
@media (prefers-reduced-motion: reduce) { .coach.in .coach-card, .coach.in .coach-arrow, .coach.in .coach-col-arrow, #roster-grid td.cell.coach-pulse, #roster-grid th.coach-pulse, #names-grid td.cell.coach-pulse, #n-comm-label.coach-glow { animation: none; } }

/* coach: warning mode */
.coach.warn .coach-card { background: #f5a623; color: #1a1a1a; width: 340px; }
.coach.warn .coach-arrow { color: #f5a623; }
.coach-card ul { margin: 4px 0 6px; padding-left: 16px; }
.coach-card li { margin-bottom: 3px; }
.coach-card p { margin: 4px 0 0; opacity: .9; }
.coach-actions { display: flex; gap: 8px; margin-top: 8px; }
.coach.warn .coach-actions .ghost { background: rgba(255,255,255,.55); color: #1a1a1a; border-color: transparent; }
.coach.warn .coach-actions .primary { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.coach-actions .primary { background: #fff; border-color: #fff; color: #1a1a1a; }
.coach-actions .ghost { background: rgba(255, 255, 255, .18); border-color: transparent; color: #fff; }

/* toast + hover hints are popovers (top layer): reset the browser's default popover box */
.toast[popover], .hint-tip[popover] { margin: 0; border: 0; overflow: visible; width: auto; height: auto; }
.toast[popover] { inset: auto auto 18px 50%; transform: translateX(-50%); }
.hint-tip[popover] { inset: auto; }
.toast.ok { background: #22e06b; color: #032a12; font-weight: 700; box-shadow: 0 8px 28px rgba(34, 224, 107, .45); }
.toast.ok::before { content: '\2713\00a0'; font-weight: 800; }

/* ── desktop-only gate for phones, tablets and very narrow windows ── */
.gate { display: none; }
.gate-on, .gate-on body { height: auto; min-height: 100%; overflow: visible; } /* let the page itself scroll, so phone browser bars never trap the top or bottom */
.gate-on .topbar, .gate-on .shell, .gate-on dialog, .gate-on .toast, .gate-on .hint-tip, .gate-on .dropveil { display: none !important; }
.gate-on .gate {
  display: flex; min-height: 100vh; min-height: 100dvh; width: 100%;
  padding: calc(72px + env(safe-area-inset-top, 0px)) 24px calc(140px + env(safe-area-inset-bottom, 0px)); /* dead space above and below: phone address bars and toolbars cover about this much */
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 22%, var(--bg)) 0%, var(--bg) 62%);
}
.gate-card { max-width: 440px; margin: auto; text-align: center; } /* margin:auto centres when there is room and never cuts the top off when there isn't */
.gate-logo { display: block; height: 84px; width: auto; margin: 0 auto 18px; fill: #fff; }
:root[data-theme="light"] .gate-logo { fill: #000; }
.gate-art { width: 150px; height: auto; color: var(--accent); margin: 0 auto 22px; display: block; }
.gate-card h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.2; color: var(--text); letter-spacing: -.01em; }
.gate-lead { margin: 0 0 14px; font-size: 15px; line-height: 1.55; color: var(--text-dim); }
.gate-next { margin: 0 0 14px; font-size: 16px; color: var(--text); }
.gate-narrow { margin: 0 0 18px; font-size: 13px; color: var(--text-muted); }
.gate-device .gate-narrow { display: none; }
.gate-tiplink { margin: 14px 0 0; font-size: 11px; }
.gate-tiplink a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.gate-tiplink a:hover { color: var(--text-dim); }
.gate-fine { margin: 0; font-size: 12px; color: var(--text-muted); }

.donate-text { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

/* pattern chooser */
button.pat-choose { display: flex; width: 100%; justify-content: space-between; align-items: center; text-align: left; }
.pat-choose .pat-go { color: var(--accent); }
dialog.wide-gallery { width: min(980px, 96vw); }
.gallery-dlg { padding: 0; }
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 14px; max-height: min(66vh, 640px); overflow: auto; }
.pat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); }
.pat-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pat-art svg { width: 76px; height: 76px; display: block; }
.pat-art svg path, .pat-art svg circle { fill: var(--text-dim); fill-opacity: 0.95; }
.pat-art svg .t2 { fill-opacity: 0.6; }
.pat-art svg .t3 { fill-opacity: 0.32; }
.pat-art svg .eo { fill-rule: evenodd; }
.pat-name { font-size: 11px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.25; }

/* accent colour picker row */
.accent-row { display: flex; align-items: center; gap: 10px; }
.accent-row span { color: var(--text-dim); font-size: 12px; flex: 1; }

/* arrow that nudges toward "Copy prompt" a few times each time the import dialog opens, then rests */
.steps li div.copy-row { position: relative; }
.point-arrow { position: absolute; left: -58px; top: 50%; width: 44px; height: 24px; margin-top: -12px; color: var(--accent); pointer-events: none; }
.point-arrow.go { animation: point-nudge .6s ease-in-out .3s 4; }
@keyframes point-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(11px); } }
@media (prefers-reduced-motion: reduce) { .point-arrow.go { animation: none; } }

/* experimental colour picker (site/colour-picker.js), modelled on Chrome for Mac: dark panel in both themes */
.cp[popover] {
  margin: 0; padding: 0; inset: auto; width: 252px; overflow: visible; background: #303030; color: #fff;
  border: 1px solid #5a5a5a; border-radius: 6px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); font-size: 13px;
}
.cp-sv { position: relative; height: 140px; border-radius: 5px 5px 0 0; cursor: crosshair; touch-action: none; outline-offset: -3px; }
.cp-sv-dot { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .25); pointer-events: none; }
.cp-mid { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; }
.cp-eye { flex: none; width: 34px; height: 34px; padding: 5px; background: none; border: 0; color: #fff; border-radius: 6px; }
.cp-eye:hover:not(:disabled) { background: rgba(255, 255, 255, .12); color: #fff; }
.cp-eye svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cp-preview { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); }
.cp-hue {
  position: relative; flex: 1; height: 14px; margin: 0 9px; border-radius: 4px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}
.cp-hue-dot { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.cp-fields { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 14px; }
.cp-rgb { display: flex; gap: 8px; }
.cp-rgb input { flex: 1; min-width: 0; }
.cp-fmt { position: relative; }
.cp-fmt[data-mode="rgb"] select.cp-format, .cp-fmt[data-mode="hsl"] select.cp-format { color: transparent; } /* the letters below replace the word */
.cp-letters { position: absolute; left: 10px; right: 34px; top: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; pointer-events: none; font-weight: 500; font-size: 13px; color: #fff; }
.cp-letters span { flex: 1; text-align: center; }
.cp input[type=text] {
  width: 100%; box-sizing: border-box; background: transparent; color: #fff; border: 1px solid #777; border-radius: 4px;
  padding: 7px 4px; text-align: center; font: 500 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.cp input[type=text]:focus { border-color: #8ab4f8; outline: none; }
.cp select.cp-format {
  appearance: none; -webkit-appearance: none; width: 100%; background: #3a3a3a; color: #fff; border: 1px solid #777; border-radius: 6px;
  padding: 7px 28px 7px 10px; text-align: center; text-align-last: center; font: 500 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4-3 4 3M4 10l4 3 4-3' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.cp select.cp-format:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 1px; }
.cp select.cp-format option { background: #303030; color: #fff; }
.cp-sv:focus-visible, .cp-hue:focus-visible { outline: 2px solid #8ab4f8; }

/* phone page: ways to carry the link over to a computer */
.gate-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 0 18px; }
.gate-actions button { min-width: 220px; padding: 11px 18px; font-size: 14px; }
.gate-mail { color: var(--accent); font-size: 13px; text-decoration: underline; }
.gate-howto { margin: 0 0 18px; }
.gate-card .howto { margin-right: 0; }

/* ICS builder dialog */
#ics-weeks-all { white-space: nowrap; flex-shrink: 0; }
#ics-weeks { max-width: 120px; }
#ics-dialog .tips { margin: 6px 0 0; }

/* ideas and comments */
button.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: 11px; font-weight: 400; color: var(--accent); text-decoration: underline; cursor: pointer; }
button.linklike:hover:not(:disabled) { color: var(--accent); filter: brightness(1.2); border: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#ideas-text { resize: vertical; min-height: 110px; font-family: inherit; line-height: 1.5; }

/* pattern gallery categories */
.pat-cats { flex: 0 0 auto; margin-right: 10px; }
.pat-cats button { padding: 5px 14px; white-space: nowrap; }

/* privacy statements: always in the accent colour */
.privacy-line { color: var(--accent); font-size: 15px; line-height: 1.5; margin: 10px auto; }
.privacy-line strong { display: block; font-size: 18px; letter-spacing: .01em; }
.privacy-line.big strong { display: inline; font-size: inherit; }
.demo-banner .privacy-line { color: var(--accent); margin: 8px 0 0; }
.demo-banner .privacy-line strong { font-size: 17px; letter-spacing: 0; margin: 0; }
.about-list { margin: 8px 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.about-list li { margin-bottom: 7px; }
.drag-hint { color: var(--accent); }
.empty-privacy strong { font-weight: 600; }

/* ── shared calendar preview mode (works on iPhones, Androids, tablets and computers) ── */
.share-view { display: none; }
.share-mode, .share-mode body { height: auto; min-height: 100%; overflow: visible; }
.share-mode .topbar,
.share-mode .shell,
.share-mode .gate,
.share-mode dialog,
.share-mode .dropveil,
.share-mode #sbd-swap-fab,
.share-mode #sbd-swap-view { display: none !important; }
.share-mode .share-view {
  display: block; min-height: 100vh; min-height: 100dvh; width: 100%;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}
.sv-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.sv-brand { display: flex; align-items: center; }
.sv-logo { display: block; height: 36px; width: auto; fill: #fff; }
:root[data-theme="light"] .sv-logo { fill: #000; }
.sv-theme-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); cursor: pointer; }

.sv-main { max-width: 1040px; margin: 0 auto; padding: 18px 14px 28px; }
.sv-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)) 0%, var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border));
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.sv-hero-info { flex: 1 1 280px; min-width: 0; }
.sv-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.sv-title { margin: 0 0 4px; font-size: 24px; line-height: 1.2; color: var(--text); word-break: break-word; }
.sv-sub { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text); opacity: .92; }
.sv-dates { margin: 0; font-size: 13px; color: var(--text-dim); }

.sv-actions {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  flex: 0 1 290px; min-width: 240px;
}
.sv-dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 22px; border-radius: 10px;
  font-size: 16px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 34%, transparent);
}
.sv-dl-btn svg { width: 20px; height: 20px; flex: none; }
.sv-dl-btn.is-busy { opacity: .85; cursor: progress; }
.sv-ready-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sv-ready-btn {
  flex: 1 1 110px; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 700;
  color: var(--text); background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer;
}
.sv-ready-btn:hover { border-color: var(--accent); color: var(--accent); }
.sv-status { margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-dim); text-align: center; }

.sv-pages { display: flex; flex-direction: column; gap: 14px; }
.sv-page-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; box-shadow: var(--shadow);
}
.sv-page-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-dim); padding: 0 2px 8px;
}
.sv-page-frame {
  position: relative; width: 100%; overflow: hidden; border-radius: 6px;
  background: #686868;
}
.sv-page-scale {
  position: absolute; left: 0; top: 0; width: 2200px; height: 1535px;
  transform-origin: 0 0;
}
.sv-page-scale .page-container { margin: 0; }

.sv-footer {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border);
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.sv-phone-note { margin: 0; font-size: 13px; color: var(--text-dim); display: none; }
.sv-tiplink { margin: 2px 0 0; font-size: 11px; }
.sv-tiplink a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.sv-tiplink a:hover { color: var(--text-dim); }
.sv-error-card {
  max-width: 480px; margin: 48px auto; padding: 28px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.sv-error-card h1 { margin: 0 0 10px; font-size: 22px; }
.sv-error-card p { margin: 0 0 18px; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.sv-home-btn { display: inline-block; padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: 700; }

@media (max-width: 899px) {
  .sv-main { padding: 12px 10px 24px; }
  .sv-hero { padding: 14px; gap: 12px; }
  .sv-title { font-size: 20px; }
  .sv-actions { flex: 1 1 100%; min-width: 0; }
  .sv-page-card { padding: 6px; border-radius: 9px; }
  .sv-editor-btn { display: none; }
  .sv-phone-note { display: block; }
}
