:root {
  --cm-bg: #f4f7fb;
  --cm-surface: #ffffff;
  --cm-primary: #eba21e;
  --cm-primary-dark: #cf8b12;
  --cm-secondary: #012849;
  --cm-secondary-soft: #1f4665;
  --cm-muted: #64748b;
  --cm-border: #d7e1ee;
  --cm-success: #198754;
  --cm-warning: #fd7e14;
  --cm-danger: #dc3545;
  --cm-shadow: 0 18px 40px rgba(1, 40, 73, 0.08);
  --cm-shadow-soft: 0 8px 24px rgba(1, 40, 73, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(235, 162, 30, 0.08), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, var(--cm-bg) 100%);
  color: var(--cm-secondary);
  min-height: 100vh;
}

a {
  text-decoration: none;
}

.cm-auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

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

.cm-auth-logo {
  height: 56px;
  width: auto;
}

.cm-alert-stack {
  display: block;
}

.cm-alert-stack:empty {
  display: none;
}

.cm-layout {
  display: flex;
  min-height: 100vh;
}

.cm-sidebar {
  width: 288px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--cm-border);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  backdrop-filter: blur(10px);
}

.cm-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--cm-secondary);
  padding: 4px 2px 8px;
}

.cm-brand img {
  display: block;
  width: 148px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.cm-nav-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-nav-link {
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--cm-secondary);
  padding: 14px 16px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cm-nav-link:hover {
  background: rgba(235, 162, 30, 0.12);
  color: var(--cm-secondary);
}

.cm-nav-link.active {
  background: rgba(235, 162, 30, 0.2);
  border-color: rgba(235, 162, 30, 0.35);
  color: var(--cm-secondary);
  box-shadow: inset 0 0 0 1px rgba(235, 162, 30, 0.08);
}

.cm-sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--cm-border);
  padding-top: 18px;
}

.cm-user-mini {
  margin-bottom: 14px;
}

.cm-user-mini .name {
  margin: 0;
  font-weight: 700;
}

.cm-user-mini .email {
  margin: 0;
  color: var(--cm-muted);
  font-size: 0.9rem;
}

.cm-main {
  flex: 1;
  padding: 28px 28px 36px;
}

.cm-topbar {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: var(--cm-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.cm-page-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--cm-secondary);
}

.cm-page-subtitle {
  margin: 0;
  color: var(--cm-muted);
  font-size: 1rem;
}

.cm-card {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 24px;
  box-shadow: var(--cm-shadow-soft);
  overflow: hidden;
}

.cm-stat-card {
  padding: 24px;
}

.cm-stat-card .label {
  color: var(--cm-muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.cm-stat-card .value {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
}

.cm-section-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cm-secondary);
}

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

.cm-card .card-body {
  padding: 28px 28px 26px;
}

.cm-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.cm-panel-head-tight {
  margin-bottom: 16px;
}

.cm-table-scroll {
  overflow-x: auto;
}

.cm-table-scroll table {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
}

.cm-table-scroll .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(1, 40, 73, 0.025);
  --bs-table-striped-color: inherit;
  --bs-table-hover-bg: rgba(235, 162, 30, 0.06);
  --bs-table-hover-color: inherit;
  vertical-align: middle;
}

.cm-table-scroll .table > :not(caption) > * > * {
  padding: 18px 14px;
  border-bottom-color: #e6edf5;
}

.cm-table-scroll thead th {
  color: var(--cm-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.cm-table-scroll tbody td {
  color: var(--cm-secondary);
}

.cm-my-tests-table {
  table-layout: fixed;
  min-width: 100%;
}

.cm-my-tests-table th:nth-child(1),
.cm-my-tests-table td:nth-child(1) {
  width: 35%;
}

.cm-my-tests-table th:nth-child(2),
.cm-my-tests-table td:nth-child(2) {
  width: 9%;
}

.cm-my-tests-table th:nth-child(3),
.cm-my-tests-table td:nth-child(3) {
  width: 9%;
}

.cm-my-tests-table th:nth-child(4),
.cm-my-tests-table td:nth-child(4) {
  width: 12%;
}

.cm-my-tests-table th:nth-child(5),
.cm-my-tests-table td:nth-child(5) {
  width: 10%;
}

.cm-my-tests-table th:nth-child(6),
.cm-my-tests-table td:nth-child(6) {
  width: 10%;
}

.cm-my-tests-table th:nth-child(7),
.cm-my-tests-table td:nth-child(7) {
  width: 15%;
}

.cm-available-tests-table {
  table-layout: fixed;
  min-width: 100%;
}

.cm-available-tests-table th:nth-child(1),
.cm-available-tests-table td:nth-child(1) {
  width: 19%;
}

.cm-available-tests-table th:nth-child(2),
.cm-available-tests-table td:nth-child(2) {
  width: 49%;
}

.cm-available-tests-table th:nth-child(3),
.cm-available-tests-table td:nth-child(3) {
  width: 9%;
}

.cm-available-tests-table th:nth-child(4),
.cm-available-tests-table td:nth-child(4) {
  width: 8%;
}

.cm-available-tests-table th:nth-child(5),
.cm-available-tests-table td:nth-child(5) {
  width: 15%;
}

.cm-payments-table {
  table-layout: fixed;
  min-width: 100%;
}

.cm-payments-table th:nth-child(1),
.cm-payments-table td:nth-child(1) {
  width: 42%;
}

.cm-payments-table th:nth-child(2),
.cm-payments-table td:nth-child(2) {
  width: 16%;
}

.cm-payments-table th:nth-child(3),
.cm-payments-table td:nth-child(3) {
  width: 18%;
}

.cm-payments-table th:nth-child(4),
.cm-payments-table td:nth-child(4) {
  width: 24%;
}

.cm-results-table {
  table-layout: fixed;
  min-width: 100%;
}

.cm-results-table th:nth-child(1),
.cm-results-table td:nth-child(1) {
  width: 40%;
}

.cm-results-table th:nth-child(2),
.cm-results-table td:nth-child(2) {
  width: 18%;
}

.cm-results-table th:nth-child(3),
.cm-results-table td:nth-child(3) {
  width: 12%;
}

.cm-results-table th:nth-child(4),
.cm-results-table td:nth-child(4) {
  width: 30%;
}

.cm-cell-id,
.cm-cell-inline {
  display: inline-block;
}

.cm-cell-title {
  line-height: 1.45;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cm-cell-description {
  line-height: 1.5;
}

.cm-cell-date {
  line-height: 1.45;
  white-space: normal;
}

.cm-score-stack {
  display: grid;
  gap: 3px;
}

.cm-score-main {
  font-weight: 700;
  color: var(--cm-secondary);
}

.cm-score-sub {
  font-size: 0.84rem;
  color: var(--cm-muted);
}

.cm-cell-status {
  display: flex;
  align-items: center;
}

.cm-cell-status .cm-badge {
  min-width: 0;
  width: 100%;
  max-width: 136px;
  text-align: center;
  justify-content: center;
}

.cm-badge {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
}

.cm-badge.purchased {
  background: rgba(1, 40, 73, 0.1);
  color: var(--cm-secondary);
}

.cm-badge.in_progress {
  background: rgba(253, 126, 20, 0.15);
  color: #c75400;
}

.cm-badge.completed {
  background: rgba(25, 135, 84, 0.14);
  color: #146c43;
}

.cm-badge.paid,
.cm-badge.captured {
  background: rgba(25, 135, 84, 0.14);
  color: #146c43;
}

.cm-badge.pending,
.cm-badge.created {
  background: rgba(13, 110, 253, 0.12);
  color: #0a58ca;
}

.cm-badge.authorized {
  background: rgba(13, 110, 253, 0.12);
  color: #0a58ca;
}

.cm-badge.failed {
  background: rgba(220, 53, 69, 0.14);
  color: #b02a37;
}

.cm-badge.provisioned {
  background: rgba(25, 135, 84, 0.14);
  color: #146c43;
}

.cm-badge.signature_failed {
  background: rgba(220, 53, 69, 0.14);
  color: #b02a37;
}

.cm-badge.refunded {
  background: rgba(108, 117, 125, 0.12);
  color: #495057;
}

.cm-badge.cancelled {
  background: rgba(108, 117, 125, 0.12);
  color: #495057;
}

.cm-badge.not_purchased {
  background: rgba(108, 117, 125, 0.12);
  color: #495057;
}

.cm-input {
  border-color: var(--cm-border);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  color: var(--cm-secondary);
}

.cm-input:focus {
  border-color: rgba(235, 162, 30, 0.65);
  box-shadow: 0 0 0 0.2rem rgba(235, 162, 30, 0.14);
}

.cm-wrap-cell {
  white-space: normal;
  min-width: 280px;
  line-height: 1.6;
}

.cm-chart-wrap {
  display: block;
}

.cm-chart-svg {
  width: 100%;
  height: 280px;
  display: block;
}

.cm-chart-grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.cm-chart-area {
  fill: rgba(15, 108, 189, 0.18);
}

.cm-chart-line {
  fill: none;
  stroke: #0f6cbd;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cm-chart-meta {
  display: flex;
  justify-content: space-between;
  color: var(--cm-muted);
  margin-top: 8px;
  font-size: 0.92rem;
}

.cm-bars {
  display: grid;
  gap: 12px;
}

.cm-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 74px;
  gap: 10px;
  align-items: center;
}

.cm-bar-label {
  font-weight: 600;
  color: #334155;
}

.cm-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

.cm-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cm-primary), var(--cm-secondary));
}

.cm-bar-value {
  font-weight: 700;
  color: #1e293b;
  text-align: right;
}

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

.cm-option {
  border: 1px solid #e8edf7;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.cm-option:last-child {
  margin-bottom: 0;
}

.cm-option:hover {
  border-color: #c9d7f4;
  background: #f7faff;
}

.cm-hidden {
  display: none !important;
}

.cm-stack {
  display: grid;
  gap: 24px;
}

.cm-table-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cm-actions > * {
  margin: 0;
}

.cm-button-col {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.cm-button-col .btn {
  min-width: 0;
  width: 132px;
  max-width: 132px;
  justify-content: center;
  white-space: normal;
  line-height: 1.2;
}

.cm-result-btn {
  width: 132px;
  max-width: 132px;
}

.cm-result-open {
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  padding-inline: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cm-result-open-icon {
  font-size: 0.95rem;
  line-height: 1;
}

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

.cm-kpi-box {
  border: 1px solid var(--cm-border);
  border-radius: 18px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.95));
}

.cm-kpi-box h3 {
  margin: 0;
  font-size: 2rem;
  color: var(--cm-secondary);
}

.btn {
  border-radius: 14px;
  padding: 0.7rem 1.1rem;
  font-weight: 600;
}

.btn-sm {
  border-radius: 12px;
  padding: 0.55rem 1rem;
}

.btn-primary {
  background-color: var(--cm-primary);
  border-color: var(--cm-primary);
  color: var(--cm-secondary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--cm-primary-dark) !important;
  border-color: var(--cm-primary-dark) !important;
  color: var(--cm-secondary) !important;
}

.btn-outline-primary {
  border-color: rgba(1, 40, 73, 0.28);
  color: var(--cm-secondary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: var(--cm-secondary) !important;
  border-color: var(--cm-secondary) !important;
  color: #fff !important;
}

.btn-outline-secondary {
  border-color: rgba(1, 40, 73, 0.22);
  color: var(--cm-secondary);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  background-color: rgba(1, 40, 73, 0.08) !important;
  border-color: rgba(1, 40, 73, 0.28) !important;
  color: var(--cm-secondary) !important;
}

.btn-outline-success {
  border-color: rgba(25, 135, 84, 0.45);
  color: #146c43;
}

.btn-outline-danger {
  border-color: rgba(220, 53, 69, 0.45);
  color: #b42318;
}

.alert-info {
  background: rgba(235, 162, 30, 0.12);
  border-color: rgba(235, 162, 30, 0.28);
  color: var(--cm-secondary);
}

.alert-danger {
  border-color: rgba(220, 53, 69, 0.2);
}

.alert-success {
  border-color: rgba(25, 135, 84, 0.2);
}

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

.cm-navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--cm-border);
  box-shadow: var(--cm-shadow-soft);
}

@media (max-width: 991.98px) {
  .cm-layout {
    flex-direction: column;
  }

  .cm-sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--cm-border);
    padding: 20px 16px;
  }

  .cm-main {
    padding: 18px 16px 24px;
  }

  .cm-nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cm-topbar {
    padding: 20px;
  }

  .cm-page-title {
    font-size: 1.7rem;
  }

  .cm-card .card-body,
  .cm-stat-card {
    padding: 20px;
  }

  .cm-brand img {
    width: 132px;
  }

  .cm-my-tests-table {
    table-layout: fixed;
    min-width: 0;
  }

  .cm-available-tests-table {
    table-layout: fixed;
    min-width: 0;
  }

  .cm-results-table {
    table-layout: fixed;
    min-width: 0;
  }

  .cm-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .cm-bar-value {
    text-align: left;
  }

  .cm-kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .cm-nav-list {
    grid-template-columns: 1fr;
  }

  .cm-topbar {
    align-items: flex-start;
  }

  .cm-table-scroll .table > :not(caption) > * > * {
    padding: 14px 10px;
  }

  .cm-actions,
  .cm-button-col {
    width: 100%;
  }

  .cm-actions .btn,
  .cm-button-col .btn {
    width: 100%;
  }
}
