:root {
  --bg: #f4f5f8; --panel: #ffffff; --col: #eceef3; --text: #1b1d24; --muted: #6a7080; --line: #d9dce5;
  --accent: #6d4aff; --accent-text: #ffffff; --ok: #1a8f4c; --warn: #b7791f; --bad: #c0392b;
  --st-idea: #6b7a90; --st-building: #2b6fd6; --st-testing: #d9730d; --st-live: #1a8f4c;
  --st-paused: #148a96; --st-canceled: #c0392b; --st-archived: #8a8378;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c; --panel: #1e212a; --col: #191b22; --text: #e8eaf0; --muted: #9aa1b2; --line: #2e323e;
    --accent: #8e74ff; --accent-text: #10111a; --ok: #46c27d; --warn: #e0a84a; --bad: #ef6c5d;
    --st-idea: #9aabc4; --st-building: #5aa2ff; --st-testing: #f0a050; --st-live: #46c27d;
    --st-paused: #3cc3d0; --st-canceled: #ef6c5d; --st-archived: #aaa397;
  }
}
:root[data-theme="dark"] {
  --bg: #14161c; --panel: #1e212a; --col: #191b22; --text: #e8eaf0; --muted: #9aa1b2; --line: #2e323e;
  --accent: #8e74ff; --accent-text: #10111a; --ok: #46c27d; --warn: #e0a84a; --bad: #ef6c5d;
  --st-idea: #9aabc4; --st-building: #5aa2ff; --st-testing: #f0a050; --st-live: #46c27d;
  --st-paused: #3cc3d0; --st-canceled: #ef6c5d; --st-archived: #aaa397;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.err { color: var(--bad); margin: 8px 16px; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.top h1 { font-size: 18px; margin: 0; }
.spacer { flex: 1; }
.views button { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 5px 12px; cursor: pointer; }
.views button:first-child { border-radius: 8px 0 0 8px; } .views button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.views button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { border-radius: 50%; object-fit: cover; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 7px 14px; cursor: pointer; font: inherit; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.solid { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.login { max-width: 420px; margin: 48px auto; text-align: center; }
.quickadd { display: flex; gap: 8px; padding: 14px 16px 6px; }
.quickadd input { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
textarea { width: 100%; resize: vertical; }
.filters { display: flex; gap: 8px; padding: 6px 16px 10px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 160px; }
.chk { font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.board { display: flex; gap: 12px; padding: 0 16px 24px; overflow-x: auto; align-items: flex-start; }
.col { background: var(--col); border-radius: 12px; min-width: 250px; width: 250px; padding: 10px; flex: 0 0 auto; }
.col.over { outline: 2px dashed var(--accent); }
.col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.pcard:hover { border-color: var(--accent); }
.pcard.dragging { opacity: .4; }
.pcard .nm { font-weight: 600; word-break: break-word; }
.row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; border-radius: 99px; padding: 1px 8px; border: 1px solid var(--line); color: var(--muted); }
.badge.app { color: var(--accent); border-color: var(--accent); } .badge.high { color: var(--bad); border-color: var(--bad); }
.bar { height: 5px; background: var(--col); border-radius: 3px; flex: 1; min-width: 40px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.faces { display: flex; } .faces .avatar, .faces .ini { margin-left: -6px; border: 2px solid var(--panel); }
.ini { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.mine { padding: 0 16px 24px; max-width: 760px; }
.mine h3 { margin: 16px 0 6px; font-size: 15px; }
.trow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.trow .t { flex: 1; } .trow.done .t { text-decoration: line-through; color: var(--muted); }
.due.late { color: var(--bad); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--panel); border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.15); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
.drawer label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 3px; }
.drawer input[type=text], .drawer input[type=url], .drawer select { width: 100%; }
.drawer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drawer h3 { margin: 18px 0 6px; font-size: 14px; }
.drawer .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.addtask { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.addtask .two { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px; }
@media (max-width: 640px) { .col { min-width: 82vw; width: 82vw; } .quickadd { flex-wrap: wrap; } }
.adminwrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.adminwrap .views { margin-bottom: 12px; }
.plist { margin-top: 12px; }
.prow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.prow .t { flex: 1; min-width: 180px; word-break: break-all; }
.arow { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.arow .when { color: var(--muted); margin-right: 8px; }

/* Status colors: each status class sets --c; columns, cards and the drawer status picker use it. */
.st-idea { --c: var(--st-idea); } .st-building { --c: var(--st-building); } .st-testing { --c: var(--st-testing); }
.st-live { --c: var(--st-live); } .st-paused { --c: var(--st-paused); } .st-canceled { --c: var(--st-canceled); } .st-archived { --c: var(--st-archived); }
.col[class*="st-"] { border-top: 4px solid var(--c); }
.col[class*="st-"] h2 { color: var(--c); }
.pcard[class*="st-"] { border-left: 4px solid var(--c); }
.pcard.st-canceled .nm { text-decoration: line-through; text-decoration-color: var(--c); }
.drawer select.stsel { border: 2px solid var(--c); color: var(--c); font-weight: 600; }

/* Header tools: search and the + (new project) button */
.top { position: relative; }
.tools { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; max-width: 520px; }
.tools .search { flex: 1; min-width: 100px; }
.addwrap { position: relative; }
.addbtn { width: 36px; height: 36px; padding: 0; font-size: 22px; line-height: 1; border-radius: 10px; }
.addpop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; display: flex; gap: 6px; padding: 10px; width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.addpop input { flex: 1; min-width: 0; }
@media (max-width: 640px) { .tools { order: 5; flex-basis: 100%; max-width: none; } .addpop { left: auto; right: 0; } }

/* Compact board cards: name on the left, badges on the right, progress as a thin line on the bottom edge */
.pcard { position: relative; overflow: hidden; padding: 8px 10px; }
.pcard .ptop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pmeta { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pcard .cnt { font-size: 12px; }
.pcard .faces { display: flex; }
.pcard .faces .avatar, .pcard .faces .ini { width: 18px; height: 18px; font-size: 10px; margin-left: -5px; border-width: 1px; }
.pcard .pbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--col); }
.pcard .pbar i { display: block; height: 100%; background: var(--ok); }

/* Brand: title (click = full refresh) with the version button tucked underneath */
.brand { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.homelink { color: inherit; text-decoration: none; }
.homelink:hover h1 { color: var(--accent); }
.verbtn { font: inherit; font-size: 10px; line-height: 1; padding: 2px 6px; margin-top: 3px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; cursor: pointer; }
.verbtn:hover { color: var(--accent); border-color: var(--accent); }
/* Change log modal */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.5); }
.modalbox { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 100%); max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.modalhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modalbody { overflow-y: auto; padding: 8px 16px 16px; }
.logentry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.logentry:last-child { border-bottom: 0; }
.logentry h3 { margin: 0 0 4px; font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.logentry .ver { color: var(--accent); }
.logentry .when { font-size: 12px; font-weight: 400; color: var(--muted); }
.logentry .cur { font-size: 10px; border: 1px solid var(--ok); color: var(--ok); border-radius: 99px; padding: 0 6px; }
.logentry ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text); }

/* Admin activity: summary chips, filters, event rows */
.sumrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font: inherit; font-size: 12px; padding: 3px 10px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 99px; cursor: pointer; }
.chip strong { color: var(--text); }
.chip:hover { border-color: var(--accent); }
.chip.bad strong { color: var(--bad); }
.actbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.actbar input { flex: 1; min-width: 140px; }
.atag { --c: var(--muted); font-size: 11px; border: 1px solid var(--c); color: var(--c); border-radius: 99px; padding: 0 8px; margin-right: 2px; white-space: nowrap; }
.cat-signin { --c: var(--st-building); } .cat-projects { --c: var(--accent); } .cat-tasks { --c: var(--st-testing); }
.cat-admin { --c: var(--st-paused); } .cat-visits { --c: var(--st-idea); } .cat-system { --c: var(--st-canceled); } .cat-legacy { --c: var(--st-archived); }
.arow .dev { color: var(--muted); font-size: 12px; }
