:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --line: #e3e6eb; --text: #1b1f24; --muted: #6b7280;
  --accent: #3b5bdb; --accent-soft: #e8edff; --danger: #d6336c; --warn: #e8590c; --ok: #2f9e44; --wait: #b08800;
  --radius: 10px; --shadow: 0 8px 30px rgba(15, 23, 42, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1a1d23; --surface-2: #22262e; --line: #2c313a; --text: #e8eaed; --muted: #9aa1ab;
    --accent: #748ffc; --accent-soft: #232a45; --danger: #f06595; --warn: #ff922b; --ok: #51cf66; --wait: #fcc419;
    --shadow: 0 8px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mac { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.mac.online { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
#search { flex: 1; max-width: 420px; margin-left: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }

.views { display: flex; gap: 6px; padding: 10px 20px; overflow-x: auto; }
.views button { border: 1px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: 99px; white-space: nowrap; }
.views button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 0 20px 40px; max-width: 1200px; }
.projects { position: sticky; top: 70px; align-self: start; padding-top: 6px; }
.projects button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: none;
  padding: 6px 10px; border-radius: 8px; }
.projects button:hover { background: var(--surface-2); }
.projects button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.projects .count { color: var(--muted); font-size: 13px; }
.projects h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 10px; }

.quick input { width: 100%; padding: 11px 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.quick input:focus { outline: none; border-style: solid; border-color: var(--accent); }

.group { margin-top: 18px; }
.group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px 4px; }
.group h2.overdue { color: var(--danger); }
.task { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; }
.task:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.task .check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: none; padding: 0; }
.task .check:hover { border-color: var(--ok); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.chip { padding: 0 8px; border-radius: 99px; background: var(--surface-2); }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.pill.doing { background: var(--accent-soft); color: var(--accent); }
.pill.review { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.waiting { background: color-mix(in srgb, var(--wait) 18%, transparent); color: var(--wait); }
.task .run { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; }
.task .run:hover { border-color: var(--accent); color: var(--accent); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.panel { position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; width: min(560px, 100%); overflow-y: auto; background: var(--surface);
  box-shadow: var(--shadow); border-left: 1px solid var(--line); padding: 18px 22px 40px; }
.panel .bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--muted); }
.panel .close { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); }
.panel .ttl { width: 100%; font-size: 20px; font-weight: 700; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; background: none; }
.panel .ttl:hover, .panel .ttl:focus { border-color: var(--line); outline: none; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 14px 0; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fields input, .fields select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.panel textarea { width: 100%; min-height: 140px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); resize: vertical; }
.panel h4 { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ok { color: var(--ok); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.runcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.runcard .head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.runcard .result { margin-top: 8px; overflow-wrap: anywhere; }
.runcard .result p { margin: 6px 0; }
.runcard pre, .runcard code { background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.runcard pre { padding: 8px; overflow-x: auto; }
.runcard code { padding: 0 4px; }
.runcard .approve { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--wait) 14%, transparent); }
.follow { display: flex; gap: 8px; margin-top: 8px; }
.follow input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.events { list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); }
.events li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.source { white-space: pre-wrap; font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 10px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); }

.login main { max-width: 420px; margin: 18vh auto; padding: 0 20px; text-align: center; }

@media (max-width: 760px) {
  .top { padding: 10px 14px; }
  .views { padding: 8px 14px; }
  .layout { grid-template-columns: 1fr; padding: 0 14px 40px; }
  .projects { position: static; display: flex; gap: 6px; overflow-x: auto; padding: 0; }
  .projects h3 { display: none; }
  .projects button { width: auto; white-space: nowrap; gap: 6px; border: 1px solid var(--line); }
  .fields { grid-template-columns: 1fr; }
  .panel { padding: 14px 16px 40px; }
}
