/**
 * WP MyLinks admin components.
 *
 * A faithful port of PixMapr's admin design (the house reference
 * implementation, assets/src/admin/scss/admin.scss + metabox.scss) onto the
 * --wml-* tokens: settings header, tabs, canvas content region, card grid,
 * boxed toggle rows, full-width 2px-border fields, and the edit-screen
 * metabox chrome. Values match the reference, not an approximation.
 *
 * Logical properties are used where direction matters so RTL needs no
 * generated twin (HOUSE-STANDARD.md 11.3, preferred approach).
 *
 * @package Wp_Mylinks
 * @since 1.1.0
 */

/* ============================================================================
   Settings page
   ========================================================================= */

.wml-settings-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  margin: 20px 20px 0 0;
}

/* Header ------------------------------------------------------------------ */

.wml-settings-header {
  background: var(--wml-gradient-brand);
  border-radius: var(--wml-radius);
  box-shadow: var(--wml-shadow-lg);
  margin-block-end: 30px;
  padding: 30px 40px;
}

.wml-settings-header-content {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.wml-settings-header-left {
  align-items: center;
  display: flex;
  gap: 20px;
}

/*
 * The header sits on brand yellow, so everything on it is ink. White text on
 * yellow lands around 1.5:1 and is unreadable — the dark-on-yellow pairing is
 * also what the brand itself uses for its hero.
 */
.wml-settings-icon {
  align-items: center;
  background: var(--wml-ink);
  border-radius: var(--wml-radius);
  box-shadow: var(--wml-shadow-ink);
  display: flex;
  height: 60px;
  justify-content: center;
  width: 60px;
}

/* The brand mark's colours are baked into the SVG, not inherited. 44px is the
   detail floor — below ~40px the avatar circle and link bars stop reading. */
.wml-settings-icon .wml-brand-mark {
  height: 44px;
  width: 44px;
}

.wml-settings-header h1 {
  color: var(--wml-ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
}

.wml-settings-subtitle {
  color: rgba(38, 46, 51, 0.75);
  font-size: 14px;
  margin: 5px 0 0;
}

.wml-version-badge {
  background: var(--wml-ink);
  border-radius: 20px;
  color: var(--wml-brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 16px;
}

/* Tabs -------------------------------------------------------------------- */

.wml-tabs {
  border-block-end: 2px solid var(--wml-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-end: 30px;
}

.wml-tabs__tab {
  align-items: center;
  background: transparent;
  border: none;
  border-block-end: 3px solid transparent;
  color: var(--wml-muted);
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
  inset-block-end: -2px;
  padding: 14px 24px;
  position: relative;
  text-decoration: none;
  transition: all 0.3s ease;
}

.wml-tabs__tab .dashicons {
  font-size: 18px;
  height: 18px;
  width: 18px;
}

.wml-tabs__tab:hover {
  background: var(--wml-brand-tint);
  color: var(--wml-text);
}

.wml-tabs__tab:focus-visible {
  border-radius: var(--wml-radius-sm) var(--wml-radius-sm) 0 0;
  outline: 2px solid var(--wml-brand-strong);
  outline-offset: -2px;
}

/* Ink label, yellow underline — the accent carries the state, not the text. */
.wml-tabs__tab--active {
  background: var(--wml-brand-soft);
  border-block-end-color: var(--wml-brand-strong);
  color: var(--wml-ink);
  font-weight: 600;
}

.wml-tabs__tab--active .dashicons {
  color: var(--wml-brand-deep);
}

/* Content region ---------------------------------------------------------- */

.wml-settings-content {
  background: var(--wml-canvas);
  border-radius: 12px;
  padding: 30px;
}

.wml-settings-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  margin-block-end: 24px;
}

.wml-settings-grid > .wml-settings-card {
  margin-block-end: 0;
}

.wml-card--wide {
  grid-column: 1 / -1;
}

/* Fixed two-up layout (Welcome tab): always pairs, never 3+ across. */
.wml-settings-grid--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .wml-settings-grid--2col {
    grid-template-columns: 1fr;
  }
}

/* Cards ------------------------------------------------------------------- */

.wml-settings-card {
  background: var(--wml-surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  margin-block-end: 24px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.wml-settings-card:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.wml-card-header {
  align-items: center;
  background: linear-gradient(135deg, var(--wml-canvas) 0%, var(--wml-surface) 100%);
  border-block-end: 1px solid var(--wml-line);
  display: flex;
  gap: 12px;
  padding: 20px 24px;
}

.wml-card-header .dashicons {
  color: var(--wml-brand-deep);
  font-size: 24px;
  height: 24px;
  width: 24px;
}

.wml-card-header h2 {
  color: var(--wml-text);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  padding: 0;
}

.wml-card-body {
  padding: 24px;
}

.wml-card-description {
  color: var(--wml-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.wml-card-actions {
  align-items: center;
  border-block-start: 1px solid var(--wml-line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-block-start: 24px;
  padding-block-start: 20px;
}

/* Fields ------------------------------------------------------------------ */

.wml-field {
  margin-block-end: 24px;
}

.wml-field:last-child {
  margin-block-end: 0;
}

.wml-field__label {
  color: var(--wml-text);
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-block-end: 8px;
}

.wml-field__required {
  color: var(--wml-danger);
}

.wml-field__input,
.wml-field textarea,
.wml-field select {
  background: var(--wml-surface);
  border: 2px solid var(--wml-line);
  border-radius: 8px;
  box-shadow: none;
  color: var(--wml-text);
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
  padding: 10px 14px;
  transition: all 0.3s ease;
  width: 100%;
}

.wml-field__input:focus,
.wml-field textarea:focus,
.wml-field select:focus {
  border-color: var(--wml-brand-deep);
  box-shadow: 0 0 0 3px var(--wml-brand-ring);
  outline: none;
}

.wml-field__input--key {
  font-family: Consolas, Monaco, monospace;
  letter-spacing: 0.12em;
}

.wml-field__help {
  color: var(--wml-muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.wml-field__before {
  border-block-end: 1px solid var(--wml-line);
  color: var(--wml-muted);
  font-size: 13px;
  line-height: 1.6;
  margin-block-end: 20px;
  padding-block-end: 14px;
}

/* Radio groups. */

.wml-field__radios {
  border: 0;
  margin: 0;
  padding: 0;
}

.wml-field__radio {
  display: block;
  font-size: 14px;
  margin-block-end: 6px;
}

.wml-field--radio-inline .wml-field__radio {
  display: inline-block;
  margin-block-end: 0;
  margin-inline-end: 16px;
}

.wml-field__radio input[type="radio"]:focus {
  box-shadow: 0 0 0 3px var(--wml-brand-ring);
}

/* Toggle rows — a styled real checkbox in a soft boxed row, so the save
   path is unchanged. Sizes match the reference (48×26 track, 22px knob). */

.wml-toggle {
  align-items: center;
  background: var(--wml-canvas);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 16px;
  padding: 16px;
  transition: all 0.3s ease;
}

.wml-toggle:hover {
  background: var(--wml-canvas-soft);
}

.wml-toggle input[type="checkbox"] {
  height: 0;
  margin: 0;
  opacity: 0;
  position: absolute;
  width: 0;
}

.wml-toggle__track {
  background: var(--wml-line-strong);
  border-radius: 26px;
  flex-shrink: 0;
  height: 26px;
  position: relative;
  transition: all 0.3s ease;
  width: 48px;
}

.wml-toggle__track::before {
  background: var(--wml-surface);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  content: "";
  height: 22px;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  position: absolute;
  transition: all 0.3s ease;
  width: 22px;
}

.wml-toggle input[type="checkbox"]:checked + .wml-toggle__track {
  background: var(--wml-gradient-ink);
}

.wml-toggle input[type="checkbox"]:checked + .wml-toggle__track::before {
  inset-inline-start: 24px;
}

.wml-toggle input[type="checkbox"]:focus-visible + .wml-toggle__track {
  box-shadow: 0 0 0 3px var(--wml-brand-ring);
}

.wml-toggle__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wml-toggle__text strong {
  color: var(--wml-text);
  font-size: 15px;
  font-weight: 500;
}

.wml-toggle__text small {
  color: var(--wml-muted);
  font-size: 13px;
}

/* Buttons ----------------------------------------------------------------- */

/*
 * Selectors are qualified with .wp-core-ui and .button so they outrank the
 * per-user admin colour scheme, which styles .wp-core-ui .button-primary and
 * would otherwise repaint these in whatever accent the user picked.
 */
.wml-button-primary,
.wp-core-ui .button.wml-button-primary,
.wp-core-ui input[type="submit"].wml-button-primary {
  align-items: center;
  background: var(--wml-gradient-ink);
  border: none;
  border-radius: 8px;
  box-shadow: var(--wml-shadow-ink);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
  height: auto;
  line-height: 1.4;
  padding: 12px 32px;
  text-decoration: none;
  text-shadow: none;
  transition: all 0.3s ease;
}

/* When these components are anchors, core's `a:visited` (0-1-1) outranks the
   bare class (0-1-0) and paints the label link-blue. Pin the visited state. */
a.wml-button-primary:visited {
  color: #fff;
}

a.wml-button-secondary:visited {
  color: var(--wml-text);
}

.wml-button-primary:hover,
.wml-button-primary:focus,
.wp-core-ui .button.wml-button-primary:hover,
.wp-core-ui .button.wml-button-primary:focus,
.wp-core-ui input[type="submit"].wml-button-primary:hover,
.wp-core-ui input[type="submit"].wml-button-primary:focus {
  background: var(--wml-ink-hover);
  border: none;
  box-shadow: var(--wml-shadow-ink);
  color: var(--wml-brand);
  outline: none;
  transform: translateY(-2px);
}

.wml-button-primary:focus-visible,
.wp-core-ui .button.wml-button-primary:focus-visible,
.wp-core-ui input[type="submit"].wml-button-primary:focus-visible {
  outline: 2px solid var(--wml-brand-strong);
  outline-offset: 2px;
}

.wml-button-primary:active,
.wp-core-ui .button.wml-button-primary:active {
  transform: translateY(0);
}

.wml-button-secondary,
.wp-core-ui .button.wml-button-secondary,
.wp-core-ui input[type="button"].wml-button-secondary {
  align-items: center;
  background: var(--wml-surface);
  border: 2px solid var(--wml-line);
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--wml-text);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
  height: auto;
  line-height: 1.4;
  padding: 10px 20px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.wml-button-secondary:hover,
.wml-button-secondary:focus,
.wp-core-ui .button.wml-button-secondary:hover,
.wp-core-ui .button.wml-button-secondary:focus,
.wp-core-ui input[type="button"].wml-button-secondary:hover,
.wp-core-ui input[type="button"].wml-button-secondary:focus {
  background: var(--wml-brand-soft);
  border-color: var(--wml-brand-strong);
  color: var(--wml-ink);
}

/* QR code side box --------------------------------------------------------- */

.wml-qr {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wml-qr__canvas img {
  border: 1px solid var(--wml-line);
  border-radius: 8px;
  display: block;
  height: auto;
  image-rendering: pixelated; /* keep modules crisp when upscaled */
  width: 100%;
}

.wml-qr__url {
  color: var(--wml-muted);
  font-size: 12px;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.wml-qr .wml-qr__download {
  justify-content: center;
  width: 100%;
}

.wml-qr__download .dashicons {
  font-size: 18px;
  height: 18px;
  width: 18px;
}

/* Code textareas (Scripts tab) ---------------------------------------------
   These hold JS/CSS, so they read like an editor: monospace, soft inset,
   no spell-check squiggles (attribute), generous height. */

.wml-field__input.wml-code {
  background: var(--wml-canvas-soft);
  border: 1px solid var(--wml-line-strong);
  border-radius: 8px;
  box-shadow: inset 0 2px 6px rgba(38, 46, 51, 0.07);
  color: var(--wml-ink);
  font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
}

.wml-field__input.wml-code:focus {
  background: var(--wml-surface);
  border-color: var(--wml-brand-strong);
  box-shadow: inset 0 2px 6px rgba(38, 46, 51, 0.05), 0 0 0 3px var(--wml-brand-ring);
  outline: none;
}

/* Design-system textareas -------------------------------------------------
   Every multi-line field (metabox and settings) reads as one styled box, the
   same soft inset the Scripts editor uses. Code fields add monospace below. */
.wml-field textarea.wml-field__input {
  background: var(--wml-canvas-soft);
  border: 1px solid var(--wml-line-strong);
  box-shadow: inset 0 2px 6px rgba(38, 46, 51, 0.07);
  color: var(--wml-ink);
  min-height: 140px;
  resize: vertical;
}

.wml-field textarea.wml-field__input:focus {
  background: var(--wml-surface);
  border-color: var(--wml-brand-strong);
  box-shadow: inset 0 2px 6px rgba(38, 46, 51, 0.05), 0 0 0 3px var(--wml-brand-ring);
  outline: none;
}

/* Editor code fields (per-page scripts, custom styles, Links HTML block) read
   like the Scripts editor: monospace, no wrap, taller. */
[data-wml-field="html-block"] textarea.wml-field__input,
[data-wml-field="mylinks_mylinks-single-custom-header-script"] textarea.wml-field__input,
[data-wml-field="mylinks_mylinks-single-custom-footer-script"] textarea.wml-field__input,
[data-wml-field="mylinks_mylinks-single-custom-styles"] textarea.wml-field__input {
  font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 180px;
  tab-size: 2;
  white-space: pre;
}

/* Header / After Body / Footer side by side inside the wide card. */
.wml-script-columns {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1440px) {
  .wml-script-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .wml-script-columns {
    grid-template-columns: 1fr;
  }
}

/* Tools tab ----------------------------------------------------------------- */

.wml-tool-form {
  border-top: 1px solid var(--wml-line);
  margin-top: 28px;
  padding-top: 28px;
}

.wml-tool-form:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.wml-tool-form .wml-field__label {
  font-size: 15px;
}

/* In these cards the help sits ABOVE the control, so it needs a bottom
   margin — the shared style only spaces help that follows an input. */
.wml-tool-form .wml-field__help {
  line-height: 1.6;
  margin: 0 0 16px;
}

.wml-tool-form .wml-input-row {
  align-items: center;
  gap: 12px;
}

.wml-tool-form select {
  max-width: 100%;
}

.wml-tool-form .wml-input-row select {
  flex: 1 1 220px;
  min-width: 0;
}

.wml-tool-form .wml-button-primary,
.wml-tool-form .wml-button-secondary {
  margin-top: 4px;
}

.wml-checkbox-row {
  align-items: center;
  color: var(--wml-muted);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
  margin-top: 16px;
}

/* Post-type source tiles (Tools -> Link URL Sources): a responsive grid of
   equal-size cards, each with the type name over its slug. */
.wml-posttype-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 12px;
}

.wml-posttype {
  align-items: flex-start;
  background: var(--wml-surface);
  border: 2px solid var(--wml-line);
  border-radius: 10px;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.wml-posttype:hover {
  border-color: var(--wml-brand);
}

.wml-posttype input[type="checkbox"] {
  flex-shrink: 0;
  margin: 2px 0 0;
}

/* Tint the whole tile when its checkbox is checked. :has degrades gracefully
   (the checkbox still shows its state) on browsers without support. */
.wml-posttype:has(input:checked) {
  background: var(--wml-brand-tint);
  border-color: var(--wml-brand-strong);
}

.wml-posttype__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.wml-posttype__name {
  color: var(--wml-ink);
  font-weight: 600;
  line-height: 1.3;
}

.wml-posttype__slug {
  align-self: flex-start;
  background: var(--wml-canvas-soft);
  border-radius: 4px;
  color: var(--wml-muted);
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  padding: 1px 6px;
  text-overflow: ellipsis;
}

.wml-posttype--locked {
  cursor: default;
  opacity: 0.7;
}

/* Styled file picker: the native input covers the whole zone invisibly, so
   click-to-browse and drag-and-drop both keep working with no JS required. */
.wml-file-drop {
  align-items: center;
  background: var(--wml-canvas-soft);
  border: 2px dashed var(--wml-line-strong);
  border-radius: var(--wml-radius-sm);
  cursor: pointer;
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px 20px;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.wml-file-drop:hover,
.wml-file-drop:focus-within {
  background: var(--wml-brand-tint);
  border-color: var(--wml-brand-strong);
}

.wml-file-drop input[type="file"] {
  cursor: pointer;
  height: 100%;
  left: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.wml-file-drop__icon.dashicons {
  color: var(--wml-brand-deep);
  font-size: 26px;
  height: 26px;
  width: 26px;
}

.wml-file-drop__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wml-file-drop__text strong {
  color: var(--wml-text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.wml-file-drop__text small {
  color: var(--wml-muted);
  font-size: 12px;
}

.wml-file-drop--has-file {
  background: var(--wml-success-soft);
  border-color: var(--wml-success-line);
  border-style: solid;
}

.wml-file-drop--has-file .wml-file-drop__icon.dashicons {
  color: var(--wml-success);
}

.wml-file-drop--compact {
  gap: 10px;
  padding: 12px 14px;
}

.wml-file-drop--compact .wml-file-drop__icon.dashicons {
  font-size: 20px;
  height: 20px;
  width: 20px;
}

.wml-file-drop--compact .wml-file-drop__text strong {
  font-size: 13px;
}

/* Import/Export editor side box -------------------------------------------- */

.wml-import-export {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wml-import-export hr {
  border: 0;
  border-top: 1px solid var(--wml-line);
  margin: 4px 0;
  width: 100%;
}

.wml-import-export .wml-field__help {
  margin: 0;
}

.wml-import-export .wml-button-secondary {
  justify-content: center;
  width: 100%;
}

/* Scoped to the buttons so the drop-zone icon keeps its own size; 18px
   matches the QR box button above it. */
.wml-import-export .wml-button-secondary .dashicons {
  font-size: 18px;
  height: 18px;
  line-height: 1;
  width: 18px;
}

/* More Plugins tab ---------------------------------------------------------
   Ported from the house reference (Indonesian Banks admin.css), ibfw → wml. */

.wml-more-intro {
  margin-block-end: 24px;
}

.wml-plugin-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.wml-plugin {
  background: var(--wml-surface);
  border: 1px solid var(--wml-line);
  border-radius: var(--wml-radius);
  box-shadow: var(--wml-shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.wml-plugin__head {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.wml-plugin__icon {
  border-radius: var(--wml-radius-sm);
  flex: none;
  height: 56px;
  width: 56px;
}

.wml-plugin__title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.wml-plugin__title h3 {
  color: var(--wml-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.wml-plugin__description {
  color: var(--wml-muted);
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.wml-plugin__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.wml-plugin__actions .dashicons {
  font-size: 14px;
  height: 14px;
  width: 14px;
}

/* Card buttons keep their hover colors but not the animation — no lift, no
   eased transition (owner decision, Aug 2026). */
.wml-plugin__actions .wml-button-primary,
.wml-plugin__actions .wml-button-secondary {
  transition: none;
}

.wml-plugin__actions .wml-button-primary:hover,
.wml-plugin__actions .wml-button-primary:focus {
  transform: none;
}

.wml-plugin__running {
  align-items: center;
  color: var(--wml-success);
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
}

.wml-pill {
  align-items: center;
  background: var(--wml-canvas-soft);
  border-radius: 999px;
  color: var(--wml-muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  letter-spacing: 0.04em;
  padding: 2px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.wml-pill--on {
  background: var(--wml-success-soft);
  color: var(--wml-success);
}

.wml-pill--brand {
  background: var(--wml-brand-soft);
  color: var(--wml-brand-deep);
}

/* Save footer ------------------------------------------------------------- */

.wml-settings-footer {
  background: var(--wml-surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: flex-end;
  padding: 24px;
}

/* Notices ----------------------------------------------------------------- */

.wml-notice-info,
.wml-notice-success,
.wml-notice-warning,
.wml-notice-error {
  border-radius: 8px;
  display: flex;
  font-size: 14px;
  gap: 12px;
  line-height: 1.5;
  margin-block-start: 20px;
  padding: 16px;
}

/*
 * Informational notes stay warm rather than the usual admin blue — a blue
 * panel is the one thing that reads as foreign next to the brand yellow.
 * Success, warning, and error keep their conventional colours, because those
 * carry meaning that palette consistency should not override.
 */
.wml-notice-info {
  background: var(--wml-brand-tint);
  border: 1px solid var(--wml-brand-soft);
  border-inline-start: 4px solid var(--wml-brand-strong);
  color: var(--wml-text);
}

.wml-notice-info .dashicons {
  color: var(--wml-brand-deep);
}

.wml-notice-success {
  background: var(--wml-success-soft);
  border: 1px solid var(--wml-success-line);
  color: var(--wml-success);
}

.wml-notice-success .dashicons {
  color: var(--wml-success);
}

.wml-notice-warning {
  background: var(--wml-warning-soft);
  border: 1px solid var(--wml-warning-line);
  color: var(--wml-warning);
}

.wml-notice-warning .dashicons {
  color: var(--wml-warning);
}

.wml-notice-error {
  background: var(--wml-danger-soft);
  border: 1px solid var(--wml-danger-line);
  color: var(--wml-danger);
}

.wml-notice-error .dashicons {
  color: var(--wml-danger);
}

/* Welcome-tab pieces ------------------------------------------------------ */

.wml-steps {
  margin: 0 0 20px;
  padding-inline-start: 20px;
}

.wml-steps li {
  font-size: 14px;
  line-height: 1.6;
  margin-block-end: 10px;
}

.wml-check {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.wml-check li {
  font-size: 14px;
  line-height: 1.6;
  margin-block-end: 10px;
  padding-inline-start: 28px;
  position: relative;
}

.wml-check .dashicons {
  color: var(--wml-success);
  font-size: 18px;
  height: 18px;
  inset-block-start: 2px;
  inset-inline-start: 0;
  position: absolute;
  width: 18px;
}

.wml-embed {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
}

.wml-embed iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

/* ============================================================================
   Edit screen (metaboxes)
   ========================================================================= */

/* Postbox chrome on the plugin's own screens. */

.post-type-mylink .postbox,
.post-type-mylinks-collection .postbox {
  border: 1px solid var(--wml-line);
  border-radius: var(--wml-radius-sm);
  box-shadow: var(--wml-shadow-sm);
  overflow: hidden;
}

.post-type-mylink .postbox .postbox-header,
.post-type-mylinks-collection .postbox .postbox-header {
  background: linear-gradient(135deg, var(--wml-canvas) 0%, var(--wml-surface) 100%);
  border-block-end: 1px solid var(--wml-line);
}

.post-type-mylink .postbox .hndle,
.post-type-mylinks-collection .postbox .hndle {
  color: var(--wml-text);
  font-size: 14px;
  font-weight: 600;
}

/*
 * Fields inside a metabox lay out in a deliberate three-column grid (two,
 * then one, as the screen narrows); wide field types (editors, repeaters,
 * embeds, long text) span the full row but cap their measure so controls
 * never stretch across a 1500px postbox.
 */
.postbox .wml-fields {
  display: grid;
  gap: 24px 32px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-block: 8px 4px;
}

.postbox .wml-fields .wml-field {
  margin-block-end: 0;
}

.postbox .wml-field--wysiwyg,
.postbox .wml-field--group,
.postbox .wml-field--oembed,
.postbox .wml-field--textarea-small,
.postbox .wml-fields > .wml-field__before,
.postbox .wml-card-description {
  grid-column: 1 / -1;
}

/* Readable measure for wide controls — a full-postbox textarea is a wall. */
.postbox .wml-field--wysiwyg,
.postbox .wml-field--oembed,
.postbox .wml-field--textarea-small {
  max-width: 860px;
}

/*
 * Layout utilities set per field via the `classes` arg:
 * --wide  spans the row at the same capped measure as the textareas, so a
 *         text input stacked above one lines up edge-to-edge with it;
 * --full  spans the whole row uncapped (file rows whose intro text already
 *         runs full width).
 */
.postbox .wml-field--wide,
.wml-group__row-body .wml-field--wide {
  grid-column: 1 / -1;
  max-width: 860px;
}

.postbox .wml-field--full,
.wml-group__row-body .wml-field--full {
  grid-column: 1 / -1;
}

.postbox .wml-card-description {
  border-block-end: 1px solid var(--wml-line);
  margin: 0;
  padding-block-end: 16px;
}

/*
 * before_row texts act as section intros: a divider above, tight to the
 * fields they introduce. The first one in a box needs no divider.
 */
.postbox .wml-field__before,
.wml-group__row-body .wml-field__before {
  border-block-end: none;
  border-block-start: 1px solid var(--wml-line);
  margin: 0 0 -10px;
  padding-block: 18px 0;
}

.postbox .wml-fields > .wml-field__before:first-child,
.postbox .wml-card-description + .wml-field__before {
  border-block-start: none;
  padding-block-start: 0;
}

/* The Social Media box pairs each platform's URL with its icon on one row. */
#mylinks_form-social .wml-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#mylinks_form-social .wml-field--radio-inline {
  grid-column: 1 / -1;
}

@media (max-width: 1440px) {
  .postbox .wml-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .postbox .wml-fields,
  #mylinks_form-social .wml-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* File / media picker ----------------------------------------------------- */

/* Input and its buttons share one row; the input takes the slack. */
.wml-file__row,
.wml-input-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wml-file__row .wml-field__input,
.wml-input-row .wml-field__input {
  flex: 1 1 160px;
  min-width: 0;
  width: auto;
}

.wml-file__row .wml-button-secondary,
.wml-input-row .wml-button-secondary {
  flex-shrink: 0;
  padding: 9px 14px;
  white-space: nowrap;
}

/* Icon-only remove: compact square, danger-tinted X, accessible via aria-label. */
.wml-file__row .wml-file__remove {
  line-height: 1;
  padding: 10px;
}

.wml-file__remove .dashicons {
  color: var(--wml-danger);
  font-size: 18px;
  height: 18px;
  width: 18px;
}

.wml-file__preview {
  margin-block-start: 10px;
}

.wml-file__preview img {
  border: 1px solid var(--wml-line);
  border-radius: var(--wml-radius-sm);
  display: block;
  height: auto;
  max-height: 90px;
  max-width: 160px;
  width: auto;
}

/* oEmbed preview ---------------------------------------------------------- */

.wml-oembed__preview {
  margin-block-start: 10px;
  max-width: 480px;
}

.wml-oembed__preview iframe {
  max-width: 100%;
}

/* Repeater groups --------------------------------------------------------- */

.wml-group__row {
  background: var(--wml-surface);
  border: 1px solid var(--wml-line);
  border-radius: var(--wml-radius-sm);
  box-shadow: var(--wml-shadow-sm);
  margin-block-end: 14px;
  overflow: hidden;
}

.wml-group__row-head {
  align-items: center;
  background: linear-gradient(135deg, var(--wml-canvas) 0%, var(--wml-surface) 100%);
  border-block-end: 1px solid var(--wml-line);
  display: flex;
  gap: 10px;
  padding: 12px 16px;
}

.wml-group__handle {
  color: var(--wml-faint);
  cursor: move;
}

.wml-group__title {
  color: var(--wml-text);
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.wml-group__collapse {
  background: transparent;
  border: none;
  color: var(--wml-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.wml-group__collapse:hover {
  color: var(--wml-ink);
}

.wml-group__collapse:focus-visible {
  box-shadow: 0 0 0 3px var(--wml-brand-ring);
  outline: none;
}

.wml-group__collapse .dashicons {
  transition: transform 0.2s ease;
}

.wml-group__row.is-collapsed .wml-group__collapse .dashicons {
  transform: rotate(180deg);
}

.wml-group__row.is-collapsed .wml-group__row-body {
  display: none;
}

.wml-group__row-body {
  display: grid;
  gap: 22px 32px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 20px;
}

.wml-group__row-body .wml-field {
  margin-block-end: 0;
}

.wml-group__row-body .wml-field--wysiwyg,
.wml-group__row-body .wml-field--oembed,
.wml-group__row-body .wml-field--textarea-small,
.wml-group__row-body .wml-field__before {
  grid-column: 1 / -1;
}

.wml-group__row-body .wml-field--wysiwyg,
.wml-group__row-body .wml-field--oembed,
.wml-group__row-body .wml-field--textarea-small {
  max-width: 860px;
}

/* The repeater's own description reads as an intro above the rows. */
.wml-field--group > .wml-field__help {
  margin: 0 0 14px;
}

@media (max-width: 1440px) {
  .wml-group__row-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .wml-group__row-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.wml-group__row.ui-sortable-helper {
  box-shadow: var(--wml-shadow-md);
}

/* Select2 sizing inside field rows. */

.wml-field .select2-container {
  max-width: 100%;
  min-width: 0;
  width: 100% !important;
}

.wml-field .select2-container .select2-selection--single {
  border: 2px solid var(--wml-line);
  border-radius: 8px;
  height: 44px;
}

.wml-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px;
  padding-inline-start: 14px;
}

.wml-field .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
}

/* Clear (X) button. Select2 renders a bare <button>×</button> that picks up the
   OS button chrome (grey box, outset border) and floats it to the top-right.
   Reset the chrome, swap the glyph for the plugin's standard danger remove icon
   (matching .wml-file__remove), and absolutely center it just left of the
   dropdown arrow so it lines up vertically in the control. */
.wml-field .select2-container--default .select2-selection--single {
  position: relative;
}

.wml-field .select2-selection__clear {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  height: 24px;
  justify-content: center;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
}

.wml-field .select2-selection__clear > span {
  font-size: 0;
}

.wml-field .select2-selection__clear > span::before {
  color: var(--wml-danger);
  content: "\f335";
  font: normal 18px/1 dashicons;
}

.wml-field .select2-selection__clear:hover > span::before {
  opacity: 0.7;
}
