:root {
  --cr-red: #d40b0f;
  --cr-red-dark: #a6070a;
  --cr-ink: #1c1c1c;
  --cr-muted: #6d6262;
  --cr-line: #e6dada;
  --cr-canvas: #f7f5f4;
  --cr-surface: #fff;
  --cr-surface-soft: #fcf9f9;
  --cr-surface-tint: #f4eeee;
  --cr-control-bg: #fff;
  --cr-control-border: #cfc0c0;
  --cr-control-height: 42px;
}

.capture-relay-admin {
  max-width: 1320px;
  color: var(--cr-ink);
}

.capture-relay-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 22px 0 26px;
  padding: 24px 28px;
  overflow: hidden;
  border: 1px solid #342d2d;
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 10%, rgba(212, 11, 15, .34), transparent 35%),
    linear-gradient(135deg, #101010 0%, #242020 100%);
  box-shadow: 0 16px 38px rgba(28, 16, 16, .18);
  color: #fff;
}

.capture-relay-hero img {
  width: 190px;
  height: 100px;
  flex: 0 0 auto;
  object-fit: contain;
}

.capture-relay-hero h1 {
  margin: 0;
  color: #fff;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.4px;
}

.capture-relay-hero p:not(.capture-relay-eyebrow) {
  max-width: 760px;
  margin: 7px 0 0;
  color: #ded4d4;
  font-size: 14px;
}

.capture-relay-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 24px;
  padding: 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--cr-line);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.capture-relay-tabs::-webkit-scrollbar {
  display: none;
}

.capture-relay-tabs .nav-tab {
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 46px;
  margin: 0 0 -1px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--cr-muted);
  font-weight: 750;
  line-height: 20px;
}

.capture-relay-tabs .nav-tab:hover,
.capture-relay-tabs .nav-tab:focus {
  border-bottom-color: rgba(212, 11, 15, .38);
  background: rgba(212, 11, 15, .04);
  color: var(--cr-red-dark);
}

.capture-relay-tabs .nav-tab-active,
.capture-relay-tabs .nav-tab-active:hover,
.capture-relay-tabs .nav-tab-active:focus {
  border-bottom-color: var(--cr-red);
  background: rgba(212, 11, 15, .07);
  color: var(--cr-red-dark);
}

.capture-relay-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--cr-red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}

.capture-relay-tab-panel {
  min-width: 0;
}

.capture-relay-tab-intro {
  margin: 0 0 22px;
}

.capture-relay-tab-intro h2 {
  margin: 0 0 6px;
  color: var(--cr-ink);
  font-size: 24px;
  line-height: 1.25;
}

.capture-relay-tab-intro p {
  max-width: 820px;
  margin: 0;
  color: var(--cr-muted);
  font-size: 14px;
  line-height: 1.6;
}

body.tools_page_capture-relay .notice,
.capture-relay-hero .notice {
  border: 0;
  border-left: 3px solid rgba(255, 87, 91, .78);
  background: transparent !important;
  box-shadow: none;
  color: #e8dddd;
}

body.tools_page_capture-relay .notice-success,
.capture-relay-hero .notice-success {
  border-left-color: rgba(100, 221, 145, .82);
}

body.tools_page_capture-relay .notice-warning,
.capture-relay-hero .notice-warning {
  border-left-color: rgba(247, 197, 94, .88);
}

body.tools_page_capture-relay .notice p,
.capture-relay-hero .notice p {
  color: #e8dddd;
}

body.tools_page_capture-relay .notice a,
.capture-relay-hero .notice a {
  color: #ff9a9d;
  font-weight: 700;
}

body.tools_page_capture-relay .notice-dismiss::before,
.capture-relay-hero .notice-dismiss::before {
  color: #eadfdf;
}

.capture-relay-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 30px 0 12px;
  color: var(--cr-ink);
  font-size: 20px;
}

.capture-relay-section-title .count {
  min-width: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f6dfe0;
  color: var(--cr-red-dark);
  font-size: 12px;
  text-align: center;
}

.capture-relay-admin .widefat,
.capture-relay-settings {
  overflow: hidden;
  border: 1px solid var(--cr-line);
  border-radius: 14px;
  background: var(--cr-surface);
  box-shadow: 0 7px 22px rgba(42, 21, 21, .06);
}

.capture-relay-admin .widefat thead th {
  padding: 13px 14px;
  border-bottom-color: var(--cr-line);
  background: var(--cr-surface-tint);
  color: var(--cr-ink);
  font-weight: 700;
}

.capture-relay-admin .widefat td,
.capture-relay-admin .widefat tbody th {
  padding: 13px 14px;
  color: var(--cr-muted);
  vertical-align: middle;
}

.capture-relay-admin .widefat.striped > tbody > :nth-child(odd) {
  background-color: var(--cr-surface-soft);
}

.capture-relay-admin .button-primary,
.capture-relay-admin .button-primary:hover,
.capture-relay-admin .button-primary:focus {
  border-color: var(--cr-red-dark);
  background: var(--cr-red);
  box-shadow: none;
}

.capture-relay-admin .button {
  box-sizing: border-box;
  min-height: var(--cr-control-height);
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 600;
  line-height: calc(var(--cr-control-height) - 2px);
}

.capture-relay-settings {
  padding: 6px 28px 24px;
}

.capture-relay-settings .form-table {
  margin: 0;
}

.capture-relay-settings .form-table .capture-relay-settings-section td {
  padding: 30px 0 12px;
  border-bottom: 0;
}

.capture-relay-settings .form-table .capture-relay-settings-section:first-child td {
  padding-top: 14px;
}

.capture-relay-settings-section h3 {
  margin: 0;
  color: var(--cr-red-dark);
  font-size: 18px;
  line-height: 1.25;
}

.capture-relay-settings-section p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--cr-muted);
}

.capture-relay-settings .form-table th {
  width: 280px;
  padding: 22px 28px 22px 0;
  border-bottom: 1px solid #f0e7e7;
  color: var(--cr-ink);
  font-weight: 700;
  line-height: 1.4;
  vertical-align: top;
}

.capture-relay-settings .form-table td {
  padding: 16px 0;
  border-bottom: 1px solid #f0e7e7;
  vertical-align: top;
}

.capture-relay-admin input[type="text"],
.capture-relay-admin input[type="email"],
.capture-relay-admin input[type="number"],
.capture-relay-admin input[type="url"],
.capture-relay-admin input[type="search"],
.capture-relay-admin select {
  box-sizing: border-box;
  height: var(--cr-control-height);
  min-height: var(--cr-control-height);
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--cr-control-border);
  border-radius: 8px;
  background: var(--cr-control-bg);
  box-shadow: 0 1px 2px rgba(42, 21, 21, .04);
  color: var(--cr-ink);
  line-height: calc(var(--cr-control-height) - 2px);
}

.capture-relay-settings .capture-relay-text-control {
  width: min(100%, 560px);
}

.capture-relay-settings .capture-relay-number-control {
  width: 132px;
}

.capture-relay-admin input[type="text"]:focus,
.capture-relay-admin input[type="email"]:focus,
.capture-relay-admin input[type="number"]:focus,
.capture-relay-admin input[type="url"]:focus,
.capture-relay-admin input[type="search"]:focus,
.capture-relay-admin select:focus {
  border-color: var(--cr-red);
  box-shadow: 0 0 0 1px var(--cr-red);
  outline: 0;
}

.capture-relay-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  gap: 0;
  box-sizing: border-box;
  height: var(--cr-control-height);
  min-height: var(--cr-control-height);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--cr-control-border);
  border-radius: 8px;
  background: var(--cr-surface-tint);
}

.capture-relay-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.capture-relay-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--cr-control-height) - 2px);
  margin: 0;
  padding: 0 16px;
  border-radius: 0;
  color: var(--cr-muted);
  cursor: pointer;
  font-weight: 650;
  line-height: 1;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.capture-relay-toggle label:hover {
  background: rgba(212, 11, 15, .06);
  color: var(--cr-ink);
}

.capture-relay-toggle label:last-child {
  border-left: 1px solid var(--cr-control-border);
}

.capture-relay-toggle input:checked + label {
  background: var(--cr-red);
  box-shadow: none;
  color: #fff;
}

.capture-relay-toggle input:checked + label:hover {
  background: var(--cr-red);
  color: #fff;
}

.capture-relay-toggle input:disabled + label {
  color: #a79a9a;
  cursor: not-allowed;
  opacity: .6;
}

.capture-relay-toggle input[value="0"]:checked + label {
  background: #3a3030;
}

.capture-relay-toggle input[value="0"]:checked + label:hover {
  background: #3a3030;
}

.capture-relay-toggle input:focus-visible + label {
  outline: 2px solid var(--cr-red);
  outline-offset: 2px;
}

.capture-relay-device-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.capture-relay-admin .capture-relay-device-name {
  width: min(220px, 100%);
}

.capture-relay-platform {
  color: var(--cr-ink);
  font-weight: 700;
}

.capture-relay-device-model {
  display: block;
  margin-top: 5px;
  color: var(--cr-muted);
}

.capture-relay-inline-action {
  display: block;
  flex: 0 0 auto;
  margin: 0;
}

.capture-relay-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 14px;
}

.capture-relay-approved-table {
  min-width: 1050px;
  table-layout: auto;
}

.capture-relay-approved-table th:first-child,
.capture-relay-approved-table td:first-child {
  width: 300px;
}

.capture-relay-approved-table .capture-relay-device-name {
  width: 180px;
}

.capture-relay-approved-table th:nth-child(3),
.capture-relay-approved-table td:nth-child(3),
.capture-relay-approved-table th:nth-child(4),
.capture-relay-approved-table td:nth-child(4),
.capture-relay-approved-table th:nth-child(5),
.capture-relay-approved-table td:nth-child(5) {
  white-space: nowrap;
}

.capture-relay-approved-table .capture-relay-actions-column,
.capture-relay-approved-table .capture-relay-device-actions-cell {
  width: 244px;
  white-space: nowrap;
}

.capture-relay-device-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.wp-core-ui .capture-relay-admin .button.capture-relay-revoke {
  min-width: 82px;
  border-color: #b45309;
  background: #d97706;
  color: #fff;
  font-weight: 700;
}

.wp-core-ui .capture-relay-admin .button.capture-relay-revoke:hover,
.wp-core-ui .capture-relay-admin .button.capture-relay-revoke:focus {
  border-color: #92400e;
  background: #b45309;
  color: #fff;
}

.wp-core-ui .capture-relay-admin .button.capture-relay-danger {
  min-width: 126px;
  border-color: #9f1215;
  background: #c5161b;
  color: #fff;
  font-weight: 700;
}

.wp-core-ui .capture-relay-admin .button.capture-relay-danger:hover,
.wp-core-ui .capture-relay-admin .button.capture-relay-danger:focus {
  border-color: #780c0e;
  background: #9f1215;
  color: #fff;
}

.capture-relay-settings p.submit {
  margin: 24px 0 0;
  padding: 0;
}

.capture-relay-admin .description {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--cr-muted);
  font-size: 13px;
  line-height: 1.5;
}

.capture-relay-docs {
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.capture-relay-docs-toc {
  position: sticky;
  top: 46px;
  padding: 20px;
  border: 1px solid var(--cr-line);
  border-radius: 14px;
  background: var(--cr-surface);
  box-shadow: 0 7px 22px rgba(42, 21, 21, .06);
}

.capture-relay-docs-toc strong {
  display: block;
  margin-bottom: 10px;
  color: var(--cr-ink);
  font-size: 14px;
}

.capture-relay-docs-toc ol {
  margin: 0 0 0 20px;
}

.capture-relay-docs-toc li {
  margin: 7px 0;
}

.capture-relay-docs-toc a {
  color: var(--cr-red-dark);
  text-decoration: none;
}

.capture-relay-docs-toc a:hover,
.capture-relay-docs-toc a:focus {
  color: var(--cr-red);
  text-decoration: underline;
}

.capture-relay-docs-content {
  min-width: 0;
}

.capture-relay-docs-callout,
.capture-relay-docs-section {
  margin: 0 0 20px;
  padding: 24px 26px;
  border: 1px solid var(--cr-line);
  border-radius: 14px;
  background: var(--cr-surface);
  box-shadow: 0 7px 22px rgba(42, 21, 21, .06);
  scroll-margin-top: 48px;
}

.capture-relay-docs-callout {
  border-left: 4px solid var(--cr-red);
  background: linear-gradient(135deg, rgba(212, 11, 15, .07), var(--cr-surface));
}

.capture-relay-docs-callout > strong {
  color: var(--cr-red-dark);
  font-size: 18px;
}

.capture-relay-docs-callout p:last-child,
.capture-relay-docs-section > :last-child {
  margin-bottom: 0;
}

.capture-relay-docs-section h2 {
  margin: 0 0 14px;
  color: var(--cr-ink);
  font-size: 21px;
}

.capture-relay-docs-section p,
.capture-relay-docs-section li,
.capture-relay-docs-definitions dd {
  color: var(--cr-muted);
  font-size: 14px;
  line-height: 1.65;
}

.capture-relay-docs-section ul,
.capture-relay-docs-steps {
  margin: 12px 0 0 22px;
}

.capture-relay-docs-section li {
  margin: 8px 0;
  padding-left: 3px;
}

.capture-relay-docs-definitions {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.capture-relay-docs-definitions > div {
  padding: 14px 16px;
  border: 1px solid var(--cr-line);
  border-radius: 10px;
  background: var(--cr-surface-soft);
}

.capture-relay-docs-definitions dt {
  margin: 0 0 4px;
  color: var(--cr-ink);
  font-weight: 750;
}

.capture-relay-docs-definitions dd {
  margin: 0;
}

.capture-relay-docs-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid #d79a24;
  background: rgba(215, 154, 36, .09);
}

.capture-relay-docs-support {
  border-color: rgba(212, 11, 15, .35);
}

@media (max-width: 782px) {
  .capture-relay-hero { padding: 20px; }
  .capture-relay-hero img { width: 150px; height: 79px; }
  .capture-relay-hero h1 { font-size: 25px; }
  .capture-relay-settings { padding: 4px 16px 14px; }
  .capture-relay-settings .form-table th {
    width: auto;
    padding: 18px 0 8px;
    border-bottom: 0;
  }
  .capture-relay-settings .form-table td { padding: 0 0 18px; }
  .capture-relay-device-name-row { align-items: stretch; flex-direction: column; }
  .capture-relay-admin .capture-relay-device-name { width: 100%; }
  .capture-relay-tabs { padding: 0; }
  .capture-relay-tabs .nav-tab { padding: 11px 14px; }
  .capture-relay-docs { grid-template-columns: 1fr; gap: 18px; }
  .capture-relay-docs-toc { position: static; }
  .capture-relay-docs-callout,
  .capture-relay-docs-section { padding: 20px; }
}

@media (prefers-color-scheme: dark) {
  body.tools_page_capture-relay #wpcontent,
  body.tools_page_capture-relay #wpbody,
  body.tools_page_capture-relay #wpbody-content {
    background: #171414;
  }

  body.tools_page_capture-relay #wpbody-content {
    min-height: calc(100vh - 32px);
  }

  body.tools_page_capture-relay #wpfooter,
  body.tools_page_capture-relay #wpfooter a {
    color: #a99d9d;
  }

  .capture-relay-admin {
    --cr-red: #ef3035;
    --cr-red-dark: #ff8b8e;
    --cr-ink: #f6f1f1;
    --cr-muted: #c9bebe;
    --cr-line: #514343;
    --cr-canvas: #171414;
    --cr-surface: #241f1f;
    --cr-surface-soft: #2a2424;
    --cr-surface-tint: #332b2b;
    --cr-control-bg: #191616;
    --cr-control-border: #655454;
    padding-bottom: 36px;
  }

  .capture-relay-tabs {
    border-bottom-color: #514343;
  }

  .capture-relay-tabs .nav-tab:hover,
  .capture-relay-tabs .nav-tab:focus {
    background: rgba(239, 48, 53, .12);
    color: #ffb4b6;
  }

  .capture-relay-tabs .nav-tab-active,
  .capture-relay-tabs .nav-tab-active:hover,
  .capture-relay-tabs .nav-tab-active:focus {
    background: rgba(239, 48, 53, .16);
    color: #fff;
  }

  .capture-relay-section-title .count {
    background: #5a2527;
    color: #ffd7d8;
  }

  .capture-relay-admin .widefat,
  .capture-relay-settings,
  .capture-relay-docs-toc,
  .capture-relay-docs-callout,
  .capture-relay-docs-section {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
  }

  .capture-relay-admin .widefat td,
  .capture-relay-admin .widefat tbody th {
    border-bottom-color: #443838;
  }

  .wp-core-ui .capture-relay-admin .button:not(.button-primary):not(.capture-relay-revoke):not(.capture-relay-danger) {
    border-color: #655454;
    background: #332b2b;
    color: #f4eeee;
  }

  .wp-core-ui .capture-relay-admin .button:not(.button-primary):not(.capture-relay-revoke):not(.capture-relay-danger):hover,
  .wp-core-ui .capture-relay-admin .button:not(.button-primary):not(.capture-relay-revoke):not(.capture-relay-danger):focus {
    border-color: #8a6c6c;
    background: #413535;
    color: #fff;
  }

  .capture-relay-admin input::placeholder {
    color: #968888;
  }

  .capture-relay-settings .form-table th,
  .capture-relay-settings .form-table td {
    border-bottom-color: #3c3333;
  }

  .capture-relay-docs-note {
    background: rgba(215, 154, 36, .15);
  }
}
