:root {
  color-scheme: light;
  --ink: #202531;
  --muted: #657086;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f2f4f1;
  --sidebar: #202531;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #d8f3ee;
  --warning: #b45309;
  --error: #b8325f;
  --shadow: 0 18px 48px rgba(32, 37, 49, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--sidebar);
  color: #f7fafc;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.app-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-loading-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(320px, calc(100vw - 48px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 48px rgba(4, 10, 20, 0.22);
  text-align: center;
}

.app-loading-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 22px;
  font-weight: 850;
}

.app-loading-panel strong {
  color: #ffffff;
  font-size: 18px;
}

.app-loading-panel p {
  margin: 0;
  color: #b9c2d0;
  font-size: 14px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: var(--sidebar);
  color: #f7fafc;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 48px rgba(4, 10, 20, 0.22);
}

.auth-card h2 {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: 24px;
}

.auth-card .eyebrow {
  color: #9fd9d2;
}

.auth-card .field span {
  color: #d8f3ee;
}

.auth-card input {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.auth-card input:focus {
  border-color: rgba(159, 217, 210, 0.72);
  outline: 3px solid rgba(159, 217, 210, 0.16);
}

.auth-card .status-line {
  color: #b9c2d0;
}

.auth-card .secondary-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f7fafc;
}

.auth-card .secondary-button:hover {
  border-color: rgba(216, 243, 238, 0.72);
  background: rgba(216, 243, 238, 0.12);
}

.user-strip {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 236px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.user-strip span {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-strip button {
  width: auto;
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.18);
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7fafc;
  font-size: 12px;
}

.user-strip button:hover {
  border-color: rgba(216, 243, 238, 0.72);
  background: rgba(216, 243, 238, 0.12);
}

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

.approval-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, auto) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  color: var(--ink);
}

.approval-item strong,
.approval-item span,
.approval-item small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.approval-item span,
.approval-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.approval-item > div:first-child {
  min-width: 0;
}

.approval-item > div:only-child {
  grid-column: 1 / -1;
}

.auth-card .approval-item {
  border-color: rgba(216, 222, 232, 0.9);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(4, 10, 20, 0.12);
}

.auth-card .approval-item strong {
  color: var(--ink);
}

.auth-card .approval-item span,
.auth-card .approval-item small {
  color: #34435c;
}

.auth-card .approval-item select {
  min-height: 40px;
  padding: 9px 11px;
  background: #fbfcfd;
  color: var(--ink);
}

.auth-card .approval-item button {
  min-height: 40px;
  padding: 0 14px;
}

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

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

.shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.shell.is-home {
  grid-template-columns: 1fr;
}

.shell.is-home .sidebar,
.shell.is-home .workspace {
  display: none;
}

.shell:not(.is-home) .home-screen {
  display: none;
}

.home-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: auto;
  padding: 36px;
  background: var(--sidebar);
  color: #f7fafc;
}

.home-panel {
  display: grid;
  gap: 22px;
  width: min(1040px, 100%);
}

.home-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.home-heading h1 {
  margin: 2px 0 0;
  font-size: 30px;
  line-height: 1.1;
}

.home-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 220px));
  justify-content: center;
  gap: 16px;
}

.home-project-card {
  display: grid;
  align-content: space-between;
  gap: 12px;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  text-align: left;
  box-shadow: 0 18px 48px rgba(4, 10, 20, 0.22);
  white-space: normal;
}

.home-project-card:hover {
  border-color: rgba(216, 243, 238, 0.72);
  background: rgba(216, 243, 238, 0.12);
}

.home-project-card strong,
.home-project-card span,
.home-project-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.home-project-card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.home-project-card span {
  color: #9fd9d2;
  font-size: 13px;
  font-weight: 800;
}

.home-project-card small {
  color: #b9c2d0;
  font-size: 12px;
  line-height: 1.35;
}

.home-project-card.create-card {
  border-style: dashed;
  background: rgba(216, 243, 238, 0.08);
}

.home-project-card.create-card small {
  justify-self: end;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.home-empty-card {
  display: grid;
  align-content: center;
  gap: 10px;
  width: min(460px, 100%);
  min-height: 160px;
  grid-column: 1 / -1;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 48px rgba(4, 10, 20, 0.22);
  text-align: center;
}

.home-empty-card strong {
  color: #ffffff;
  font-size: 18px;
  line-height: 1.25;
}

.home-empty-card span {
  color: #b9c2d0;
  font-size: 14px;
  line-height: 1.4;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 24px 20px;
  min-width: 0;
  overflow: auto;
  background: var(--sidebar);
  color: #f7fafc;
}

.brand-row,
.brand,
.project-heading,
.actions,
.button-row {
  display: flex;
  align-items: center;
}

.brand-row,
.project-heading,
.actions {
  justify-content: space-between;
  gap: 16px;
}

.brand {
  gap: 13px;
  min-width: 0;
  border-radius: 8px;
  cursor: pointer;
}

.brand:hover,
.brand:focus-visible {
  outline: 2px solid rgba(216, 243, 238, 0.28);
  outline-offset: 4px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 850;
}

.brand h1,
.brand p,
.project-header h2,
.project-header p,
.section-title span,
.section-title strong,
.summary,
.status-line,
.modal-header h2,
.modal-header p,
.modal-question {
  margin: 0;
}

.brand h1 {
  font-size: 21px;
  line-height: 1.1;
}

.brand p {
  color: #b9c2d0;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(269px, 0.352fr);
  align-items: start;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px 16px;
  width: min(1720px, 100%);
  height: 100vh;
  overflow: hidden;
  margin: 0 auto;
  padding: 24px 16px;
}

.project-header {
  grid-column: 1;
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.project-heading {
  align-items: flex-start;
}

.project-heading > div:first-child {
  min-width: 0;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.project-header h2 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.mvp-command-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.stage-roadmap {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.stage-roadmap-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fbfcfd;
  color: var(--muted);
  font: inherit;
  text-align: left;
  white-space: normal;
}

.stage-roadmap-item em {
  grid-row: 1 / span 2;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #e8edf3;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.stage-roadmap-item strong {
  align-self: end;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-roadmap-item small {
  align-self: start;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.stage-roadmap-item {
  min-height: 38px;
  border-color: var(--line);
  padding: 6px 8px;
  background: #ffffff;
  cursor: pointer;
}

button.stage-roadmap-item:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f6fbfa;
}

.stage-roadmap-item.is-done {
  border-color: rgba(15, 118, 110, 0.26);
  color: var(--accent-dark);
}

.stage-roadmap-item.is-done em {
  background: var(--accent);
  color: #ffffff;
}

.stage-roadmap-item.is-current {
  border-color: rgba(15, 118, 110, 0.55);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.stage-roadmap-item.is-current em {
  background: #ffffff;
  color: var(--accent-dark);
}

.stage-roadmap-item.is-available {
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--accent-dark);
}

.stage-roadmap-item.is-available em {
  background: #d8f3ee;
  color: var(--accent-dark);
}

.zone-status {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
}

.zone-status strong {
  display: block;
  margin-top: 2px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-status.is-current {
  border-color: rgba(15, 118, 110, 0.38);
  background: #f7fbfa;
}

.zone-status.is-done strong {
  color: var(--accent-dark);
}

.eyebrow,
.section-title span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-top: 0;
}

.project-title-card {
  display: grid;
  gap: 10px;
  padding: 0;
}

.project-title-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.project-title-view strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title-view strong.is-hidden,
.project-title-inline-input.is-hidden {
  display: none;
}

.project-title-inline-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(15, 118, 110, 0.4);
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.project-title-inline-input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  outline-offset: 1px;
}

.edit-title-button {
  width: 34px;
  height: 34px;
}

.edit-title-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.project-management-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.edit-title-button,
.project-action-icon {
  width: 34px;
  height: 34px;
}

.edit-title-button svg,
.project-action-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.danger-icon {
  border-color: rgba(184, 50, 95, 0.34);
  background: #fff7fa;
  color: var(--error);
}

.danger-icon:hover {
  background: #fce8ef;
}

.project-action-icon.is-active {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.project-action-icon polygon,
.project-action-icon rect {
  fill: currentColor;
  stroke: currentColor;
}

.server-status-value {
  display: grid;
  gap: 4px;
}

.server-status-value span,
.server-status-value a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.server-status-value a {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.project-title-editor {
  display: grid;
  gap: 8px;
}

.project-title-editor.is-hidden {
  display: none;
}

.compact-status {
  min-height: 0;
  margin: 0;
  font-size: 12px;
}

.compact-status:empty {
  display: none;
}

.summary {
  color: #3d485c;
  line-height: 1.45;
}

.summary:not(.is-expanded) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-toggle {
  display: grid;
  width: 36px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  border-color: var(--line);
  padding: 0;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.summary-toggle:hover,
.summary-toggle.is-active {
  background: #edf2f0;
}

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
}

.facts div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

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

.server-card {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfd;
}

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

.server-card-main .eyebrow {
  margin: 0 0 3px;
}

.server-status-value {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.server-status-value a {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.server-status-value a:hover {
  text-decoration: underline;
}

.server-status-error {
  color: var(--error);
  font-size: 12px;
  font-weight: 750;
}

.server-status-log {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.server-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.server-toggle-button,
.preview-edit-button {
  align-self: center;
}

.repository-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.repository-card.is-busy {
  opacity: 0.72;
}

.compact-field {
  gap: 6px;
}

.compact-field span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-field input {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 13px;
}

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

.repository-actions button {
  min-height: 34px;
  padding: 8px 12px;
}

.facts dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.preview-domain-editor {
  display: grid;
  gap: 8px;
}

.preview-domain-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.preview-domain-input-row input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.preview-domain-input-row span {
  padding-right: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.auto-mode-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  cursor: pointer;
}

.auto-mode-toggle input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.auto-mode-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid #cad4d8;
  border-radius: 999px;
  background: #e7edf0;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.auto-mode-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 32, 0.18);
  content: "";
  transition: transform 0.16s ease;
}

.auto-mode-toggle.is-active .auto-mode-switch {
  border-color: #286c5b;
  background: #2f806b;
}

.auto-mode-toggle.is-active .auto-mode-switch::after {
  transform: translateX(18px);
}

.auto-mode-toggle strong,
.auto-mode-toggle small {
  display: block;
}

.auto-mode-toggle strong {
  font-size: 14px;
}

.auto-mode-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.auto-mode-toggle:has(input:disabled) {
  cursor: default;
  opacity: 0.62;
}

.requirement-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.requirement-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.requirement-step:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f6fbfa;
}

.requirement-step span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #e8edf3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.requirement-step strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
}

.requirement-step.is-done span {
  background: var(--accent);
  color: #ffffff;
}

.requirement-step.is-current {
  border-color: rgba(15, 118, 110, 0.55);
  background: var(--accent-soft);
}

.requirement-step.is-current span {
  background: #ffffff;
  color: var(--accent-dark);
}

.workspace-grid {
  display: contents;
}

.workspace-grid > .work-panel:not(#dialog-panel) {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: 24px;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 8px;
  gap: 12px;
}

#dialog-panel,
#documentation-panel,
#visual-style-panel,
#task-plan-panel {
  grid-column: 1;
}

#dialog-panel {
  grid-row: 2;
}

#documentation-panel {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

#visual-style-panel {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

#task-plan-panel {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.workspace-grid > .work-panel:not(#dialog-panel),
#dialog-panel,
#documentation-panel,
#task-plan-panel {
  min-width: 0;
}

.work-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.documentation-panel {
  position: relative;
  display: grid;
  align-content: start;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 22px 76px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-plan-panel {
  position: relative;
  display: grid;
  align-content: start;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 22px 78px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.visual-style-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.documentation-header,
.documentation-actions,
.visual-style-header,
.task-plan-header,
.task-plan-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.visual-style-list {
  display: block;
  min-height: 0;
  overflow: hidden;
}

.visual-style-header .visual-meta {
  flex: 0 0 auto;
  width: auto;
  max-width: 260px;
  margin-left: auto;
  justify-self: end;
  grid-template-columns: minmax(0, auto);
}

.visual-style-header .visual-meta div {
  min-width: 0;
  width: max-content;
  max-width: 260px;
}

.visual-carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.visual-carousel-stage {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  color: inherit;
}

.visual-carousel.is-generating .visual-carousel-stage,
.visual-carousel.is-generating .visual-carousel-thumb,
.visual-carousel.is-generating .visual-carousel-nav {
  cursor: wait;
}

.visual-generation-badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 3px;
  max-width: min(320px, calc(100% - 28px));
  border: 1px solid rgba(15, 118, 110, 0.32);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.visual-generation-badge strong,
.visual-generation-badge small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.visual-generation-badge strong {
  color: var(--accent-dark);
  font-size: 13px;
}

.visual-generation-badge small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.visual-carousel-stage.is-selected {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.visual-carousel-stage:hover,
.visual-carousel-stage:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: -3px;
}

.visual-carousel-stage img {
  display: block;
  width: 100%;
  height: clamp(300px, 42vw, 560px);
  object-fit: cover;
  background: #ffffff;
}

.visual-carousel-nav {
  align-self: stretch;
  width: 44px;
  height: auto;
  min-height: 180px;
  font-size: 34px;
}

.visual-carousel-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.visual-carousel-counter {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fbfcfd;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.visual-carousel-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 74px;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.visual-carousel-thumb {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #ffffff;
}

.visual-carousel-thumb.is-active {
  border-color: rgba(15, 118, 110, 0.72);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.visual-carousel-thumb.is-selected {
  border-color: rgba(15, 118, 110, 0.92);
}

.visual-carousel-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.visual-style-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.visual-style-actions textarea {
  min-height: 86px;
}

.visual-style-actions .actions {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-items: end;
  gap: 8px;
}

.visual-style-actions .status-line {
  grid-column: 1 / -1;
  max-width: 320px;
  text-align: right;
}

.visually-hidden-file {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-visual-style-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-image-modal .document-modal-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

.is-image-modal .document-modal-body {
  display: grid;
  min-height: 0;
}

.is-image-modal .document-modal-preview {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.image-carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
}

.image-carousel-button {
  align-self: stretch;
  width: 44px;
  height: auto;
  min-height: 120px;
  font-size: 34px;
}

.document-image-link {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.document-image-preview {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.image-carousel-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.image-carousel-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fbfcfd;
  color: var(--ink);
  font-weight: 850;
}

.image-carousel-meta p {
  margin: 0;
  overflow-wrap: anywhere;
}

.visual-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.visual-modal-actions strong,
.visual-modal-actions span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.visual-modal-actions span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.visual-modal-actions .button-row {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.visual-modal-actions a.secondary-button {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  text-decoration: none;
}

.visual-modal-revision {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.visual-modal-revision label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.visual-modal-revision textarea {
  min-height: 68px;
  resize: none;
}

.visual-modal-revision .button-row {
  justify-content: flex-end;
}

.documentation-actions,
.task-plan-actions {
  position: absolute;
  right: 22px;
  bottom: 14px;
  left: 22px;
  justify-content: flex-end;
  min-height: 42px;
  padding-bottom: 2px;
}

.documentation-actions .button-row {
  min-width: 0;
  flex-wrap: nowrap;
  width: auto;
  justify-content: flex-end;
}

.task-plan-actions .button-row {
  min-width: 0;
  flex-wrap: nowrap;
  width: auto;
  margin-left: auto;
  overflow-x: auto;
  justify-content: flex-end;
  gap: 8px;
}

.documentation-actions button,
.task-plan-actions button {
  min-height: 36px;
  min-width: 0;
  padding-inline: 10px;
  font-size: 13px;
}

.documentation-actions #confirm-documentation {
  flex: 0 0 auto;
}

.documentation-actions .secondary-button {
  flex: 0 1 auto;
}

.documentation-actions .status-line {
  flex: 0 1 180px;
}

.task-plan-actions .status-line {
  position: absolute;
  bottom: 42px;
  left: 0;
  max-width: min(460px, 100%);
  min-height: 0;
}

.task-status-filter {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  background: transparent;
}

.task-status-filter-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 12px;
}

.task-status-filter-header strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.task-status-filter-header button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.task-status-filter-options {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.task-status-filter-option {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px 5px 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.task-status-filter-option:hover,
.task-status-filter-option.is-selected {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.task-status-filter-option.is-red,
.task-status.is-red {
  border-color: rgba(184, 50, 95, 0.35);
  background: #fde8ef;
  color: #9f1239;
}

.task-status-filter-option.is-green,
.task-status.is-green {
  border-color: rgba(15, 118, 110, 0.35);
  background: #d8f3ee;
  color: #115e59;
}

.task-status-filter-option.is-yellow,
.task-status.is-yellow {
  border-color: rgba(180, 83, 9, 0.35);
  background: #fef3c7;
  color: #92400e;
}

.task-status-filter-option.is-blue,
.task-status.is-blue {
  border-color: rgba(37, 99, 235, 0.32);
  background: #dbeafe;
  color: #1d4ed8;
}

.task-status-filter-option.is-neutral,
.task-status.is-neutral {
  border-color: var(--line);
  background: #e8edf3;
  color: var(--muted);
}

.task-status-filter-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.task-status-filter-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-status-filter-option small {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  border-radius: 999px;
  padding: 0 6px;
  background: #e8edf3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.task-status-filter-option.is-selected small {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-dark);
}

.task-status-filter-option.is-red small {
  background: rgba(184, 50, 95, 0.12);
  color: #9f1239;
}

.task-status-filter-option.is-green small {
  background: rgba(15, 118, 110, 0.14);
  color: #115e59;
}

.task-status-filter-option.is-yellow small {
  background: rgba(180, 83, 9, 0.14);
  color: #92400e;
}

.task-status-filter-option.is-blue small {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.task-status-filter-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.task-plan-list {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
}

.task-epic {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.task-epic.is-completed {
  border-color: rgba(15, 118, 110, 0.3);
  background: #f6fbfa;
}

.task-epic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-epic-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.task-epic-title span,
.task-epic-meta small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.task-epic-title strong {
  display: block;
  min-width: 0;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-epic-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  text-align: left;
}

.task-epic-meta span {
  display: inline-grid;
  min-width: 44px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #e8edf3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.task-epic-edit,
.task-epic-create-task {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.task-epic.is-completed .task-epic-meta span {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.task-item {
  display: grid;
  gap: 0;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.task-item:hover,
.task-item:focus-visible {
  color: var(--ink);
  outline: none;
}

.task-item:hover,
.task-item.is-selected {
  border-color: rgba(15, 118, 110, 0.48);
  background: #f6fbfa;
}

.task-item.is-selected {
  box-shadow: inset 4px 0 0 var(--accent);
}

.task-item-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 28px;
}

.task-number,
.task-status {
  display: inline-grid;
  min-width: 28px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #e8edf3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.task-status {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.task-status.is-red,
.task-status.is-green,
.task-status.is-yellow,
.task-status.is-blue,
.task-status.is-neutral {
  font-weight: 850;
}

.task-title {
  min-width: 0;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-body {
  display: none;
  gap: 8px;
  width: 100%;
  min-width: 0;
  color: #3d485c;
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.task-body p {
  margin: 0;
}

.task-body ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  white-space: normal;
}

.task-body p,
.task-body li {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.task-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.document-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
  margin: 0;
}

.document-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.document-meta dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.document-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
}

.task-plan-header .document-meta {
  grid-template-columns: repeat(4, minmax(92px, 1fr));
}

.documentation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  min-height: 0;
  min-width: 0;
}

.documentation-editor textarea {
  min-height: 460px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.documentation-preview-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  min-height: 0;
  min-width: 0;
}

.compact-title strong {
  font-size: 16px;
}

.documentation-preview {
  min-height: 0;
  max-height: none;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  color: #2d3748;
  font-size: 14px;
  line-height: 1.55;
}

.documentation-preview mark {
  border-radius: 4px;
  padding: 1px 3px;
  background: #fff1a8;
  color: #2d3748;
}

.documentation-preview h1,
.documentation-preview h2,
.documentation-preview h3,
.documentation-preview h4,
.document-modal-preview h1,
.document-modal-preview h2,
.document-modal-preview h3,
.document-modal-preview h4 {
  margin: 18px 0 8px;
  color: var(--ink);
  line-height: 1.2;
}

.documentation-preview h1:first-child,
.documentation-preview h2:first-child,
.documentation-preview h3:first-child,
.documentation-preview h4:first-child,
.document-modal-preview h1:first-child,
.document-modal-preview h2:first-child,
.document-modal-preview h3:first-child,
.document-modal-preview h4:first-child {
  margin-top: 0;
}

.documentation-preview h1,
.document-modal-preview h1 {
  font-size: 24px;
}

.documentation-preview h2,
.document-modal-preview h2 {
  font-size: 19px;
}

.documentation-preview h3,
.document-modal-preview h3 {
  font-size: 16px;
}

.documentation-preview h4,
.document-modal-preview h4 {
  font-size: 14px;
}

.documentation-preview p,
.document-modal-preview p {
  margin: 0 0 10px;
}

.documentation-preview ul,
.documentation-preview ol,
.document-modal-preview ul,
.document-modal-preview ol {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  padding-left: 22px;
}

.documentation-preview code,
.document-modal-preview code {
  border-radius: 4px;
  padding: 2px 4px;
  background: #edf2f0;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.documentation-preview pre,
.document-modal-preview pre {
  overflow: auto;
  max-width: 100%;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7f9fb;
  color: #202531;
}

.documentation-preview pre code,
.document-modal-preview pre code {
  display: block;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.generation-progress {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  padding: 14px;
  background: #f3fbf8;
}

.generation-progress div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}

.generation-progress span {
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8e6e1;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 320ms ease;
}

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

.section-title strong {
  font-size: 20px;
}

.current-question {
  display: grid;
  gap: 8px;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.current-question span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.current-question strong {
  font-size: 20px;
  line-height: 1.35;
}

.current-question p {
  margin: 0;
  white-space: pre-wrap;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 156px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.is-hidden {
  display: none !important;
}

.answer-options {
  display: grid;
  gap: 16px;
}

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

.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
  cursor: pointer;
}

.check-option:has(input:checked) {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--accent-soft);
}

.check-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-option span {
  font-size: 14px;
  font-weight: 750;
}

.custom-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.custom-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-color: rgba(15, 118, 110, 0.3);
  padding: 0 10px;
  background: #f1fbf8;
  color: var(--accent-dark);
  font-size: 13px;
}

.custom-chip:hover {
  background: var(--accent-soft);
}

.custom-chip strong {
  font-size: 16px;
  line-height: 1;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  font-size: 24px;
  line-height: 1;
}

.secondary-icon {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-icon:hover,
.secondary-button:hover {
  background: #edf2f0;
}

.secondary-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.danger-button {
  border-color: rgba(184, 50, 95, 0.34);
  background: #fff7fa;
  color: var(--error);
}

.danger-button:hover {
  background: #fce8ef;
}

.button-row {
  gap: 10px;
}

.is-busy button {
  cursor: wait;
  opacity: 0.7;
}

.status-line {
  min-height: 20px;
  color: var(--error);
  font-size: 14px;
  font-weight: 700;
}

.project-side-panel {
  min-height: 0;
}

.side-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f3f6f8;
}

.side-tab {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.side-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.side-tab.is-active {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
}

.side-tab-content,
.side-tab-panel {
  min-height: 0;
  overflow: hidden;
}

.side-tab-content {
  display: grid;
}

.side-tab-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.side-tab-panel.is-hidden {
  display: none;
}

.document-list-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.document-list {
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.document-list-toolbar button {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 13px;
}

.document-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  white-space: normal;
}

.document-list-item:hover,
.document-list-item.is-active {
  border-color: rgba(15, 118, 110, 0.48);
  background: #f6fbfa;
  color: var(--ink);
}

.document-list-item strong,
.document-list-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.document-list-item strong {
  font-size: 14px;
  line-height: 1.25;
}

.document-list-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.event-list {
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0 0 22px;
  height: 100%;
  max-height: none;
  overflow: auto;
  list-style: none;
}

.event-list li,
.project-item,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.event-list strong,
.event-list span,
.project-item strong,
.project-item span {
  display: block;
}

.event-list span,
.project-item span,
.empty {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.event-list li {
  overflow-wrap: anywhere;
}

.dark-empty {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #b9c2d0;
}

.project-list {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.project-list .section-title span {
  color: #9fd9d2;
}

.project-list .section-title strong {
  color: #ffffff;
}

.project-list-items {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 66px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  overflow: hidden;
}

.project-item:hover,
.project-item.is-active {
  border-color: rgba(216, 243, 238, 0.72);
  background: rgba(216, 243, 238, 0.12);
}

.project-item span {
  color: #b9c2d0;
}

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

.project-item-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 40px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.project-item-main:hover {
  background: transparent;
}

.project-favorite-button {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #b9c2d0;
}

.project-favorite-button:hover {
  border-color: rgba(216, 243, 238, 0.58);
  background: rgba(216, 243, 238, 0.12);
  color: #f7fafc;
}

.project-favorite-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.project-favorite-button .is-filled,
.project-item.is-favorite .project-favorite-button svg {
  fill: currentColor;
}

.project-item.is-favorite .project-favorite-button {
  border-color: rgba(216, 243, 238, 0.42);
  background: rgba(216, 243, 238, 0.16);
  color: #d8f3ee;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal.is-hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 37, 49, 0.42);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(32, 37, 49, 0.28);
}

.wide-modal {
  width: min(860px, 100%);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
}

.document-modal-panel {
  width: min(980px, 100%);
}

.project-settings-panel {
  width: min(760px, 100%);
}

.settings-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  min-height: 38px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.settings-tab-panel {
  display: grid;
  gap: 14px;
}

.project-settings-form {
  display: grid;
  gap: 14px;
}

.settings-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}

.settings-checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.settings-danger-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.github-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.telegram-settings-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.github-account-label {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.custom-document-title-field {
  margin: -6px 0 12px;
}

.document-modal-body {
  min-height: 0;
}

.document-modal-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(58vh, 620px);
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fbfcfd;
  color: #2d3748;
  font-size: 14px;
  line-height: 1.55;
}

.document-version-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
  background: #fbfcfd;
}

.document-version-switcher {
  display: inline-grid;
  grid-template-columns: 34px minmax(54px, auto) 34px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.document-version-switcher strong {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.document-version-toolbar > span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.document-version-content {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.document-version-content mark,
.document-modal-preview mark {
  border-radius: 4px;
  padding: 1px 3px;
  background: #fff1a8;
  color: #2d3748;
}

.document-modal-editor textarea {
  min-height: 420px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.document-modal-actions {
  align-items: flex-start;
  gap: 14px;
}

.document-modal-actions .button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.save-as-menu {
  position: relative;
  display: inline-flex;
}

.save-as-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  display: grid;
  min-width: 116px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.save-as-options button {
  min-height: 36px;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.save-as-options button:hover {
  background: #edf2f0;
}

.task-detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding-right: 4px;
  color: #263247;
  line-height: 1.5;
}

.wide-modal > .actions {
  align-items: flex-start;
  gap: 12px;
  min-height: 0;
}

.wide-modal > .actions .button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wide-modal > .actions button {
  min-height: 38px;
}

.task-detail h3,
.task-detail h4,
.task-detail p,
.task-detail ul,
.task-detail-grid {
  margin: 0;
}

.task-detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f3f6f8;
}

.task-detail-tab {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.task-detail-tab:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.task-detail-tab.is-active {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
}

.task-detail-tab span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-detail-tab strong {
  display: none;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--warning);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.task-detail-tab.has-update strong {
  display: grid;
}

.task-detail-section {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.task-detail [hidden] {
  display: none !important;
}

.task-detail-section + .task-detail-section {
  margin-top: 2px;
}

.task-description-detail {
  background: #fbfcfd;
}

.task-detail-empty {
  border: 1px dashed rgba(101, 112, 134, 0.34);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.agent-run-detail,
.prototype-build-detail,
.review-decision-detail {
  display: grid;
  gap: 14px;
  border-left: 4px solid rgba(15, 118, 110, 0.58);
  background: #f9fbfb;
}

.prototype-build-detail {
  border-left-color: rgba(180, 83, 9, 0.54);
}

.review-decision-detail {
  border-left-color: rgba(101, 112, 134, 0.54);
}

.task-documents-detail {
  display: grid;
  gap: 12px;
  border-left: 4px solid rgba(37, 99, 235, 0.52);
  background: #f9fbff;
}

.task-context-material-list {
  display: grid;
  gap: 8px;
}

.task-context-material {
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  padding: 7px 10px;
  background: #ffffff;
  cursor: pointer;
}

.task-context-material:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.task-context-material.is-selected {
  border-color: rgba(37, 99, 235, 0.5);
  background: #f7fbff;
}

.task-context-material input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.task-context-material-preview,
.task-context-material-icon {
  display: grid;
  width: 44px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6f8;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.task-context-material-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-context-material-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-context-material-copy span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-context-material-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.task-documents-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.task-documents-actions .status-line {
  min-width: 120px;
  margin: 0;
  text-align: right;
}

.task-detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-carousel-header {
  justify-content: flex-end;
}

.agent-run-detail p,
.prototype-build-detail p,
.review-decision-detail p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.task-detail-copy-grid > div,
.task-detail-subsection,
.review-decision-entry {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.review-decision-entry + .review-decision-entry {
  margin-top: 0;
}

.review-carousel-controls {
  display: inline-grid;
  grid-template-columns: 32px auto 32px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.review-carousel-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  font-size: 22px;
}

.review-carousel-track {
  display: grid;
  min-width: 0;
}

.task-detail-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-decision-entry h4,
.task-detail-copy-grid h4,
.task-detail-subsection h4 {
  font-size: 12px;
  font-weight: 850;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.task-review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.task-review-panel textarea {
  min-height: 96px;
}

.preview-link {
  display: inline-grid;
  width: fit-content;
  min-height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.preview-link:hover {
  background: var(--accent-dark);
}

.secondary-preview-link {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-preview-link:hover {
  background: #edf2f0;
}

.agent-summary {
  display: grid;
  gap: 10px;
}

.agent-summary-main,
.agent-summary-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.agent-summary-main {
  color: #263247;
}

.agent-summary-main p,
.agent-summary-main ul,
.agent-summary-section p,
.agent-summary-section ul {
  margin: 0;
}

.agent-summary-main p + p,
.agent-summary-main p + ul,
.agent-summary-main ul + p,
.agent-summary-main ul + ul {
  margin-top: 8px;
}

.agent-summary-section {
  display: grid;
  gap: 7px;
}

.agent-summary-section h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.agent-summary-section ul {
  display: grid;
  gap: 5px;
  padding-left: 18px;
}

.task-detail h3 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.task-detail ul {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.task-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.task-detail-grid .task-detail-wide-card {
  padding: 7px 10px;
}

.task-detail-grid dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.task-detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 750;
}

.dependency-list {
  display: grid;
  gap: 4px;
}

.dependency-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.dependency-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dependency-remove {
  flex: 0 0 auto;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 9px;
  border-color: rgba(185, 28, 28, 0.22);
  background: #fff7f7;
  color: #b91c1c;
  font-size: 12px;
}

.dependency-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 6px;
}

.dependency-add select {
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.dependency-add-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.2;
}

.modal-question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  color: #344052;
  line-height: 1.45;
}

.server-update-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: min(520px, calc(100vw - 40px));
  border: 1px solid rgba(15, 118, 110, 0.34);
  border-radius: 8px;
  padding: 14px 14px 14px 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.server-update-toast.is-hidden {
  display: none;
}

.server-update-toast strong,
.server-update-toast p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.server-update-toast strong {
  color: var(--accent-dark);
  font-size: 14px;
}

.server-update-toast p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.server-update-toast button {
  min-height: 38px;
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .mvp-command-strip {
    grid-template-columns: 1fr;
  }

  .stage-roadmap {
    grid-template-columns: repeat(7, minmax(112px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .requirement-steps {
    grid-template-columns: repeat(7, minmax(150px, 1fr));
  }

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

  .workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-header,
  .workspace-grid > .work-panel:not(#dialog-panel),
  #dialog-panel,
  #documentation-panel,
  #visual-style-panel,
  #task-plan-panel {
    grid-column: 1;
    grid-row: auto;
  }

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

  .visual-style-list,
  .visual-style-actions,
  .image-carousel {
    grid-template-columns: 1fr;
  }

  .visual-carousel {
    grid-template-columns: 1fr;
  }

  .visual-carousel-nav {
    min-height: 42px;
    width: 100%;
  }

  .visual-carousel-stage img {
    height: clamp(220px, 62vw, 420px);
  }

  .visual-carousel-footer {
    grid-template-columns: 1fr;
  }

  .image-carousel-button {
    min-height: 42px;
    width: 100%;
  }
}

@media (max-width: 860px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .shell {
    display: block;
    min-height: 100dvh;
    overflow: visible;
  }

  .sidebar {
    gap: 16px;
    padding: 14px 16px 16px;
    overflow: visible;
  }

  .workspace {
    display: grid;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 14px;
  }

  .workspace-grid {
    gap: 14px;
  }

  .project-header {
    position: relative;
    top: auto;
    z-index: 1;
    padding: 12px;
  }

  .workspace-grid > .work-panel:not(#dialog-panel),
  #documentation-panel,
  #visual-style-panel,
  #task-plan-panel {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .project-list {
    gap: 10px;
  }

  .project-list-items {
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 220px);
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .project-item {
    min-height: 60px;
  }

  .document-meta,
  .task-plan-header .document-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .task-detail-tabs {
    grid-auto-flow: column;
    grid-auto-columns: minmax(138px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
  }

  .server-update-toast {
    right: 12px;
    bottom: 12px;
    grid-template-columns: 1fr;
    width: calc(100vw - 24px);
  }

  .server-update-toast button {
    width: 100%;
  }

  .modal {
    align-items: end;
    padding: 10px;
  }

  .modal-panel,
  .wide-modal,
  .document-modal-panel {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 16px;
  }

  .document-modal-preview {
    min-height: 260px;
    max-height: 52dvh;
  }
}

@media (max-width: 680px) {
  .auth-screen {
    align-items: start;
    padding: 14px;
  }

  .auth-card {
    padding: 18px;
  }

  .approval-item {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .project-heading,
  .actions,
  .button-row,
  .documentation-header,
  .visual-style-header,
  .documentation-actions,
  .modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .visual-style-header .visual-meta {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }

  .home-screen {
    min-height: 100dvh;
    place-items: start stretch;
    padding: 14px;
  }

  .home-panel {
    width: 100%;
  }

  .home-project-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-project-card {
    aspect-ratio: auto;
    min-height: 140px;
    padding: 16px;
  }

  .brand-row {
    gap: 12px;
  }

  .brand {
    width: 100%;
  }

  .brand-row .icon-button {
    align-self: flex-start;
  }

  .stage-roadmap,
  .requirement-steps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .stage-roadmap-item,
  .requirement-step {
    min-width: min(76vw, 230px);
    scroll-snap-align: start;
  }

  .stage-roadmap-item {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 44px;
  }

  .project-header h2 {
    font-size: 22px;
  }

  .work-panel,
  .documentation-panel,
  .visual-style-panel,
  .task-plan-panel {
    gap: 14px;
    padding: 14px;
  }

  .documentation-panel,
  .task-plan-panel {
    padding-bottom: 14px;
  }

  .documentation-preview,
  .task-plan-list {
    max-height: none;
    overflow: visible;
  }

  .visual-carousel-stage img {
    height: clamp(220px, 72vw, 340px);
  }

  .visual-generation-badge {
    position: static;
    max-width: none;
    margin: 10px;
  }

  .visual-style-actions .actions {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .visual-style-actions .status-line {
    max-width: none;
    text-align: left;
  }

  .project-title-view {
    grid-template-columns: 1fr;
  }

  .project-management-actions {
    justify-content: flex-start;
  }

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

  .document-meta,
  .task-plan-header .document-meta {
    grid-template-columns: 1fr;
  }

  .task-detail-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-carousel-controls {
    justify-self: start;
  }

  .side-tabs {
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
  }

  .current-question {
    min-height: 0;
    padding: 14px;
  }

  .current-question strong {
    font-size: 18px;
  }

  .checklist,
  .custom-option-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 0;
  }

  .modal-panel,
  .wide-modal,
  .document-modal-panel {
    min-height: auto;
    max-height: 100dvh;
    border-radius: 8px 8px 0 0;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  .modal-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .modal-header .icon-button {
    width: 42px;
    align-self: flex-start;
  }

  .document-modal-preview {
    min-height: 220px;
  }

  .save-as-menu,
  .save-as-menu > button {
    width: 100%;
  }

  .save-as-options {
    right: auto;
    left: 0;
    width: 100%;
  }

  button,
  .icon-button {
    width: 100%;
  }

  .project-item-main {
    width: auto;
  }

  .project-favorite-button {
    width: 42px;
  }

  .task-detail-tab {
    width: auto;
  }

  .edit-title-button,
  .project-action-icon,
  .brand-row .icon-button {
    width: 42px;
  }
}
