:root {
  --brand-blue: #0b74d1;
  --brand-blue-deep: #084c8d;
  --brand-green: #22a866;
  --brand-green-deep: #0e6e43;
  --ink-strong: #183247;
  --ink-soft: #567084;
  --line: rgba(13, 63, 104, 0.12);
  --panel: rgba(255, 255, 255, 0.94);
  --page-top: #edf7ff;
  --page-bottom: #f8fcfb;
  --shadow-soft: 0 24px 60px rgba(12, 54, 88, 0.12);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink-strong);
  background:
    radial-gradient(circle at top left, rgba(11, 116, 209, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(34, 168, 102, 0.14), transparent 28%),
    linear-gradient(180deg, var(--page-top), var(--page-bottom));
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
  color: var(--brand-blue-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.18rem rgba(11, 116, 209, 0.18);
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  background: rgba(248, 252, 251, 0.9);
  border-bottom: 1px solid rgba(11, 116, 209, 0.08);
}

.navbar {
  padding: 1rem 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.brand-logo {
  width: 170px;
  height: auto;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-strong);
}

.brand-tag,
.lead,
.text-muted {
  color: var(--ink-soft) !important;
}

.nav-link {
  color: var(--ink-strong);
  font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--brand-blue);
}

.btn-brand {
  color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
  box-shadow: 0 12px 24px rgba(11, 116, 209, 0.24);
}

.btn-brand:hover,
.btn-brand:focus {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue-deep), var(--brand-green-deep));
}

.btn-outline-brand {
  color: var(--brand-blue-deep);
  border: 1px solid rgba(11, 116, 209, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

.btn-outline-brand:hover,
.btn-outline-brand:focus {
  color: var(--brand-blue-deep);
  border-color: rgba(11, 116, 209, 0.4);
  background: rgba(255, 255, 255, 0.96);
}

main.container {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.app-alert {
  margin-bottom: 1.25rem;
  border: 0;
  border-radius: 16px;
}

.content-card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
}

.content-card {
  padding: 1.75rem;
}

.narrow-card {
  max-width: 900px;
  margin: 0 auto;
}

.section-heading h2,
.auth-card h1,
.dashboard-header h1 {
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.section-heading-inline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--brand-blue-deep);
  background: rgba(11, 116, 209, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-shell {
  min-height: calc(100vh - 130px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 620px);
}

.app-form .form-control {
  min-height: 48px;
  border-radius: 14px;
  border-color: rgba(11, 116, 209, 0.16);
}

.app-form textarea.form-control {
  min-height: auto;
}

.demo-box {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(11, 116, 209, 0.06);
}

.demo-grid {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.demo-grid div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-header,
.stats-grid,
.section-grid,
.details-grid {
  display: grid;
  gap: 1.5rem;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.5rem 0;
}

.admin-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-action-card {
  display: block;
  padding: 1rem;
  color: var(--ink-strong);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(12, 54, 88, 0.08);
}

.admin-action-card:hover {
  color: var(--ink-strong);
  text-decoration: none;
  border-color: rgba(11, 116, 209, 0.28);
}

.admin-action-card strong,
.admin-action-card span {
  display: block;
}

.admin-action-card strong {
  margin-bottom: 0.4rem;
  color: var(--brand-blue-deep);
}

.admin-action-card span {
  color: var(--ink-soft);
}

.stat-card {
  padding: 1.2rem;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  color: var(--brand-blue-deep);
}

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

.details-grid {
  grid-template-columns: 1.15fr 0.85fr;
  margin-bottom: 1.5rem;
}

.app-table {
  margin-bottom: 0;
}

.app-table th {
  color: var(--ink-soft);
  font-weight: 700;
  border-bottom-color: rgba(13, 63, 104, 0.12);
}

.app-table td {
  vertical-align: middle;
  border-bottom-color: rgba(13, 63, 104, 0.08);
}

.table-badge {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(34, 168, 102, 0.12);
  color: var(--brand-green-deep);
  font-weight: 700;
  font-size: 0.9rem;
}

.user-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: 1rem;
  color: var(--ink-strong);
}

.user-badge small {
  color: var(--ink-soft);
}

.notification-list,
.timeline-list {
  display: grid;
  gap: 0.9rem;
}

.notification-item,
.timeline-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(11, 116, 209, 0.08);
}

.notification-item span,
.timeline-row span,
.data-list span {
  color: var(--ink-soft);
}

.data-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.data-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.compact-list span {
  text-align: right;
}

.action-form {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(11, 116, 209, 0.05);
}

.action-form:last-child {
  margin-bottom: 0;
}

.trf-sheet {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #9aa9b5;
  box-shadow: 0 20px 55px rgba(12, 54, 88, 0.12);
}

.trf-sheet-title {
  display: grid;
  grid-template-columns: 1fr 220px 180px;
  align-items: stretch;
  border: 1px solid #748898;
  border-bottom: 0;
}

.trf-sheet-title h1 {
  margin: 0;
  padding: 0.65rem;
  font-size: 1.35rem;
  text-align: center;
  text-transform: uppercase;
}

.trf-sheet-title div,
.trf-form-grid label,
.trf-form-grid input,
.trf-form-grid select,
.trf-long-row,
.trf-sign-grid label,
.trf-sign-grid span,
.tests-table > div {
  border-left: 1px solid #748898;
  border-top: 1px solid #748898;
}

.trf-sheet-title div {
  display: grid;
  grid-template-columns: 1fr;
}

.trf-sheet-title label,
.trf-section-label,
.trf-long-row label {
  font-weight: 700;
  color: #1c3448;
}

.trf-sheet-title label,
.trf-sheet-title span {
  padding: 0.35rem 0.5rem;
}

.trf-form-grid {
  display: grid;
  grid-template-columns: 170px 1fr 170px 1fr;
  border-right: 1px solid #748898;
  border-bottom: 1px solid #748898;
}

.trf-form-grid label,
.trf-form-grid input,
.trf-form-grid select {
  min-height: 38px;
  padding: 0.45rem 0.55rem;
}

.trf-form-grid input,
.trf-form-grid select,
.trf-long-row textarea {
  width: 100%;
  border: 0;
  outline: none;
  background: #fff;
}

.trf-validation-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.45rem 0.55rem;
  border-right: 1px solid #748898;
  border-left: 1px solid #748898;
  border-bottom: 1px solid #748898;
  background: #fff;
}

.trf-span-3 {
  grid-column: span 3;
}

.trf-section-label {
  padding: 0.45rem 0.55rem;
  border-right: 1px solid #748898;
  border-left: 1px solid #748898;
  background: #f4f8fb;
}

.tests-table {
  display: grid;
  grid-template-columns: 1fr 70px 1fr 70px;
  border-right: 1px solid #748898;
  border-bottom: 1px solid #748898;
}

.tests-table > div {
  min-height: 30px;
  padding: 0.35rem 0.5rem;
}

.tests-header {
  font-weight: 700;
  text-align: center;
  background: #f4f8fb;
}

.tick-column {
  text-align: center;
}

.tick-column input {
  width: 18px;
  height: 18px;
}

.trf-long-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  border-right: 1px solid #748898;
  border-bottom: 1px solid #748898;
}

.trf-long-row label,
.trf-long-row textarea {
  padding: 0.5rem;
}

.trf-sign-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-right: 1px solid #748898;
  border-bottom: 1px solid #748898;
}

.trf-sign-grid label,
.trf-sign-grid span {
  min-height: 52px;
  padding: 0.45rem 0.55rem;
}

.trf-report-grid {
  border-top: 0;
}

.trf-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.requested-tests-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.requested-tests-panel strong {
  display: block;
  margin-bottom: 0.7rem;
}

.requested-test-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.requested-test-list span {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  color: var(--brand-green-deep);
  background: rgba(34, 168, 102, 0.12);
  font-weight: 700;
}

.admin-detail-grid {
  margin-bottom: 1.5rem;
}

.table-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.table-chip-list span {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--brand-blue-deep);
  background: rgba(11, 116, 209, 0.08);
  border: 1px solid rgba(11, 116, 209, 0.12);
  font-weight: 700;
}

.script-panel {
  margin-top: 1.5rem;
}

.script-panel pre {
  max-height: 540px;
  overflow: auto;
  padding: 1rem;
  border-radius: 8px;
  color: #163047;
  background: #f6fafc;
  border: 1px solid var(--line);
}

.license-list {
  display: grid;
  gap: 1rem;
}

.license-item {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.license-item span {
  color: var(--ink-soft);
}

code {
  color: var(--brand-blue-deep);
}

/* ── Status badge colour variants ── */
.badge-submitted    { background: rgba(11,116,209,0.12); color: #0a5da0; }
.badge-approved     { background: rgba(0,150,136,0.13);  color: #00695c; }
.badge-acknowledged { background: rgba(0,172,193,0.12);  color: #006064; }
.badge-results      { background: rgba(94,53,177,0.12);  color: #4527a0; }
.badge-changes      { background: rgba(245,124,0,0.13);  color: #bf360c; }
.badge-final        { background: rgba(34,168,102,0.16); color: var(--brand-green-deep); font-weight: 800; }
.badge-rejected     { background: rgba(211,47,47,0.1);   color: #b71c1c; }

/* ── Page-level header block ── */
.page-header-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header-block h1 {
  margin: 0.35rem 0 0;
  font-size: 1.9rem;
}

/* ── TRF header meta pills ── */
.trf-header-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.trf-meta-pill {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  background: rgba(11,116,209,0.07);
  border: 1px solid rgba(11,116,209,0.14);
  min-width: 130px;
}

.trf-meta-pill span {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trf-meta-pill strong {
  color: var(--brand-blue-deep);
  font-size: 1rem;
}

/* ── Form section cards ── */
.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-strong);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.section-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.form-fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1.5rem;
}

.form-fields-grid .form-label {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.form-fields-grid .form-control,
.form-fields-grid .form-select {
  border-radius: 10px;
  border-color: rgba(11,116,209,0.18);
  min-height: 42px;
}

.form-fields-grid .col-span-2 { grid-column: span 2; }
.form-fields-grid .col-span-3 { grid-column: span 3; }

/* ── Tests modern checkbox grid ── */
.tests-modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.6rem;
}

.test-check-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid rgba(11,116,209,0.16);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: rgba(255,255,255,0.8);
  user-select: none;
}

.test-check-item:hover {
  border-color: rgba(11,116,209,0.4);
  background: rgba(11,116,209,0.04);
}

.test-check-item.checked {
  border-color: rgba(11,116,209,0.5);
  background: rgba(11,116,209,0.07);
}

.test-check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-blue);
  flex-shrink: 0;
  margin: 0;
}

.test-check-item span {
  font-size: 0.88rem;
  line-height: 1.3;
}

.test-check-item.checked span {
  font-weight: 600;
  color: var(--brand-blue-deep);
}

/* ── Workflow stepper ── */
.workflow-stepper {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0.75rem 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 72px;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 17px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--line);
}

.step-item.step-done:not(:last-child)::after { background: var(--brand-green); }

.step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  z-index: 1;
  flex-shrink: 0;
}

.step-item.step-done     .step-circle { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.step-item.step-current  .step-circle { background: var(--brand-blue);  border-color: var(--brand-blue);  color: #fff; box-shadow: 0 0 0 4px rgba(11,116,209,0.18); }
.step-item.step-rejected .step-circle { background: #ef4444; border-color: #ef4444; color: #fff; }

.step-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink-soft);
  max-width: 80px;
  line-height: 1.3;
}

.step-item.step-current  .step-label { color: var(--brand-blue-deep); }
.step-item.step-done     .step-label { color: var(--brand-green-deep); }
.step-item.step-rejected .step-label { color: #b71c1c; }

/* ── Admin navigation tabs ── */
.admin-nav-tabs {
  display: flex;
  gap: 0.2rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
  padding-bottom: 0;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color 0.15s, background 0.15s;
}

.admin-tab:hover { color: var(--brand-blue-deep); text-decoration: none; background: rgba(11,116,209,0.05); }

.admin-tab.active {
  color: var(--brand-blue-deep);
  background: rgba(255,255,255,0.97);
  border-color: var(--line);
  border-bottom-color: rgba(255,255,255,0.97);
}

/* ── Reports page ── */
.report-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-stat-card {
  padding: 1.1rem 1.25rem;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(12,54,88,0.07);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.report-stat-card strong {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.report-stat-card span {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.status-progress-list { display: grid; gap: 0.85rem; }

.status-progress-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.status-progress-item .sp-name {
  width: 160px;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.sp-bar-wrap {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.sp-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-green));
  transition: width 0.6s ease;
}

.sp-count {
  width: 28px;
  text-align: right;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--brand-blue-deep);
}

/* ── Mail Setup ── */
.mail-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.mail-section-title:first-child { margin-top: 0; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .brand-logo { width: 130px; }
  .brand-copy, .user-badge { display: none; }

  .stats-grid,
  .admin-actions-grid,
  .section-grid,
  .details-grid { grid-template-columns: 1fr; }

  .notification-item,
  .timeline-row,
  .demo-grid div,
  .data-list div,
  .section-heading-inline { flex-direction: column; align-items: flex-start; }

  .form-fields-grid   { grid-template-columns: repeat(2, 1fr); }
  .report-stat-row    { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
  main.container { padding-top: 1.25rem; }

  .content-card,
  .stat-card { padding: 1.25rem; border-radius: 22px; }

  .trf-sheet { padding: 0.75rem; }

  .trf-sheet-title,
  .trf-form-grid,
  .trf-long-row,
  .trf-sign-grid { grid-template-columns: 1fr; }

  .tests-table { grid-template-columns: 1fr 56px; }

  .tests-table .tests-header:nth-child(3),
  .tests-table .tests-header:nth-child(4) { display: none; }

  .trf-span-3 { grid-column: auto; }

  .form-fields-grid { grid-template-columns: 1fr; }
  .form-fields-grid .col-span-2,
  .form-fields-grid .col-span-3 { grid-column: auto; }

  .report-stat-row { grid-template-columns: repeat(2, 1fr); }

  .workflow-stepper { gap: 0; }
}
