:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --column: #eef0f4;
  --border: #e3e6ec;
  --border-strong: #cdd2db;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8590a2;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .22);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 236px;
  --topbar: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b24;
  --surface-2: #1b212c;
  --column: #121821;
  --border: #262e3b;
  --border-strong: #364152;
  --text: #e6e9ef;
  --text-2: #a9b2c1;
  --muted: #727d8f;
  --primary: #7c74ff;
  --primary-hover: #918bff;
  --primary-soft: #23214a;
  --danger: #f05252;
  --danger-soft: #2c1517;
  --warning: #f2a33a;
  --warning-soft: #2a2012;
  --success: #34c46a;
  --success-soft: #11261a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }

/* ---------- Boot / spinner ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.btn:focus-visible, .input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--column); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn:disabled { opacity: .55; cursor: default; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
.select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238590a2' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.textarea { height: auto; min-height: 90px; padding: 9px 10px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.error-text { color: var(--danger); font-size: 13px; }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 30px 28px; box-shadow: var(--shadow); }
.auth-card .logo { margin-bottom: 22px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p { margin: 0 0 20px; color: var(--text-2); }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.logo img { width: 30px; height: 30px; }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .02em; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; z-index: 30;
}
.sidebar .logo { padding: 2px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--column); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a .badge { margin-left: auto; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.sidebar-footer .who { flex: 1; min-width: 0; cursor: pointer; border-radius: var(--radius-sm); padding: 4px; display: flex; align-items: center; gap: 8px; }
.sidebar-footer .who:hover { background: var(--column); }
.sidebar-footer .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who small { display: block; font-size: 11px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn { display: none; }
.search { position: relative; width: 260px; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search .input { padding-left: 34px; background: var(--surface); }
.content { padding: 18px 22px 40px; min-width: 0; }

.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--column); color: var(--text-2);
}
.badge.red { background: var(--danger); color: #fff; }
.badge.amber { background: var(--warning); color: #fff; }
.bell { position: relative; }
.bell .badge { position: absolute; top: -3px; right: -4px; height: 17px; min-width: 17px; font-size: 10px; padding: 0 4px; border: 2px solid var(--bg); }

/* ---------- Avatars & chips ---------- */
.avatar {
  --c: var(--primary);
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--c); letter-spacing: .02em; user-select: none;
}
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.none { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--muted); }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar-btn { margin-left: -6px; border-radius: 50%; border: 2px solid var(--bg); padding: 0; background: none; cursor: pointer; transition: transform .12s; }
.avatar-stack .avatar-btn:first-child { margin-left: 0; }
.avatar-stack .avatar-btn:hover { transform: translateY(-2px); z-index: 1; }
.avatar-stack .avatar-btn.on { box-shadow: 0 0 0 2px var(--primary); z-index: 2; }
.avatar-stack .avatar-btn .avatar { width: 32px; height: 32px; font-size: 12px; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--column); color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.amber { background: var(--warning-soft); color: var(--warning); }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.blue { background: var(--primary-soft); color: var(--primary); }

.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-Backlog { background: var(--column); color: var(--muted); }
.st-Todo { background: #e8eefc; color: #3b5bdb; }
.st-InProgress { background: #fff4e0; color: #c26a00; }
.st-Review { background: #f1e9ff; color: #7c3aed; }
.st-Done { background: var(--success-soft); color: var(--success); }
:root[data-theme="dark"] .st-Todo { background: #1b2545; color: #8ea8ff; }
:root[data-theme="dark"] .st-InProgress { background: #2e2310; color: #f2a33a; }
:root[data-theme="dark"] .st-Review { background: #271c42; color: #b79bff; }

.prio { display: inline-flex; align-items: center; }
.prio svg { width: 16px; height: 16px; }
.prio-Low { color: #64748b; }
.prio-Medium { color: #3b82f6; }
.prio-High { color: #f97316; }
.prio-Critical { color: var(--danger); }

.type-ico { width: 18px; height: 18px; border-radius: 4px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.type-ico svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 2.6; }
.ty-Task { background: #3b82f6; }
.ty-Bug { background: #ef4444; }
.ty-Request { background: #8b5cf6; }
.ty-Support { background: #f59e0b; }
.ty-Improvement { background: #10b981; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--column); padding: 3px; border-radius: 9px; }
.seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Kanban ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px;
  overflow-x: auto; padding-bottom: 8px; align-items: start;
  min-height: calc(100vh - var(--topbar) - 110px);
}
.column { background: var(--column); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar) - 110px); min-height: 200px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.column-head .badge { background: var(--surface); }
.column-head .btn { margin-left: auto; }
.column-body { flex: 1; overflow-y: auto; padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column.drop-target { box-shadow: inset 0 0 0 2px var(--primary); }
.column-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 8px; border: 1.5px dashed var(--border-strong); border-radius: 9px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 11px;
  box-shadow: var(--shadow-sm); cursor: pointer; user-select: none; touch-action: manipulation;
  transition: box-shadow .12s, border-color .12s, transform .12s; position: relative;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card.blocked { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.card.blocked::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--danger); }
.card-title { font-weight: 500; margin: 6px 0 8px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-top, .card-foot { display: flex; align-items: center; gap: 6px; }
.card-key { font-size: 12px; font-weight: 600; color: var(--muted); }
.card-key.done { text-decoration: line-through; }
.card-foot { justify-content: space-between; }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; min-width: 0; flex-wrap: wrap; }
.card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.card-block { font-size: 12px; color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 5px 7px; margin-bottom: 8px; display: flex; gap: 5px; align-items: flex-start; }
.card-block .icon { margin-top: 1px; }
.card.ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(2.5deg); box-shadow: var(--shadow-lg); opacity: .95; }
.card.placeholder-src { opacity: .35; }
.drop-placeholder { border: 2px dashed var(--primary); border-radius: var(--radius); background: var(--primary-soft); flex: none; }
.dragging, .dragging * { cursor: grabbing !important; }

/* ---------- Tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 15px; }
.panel-body { padding: 14px 16px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .title-cell { min-width: 240px; font-weight: 500; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; margin-bottom: 6px; opacity: .6; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-sm); cursor: default; }
.kpi[data-go] { cursor: pointer; }
.kpi[data-go]:hover { border-color: var(--border-strong); }
.kpi small { display: block; font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi b { display: block; font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi.red b { color: var(--danger); }
.kpi.amber b { color: var(--warning); }
.kpi.green b { color: var(--success); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid > .stack { gap: 16px; }
.person { display: flex; align-items: center; gap: 10px; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--muted); font-size: 12px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.mini-bars i { width: 8px; border-radius: 2px 2px 0 0; background: var(--primary); opacity: .85; min-height: 2px; }
.mini-bars i.zero { background: var(--border-strong); opacity: 1; }
.chart { width: 100%; height: 180px; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.num-pill { display: inline-block; min-width: 24px; text-align: center; padding: 2px 6px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.num-pill.zero { color: var(--muted); font-weight: 400; }
.num-pill.red { background: var(--danger-soft); color: var(--danger); }
.num-pill.amber { background: var(--warning-soft); color: var(--warning); }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .txt { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); word-break: break-word; }
.feed .txt b { color: var(--text); font-weight: 600; }
.feed .txt .task-link { font-weight: 500; }
.feed .txt q { display: block; margin-top: 4px; padding: 6px 9px; background: var(--surface-2); border-radius: 6px; color: var(--text-2); font-size: 12.5px; quotes: none; white-space: pre-wrap; max-height: 80px; overflow: hidden; }
.feed time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.day-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 14px 0 4px; }

/* ---------- Modal / Drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: rise .18s; border: 1px solid var(--border); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }

.overlay.drawer { justify-content: flex-end; padding: 0; align-items: stretch; }
.detail { width: min(980px, 100%); height: 100vh; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s; }
.detail-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.detail-head .crumb { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.detail-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.detail-main { padding: 18px 22px 30px; min-width: 0; }
.detail-side { padding: 18px; border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.title-edit { width: 100%; font-size: 21px; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; margin: 0 -8px 8px; background: transparent; resize: none; overflow: hidden; line-height: 1.3; letter-spacing: -.01em; }
.title-edit:hover { background: var(--surface-2); }
.title-edit:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.desc-view { white-space: pre-wrap; word-break: break-word; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; cursor: text; min-height: 40px; color: var(--text); }
.desc-view:hover { background: var(--surface-2); }
.desc-view.empty-desc { color: var(--muted); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.block-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; }
.block-banner .grow { color: var(--text); white-space: pre-wrap; }
.block-banner b { color: var(--danger); display: block; margin-bottom: 2px; }
.block-banner.pending { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); align-items: center; flex-wrap: wrap; }
.block-banner.pending b { color: var(--warning); }
.block-banner.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.block-banner.ok b { color: var(--success); }
.pref-grid { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.pref-grid .check { font-size: 13px; }
.pref-grid label:has(input:disabled) { opacity: .55; cursor: default; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
pre.code { margin: 0; padding: 10px 12px; overflow-x: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 22px 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .badge { margin-left: 4px; height: 18px; min-width: 18px; font-size: 10px; }
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment-meta b { color: var(--text); font-size: 13px; margin-right: 6px; }
.comment-text { background: var(--surface-2); border: 1px solid var(--border); border-radius: 0 10px 10px 10px; padding: 8px 11px; white-space: pre-wrap; word-break: break-word; }
.mention { color: var(--primary); font-weight: 600; }
.composer { display: flex; gap: 10px; margin-bottom: 18px; }
.composer .textarea { min-height: 64px; }
.composer.drop .textarea { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.composer-foot { margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 32px; padding: 4px 8px 4px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 12.5px;
}
a.file-chip:hover { border-color: var(--primary); color: var(--primary); }
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.file-chip small { color: var(--muted); white-space: nowrap; }
.file-chip button { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.file-chip button:hover { background: var(--danger-soft); color: var(--danger); }
.att-img { display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.att-img img { display: block; max-width: min(280px, 100%); max-height: 200px; object-fit: contain; }
.att-img:hover { border-color: var(--primary); }
.side-field { display: flex; flex-direction: column; gap: 5px; }
.side-field > span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.side-meta { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.side-meta div { display: flex; justify-content: space-between; gap: 8px; }
.side-meta b { color: var(--text-2); font-weight: 500; text-align: right; }
.progress { height: 6px; border-radius: 3px; background: var(--column); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.progress.over i { background: var(--danger); }

/* ---------- Dropdown / notifications ---------- */
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; animation: rise .14s; overflow: hidden; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.dropdown-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }
.notif.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.notif time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13px; animation: rise .18s; max-width: 380px; cursor: pointer; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-body { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 900px) {
  :root { --topbar: 56px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 25; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar h1 { font-size: 16px; }
  .search { width: auto; flex: 1; max-width: 220px; }
  .content { padding: 14px 12px 90px; }
  .board { grid-auto-columns: 84vw; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 8px; scroll-padding: 0 12px; }
  .column { scroll-snap-align: start; max-height: calc(100vh - var(--topbar) - 140px); }
  .detail-body { grid-template-columns: 1fr; }
  .detail-side { border-left: 0; border-top: 1px solid var(--border); order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .detail-side .side-meta, .detail-side .side-actions { grid-column: 1 / -1; }
  .detail-main { padding: 16px; }
  .toolbar .select { min-width: 0; flex: 1 1 140px; }
  .hide-mobile { display: none !important; }
  .fab { display: inline-flex !important; }
}

@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .overlay { padding: 0; align-items: stretch; }
  .modal, .modal.wide { max-width: none; border-radius: 0; min-height: 100%; display: flex; flex-direction: column; border: 0; }
  .modal-body { flex: 1; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .search { display: none; }
  .search.open { display: block; position: absolute; left: 8px; right: 8px; top: 8px; max-width: none; z-index: 5; }
  .kpi b { font-size: 22px; }
  .topbar .new-btn span { display: none; }
  .topbar .new-btn { width: 36px; padding: 0; }
}

.fab { display: none; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; background: var(--primary); color: #fff; border: 0; box-shadow: var(--shadow-lg); align-items: center; justify-content: center; z-index: 40; cursor: pointer; }
.fab .icon { width: 24px; height: 24px; }
.search-toggle { display: none; }
@media (max-width: 560px) { .search-toggle { display: inline-flex; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
