:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --muted: var(--tg-theme-hint-color, #888888);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --accent: var(--tg-theme-button-color, #2b7cff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: #e5484d;
  --ok: #30a46c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 120px; }
h1 { font-size: 20px; margin: 4px 0 8px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--card); color: var(--muted); white-space: nowrap; }
.job { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 12px; margin: 6px 0;
  background: var(--card); border-radius: 12px; color: var(--text); text-decoration: none; }
.job-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, .btn { appearance: none; border: 0; border-radius: 10px; padding: 12px 14px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.secondary { background: var(--card); color: var(--text); }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { position: relative; background: var(--card); border-radius: 12px; overflow: hidden; border: 3px solid transparent; }
.tile.selected { border-color: var(--accent); }
.tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.tile .cap { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; font-size: 13px; }
.tile input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }
.placeholder { aspect-ratio: 1; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: grid; place-items: center; z-index: 10; }
.lightbox img { max-width: 100vw; max-height: 100vh; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--card); display: flex; gap: 8px; }
.bar button { flex: 1; }
textarea, input[type=text], select { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--card);
  background: var(--card); color: var(--text); }
.sheet { background: var(--card); border-radius: 12px; padding: 12px; margin: 10px 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--bg); border-radius: 999px; margin: 4px 4px 0 0; }
.slider { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 8px; margin: 8px 0; }
.slider input { width: 100%; }
.err { color: var(--danger); white-space: pre-line; }

/* ---------- board ---------- */
.small { font-size: 13px; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; }
.seg button { background: transparent; color: var(--muted); padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.seg button.on { background: var(--bg); color: var(--text); }
#new-idea input { background: var(--bg); }
#new-idea .row button { flex: 1; }
.sec { margin-top: 14px; }
.sec-head { width: 100%; display: flex; align-items: center; gap: 8px; background: transparent; color: var(--text);
  padding: 8px 2px; font-size: 16px; text-align: left; }
.sec-head span:first-child { flex: 1; }
.sec-head .chev { color: var(--muted); width: 14px; }
.card { display: block; background: var(--card); border-radius: 12px; padding: 12px; margin: 8px 0; color: var(--text); text-decoration: none; }
.card.idea.child { margin-left: 18px; border-left: 3px solid var(--accent); }
.card .tagline { font-weight: 700; font-size: 16px; margin-bottom: 4px; overflow-wrap: anywhere; }
.card .small { margin-top: 2px; overflow-wrap: anywhere; }
.card .acts { margin-top: 10px; }
.card .acts button { padding: 9px 11px; font-size: 14px; }
.card button.secondary { background: var(--bg); }
.art-edit { margin-top: 10px; }
.art-edit textarea { background: var(--bg); margin-bottom: 8px; }
.job-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; position: relative; }
.thumb img, .thumb-ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); }
.job-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { padding: 3px 8px; font-size: 12px; font-weight: 500; border-radius: 999px; background: var(--bg); color: var(--accent); }
.progress { grid-column: 1 / -1; height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.remove-box { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--card); text-align: center; }
button.danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
#banner { white-space: pre-line; }
/* vector inspector */
.vi { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.vi-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.vi-top b { flex: 1; }
.vi-top button { padding: 8px 14px; }
.vi-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.vi-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.vi-controls { padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--card); }
.vi-controls .slider { grid-template-columns: 90px 1fr 44px; }
.vi-hue { -webkit-appearance: none; appearance: none; height: 14px; border-radius: 7px;
  background: linear-gradient(to right, #000 0 4%, hsl(0,100%,50%) 4%, hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%),
    hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%) 96%, #fff 96%); }
.vi-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #333; }
.vi-chips { margin: 6px 0; }
.vi-chips button { padding: 6px 10px; font-size: 13px; }
.vi-fix { background: var(--card); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.vi-fix .row { gap: 6px; }
.vi-sw { width: 34px; height: 34px; padding: 0; border-radius: 8px; border: 2px solid var(--bg); }
.vi-sw.on { outline: 3px solid var(--accent); }
.vi-sw.sm { display: inline-block; width: 18px; height: 18px; vertical-align: middle; border-radius: 4px; border: 1px solid #888; }
button.on-outline { outline: 2px solid var(--accent); }
.vi-stage canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
[hidden] { display: none !important; }  /* .row etc. set display, which otherwise beats the hidden attribute */
.job-card { grid-template-columns: 56px minmax(0, 1fr) 36px; }
.card-x { width: 36px; height: 36px; padding: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 16px; }
.job-card .progress { grid-column: 1 / -1; }
.scan-btn { width: 100%; margin-top: 8px; }
.scan-btn { width: 100%; margin-top: 8px; }

/* colour browser (publish summary) */
button.more-btn { display: block; background: none; color: var(--accent); padding: 8px 0 2px; font-weight: 600; }
.cb { margin-top: 6px; }
.cb-stage { aspect-ratio: 1; border-radius: 12px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.cb-art { width: 70%; max-height: 88%; object-fit: contain; }
.cb-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
button.cb-dot { background: none; color: var(--text); padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; }
.cb-sw { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(128,128,128,.45); position: relative; }
.cb-dot.cur .cb-sw { box-shadow: 0 0 0 3px var(--accent); }
.cb-dot.on .cb-sw::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 0 3px #000; font-weight: 700; font-size: 16px; }
.cb-name { text-align: center; line-height: 1.15; }
.vi-erase { background: repeating-conic-gradient(#bbb 0 25%, #fff 0 50%) 0 0/10px 10px; color: #c00; font-weight: 700; font-size: 16px; }
.vi-dotbox { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; }
.vi-dot { display: inline-block; border-radius: 50%; border: 1px solid #888; max-width: 100%; max-height: 100%; }
.vi-icon { padding: 6px 10px; font-size: 18px; }
.vi-crow { gap: 6px; flex-wrap: nowrap; }
.vi-scroll { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 4px 2px; -webkit-overflow-scrolling: touch; }
.vi-scroll > * { flex: 0 0 auto; }
