/* Affiliate Cabinet — frontend.
   Colors resolve to the theme's brand tokens (assets/css/tokens.css) and
   fall back to the brand hexes, so the plugin also works outside serp-shop. */

/* The registration form sits outside the cabinet on the invitation page and on a page with the shortcode,
   so it gets the same variables. */
.ac-cabinet,
.ac-register {
  --ac-primary: var(--color-primary, #009b77);
  --ac-primary-dark: var(--color-primary-dark, #005e5d);
  --ac-secondary: var(--color-secondary, #202a44);
  --ac-accent: var(--color-accent, #e8653a);
  --ac-bg: var(--color-bg, #f7f8fa);
  --ac-text: var(--color-text-main, #2d3748);
  --ac-text-light: var(--color-text-light, #718096);
  --ac-border: var(--color-border, #e2e8f0);
  --ac-success: var(--color-success, #38a169);
  --ac-warning: var(--color-warning, #d69e2e);
  --ac-danger: var(--color-danger, #e53e3e);
  --ac-radius: var(--radius-DEFAULT, 12px);
  --ac-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
  --ac-font: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

.ac-cabinet {
  font-family: var(--ac-font);
  color: var(--ac-text);
  max-width: 46rem;
  margin: 0 auto;
}

.ac-cabinet h2,
.ac-cabinet h3 {
  font-family: var(--ac-font);
  color: var(--ac-secondary);
  margin: 0 0 0.5rem;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.ac-alert {
  border-radius: var(--ac-radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.ac-alert--success {
  background: color-mix(in srgb, var(--ac-success) 10%, white);
  border-color: color-mix(in srgb, var(--ac-success) 35%, white);
  color: #1d5c3a;
}
.ac-alert--error {
  background: color-mix(in srgb, var(--ac-danger) 8%, white);
  border-color: color-mix(in srgb, var(--ac-danger) 30%, white);
  color: #8c2626;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.ac-card {
  background: #fff;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.25rem;
}

/* ── Code card (the hero, drawn on Morpho Blue) ──────────────────────────── */

.ac-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--ac-secondary);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
  padding: 1.4rem 1.6rem;
  margin: 0 0 1.25rem;
  color: #fff;
}
.ac-code-card__label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ac-primary) 60%, white);
  margin-bottom: 0.3rem;
}
.ac-code-card__code {
  display: inline-block;
  font-family: var(--ac-font);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--ac-primary) 70%, white);
}
.ac-code-card__rate {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--ac-radius);
  padding: 0.65rem 1.25rem;
  font-family: var(--ac-font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}
.ac-btn:active {
  transform: translateY(1px);
}
/* Diluent behind a white label (7.6:1). Morpho Teal under white text is only 3.53:1, below AA for normal-size text. */
.ac-btn--primary {
  background: var(--ac-primary-dark);
  color: #fff;
}
.ac-btn--primary:hover {
  background: var(--ac-secondary);
}
.ac-btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.ac-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}
.ac-cabinet__cta .ac-btn--ghost,
.ac-link-builder .ac-btn--ghost {
  color: var(--ac-primary);
  border-color: color-mix(in srgb, var(--ac-primary) 40%, white);
}
.ac-cabinet__cta .ac-btn--ghost:hover,
.ac-link-builder .ac-btn--ghost:hover {
  background: color-mix(in srgb, var(--ac-primary) 8%, white);
}

/* ── Link builder ────────────────────────────────────────────────────────── */

.ac-link-builder__title {
  font-size: 1.05rem;
}
.ac-link-builder__hint {
  margin: 0 0 0.75rem;
  color: var(--ac-text-light);
  font-size: 0.9rem;
}
.ac-link-builder__row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ac-link-builder__input {
  flex: 1 1 14rem;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  padding: 0.55rem 0.8rem;
  font-family: var(--ac-font);
  font-size: 0.95rem;
}
.ac-link-builder__row input:focus,
.ac-link-builder__result input:focus,
.ac-form input:focus,
.ac-form .ac-check input:focus-visible {
  outline: 2px solid var(--ac-primary);
  outline-offset: 1px;
  border-color: transparent;
}
.ac-link-builder__result {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
}
.ac-link-builder__result[hidden] {
  display: none;
}
.ac-link-builder__output {
  flex: 1;
  border: 1px dashed var(--ac-primary);
  background: color-mix(in srgb, var(--ac-primary) 5%, white);
  border-radius: var(--ac-radius);
  padding: 0.55rem 0.8rem;
  font-family: var(--ac-font);
  font-size: 0.9rem;
  color: var(--ac-text);
}
.ac-link-builder__default {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--ac-text-light);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.ac-link-builder__default-url {
  background: var(--ac-bg);
  border: 1px solid var(--ac-border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  word-break: break-all;
}
.button-link.ac-copy {
  color: var(--ac-primary);
  font-size: 0.8rem;
}
.button-link.ac-copy:hover {
  text-decoration: none;
  color: var(--ac-primary-dark);
}

/* ── Summary cards ───────────────────────────────────────────────────────── */

.ac-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}
.ac-summary__item {
  flex: 1 1 0;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.ac-summary__item--available {
  border-color: color-mix(in srgb, var(--ac-primary) 45%, white);
  background: color-mix(in srgb, var(--ac-primary) 5%, white);
}
.ac-summary__value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ac-secondary);
  font-variant-numeric: tabular-nums;
}
.ac-summary__item--available .ac-summary__value {
  color: var(--ac-primary-dark);
}
.ac-summary__label {
  font-size: 0.72rem;
  color: var(--ac-text-light);
}

/* ── Sales table ─────────────────────────────────────────────────────────── */

.ac-cabinet__sales-title {
  font-size: 1.05rem;
  margin-bottom: 0.9rem;
}
.ac-table-wrap {
  overflow-x: auto;
}
.ac-table--front {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.ac-table--front th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ac-text-light);
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--ac-border);
}
.ac-table--front td {
  padding: 0.65rem 0.6rem;
  border-bottom: 1px solid var(--ac-border);
  vertical-align: top;
}
.ac-table--front tbody tr:last-child td {
  border-bottom: 0;
}
.ac-table--front tbody tr:hover td {
  background: var(--ac-bg);
}
.ac-col-num,
.ac-table--front th.ac-col-num,
.ac-table--front td.ac-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ac-cell-commission {
  font-weight: 600;
  color: var(--ac-primary-dark);
}
.ac-cabinet__no-sales {
  color: var(--ac-text-light);
  margin: 0.5rem 0;
}
.ac-cabinet__footnote {
  font-size: 0.8rem;
  color: var(--ac-text-light);
  margin-top: 0.75rem;
}

/* ── Status pills ────────────────────────────────────────────────────────── */

.ac-status {
  display: inline-block;
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.ac-status--pending,
.ac-status--held,
.ac-status--in {
  background: color-mix(in srgb, var(--ac-warning) 15%, white);
  color: #8a5f12;
}
.ac-status--completed,
.ac-status--available,
.ac-status--partial,
.ac-status--paid,
.ac-status--active {
  background: color-mix(in srgb, var(--ac-success) 15%, white);
  color: #1d5c3a;
}
.ac-status--refunded,
.ac-status--rejected {
  background: color-mix(in srgb, var(--ac-danger) 12%, white);
  color: #8c2626;
}

/* ── Registration form ───────────────────────────────────────────────────── */

.ac-register__title {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}
.ac-register__lead {
  color: var(--ac-text-light);
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
}
.ac-register__note {
  background: color-mix(in srgb, var(--ac-primary) 7%, white);
  border: 1px solid color-mix(in srgb, var(--ac-primary) 30%, white);
  border-radius: var(--ac-radius);
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
}
.ac-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ac-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ac-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ac-secondary);
}
.ac-req {
  color: var(--ac-accent);
  margin-left: 2px;
}
.ac-opt {
  font-weight: 400;
  color: var(--ac-text-light);
  font-size: 0.82rem;
}
.ac-field input {
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  padding: 0.6rem 0.85rem;
  font-family: var(--ac-font);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ac-text);
}
.ac-field__error {
  color: var(--ac-danger);
  font-size: 0.82rem;
}
.ac-check {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--ac-text-light);
}
.ac-check input {
  margin-top: 0.2rem;
  accent-color: var(--ac-primary);
}
.ac-check a {
  color: var(--ac-primary);
}
.ac-register__submit {
  align-self: flex-start;
  padding: 0.75rem 1.75rem;
}
.ac-cabinet__cta .ac-register {
  max-width: none;
  margin: 1rem 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ── Cabinet state boxes (pending / rejected) ────────────────────────────── */

.ac-cabinet__state h2 {
  font-size: 1.3rem;
}
.ac-cabinet__state p {
  margin: 0;
  color: var(--ac-text-light);
}
.ac-cabinet__state--pending {
  border-left: 4px solid var(--ac-warning);
}
.ac-cabinet__state--rejected {
  border-left: 4px solid var(--ac-danger);
}

/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 48em) {
  .ac-code-card__code {
    font-size: 1.6rem;
  }
  .ac-summary {
    flex-wrap: wrap;
  }
  .ac-summary__item {
    flex: 1 1 calc(33% - 0.5rem);
  }
  .ac-table--front .ac-table__hide-sm {
    display: none;
  }
}

/* ── Payments ────────────────────────────────────────────────────────────── */

.ac-payments {
  margin-top: 1.5rem;
}

.ac-profile {
  margin-top: 1.5rem;
}
.ac-profile > summary {
  cursor: pointer;
  margin: 0;
}
.ac-profile[open] > summary {
  margin-bottom: 1rem;
}
.ac-field textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
}

/* The sign-up page fills the screen like My Account does (theme: .woocommerce-account #main), so the footer sits at the bottom. */
body.ac-signup #main {
  background-color: var(--color-bg, #f7f8fa);
  min-height: calc(100vh - var(--spacing-header, 4rem));
}

/* The form on a page of its own: a column with gutters, like the cabinet. Inside the cabinet the rule above resets it. */
.ac-register {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.75rem 2rem;
  background: #fff;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
}

.ac-register__login {
  margin-top: 16px;
  text-align: center;
}

.ac-register__login a {
  color: var(--ac-primary-dark);
  text-decoration: underline;
}

/* First and last name side by side, one under the other on a narrow screen. */
.ac-field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}

@media (min-width: 40em) {
  .ac-field-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Paging of "Your sales" */
.ac-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}
.ac-pager .ac-btn--ghost {
    color: var(--ac-primary-dark);
    border-color: color-mix(in srgb, var(--ac-primary-dark) 40%, white);
}
.ac-pager .ac-btn--ghost:hover {
    background: color-mix(in srgb, var(--ac-primary-dark) 8%, white);
}
.ac-pager__text {
    color: var(--ac-text);
    opacity: .75;
    font-size: 14px;
}
.ac-card[aria-busy="true"] {
    opacity: .6;
}

.ac-summary__note {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ac-text);
    opacity: .75;
}

/* The links of an affiliate, one per shop of the program. */
.ac-link-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ac-link-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
}
.ac-link-list__shop {
  min-width: 11rem;
  font-size: 0.8rem;
  color: var(--ac-text-light);
}

/* One amount per currency, one under another. */
.ac-multi{display:block}
