:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --sidebar: #172b4d;
  --sidebar-text: #e6edf7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #172b4d;
  --muted: #5e6c84;
  --border: #dfe1e6;
  --accent: #0052cc;
  --accent-hover: #0747a6;
  --green: #00875a;
  --yellow: #ffab00;
  --red: #de350b;
  --shadow: 0 14px 34px rgba(9, 30, 66, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: var(--app-height, 100dvh);
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: clamp(184px, 18vw, 240px) minmax(0, 1fr);
  height: var(--app-height, 100dvh);
}

.shell.layout-nav-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.shell.access-locked .nav-item {
  opacity: 0.42;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  display: block;
  font-size: 18px;
}

#user-badge {
  grid-column: 2;
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.sidebar-toggle {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}

.nav {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.nav-icon {
  width: 24px;
  flex: 0 0 24px;
  text-align: center;
  font-weight: 850;
}

.shell.layout-nav-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 12px 8px;
}

.shell.layout-nav-collapsed .brand strong,
.shell.layout-nav-collapsed #user-badge,
.shell.layout-nav-collapsed .nav-label {
  display: none;
}

.shell.layout-nav-collapsed .nav {
  padding: 8px;
}

.shell.layout-nav-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  min-width: 0;
  height: var(--app-height, 100dvh);
  overflow: auto;
  padding-bottom: 36px;
  transition: padding-right 160ms ease;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(244, 245, 247, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.toolbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.toolbar-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-color: var(--accent);
  border-radius: 50%;
  background: #deebff;
  color: var(--accent-hover);
}

#account-avatar {
  font-weight: 850;
}

.toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

button:hover {
  border-color: #b3bac5;
}

button[type="submit"],
#new-task {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

button[type="submit"]:hover,
#new-task:hover {
  background: var(--accent-hover);
}

button.danger {
  border-color: #ffbdad;
  background: #ffebe6;
  color: var(--red);
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 18px;
  white-space: nowrap;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.view {
  display: none;
  padding: 14px 18px 24px;
}

.view.active {
  display: block;
}

.access-view.active {
  display: grid;
  min-height: calc(var(--app-height, 100dvh) - 96px);
  place-items: center;
}

.access-panel {
  width: min(480px, 100%);
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.board-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.board-controls .subnav {
  margin-bottom: 0;
}

.board-scope {
  position: relative;
}

.scope-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scope-menu label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.scope-menu input {
  width: auto;
  min-height: auto;
}

#board-scope-toggle {
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subnav-item.active {
  border-color: var(--accent);
  background: #deebff;
  color: var(--accent-hover);
}

.stack {
  display: grid;
  gap: 12px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.panel + .panel {
  margin-top: 12px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head.compact {
  margin-bottom: 10px;
  justify-content: flex-start;
  gap: 8px;
}

.panel-head h2 {
  margin: 0;
}

.panel-head.compact .button-row {
  margin-left: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 12px;
  align-items: start;
}

.form-panel button[type="submit"] {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.span-2 {
  grid-column: span 2;
}

.project-create-form button[type="submit"] {
  align-self: end;
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.layout-compact .workspace {
  max-width: 980px;
  margin: 0 auto;
}

.layout-wide .workspace {
  max-width: 1440px;
  margin: 0 auto;
}

.layout-full .workspace {
  max-width: none;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.desktop-layout .board-layout.project-panel-open {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

.status-board {
  display: flex;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  scroll-padding-inline: 12px;
  -webkit-overflow-scrolling: touch;
}

.status-block,
.expand-row,
.data-row,
.project-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.status-block {
  flex: 1 0 min(320px, 100%);
  min-width: min(320px, 100%);
  transition: flex-basis 160ms ease, min-width 160ms ease;
}

.status-block.expanded {
  flex-grow: 1;
}

.status-block.collapsed {
  flex: 0 0 58px;
  min-width: 58px;
}

.status-block.collapsed .status-head {
  min-height: 190px;
  align-items: center;
  justify-content: flex-start;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.status-block.collapsed .status-head-meta {
  font-size: 11px;
}

.status-board.has-collapsed-statuses .status-block.expanded {
  flex-basis: min(420px, 100%);
  min-width: min(360px, 100%);
}

.status-head,
.row-head,
.collapse-head {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 0 12px;
  background: var(--surface-2);
  text-align: left;
}

.row-head.static {
  cursor: default;
}

.row-head-main {
  min-height: 42px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.project-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.status-head-meta,
.row-head > span:last-child,
.row-head-main > span:last-child,
.collapse-head > span:last-child {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-body,
.row-details,
.collapsible-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  min-height: 96px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  border-left: 5px solid var(--green);
}

.compact-task-card {
  min-height: 122px;
  align-content: start;
}

.task-row.overdue {
  border-left-color: var(--red);
}

.task-row.soon {
  border-left-color: var(--yellow);
}

.task-row.normal {
  border-left-color: var(--green);
}

.desktop-layout .task-row[draggable="true"] {
  cursor: grab;
}

.task-card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.task-card-key {
  width: fit-content;
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font-size: 13px;
  font-weight: 850;
}

.task-card-name {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.task-card-description {
  display: -webkit-box;
  min-height: 38px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.task-card-due {
  width: fit-content;
  margin-top: 3px;
  border-radius: 5px;
  padding: 2px 6px;
  background: #e3fcef;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.task-card-due.yellow {
  background: #fff0b3;
  color: #7a4d00;
}

.task-card-due.red {
  background: #ffebe6;
  color: var(--red);
}

.task-card-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.task-card-title button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font-weight: 850;
}

.task-card-title.overdue button {
  color: var(--red);
}

.task-card-title.soon button {
  color: #7a4d00;
}

.task-card-title.normal button {
  color: var(--green);
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-card-side {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.unread-comments {
  min-width: 28px;
  border-radius: 12px;
  padding: 2px 7px;
  background: #dfe1e6;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.unread-comments.has-unread {
  background: #deebff;
  color: var(--accent-hover);
}

.mobile-status-select {
  display: none;
}

.task-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row select {
  min-height: 32px;
}

.muted-inline {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-list {
  display: grid;
  gap: 8px;
}

.data-row {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.calendar-list,
.project-workload,
.child-task-list,
.document-tree,
.workload-status,
.dashboard-backlog {
  display: grid;
  gap: 8px;
}

.backlog-project-group {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.backlog-project-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.backlog-project-list {
  display: grid;
  gap: 6px;
}

.backlog-project-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.calendar-shell {
  display: grid;
  gap: 10px;
}

.calendar-content {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.calendar-task-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 8px;
  max-height: min(680px, calc(var(--app-height, 100dvh) - 142px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 18px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  background: var(--border);
}

.calendar-weekday,
.calendar-day {
  min-width: 0;
  background: var(--surface);
}

.calendar-weekday {
  min-height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.calendar-day {
  min-height: clamp(82px, 7vw, 122px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 5px;
  padding: 7px;
  border: 0;
  border-radius: 0;
  text-align: left;
}

.calendar-day:hover,
.calendar-day.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.calendar-day.muted {
  background: #fafbfc;
  color: #97a0af;
}

.calendar-day-number {
  font-weight: 700;
}

.calendar-bar.backlog {
  background: #6554c0;
}

.calendar-bar.in_work {
  background: var(--accent);
}

.calendar-bar.testing {
  background: var(--yellow);
}

.calendar-bar.done {
  background: var(--green);
}

.calendar-more {
  align-self: end;
  color: var(--muted);
  font-weight: 900;
  line-height: 1;
}

.calendar-bars {
  display: grid;
  grid-template-rows: repeat(3, 18px);
  gap: 2px;
  align-self: end;
}

.calendar-bar-slot {
  min-height: 18px;
  display: block;
}

.calendar-bar {
  position: relative;
  height: 5px;
  display: block;
  border-radius: 999px;
  overflow: visible;
}

.calendar-bar.span-start {
  margin-right: -8px;
  border-radius: 999px 0 0 999px;
}

.calendar-bar.span-middle {
  margin-right: -8px;
  margin-left: -8px;
  border-radius: 0;
}

.calendar-bar.span-end {
  margin-left: -8px;
  border-radius: 0 999px 999px 0;
}

.calendar-bar.span-single {
  border-radius: 999px;
}

.calendar-bar-label {
  position: absolute;
  top: -14px;
  left: 4px;
  color: var(--text);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.calendar-day-head {
  padding-top: 6px;
}

.calendar-item,
.small-task-link,
.child-task-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  text-align: left;
}

.calendar-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.calendar-task-color {
  width: 10px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
}

.calendar-task-color.backlog {
  background: #6554c0;
}

.calendar-task-color.in_work {
  background: var(--accent);
}

.calendar-task-color.testing {
  background: var(--yellow);
}

.calendar-task-color.done {
  background: var(--green);
}

.small-task-link {
  grid-template-columns: minmax(0, 1fr) auto;
}

.calendar-item strong,
.small-task-link strong,
.child-task-link strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-item em,
.small-task-link span,
.child-task-link span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.document-tree details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px;
}

.document-root-section {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.document-root-section > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.document-root-section h3,
.document-root-section p {
  margin: 0;
}

.document-root-section p {
  color: var(--muted);
  font-size: 13px;
}

.document-tree details details {
  margin-top: 8px;
  background: var(--surface);
}

.document-tree summary {
  cursor: pointer;
  font-weight: 800;
}

.documents-layout {
  display: block;
}

.document-node {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.document-thumbnail-button {
  width: 72px;
  min-height: 62px;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.document-node-main {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.document-node-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.document-node-grid {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.document-node-grid > span:last-child {
  display: grid;
  gap: 3px;
}

.document-thumbnail {
  width: 72px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ebf2ff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  object-fit: cover;
}

.document-thumbnail-file {
  background: #f4f5f7;
  color: var(--muted);
}

.document-thumbnail-frame-shell {
  overflow: hidden;
  background: #ffffff;
}

.document-thumbnail-frame {
  width: 180px;
  height: 150px;
  border: 0;
  pointer-events: none;
  transform: scale(0.38);
  transform-origin: top left;
}

.document-thumbnail-text {
  align-items: start;
  justify-items: start;
  overflow: hidden;
  padding: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 9px;
  line-height: 1.2;
  text-align: left;
}

.document-node.active {
  border-color: #b3d4ff;
  background: #deebff;
}

.document-preview-dialog {
  width: min(920px, calc(100vw - 24px));
}

.document-preview {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 10px;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.document-preview h3,
.document-preview p {
  margin: 0;
}

.document-preview-body {
  min-height: 160px;
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 8px;
}

.document-preview img,
.document-preview iframe {
  width: 100%;
  max-height: 420px;
  border: 0;
  object-fit: contain;
}

.document-preview pre {
  width: 100%;
  max-height: 360px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.button-link {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.project-side-panel {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 10px;
  min-height: 160px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.project-side-panel.hidden-panel {
  display: none;
}

.project-side-panel h2 {
  margin: 0;
  font-size: 18px;
}

.project-side-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.project-side-panel-actions {
  display: flex;
  gap: 6px;
}

.project-key-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
}

.project-detail-view {
  display: grid;
  gap: 12px;
}

.project-compact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.project-compact-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.project-compact-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.project-detail-header h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.project-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 14px;
  align-items: start;
}

.project-detail-main,
.project-detail-side {
  display: grid;
  gap: 12px;
}

.project-inline-field {
  margin: 0;
}

.project-task-line {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  padding-left: calc(var(--subtask-depth) * 16px);
}

.project-task-line > button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border: 0;
  background: transparent;
  text-align: left;
}

.project-activity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-activity-list {
  display: grid;
  gap: 8px;
}

.project-subtask-children,
.project-child-children {
  display: grid;
  gap: 4px;
}

.project-roadmap {
  max-height: 520px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.roadmap-grid {
  display: grid;
  gap: 8px;
  min-width: 760px;
}

.roadmap-months,
.roadmap-days,
.roadmap-task-row {
  display: grid;
  grid-template-columns: 220px repeat(var(--roadmap-days), minmax(12px, 1fr));
  align-items: center;
}

.roadmap-months,
.roadmap-days {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.roadmap-days {
  top: 32px;
  min-height: 30px;
  color: var(--text);
}

.roadmap-day-number {
  height: 100%;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--border);
}

.roadmap-project {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.roadmap-project-title {
  width: 220px;
  display: grid;
  justify-items: start;
  min-height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
}

.roadmap-task-row {
  position: relative;
  min-height: 30px;
  border-bottom: 1px solid var(--border);
}

.roadmap-cell {
  grid-row: 1;
  height: 100%;
  border-left: 1px solid var(--border);
}

.roadmap-task-label {
  position: relative;
  z-index: 2;
  grid-column: 1;
  min-height: 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding-left: calc(var(--roadmap-depth) * 16px);
  border: 0;
  background: transparent;
  text-align: left;
}

.roadmap-task-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-task-bar {
  position: relative;
  z-index: 3;
  grid-row: 1;
  min-height: 20px;
  height: 20px;
  align-self: center;
  justify-content: flex-start;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  color: #ffffff;
  font-size: 11px;
}

.roadmap-task-bar.backlog {
  background: #6554c0;
}

.roadmap-task-bar.in_work {
  background: var(--accent);
}

.roadmap-task-bar.testing {
  background: var(--yellow);
  color: var(--text);
}

.roadmap-task-bar.done {
  background: var(--green);
}

.my-tasks-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.my-task-list-panel {
  position: sticky;
  top: 86px;
  max-height: calc(var(--app-height, 100dvh) - 128px);
  overflow: auto;
}

.my-task-list-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}

.my-task-list-item.active {
  border-color: #b3d4ff;
  background: #deebff;
}

.my-task-list-item strong,
.my-task-list-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-task-detail {
  min-height: 260px;
}

.my-task-project-group {
  display: grid;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.my-task-project-title {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.my-task-project-head {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.my-task-project-body {
  display: grid;
  gap: 8px;
}

.my-task-compact-card {
  display: grid;
  gap: 6px;
}

.my-task-compact-row {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}

.my-task-compact-row.active {
  border-color: #b3d4ff;
  background: #deebff;
}

.my-task-compact-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nested-subtasks {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  margin-top: 4px;
  padding-left: calc(var(--subtask-depth, 1) * 10px);
  border-left: 2px solid #b3d4ff;
}

.nested-subtask-link {
  min-height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  text-align: left;
}

.nested-subtask-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nested-subtask-node,
.subtask-tree-node,
.project-child-node {
  display: grid;
  gap: 4px;
  padding-left: calc(var(--subtask-depth) * 8px);
}

.subtask-tree {
  display: grid;
  gap: 5px;
}

.my-task-nested {
  margin-left: 12px;
}

.compact-subnav {
  gap: 5px;
  margin-bottom: 10px;
}

.compact-subnav .subnav-item {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.empty-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.button-row.compact-actions button {
  min-height: 32px;
}

.count {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: #dfe1e6;
  color: var(--text);
  font-size: 12px;
}

.issue-key,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  border-radius: 5px;
  padding: 2px 7px;
  background: #deebff;
  color: #0747a6;
  font-size: 12px;
  font-weight: 800;
}

.pill.green {
  background: #e3fcef;
  color: var(--green);
}

.pill.yellow {
  background: #fff0b3;
  color: #7a4d00;
}

.pill.red {
  background: #ffebe6;
  color: var(--red);
}

.meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

#dashboard-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.monitoring-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}

.metric-button {
  display: block;
  width: 100%;
  min-height: 78px;
  border: 0;
  text-align: left;
}

.metric strong {
  display: block;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric.wide {
  grid-column: span 2;
}

.status-metric {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
}

.status-metric span:last-child {
  grid-column: 2;
}

.status-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(9, 30, 66, 0.08);
}

.status-dot.green {
  background: var(--green);
}

.status-dot.yellow {
  background: var(--yellow);
}

.status-dot.red {
  background: var(--red);
}

.metric-chart {
  display: grid;
  gap: 7px;
}

.metric-bar {
  height: 8px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe1e6;
}

.metric-bar b {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--accent);
}

.metric-chart.green .metric-bar b {
  background: var(--green);
}

.metric-chart.yellow .metric-bar b {
  background: var(--yellow);
}

.ai-view.active {
  display: grid;
  min-height: calc(100dvh - 98px);
}

.ai-chat {
  display: grid;
  grid-template-rows: minmax(240px, 1fr) auto;
  min-height: min(680px, calc(100dvh - 132px));
  padding: 0;
  overflow: hidden;
}

.ai-chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: var(--surface-2);
}

.ai-message {
  max-width: min(760px, 92%);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.ai-message.user {
  justify-self: end;
  border-color: #b3d4ff;
  background: #deebff;
}

.ai-message span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-message p {
  margin: 0;
  white-space: pre-wrap;
}

.ai-empty {
  color: var(--muted);
}

.ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.ai-composer textarea {
  resize: none;
}

.dialog {
  width: min(620px, calc(100vw - 24px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(9, 30, 66, 0.42);
}

.dialog-body {
  padding: 16px;
}

.create-dialog {
  width: min(760px, calc(100vw - 24px));
}

.task-preview-dialog {
  width: min(860px, calc(100vw - 24px));
}

.task-edit-dialog {
  width: min(760px, calc(100vw - 24px));
}

.create-panel {
  margin-top: 12px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 14px;
  width: min(520px, 100vw);
  height: var(--app-height, 100dvh);
  padding: 18px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 160ms ease;
  overflow: auto;
}

.desktop-layout .workspace.task-side-open {
  padding-right: min(520px, 38vw);
}

.desktop-layout .workspace.task-side-open .board-layout {
  grid-template-columns: minmax(0, 1fr);
}

.desktop-layout .workspace.task-side-open .project-side-panel {
  display: none;
}

.account-drawer {
  left: 0;
  right: auto;
  border-right: 1px solid var(--border);
  border-left: 0;
  transform: translateX(-105%);
}

.account-drawer.open {
  transform: translateX(0);
}

.toggle-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: auto;
  min-height: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: flex-start;
  gap: 14px;
  align-items: flex-start;
}

.drawer-close-left {
  flex: 0 0 auto;
}

.drawer h2 {
  margin: 8px 0 0;
  font-size: 22px;
}

.drawer h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comments {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.comment {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.comment-avatar,
.avatar {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #deebff;
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 900;
}

.comment-body {
  min-width: 0;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.comment-form {
  display: grid;
  gap: 8px;
}

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-row button {
  width: 36px;
  min-height: 32px;
  padding: 0;
}

.task-preview-grid {
  display: grid;
  gap: 12px;
}

.task-detail {
  display: grid;
  gap: 16px;
}

.task-detail.compact {
  gap: 12px;
}

.task-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.task-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.task-detail-head h2 {
  margin: 5px 0 2px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.15;
}

.task-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 12px;
  align-items: start;
}

.task-detail-main,
.task-detail-side {
  display: grid;
  gap: 12px;
}

.task-detail-block {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.task-detail.compact .task-detail-grid {
  grid-template-columns: 1fr;
}

.task-detail section {
  display: grid;
  gap: 8px;
}

.task-detail section > h3 {
  margin: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  font-size: 15px;
}

.task-detail p {
  margin: 0;
  line-height: 1.45;
}

.task-edit-form {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fafbfc;
}

.task-edit-form label {
  margin-bottom: 0;
}

.task-edit-form input:focus,
.task-edit-form select:focus,
.task-edit-form textarea:focus,
.editable-field:hover {
  border-color: #4c9aff;
  box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.18);
  outline: none;
}

.subtask-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.subtask-list {
  display: grid;
  gap: 8px;
}

.task-preview-title {
  display: grid;
  gap: 4px;
}

.task-preview-title h3 {
  margin: 0;
  font-size: 24px;
}

.task-field-list,
.attachment-list,
.issue-link-list {
  display: grid;
  gap: 7px;
}

.task-field {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-2);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.task-inline-control {
  margin: 0;
}

.task-inline-control input,
.task-inline-control select {
  min-height: 30px;
  padding: 4px 8px;
  font-weight: 800;
}

.task-field span:first-child {
  color: var(--muted);
  font-weight: 800;
}

#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 46px;
  z-index: 50;
  display: none;
  padding: 12px;
  border-radius: 8px;
  background: #172b4d;
  color: #ffffff;
}

#activity-status-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  min-height: 32px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 6px 14px;
  background: #172b4d;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .shell {
    display: block;
    height: auto;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
  }

  .brand {
    padding: 12px 14px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .workspace {
    height: auto;
    overflow: visible;
  }

  .workspace.task-side-open {
    padding-right: 0;
  }

  .toolbar {
    top: 92px;
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions select,
  .toolbar-actions button {
    flex: 1 1 140px;
  }

  .board-layout,
  .calendar-content,
  .my-tasks-layout,
  .task-detail-grid {
    grid-template-columns: 1fr;
  }

  .status-board {
    flex-direction: column;
    overflow-x: visible;
  }

  .status-block,
  .status-block.expanded,
  .status-block.collapsed,
  .status-board.has-collapsed-statuses .status-block.expanded {
    flex: 1 1 auto;
    min-width: 0;
  }

  .status-block.collapsed .status-head {
    min-height: 42px;
    align-items: flex-start;
    writing-mode: horizontal-tb;
  }

  .project-side-panel {
    position: static;
  }

  .calendar-task-sidebar {
    position: static;
    max-height: none;
  }

  .my-task-list-panel {
    position: static;
    max-height: none;
  }

  .two-col,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .task-row {
    grid-template-columns: 1fr;
  }

  .task-row select,
  .muted-inline {
    grid-column: 1 / -1;
  }

  .task-card-side {
    justify-items: start;
  }

  .mobile-status-select {
    display: block;
  }

  .calendar-day {
    min-height: 74px;
    padding: 5px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  #dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #dashboard-metrics .metric {
    min-height: 54px;
    padding: 8px;
  }

  #dashboard-metrics .metric strong {
    font-size: 19px;
  }

  #dashboard-metrics .metric span {
    font-size: 11px;
  }

  .subtask-form {
    grid-template-columns: 1fr;
  }

  .ai-view.active {
    min-height: calc(100dvh - 154px);
  }

  .ai-chat {
    min-height: calc(100dvh - 186px);
  }

  .ai-composer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .view {
    padding: 10px;
  }

  .toolbar {
    padding: 12px 10px;
  }

  .panel {
    padding: 10px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metric.wide {
    grid-column: span 1;
  }

  #dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .row-head,
  .status-head,
  .collapse-head {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 8px 10px;
  }

  .calendar-grid {
    font-size: 12px;
  }

  .calendar-day {
    min-height: 58px;
  }

  .calendar-bar {
    height: 4px;
  }

  .task-field {
    grid-template-columns: 1fr;
  }

  .task-detail-head {
    display: grid;
  }

  .task-preview-dialog {
    width: calc(100vw - 12px);
  }
}
