:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #172033;
  --muted: #687386;
  --line: #dde3ec;
  --green: #247a55;
  --green-strong: #166541;
  --blue: #1f5fbf;
  --red: #c83242;
  --amber: #a26300;
  --yellow-soft: #fff7d1;
  --yellow-strong: #ffe07a;
  --red-soft: #ffdede;
  --red-hard: #e74757;
  --shadow: 0 14px 40px rgba(31, 45, 61, .08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --sidebar: #0b1220;
  --panel: #172033;
  --panel-2: #111a2b;
  --text: #e7edf7;
  --muted: #9aa8bc;
  --line: #2a3548;
  --green: #34a66f;
  --green-strong: #41bf82;
  --blue: #7db2ff;
  --red: #ff6d7b;
  --amber: #f2b84b;
  --yellow-soft: #3b3218;
  --yellow-strong: #554513;
  --red-soft: #4a2028;
  --red-hard: #8c2634;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.42;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.mobile-brand-row {
  display: block;
}

.mobile-menu-toggle {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px 16px;
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

nav {
  display: grid;
  gap: 5px;
}

nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 700;
}

nav a:hover,
nav a.active {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

nav a.nav-alert {
  color: #ffffff;
  background: var(--red);
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, .18);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  overflow-x: hidden;
}

.workspace-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions form {
  margin: 0;
}

.user-chip {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  font-weight: 700;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 22px auto 56px;
}

button,
.primary,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

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

.primary:hover {
  background: var(--green-strong);
}

.big {
  min-height: 42px;
}

.danger {
  color: var(--red);
}

.theme-toggle::before {
  content: "☀";
  margin-right: 7px;
}

html[data-theme="dark"] .theme-toggle::before {
  content: "☾";
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  vertical-align: middle;
}

.badge-comment {
  background: var(--amber);
}

.badge-notice {
  background: var(--red);
}

.badge-soft {
  background: color-mix(in srgb, var(--blue) 14%, var(--panel));
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
}

.disabled-link {
  opacity: .45;
  pointer-events: none;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1,
h2,
h3 {
  margin: 0 0 9px;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 100%;
  overflow-x: visible;
  align-items: flex-start;
  padding: 4px 0 14px;
}

.board-section,
.panel,
.login {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.board-section h2 span {
  color: var(--muted);
  font-size: 14px;
}

.kanban-column {
  width: 100%;
  min-height: 150px;
}

.attention-column {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
}

.column-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.column-head h2 {
  margin-bottom: 3px;
}

.column-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.drop-hint {
  display: none;
}

.kanban-column.drag-over {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--panel) 82%, var(--blue));
}

.task-list {
  display: grid;
  gap: 7px;
}

.task {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  box-shadow: 0 8px 20px rgba(31, 45, 61, .05);
}

.proposal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.proposal-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 148px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.proposal-card:hover {
  border-color: var(--blue);
  text-decoration: none;
}

.proposal-card::before {
  content: "";
  display: block;
  height: 4px;
  margin: -11px -11px 9px;
  border-radius: 8px 8px 0 0;
  background: var(--line);
}

.proposal-new::before {
  background: var(--blue);
}

.proposal-rejected {
  border-color: color-mix(in srgb, var(--red) 46%, var(--line));
  background: color-mix(in srgb, var(--red-soft) 34%, var(--panel));
}

.proposal-rejected::before {
  background: var(--red);
}

.proposal-approved {
  border-color: color-mix(in srgb, var(--amber) 50%, var(--line));
  background: color-mix(in srgb, var(--yellow-soft) 38%, var(--panel));
}

.proposal-approved::before {
  background: var(--amber);
}

.proposal-converted {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--panel));
}

.proposal-converted::before {
  background: var(--green);
}

.proposal-unread {
  border-color: color-mix(in srgb, var(--blue) 60%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 20%, transparent), var(--shadow);
}

.proposal-card h3 {
  display: -webkit-box;
  min-height: 34px;
  overflow: hidden;
  color: var(--blue);
  font-size: 15px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.proposal-card p {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.proposal-card .meta {
  font-size: 12px;
}

.stored-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stored-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.stored-card::before {
  content: "";
  display: block;
  height: 4px;
  margin: -11px -11px 0;
  border-radius: 8px 8px 0 0;
}

.stored-task::before {
  background: var(--blue);
}

.stored-proposal {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
}

.stored-proposal::before {
  background: var(--amber);
}

.stored-type-badge {
  width: fit-content;
}

.stored-task .stored-type-badge {
  background: color-mix(in srgb, var(--blue) 24%, var(--panel));
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 42%, var(--line));
}

.stored-proposal .stored-type-badge {
  background: color-mix(in srgb, var(--amber) 24%, var(--panel));
  color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 48%, var(--line));
}

.stored-card-main {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.stored-card-main:hover {
  text-decoration: none;
}

.stored-card h3 {
  margin: 0;
  color: var(--blue);
  font-size: 15px;
}

.stored-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.stored-card form,
.stored-card button {
  width: 100%;
}

.analytics-section {
  margin-bottom: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.metric-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card b {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
}

.metric-success {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
}

.metric-success b {
  color: var(--green);
}

.metric-warning {
  border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
}

.metric-warning b {
  color: var(--amber);
}

.metric-danger {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
}

.metric-danger b {
  color: var(--red);
}

.analytics-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.analytics-ai-actions button[disabled] {
  opacity: .65;
  cursor: wait;
}

.analytics-ai-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.analytics-ai-result.loading {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.analytics-ai-result h3 {
  margin: 0;
}

.analytics-ai-text {
  display: grid;
  gap: 6px;
}

.analytics-ai-text p {
  margin: 0;
  color: var(--text);
}

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

.analytics-list-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.analytics-list-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 16px;
}

.analytics-list-card h3 span {
  color: var(--muted);
  font-size: 13px;
}

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

.analytics-mini-list a {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
}

.analytics-mini-list a:hover {
  border-color: var(--blue);
}

.analytics-mini-list span,
.analytics-mini-list small {
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  grid-template-columns: 150px 110px 170px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.activity-list span,
.activity-list em {
  color: var(--muted);
  font-style: normal;
}

.activity-list a,
.activity-list strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-wait {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.ai-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.ai-progress {
  width: min(360px, 100%);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.ai-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  animation: ai-progress 1.4s ease-in-out infinite;
}

.ai-status {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ai-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

.task-compact {
  min-height: 92px;
}

.task[draggable="true"] {
  cursor: grab;
}

.task.dragging {
  opacity: .55;
  cursor: grabbing;
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.task-compact h3 {
  display: -webkit-box;
  min-height: 36px;
  margin-bottom: 7px;
  overflow: hidden;
  color: var(--blue);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.task-compact .badge {
  min-height: 18px;
  padding: 1px 6px;
  font-size: 11px;
}

.actions {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.meta,
.hint,
.seen,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.deadline-line {
  margin-top: 8px;
}

.task-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.task-foot .deadline-line {
  margin-top: 0;
}

.task-stat {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.task-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(430px, 100vw);
  height: 100vh;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .22);
  transform: translateX(105%);
  transition: transform .18s ease;
}

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

.drawer-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, .26);
}

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

.drawer-head h2 {
  font-size: 22px;
}

.drawer-meta {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.drawer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.drawer-actions > *,
.drawer-actions form,
.drawer-actions button,
.drawer-actions a {
  width: 100%;
  min-width: 0;
}

.drawer-actions .reject-mini {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.drawer-description {
  white-space: normal;
}

.drawer-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.deadline-line span {
  margin-left: 8px;
  font-weight: 800;
}

.deadline-yellow-soft {
  background: var(--yellow-soft);
}

.deadline-yellow-strong {
  background: var(--yellow-strong);
}

.deadline-red {
  background: var(--red-soft);
}

.deadline-overdue {
  color: #ffffff;
  background: var(--red-hard);
  border-color: var(--red);
}

.deadline-overdue a,
.deadline-overdue .meta,
.deadline-overdue .seen {
  color: #ffffff;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.narrow,
.login {
  max-width: 760px;
  margin: 0 auto;
}

.detail {
  display: grid;
  gap: 15px;
}

.description {
  white-space: normal;
  font-size: 16px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.inline-form select {
  max-width: 260px;
}

.proposal-actions {
  justify-content: flex-end;
}

.proposal-status-form {
  align-items: end;
  width: fit-content;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.proposal-status-form label {
  min-width: 220px;
}

.proposal-status-form button {
  min-height: 39px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
  margin: 10px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filters label {
  gap: 4px;
  font-size: 13px;
}

.filters input,
.filters select {
  min-height: 34px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  font-weight: 800;
}

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

.filter-actions,
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reject-mini {
  display: flex;
  align-items: center;
  gap: 5px;
}

.reject-mini input {
  width: 125px;
  min-height: 34px;
}

.rejection-note {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--red-soft) 42%, var(--panel));
}

.calculator-result {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 9%, var(--panel));
}

.subtask-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.subtask {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.subtask form {
  margin: 0;
}

.subtask-toggle {
  flex: 1 1 auto;
  min-width: 0;
}

.subtask-toggle .check-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.subtask-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: max-content;
}

.subtask-edit-form {
  flex: 0 0 auto;
}

.subtask-edit-input {
  flex: 1 1 auto;
  min-width: 180px;
  min-height: 34px;
}

.subtask-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.subtask-add {
  max-width: 720px;
  margin-top: 8px;
}

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

.subtask-form-block > button {
  width: fit-content;
}

.subtask-preview {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 10px 10px 10px 30px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.subtask-done .subtask-text {
  text-decoration: line-through;
}

.expand-tail {
  margin-top: 8px;
}

.expand-tail summary {
  width: fit-content;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.expand-tail summary::-webkit-details-marker {
  display: none;
}

.expand-tail summary:hover {
  text-decoration: underline;
}

.expand-tail[open] summary {
  margin-bottom: 8px;
}

.login {
  text-align: center;
}

.login .stack {
  text-align: left;
}

.login-art {
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
  border-radius: 22px;
}

.thumbs,
.shots,
.existing-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.thumb img {
  width: 76px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.shot {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
}

.shot img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--panel);
  border: 0;
}

.remove-shot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  font-weight: 400;
}

.remove-shot input {
  width: auto;
  min-height: auto;
}

.remove-shot img {
  width: 82px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.comment {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.comment span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

code {
  white-space: pre-wrap;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 24px;
  background: rgba(10, 14, 22, .9);
}

.image-viewer.open {
  display: flex;
}

.image-viewer img {
  max-width: 100%;
  max-height: 100%;
  transform: scale(var(--zoom, 1));
  transform-origin: center;
  transition: transform .12s ease;
}

.viewer-tools {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.viewer-tools button {
  min-width: 42px;
  color: #ffffff;
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .14);
}

.realtime-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 12px;
  max-width: min(520px, calc(100% - 36px));
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 40%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.realtime-notice.show {
  display: flex;
}

.realtime-notice span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.realtime-notice button {
  white-space: nowrap;
}

.error {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .brand {
    width: auto;
    padding-bottom: 8px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .mobile-menu-toggle::before {
    content: "☰";
    margin-right: 7px;
  }

  .sidebar nav {
    display: none;
    gap: 6px;
    max-width: 100%;
    overflow: visible;
    padding: 8px 0 2px;
  }

  .sidebar.menu-open nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar nav a {
    justify-content: center;
    white-space: normal;
    min-height: 34px;
    padding: 7px 10px;
  }

  .workspace-top {
    position: static;
    padding: 12px;
    max-width: 100vw;
    overflow: hidden;
  }

  .workspace-top,
  .headline,
  .task-head {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    width: 100%;
    max-width: 100vw;
    padding: 0 12px;
    margin-top: 14px;
    margin-right: 0;
    margin-left: 0;
  }

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

  .board {
    display: grid;
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-right: 0;
    padding-left: 0;
  }

  .kanban-column {
    width: 100%;
    max-width: none;
    min-height: 0;
  }

  .top-actions,
  .filter-actions,
  .actions,
  .inline-form {
    width: 100%;
    min-width: 0;
  }

  .filter-actions > *,
  .inline-form > * {
    flex: 1 1 auto;
    min-width: 0;
  }

  .top-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions > *,
  .top-actions form,
  .top-actions form button {
    width: 100%;
    min-width: 0;
  }

  .task,
  .board-section,
  .panel,
  .filters {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  table {
    min-width: 640px;
  }

  .analytics-lists-grid {
    grid-template-columns: 1fr;
  }

  .activity-list li {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .activity-list a,
  .activity-list strong {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  .brand {
    font-size: 18px;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .sidebar.menu-open nav {
    grid-template-columns: 1fr;
  }

  .user-chip {
    width: 100%;
    text-align: center;
  }

  .headline .primary {
    width: 100%;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .column-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-drawer {
    width: 100vw;
    padding: 14px;
  }

  .drawer-actions {
    grid-template-columns: 1fr;
  }

  .drawer-actions .reject-mini {
    grid-template-columns: 1fr;
  }

  .reject-mini {
    width: 100%;
  }

  .proposal-actions,
  .proposal-status-form {
    width: 100%;
  }

  .proposal-status-form {
    align-items: stretch;
    flex-direction: column;
  }

  .proposal-status-form label,
  .proposal-status-form button,
  .proposal-actions > * {
    width: 100%;
  }

  .reject-mini input,
  .reject-mini button {
    width: 100%;
  }

  .subtask {
    align-items: flex-start;
    flex-direction: column;
  }

  .subtask-toggle,
  .subtask-side {
    width: 100%;
  }

  .subtask-side {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .subtask-toggle .check-row {
    align-items: flex-start;
  }

  .subtask-edit-input {
    min-width: 0;
  }

  .subtask-form-block > button {
    width: 100%;
  }

  .analytics-ai-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .analytics-ai-result.loading {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .realtime-notice {
    right: 10px;
    bottom: 10px;
    left: 10px;
    align-items: stretch;
    flex-direction: column;
    max-width: none;
  }
}
