:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f9fafb; --line: #e6e8ec; --line-2: #eef0f3;
  --text: #1e1f21; --muted: #6d6e6f; --faint: #9ca0a6;
  --side: #1e1f21; --side-2: #2a2b2d; --side-text: #e8e8e9; --side-muted: #a2a0a2;
  --accent: #6d5efc; --accent-soft: #eeecff; --ok: #1f9d6b; --ok-soft: #e3f6ee; --warn: #c98a00; --warn-soft: #fff4d6;
  --bad: #d64545; --bad-soft: #fde8e8; --info: #2d7fd3; --info-soft: #e5f0fc; --claude: #c2672f; --claude-soft: #fbeee5;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.18);
  --r: 10px; --font: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #161718; --panel: #1f2022; --panel-2: #242527; --line: #313236; --line-2: #2a2b2e;
  --text: #ececed; --muted: #a3a4a7; --faint: #75777b; --side: #111213; --side-2: #1c1d1f;
  --accent-soft: #2b2752; --ok-soft: #12342a; --warn-soft: #3a2f10; --bad-soft: #3d1c1c; --info-soft: #162c44; --claude-soft: #3a2518;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5); color-scheme: dark;
}}
:root[data-theme="dark"] {
  --bg: #161718; --panel: #1f2022; --panel-2: #242527; --line: #313236; --line-2: #2a2b2e;
  --text: #ececed; --muted: #a3a4a7; --faint: #75777b; --side: #111213; --side-2: #1c1d1f;
  --accent-soft: #2b2752; --ok-soft: #12342a; --warn-soft: #3a2f10; --bad-soft: #3d1c1c; --info-soft: #162c44; --claude-soft: #3a2518;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; overflow-y: auto; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand small { display: block; font-weight: 500; color: var(--side-muted); font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-2); }
.nav a.on { background: #3a3b3e; }
.nav svg { width: 17px; height: 17px; opacity: .85; flex: none; }
.side h4 { margin: 18px 10px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.side h4 button { background: none; border: 0; color: var(--side-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.side h4 button:hover { color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.nav .pct { margin-left: auto; font-size: 11px; color: var(--side-muted); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 12px 10px 4px; font-size: 12px; color: var(--side-muted); display: flex; align-items: center; gap: 8px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: #3ccf8e; box-shadow: 0 0 0 3px rgba(60,207,142,.2); }
.live.off { background: #888; box-shadow: none; }
.main { overflow-y: auto; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 28px 0; }
.topbar .row { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.topbar h1 { font-size: 20px; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; flex: none; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
.tabs a { padding: 8px 10px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-color: var(--text); }
.topbar.plain { padding-bottom: 12px; }
.content { padding: 24px 28px 60px; max-width: 1400px; }
.btn.menu-btn { display: none; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 10px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 70px; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; gap: 8px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-b { padding: 0 16px 16px; }
.hello { margin: 4px 0 20px; }
.hello .date { color: var(--muted); font-weight: 500; }
.hello h2 { margin: 2px 0 0; font-size: 26px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard { padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s; display: block; }
.pcard:hover { border-color: var(--faint); }
.pcard .top { display: flex; align-items: center; gap: 10px; }
.pcard .ic { width: 34px; height: 34px; border-radius: 9px; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.pcard .nm { font-weight: 600; }
.pcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pcard .last { font-size: 12px; color: var(--muted); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.prog .bar { flex: 1; }
.prog b { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.on_track, .pill.done, .pill.p-low { background: var(--ok-soft); color: var(--ok); }
.pill.at_risk, .pill.review, .pill.p-high { background: var(--warn-soft); color: var(--warn); }
.pill.off_track, .pill.p-urgent { background: var(--bad-soft); color: var(--bad); }
.pill.in_progress, .pill.p-medium { background: var(--info-soft); color: var(--info); }
.pill.stage { background: var(--accent-soft); color: var(--accent); }
.pill.claude { background: var(--claude-soft); color: var(--claude); }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.feed li:first-child { border-top: 0; }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; background: var(--accent-soft); color: var(--accent); }
.av.claude { background: var(--claude-soft); color: var(--claude); }
.feed .t { flex: 1; min-width: 0; }
.feed .t b { font-weight: 600; }
.feed .when { color: var(--faint); font-size: 12px; }
.empty { color: var(--muted); padding: 22px; text-align: center; font-size: 13px; }

/* today schedule */
.slot { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; border-left: 3px solid; background: var(--panel-2); margin-bottom: 6px; font-size: 13px; }
.slot .tm { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; }
.slot.now { background: var(--accent-soft); }
.slot.now .tm { color: var(--accent); font-weight: 600; }

/* task list */
.tl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tl-head, .trow { display: grid; grid-template-columns: 34px minmax(200px, 1fr) 120px 96px 110px 110px; align-items: center; }
.tl-head { font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.tl-head > div, .trow > div { padding: 7px 8px; min-width: 0; }
.sec-h { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; font-weight: 600; font-size: 14px; border-top: 1px solid var(--line); cursor: pointer; user-select: none; }
.sec-h:first-of-type { border-top: 0; }
.sec-h .cnt { color: var(--faint); font-weight: 500; font-size: 12px; }
.sec-h .chev { transition: transform .15s; color: var(--muted); }
.sec-h.closed .chev { transform: rotate(-90deg); }
.trow { border-top: 1px solid var(--line-2); cursor: pointer; font-size: 13px; }
.trow:hover { background: var(--panel-2); }
.trow.open { background: var(--accent-soft); }
.trow .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow.is-done .tt { color: var(--faint); text-decoration: line-through; }
.trow .muted, .muted { color: var(--muted); }
.trow .late { color: var(--bad); font-weight: 500; }
.chk { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--faint); background: none; cursor: pointer; display: grid; place-items: center; padding: 0; margin-left: 6px; color: transparent; }
.chk:hover { border-color: var(--ok); color: var(--ok); }
.chk.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.chk svg { width: 11px; height: 11px; }
.addrow { padding: 6px 12px 10px 46px; }
.addrow input { border: 0; background: transparent; outline: none; width: 100%; padding: 4px 0; color: var(--text); }
.addrow input::placeholder { color: var(--faint); }
.by-claude { font-size: 10px; color: var(--claude); font-weight: 700; margin-left: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--line-2); border-radius: var(--r); padding: 10px; min-height: 200px; }
.col.drag { outline: 2px dashed var(--accent); }
.col h5 { margin: 2px 4px 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.col h5 span { color: var(--muted); font-weight: 500; }
.bcard { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); font-size: 13px; }
.bcard .bt { font-weight: 500; margin-bottom: 8px; }
.bcard .bm { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }

/* timeline */
.gantt { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.g-inner { position: relative; min-width: 100%; }
.g-head { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-2); }
.g-day { flex: none; text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0; border-left: 1px solid var(--line-2); }
.g-day.we { background: rgba(127,127,127,.05); }
.g-day.td { color: var(--accent); font-weight: 700; }
.g-row { position: relative; height: 38px; border-bottom: 1px solid var(--line-2); }
.g-label { position: sticky; left: 0; z-index: 2; width: 220px; height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--panel); border-right: 1px solid var(--line); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.g-bar { position: absolute; top: 8px; height: 22px; border-radius: 6px; color: #fff; font-size: 11.5px; font-weight: 600; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.g-bar .fill { position: absolute; inset: 0; background: rgba(0,0,0,.18); border-radius: 6px; }
.g-bar span { position: relative; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 1; opacity: .7; }

/* schedule week */
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.wk-h { position: sticky; top: 0; z-index: 2; background: var(--panel-2); border-bottom: 1px solid var(--line); padding: 8px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; }
.wk-h b { display: block; font-size: 18px; color: var(--text); font-weight: 600; }
.wk-h.td b { color: #fff; background: var(--accent); border-radius: 50%; width: 32px; height: 32px; line-height: 32px; margin: 2px auto 0; }
.wk-times { position: relative; }
.wk-times div { position: absolute; right: 6px; font-size: 11px; color: var(--faint); transform: translateY(-7px); }
.wk-col { position: relative; border-left: 1px solid var(--line-2); cursor: copy; }
.wk-col .hl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); pointer-events: none; }
.blk { position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 5px 7px; font-size: 12px; color: #fff; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); border-left: 3px solid rgba(0,0,0,.25); }
.blk b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk small { opacity: .9; }
.blk.once { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 6px, transparent 6px 12px); }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 1; pointer-events: none; }
.nowline::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.plan { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
.plan td { padding: 8px; border-bottom: 1px solid var(--line-2); }
.plan td.n { font-variant-numeric: tabular-nums; text-align: right; }
.plan th.n { text-align: right; }

/* overview */
.ov { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.stepper { display: flex; gap: 4px; margin: 6px 0 4px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 90px; border: 1px solid var(--line); background: var(--panel); padding: 8px 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 6px; }
.stepper button.past { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.stepper button.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 8px; }
.spark div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; position: relative; }
.spark div:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; background: var(--text); color: var(--panel); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.spark-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* logs */
.log { padding: 14px 16px; border-top: 1px solid var(--line-2); display: flex; gap: 12px; }
.log:first-child { border-top: 0; }
.log .body { flex: 1; min-width: 0; }
.log .sm { font-weight: 600; }
.log .dt { white-space: pre-wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.log .mt { font-size: 12px; color: var(--faint); margin-top: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* drawer & modal */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 30; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-b { padding: 6px 20px 30px; overflow-y: auto; flex: 1; }
.title-in { font-size: 20px; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; width: 100%; background: transparent; outline: none; margin: 10px 0 4px -8px; }
.title-in:hover { border-color: var(--line); }
.title-in:focus { border-color: var(--accent); }
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 12px 0; font-size: 13px; }
.fields > span { color: var(--muted); }
.modal-bg { position: fixed; inset: 0; background: rgba(15,16,20,.45); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(520px, 100%); box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto; }
.modal-h { padding: 16px 20px 4px; font-weight: 600; font-size: 17px; }
.modal-b { padding: 0 20px 6px; }
.modal-f { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-f .l { margin-right: auto; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
#toast div { background: var(--text); color: var(--panel); padding: 9px 16px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow-lg); animation: tin .2s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre; overflow-x: auto; }
.row { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 5px 12px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%), var(--bg); }
.auth .card { width: min(380px, 100%); padding: 28px; }
.auth h1 { margin: 14px 0 4px; font-size: 22px; }
.auth p { color: var(--muted); margin: 0 0 14px; }
.err { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* responsive */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } .home-grid, .ov { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px 0; } .topbar.plain { padding-bottom: 10px; }
  .content { padding: 16px 16px 60px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .tl-head { display: none; }
  .trow { grid-template-columns: 34px 1fr auto; }
  .trow > .c-status, .trow > .c-assignee, .trow > .c-pri { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar .hide-m { display: none; }
}
