:root {
  --sb-bg: #141829;
  --sb-bg-2: #1A1F35;
  --sb-hover: #222844;
  --sb-active: #2B3256;
  --sb-text: #C8CEE3;
  --sb-muted: #7D86A6;
  --sb-line: #252B47;

  --accent: #0E9F6E;
  --accent-hover: #0B8A5F;
  --accent-soft: #E6F6EF;
  --primary: #3D63F5;
  --primary-soft: #ECF0FF;

  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E3E6EC;
  --border-soft: #EEF0F4;
  --text: #1B2233;
  --text-2: #475266;
  --muted: #8891A5;
  --hover: #F5F7FA;
  --selected: #EEF3FF;

  --s-todo: #7C879C;   --s-todo-bg: #EFF1F5;
  --s-prog: #3D63F5;   --s-prog-bg: #EBEFFF;
  --s-review: #C2720A; --s-review-bg: #FEF2DF;
  --s-block: #DC3E43;  --s-block-bg: #FDECEC;
  --s-done: #0E9F6E;   --s-done-bg: #E4F5EE;

  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.xs { width: 12px; height: 12px; }
::selection { background: #CFDCFF; }

.boot { height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); animation: pulse 1.2s infinite; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; overflow: hidden; }
#drawer-root { display: contents; }
.sidebar { background: var(--sb-bg); color: var(--sb-text); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #0E1120; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.content { flex: 1; overflow: auto; min-height: 0; }

/* ---------- sidebar ---------- */
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #12B981, #0B8A5F); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(14,159,110,.4); }
.logo svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; fill: none; }
.ws-name { font-weight: 600; color: #fff; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 11px; color: var(--sb-muted); }
.sb-new { margin: 4px 12px 12px; display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; }
.sb-new:hover { background: var(--accent-hover); }
.sb-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.sb-scroll::-webkit-scrollbar { width: 8px; } .sb-scroll::-webkit-scrollbar-thumb { background: #2A3050; border-radius: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--sb-text); cursor: pointer; user-select: none; white-space: nowrap; }
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item.active { background: var(--sb-active); color: #fff; }
.nav-item .i { opacity: .85; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: #F59E0B; color: #1B1300; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-count { font-size: 11px; color: var(--sb-muted); }
.sb-section { display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sb-muted); }
.sb-section button { background: none; border: 0; color: var(--sb-muted); padding: 2px; border-radius: 4px; display: grid; }
.sb-section button:hover { color: #fff; background: var(--sb-hover); }
.space-row .chev { transition: transform .15s; opacity: .6; }
.space-row.collapsed .chev { transform: rotate(-90deg); }
.space-dot { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.proj-item { padding-left: 34px; height: 30px; }
.proj-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.sb-foot { border-top: 1px solid var(--sb-line); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.sb-foot .who { flex: 1; min-width: 0; }
.sb-foot .who b { display: block; color: #fff; font-weight: 600; font-size: 12.5px; }
.sb-foot .who span { font-size: 11px; color: var(--sb-muted); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #8FE3C3; }
.live-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 3px rgba(52,211,153,.18); }
.live-pill.off { color: var(--sb-muted); } .live-pill.off::before { background: #6B7280; box-shadow: none; }

/* ---------- topbar ---------- */
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; white-space: nowrap; }
.crumbs b { color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.search { position: relative; width: 280px; }
.search input { width: 100%; height: 34px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 0 12px 0 32px; outline: none; transition: .15s; }
.search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search > .i { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search kbd { position: absolute; right: 8px; top: 8px; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: #fff; }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 420px; overflow: auto; }
.sr-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; cursor: pointer; }
.sr-item:hover, .sr-item.hl { background: var(--hover); }
.sr-item small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.presence { display: flex; align-items: center; }
.presence .av { margin-left: -6px; box-shadow: 0 0 0 2px #fff; cursor: pointer; transition: transform .15s; }
.presence .av:first-child { margin-left: 0; }
.presence .av:hover { transform: translateY(-2px); z-index: 2; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--hover); border-color: #D3D8E1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.blue { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--s-block); }
.btn.danger:hover { background: var(--s-block-bg); border-color: #F5C2C3; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 26px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.input, .select, .textarea { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 7px; padding: 0 10px; background: #fff; outline: none; transition: .12s; }
.textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- avatars ---------- */
.av { --s: 24px; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: calc(var(--s) * .42); font-weight: 600; flex: none; position: relative; letter-spacing: -.02em; user-select: none; }
.av.bot, .av.executor { border-radius: 28%; }
.av.lg { --s: 40px; } .av.xl { --s: 52px; } .av.sm { --s: 20px; } .av.xs { --s: 18px; }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; background: #A0A8B8; }
.av.lg .dot, .av.xl .dot { width: 12px; height: 12px; }
.av .dot.idle { background: #34D399; }
.av .dot.working { background: #3D63F5; }
.av .dot.waiting { background: #F59E0B; }
.av.is-working::after { content: ''; position: absolute; inset: -3px; border-radius: inherit; border: 2px solid #3D63F5; opacity: .6; animation: ring 1.6s ease-out infinite; }
.av.av-none { background: transparent !important; border: 1.5px dashed #C3C9D5; color: var(--muted); }
@keyframes ring { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes pulse { 50% { opacity: .5; } }
.who-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.who-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 4px; border-radius: 4px; background: #EEF0F6; color: #6A7389; text-transform: uppercase; }
.bot-tag.ex { background: #FBEDE6; color: #B2532E; }

/* ---------- pills ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 0; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-todo { color: var(--s-todo); background: var(--s-todo-bg); }
.st-in_progress { color: var(--s-prog); background: var(--s-prog-bg); }
.st-review { color: var(--s-review); background: var(--s-review-bg); }
.st-blocked { color: var(--s-block); background: var(--s-block-bg); }
.st-done { color: var(--s-done); background: var(--s-done-bg); }
select.status { appearance: none; cursor: pointer; padding-right: 9px; outline: none; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.prio.urgent { color: #DC3E43; font-weight: 600; } .prio.high { color: #D97706; font-weight: 500; } .prio.low { color: #A3ABBC; }
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 5px; background: #F0F2F6; color: #5A6478; font-size: 11px; font-weight: 500; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--border); background: #fff; font-size: 12px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: #C9CFDA; }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.lock { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px; background: #FFF4DB; color: #A35D00; font-size: 11px; font-weight: 600; white-space: nowrap; }
.due { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.due.overdue { color: var(--s-block); font-weight: 600; }
.due.soon { color: #C2720A; font-weight: 500; }
.bar { height: 4px; border-radius: 2px; background: #EDF0F4; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.bar.blue > i { background: var(--primary); }

/* ---------- page ---------- */
.page { padding: 24px 28px 48px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 14px 16px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 28px; margin-bottom: 6px; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .k-label { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.warn .k-val { color: #C2720A; } .kpi.bad .k-val { color: var(--s-block); } .kpi.good .k-val { color: var(--accent); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.bots-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px 16px; }
.bot-live { border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: .15s; background: var(--surface-2); }
.bot-live:hover { border-color: var(--border); background: #fff; box-shadow: var(--shadow-sm); }
.bot-live .top { display: flex; align-items: center; gap: 10px; }
.bot-live .nm { font-weight: 600; } .bot-live .rl { font-size: 11.5px; color: var(--muted); }
.bot-live .act { font-size: 12px; color: var(--text-2); min-height: 34px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bot-live .meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.state-label { font-size: 11px; font-weight: 600; }
.state-label.working { color: var(--primary); } .state-label.waiting { color: #C2720A; } .state-label.idle { color: var(--accent); } .state-label.offline { color: var(--muted); }
.typing { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed li { display: flex; gap: 10px; padding: 8px 16px; align-items: flex-start; }
.feed li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #FFF8E1; } to { background: transparent; } }
.feed .txt { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.feed .txt b { color: var(--text); font-weight: 600; }
.feed .txt a { color: var(--text); font-weight: 500; }
.feed time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mini-list .mi { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--border-soft); cursor: pointer; }
.mini-list .mi:first-child { border-top: 0; }
.mini-list .mi:hover { background: var(--hover); }
.mini-list .mi .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- project header & views ---------- */
.proj-head { padding: 18px 24px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.proj-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.proj-title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.proj-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.proj-meta { display: flex; align-items: center; gap: 18px; margin: 10px 0 0; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.proj-meta .m { display: flex; align-items: center; gap: 6px; }
.proj-meta .bar { width: 120px; }
.tabs { display: flex; gap: 2px; margin-top: 12px; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; cursor: pointer; user-select: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 24px; flex-wrap: wrap; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.av-filter { display: flex; gap: 4px; }
.av-filter .av { cursor: pointer; opacity: .4; transition: .15s; }
.av-filter .av.on { opacity: 1; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }
.av-filter.none-on .av { opacity: 1; }

/* table */
.grid-wrap { padding: 0 24px 40px; }
.tgrid { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tg-row { display: grid; grid-template-columns: minmax(280px, 1fr) 160px 132px 96px 100px 100px 110px; align-items: center; min-height: 40px; border-top: 1px solid var(--border-soft); }
.tgrid.with-project .tg-row { grid-template-columns: minmax(260px, 1fr) 170px 160px 132px 96px 100px 110px; }
.tg-row > div { padding: 0 12px; min-width: 0; }
.tg-head { min-height: 34px; background: var(--surface-2); border-top: 0; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; z-index: 2; }
.tg-group { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 38px; background: #fff; border-top: 1px solid var(--border); cursor: pointer; user-select: none; font-weight: 600; }
.tg-group:first-of-type { border-top: 0; }
.tg-group .chev { transition: transform .15s; color: var(--muted); }
.tg-group.collapsed .chev { transform: rotate(-90deg); }
.tg-group .cnt { color: var(--muted); font-weight: 500; font-size: 12px; }
.tg-task { cursor: pointer; transition: background .1s; }
.tg-task:hover { background: var(--hover); }
.tg-task.sel { background: var(--selected); }
.tg-task.live { background: linear-gradient(90deg, rgba(61,99,245,.07), transparent 60%); }
.tg-title { display: flex; align-items: center; gap: 8px; }
.tg-title .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tg-task.done .ttl { color: var(--muted); text-decoration: line-through; text-decoration-color: #C3C9D5; }
.check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #C3C9D5; display: grid; place-items: center; flex: none; background: #fff; transition: .12s; }
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { stroke: #fff; }
.check svg { width: 10px; height: 10px; stroke: transparent; stroke-width: 3.5; fill: none; }
.tg-title .meta { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11.5px; flex: none; }
.tg-title .meta span { display: inline-flex; align-items: center; gap: 3px; }
.tg-add { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 36px; height: 36px; border-top: 1px solid var(--border-soft); color: var(--muted); }
.tg-add input { border: 0; outline: none; flex: 1; height: 100%; background: transparent; }
.tg-add:focus-within { background: var(--surface-2); }
.live-label { font-size: 11px; color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; white-space: nowrap; }

/* board */
.board { display: flex; gap: 14px; padding: 0 24px 32px; align-items: flex-start; overflow-x: auto; min-height: calc(100% - 60px); }
.col { flex: 1 0 220px; max-width: 320px; background: #EDEFF3; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 600; }
.col-head .cnt { color: var(--muted); font-weight: 500; }
.col-body { padding: 4px 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 10px; transition: background .15s; }
.col-body.drop { background: #DCE4FB; }
.kcard { background: #fff; border-radius: 9px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px rgba(16,24,40,.04); cursor: grab; transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: var(--shadow); }
.kcard.dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard.live { box-shadow: 0 0 0 1.5px rgba(61,99,245,.5), var(--shadow); }
.kcard .kt { font-weight: 500; margin-bottom: 8px; line-height: 1.4; }
.kcard .kp { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.kcard .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.kcard .kf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kcard .bar { margin-top: 8px; }
.col-add { margin: 0 8px 8px; padding: 8px; border-radius: 8px; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.col-add:hover { background: #E2E5EB; color: var(--text); }

/* timeline */
.tl { margin: 0 24px 32px; background: #fff; border: 1px solid var(--border); border-radius: 10px; display: grid; grid-template-columns: 300px 1fr; overflow: hidden; }
.tl-left { border-right: 1px solid var(--border); }
.tl-right { overflow-x: auto; position: relative; }
.tl-hrow { height: 52px; border-bottom: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tl-row { height: 38px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; }
.tl-row:hover { background: var(--hover); }
.tl-row .ttl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-head { height: 52px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
.tl-months { display: flex; height: 26px; }
.tl-months div { border-left: 1px solid var(--border); padding: 6px 8px; font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.tl-days { display: flex; height: 26px; }
.tl-days div { flex: none; text-align: center; font-size: 10.5px; color: var(--muted); padding-top: 5px; border-left: 1px solid transparent; }
.tl-days div.we { background: #F1F3F6; }
.tl-days div.today { color: #fff; background: var(--primary); border-radius: 4px; font-weight: 700; }
.tl-body { position: relative; }
.tl-gridrow { height: 38px; border-bottom: 1px solid var(--border-soft); position: relative; }
.tl-bg { position: absolute; inset: 0; display: flex; pointer-events: none; }
.tl-bg div { flex: none; height: 100%; }
.tl-bg div.we { background: rgba(241,243,246,.7); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--primary); opacity: .7; z-index: 1; pointer-events: none; }
.tl-bar { position: absolute; top: 8px; height: 22px; border-radius: 6px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.12); z-index: 2; }
.tl-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.22); }
.tl-bar span { position: relative; overflow: hidden; text-overflow: ellipsis; }
.tl-bar.milestone { width: 14px !important; height: 14px; top: 12px; transform: rotate(45deg); border-radius: 3px; padding: 0; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,20,35,.18); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: #fff; z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dr-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); color: var(--muted); font-size: 12px; }
.dr-top .crumb { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.dr-scroll { flex: 1; overflow-y: auto; }
.dr-main { padding: 18px 24px 8px; }
.dr-title { width: 100%; border: 0; outline: none; font-size: 21px; font-weight: 700; letter-spacing: -.02em; padding: 4px 6px; margin-left: -6px; border-radius: 6px; resize: none; overflow: hidden; line-height: 1.3; }
.dr-title:hover { background: var(--hover); } .dr-title:focus { background: #fff; box-shadow: 0 0 0 2px var(--primary-soft); }
.props { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; margin: 14px 0 6px; align-items: center; }
.props > label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; height: 32px; }
.props .pv { display: flex; align-items: center; gap: 8px; min-height: 32px; flex-wrap: wrap; }
.pv select, .pv input[type=date], .pv input.plain { height: 30px; border: 1px solid transparent; border-radius: 6px; padding: 0 8px; background: transparent; outline: none; cursor: pointer; }
.pv select:hover, .pv input[type=date]:hover, .pv input.plain:hover { background: var(--hover); border-color: var(--border); }
.pv select:focus, .pv input:focus { border-color: var(--primary); background: #fff; }
.pv select.status { height: 24px; padding: 0 10px; border: 0; border-radius: 12px; }
.pv select.status.st-todo { background: var(--s-todo-bg); } .pv select.status.st-in_progress { background: var(--s-prog-bg); } .pv select.status.st-review { background: var(--s-review-bg); } .pv select.status.st-blocked { background: var(--s-block-bg); } .pv select.status.st-done { background: var(--s-done-bg); }
.pv input[type=range] { width: 160px; accent-color: var(--accent); }
.desc { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; min-height: 90px; outline: none; resize: vertical; line-height: 1.55; background: var(--surface-2); }
.desc:hover { border-color: var(--border); } .desc:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dr-section { margin: 20px 0 0; }
.dr-section h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; margin: 12px 0 4px; }
.banner.amber { background: #FFF7E6; border: 1px solid #FBE0A8; }
.banner .bt { flex: 1; min-width: 0; }
.banner .bt b { display: block; }
.banner .bt span { color: var(--text-2); font-size: 12px; }
.subtasks .st { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.subtasks .st:hover { background: var(--hover); }
.subtasks .st .ttl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtasks .add { display: flex; gap: 8px; align-items: center; padding: 4px 8px; color: var(--muted); }
.subtasks .add input { border: 0; outline: none; flex: 1; height: 30px; background: transparent; }
.delegate { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dg-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; transition: .15s; background: #fff; text-align: left; }
.dg-card:hover { border-color: #C9CFDA; box-shadow: var(--shadow-sm); }
.dg-card b { display: block; } .dg-card small { color: var(--muted); }
.job { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.job-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); font-size: 12px; }
.job-head .grow { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-log { margin: 0; background: #0F1322; color: #C9D1E6; font: 11.5px/1.6 var(--mono); padding: 12px 14px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.jstat { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.jstat.running { background: var(--s-prog-bg); color: var(--s-prog); } .jstat.queued, .jstat.awaiting_approval { background: #FFF4DB; color: #A35D00; }
.jstat.done { background: var(--s-done-bg); color: var(--s-done); } .jstat.failed, .jstat.rejected, .jstat.cancelled { background: var(--s-block-bg); color: var(--s-block); }
.stream { padding: 4px 0 12px; }
.ev { display: flex; gap: 10px; padding: 8px 0; }
.ev .body { flex: 1; min-width: 0; }
.ev .head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ev .head b { color: var(--text); font-weight: 600; font-size: 12.5px; }
.ev .bubble { margin-top: 4px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 0 10px 10px 10px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.ev.system .bubble { background: #FFFBF0; border-color: #F7E5BC; }
.ev.executor .bubble { background: #0F1322; border-color: #0F1322; color: #D3DAEC; font: 12px/1.6 var(--mono); }
.ev.mini { padding: 3px 0 3px 34px; font-size: 12px; color: var(--muted); align-items: center; }
.ev.mini b { color: var(--text-2); font-weight: 600; }
.mention { color: var(--primary); font-weight: 600; }
.composer { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 10px; align-items: flex-end; background: #fff; }
.composer textarea { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-height: 40px; max-height: 160px; resize: none; outline: none; line-height: 1.45; }
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- approvals ---------- */
.ap-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.bulkbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--text); color: #fff; border-radius: 10px; margin-bottom: 12px; box-shadow: var(--shadow); animation: fade .15s; }
.bulkbar .grow { flex: 1; }
.bulkbar .btn { height: 30px; }
.bulkbar .btn.ghost { color: #fff; } .bulkbar .btn.ghost:hover { background: rgba(255,255,255,.1); }
.ap-list { display: flex; flex-direction: column; }
.ap { display: grid; grid-template-columns: 28px 40px 1fr auto; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border-soft); align-items: start; transition: background .12s; }
.ap:first-child { border-top: 0; }
.ap:hover { background: var(--surface-2); }
.ap.sel { background: var(--selected); }
.ap .cb { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #C3C9D5; display: grid; place-items: center; margin-top: 10px; cursor: pointer; background: #fff; }
.ap .cb.on { background: var(--primary); border-color: var(--primary); }
.ap .cb svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3.5; fill: none; }
.ap-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-sum { color: var(--text-2); margin-top: 3px; }
.ap-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.ap-actions { display: flex; gap: 6px; align-items: center; }
.ap-details { margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; font: 11.5px/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; max-height: 200px; overflow: auto; }
.act-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #F0F2F6; color: #5A6478; }
.act-badge.task-complete { background: var(--s-done-bg); color: var(--s-done); }
.act-badge.executor-run { background: #FBEDE6; color: #B2532E; }
.act-badge.external-action { background: #F3EAFE; color: #7C3AED; }
.act-badge.project-create, .act-badge.task-create { background: var(--s-prog-bg); color: var(--s-prog); }
.decided { font-size: 12px; font-weight: 600; }
.decided.approved { color: var(--s-done); } .decided.rejected, .decided.failed { color: var(--s-block); }

/* ---------- bots ---------- */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 28px; }
.bot-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bot-card .hd { display: flex; gap: 12px; align-items: center; }
.bot-card .hd .nm { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.bot-card .hd .hn { color: var(--muted); font-size: 12px; }
.bot-card .desc-t { color: var(--text-2); font-size: 12.5px; }
.bot-card .now { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-2); display: flex; gap: 8px; align-items: center; min-height: 36px; }
.bot-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bot-card .stat { text-align: center; padding: 6px; border-radius: 8px; background: var(--surface-2); }
.bot-card .stat b { display: block; font-size: 17px; letter-spacing: -.02em; }
.bot-card .stat span { font-size: 11px; color: var(--muted); }
.bot-card .skills { display: flex; gap: 4px; flex-wrap: wrap; }
.bot-card .ft { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.bot-card .ft .del { margin-left: auto; }
.org-badge { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: #EEEAFE; color: #5B4BDB; text-transform: uppercase; letter-spacing: .03em; }
.policy-wrap { overflow-x: auto; }
table.policy { width: 100%; border-collapse: collapse; min-width: 720px; }
table.policy th, table.policy td { padding: 10px 12px; border-top: 1px solid var(--border-soft); text-align: left; }
table.policy th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); border-top: 0; white-space: nowrap; }
table.policy td:first-child { font-weight: 500; }
.seg { display: inline-flex; background: #F0F2F6; border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 24px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on.auto { background: #fff; color: var(--s-done); box-shadow: var(--shadow-sm); }
.seg button.on.approval { background: #fff; color: #B26200; box-shadow: var(--shadow-sm); }
.seg button.on.deny { background: #fff; color: var(--s-block); box-shadow: var(--shadow-sm); }
.seg button.on.inherit { background: #fff; color: var(--muted); box-shadow: var(--shadow-sm); }
.pol-select { height: 28px; border-radius: 6px; border: 1px solid var(--border); padding: 0 6px; font-size: 12px; background: #fff; }
.pol-select.auto { color: var(--s-done); } .pol-select.approval { color: #B26200; } .pol-select.deny { color: var(--s-block); } .pol-select.inherit { color: var(--muted); }

.code { background: #0F1322; color: #D3DAEC; font: 12px/1.6 var(--mono); padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; position: relative; }
.code .copy { position: absolute; top: 8px; right: 8px; }
.keybox { display: flex; gap: 8px; align-items: center; background: #F5F7FA; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: 12px var(--mono); word-break: break-all; }
.keybox span { flex: 1; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--border-soft); }
.set-row:first-child { border-top: 0; }
.set-row .l b { display: block; } .set-row .l span { color: var(--muted); font-size: 12px; }
.switch { width: 38px; height: 22px; border-radius: 11px; background: #CBD1DC; position: relative; border: 0; transition: .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--accent); } .switch.on::after { left: 19px; }

/* ---------- modal / menus / toasts ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,20,35,.42); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2,.8,.2,1); }
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.modal-body { padding: 12px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.menu { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; animation: pop .12s; }
.menu .mi { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu .mi:hover { background: var(--hover); }
.menu .mi small { display: block; color: var(--muted); font-size: 11.5px; }
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: #1B2233; color: #fff; border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; max-width: 420px; animation: pop .18s; font-size: 12.5px; }
.toast.err { background: #B42318; }
.toast .btn { height: 26px; font-size: 12px; background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.toast .btn:hover { background: rgba(255,255,255,.2); }

/* login */
.login { height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, #1F2A55 0%, var(--sb-bg) 60%); grid-column: 1 / -1; }
.login .card { width: 360px; padding: 28px; }
.login h1 { font-size: 20px; margin: 14px 0 4px; }
.login p { color: var(--muted); margin: 0 0 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .search { width: 200px; }
  .tg-row, .tgrid.with-project .tg-row { grid-template-columns: minmax(220px, 1fr) 140px 128px 90px 96px; }
  .tg-row > .c-start, .tg-row > .c-prog, .tg-row > .c-proj { display: none; }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 55; transform: translateX(-100%); transition: transform .2s; }
  body.sb-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .search, .presence { display: none; }
  .topbar { padding: 0 12px; }
  .page { padding: 18px 16px 40px; }
  .proj-head, .toolbar { padding-left: 16px; padding-right: 16px; }
  .grid-wrap, .board { padding-left: 16px; padding-right: 16px; }
  .tl { margin: 0 16px 24px; grid-template-columns: 160px 1fr; }
  .tg-row, .tgrid.with-project .tg-row { grid-template-columns: minmax(0, 1fr) 110px 40px; }
  .tg-row > .c-prio, .tg-row > .c-due, .tg-row > .c-start, .tg-row > .c-prog, .tg-row > .c-proj { display: none; }
  .tg-row > .c-who .who-chip span { display: none; }
  .kpis { gap: 10px; }
  .row2 { grid-template-columns: 1fr; }
  .props { grid-template-columns: 96px 1fr; }
  .ap { grid-template-columns: 24px 32px 1fr; }
  .ap-actions { grid-column: 3; }
  .delegate { grid-template-columns: 1fr; }
}
