/* Tracking Code page only. Uses shared CRM theme tokens and components. */
.tc-page { min-width: 0; }
.tc-main { min-width: 0; }
.tc-page .set-head { margin-bottom: var(--sp-4); }
.tc-page .set-head__title { font-size: clamp(22px, 2vw, 28px); }
.tc-page .set-tabs { margin-bottom: 0; }
.tc-page .set-tabs--boxed { border-bottom: 1px solid var(--border); }
.tc-page .tc-panel { min-width: 0; padding-top: var(--sp-5); }
.tc-page .tc-panel[hidden] { display: none !important; }
.tc-section { max-width: none; padding: 0 0 var(--sp-5); margin: 0 0 var(--sp-5); border-bottom: 1px solid var(--border); }
.tc-heading { margin: 0 0 4px; font-size: 16px; line-height: 1.4; font-weight: 700; color: var(--text); }
.tc-copy { margin: 0 0 10px; max-width: 920px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.tc-copy a, .tc-add-domain { color: var(--brand); font-weight: 600; text-decoration: none; }
.tc-copy a:hover, .tc-add-domain:hover { text-decoration: underline; }
.tc-copy--small { margin-bottom: 8px; font-size: 12.5px; }
.tc-field-heading { margin: 12px 0 4px; font-size: 13px; font-weight: 700; }
.tc-codebox { position: relative; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.tc-codebox pre { margin: 0; padding: 18px 16px; padding-right: 100px; overflow-x: auto; white-space: pre; color: var(--text); font: 12px/1.7 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
[data-theme="dark"] .tc-codebox { background: var(--surface-3, #171b24); }
.tc-codebox .tc-copy-code { position: absolute; top: 8px; right: 8px; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tc-actions .icon { flex: none; }
.tc-validate { padding-top: 0; }
.tc-validate-form { max-width: 480px; }
.tc-validate-form .input { width: 100%; }
.tc-validate-form .field__help { margin: 4px 0 10px; }
.tc-validate-form .field__error { display: none; }
.tc-validate-form.is-invalid .field__error { display: block; }
.tc-feedback { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); background: var(--surface-2); font-size: 13px; }
.tc-wordpress { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.tc-accordion { display: flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tc-accordion__chevron { display: inline-flex; transition: transform .16s ease; }
.tc-accordion[aria-expanded="true"] .tc-accordion__chevron { transform: rotate(90deg); }
.tc-accordion__content { padding: 14px 0 0 24px; max-width: 560px; }
.tc-portal-row { display: flex; align-items: flex-end; gap: 10px; max-width: 460px; }
.tc-portal-row .field { flex: 1; min-width: 0; }
.tc-portal-row .btn-crm { margin-bottom: 1px; }
.tc-domain-section { border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.tc-domain-list { border-bottom: 1px solid var(--border); }
.tc-domain-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 180px) auto; gap: 16px; align-items: center; min-height: 44px; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.tc-domain-row:last-child { border-bottom: 0; }
.tc-domain-type { color: var(--text-muted); }
.tc-domain-row .btn-crm { justify-self: end; }
.tc-add-domain { display: inline-flex; align-items: center; gap: 5px; padding: 10px 0; border: 0; background: transparent; font: inherit; font-size: 13px; cursor: pointer; }
.tc-add-domain-form { padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; max-width: 600px; }
.tc-add-domain-controls { display: flex; gap: 8px; align-items: center; }
.tc-add-domain-controls .input { flex: 1; min-width: 100px; }
.tc-add-domain-form .field__error { display: none; }
.tc-add-domain-form.is-invalid .field__error { display: block; }
.tc-settings-list { max-width: none; }
.tc-settings-list .su-toggle { padding: 15px 0; }
.tc-settings-list .su-toggle__body { padding-right: 12px; }
.tc-settings-list .su-toggle__desc { max-width: 760px; }
.tc-exclude-section { max-width: 760px; padding-top: 20px; }
.tc-ip-value { margin: 0 0 16px; color: var(--text-muted); font-size: 13px; }
.tc-exclude-section .field { max-width: 720px; }
.tc-email-code { min-height: 76px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; }
#dev-dialog,
dialog.set-modal.tc-dialog:not(.set-modal--drawer) {
  width: min(560px, calc(100vw - 32px));
  max-width: 560px;
  height: fit-content;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 10px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg, 0 20px 60px rgba(16,24,40,.22));
  overflow: hidden;
}
#dev-dialog::backdrop,
dialog.set-modal.tc-dialog:not(.set-modal--drawer)::backdrop {
  background: rgba(16,24,40,.42);
}
#dev-dialog .set-modal__body { padding: 20px 20px 0px 20px;  }
#dev-dialog .set-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
@media (max-width: 767px) {
  .tc-page .settings__main { min-width: 0; }
  .tc-page .set-head__title { font-size: 22px; }
  .tc-page .set-tabs--boxed { overflow-x: auto; max-width: 100%; }
  .tc-page .set-tab { flex: 0 0 auto; white-space: nowrap; }
  .tc-codebox pre { padding: 54px 12px 14px; font-size: 11px; }
  .tc-codebox .tc-copy-code { left: 10px; right: auto; top: 10px; }
  .tc-domain-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .tc-domain-type { grid-column: 1; grid-row: 2; }
  .tc-domain-row .btn-crm { grid-column: 2; grid-row: 1 / span 2; }
  .tc-add-domain-controls { flex-wrap: wrap; }
  .tc-add-domain-controls .input { flex-basis: 100%; }
  .tc-portal-row { align-items: stretch; }
  .tc-portal-row .btn-crm { align-self: flex-end; }
  #dev-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  #dev-dialog .set-modal__body { overflow-y: auto; max-height: calc(100dvh - 180px); }
}


/* Reference-matched tracking page interactions */
.tc-domain-header { display:grid; grid-template-columns:minmax(0,1fr) minmax(90px,180px) auto; gap:16px; padding:12px; border-bottom:1px solid var(--border); color:var(--text-muted); font-size:12px; }
.tc-domain-row { min-height:72px; padding:12px; }
.tc-settings-list { border:1px solid var(--border); border-radius:var(--radius-lg,12px); overflow:hidden; }
.tc-settings-list .su-toggle { display:flex; align-items:center; min-height:72px; padding:14px 16px; border-bottom:1px solid var(--border); }
.tc-settings-list .su-toggle:last-child { border-bottom:0; }
.tc-settings-list .su-toggle__body { order:1; flex:1; }
.tc-settings-list .su-toggle > .switch { order:2; flex:0 0 auto; margin-left:18px; }
.tc-settings-list .su-toggle__title { font-size:14px; font-weight:700; }
.tc-settings-list .su-toggle__desc { max-width:100%; margin:3px 0 0; line-height:1.55; }
.tc-exclude-section { max-width:none; padding-top:22px; }
.tc-exclude-section .field { max-width:none; }
.tc-exclude-field { margin-top:22px; }
.tc-exclude-field .field__help { margin:3px 0 8px; max-width:none; }
.tc-exclude-field textarea.input { width:100%; min-height:96px; resize:vertical; }
.tc-dialog .set-modal__head { min-height:68px; padding:18px 28px; }
.tc-dialog .set-modal__title { font-size:20px; font-weight:700; }
.tc-domain-dialog.tc-dialog {
  width: min(450px, calc(100vw - 32px));
  max-width: 450px;
}
.tc-email-body { overflow-y:auto; max-height:calc(100dvh - 180px); }
.tc-email-body .field__label { margin-bottom:7px; }
.tc-email-body .input { width:100%; min-height:41px; }
.tc-email-body .field__error { display:none; }
.tc-email-body .field.is-invalid .field__error { display:block; }
.tc-preview-toggle { display:flex; align-items:center; gap:8px; border:0; background:transparent; padding:4px 0 10px; color:var(--text); font:inherit; font-size:14px; cursor:pointer; }
.tc-preview-chevron { display:inline-flex; transition:transform .15s ease; }
.tc-preview-toggle[aria-expanded="true"] .tc-preview-chevron { transform:rotate(90deg); }
.tc-email-preview { height:min(500px,58vh); overflow:auto; border:1px solid var(--border-strong); border-radius:16px; padding:12px 16px 20px; background:var(--surface); }
.tc-email-preview[hidden] { display:none!important; }
.tc-email-brand { text-align:center; color:#f15a24; font-size:29px; font-weight:800; letter-spacing:-1.4px; padding:4px 0 12px; border-bottom:1px solid var(--border); }
.tc-email-content { font-size:14px; line-height:1.65; color:var(--text); }
.tc-email-content p { margin:10px 0; }
.tc-email-content pre { white-space:pre-wrap; overflow-wrap:anywhere; font:12px/1.6 var(--font-mono,monospace); }
.tc-email-content a { color:var(--brand-ink,var(--brand)); font-weight:600; overflow-wrap:anywhere; }
.tc-email-content ul { padding-left:22px;list-style: disc;}
.tc-email-foot { justify-content:flex-start!important; border-top:0!important; }
.tc-email-foot .btn-crm { min-width:84px; border-radius:999px; }
.tc-domain-dialog { width:min(450px,calc(100vw - 32px)); max-width:450px; }
.tc-domain-dialog .set-modal__foot { justify-content:flex-start; border-top:0; }
.tc-domain-dialog .field__error { display:none; }
.tc-domain-dialog .field.is-invalid .field__error { display:block; }
.tc-domain-dialog [data-tc-domain-save]:disabled { opacity:.45; cursor:not-allowed; }
.tc-validate-form .field__label { display:block; }
.tc-validate-form .input { max-width:675px; }
.tc-validate-form .field__help { font-weight:600; }
.tc-validate-form .tc-url-valid { color:var(--brand-ink,var(--brand)); font-size:13px; font-weight:600; margin:5px 0 10px; }
.tc-validate-form .tc-url-invalid { color:var(--danger,var(--text)); }
@media(max-width:767px) {
 .tc-domain-header { grid-template-columns:minmax(0,1fr) auto; }
 .tc-domain-header span:last-child { display:none; }
 .tc-settings-list .su-toggle { align-items:flex-start; padding:14px 12px; }
 .tc-settings-list .su-toggle > .switch { margin-left:10px; }
 .tc-email-body { padding:20px 18px 12px!important; }
 .tc-email-foot { padding:10px 18px 18px!important; }
 .tc-domain-dialog .set-modal__body { padding:20px 20px 10px; }
 .tc-domain-dialog .set-modal__foot { padding:12px 20px 20px; }
 .tc-domain-row { grid-template-columns:minmax(0,1fr) auto; }
}

/* Embed snippet uses the dark code surface shown in the reference. */
.tc-codebox { background:#111!important; border-color:#303030; border-radius:6px; }
.tc-codebox pre { color:#f4f4f4; min-height:154px; padding:14px 16px; }
.tc-codebox .tc-copy-code { position:static; }
.tc-actions .btn-crm { border-radius:999px; }
.tc-validate-form .input { max-width:675px; }
@media(max-width:767px) { .tc-codebox pre { padding:14px 12px; min-height:130px; } }


/* Tracking URL validation: show one clear inline message, using the CRM form styles. */
.tc-validate-form .tc-feedback {
  margin: 5px 0 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.45;
}
.tc-validate-form .tc-url-invalid { color: var(--danger, #c01048); }
.tc-validate-form .tc-url-valid { color:var(--success) }

/* Keep enabled tracking switches on the CRM brand blue, never black. */
.tc-settings-list .switch input:checked + .switch__track {
  background: var(--brand-ink, var(--brand));
}
.tc-settings-list .switch input:focus-visible + .switch__track {
  box-shadow: var(--focus-ring);
}


/* Reference-style segmented ON/OFF control for tracking settings. */
.tc-settings-list .switch { width:100px; height:40px; align-items:stretch; }
.tc-settings-list .switch__track {
  display:block; width:100%; height:100%; position:relative; overflow:hidden;
  border:1px solid var(--border-strong); border-radius:5px;
  background:var(--surface-2); box-sizing:border-box;
}
.tc-settings-list .switch__track::before {
  content:"OFF"; position:absolute; inset:0 0 0 40px; display:flex; align-items:center; justify-content:center;
  color:var(--text); font-size:12px; font-weight:700; background:var(--surface-2);
}
.tc-settings-list .switch__track::after {
  content:""; position:absolute; top:0; left:0; width:38px; height:38px;
  border:1px solid var(--border-strong); border-radius:4px; background:var(--surface);
  box-shadow:none; transform:none; box-sizing:border-box;
}
.tc-settings-list .switch input:checked + .switch__track {
  background:var(--surface); border-color:var(--border-strong);
}
.tc-settings-list .switch input:checked + .switch__track::before {
  content:"ON"; inset:0 40px 0 0; color:var(--brand-contrast); background:var(--brand-ink, var(--brand));
}
.tc-settings-list .switch input:checked + .switch__track::after {
  content:"";
  left:auto;
  right:0;
  display:block;
  color:var(--brand-ink, var(--brand));
  font-size:0;
  font-weight:400;
  transform:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232456e6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:center;
  background-size:20px 20px;
}
.tc-settings-list .switch input:focus-visible + .switch__track { box-shadow:var(--focus-ring); }
@media(max-width:767px) { .tc-settings-list .switch { width:92px; height:38px; } .tc-settings-list .switch__track::after { width:36px; height:36px; } .tc-settings-list .switch input:checked + .switch__track::before { inset:0 36px 0 0; } .tc-settings-list .switch__track::before { inset:0 0 0 36px; } }


/* Final CRM tracking-page refinements: blue/white buttons and a single URL error. */
.tc-page .btn-crm,
#dev-dialog .btn-crm,
#tc-domain-dialog .btn-crm,
body:has(.tc-page) .save-bar .btn-crm {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
}
.tc-page .btn-crm--primary,
#dev-dialog .btn-crm--primary,
#tc-domain-dialog .btn-crm--primary,
body:has(.tc-page) .save-bar .btn-crm--primary {
  color: var(--brand-contrast, #fff);
  background: var(--brand, #2456e6);
  border-color: var(--brand, #2456e6);
}
.tc-page .btn-crm--primary:hover,
#dev-dialog .btn-crm--primary:hover,
#tc-domain-dialog .btn-crm--primary:hover,
body:has(.tc-page) .save-bar .btn-crm--primary:hover {
  color: var(--brand-contrast, #fff);
  background: var(--brand-hover, #1c46c4);
  border-color: var(--brand-hover, #1c46c4);
}
.tc-page .btn-crm--outline,
#dev-dialog .btn-crm--outline,
#tc-domain-dialog .btn-crm--outline,
body:has(.tc-page) .save-bar .btn-crm--outline {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
.tc-page .tc-validate-form .field__error {
  display: none !important;
}
.tc-page .tc-validate-form .tc-feedback[hidden] {
  display: none !important;
}
.tc-page .tc-validate-form .tc-feedback:not([hidden]) {
  display: block;
}
@media (max-width: 767px) {
  .tc-page .tc-actions .btn-crm,
  #dev-dialog .btn-crm,
  #tc-domain-dialog .btn-crm,
  body:has(.tc-page) .save-bar .btn-crm {
    min-height: 40px;
  }
}
