:root {
  --bg: #edf3f8;
  --paper: rgba(255, 255, 255, 0.98);
  --soft: #f5f8fb;
  --line: #d4dde7;
  --ink: #1f2937;
  --muted: #667789;
  --accent: #2f6fa3;
  --accent-dark: #25577f;
  --teal: #355c7d;
  --danger: #b34b4b;
  --selected: rgba(53, 92, 125, 0.10);
  --drop: rgba(47, 111, 163, 0.12);
  --status-green-bg: #eef8f0;
  --status-green-border: #98c8a1;
  --status-yellow-bg: #fff8df;
  --status-yellow-border: #dcc56e;
  --status-red-bg: #fff0f0;
  --status-red-border: #e1a1a1;
  --sidebar-width: 300px;
  --workspace-side-width: 300px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(47, 111, 163, 0.07), transparent 28%),
    radial-gradient(circle at top right, rgba(53, 92, 125, 0.06), transparent 28%),
    linear-gradient(180deg, #f4f8fb 0%, #e8eef4 100%);
}

.top-menu {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.top-menu-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--teal);
  color: var(--teal);
  text-decoration: none;
  font-size: 13px;
}

.top-link.active,
.top-link:hover,
.top-link:focus-visible {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.top-menu-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr) 8px var(--workspace-side-width);
  gap: 8px;
  padding: 18px;
  overflow: hidden;
}

.layout.with-main-menu {
  height: calc(100vh - 58px);
}

.sidebar,
.workspace,
.workspace-main,
.workspace-side,
.rubric-tile,
.release-column,
.workspace-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 18px 60px rgba(30, 26, 22, 0.08);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.layout-resizer {
  align-self: stretch;
  min-height: 0;
  border-radius: 999px;
  cursor: col-resize;
  position: relative;
  touch-action: none;
}

.layout-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: rgba(47, 111, 163, 0.18);
  transform: translateX(-50%);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.layout-resizer:hover::before,
.layout-resizer.is-resizing::before {
  background: rgba(47, 111, 163, 0.58);
  box-shadow: 0 0 0 4px rgba(47, 111, 163, 0.10);
}

body.is-resizing-layout,
body.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.workspace {
  display: contents;
}

.sidebar-top,
.sidebar-bottom,
.workspace {
  min-height: 0;
}

.sidebar-top,
.sidebar-bottom,
.workspace-panel {
  background: #fff;
  border-radius: 18px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 6px 8px 0;
}

.sidebar-header,
.workspace-header,
.toolbar,
.release-header,
.column-actions,
.item-actions,
.editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.sidebar-header {
  margin-bottom: 12px;
  align-items: stretch;
  flex-direction: column;
}

.sidebar-header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-items: center;
}

.sidebar-header-actions .primary,
.sidebar-header-actions .nav-link {
  width: 100%;
  min-width: 0;
}

.sidebar-header-actions .primary {
  grid-column: 1 / -1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  padding-left: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 23px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
}

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

.rubric-list {
  overflow: auto;
  display: grid;
  gap: 2px;
  align-content: start;
  grid-auto-rows: max-content;
  padding: 0 2px 0 1px;
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
}

.rubric-tile {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  cursor: grab;
  background: #fff;
  position: relative;
  align-items: center;
  box-shadow: 0 4px 14px rgba(31, 41, 55, 0.06);
}

.rubric-tile-action {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.rubric-tile-action .compact-button {
  min-width: 66px;
  padding: 5px 9px;
}

.rubric-tile.file-drop-ready {
  outline: 2px dashed var(--accent);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rubric-tile.file-uploading {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.rubric-tile.file-upload-success {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.rubric-tile.file-upload-error {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

.rubric-tile[data-upload-message]::after {
  content: attr(data-upload-message);
  position: absolute;
  right: 10px;
  bottom: 8px;
  max-width: 75%;
  font-size: 10px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rubric-tile.file-uploading::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.35);
  border-top-color: #f59e0b;
  animation: tile-spin 0.8s linear infinite;
  pointer-events: none;
}

.rubric-dropzone {
  height: 4px;
  border: 1px dashed transparent;
  border-radius: 10px;
}

.rubric-dropzone.active {
  border-color: var(--accent);
  background: var(--drop);
}

.rubric-tile.status-green,
.release-item.status-green {
  background: var(--status-green-bg);
  border-color: var(--status-green-border);
}

.rubric-tile.status-yellow,
.release-item.status-yellow {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
}

.rubric-tile.status-red,
.release-item.status-red {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
}

.rubric-tile.dragging {
  opacity: 0.6;
}

.rubric-tile.skip-next-release {
  background: #3a3a3a;
  border-color: #2b2b2b;
  color: #ffffff;
  opacity: 1;
}

.rubric-tile.skip-next-release .muted {
  color: rgba(255, 255, 255, 0.82);
}

.rubric-tile.active {
  background: #2f6fa3;
  border-color: #25577f;
  color: #ffffff;
}

.rubric-tile.active .muted {
  color: rgba(255, 255, 255, 0.86);
}

.rubric-tile.skip-next-release .handle,
.rubric-tile.active .handle {
  color: rgba(255, 255, 255, 0.94);
}

.rubric-tile.rubric-is-new .handle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  color: #ffffff;
  z-index: 1;
}

.rubric-tile.rubric-is-new .handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e03131;
  transform: translate(-50%, -50%);
  z-index: -1;
  animation: new-rubric-pulse 1.4s ease-out infinite;
}

.rubric-tile.skip-next-release::before {
  content: "Пропуск";
  position: absolute;
  right: 8px;
  top: 6px;
  font-size: 9px;
  line-height: 1;
  background: rgba(30, 41, 59, 0.82);
  color: #fff;
  padding: 2px 5px;
  border-radius: 999px;
}

@keyframes tile-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes new-rubric-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(224, 49, 49, 0.55);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 0 0 9px rgba(224, 49, 49, 0);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(224, 49, 49, 0);
  }
}

.rubric-main {
  display: grid;
  gap: 2px;
  font-size: 11px;
  min-width: 0;
}

.rubric-main strong {
  line-height: 1.2;
}

.rubric-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(145, 32, 32, 0.1);
  color: #8b1e1e;
  border: 1px solid rgba(145, 32, 32, 0.28);
}

.rubric-tile.not-in-build.active .rubric-status-badge,
.rubric-tile.not-in-build.skip-next-release .rubric-status-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.38);
}

.rubric-actions-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.rubric-context-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: 4px;
  min-width: 260px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}

.rubric-context-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  color: #111827;
  font-size: 13px;
  cursor: pointer;
}

.rubric-context-menu button:hover {
  background: #eff6ff;
}

.rubric-editor-actions {
  margin-top: 12px;
  justify-content: flex-start;
}

.rubric-editor-actions form {
  width: auto;
}

.rubric-editor-actions .ghost {
  width: auto;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.workspace-top-menu {
  height: auto;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 7px 10px;
  background: #fff;
  margin-bottom: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.workspace-top-menu .top-menu-nav {
  flex-wrap: wrap;
}

.workspace-top-menu .top-menu-user {
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 6px;
  max-width: 100%;
}

.export-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: nowrap;
  align-items: center;
}

.export-tabs .nav-link {
  flex: 1 1 0;
  min-width: 0;
}

.export-box {
  display: grid;
  gap: 10px;
  margin-top: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.export-pane {
  display: grid;
  gap: 10px;
  align-content: start;
}

.ratio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.workspace-layout {
  display: contents;
}

.workspace-main {
  padding: 10px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-side {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(280px, 1fr);
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
}

.workspace-panel {
  padding: 12px 16px 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.workspace-side .workspace-panel,
.workspace-side .workspace-top-menu {
  box-shadow: none;
}

.composer-panel {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.export-status-panel {
  min-height: 280px;
  height: auto;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.export-status-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.export-status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-status-actions .compact-button {
  min-width: 86px;
  padding: 6px 12px;
  white-space: nowrap;
}

.export-jobs {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  overflow: auto;
  flex: 1 1 auto;
  padding-right: 4px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 41, 55, 0.34);
}

.confirm-modal {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(31, 41, 55, 0.22);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.export-job {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.export-job.is-running {
  border-color: var(--accent);
}

.export-job.is-done {
  border-color: #6aa070;
}

.export-job.is-error {
  border-color: var(--danger);
}

.export-job-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.export-job-name {
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-job-kind {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.export-job-stage,
.export-job-path,
.export-job-warning,
.export-job-error {
  font-size: 12px;
  line-height: 1.35;
}

.export-job-path,
.export-job-warning,
.export-job-error {
  color: var(--muted);
  word-break: break-word;
}

.export-job-warning {
  color: #8a5a00;
}

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

.export-job-timeline {
  display: grid;
  gap: 4px;
  max-height: 92px;
  overflow: auto;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f7fbff;
  border: 1px dashed #d7e6f2;
}

.export-job-timeline-item {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  line-height: 1.25;
}

.export-job-timeline-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.export-job-timeline-stage {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.export-job-timeline-progress {
  color: #0f3f5f;
  font-variant-numeric: tabular-nums;
}

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

.progress-value {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #74a7d1);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.hidden {
  display: none !important;
}

.release-create-form,
.release-meta-form,
.item-form,
.rubric-editor-form,
.file-form {
  display: grid;
  gap: 10px;
}

.file-form[data-editor-file-dropzone] {
  border: 1px dashed transparent;
  border-radius: 14px;
  padding: 8px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.file-form[data-editor-file-dropzone].file-drop-ready {
  border-color: var(--accent);
  background: var(--drop);
}

.release-create-form {
  grid-template-columns: minmax(240px, 1.2fr) 180px auto;
  align-items: center;
}

.composer-toolbar {
  margin-bottom: 10px;
}

.workspace-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
}

.workspace-side-panel {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
}

.workspace-actions.side-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  justify-items: stretch;
}

.workspace-actions.side-actions .ghost {
  width: 100%;
}

.workspace-actions .ghost {
  width: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mode-button {
  margin-right: 28px;
  font-weight: 700;
}

.workspace-actions.side-actions .mode-button {
  margin-right: 0;
}

.import-release-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.import-release-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) 150px 190px auto;
  gap: 10px;
  align-items: center;
}

.file-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-picker-row .ghost {
  width: auto;
  flex: 0 0 auto;
}

.picked-path {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-release-result {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.import-result-summary {
  font-size: 13px;
  font-weight: 600;
}

.import-result-summary.is-success {
  color: #2f6f47;
}

.import-result-summary.is-warning {
  color: var(--danger);
}

.import-result-block {
  display: grid;
  gap: 6px;
}

.import-result-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}

.create-release-button {
  width: auto;
  min-width: 120px;
  padding-inline: 16px;
}

.release-header {
  display: grid;
  gap: 8px;
  align-items: stretch;
  cursor: grab;
}

.release-header input,
.release-header button,
.release-header form {
  cursor: auto;
}

.release-meta-form input[type="text"] {
  user-select: text;
}

.release-meta-form {
  grid-template-columns: minmax(0, 1fr) 140px;
  align-items: center;
}

.column-actions-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.column-export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.column-export-actions form,
.column-export-actions .ghost {
  width: 100%;
  margin: 0;
}

.release-kind-toggle {
  display: inline-flex;
  gap: 4px;
}

.compact-toggle {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.compact-toggle.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.release-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  height: calc(100% - 46px);
  padding-bottom: 4px;
  min-height: 0;
}

.release-column {
  flex: 0 0 var(--release-column-width, 340px);
  width: var(--release-column-width, 340px);
  min-width: var(--release-column-width, 340px);
  max-width: var(--release-column-width, 340px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.column-width-resizer {
  position: absolute;
  top: 12px;
  right: 3px;
  bottom: 12px;
  width: 10px;
  border-radius: 999px;
  cursor: col-resize;
  touch-action: none;
  z-index: 5;
}

.column-width-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: rgba(47, 111, 163, 0.14);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.column-width-resizer:hover::before,
.column-width-resizer.is-resizing::before {
  background: rgba(47, 111, 163, 0.62);
  box-shadow: 0 0 0 4px rgba(47, 111, 163, 0.10);
}

.release-column.drag-over-column {
  outline: 3px solid rgba(42, 78, 96, 0.24);
}

.column-dropzone,
.item-dropzone {
  border: 1px dashed transparent;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.item-dropzone {
  height: 7px;
}

.column-dropzone.active,
.item-dropzone.active {
  border-color: var(--accent);
  background: var(--drop);
}

.items {
  display: grid;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 18px;
}

.release-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf9;
  padding: 5px 8px;
  margin: 1px 0;
}

.release-item.selected {
  background: var(--selected);
  border-color: var(--teal);
}

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

.handle {
  color: var(--muted);
  font-weight: bold;
}

.release-item-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.release-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.release-item-title span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.release-item-line form {
  width: auto;
  min-width: 0;
  margin: 0;
}

.icon-button {
  width: 17px;
  min-width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button.danger,
.icon-button.danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.meta {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

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

.editor-subsection {
  margin-top: 18px;
}

.editor-empty,
.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.editor-files {
  margin-top: 12px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

input,
select,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff9f2;
  border-color: transparent;
}

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

.primary {
  background: var(--accent);
  color: #fff9f2;
}

.ghost {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}

.ghost:hover,
.ghost:focus-visible {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  flex: 0 0 auto;
}

.nav-link.active {
  background: var(--teal);
  color: #fff;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
}

.small {
  width: auto;
  justify-self: start;
  padding: 8px 10px;
  font-size: 12px;
}

.compact-button {
  width: auto;
  min-width: 40px;
  padding: 5px 8px;
  font-size: 12px;
}

.danger,
.danger-link {
  color: var(--danger);
  border-color: var(--danger);
}

.danger:hover,
.danger:focus-visible,
.danger-link:hover,
.danger-link:focus-visible {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.file-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 210px;
}

.file-row-actions form {
  margin: 0;
}

.file-row-actions button,
.file-action-link {
  width: auto;
  min-width: 96px;
  min-height: 35px;
}

.file-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid var(--teal);
  border-radius: 12px;
  color: var(--teal);
  text-decoration: none;
  font-size: 13px;
}

.file-action-link:hover,
.file-action-link:focus-visible {
  background: var(--teal);
  color: #fff;
}

.login-page,
.settings-page {
  min-height: calc(100vh - 58px);
  padding: 18px;
  display: grid;
  overflow: auto;
}

.converter-page {
  min-height: calc(100vh - 58px);
  padding: 18px;
  display: grid;
  place-items: start center;
  overflow: auto;
}

.converter-card {
  width: min(1120px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 18px 60px rgba(30, 26, 22, 0.08);
}

.converter-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.converter-heading .muted {
  max-width: 760px;
  margin: 0;
  line-height: 1.5;
}

.converter-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1.2fr);
  gap: 24px;
  align-items: start;
}

.converter-form {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
}

.converter-file-field {
  gap: 8px;
  padding: 14px;
  border: 1px dashed #9eb4c7;
  border-radius: 14px;
  background: #fff;
}

.converter-file-field input {
  width: 100%;
}

.converter-file-field .muted {
  font-size: 12px;
  font-weight: 400;
}

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

.converter-submit {
  min-height: 42px;
}

.converter-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.converter-status {
  padding: 10px 12px;
  border: 1px solid #9ebbd1;
  border-radius: 12px;
  background: #eef6fb;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.4;
}

.converter-status.is-error {
  border-color: #e1a1a1;
  background: #fff0f0;
  color: #8a3636;
}

.converter-status.is-success {
  border-color: #98c8a1;
  background: #eef8f0;
  color: #356b40;
}

.converter-preview {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-items: start;
}

.converter-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #1d2730;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 16px 34px rgba(31, 41, 55, 0.16);
}

.converter-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.converter-preview-frame.is-portrait {
  width: min(100%, 320px);
}

.converter-preview-frame > .muted {
  color: #aeb8c2;
}

.converter-preview-meta {
  width: 100%;
  margin: 10px 2px 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.login-page {
  place-items: center;
}

.login-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 18px 60px rgba(30, 26, 22, 0.08);
}

.login-card {
  width: min(460px, 100%);
  padding: 22px;
}

.login-form {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.login-error {
  margin-top: 12px;
  border: 1px solid #e1a1a1;
  background: #fff0f0;
  color: #8a3636;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}

.settings-card {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.settings-user-list {
  display: grid;
  gap: 10px;
}

.settings-user-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.settings-user-item.is-superadmin {
  border-color: #dcc56e;
  background: #fff8df;
}

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

.settings-user-actions,
.settings-user-delete {
  width: auto;
}

.settings-user-delete .ghost {
  width: auto;
}

.settings-new-user {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.settings-export-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.settings-export-grid h4 {
  margin: 0;
  font-size: 14px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout-resizer,
  .column-width-resizer {
    display: none;
  }

  .sidebar,
  .workspace-main,
  .workspace-side {
    min-height: auto;
  }

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

  .workspace-side {
    grid-template-rows: auto auto minmax(200px, 1fr);
  }

  .export-status-panel {
    min-height: 300px;
  }

  .release-create-form,
  .editor-grid,
  .import-release-form,
  .settings-user-form,
  .settings-export-grid,
  .converter-layout {
    grid-template-columns: 1fr;
  }

  .top-menu {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .layout.with-main-menu {
    height: calc(100vh - 90px);
  }
}
