:root {
  color-scheme: light;
  --ink: #172b4d;
  --muted: #6b778c;
  --line: #dfe1e6;
  --line-soft: #ebecf0;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --primary: #0c66e4;
  --primary-hover: #0055cc;
  --green: #14892c;
  --red: #c9372c;
  --blue: #0c66e4;
  --purple: #654982;
  --orange: #b65c02;
  --shadow: 0 12px 36px rgba(9, 30, 66, 0.12);
  --preview-surface: #ffffff;
  --preview-header: #f1f2f4;
  --preview-border: #c7cdd4;
  --preview-text: #172b4d;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6edf7;
  --muted: #9fadbc;
  --line: #38485f;
  --line-soft: #2d3b50;
  --surface: #1d2635;
  --canvas: #111827;
  --primary: #579dff;
  --primary-hover: #85b8ff;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.4);
  --preview-surface: #1d2635;
  --preview-header: #253247;
  --preview-border: #53647c;
  --preview-text: #e6edf7;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 1180px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, #579dff, #0c66e4 70%);
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(12, 102, 228, 0.24);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.01em;
  font-size: 16px;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a06b;
}

.save-state.saving .save-dot {
  background: #f5cd47;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.header-action-group:last-child {
  padding-right: 0;
  border-right: 0;
}

.header-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #44546f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.header-action:hover {
  background: #f1f2f4;
}

.header-action.icon-only {
  min-width: 32px;
  justify-content: center;
  padding: 0 7px;
  font-size: 19px;
}

.header-action:disabled {
  cursor: default;
  opacity: 0.35;
}

.theme-icon {
  font-size: 17px;
}

.button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  font-weight: 600;
}

.button-primary {
  color: white;
  background: var(--primary);
}

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

.button-success {
  color: white;
  background: #1f845a;
}

.button-success:hover {
  background: #216e4e;
}

.button-secondary {
  background: #e9f2ff;
  color: #0c66e4;
}

.button-ghost {
  background: transparent;
  color: #44546f;
}

.button-ghost:hover,
.button-secondary:hover {
  background: #dce8f8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 24px;
  width: min(1780px, calc(100% - 48px));
  margin: 24px auto 64px;
}

.report-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.04);
}

.report-card {
  min-width: 0;
  padding: 32px;
}

.report-heading {
  margin-bottom: 24px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-heading h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

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

.field[hidden] {
  display: none;
}

.field span {
  color: #44546f;
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  height: 40px;
  padding: 0 11px;
  border: 1px solid #b7bdc8;
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.field input:focus,
.field select:focus,
.section-title:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(12, 102, 228, 0.16);
}

#overallStatus {
  font-weight: 800;
}

.editor-toolbar {
  position: sticky;
  z-index: 25;
  top: 72px;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f7f8f9;
  box-shadow: 0 5px 12px rgba(9, 30, 66, 0.08);
}

.editor-toolbar button,
.editor-toolbar select {
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.editor-toolbar button {
  min-width: 34px;
  padding: 0 9px;
}

.editor-toolbar button:hover,
.editor-toolbar select:hover {
  background: #e9ebee;
}

.editor-toolbar select {
  padding: 0 8px;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--line);
}

.intro-editor {
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  outline: 0;
  line-height: 1.55;
}

.intro-editor:focus {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

[contenteditable="true"]:empty::before {
  color: #97a0af;
  content: attr(data-placeholder);
  pointer-events: none;
}

.sections {
  display: grid;
  min-width: 0;
  gap: 18px;
  margin-top: 28px;
}

.check-section {
  width: 100%;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.section-header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
  background: #fafbfc;
}

.check-section.collapsed .section-header {
  border-bottom: 0;
  border-radius: 9px;
}

.drag-handle {
  color: #97a0af;
  cursor: grab;
  font-weight: 700;
  letter-spacing: -3px;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.check-section.dragging {
  opacity: 0.5;
}

.check-section.drag-over {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.section-title {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
}

.section-actions {
  display: flex;
  gap: 4px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #44546f;
  font-size: 20px;
}

.icon-button:hover {
  background: #e9ebee;
}

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

.check-section.collapsed .section-content {
  display: none;
}

.check-section.collapsed .collapse-section {
  transform: rotate(180deg);
}

.column-toolbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.column-toolbar > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.column-chips {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
}

.column-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f9;
}

.column-chip input {
  width: 150px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.column-chip input:focus {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.column-chip button {
  width: 28px;
  height: 28px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}

.column-chip button:hover {
  color: var(--red);
  background: #ffebe6;
}

.add-column-button {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: var(--primary);
  background: #e9f2ff;
  font-size: 12px;
  font-weight: 650;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.check-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.number-col {
  width: 52px;
}

.status-col {
  width: 164px;
}

.dynamic-col {
  min-width: 210px;
}

.actions-col {
  width: 46px;
}

.check-table th {
  height: 42px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f1f2f4;
  color: #44546f;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.editable-column-header,
.status-header {
  position: relative;
  padding: 4px 36px 4px 27px !important;
}

.column-drag-handle {
  position: absolute;
  top: 50%;
  left: 5px;
  width: 18px;
  transform: translateY(-50%);
  cursor: grab;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: -2px;
  text-align: center;
  user-select: none;
}

.column-drag-handle:active {
  cursor: grabbing;
}

.editable-column-header.column-dragging {
  position: relative;
  opacity: 0.38;
  background: color-mix(in srgb, var(--primary) 22%, var(--surface));
}

.check-table td.column-dragging {
  opacity: 0.42;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.editable-column-header.column-drag-over-before {
  box-shadow: inset 5px 0 0 var(--primary);
}

.editable-column-header.column-drag-over-after {
  box-shadow: inset -5px 0 0 var(--primary);
}

.column-drag-ghost {
  position: fixed;
  z-index: 99999;
  top: -1000px;
  left: -1000px;
  min-width: 220px;
  padding: 14px 18px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(9, 30, 66, 0.28);
  font-weight: 750;
}

.column-resizer {
  position: absolute;
  z-index: 4;
  top: 0;
  right: -4px;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 4px;
  width: 1px;
  background: transparent;
  content: "";
}

.column-resizer:hover::after {
  background: var(--primary);
}

.editable-column-header input {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  outline: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.editable-column-header input:hover {
  border-color: #b7bdc8;
  background: var(--surface);
}

.editable-column-header input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(12, 102, 228, 0.16);
}

.status-header > span {
  display: block;
  padding: 8px 5px;
}

.column-menu-button {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--muted);
  letter-spacing: 1px;
}

.column-menu-button:hover {
  background: #dfe1e6;
  color: var(--ink);
}

.check-table th:last-child,
.check-table td:last-child {
  border-right: 0;
}

.check-table td {
  position: relative;
  min-height: 56px;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.check-table td.editor-cell {
  height: 1px;
}

.check-table tbody tr:last-child td {
  border-bottom: 0;
}

.row-number {
  padding: 14px 9px !important;
  color: var(--muted);
  text-align: center;
  font-weight: 650;
}

.cell-editor {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 58px;
  padding: 11px 10px;
  outline: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cell-editor > p:empty,
.intro-editor > p:empty {
  min-height: 1.45em;
  margin: 3px 0;
}

.cell-editor:focus {
  box-shadow: none;
}

.editor-cell:focus-within {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.status-select {
  width: calc(100% - 14px);
  min-height: 34px;
  margin: 10px 7px;
  padding: 0 24px 0 9px;
  border: 0;
  border-radius: 5px;
  outline: 0;
  font-size: 11px;
  font-weight: 800;
}

.status-select:focus {
  box-shadow: 0 0 0 2px rgba(12, 102, 228, 0.24);
}

.status-ok {
  color: #216e4e;
  background: #dcfff1;
}

.status-fail {
  color: #ae2e24;
  background: #ffeceb;
}

.status-almost {
  color: #0055cc;
  background: #e9f2ff;
}

.status-unchecked {
  color: #5e4db2;
  background: #f3f0ff;
}

.status-partial {
  color: #974f0c;
  background: #fff3eb;
}

.row-actions {
  padding-top: 8px !important;
  text-align: center;
}

.row-menu-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  letter-spacing: 1px;
}

.row-menu-button:hover {
  background: #f1f2f4;
}

.floating-context-menu {
  position: fixed;
  z-index: 500;
  width: max-content;
  min-width: 190px;
  max-width: 260px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.floating-context-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
}

.floating-context-menu button:hover {
  background: #f1f2f4;
}

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

.add-row-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: #fafbfc;
  color: var(--primary);
  font-weight: 650;
}

.add-row-button:hover {
  background: #e9f2ff;
}

.add-section-button {
  display: flex;
  width: 100%;
  height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  border: 1px dashed #8590a2;
  border-radius: 9px;
  background: transparent;
  color: #44546f;
  font-weight: 650;
}

.add-section-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f4f8ff;
}

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

.summary-card {
  position: sticky;
  top: 96px;
  padding: 20px;
}

.summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.summary-heading h2 {
  margin: 0;
  font-size: 18px;
}

.summary-total {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #0c66e4;
  background: #e9f2ff;
  font-weight: 800;
}

.summary-chart {
  display: flex;
  overflow: hidden;
  height: 10px;
  margin: 22px 0;
  border-radius: 99px;
  background: #ebecf0;
}

.chart-segment {
  transition: width 180ms ease;
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 9px;
}

.summary-color {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.summary-label {
  color: #44546f;
  font-size: 12px;
}

.summary-count {
  font-weight: 750;
}

.summary-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 30, 66, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1400px, 96vw);
  height: min(880px, 92vh);
  overflow: hidden;
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(9, 30, 66, 0.38);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.import-modal {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(920px, 94vw);
  height: min(720px, 88vh);
}

.settings-modal {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(660px, 94vw);
  height: auto;
  max-height: 90vh;
}

.settings-body {
  display: grid;
  gap: 16px;
  padding: 22px;
  overflow-y: auto;
}

.settings-note {
  padding: 12px 14px;
  border: 1px solid #85b8ff;
  border-radius: 7px;
  color: #0c66e4;
  background: #e9f2ff;
  font-size: 12px;
  line-height: 1.5;
}

.connection-state {
  padding: 11px 13px;
  border-radius: 6px;
  color: var(--muted);
  background: #f1f2f4;
  font-size: 12px;
}

.connection-state.success {
  color: #216e4e;
  background: #dcfff1;
}

.connection-state.error {
  color: #ae2e24;
  background: #ffeceb;
}

.import-body {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 22px;
}

.import-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.import-textarea {
  width: 100%;
  min-height: 360px;
  resize: none;
  padding: 16px;
  border: 1px solid #b7bdc8;
  border-radius: 7px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.import-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(12, 102, 228, 0.16);
}

.import-warning {
  padding: 10px 12px;
  border-radius: 6px;
  color: #ae2e24;
  background: #ffeceb;
  font-size: 12px;
}

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

.preview-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 22px 0;
  border-bottom: 1px solid var(--line);
}

.preview-tab {
  padding: 9px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.preview-tab.active {
  border-color: var(--primary);
  color: var(--primary);
}

.preview-body {
  overflow: auto;
  padding: 24px;
  background: #f7f8f9;
}

.jira-preview {
  min-height: 100%;
  padding: 34px;
  border: 1px solid var(--preview-border);
  border-radius: 8px;
  color: var(--preview-text);
  background: var(--preview-surface);
}

.jira-preview h1 {
  margin: 0 0 16px;
  font-size: 24px;
}

.jira-preview h2 {
  margin: 28px 0 9px;
  font-size: 19px;
}

.jira-preview table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.jira-preview th,
.jira-preview td {
  padding: 9px;
  border: 1px solid var(--preview-border);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
}

.jira-preview th {
  color: var(--preview-text);
  background: var(--preview-header);
}

.jira-preview td {
  color: var(--preview-text);
  background: var(--preview-surface);
}

.cell-code-block {
  display: block;
  position: relative;
  width: 100%;
  max-width: none;
  margin: 6px 0;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
  background: #f4f5f7;
  color: #172b4d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
}

.cell-code-block.code-collapsed {
  box-sizing: border-box;
  width: min(100%, 280px);
  min-height: 86px;
  max-height: 86px;
  padding: 42px 12px 12px;
  overflow: hidden;
  cursor: pointer;
}

.cell-code-block.code-collapsed code {
  display: block;
  overflow: hidden;
  color: transparent;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-code-block.code-collapsed::after {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  overflow: hidden;
  color: var(--muted);
  content: "Фрагмент кода";
  font-family: inherit;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-code-block.code-expanded {
  width: max-content;
  min-width: 100%;
  overflow: visible;
}

.cell-code-block.code-selected {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cell-code-block.code-selected::after {
  position: absolute;
  z-index: 3;
  right: -7px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 3px;
  background: var(--primary);
  cursor: nwse-resize;
  content: "";
}

.cell-code-block.code-dragging {
  opacity: 0.42;
}

.cell-editor.code-drop-target,
.intro-editor.code-drop-target {
  box-shadow: inset 0 0 0 3px var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.cell-code-block code,
.cell-code-block code * {
  padding: 0;
  background: transparent !important;
  font: inherit;
  white-space: pre;
}

.code-key {
  color: #0052cc;
}

.code-string {
  color: #006644;
}

.code-literal {
  color: #bf2600;
}

.code-number {
  color: #6554c0;
}

.cell-code-block::before {
  display: block;
  margin-bottom: 6px;
  color: #5e6c84;
  content: attr(data-language);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.code-controls,
.image-controls {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 5px;
}

.code-control-button,
.media-copy-button {
  display: inline-grid;
  width: 28px;
  min-height: 24px;
  padding: 0;
  place-items: center;
  border: 1px solid #b6c2cf;
  border-radius: 5px;
  color: #44546f;
  background: #ffffff;
  cursor: pointer;
  font: 700 15px/1 inherit;
}

.code-control-button:hover,
.media-copy-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cell-image {
  position: relative;
  display: block;
  width: min(100%, 520px);
  max-width: 100%;
  margin: 5px 0;
  cursor: pointer;
  user-select: none;
}

.image-controls {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.cell-image:hover .image-controls,
.cell-image.image-selected .image-controls,
.image-controls:focus-within {
  opacity: 1;
}

.cell-image img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: contain;
}

.cell-image[data-align="center"] {
  margin-right: auto;
  margin-left: auto;
}

.cell-image[data-align="right"] {
  margin-right: 0;
  margin-left: auto;
}

.cell-image.image-selected {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cell-image.image-selected::after {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 3px;
  background: var(--primary);
  cursor: nwse-resize;
  content: "";
}

body.resizing-image,
body.resizing-image *,
body.resizing-code,
body.resizing-code * {
  cursor: nwse-resize !important;
  user-select: none !important;
}

.import-source-tabs {
  display: flex;
  gap: 4px;
}

.import-source-tab {
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.import-source-tab.active {
  color: var(--primary);
  background: #e9f2ff;
}

.import-pane {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.import-pane[hidden] {
  display: none;
}

.import-summary {
  padding: 10px 12px;
  border-radius: 6px;
  color: #216e4e;
  background: #dcfff1;
  font-size: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.history-modal {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, 94vw);
  height: min(760px, 88vh);
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
}

.history-toolbar input {
  min-width: 280px;
  flex: 1;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

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

.history-list {
  display: grid;
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  padding: 18px 22px;
}

.history-empty {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-item h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.focus-exit-button {
  position: fixed;
  z-index: 90;
  right: 24px;
  bottom: 24px;
  padding: 10px 16px;
  border: 0;
  border-radius: 99px;
  color: white;
  background: var(--primary);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.app-shell.focus-mode .workspace {
  display: block;
  width: calc(100% - 32px);
  max-width: none;
  margin: 16px auto 48px;
}

.app-shell.focus-mode .report-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell.focus-mode .report-heading,
.app-shell.focus-mode .metadata-grid,
.app-shell.focus-mode .intro-editor,
.app-shell.focus-mode .summary-card {
  display: none;
}

.app-shell.focus-mode .sections {
  margin-top: 16px;
}

.app-shell.focus-mode .editor-toolbar {
  top: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-shell.focus-mode .add-section-button {
  margin-bottom: 70px;
}

.markup-preview {
  width: 100%;
  min-height: 100%;
  resize: none;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #172b4d;
  color: #e9f2ff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  background: #172b4d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1380px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .report-card {
    padding: 24px;
  }
}

:root[data-theme="dark"] .topbar {
  background: rgba(29, 38, 53, 0.96);
}

:root[data-theme="dark"] .button-ghost,
:root[data-theme="dark"] .header-action,
:root[data-theme="dark"] .field span,
:root[data-theme="dark"] .summary-label {
  color: #c7d1e0;
}

:root[data-theme="dark"] .button-secondary,
:root[data-theme="dark"] .add-column-button {
  background: #243b5a;
  color: #85b8ff;
}

:root[data-theme="dark"] .settings-note {
  color: #85b8ff;
  background: #123263;
}

:root[data-theme="dark"] .connection-state {
  background: #2d3b50;
}

:root[data-theme="dark"] .connection-state.success {
  color: #7ee2b8;
  background: #164b35;
}

:root[data-theme="dark"] .connection-state.error {
  color: #ff9c8f;
  background: #5d1f1a;
}

:root[data-theme="dark"] .cell-code-block {
  border-color: #3d506b;
  color: #e9f2ff;
  background: #101722;
}

:root[data-theme="dark"] .code-control-button,
:root[data-theme="dark"] .media-copy-button {
  border-color: #526581;
  color: #c7d1e0;
  background: #243247;
}

:root[data-theme="dark"] .cell-code-block::before {
  color: #85b8ff;
}

:root[data-theme="dark"] .code-key {
  color: #79c0ff;
}

:root[data-theme="dark"] .code-string {
  color: #a5d6ff;
}

:root[data-theme="dark"] .code-literal {
  color: #ff7b72;
}

:root[data-theme="dark"] .code-number {
  color: #d2a8ff;
}

:root[data-theme="dark"] .button-ghost:hover,
:root[data-theme="dark"] .button-secondary:hover,
:root[data-theme="dark"] .header-action:hover,
:root[data-theme="dark"] .icon-button:hover,
:root[data-theme="dark"] .editor-toolbar button:hover,
:root[data-theme="dark"] .editor-toolbar select:hover,
:root[data-theme="dark"] .row-menu-button:hover,
:root[data-theme="dark"] .floating-context-menu button:hover {
  background: #2d3b50;
}

:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .editor-toolbar,
:root[data-theme="dark"] .section-header,
:root[data-theme="dark"] .add-row-button,
:root[data-theme="dark"] .check-table th,
:root[data-theme="dark"] .preview-body,
:root[data-theme="dark"] .import-textarea {
  background: #222e3f;
  color: var(--ink);
}

:root[data-theme="dark"] .intro-editor,
:root[data-theme="dark"] .editable-column-header input:hover,
:root[data-theme="dark"] .editable-column-header input:focus,
:root[data-theme="dark"] .jira-preview {
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .check-table td {
  background: #1d2635;
}

:root[data-theme="dark"] .column-menu-button:hover {
  background: #38485f;
  color: var(--ink);
}

:root[data-theme="dark"] .status-ok {
  color: #7ee2b8;
  background: #164b35;
}

:root[data-theme="dark"] .status-fail {
  color: #ff9c8f;
  background: #5d1f1a;
}

:root[data-theme="dark"] .status-almost {
  color: #85b8ff;
  background: #123263;
}

:root[data-theme="dark"] .status-unchecked {
  color: #b8acf6;
  background: #352c63;
}

:root[data-theme="dark"] .status-partial {
  color: #fec57b;
  background: #5f3811;
}

:root[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-footer,
:root[data-theme="dark"] .import-body,
:root[data-theme="dark"] .settings-body {
  color: var(--ink);
  background: var(--surface);
}

:root[data-theme="dark"] .import-body p,
:root[data-theme="dark"] .modal-footer {
  color: var(--muted);
}

:root[data-theme="dark"] .import-source-tab.active {
  color: #85b8ff;
  background: #243b5a;
}

:root[data-theme="dark"] .import-summary {
  color: #7ee2b8;
  background: #164b35;
}
