:root {
  --bg: #0c0e0c;
  --panel: #121612;
  --line: #243024;
  --fg: #c8f7c5;
  --dim: #6f8f6c;
  --accent: #39ff88;
  --amber: #ffb547;
  --red: #ff5f5f;
  --blue: #6cc4ff;
  --pink: #ff79c6;
  color-scheme: dark;
}

/* themes, picked with [t] and stored per browser. green above is the default */
:root[data-theme="amber"] {
  --bg: #0d0a05; --panel: #15100a; --line: #3a2a12; --fg: #ffd59a; --dim: #a5793f;
  --accent: #ffb000; --amber: #ff7f2a; --red: #ff5050; --blue: #ffd27a; --pink: #ff9f6b;
}
:root[data-theme="dracula"] {
  --bg: #1e1f29; --panel: #282a36; --line: #44475a; --fg: #f8f8f2; --dim: #7c86b8;
  --accent: #bd93f9; --amber: #ffb86c; --red: #ff5555; --blue: #8be9fd; --pink: #ff79c6;
}
:root[data-theme="nord"] {
  --bg: #2a303c; --panel: #2e3440; --line: #434c5e; --fg: #eceff4; --dim: #8f9bb3;
  --accent: #88c0d0; --amber: #ebcb8b; --red: #bf616a; --blue: #81a1c1; --pink: #b48ead;
}
:root[data-theme="solarized"] {
  --bg: #00212b; --panel: #002b36; --line: #0d4654; --fg: #eee8d5; --dim: #839496;
  --accent: #2aa198; --amber: #b58900; --red: #dc322f; --blue: #268bd2; --pink: #d33682;
}
:root[data-theme="mono"] {
  --bg: #0a0a0a; --panel: #111111; --line: #2c2c2c; --fg: #e6e6e6; --dim: #7d7d7d;
  --accent: #ffffff; --amber: #c8c8c8; --red: #ff6b6b; --blue: #b5b5b5; --pink: #d0d0d0;
}
:root[data-theme="paper"] {
  --bg: #ece8de; --panel: #f8f5ee; --line: #d6cfbf; --fg: #2b2a27; --dim: #857f70;
  --accent: #1d7a4c; --amber: #b26b00; --red: #c0392b; --blue: #2b6cb0; --pink: #b83280;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.acc { color: var(--accent); }
.amb { color: var(--amber); }
.red { color: var(--red); }
.blu { color: var(--blue); }
.gap { margin-top: 12px; }
.small { font-size: 12px; margin-top: 4px; }
.head { margin-bottom: 12px; }
.note { margin-top: 10px; font-size: 12px; }

/* window chrome */
.win { max-width: 1200px; margin: 24px auto; border: 1px solid var(--line); background: var(--panel); height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.bar .title { margin-left: 8px; color: var(--dim); }
.themebtn { margin-left: auto; color: var(--dim); }
.themebtn:hover { color: var(--accent); }
.thememenu { position: absolute; top: 34px; right: 12px; z-index: 20; background: var(--panel); border: 1px solid var(--line);
  min-width: 220px; padding: 4px 0; box-shadow: 0 8px 24px color-mix(in srgb, #000 35%, transparent); }
.thememenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 12px; text-align: left; color: var(--fg); }
.thememenu button:hover, .thememenu button.on { background: var(--line); }
.thememenu button.on::after { content: "✓"; margin-left: auto; color: var(--accent); }
.swatch { display: inline-flex; border: 1px solid var(--line); }
.swatch i { width: 9px; height: 12px; }
.bar { position: relative; }
.bar .who { margin-left: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* nav */
.nav { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nav button { padding: 2px 10px; color: var(--dim); }
.nav button:hover { color: var(--accent); }
.nav button.on { color: var(--bg); background: var(--accent); }
.nav button:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; color: var(--accent); }
.nav button.on:focus-visible { color: var(--bg); }
.nav .scope { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav .scope button.on { color: var(--bg); background: var(--accent); }
.nav .scope button[data-scope="#work"].on { background: var(--blue); }
.nav .scope button[data-scope="#private"].on { background: var(--pink); }

/* built in tags */
.tag-work { color: var(--blue); }
.tag-private { color: var(--pink); }
.quicktags { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; }
.quicktags button { color: var(--dim); }
.quicktags button.on { color: var(--accent); }
.quicktags button[data-tag="#work"].on { color: var(--blue); }
.quicktags button[data-tag="#private"].on { color: var(--pink); }

main { flex: 1; padding: 16px; overflow: auto; }
.view { display: none; }
.view.on { display: block; }

/* login */
.login { max-width: 520px; margin: 10vh auto; }
.logo { color: var(--accent); margin: 0 0 16px; font-size: 12px; }
.btn { display: inline-block; margin: 4px 8px 0 0; border: 1px solid var(--accent); padding: 6px 14px; color: var(--accent); }
.btn:hover, .btn:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
.btn.ghost:focus-visible { background: var(--dim); color: var(--bg); }
.keyhint { margin-top: 10px; }
.btn.ghost { border-color: var(--dim); color: var(--dim); }
.btn.ghost:hover { background: var(--dim); color: var(--bg); }
.miss { font-size: 20px; color: var(--accent); margin: 4px 0 6px; }
.quip { min-height: 1.5em; transition: opacity .3s; }
.quip.fade { opacity: 0; }
.cursor { display: inline-block; width: 8px; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* board */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.col { border: 1px solid var(--line); min-height: 300px; display: flex; flex-direction: column; }
.col.over { border-color: var(--accent); }
.col h3 { margin: 0; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: normal;
  position: sticky; top: -16px; z-index: 2; background: var(--panel); }
.col .list { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col .add { text-align: left; padding: 0 8px 8px; }
.col .add:hover, .older:hover { color: var(--accent); }
.older { text-align: left; font-size: 12px; }
.empty { padding: 8px 0; font-size: 12px; }
.card { border: 1px dashed var(--line); padding: 8px; position: relative; cursor: pointer; user-select: none; }
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card.sel { border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.card.sel .id::before { content: "› "; color: var(--accent); }
.card.moving { border: 1px dashed var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.card.moving .id::before { content: "⇅ "; color: var(--amber); }
.card .id { color: var(--dim); }
.card .t { margin: 2px 18px 6px 0; overflow-wrap: anywhere; }
.card .desc { color: var(--dim); font-size: 12px; margin: -4px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; font-size: 12px; }
.card .tags { margin-top: 6px; font-size: 12px; }
.card .x { position: absolute; top: 4px; right: 6px; color: var(--dim); padding: 0 4px; opacity: .4; }
.card:hover .x, .card .x:focus { opacity: 1; }
.card .x:hover { color: var(--bg); background: var(--red); }
.col.done .t { color: var(--dim); text-decoration: line-through; }

/* calendar */
.calhead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.legend { margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.grid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 92px; padding: 4px 6px; min-width: 0; }
.grid .dow { min-height: 0; color: var(--dim); text-align: center; }
.grid .out { background: color-mix(in srgb, var(--bg) 45%, transparent); }
.grid .out .n { opacity: .5; }
.grid .today { outline: 1px solid var(--accent); outline-offset: -1px; }
.grid .over { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.grid .n { color: var(--dim); font-size: 11px; }
.chip { display: block; width: 100%; text-align: left; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; margin-top: 2px; border-left: 2px solid; }
.chip:hover { background: var(--line); }
.chip.todo { border-color: var(--amber); }
.chip.doing { border-color: var(--blue); }
.chip.done { border-color: var(--dim); color: var(--dim); text-decoration: line-through; }
.chip.late { color: var(--red); }

/* stats */
[data-range] { color: var(--accent); }
[data-range].on { color: var(--bg); background: var(--accent); padding: 0 4px; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { border: 1px solid var(--line); padding: 8px 10px; min-width: 0; }
.tile .k { color: var(--dim); font-size: 12px; }
.tile .v { font-size: 22px; color: var(--accent); }
.tile .d { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pane { border: 1px solid var(--line); padding: 8px 10px; min-width: 0; }
.pane.wide { grid-column: 1 / -1; }
.pane h4 { margin: 0 0 6px; font-weight: normal; color: var(--dim); font-size: 12px; }
.pane pre { margin: 0; font: inherit; font-size: 12px; overflow-x: auto; }

/* form */
.form { max-width: 620px; }
.form label { display: block; margin-top: 12px; color: var(--dim); }
.form input, .form select, .form textarea {
  width: 100%; background: transparent; color: var(--fg); border: 0; border-bottom: 1px solid var(--line);
  font: inherit; padding: 4px 0; outline: none; border-radius: 0;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); }
.form select option { background: var(--panel); }
.form .meta { padding: 4px 0; font-size: 12px; white-space: pre-line; }
.form .actions { margin-top: 18px; display: flex; gap: 18px; }
.form .actions button:hover { text-decoration: underline; }

/* confirm modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.overlay.on { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--red); max-width: 420px; width: 100%; }
.modal .mh { padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--red); }
.modal .mb { padding: 12px 10px; overflow-wrap: anywhere; }
.modal .mf { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: flex-end; }
.modal .del { color: var(--red); border: 1px solid var(--red); padding: 2px 10px; }
.modal .del:hover, .modal .del:focus { background: var(--red); color: var(--bg); outline: none; }

/* command line */
.out { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); font: inherit; font-size: 12px; white-space: pre-wrap; }
.cmd { border-top: 1px solid var(--line); padding: 8px 12px; display: flex; gap: 8px; }
.cmd input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--fg); font: inherit; outline: none; }

@media (max-width: 760px) {
  .win { margin: 0; height: 100dvh; border: 0; }
  main { padding: 12px; }
  .col h3 { top: -12px; }
  .cols { grid-template-columns: 1fr; }
  .col { min-height: 0; }
  .grid > div { min-height: 60px; padding: 2px 3px; }
  .chip { font-size: 10px; }
  .legend, #prompt { display: none; }
  .nav .scope { margin-left: 0; width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panes { grid-template-columns: 1fr; }
  .logo { font-size: 9px; }
  .miss { font-size: 16px; }
}
.head { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.head .keys { margin-left: auto; font-size: 12px; }
@media (max-width: 760px) { .head .keys { display: none; } }
