: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;
}

* {
  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: 340px 1fr;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

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

.sidebar,
.workspace,
.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: grid;
  grid-template-rows: minmax(0, 7fr) minmax(220px, 3fr);
  gap: 14px;
  padding: 8px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.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: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.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: 4px;
  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: 10px 12px;
  cursor: grab;
  background: #fff;
  position: relative;
  align-items: center;
  box-shadow: 0 4px 14px rgba(31, 41, 55, 0.06);
}

.rubric-dropzone {
  height: 8px;
  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-main {
  display: grid;
  gap: 2px;
  font-size: 12px;
  min-width: 0;
}

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

.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;
}

.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 {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

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

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

.export-status-panel {
  flex: 0 0 auto;
  min-height: 132px;
  max-height: 190px;
  overflow: hidden;
}

.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-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: 128px;
  padding-right: 4px;
}

.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-error {
  font-size: 12px;
  line-height: 1.35;
}

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

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

.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;
}

.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-actions .ghost {
  width: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}

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

.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;
}

.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 {
  min-width: 340px;
  max-width: 340px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.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;
}

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

.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);
}

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

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

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

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

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