:root {
  color-scheme: light;
  --cp-bg: #fbfaff;
  --cp-surface: #ffffff;
  --cp-surface-strong: #f7f4fd;
  --cp-border: #e6dff8;
  --cp-text: #17113a;
  --cp-muted: #6f6790;
  --cp-accent: #7b4dcc;
  --cp-accent-strong: #4b2e83;
  --cp-primary: #7b4dcc;
  --cp-primary-strong: #6f3fbd;
  --cp-success: #16a34a;
  --cp-warning: #f59e0b;
  --cp-danger: #ef4444;
  --cp-shadow: 0 14px 40px rgba(75, 46, 131, 0.08);
  --cp-shadow-soft: 0 8px 24px rgba(75, 46, 131, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 0%, rgba(220, 207, 255, 0.34), transparent 32%),
    linear-gradient(180deg, #fbfaff 0%, #f7f4fd 100%);
  color: var(--cp-text);
  font-family: Aptos, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.cp-body,
.cp-login-body {
  min-height: 100vh;
}

.cp-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid rgba(230, 223, 248, 0.78);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.cp-brand,
.cp-login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
}

.cp-brand > img:first-child,
.cp-login-brand > img:first-child {
  width: 32px;
  height: 32px;
}

.cp-brand-wordmark {
  display: block;
  width: 146px;
  max-width: 38vw;
  height: auto;
  max-height: 30px;
  object-fit: contain;
}

.cp-brand strong,
.cp-login-brand strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid rgba(123, 77, 204, 0.28);
  border-radius: 6px;
  background: #f3f1fb;
  color: var(--cp-accent-strong);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.cp-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.cp-nav a,
.cp-secondary-button,
.cp-primary-button,
.cp-user button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.cp-nav a {
  color: var(--cp-muted);
}

.cp-nav a.is-active,
.cp-nav a:hover {
  background: var(--cp-surface-strong);
  color: var(--cp-text);
}

.cp-user {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  color: var(--cp-muted);
}

.cp-user button,
.cp-secondary-button {
  border: 1px solid var(--cp-border);
  background: var(--cp-surface);
  color: var(--cp-text);
  box-shadow: var(--cp-shadow-soft);
}

.cp-primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--cp-primary), #a97cf2);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(123, 77, 204, 0.22);
}

.cp-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 72px;
}

.cp-hero,
.cp-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.cp-hero h1,
.cp-page-heading h1 {
  margin: 6px 0 8px;
  font-size: 2.25rem;
  line-height: 1.08;
}

.cp-hero p,
.cp-page-heading p,
.cp-panel-header p,
.cp-empty p {
  margin: 0;
  color: var(--cp-muted);
}

.cp-eyebrow {
  color: var(--cp-accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cp-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.cp-metric-card,
.cp-panel {
  border: 1px solid var(--cp-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfaff 100%);
  box-shadow: var(--cp-shadow);
}

.cp-metric-card {
  padding: 22px;
}

.cp-metric-card span,
.cp-metric-card small {
  display: block;
  color: var(--cp-muted);
}

.cp-metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 2rem;
}

.cp-metric-card.is-ok {
  border-color: rgba(22, 163, 74, 0.24);
}

.cp-metric-card.is-warning {
  border-color: rgba(245, 158, 11, 0.34);
}

.cp-panel {
  padding: 20px;
}

.cp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.cp-panel-header h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.cp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #f3f1fb;
  color: var(--cp-accent-strong);
  font-weight: 800;
}

.cp-layout-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.35fr);
  gap: 18px;
}

.cp-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #efe9fb;
  border-radius: 8px;
}

.cp-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.cp-table th,
.cp-table td {
  padding: 15px 14px;
  border-bottom: 1px solid #efe9fb;
  text-align: left;
  vertical-align: middle;
}

.cp-table th {
  color: var(--cp-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.cp-table td strong,
.cp-table td small {
  display: block;
}

.cp-table td small {
  margin-top: 3px;
  color: var(--cp-muted);
}

.cp-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f2e8ff;
  color: var(--cp-accent-strong);
  font-weight: 800;
}

.cp-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cp-form label,
.cp-form .cp-field-wide {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.cp-form label span {
  color: var(--cp-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.cp-form input,
.cp-form select,
.cp-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--cp-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--cp-text);
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(75, 46, 131, 0.035);
}

.cp-form input:focus,
.cp-form select:focus,
.cp-form textarea:focus {
  border-color: #a97cf2;
  box-shadow: 0 0 0 3px rgba(169, 124, 242, 0.18), var(--cp-shadow-soft);
  outline: none;
}

.cp-form textarea {
  resize: vertical;
}

.cp-form small {
  color: var(--cp-muted);
}

.cp-field-wide,
.cp-form .cp-primary-button,
.cp-login-form .cp-primary-button {
  grid-column: 1 / -1;
}

.cp-alert {
  margin-bottom: 16px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  padding: 12px 14px;
}

.cp-empty {
  padding: 32px;
  border: 1px dashed var(--cp-border);
  border-radius: 8px;
  text-align: center;
}

.cp-empty h3 {
  margin: 0 0 8px;
}

.cp-definition-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.cp-definition-list div {
  padding-bottom: 12px;
  border-bottom: 1px solid #efe9fb;
}

.cp-definition-list dt {
  color: var(--cp-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cp-definition-list dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.cp-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.cp-login-panel {
  width: min(430px, 100%);
  border: 1px solid var(--cp-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--cp-shadow);
  padding: 30px;
}

.cp-login-brand {
  margin-bottom: 28px;
}

.cp-login-heading h1 {
  margin: 8px 0;
  font-size: 1.85rem;
}

.cp-login-heading p {
  margin: 0 0 20px;
  color: var(--cp-muted);
}

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

@media (max-width: 880px) {
  .cp-topbar,
  .cp-hero,
  .cp-page-heading {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .cp-topbar,
  .cp-hero,
  .cp-page-heading,
  .cp-user,
  .cp-nav {
    justify-content: flex-start;
  }

  .cp-metric-grid,
  .cp-layout-grid,
  .cp-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .cp-topbar {
    padding: 16px 20px;
    gap: 14px;
  }

  .cp-brand {
    flex-wrap: wrap;
  }

  .cp-main {
    width: min(100% - 32px, 1180px);
    padding: 40px 0 56px;
  }

  .cp-hero h1,
  .cp-page-heading h1 {
    font-size: 2rem;
  }

  .cp-table-wrap {
    overflow: visible;
    border: 0;
  }

  .cp-table,
  .cp-table thead,
  .cp-table tbody,
  .cp-table tr,
  .cp-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .cp-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .cp-table tbody {
    display: grid;
    gap: 12px;
  }

  .cp-table tr {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    background: var(--cp-surface);
  }

  .cp-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 0;
    border: 0;
    text-align: right;
  }

  .cp-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--cp-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
  }

  .cp-table td:first-child {
    display: block;
    text-align: left;
  }

  .cp-table td:first-child::before {
    display: none;
  }

  .cp-table td small {
    overflow-wrap: anywhere;
  }

  .cp-table .cp-secondary-button {
    min-height: 36px;
    padding: 0 12px;
  }
}
