@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0f1a;
  --bg-subtle: #131825;
  --card: #151a2a;
  --sidebar-bg: #0a0e18;
  --sidebar-bg-end: #0d1220;
  --sidebar-text: #6b7a90;
  --sidebar-hover: rgba(255,255,255,.05);
  --sidebar-active-bg: rgba(16,185,129,.1);
  --sidebar-active-text: #34d399;
  --sidebar-active-border: #10b981;
  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-light: rgba(16,185,129,.12);
  --primary-subtle: rgba(16,185,129,.06);
  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-light: rgba(239,68,68,.12);
  --success: #34d399;
  --success-light: rgba(16,185,129,.12);
  --warning: #fbbf24;
  --warning-light: rgba(251,191,35,.12);
  --hold: #a78bfa;
  --hold-light: rgba(139,92,246,.12);
  --info: #60a5fa;
  --info-light: rgba(59,130,246,.12);
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-light: #1a2234;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 2px 8px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
  --transition: .2s cubic-bezier(.4,0,.2,1);
  --transition-fast: .12s cubic-bezier(.4,0,.2,1);
  --sidebar-width: 260px;
}

html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-hover); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

::selection { background: rgba(16,185,129,.3); color: #fff; }

/* Login */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(16,185,129,.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.06) 0%, transparent 50%);
}
.login-page::before {
  content: '';
  position: fixed; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0px, rgba(255,255,255,.02) 1px, transparent 1px, transparent 80px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0px, rgba(255,255,255,.02) 1px, transparent 1px, transparent 80px);
  pointer-events: none;
}
.login-box {
  background: var(--card); border-radius: var(--radius-xl); padding: 2.8rem 2.2rem 2.4rem;
  width: 400px; max-width: 90vw;
  box-shadow: 0 25px 60px rgba(0,0,0,.5);
  border: 1px solid var(--border);
  text-align: center;
  position: relative; z-index: 1;
  animation: loginAppear .5s cubic-bezier(.16,1,.3,1);
}
@keyframes loginAppear {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-box h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .2rem; letter-spacing: -.03em; }
.login-subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: .88rem; }
.login-box .logo-icon {
  width: 52px; height: 52px; margin: 0 auto .8rem;
  background: linear-gradient(135deg, var(--primary), #059669);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(16,185,129,.3);
}

/* Fields */
.field { text-align: left; margin-bottom: 1.1rem; }
.field label {
  display: block; font-weight: 600; margin-bottom: .4rem;
  font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--card); font-family: inherit; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}

.error-msg { color: var(--danger); font-size: .82rem; margin-bottom: .5rem; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.2rem; border: none; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); font-family: inherit; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 16px rgba(16,185,129,.4);
  transform: translateY(-1px);
}

.btn.danger { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,.25); }
.btn.danger:hover:not(:disabled) { background: var(--danger-hover); transform: translateY(-1px); }

.btn.outline {
  background: var(--card); border: 1.5px solid var(--border); color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}
.btn.outline:hover:not(:disabled) { background: var(--bg-subtle); border-color: #334155; color: var(--text); }

.btn.small { padding: .35rem .7rem; font-size: .78rem; border-radius: 6px; }
.btn.full { width: 100%; }

/* Layout */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width); background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-end));
  color: var(--sidebar-text);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  border-right: 1px solid rgba(255,255,255,.05);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sidebar-header {
  padding: 1.4rem 1.3rem 1.1rem; font-size: 1.05rem; font-weight: 700; color: #fff;
  letter-spacing: -.02em; display: flex; align-items: center; gap: .65rem;
}
.sidebar-header .logo-dot {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #059669);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
  flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: .4rem .7rem; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem; color: var(--sidebar-text); font-size: .88rem; font-weight: 500;
  transition: all var(--transition); text-decoration: none !important;
  border-radius: var(--radius-sm); margin-bottom: 2px;
  position: relative;
}
.sidebar-nav a::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 0 2px 2px 0;
  background: var(--sidebar-active-border);
  transition: height var(--transition);
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #94a3b8; }
.sidebar-nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.sidebar-nav a.active::before { height: 60%; }
.sidebar-nav a .nav-icon {
  width: 20px; height: 20px; opacity: .5; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--transition);
}
.sidebar-nav a:hover .nav-icon { opacity: .8; }
.sidebar-nav a.active .nav-icon { opacity: 1; }
.sidebar-nav a .badge {
  background: var(--danger); color: #fff;
  font-size: .65rem; padding: .15rem .45rem; border-radius: 10px; font-weight: 700;
  min-width: 20px; text-align: center; line-height: 1.2;
}
.sidebar-nav a .badge:first-of-type { margin-left: auto; }
.badge-open { background: var(--danger) !important; box-shadow: 0 2px 6px rgba(239,68,68,.3); }
.badge-blocked { background: var(--warning) !important; box-shadow: 0 2px 6px rgba(251,191,35,.3); }
.badge-bugs { background: var(--danger) !important; }

.sidebar-project-filter {
  padding: .7rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-project-filter > label {
  display: block; font-size: .65rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--sidebar-text); margin-bottom: .35rem; font-weight: 600;
}
.sidebar-project-filter select {
  width: 100%; padding: .4rem .55rem; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  color: #e2e8f0; font-size: .8rem; font-family: inherit; cursor: pointer;
  outline: none; transition: all var(--transition);
}
.sidebar-project-filter select:hover { border-color: rgba(255,255,255,.2); }
.sidebar-project-filter select option {
  background: #fff; color: #1e293b;
}

.sidebar-footer {
  padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06);
  font-size: .78rem;
}
.sidebar-footer .staff-info { display: flex; align-items: center; gap: .55rem; margin-bottom: .55rem; }
.sidebar-footer .staff-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(16,185,129,.3), rgba(5,150,105,.3));
  color: #34d399;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; flex-shrink: 0;
  border: 1.5px solid rgba(52,211,153,.3);
}
.sidebar-footer .staff-name { color: #e2e8f0; font-weight: 600; font-size: .82rem; }
.sidebar-actions { display: flex; gap: .15rem; margin-left: -.35rem; }
.sidebar-actions a {
  color: var(--sidebar-text); font-size: .76rem; padding: .25rem .4rem;
  border-radius: 6px; transition: all var(--transition);
  text-decoration: none !important;
}
.sidebar-actions a:hover { color: #e2e8f0; background: var(--sidebar-hover); }

/* Mobile */
.menu-toggle {
  display: none;
  position: fixed; top: .75rem; left: .75rem; z-index: 60;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--card); border: 1.5px solid var(--border);
  box-shadow: var(--shadow); cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* Main */
.main {
  flex: 1; margin-left: var(--sidebar-width); padding: 1.8rem 2.5rem;
  min-height: 100vh;
}

.view-enter { animation: viewEnter .3s cubic-bezier(.16,1,.3,1); }
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page header */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.page-header h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.page-header .page-subtitle { flex-basis: 100%; font-size: .8rem; color: var(--text-muted); margin-top: -.4rem; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.4rem; margin-bottom: 1rem; border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: .85rem; margin-bottom: 1.8rem;
}
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.2rem 1.3rem; border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: all var(--transition);
}
.stat-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 0 2px 2px 0;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-card.open::after { background: var(--info); }
.stat-card.open .stat-value { color: var(--info); }
.stat-card.progress::after { background: var(--primary); }
.stat-card.progress .stat-value { color: var(--primary); }
.stat-card.review::after { background: var(--hold); }
.stat-card.review .stat-value { color: var(--hold); }
.stat-card.closed::after { background: var(--success); }
.stat-card.closed .stat-value { color: var(--success); }
.stat-card.rejected::after { background: var(--warning); }
.stat-card.rejected .stat-value { color: var(--warning); }
.stat-card.cancelled::after { background: var(--text-muted); }
.stat-card.cancelled .stat-value { color: var(--text-muted); }
.stat-card.bugs::after { background: var(--danger); }
.stat-card.bugs .stat-value { color: var(--danger); }
.stat-card.features::after { background: #a78bfa; }
.stat-card.features .stat-value { color: #a78bfa; }

/* Tasks toolbar */
.tasks-toolbar {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1.2rem; flex-wrap: wrap;
}
.tasks-title {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-right: auto;
}
.tasks-filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.tasks-filters select {
  padding: .4rem .7rem; border: 1.5px solid var(--border); border-radius: 20px;
  font-size: .78rem; font-weight: 500; background: var(--card); font-family: inherit;
  color: var(--text-secondary); outline: none; cursor: pointer;
  transition: all var(--transition); box-shadow: var(--shadow-xs);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  padding-right: 1.6rem;
}
.tasks-filters select:hover { border-color: #334155; background-color: var(--bg-subtle); }
.tasks-filters select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.08); }

/* Task list rows */
.task-list { display: flex; flex-direction: column; gap: 1px; }
.task-list.compact { margin: -.4rem -.6rem -.4rem -.6rem; }

.tl-row {
  display: grid;
  grid-template-columns: 60px 1fr 32px 32px auto 110px 90px 110px;
  align-items: center; gap: 0 .6rem;
  padding: .6rem 1rem; cursor: pointer;
  border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  transition: all var(--transition-fast);
  position: relative;
}
.task-list:not(.compact) .tl-row { margin-bottom: .35rem; box-shadow: var(--shadow-xs); }
.task-list.compact .tl-row { border-radius: 0; border-left: none; border-right: none; margin-bottom: -1px; }
.task-list.compact .tl-row:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.task-list.compact .tl-row:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }


.tl-row:hover { border-color: rgba(16,185,129,.35); box-shadow: var(--shadow); transform: translateY(-1px); }

.tl-key {
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tl-title {
  font-weight: 600; font-size: .88rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.01em; min-width: 0;
}
.tl-col {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-col-type, .tl-col-prio, .tl-col-spec, .tl-col-status { text-align: center; }
.tl-col-assignee {
  font-size: .78rem; color: var(--text-secondary); font-weight: 500;
}
.tl-col-time {
  font-size: .72rem; color: var(--text-muted); font-weight: 500; text-align: right;
}
.tl-empty { color: var(--text-muted); font-size: .78rem; }

/* Row status backgrounds */
.tl-st-open { background: var(--card); }
.tl-st-progress { background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.2); }
.tl-st-review { background: rgba(251,191,35,.07); border-color: rgba(251,191,35,.18); }
.tl-st-closed { background: rgba(100,116,139,.06); opacity: .65; }
.tl-st-rejected { background: rgba(100,116,139,.06); opacity: .65; }
.tl-st-closed:hover, .tl-st-rejected:hover { opacity: .85; }

/* Specialty badges */
.spec-badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .72rem; font-weight: 700; white-space: nowrap; letter-spacing: .02em;
  background: rgba(100,116,139,.15); color: var(--text-secondary);
}
.spec-support { background: rgba(251,191,35,.2); color: #fbbf24; }
.spec-backend { background: rgba(167,139,250,.2); color: #a78bfa; }
.spec-frontend { background: rgba(96,165,250,.2); color: #60a5fa; }
.spec-moderator { background: rgba(244,114,182,.2); color: #f472b6; }
.spec-devops { background: rgba(52,211,153,.2); color: #34d399; }
.spec-ar { background: rgba(239,68,68,.2); color: #ef4444; }
.spec-manager { background: rgba(234,179,8,.2); color: #eab308; }
.spec-badge-past { opacity: .45; font-size: .62rem; padding: .15rem .4rem; }
.spec-arrow { color: var(--text-secondary); opacity: .5; font-size: .7rem; margin: 0 .15rem; vertical-align: middle; }
.spec-chain { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem; }
.tl-col-spec { display: flex; align-items: center; gap: .25rem; }
.spec-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: rgba(100,116,139,.3); color: #fff;
  font-size: .6rem; font-weight: 700; line-height: 1; letter-spacing: 0;
}
.spec-dot.spec-support { background: #d97706; }
.spec-dot.spec-backend { background: #7c3aed; }
.spec-dot.spec-frontend { background: #2563eb; }
.spec-dot.spec-moderator { background: #db2777; }
.spec-dot.spec-devops { background: #059669; }
.spec-dot.spec-developer { background: #0891b2; }
.spec-dot.spec-ar { background: #dc2626; }
.spec-dot.spec-manager { background: #ca8a04; }
.spec-dot-past { opacity: .4; width: 16px; height: 16px; font-size: .5rem; }
.spec-dot-arrow { color: var(--text-muted); opacity: .4; font-size: .65rem; line-height: 1; }

/* Status badges */
.status {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-open { background: var(--info-light); color: var(--info); }
.status-open::before { background: var(--info); }
.status-progress { background: var(--primary-light); color: var(--primary); }
.status-progress::before { background: var(--primary); }
.status-review { background: var(--hold-light); color: var(--hold); }
.status-review::before { background: var(--hold); }
.status-closed { background: var(--success-light); color: var(--success); }
.status-closed::before { background: var(--success); }
.status-rejected { background: rgba(100,116,139,.12); color: var(--text-muted); }
.status-rejected::before { background: var(--text-muted); }

/* Priority badges */
.priority-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 20px;
  font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.priority-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; vertical-align: middle;
}
.priority-icon svg { display: block; }
.priority-low { color: var(--text-muted); }
.priority-medium { color: var(--info); }
.priority-high { color: var(--warning); }
.priority-critical { color: var(--danger); }

/* Type badges */
.type-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 20px;
  font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.type-task { background: var(--info-light); color: var(--info); }
.type-bug { background: var(--danger-light); color: var(--danger); }
.type-feature { background: var(--primary-light); color: var(--primary); }
.type-consultation { background: var(--hold-light); color: var(--hold); }
/* Inline-editable type select: same pill shape as .type-badge but with
   browser-native dropdown chrome so the affordance reads as "click me"
   without a separate icon. Color follows the same per-type classes. */
select.type-select {
  appearance: auto;
  border: none;
  padding: .15rem 1.25rem .15rem .5rem;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}
select.type-select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
select.type-select:disabled { opacity: 0.6; cursor: progress; }

/* Inline-edit version of .spec-badge (ЗАДАЧ-232). Same pill geometry as
   the read-only badge so it sits naturally in the .spec-chain row; the
   spec-X classes (.spec-backend, .spec-frontend, …) layered on top of
   this rule supply the per-specialty colours, exactly like type-select
   pairs with .type-X. */
select.spec-select {
  appearance: auto;
  border: none;
  padding: .15rem 1.25rem .15rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .02em;
  cursor: pointer;
  line-height: 1.3;
}
select.spec-select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
select.spec-select:disabled { opacity: 0.6; cursor: progress; }
.type-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; vertical-align: middle;
}
.type-icon svg { display: block; }

/* Task timers */
.task-timers {
  display: flex; gap: .6rem; flex-wrap: wrap;
  padding-top: .8rem; margin-top: .8rem; border-top: 1px solid var(--border-light);
}
.timer-item {
  flex: 1; min-width: 100px;
  padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-light);
  text-align: center;
}
.timer-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700; margin-bottom: .2rem;
}
.timer-value {
  font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.timer-waiting {
  background: var(--warning-light); border-color: rgba(251,191,35,.2);
}
.timer-waiting .timer-value { color: var(--warning); }
.timer-active {
  background: var(--primary-light); border-color: rgba(16,185,129,.2);
}
.timer-active .timer-value { color: var(--primary); }
.timer-summary {
  background: var(--bg-subtle, rgba(148,163,184,.12)); border-color: var(--border-light);
}
.timer-summary .timer-value { color: var(--text-muted); }

.timer { font-size: .7rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer-wait { color: #fbbf24; }
.timer-exec { color: #10b981; }
.timer-total { color: var(--text-muted); }

/* Task actions */
.task-actions-panel {
  display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  padding-top: .8rem; margin-top: .8rem; border-top: 1px solid var(--border-light);
}

/* Task detail */
.task-meta {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .7rem 1.5rem; margin-bottom: 1rem;
}
.task-meta dt {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700; margin-bottom: .15rem;
}
.task-meta dd { font-weight: 500; margin-bottom: .6rem; font-size: .9rem; }
.task-meta .meta-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--primary);
  cursor: pointer;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
  transition: color var(--transition-fast), border-bottom-style var(--transition-fast);
}
.task-meta .meta-link:hover {
  color: var(--primary-hover);
  border-bottom-style: solid;
}
.task-meta .meta-link svg { opacity: .65; }
.task-meta .meta-link:hover svg { opacity: 1; }

.task-detail {
  display: flex; flex-direction: column;
  height: calc(100vh - 3.6rem);
}
.task-detail > .page-header { flex-shrink: 0; margin-bottom: 0; }

.task-grid {
  display: grid; grid-template-columns: 3fr 2fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: .6rem; margin-top: .6rem;
  flex: 1; min-height: 0;
}
.grid-meta { grid-column: 1; grid-row: 1; align-self: start; min-height: 0; }
.grid-meta .card { margin-bottom: 0; }
.grid-desc, .grid-description {
  grid-column: 2; grid-row: 1 / span 2;
  display: flex; min-height: 0;
}
.grid-desc .sidebar-section, .grid-description > .card {
  flex: 1; margin-bottom: 0; overflow-y: auto;
}
.grid-comments {
  grid-column: 1; grid-row: 2; min-height: 0;
  display: flex; flex-direction: column;
}
.grid-comments > .card {
  flex: 1; min-height: 0; margin-bottom: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.grid-comments > .card > h3 { flex-shrink: 0; }
.grid-comments .comments-wrap {
  flex: 1; min-height: 0; overflow-y: auto;
  padding-right: .35rem;
}

/* Collapsible meta and description cards (ЗАДАЧ-131). At high browser
   zoom the meta dl alone can fill half the viewport on the stacked
   layout, leaving comments cramped. Expanded state keeps the original
   look — the chevron sits unobtrusively in the card's top-right corner
   and the meta dl / description is shown in full. Collapsed state hides
   the body, shrinks the header to one line, and replaces the title with
   a status / project / assignee summary so the user still has context
   without the panel taking up vertical space. */
.grid-meta > .card,
.grid-description > .card {
  position: relative;
}
.card-collapse-header {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .6rem; padding-right: 1.6rem; min-height: 1.4rem;
}
/* Meta panel has no heading in the expanded state, so the placeholder
   header collapses to its min-height (just enough to host the absolute
   chevron above the dl) and adds no extra gap before the metadata. */
.grid-meta:not(.is-collapsed) .card-collapse-header { margin-bottom: 0; }
.card-collapse-toggle {
  position: absolute; top: .55rem; right: .55rem;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); cursor: pointer; padding: 0;
  transition: background-color .15s, color .15s;
  z-index: 1;
}
.card-collapse-toggle:hover { background: var(--hover); color: var(--text); }
.card-collapse-chevron { transition: transform .15s; }
.is-collapsed .card-collapse-chevron { transform: rotate(-90deg); }
.card-collapse-title { margin: 0; font-size: 1rem; }
.card-collapse-summary {
  display: none; flex: 1; min-width: 0;
  font-size: .85rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  align-items: center; gap: .35rem;
}
.card-collapse-summary .meta-summary-sep { opacity: .5; margin: 0 .15rem; }
.is-collapsed .card-collapse-summary { display: flex; }
/* When meta is collapsed there is no h3 — keep a 0-height header just to
   reserve the chevron's absolute-positioning anchor. */
.grid-meta.is-collapsed .card-collapse-header { margin-bottom: 0; min-height: 1.4rem; }
.is-collapsed .card-collapse-body { display: none; }
/* When the description card is collapsed on wide layouts (≥901px), it
   only needs row 1 — collapse it to a strip and let the comments column
   flow from where the meta panel ends down through the freed row 2.
   The narrow stacked layout (@media below) reapplies the row-2 placement
   so the collapsed description doesn't sit on top of the meta panel. */
@media (min-width: 901px) {
  .grid-description.is-collapsed {
    grid-row: 1 / span 1; align-self: start;
  }
  /* When the description shrinks to a strip it stops carrying col 2 down
     into row 2, leaving an empty 2fr stripe next to the comments. Letting
     comments span both columns reclaims that space — exactly what the
     reporter wanted: more horizontal room for long comment threads. */
  .task-grid:has(.grid-description.is-collapsed) .grid-comments {
    grid-column: 1 / span 2;
  }
}
.grid-description.is-collapsed > .card { overflow: visible; }

.btn-scroll-down {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 50;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(16,185,129,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.btn-scroll-down.visible { opacity: 1; pointer-events: auto; }
.btn-scroll-down:hover { transform: translateX(-50%) scale(1.1); }

.sidebar-section {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem; overflow: hidden;
}
.sidebar-title { font-size: .85rem; font-weight: 700; margin: 0 0 .5rem; }

/* Comments */
.comments-wrap { position: relative; }
.comments {
  display: flex; flex-direction: column; gap: .7rem;
  padding: .5rem .2rem .5rem 0;
}
.comment {
  padding: .9rem 1.1rem; border-radius: var(--radius); position: relative;
  width: 100%; line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--border-light); border-bottom-left-radius: 4px;
}
.comment.self {
  background: linear-gradient(135deg, var(--primary-light), #d1fae5);
  border: 1px solid rgba(16,185,129,.12); border-bottom-right-radius: 4px;
}
.comment-header {
  display: flex; gap: .6rem; align-items: baseline; margin-bottom: .3rem; font-size: .78rem;
}
.comment-header .name { font-weight: 700; color: var(--text); }
.comment-header .time { color: var(--text-muted); font-size: .7rem; }
.comment-body { white-space: pre-wrap; word-break: break-word; font-size: .9rem; }

/* Inline image attachments. linkify() expands "[img:N]" markers to
   <a class="task-img-link"><img class="task-img"></a> in both the task
   description and any comment body, so the same rules style both places. */
.task-img-link {
  display: inline-block; margin: .35rem .35rem 0 0;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  overflow: hidden; vertical-align: top; background: var(--bg-subtle);
  max-width: 100%;
}
.task-img-link:hover { border-color: var(--primary); }
.task-img {
  display: block; max-width: 100%; max-height: 320px;
  object-fit: contain; cursor: zoom-in;
}
.task-description .task-img, .comment-body .task-img { background: #000; }
.img-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  cursor: zoom-out;
}
.img-lightbox img { max-width: 100%; max-height: 100%; box-shadow: var(--shadow-lg); }

.comment-event {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; margin: .25rem 0;
  border-left: 3px solid var(--accent);
  background: rgba(16,185,129,.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .82rem; color: var(--text-secondary);
}
.comment-event-icon { flex-shrink: 0; color: var(--accent); display: flex; }
.comment-event-text { flex: 1; }
.comment-event-text strong { color: var(--text); font-weight: 600; }
.comment .del-comment {
  position: absolute; top: .5rem; right: .5rem; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1rem; opacity: 0;
  transition: all var(--transition-fast);
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.comment:hover .del-comment { opacity: .5; }
.comment .del-comment:hover { opacity: 1; color: var(--danger); background: var(--danger-light); }

/* Inline comment composer (ЗАДАЧ-381). Reuses the pre-existing
   .reply-box / .reply-actions / .reply-hint rules below — those rules
   were carried for a never-wired comment input that ЗАДАЧ-381 finally
   activates. */

/* Reply box */
.reply-box { flex-shrink: 0; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--border-light); }
.reply-box textarea {
  width: 100%; min-height: 80px; padding: .85rem 1rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .9rem; resize: vertical;
  outline: none; font-family: inherit; background: var(--card); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition); line-height: 1.5;
}
.reply-box textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.08); }
.reply-actions { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; align-items: center; }
.reply-hint { font-size: .72rem; color: var(--text-muted); margin-left: auto; }
.reply-hint kbd {
  display: inline-block; padding: .1rem .35rem; border: 1px solid var(--border);
  border-radius: 4px; font-size: .68rem; background: var(--bg); font-family: inherit;
}

/* Task list view */
.tasks-view { display: flex; flex-direction: column; height: calc(100vh - 3.6rem); }
.tasks-view > .tasks-toolbar { flex-shrink: 0; }
.tasks-view > .task-list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: .5rem; }

/* Pagination */
.pagination { display: flex; gap: .35rem; align-items: center; margin-top: 1.2rem; justify-content: center; }
.pagination .btn { min-width: 34px; }
.pagination .btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #0b0f1a;
  border-color: var(--primary); box-shadow: 0 2px 8px rgba(16,185,129,.3);
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--card); border-radius: var(--radius-lg); padding: 2rem;
  width: 480px; max-width: 92vw; box-shadow: var(--shadow-lg);
  animation: modalIn .25s cubic-bezier(.16,1,.3,1);
  border: 1px solid var(--border-light);
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
}
.modal.modal-wide { width: 640px; max-width: 95vw; }
.modal.modal-wide textarea { resize: vertical; min-height: 180px; line-height: 1.6; font-family: inherit; }
.modal h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.3rem; letter-spacing: -.02em; }
.modal .actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.3rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Agent management */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }

.agent-role-badge {
  display: inline-flex; align-items: center; padding: .2rem .55rem;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.agent-role-badge.role-1 { background: var(--primary-light); color: var(--primary); }
.agent-role-badge.role-0 { background: var(--info-light); color: var(--info); }
.agent-role-badge.role-2 { background: rgba(245,158,11,.15); color: #b45309; }

.specialty-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
  background: #f1f5f9; color: var(--text-secondary);
}

/* Projects grid */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: .75rem;
}
.projects-grid .card.project-card {
  margin-bottom: 0; padding: 1rem 1.2rem;
  display: flex; flex-direction: column;
  cursor: pointer;
}
.project-header {
  display: flex; align-items: center; gap: .6rem; min-width: 0;
}
.project-header h3 {
  margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-prefix {
  display: inline-block; flex-shrink: 0;
  padding: .15rem .5rem; border-radius: 20px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  background: var(--primary-light); color: var(--primary);
}
.project-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* Users grid */
.users-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: .75rem;
}
.user-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.user-card:hover {
  border-color: rgba(16,185,129,.35); box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.user-card-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.user-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; letter-spacing: .02em;
}
.user-avatar.agent {
  background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(59,130,246,.08));
  color: var(--info); border: 1.5px solid rgba(59,130,246,.25);
}
.user-avatar.admin {
  background: linear-gradient(135deg, rgba(16,185,129,.15), rgba(16,185,129,.08));
  color: var(--primary); border: 1.5px solid rgba(16,185,129,.25);
}
.user-avatar.manager {
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.08));
  color: #b45309; border: 1.5px solid rgba(245,158,11,.3);
}
.user-card-info { min-width: 0; }
.user-card-name {
  font-weight: 700; font-size: .95rem; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-meta { display: flex; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; align-items: center; }

.agent-api-section {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .6rem .75rem; margin-bottom: .5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem;
}
.agent-api-status span { font-weight: 600; }
.project-checkboxes {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.project-check {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--card);
  cursor: pointer; transition: all var(--transition-fast);
  font-size: .82rem; font-weight: 500; user-select: none;
}
.project-check:hover { border-color: #334155; background: var(--bg-subtle); }
.project-check input { accent-color: var(--primary); cursor: pointer; margin: 0; }
.project-check.checked {
  border-color: rgba(16,185,129,.4); background: var(--primary-light);
}
.project-checkboxes.access-matrix {
  display: grid; grid-template-columns: 1fr; gap: .35rem;
}
/* ЗАДАЧ-1063: group header separating projects by their group inside the
 * access-grant matrix. */
.access-group-header {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
  padding: .5rem .5rem .2rem; margin-top: .25rem;
  border-bottom: 1px solid var(--border);
}
.access-group-header:first-child { margin-top: 0; }
.access-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .35rem .5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card);
}
.access-row-name {
  flex: 1; min-width: 0; font-size: .85rem; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.access-row-select {
  flex: 0 0 auto; padding: .25rem .5rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card);
  font-size: .8rem; font-weight: 500; cursor: pointer;
}
/* Override the generic ".field select { width:100% }" rule so the access
 * level dropdown stays compact and does not cover the project name. */
.field select.access-row-select {
  width: auto; max-width: 11rem; min-width: 7rem;
  padding: .25rem .5rem; font-size: .8rem; font-weight: 500;
  border-width: 1px;
}
.access-row-select.level-0 { color: var(--text-muted); }
.access-row-select.level-1 { color: var(--info); border-color: rgba(59,130,246,.35); }
.access-row-select.level-2 { color: var(--primary); border-color: rgba(16,185,129,.35); background: var(--primary-light); }

/* Worker-agent dispatch grants — list view. Each entry is a row of
 * { project select, specialty select, remove button }. An external
 * "+ Add" button appends a fresh empty row. The dropdowns naturally
 * reflow on narrow screens (the row uses flex with wrap), so a long
 * project name does not overflow the modal. */
.create-perm-list {
  display: flex; flex-direction: column; gap: .35rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); padding: .5rem; margin-bottom: .5rem;
}
.create-perm-list-row {
  display: flex; gap: .35rem; align-items: center; flex-wrap: wrap;
}
.create-perm-list-row select {
  flex: 1 1 8rem; min-width: 0;
  padding: .35rem .5rem;
  background: var(--bg-subtle); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem;
}
.create-perm-list-row select:focus {
  outline: none; border-color: var(--primary);
}
.create-perm-list-row .create-perm-project { flex: 2 1 12rem; }
.create-perm-list-row .create-perm-specialty { flex: 1 1 9rem; }
.create-perm-remove {
  flex: 0 0 auto; padding: .15rem .55rem;
  font-size: 1rem; line-height: 1; min-width: 1.8rem;
}
.create-perm-empty {
  color: var(--text-muted); font-size: .82rem;
  padding: .25rem .15rem;
}
.field-hint {
  font-size: .72rem; color: var(--text-muted); margin-top: .35rem;
}

/* Global model aliases (ЗАДАЧ-1120), managed on the admin settings page. */
.model-alias-list {
  display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem;
}
.model-alias-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); background: var(--bg);
}
.model-alias-row code { overflow-wrap: anywhere; }
.model-alias-target { flex: 1 1 14rem; }
.model-alias-arrow { color: var(--text-muted); }
.model-alias-form { margin-top: .8rem; }

.agent-hint {
  background: var(--primary-light); color: var(--primary); border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-sm); padding: .5rem .75rem;
  font-size: .8rem; font-weight: 500; margin-bottom: .5rem;
}

/* Toast */
.toast-container {
  position: fixed; top: 1.2rem; right: 1.2rem; z-index: 200;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--card); border-radius: var(--radius-sm); padding: .8rem 1.1rem;
  box-shadow: var(--shadow-lg); font-size: .85rem; font-weight: 500;
  border-left: 3px solid var(--success); pointer-events: auto;
  animation: toastIn .3s cubic-bezier(.16,1,.3,1), toastOut .3s ease 2.7s forwards;
  max-width: 360px; display: flex; align-items: center; gap: .5rem;
}
.toast.error { border-left-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Labels */
.label-tag {
  display: inline-block; padding: .1rem .4rem; border-radius: 4px;
  font-size: .72rem; font-weight: 600;
  background: rgba(100,116,139,.15); color: var(--text-secondary);
  margin: .1rem .15rem;
}

/* Empty state */
.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.8rem; margin-bottom: .8rem; opacity: .4; }
.empty-state p { font-size: .9rem; max-width: 300px; margin: .3rem auto 0; }

/* Spinner */
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex; align-items: center; justify-content: center; padding: 5rem;
  color: var(--text-muted); gap: .8rem; font-size: .9rem; font-weight: 500;
}

/* Description block */
.desc-content {
  white-space: pre-wrap; word-break: break-word; font-size: .88rem;
  line-height: 1.6; color: var(--text); max-height: 300px; overflow-y: auto;
}

/* Responsive */
@media (max-width: 900px) {
  .main { padding: 1.3rem 1.5rem; }
  .task-detail { height: calc(100vh - 2.6rem); }
  .task-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .grid-meta { grid-column: 1; grid-row: 1; }
  .grid-desc, .grid-description {
    grid-column: 1; grid-row: 2; max-height: 40%;
  }
  .grid-comments { grid-column: 1; grid-row: 3; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.3); }
  .main { margin-left: 0; padding: 4rem 1rem 1.5rem; }
  .task-detail { height: calc(100vh - 5.5rem); }
  .tasks-view { height: calc(100vh - 5.5rem); }
  .tasks-toolbar { gap: .5rem; }
  .tasks-title { font-size: 1.25rem; width: 100%; }
  .tl-row {
    grid-template-columns: 50px 1fr 80px 80px;
  }
  .tl-key { font-size: .72rem; }
  .tl-title { font-size: .84rem; }
  .tl-col-spec, .tl-col-assignee, .tl-col-time, .tl-col-prio { display: none; }
  .comment { max-width: 92%; }
  .form-grid { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 1.25rem; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
}

[hidden] { display: none !important; }
