:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --border: #e4e2da;
  --border-strong: #d0cec4;
  --text: #1d1c19;
  --text-2: #5f5d55;
  --muted: #8a887e;
  --accent: #0f6e56;
  --accent-bg: #e1f5ee;
  --red: #a32d2d; --red-bg: #fceaea;
  --amber: #854f0b; --amber-bg: #faeeda;
  --green: #0f6e56; --green-bg: #e1f5ee;
  --purple: #534ab7; --purple-bg: #eeedfe;
  --shadow: 0 1px 3px rgba(20, 20, 15, 0.06);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131311;
    --surface: #1d1d1a;
    --surface-2: #232320;
    --border: #2e2e29;
    --border-strong: #3d3d36;
    --text: #ecebe4;
    --text-2: #b4b2a7;
    --muted: #828075;
    --accent: #4ecfa5;
    --accent-bg: #10352a;
    --red: #f09595; --red-bg: #3a1717;
    --amber: #fac775; --amber-bg: #38270b;
    --green: #5dcaa5; --green-bg: #10352a;
    --purple: #afa9ec; --purple-bg: #232052;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
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", sans-serif;
}
button { font: inherit; color: inherit; }

.shell { max-width: 880px; margin: 0 auto; padding: 0 14px 90px; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin: 0 -14px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
header.top .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
@media (prefers-color-scheme: dark) { header.top .logo { color: #0d2b21; } }
header.top .titles { flex: 1; min-width: 0; }
header.top h1 { font-size: 15.5px; margin: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top select {
  font: inherit; font-size: 13px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 8px; padding: 5px 8px; max-width: 130px;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.kpi .hint { font-size: 11.5px; color: var(--muted); }
.progress { height: 6px; border-radius: 3px; background: var(--border); margin-top: 8px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }

h2.sec {
  font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 26px 0 10px;
  display: flex; align-items: center; justify-content: space-between;
}
h2.sec .count { font-weight: 500; text-transform: none; letter-spacing: 0; }

.focus {
  background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius); padding: 4px 14px;
}
.focus .frow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--accent) 15%, transparent); }
.focus .frow:last-child { border-bottom: none; }
.focus .frow .txt { flex: 1; font-size: 14px; font-weight: 550; }
.focus .frow .from { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.focus .doit {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--surface); border-radius: 8px; padding: 5px 11px; font-size: 12.5px; cursor: pointer;
  color: var(--accent); font-weight: 600; flex-shrink: 0;
}
.focus .empty { padding: 12px 0; font-size: 13.5px; color: var(--text-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.gcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; transition: border-color 0.15s;
}
.gcard:hover { border-color: var(--border-strong); }
.gcard .gname { font-weight: 650; font-size: 13.5px; }
.gcard .grole { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.gcard .next { font-size: 12.5px; color: var(--text-2); margin-top: 7px; display: flex; gap: 6px; }
.gcard .next::before { content: "→"; color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: var(--green-bg); color: var(--green); }

.tabs {
  display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; margin: 0 0 12px; box-shadow: var(--shadow);
}
.tabs button {
  flex: 1; border: none; background: transparent; padding: 7px 4px; border-radius: 7px;
  font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer;
}
.tabs button.on { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs button.on { color: #0d2b21; } }
.tabs button .n { font-size: 11px; opacity: 0.75; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item.done { opacity: 0.55; }
.item.done .title { text-decoration: line-through; }
.check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong);
  background: var(--surface); cursor: pointer; flex-shrink: 0; margin-top: 1px;
  display: grid; place-items: center; font-size: 14px; color: transparent; transition: all 0.15s;
}
.item.done .check, .check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .item.done .check, .check.on { color: #0d2b21; } }
.item .body { flex: 1; min-width: 0; cursor: pointer; }
.item .title { font-size: 14px; font-weight: 500; }
.item .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; align-items: center; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.chip.forme { background: var(--amber-bg); color: var(--amber); border-color: transparent; font-weight: 600; }
.chip.due { background: var(--purple-bg); color: var(--purple); border-color: transparent; }
.chip.status-in_progress { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip.status-blocked { background: var(--red-bg); color: var(--red); border-color: transparent; }
.note-txt { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.addbtn {
  width: 100%; margin-top: 10px; padding: 11px; border: 1.5px dashed var(--border-strong);
  background: transparent; color: var(--text-2); border-radius: var(--radius); cursor: pointer; font-size: 13.5px;
}
.addbtn:hover { border-color: var(--accent); color: var(--accent); }

.jgroup .jdate { font-size: 12px; font-weight: 650; color: var(--muted); margin: 14px 2px 6px; }
.jentry { display: flex; gap: 9px; padding: 9px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; font-size: 13.5px; }
.jentry .who { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.who.julien { background: var(--green-bg); color: var(--green); }
.who.claude { background: var(--purple-bg); color: var(--purple); }
.who.codex { background: var(--amber-bg); color: var(--amber); }
.jentry .txt { flex: 1; }

.rrow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.rrow:last-child { border-bottom: none; }
.rrow .amt { font-weight: 650; margin-left: auto; white-space: nowrap; }
.chart-wrap { padding: 14px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.empty-box { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13.5px; }

.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
@media (prefers-color-scheme: dark) { .fab { color: #0d2b21; } }

.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 15, 12, 0.45);
  display: grid; place-items: end center; padding: 0;
}
@media (min-width: 640px) { .overlay { place-items: center; } }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 18px 18px 0 0; padding: 18px 18px 26px;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 640px) { .sheet { border-radius: 18px; padding-bottom: 18px; } }
.sheet h3 { margin: 0 0 14px; font-size: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface-2); color: var(--text);
}
.field textarea { resize: vertical; min-height: 60px; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 16px; }
.btn { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 550; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; flex: 1; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0d2b21; } }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 550;
  padding: 9px 18px; border-radius: 22px; opacity: 0; pointer-events: none;
  transition: all 0.25s ease; z-index: 60; max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
#login .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center;
}
#login .logo { width: 52px; height: 52px; border-radius: 15px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 24px; margin: 0 auto 14px; }
#login h1 { font-size: 20px; margin: 0 0 4px; }
#login p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
#login input { width: 100%; font: inherit; padding: 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); color: var(--text); margin-bottom: 10px; text-align: center; }
#login .err { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
