/* Cedar Tasks — Hollow Cedar palette, dark by default with a light variant. */
:root {
  --bg: #090E16;
  --bg2: #0E1622;
  --panel: #131D2B;
  --panel2: #18232F;
  --line: #223044;
  --line2: #2E4059;
  --text: #EDE7DA;
  --text2: #C8C4BA;
  --dim: #8B98A9;
  --accent: #D8A245;
  --accent-hover: #A8761D;
  --accent-ink: #090E16;
  --cedar: #5C7A63;
  --alarm: #C9705A;
  --radius: 8px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F6F3EC;
    --bg2: #EFEAE0;
    --panel: #FFFFFF;
    --panel2: #F3EFE6;
    --line: #DDD6C8;
    --line2: #C9C0AE;
    --text: #1A2230;
    --text2: #3A4556;
    --dim: #6A7585;
    --accent: #A8761D;
    --accent-hover: #8A5F14;
    --accent-ink: #FFFFFF;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; line-height: 1.3; }
h2 { font-size: 1rem; margin: 0 0 .75rem; color: var(--text2); }
.muted, .meta, .count { color: var(--dim); }
.meta { margin: 0 0 1rem; font-size: .9rem; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 16px; background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { color: var(--text); font-weight: 700; letter-spacing: .02em; }
.brand::before { content: ""; display: inline-block; width: .6rem; height: .6rem; margin-right: .5rem; border-radius: 2px; background: var(--cedar); }
.top nav { display: flex; align-items: center; gap: 1rem; }
.top nav form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 1rem 16px 3rem; }

.flash {
  background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent);
  padding: .6rem .8rem; border-radius: var(--radius); margin-bottom: 1rem;
}

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius);
  padding: .5rem .6rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
button {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius);
  padding: .5rem 1rem; font-weight: 600; cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
button.link:hover { text-decoration: underline; background: none; }
button.danger { background: none; color: var(--alarm); border: 1px solid var(--alarm); }
button.danger:hover { background: var(--alarm); color: var(--bg); }

.quickadd, .filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.quickadd input[name=title] { flex: 1 1 260px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters .clear { align-self: center; }
.count { margin: .25rem 0 .5rem; font-size: .85rem; }

table.tasks { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tasks th, .tasks td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tasks th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); background: var(--panel2); }
.tasks tbody tr:hover { background: var(--panel2); }
.tasks td.id { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tasks td.id a { color: var(--dim); }
.tasks td.title a { color: var(--text); font-weight: 500; }
.tasks tr.st-closed td.title a { color: var(--dim); text-decoration: line-through; }
.tasks td.date { white-space: nowrap; color: var(--dim); font-size: .9rem; }
.tasks .empty { text-align: center; color: var(--dim); padding: 2rem; }

.chip {
  display: inline-block; font-size: .78rem; padding: .05rem .45rem; margin: 0 .25rem .2rem 0;
  border: 1px solid var(--line2); border-radius: 999px; color: var(--text2); white-space: nowrap;
}
.status { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.status.open { background: color-mix(in srgb, var(--cedar) 30%, transparent); color: var(--text); }
.status.on_hold { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); }
.status.closed { background: var(--panel2); color: var(--dim); }

.crumbs { margin: 0 0 .75rem; }
.code { color: var(--dim); font-weight: 400; margin-right: .35rem; }
.edit { display: grid; gap: .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.edit label { display: grid; gap: .3rem; font-size: .85rem; color: var(--dim); }
.edit label input, .edit label select { color: var(--text); font-size: 1rem; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
fieldset.labels { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .75rem .75rem; margin: 0; }
fieldset.labels legend { font-size: .85rem; color: var(--dim); padding: 0 .3rem; }
.edit label.chk { display: inline-flex; align-items: center; gap: .35rem; margin: .25rem 1rem .25rem 0; color: var(--text); font-size: .95rem; }
.edit .actions { display: flex; justify-content: flex-end; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.note { border-left: 3px solid var(--cedar); padding: .1rem 0 .1rem .8rem; margin-bottom: 1rem; }
.note time { font-size: .8rem; color: var(--dim); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md pre, .md code { background: var(--panel2); border-radius: 4px; font-size: .88rem; }
.md code { padding: .05rem .3rem; }
.md pre { padding: .6rem .8rem; overflow-x: auto; }
.md pre code { padding: 0; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--line); padding: .3rem .5rem; }
form.delete { margin-top: 2rem; }

.manage { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.manage .panel { margin: 0; }
.item { display: flex; gap: .4rem; margin-bottom: .4rem; }
.item input[name=name] { flex: 1; }
.item input.num { width: 5rem; }
.item input.pre { width: 4.5rem; text-transform: uppercase; }
.project-head { margin: 1.75rem 0 .75rem; font-size: 1.1rem; color: var(--text); }
.manage + .project-head { margin-top: 2rem; }
.item button { padding: .4rem .7rem; }
.item.add { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }

.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { margin-bottom: 1rem; }
.login form { display: grid; gap: .75rem; }
.login label { display: grid; gap: .3rem; color: var(--dim); font-size: .85rem; }

@media (max-width: 760px) {
  .row4 { grid-template-columns: 1fr 1fr; }
  .filters select, .quickadd select { flex: 1 1 45%; }
  table.tasks, .tasks tbody, .tasks tr, .tasks td { display: block; width: 100%; }
  .tasks thead { display: none; }
  table.tasks { background: none; border: 0; }
  .tasks tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: .6rem .75rem; margin-bottom: .6rem;
    display: grid; grid-template-columns: auto 1fr; column-gap: .5rem;
  }
  .tasks td { border: 0; padding: .1rem 0; }
  .tasks td.id { grid-column: 1; }
  .tasks td.title { grid-column: 2; }
  .tasks td[data-k] { grid-column: 1 / -1; font-size: .88rem; }
  .tasks td[data-k]::before { content: attr(data-k) ": "; color: var(--dim); }
  .tasks td.blank { display: none; }
  .tasks .empty { grid-column: 1 / -1; }
}
