/* Tasks demo — follows the real tool: navy brand, blue accent, sidebar with a topic tree, list/board,
   detail panel sliding in from the right. rem only. */
:root {
  --accent: #2563eb; --accent-soft: #eaf1fe;
  --navy: #14181f; --amber: #f59e0b; --coral: #f43f5e; --green: #10b981;
  --bg: #f7f8fa; --surface-2: #f5f6f8; --line: #e5e7ec; --faint: #8b929e;
  --side-w: 16.5rem;
}
:root[data-theme="dark"] {
  --accent: #3b82f6; --accent-soft: rgb(59 130 246 / 20%); --accent-text: #fff;
  --navy: #eef1f6; --amber: #fbbf24; --coral: #fb7185; --green: #34d399;
  --bg: #0d1015; --surface: #15181e; --surface-2: #1b1f26; --line: rgb(255 255 255 / 9%); --line-strong: rgb(255 255 255 / 16%); --faint: #6b7484;
}
html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; }

/* ── top bar ── */
.topbar { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 1rem; background: var(--surface); border-bottom: 0.0625rem solid var(--line); flex: none; min-height: 3.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 800; color: var(--navy); font-size: 1rem; white-space: nowrap; }
.brand .ms { color: var(--accent); }
.spacer { flex: 1; }
.topbar .k-toolbar { margin-left: 0; }
.ws { min-width: 9.5rem; max-width: 13rem; }
.ws .k-select-btn { height: 2.125rem; font-weight: 600; }
.viewtabs { display: inline-flex; border: 0.0625rem solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.viewtabs button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-weight: 600; font-size: 0.8125rem; padding: 0.375rem 0.75rem; background: var(--surface); }
.viewtabs button + button { border-left: 0.0625rem solid var(--line-strong); }
.viewtabs button.active { background: var(--accent); color: #fff; }
.viewtabs .ms { font-size: 1.0625rem; }
#btnSide { display: none; }

/* ── shell ── */
.shell { flex: 1; display: flex; min-height: 0; }
.sidebar { width: var(--side-w); flex: none; background: var(--surface); border-right: 0.0625rem solid var(--line); display: flex; flex-direction: column; overflow-y: auto; padding: 0.75rem 0.625rem 1rem; }
.backdrop { display: none; }
.nav-item { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.4375rem 0.625rem; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); font-size: 0.875rem; font-weight: 600; }
.nav-item .ms { font-size: 1.125rem; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active .ms { color: var(--accent); }
.nav-item .cnt { margin-left: auto; font-size: 0.75rem; font-weight: 700; color: var(--faint); }
.tree-head { display: flex; align-items: center; justify-content: space-between; margin: 1.125rem 0.375rem 0.375rem; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.tree-head button { all: unset; cursor: pointer; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 0.375rem; color: var(--muted); }
.tree-head button:hover { background: var(--surface-2); color: var(--accent); }
.tree-head .ms { font-size: 1.125rem; }
.t-item { display: flex; align-items: center; gap: 0.25rem; padding: 0.3125rem 0.375rem 0.3125rem 0.25rem; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); font-size: 0.875rem; position: relative; }
.t-item:hover { background: var(--surface-2); }
.t-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.t-item.drop { box-shadow: inset 0 0 0 0.125rem var(--accent); }
.t-arrow { width: 1.125rem; flex: none; display: grid; place-items: center; color: var(--faint); cursor: pointer; transition: transform .12s; }
.t-arrow .ms { font-size: 1rem; }
.t-item.closed .t-arrow { transform: rotate(-90deg); }
.t-arrow.leaf { visibility: hidden; }
.t-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-name input { width: 100%; height: 1.75rem; padding: 0 0.375rem; font: inherit; font-size: 0.8125rem; border: 0.0625rem solid var(--accent); border-radius: 0.375rem; outline: none; background: var(--surface); color: var(--text); }
.t-cnt { font-size: 0.75rem; font-weight: 700; color: var(--faint); }
.t-act { display: none; gap: 0.125rem; }
.t-item:hover .t-act, .t-item:focus-within .t-act { display: inline-flex; }
.t-item:hover .t-cnt { display: none; }
.t-act button { all: unset; cursor: pointer; display: grid; place-items: center; width: 1.375rem; height: 1.375rem; color: var(--muted); border-radius: 0.3rem; }
.t-act button:hover { background: var(--line); color: var(--accent); }
.t-act .ms { font-size: 1rem; }
.t-kids { margin-left: 0.875rem; border-left: 0.0625rem solid var(--line); padding-left: 0.25rem; }
.t-menu { position: absolute; right: 0.25rem; top: 100%; z-index: 40; background: var(--surface); border: 0.0625rem solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 11rem; padding: 0.25rem; animation: k-pop .14s ease-out; }
.t-menu button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--text); padding: 0.4375rem 0.625rem; border-radius: 0.375rem; cursor: pointer; font-weight: 500; }
.t-menu button:hover { background: var(--surface-2); }
.t-menu .ms { font-size: 1rem; color: var(--muted); }
.t-menu button.danger, .t-menu button.danger .ms { color: var(--coral); }
.tree-empty { margin: 0.5rem; font-size: 0.8125rem; color: var(--faint); line-height: 1.5; }
.tree-empty .ms { font-size: 1rem; vertical-align: -0.2rem; }
.side-foot { margin-top: auto; padding-top: 1rem; }

/* ── main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.mainhead { padding: 1rem 1.375rem 0; flex: none; }
.crumb { display: flex; align-items: baseline; gap: 0.625rem; flex-wrap: wrap; }
.crumb h1 { font-size: 1.25rem; color: var(--navy); }
.crumb .path { color: var(--faint); font-size: 0.8125rem; font-weight: 600; }
.crumb .n { color: var(--faint); font-size: 0.8125rem; }
.toolrow { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
.toolrow .k-search { width: 14rem; max-width: 100%; }
.toolrow .k-input { height: 2rem; }
.chips { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 0.25rem; border: 0.0625rem solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 0.8125rem; font-weight: 600; padding: 0.25rem 0.6875rem; border-radius: 2rem; }
.chip .ms { font-size: 0.9375rem; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--navy); border-color: var(--navy); color: var(--bg); }
.sort { min-width: 10rem; width: 11rem; }
.sort .k-select-btn { height: 2rem; font-size: 0.8125rem; }
.quickadd { position: relative; margin: 0.125rem 0 0.875rem; }
.quickadd > .ms { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--accent); pointer-events: none; }
.quickadd .k-input { height: 2.75rem; padding-left: 2.5rem; font-size: 0.9375rem; border-style: dashed; }
.quickadd .k-input:focus { border-style: solid; }
.content { flex: 1; overflow-y: auto; padding: 0 1.375rem 5.5rem; }

/* list */
.task-row { display: flex; align-items: center; gap: 0.625rem; padding: 0.5625rem 0.75rem; border: 0.0625rem solid var(--line); background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 0.375rem; cursor: pointer; box-shadow: 0 0.0625rem 0.125rem rgb(16 24 40 / 4%); animation: k-pop .2s ease-out both; }
.task-row:hover { border-color: var(--accent); }
.task-row.done .tt { text-decoration: line-through; color: var(--faint); }
.task-row.fresh { border-color: var(--accent); box-shadow: 0 0 0 0.1875rem var(--accent-soft); }
.task-row.leaving { opacity: 0; transform: translateX(1rem); transition: opacity .25s, transform .25s; }
.cb { all: unset; width: 1.125rem; height: 1.125rem; flex: none; border: 0.125rem solid var(--faint); border-radius: 50%; display: inline-grid; place-items: center; color: transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.cb .ms { font-size: 0.8125rem; font-weight: 700; }
.cb:hover { border-color: var(--green); color: var(--green); }
.cb.on { background: var(--green); border-color: var(--green); color: #fff; }
.pdot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.375rem; padding: 0 0.5rem; border-radius: 1rem; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; flex: none; border: 0.0625rem solid var(--line); }
.badge .ms { font-size: 0.875rem; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.who { padding-left: 0.125rem; }
.badge.who .k-avatar { width: 1.125rem; height: 1.125rem; font-size: 0.5rem; }
.tcrumb { flex: none; font-size: 0.75rem; color: var(--faint); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--faint); padding: 3.75rem 1.25rem; font-size: 0.9375rem; line-height: 1.7; display: grid; justify-items: center; gap: 0.25rem; }
.empty .ms { font-size: 2.25rem; color: var(--line-strong); }
.sk-row { height: 2.625rem; margin-bottom: 0.375rem; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.1s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(13rem, 1fr)); gap: 0.75rem; align-items: start; }
.col { background: var(--surface-2); border: 0.0625rem solid var(--line); border-radius: var(--radius); padding: 0.625rem; min-height: 11rem; transition: border-color .12s, background .12s; }
.col.drag { border-color: var(--accent); background: var(--accent-soft); border-style: dashed; }
.col h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0.125rem 0.25rem 0.625rem; display: flex; align-items: center; gap: 0.375rem; }
.col h3 .cnt { color: var(--faint); font-weight: 700; }
.col h3 .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.kcard { background: var(--surface); border: 0.0625rem solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 0.0625rem 0.125rem rgb(16 24 40 / 5%); padding: 0.625rem 0.75rem; margin-bottom: 0.5rem; cursor: grab; user-select: none; display: flex; flex-direction: column; gap: 0.375rem; }
.kcard:hover { border-color: var(--accent); }
.kcard .kt { font-size: 0.875rem; display: flex; gap: 0.25rem; align-items: flex-start; }
.kcard .kt span:first-child { flex: 1; }
.kcard.done .kt span:first-child { text-decoration: line-through; color: var(--faint); }
.kcard.dragging { opacity: .35; }
.kcard.fresh { border-color: var(--accent); box-shadow: 0 0 0 0.1875rem var(--accent-soft); }
.handle { color: var(--faint); touch-action: none; cursor: grab; opacity: .6; }
.handle .ms { font-size: 1.0625rem; }
.kmeta { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.kmeta .tcrumb { max-width: 100%; }
.col-note { font-size: 0.75rem; color: var(--faint); text-align: center; padding: 0.375rem; }
.ghost { position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; box-shadow: var(--shadow-lg); opacity: .96; margin: 0; }
body.dragging-active, body.dragging-active * { cursor: grabbing !important; }

/* detail panel */
.detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(27.5rem, 100vw); z-index: 60; background: var(--surface); border-left: 0.0625rem solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .18s ease; display: flex; flex-direction: column; }
.detail.open { transform: none; }
.d-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem 0.625rem 1rem; border-bottom: 0.0625rem solid var(--line); }
.d-head strong { flex: 1; }
.saved { color: var(--muted); font-size: 0.75rem; display: inline-flex; align-items: center; gap: 0.25rem; }
.saved .ms { font-size: 0.9375rem; }
.d-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.875rem; }
.d-title { width: 100%; font: inherit; font-size: 1.0625rem; font-weight: 700; color: var(--text); background: var(--surface); border: 0.0625rem solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; outline: none; }
.d-title:focus, .d-body textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 0.1875rem var(--accent-soft); }
.d-body textarea { min-height: 8rem; line-height: 1.5; }
.seg { display: flex; border: 0.0625rem solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { all: unset; cursor: pointer; flex: 1; text-align: center; background: var(--surface); color: var(--muted); font-size: 0.8125rem; font-weight: 600; padding: 0.4375rem 0.25rem; }
.seg button + button { border-left: 0.0625rem solid var(--line-strong); }
.seg button.active { background: var(--accent); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid2 .k-select { min-width: 0; }
.d-meta { font-size: 0.75rem; color: var(--faint); line-height: 1.7; }
.d-foot { padding: 0.75rem 1rem; border-top: 0.0625rem solid var(--line); display: flex; justify-content: space-between; gap: 0.5rem; }

/* team dialog */
dialog.k-dialog.team { width: min(32rem, 94vw); }
.lid, .teamrij { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0; border-bottom: 0.0625rem solid var(--line); }
.lid .nm, .teamrij .nm { flex: 1; min-width: 0; font-weight: 600; }
.lid .nm small { display: block; color: var(--faint); font-size: 0.75rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.inviterij { display: flex; gap: 0.5rem; }
.inviterij .k-input { flex: 1; }
.dlg-msg { font-size: 0.8125rem; color: var(--muted); }
.dlg-msg.err { color: var(--bad); }
.dlg-msg.ok { color: var(--ok); }

/* undo toast */
.u-toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.u-toasts .k-toast button { all: unset; cursor: pointer; font-weight: 800; text-decoration: underline; margin-left: 0.5rem; }

.foot-badge { display: none; justify-content: center; padding-top: 1rem; }

/* ── mobile ── */
@media (max-width: 47.5rem) {
  .foot-badge { display: flex; }
  #btnSide { display: inline-grid; }
  .brand-txt, .vt-txt, .team-btn { display: none; }
  .topbar { padding: 0.5rem 5vw 0.5rem 0.5rem; gap: 0.375rem; }
  .ws { min-width: 7.5rem; max-width: 9.5rem; }
  .viewtabs button { padding: 0.375rem 0.5rem; }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(18.75rem, 86vw); transform: translateX(-105%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; z-index: 65; background: rgb(10 18 32 / 45%); }
  .mainhead { padding: 0.75rem 5vw 0; }
  .content { padding: 0 5vw 5.5rem; }
  .board { grid-template-columns: 1fr; }
  .tcrumb { display: none; }
  .toolrow .k-search { width: 100%; }
  .task-row .badge.opt { display: none; }
}
