:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --info-soft: #cffafe;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.16);
  padding: 28px;
}

.badge,
.pill,
.hint-icon {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge,
.pill.primary,
.hint-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.pill.success {
  color: var(--success);
  background: var(--success-soft);
}

.pill.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.login-card h1 {
  margin: 12px 0 8px;
  font-size: 28px;
}

.login-card p,
.help-text,
.subline,
.chart-title,
.chart-note,
.section p {
  color: var(--muted);
}

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

.login-form input,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  background: #fff;
}

.login-form label,
.field label {
  font-size: 14px;
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  background: #dc2626;
  color: #fff;
}

.error-box {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  font-size: 22px;
}

.brand span,
.nav small,
.hint,
.user-box span {
  color: rgba(255, 255, 255, 0.68);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  color: #fff;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.user-box {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.ghost-link {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
}

.main {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.topbar,
.actions,
.section-header-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-header-row {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card,
.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.section,
.form-card {
  padding: 22px;
}

.section h2,
.form-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  min-width: 1500px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: 14px;
}

.table-wrap th,
.table-wrap td {
  border-bottom: 1px solid var(--line);
}

.table-wrap th {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  vertical-align: top;
}

.table-wrap td {
  padding: 16px 14px;
  vertical-align: top;
}

.th-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  line-height: 1.25;
}

.th-center {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.cell-link,
.cell-release-task,
.cell-sprint-task {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.cell-status {
  text-align: center;
  vertical-align: middle !important;
}

.cell-center {
  text-align: center;
  white-space: nowrap;
  vertical-align: middle !important;
}

.cell-actions {
  vertical-align: middle !important;
}

.col-link {
  width: 16%;
}

.col-release-task {
  width: 18%;
}

.col-release-status {
  width: 12%;
}

.col-sprint-task {
  width: 18%;
}

.col-sprint-status {
  width: 12%;
}

.col-reopen {
  width: 5%;
}

.col-metric {
  width: 9%;
}

.col-actions {
  width: 10%;
}

.link-title {
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.subline {
  display: inline-block;
  margin-top: 4px;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.preview-inline-form {
  margin: 2px 0 0;
}

.preview-link-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
}

.preview-link-action:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.preview-link-action-icon {
  font-size: 12px;
  line-height: 1;
  flex: 0 0 auto;
}

.preview-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: #15803d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.preview-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 16px;
}

.pretest-row-critical {
  background: rgba(254, 226, 226, 0.38);
}

.pretest-row-warning {
  background: rgba(254, 243, 199, 0.38);
}

.pretest-row-info {
  background: rgba(236, 254, 255, 0.6);
}

.row-alert-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.row-alert-marker.alert-critical {
  background: #fee2e2;
  color: #dc2626;
}

.row-alert-marker.alert-warning {
  background: #fef3c7;
  color: #d97706;
}

.row-alert-marker.alert-info {
  background: #cffafe;
  color: #0891b2;
}

.metric-stack {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.metric-line {
  line-height: 1.25;
}

.metric-line.muted {
  color: var(--muted);
  font-size: 12px;
}

.estimate-check-form {
  margin: 0;
}

.estimate-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}

.estimate-check input {
  margin: 0;
}

.formula-box {
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 14px;
}

.formula-box strong {
  display: block;
  margin-bottom: 8px;
}

.formula-box ul {
  margin: 0;
  padding-left: 18px;
}

.pretest-details-modal {
  width: min(1100px, 100%);
}

.detail-text-grid {
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.process-chart-grid {
  display: grid;
  gap: 12px;
}

.process-chart-row {
  display: grid;
  grid-template-columns: 260px 1fr 130px;
  gap: 12px;
  align-items: center;
}

.process-chart-label {
  font-size: 14px;
}

.process-chart-bar {
  width: 100%;
  height: 12px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
}

.process-chart-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 999px;
}

.process-chart-value {
  font-weight: 700;
}

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

.alert-item {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.alert-item.critical {
  background: #fff1f2;
  color: #b91c1c;
  border: 1px solid #fecdd3;
}

.alert-item.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.alert-item.info {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fff;
}

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

.chart-value {
  font-size: 28px;
  font-weight: 800;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.form-stack {
  display: grid;
  gap: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.one {
  grid-template-columns: 1fr;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

.toggle-grid {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
}

.toggle-row strong {
  display: block;
  margin-bottom: 4px;
}

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

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

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #111827;
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  z-index: 9999;
}

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

.hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #2563eb;
  background: #dbeafe;
  cursor: help;
  text-decoration: none;
  user-select: none;
  flex: 0 0 18px;
}

.row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 88px;
}

.row-actions .link-action {
  width: 100%;
}

.link-action {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.link-action.open {
  color: #2563eb;
}

.link-action.delete {
  color: #dc2626;
}

.link-action:hover {
  text-decoration: underline;
}

.pill-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
  width: 100%;
  max-width: 170px;
  min-height: 42px;
  padding: 9px 12px;
  box-sizing: border-box;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.details-modal {
  width: min(1040px, 100%);
}

.delete-modal {
  width: min(560px, 100%);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 26px;
}

.modal-header p {
  margin: 6px 0 0;
  color: #6b7280;
  line-height: 1.45;
}

.modal-content {
  padding: 14px 24px 24px;
  display: grid;
  gap: 18px;
}

.close {
  border: 0;
  background: #f3f4f6;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  flex: 0 0 auto;
}

.delete-note {
  padding: 14px 16px;
  border: 1px solid #fee2e2;
  background: #fff7f7;
  color: #7f1d1d;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.page-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  background: #dbeafe;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.details-task-card {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 18px;
  background: #ffffff;
}

.details-task-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.details-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.details-task-meta span {
  font-size: 13px;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 6px 10px;
}

.details-timeline {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.details-timeline-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.details-timeline-row > div:first-child {
  min-width: 0;
  line-height: 1.35;
}

.details-timeline-row > strong {
  display: block;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.details-bar {
  width: 100%;
  height: 10px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
  align-self: center;
}

.details-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 999px;
}

.details-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.details-metric-box {
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
}

.details-metric-box .label {
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
}

.details-metric-box .value {
  font-size: 24px;
  font-weight: 800;
}

.field-hint {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.inline-warning {
  min-height: 20px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #b45309;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.inline-warning.show {
  opacity: 1;
}

.status-default {
  background: #f3f4f6;
  color: #374151;
}

.status-reopened {
  background: #fce7f3;
  color: #c026d3;
}

.status-in-progress {
  background: #dbeafe;
  color: #2563eb;
}

.status-cannot-reproduce {
  background: #fee2e2;
  color: #dc2626;
}

.status-pending {
  background: #fef3c7;
  color: #d97706;
}

.status-upload-to-test-bench {
  background: #ccfbf1;
  color: #0f766e;
}

.status-to-test {
  background: #ede9fe;
  color: #7c3aed;
}

.status-testing {
  background: #fef3c7;
  color: #ca8a04;
}

.status-product-review {
  background: #ffedd5;
  color: #ea580c;
}

.status-publish {
  background: #dcfce7;
  color: #16a34a;
}

.status-closed {
  background: #dcfce7;
  color: #166534;
}

.release-status-testing {
  background: #ede9fe;
  color: #7c3aed;
}

.release-status-bugs {
  background: #fee2e2;
  color: #dc2626;
}

.release-status-product-review {
  background: #ffedd5;
  color: #ea580c;
}

.release-status-release {
  background: #dcfce7;
  color: #16a34a;
}

.release-status-ready-for-test {
  background: #dbeafe;
  color: #2563eb;
}

.release-status-pending-product {
  background: #fef3c7;
  color: #d97706;
}

.release-status-fallback {
  background: #fce7f3;
  color: #c026d3;
}

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

  .sidebar {
    display: none;
  }

  .charts-grid,
  .form-grid.five,
  .form-grid.four,
  .form-grid.three,
  .form-grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .details-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .process-chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .page-shell {
    padding: 18px;
  }

  .charts-grid,
  .form-grid.five,
  .form-grid.four,
  .form-grid.three,
  .form-grid.two,
  .details-metrics-grid {
    grid-template-columns: 1fr;
  }

  .page-header-row,
  .form-actions,
  .modal-actions,
  .modal-header,
  .section-header-row {
    flex-direction: column;
  }

  .form-actions .btn,
  .page-header-row .btn,
  .modal-actions .btn,
  .section-header-row .btn {
    width: 100%;
  }

  .details-timeline-row {
    grid-template-columns: 1fr;
  }

  .details-timeline-row > strong {
    text-align: left;
  }
}