/**
 * Logos by Quintaphon: Admin design system
 * Minimal, light, fast. Plain CSS, no build step.
 *
 * Sections
 *  1. Tokens            8. Tables
 *  2. Base              9. Badges, pills, chips
 *  3. Shell / sidebar  10. Tabs, filters, pagination
 *  4. Top bar          11. Dashboard widgets
 *  5. Page header      12. Logo editor and media
 *  6. Buttons          13. Login page
 *  7. Cards, notices,  14. Utilities
 *     forms            15. Responsive
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
  /* Surfaces and text */
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f3f3f5;
  --border: #e6e6ea;
  --border-strong: #d4d4da;
  --text: #18181b;
  --text-2: #3f3f46;
  --text-muted: #63636e;
  --text-faint: #8e8e98;

  /* Accent (charcoal, matches the brand) */
  --accent: #222225;
  --accent-hover: #000000;
  --accent-contrast: #ffffff;
  --accent-soft: #ededf0;

  /* Focus ring */
  --focus: #2563eb;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.28);

  /* Semantic */
  --success: #047857;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --danger: #be123c;
  --danger-strong: #e11d48;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --warning: #92400e;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Type scale */
  --font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 22px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Elevation (kept deliberately flat) */
  --shadow-xs: 0 1px 2px rgba(16, 16, 24, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 16, 24, 0.06);
  --shadow-lg: 0 8px 24px rgba(16, 16, 24, 0.08);
  --shadow-xl: 0 16px 40px rgba(16, 16, 24, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 0.15s;

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --sidebar-current: var(--sidebar-w);
  --topbar-h: 56px;
  --content-max: none; /* content uses the full width beside the sidebar */
  --control-h: 36px;

  /* Legacy aliases (views and scripts still reference these names) */
  --neutral-50: #fafafa;
  --neutral-100: #f3f3f5;
  --neutral-200: #e6e6ea;
  --neutral-300: #d4d4da;
  --neutral-400: #a1a1aa;
  --neutral-500: #71717a;
  --neutral-600: #52525b;
  --neutral-700: #3f3f46;
  --neutral-800: #27272a;
  --neutral-900: #18181b;
  --neutral-950: #09090b;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-700: #334155;
  --primary-50: #f4f4f5;
  --primary-100: #e4e4e7;
  --primary-200: #d4d4d8;
  --primary-300: #a1a1aa;
  --primary-400: #71717a;
  --primary-500: #52525b;
  --primary-600: #222225;
  --primary-700: #18181b;
  --primary-800: #111113;
  --primary-900: #09090b;
  --primary: #222225;
  --brand-primary: #1d4ed8;
  --text-main: var(--text);
  --text-secondary: var(--text-2);
  --border-light: var(--border);
  --border-focus: var(--accent);
  --body-bg: var(--bg);
  --card-bg: var(--surface);
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --rose-50: #fff1f2;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.wp-admin {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.wp-admin a { color: var(--text); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }

#wpbody-content code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  color: var(--text-2);
  word-break: break-word;
}

hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

img, svg { vertical-align: middle; }

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
input[type="color"]:focus-visible,
input[type="file"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.screen-reader-text,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   3. Shell and sidebar
   ========================================================================== */
html.sidebar-collapsed { --sidebar-current: var(--sidebar-w-collapsed); }

#adminmenumain {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-current);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: width var(--dur) var(--ease), transform 0.2s var(--ease);
}

#adminmenuwrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.sidebar-header {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-3) 0 14px;
  border-bottom: 1px solid var(--border);
}

.menu-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
  border-radius: var(--radius);
}

.brand-icon-wrap {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
}

.brand-icon-wrap svg { width: 18px; height: 18px; }

.brand-title-group { display: flex; flex-direction: column; min-width: 0; }

.brand-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-badge { font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-close:hover { background: var(--surface-3); color: var(--text); }

.nav-section-title {
  padding: var(--space-4) 18px var(--space-1);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  white-space: nowrap;
}

#adminmenu {
  list-style: none;
  margin: 0;
  padding: var(--space-1) 10px var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

#adminmenu li { margin: 0; padding: 0; }

#adminmenu .menu-top a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

#adminmenu .menu-top a:hover { background: var(--surface-3); color: var(--text); }

#adminmenu .menu-top.current a {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

#adminmenu .menu-top.current a::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.wp-menu-image {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

#adminmenu .menu-top a:hover .wp-menu-image,
#adminmenu .menu-top.current .wp-menu-image { color: var(--text); }

.wp-menu-image svg { width: 18px; height: 18px; }

.wp-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: 10px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px;
}

.user-avatar-initials {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  font-size: 11.5px;
  display: grid;
  place-items: center;
}

.user-info-text { display: flex; flex-direction: column; min-width: 0; }

.user-name-display {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge { font-size: 11.5px; color: var(--text-muted); text-transform: capitalize; }

/* Script version under the user's name: visible on every admin page. */
.user-version-link {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.85;
}
.user-version-link:hover { color: var(--text); text-decoration: underline; opacity: 1; }

/* Icon-only collapse toggle in the sidebar header (right of the site logo). */
.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.sidebar-collapse-btn:hover { background: var(--surface-3); color: var(--text); }

.sidebar-backdrop { display: none; }

/* Collapsed rail (desktop only) */
@media (min-width: 901px) {
  /* Collapsed: the site logo hides and the header holds only the toggle. */
  html.sidebar-collapsed .menu-brand-link,
  html.sidebar-collapsed .nav-section-title,
  html.sidebar-collapsed .user-info-text {
    display: none;
  }

  html.sidebar-collapsed .sidebar-header { justify-content: center; padding: 0; }

  html.sidebar-collapsed #adminmenu { padding: var(--space-3) 10px; }

  html.sidebar-collapsed #adminmenu .menu-top a { justify-content: center; padding: 0; gap: 0; }

  html.sidebar-collapsed .wp-menu-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  html.sidebar-collapsed .sidebar-user { justify-content: center; padding: 6px 0; }

}

/* ==========================================================================
   4. Top bar
   ========================================================================== */
#wpcontent {
  margin-left: var(--sidebar-current);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left var(--dur) var(--ease);
}

#wpadminbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-7);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }

.mobile-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.mobile-nav-toggle:hover { background: var(--surface-3); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-breadcrumb .crumb-slash { color: var(--border-strong); }

.topbar-breadcrumb .crumb-current {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.btn-view-site,
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  font: 500 var(--fs-sm) / 1 var(--font-family);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn-view-site {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
}

body.wp-admin .btn-view-site { color: var(--text-2); }

.btn-view-site:hover { background: var(--surface-3); color: var(--text); }

.btn-logout { border: 1px solid transparent; background: transparent; color: var(--danger); }

.btn-logout:hover { background: var(--danger-bg); }

/* ==========================================================================
   5. Main content and page header
   ========================================================================== */
#wpbody {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-7) 0;
  min-width: 0;
}

#wpbody-content {
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
  margin: 0 auto var(--space-6);
  flex: 1 0 auto;
}

.page-header-area,
.wrap-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.page-title-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

.page-header-area > .cluster { flex: 1 1 auto; justify-content: flex-end; }

.wp-heading-inline,
.page-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

/* ==========================================================================
   6. Buttons
   ========================================================================== */
.button,
.page-title-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font: 500 var(--fs-sm) / 1.2 var(--font-family);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.wp-admin .button { color: var(--text-2); }

.button:hover {
  background: var(--surface-3);
  border-color: var(--neutral-400);
  color: var(--text);
}

.button:disabled,
.button[disabled] { opacity: 0.55; cursor: not-allowed; }

.button svg,
.page-title-action svg { flex-shrink: 0; }

/* Primary: kept firm with !important so legacy inline colors stay on brand */
.button-primary,
.page-title-action,
body.wp-admin .button-primary,
body.wp-admin .page-title-action {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--accent-contrast) !important;
  font-weight: 600;
}

.button-primary:hover,
.page-title-action:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.button-secondary { background: var(--surface); }

.button-sm,
.button-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.button-large { min-height: 42px; padding: 0 18px; font-size: var(--fs-base); font-weight: 600; }

.button-block { width: 100%; }

.button-danger,
body.wp-admin .button-danger {
  background: var(--surface);
  border-color: var(--danger-border);
  color: var(--danger);
}

.button-danger:hover { background: var(--danger-bg); border-color: var(--danger-strong); color: var(--danger); }

.button-link,
.button-link-delete,
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: 500 var(--fs-sm) / 1.3 var(--font-family);
  cursor: pointer;
  text-decoration: none;
}

.button-link,
.link-button { color: var(--text-2); }

.button-link:hover,
.link-button:hover { color: var(--text); text-decoration: underline; }

.button-link-delete,
body.wp-admin .button-link-delete { color: var(--danger) !important; background: none; }

.button-link-delete:hover { background: var(--danger-bg) !important; }

.button.button-link-delete {
  min-height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
}

.button-sm.button-link-delete,
.button.button-sm.button-link-delete { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }

.btn-trash-post {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--danger);
  font: 600 var(--fs-sm) / 1.2 var(--font-family);
  cursor: pointer;
}

.btn-trash-post:hover { background: var(--danger-bg); }

.button-group,
.actions-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.inline-form { display: inline; margin: 0; }

/* ==========================================================================
   7. Cards, notices, forms
   ========================================================================== */
.postbox,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: var(--space-5);
  min-width: 0;
}

.postbox .hndle,
.card-header {
  margin: 0;
  min-height: 52px;
  padding: var(--space-3) var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  background: transparent;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.postbox .hndle .badge { font-size: 11px; }

.postbox .inside,
.card-body { padding: var(--space-5); }

.postbox .inside > :last-child,
.card-body > :last-child { margin-bottom: 0; }

.postbox .inside.flush,
.card-body.flush { padding: 0; }

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.card-grid > .postbox,
.card-grid > .card { margin-bottom: 0; }

.danger-zone { border-color: var(--danger-border); }

.danger-zone .hndle { color: var(--danger); background: var(--danger-bg); }

.panel-subtle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

/* Notices */
.notice,
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-5);
  padding: 11px 12px 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.45;
}

.notice > svg { flex-shrink: 0; margin-top: 1px; }

.notice p,
.alert p { margin: 0; flex: 1; min-width: 0; }

.notice-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }

.notice-error,
.alert-error,
#login_error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

.notice-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

.notice-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }

.notice-dismiss {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin: -3px -2px -3px auto;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: currentColor;
  opacity: 0.7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.notice-dismiss:hover { opacity: 1; background: rgba(0, 0, 0, 0.05); }

.notice.is-dismissing { opacity: 0; transition: opacity var(--dur) var(--ease); }

/* Forms */
.form-group { margin-bottom: var(--space-4); }

.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}

.inline-check,
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

.check-row { display: flex; align-items: flex-start; }

.check-row input { margin-top: 3px; }

input.widefat,
textarea.widefat,
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
textarea {
  width: 100%;
  max-width: 100%;
  min-height: var(--control-h);
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

textarea { min-height: 80px; line-height: 1.55; resize: vertical; }

input::placeholder,
textarea::placeholder { color: var(--text-faint); }

select,
select.widefat,
.post_status,
select.filter-select,
.form-table select {
  width: 100%;
  max-width: 100%;
  min-height: var(--control-h);
  padding: 7px 32px 7px 11px;
  padding-right: 32px !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 11px center !important;
  background-size: 12px 12px !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

select[multiple] {
  background-image: none !important;
  padding-right: 11px !important;
  white-space: normal;
}

input[type="file"] {
  max-width: 100%;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

input[type="file"].widefat { padding: 6px; min-height: var(--control-h); }

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font: 500 var(--fs-xs) / 1.2 var(--font-family);
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

input[type="color"] { cursor: pointer; }

input:hover:not(:focus):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not(:disabled),
textarea:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled) { border-color: var(--neutral-400); }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--focus-ring);
}

input[type="checkbox"]:focus,
input[type="radio"]:focus { box-shadow: none; }

input:disabled,
textarea:disabled,
select:disabled { background-color: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }

.title-input {
  min-height: 44px;
  font-size: var(--fs-md) !important;
  font-weight: 600;
}

.slug-input,
#logo_slug { min-height: 44px; }

.description,
p.description {
  margin: 6px 0 0;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Intro paragraphs at the top level of a card body */
.postbox .inside > p.description,
.card-body > p.description { margin-bottom: var(--space-4); }

.inline-fields,
.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-fields > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.inline-fields > select,
.row-form > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.row-form > select {
  width: auto;
  flex: 1 1 180px;
  min-width: 0;
}

.inline-fields > label { margin: 0; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.field-grid > .form-group { margin-bottom: 0; }

.password-wrap { position: relative; display: block; width: 100%; }

.password-wrap input { padding-right: 72px !important; margin: 0; }

.password-wrap .pwd-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font: 600 11.5px / 1 var(--font-family);
  cursor: pointer;
  user-select: none;
}

.password-wrap .pwd-toggle:hover { background: var(--neutral-200); color: var(--text); }

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  flex: 0 1 380px;
  min-width: 0;
  max-width: 420px;
}

.search-box input[type="search"] { flex: 1; min-width: 0; width: auto; }

/* ==========================================================================
   8. Tables
   ========================================================================== */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

/* Tables placed inside a card body sit flush */
.postbox .inside > .table-responsive,
.card-body > .table-responsive {
  margin-bottom: 0;
  border: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  box-shadow: none;
}

.table-responsive > table { min-width: 640px; }

table.widefat,
.wp-list-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  text-align: left;
  font-size: var(--fs-sm);
}

table.widefat thead th,
.wp-list-table thead th {
  padding: 10px var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

table.widefat thead th a { color: inherit; text-decoration: none; }

table.widefat tbody td,
table.widefat tbody th,
.wp-list-table tbody td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}

table.widefat tbody tr:last-child > td,
table.widefat tbody tr:last-child > th { border-bottom: 0; }

table.widefat tbody tr { transition: background-color var(--dur) var(--ease); }

table.widefat tbody tr:hover { background: var(--surface-2); }

table.widefat tbody input[type="text"],
table.widefat tbody input[type="password"],
table.widefat tbody input[type="email"],
table.widefat tbody select { min-height: 32px; }

table.widefat a,
.wp-list-table a { color: var(--text); text-decoration: none; font-weight: 600; }

table.widefat a:hover { text-decoration: underline; }

table.widefat a.button,
table.widefat a.button:hover { font-weight: 500; text-decoration: none; }

table.widefat a.badge { font-weight: 600; }

table.widefat.striped tbody tr:nth-child(odd) { background: var(--surface-2); }

/* Key-value table without chrome (dashboard system overview) */
table.widefat.kv-table td { padding: 10px 0; }

table.widefat.kv-table td:first-child { font-weight: 600; color: var(--text); }

table.widefat.kv-table td:last-child { text-align: right; }

table.widefat.kv-table tbody tr:hover { background: transparent; }

table.widefat td.column-title { min-width: 220px; }

.col-check { width: 40px; text-align: center !important; padding-left: 12px !important; padding-right: 4px !important; }

.col-actions,
.text-right,
.ta-right { text-align: right !important; }

.empty-row td,
td.empty-cell {
  padding: var(--space-7) var(--space-4) !important;
  text-align: center;
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-top: 4px;
  font-size: var(--fs-xs);
}

.row-actions > span { display: none; }

.row-actions a,
.row-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: 500 var(--fs-xs) / 1.5 var(--font-family);
  text-decoration: none;
  cursor: pointer;
}

table.widefat .row-actions a { font-weight: 500; color: var(--text-muted); }

.row-actions a:hover,
.row-actions button:hover { color: var(--text); text-decoration: underline; }

.row-actions .button-link-delete,
.row-actions .is-danger { color: var(--danger) !important; }

.row-actions .button-link-delete:hover { background: none !important; }

.row-actions .quick-edit-trigger { color: var(--text-2); font-weight: 600; }

/* Quick edit row */
tr.quick-edit-row,
tr.quick-edit-row:hover { background: var(--surface-2); }

tr.quick-edit-row > td {
  padding: var(--space-4) var(--space-5) !important;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px solid var(--border-strong) !important;
}

.quick-edit-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}

.quick-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.quick-edit-grid label,
.mini-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}

.quick-status-msg { font-size: var(--fs-xs); font-weight: 600; color: var(--success); }

/* ==========================================================================
   9. Badges, pills, chips
   ========================================================================== */
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}

.badge-published,
.badge-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }

.badge-draft,
.badge-neutral,
.badge-muted { background: var(--surface-3); border-color: var(--border); color: var(--text-2); }

.badge-scheduled,
.badge-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

.badge-trash,
.badge-error,
.badge-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

.badge-info,
.badge-tag { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }

.badge-featured,
.badge-admin { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.badge-editor { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }

.badge + .badge { margin-left: 4px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }

.tag-list .badge + .badge { margin-left: 0; }

.code-pill {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
}

.text-dash { color: var(--text-faint); }

.count-pill {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

/* ==========================================================================
   10. Tabs, filters, pagination
   ========================================================================== */
.settings-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 var(--space-5);
  padding: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 10px 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

body.wp-admin .settings-tab { color: var(--text-muted); }

.settings-tab:hover,
body.wp-admin .settings-tab:hover { color: var(--text); border-bottom-color: var(--border-strong); }

.settings-tab.is-active,
.settings-tab.nav-tab-active,
body.wp-admin .settings-tab.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.settings-tab:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* Status filter list (logos) */
.subsubsub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}

.subsubsub li { margin: 0; }

.subsubsub li.subsubsub-end { margin-left: auto; }

.subsubsub a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.wp-admin .subsubsub a { color: var(--text-muted); }

.subsubsub a:hover,
body.wp-admin .subsubsub a:hover { background: var(--surface-3); color: var(--text); }

.subsubsub a.current,
body.wp-admin .subsubsub a.current {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}

.subsubsub .count { color: var(--text-faint); font-weight: 500; }

/* Generic pill filter row (media) */
.filter-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.filter-pills .button { border-radius: var(--radius-full); }

.pill-count {
  display: inline-block;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
}

.button-primary .pill-count { background: rgba(255, 255, 255, 0.2); color: #ffffff; }

/* Segmented view switch (media grid / list) */
.view-mode-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.btn-view-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.wp-admin .btn-view-mode { color: var(--text-muted); }

.btn-view-mode:hover,
body.wp-admin .btn-view-mode:hover { color: var(--text); }

.btn-view-mode.active,
body.wp-admin .btn-view-mode.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Toolbar above lists */
.toolbar,
.tablenav.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.toolbar-group,
.bulkactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.bulkactions select { width: auto; min-width: 170px; }

.selection-count {
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.bulk-edit-panel {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

.bulk-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.bulk-edit-head h4 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}

.bulk-edit-head h4 svg { margin: -2px 6px 0 0; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.bulk-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
  align-items: start;
}

/* Buttons line up with the inputs: an empty label above them takes the label row's height. */
.bulk-edit-grid > .bulk-edit-actions { align-self: start; }
.bulk-edit-actions .button-group { flex-wrap: nowrap; }

.radio-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }

.radio-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-xs); font-weight: 500; cursor: pointer; }

/* Pagination */
.tablenav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

.tablenav-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.tablenav-pages > span:first-child { margin-right: var(--space-2); }

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ==========================================================================
   11. Dashboard widgets
   ========================================================================== */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.stat-icon-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text-2);
}

.stat-icon-wrap svg { width: 20px; height: 20px; }

.stat-icon-blue { background: var(--info-bg); color: var(--info); }
.stat-icon-green { background: var(--success-bg); color: var(--success); }
.stat-icon-purple { background: var(--surface-3); color: var(--text-2); }
.stat-icon-amber { background: var(--warning-bg); color: var(--warning); }

.stat-content { display: flex; flex-direction: column; min-width: 0; }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  overflow-wrap: anywhere;
}

.stat-label { margin-top: 2px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }

.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.dashboard-widgets > .postbox { margin-bottom: 0; }

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--space-2);
}

.action-card-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

body.wp-admin .action-card-btn { color: var(--text); }

.action-card-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }

.action-card-btn.is-primary { border-color: var(--accent); }

.action-card-btn small { font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); }

.card-section-divider { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* ==========================================================================
   12. Logo editor and media
   ========================================================================== */
#post-body.columns-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-5);
  align-items: start;
}

#post-body-content,
.postbox-container { min-width: 0; }

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
}

.upload-field,
.upload-preview-group {
  min-width: 0;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--surface-2) !important;
}

.upload-preview-group { padding: var(--space-4); }

.upload-preview-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.upload-preview-group-head h3 { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--text); }

.upload-bg-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.upload-bg-picker input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: none;
}

.upload-bg-picker .bg-hex-input { min-height: 26px; }

.logo-live-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin: 10px 0 6px;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background-color: #ffffff;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}

.logo-live-preview:hover { border-color: var(--text-2); border-style: solid; }

.logo-live-preview::after {
  content: "Open Media Library";
  position: absolute;
  right: 8px;
  bottom: 6px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.logo-live-preview:hover::after { opacity: 1; }

.logo-live-preview img,
.logo-live-preview object { max-width: 100%; max-height: 100px; object-fit: contain; pointer-events: none; }

.logo-live-preview-empty { color: var(--text-faint); font-size: var(--fs-xs); font-weight: 500; pointer-events: none; }

.custom-variant-card { border-radius: var(--radius-lg); }

/* Category checklist */
.category-check-item { border-radius: var(--radius-sm); }

.category-check-item:hover { background: var(--surface-3); }

/* Brand color swatches */
.color-swatches-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) 0;
}

.swatch-edit { position: relative; display: inline-flex; }

.swatch-edit input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: none;
}

.swatch-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--danger-strong);
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.swatch-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease);
}

.swatch-item:hover,
.swatch-item:focus-within { border-color: var(--text-2); }

.swatch-color-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: none;
}

.swatch-hex-input {
  width: 84px !important;
  min-height: 28px !important;
  padding: 3px 6px !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs) !important;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  font-weight: 600;
  text-transform: uppercase;
}

.swatch-remove-btn {
  padding: 2px 5px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.swatch-remove-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* Search result preview (deliberately Google-like) */
.serp-preview-box {
  margin-top: 14px;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  font-family: inherit;
}

.serp-preview-url { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12px; color: #202124; }

.serp-preview-url span { color: #5f6368; }

.serp-preview-title { margin-bottom: 4px; font-size: 17px; line-height: 1.3; color: #1a0dab; cursor: pointer; }

.serp-preview-desc { margin: 0; font-size: 13px; line-height: 1.45; color: #4d5156; }

/* Media library */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.media-item-card { transition: border-color var(--dur) var(--ease); }

.media-item-card:hover { border-color: var(--border-strong) !important; }

.media-thumb-box {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.upload-dropzone {
  border: 2px dashed var(--border-strong) !important;
  background: var(--surface-2) !important;
}

.sort-indicator { font-size: 10px; color: var(--text-faint); }

.sort-indicator.is-active { font-size: 11px; color: var(--text); font-weight: 700; }

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-full);
  background: var(--info-bg);
  color: var(--info);
  font-size: var(--fs-xs);
  font-weight: 600;
}

body.wp-admin .search-chip a { color: var(--info); text-decoration: none; font-weight: 700; }

/* Progress bars used by long-running tools */
.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1px solid var(--border);
}

/* Console style log boxes keep their dark look for readability */
[id$="-log-box"] { scrollbar-width: thin; }

/* ==========================================================================
   13. Login page
   ========================================================================== */
body.auth-page {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: var(--font-family);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.auth-page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("/logos/assets/images/front.svg");
  background-repeat: repeat;
  background-size: 80px 40px;
  opacity: 0.035;
  pointer-events: none;
}

.auth-page-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: var(--space-7) var(--space-4);
}

.auth-header-brand { margin-bottom: var(--space-5); text-align: center; }

.auth-brand { display: inline-block; margin: 0; text-decoration: none; border-radius: var(--radius); }

.auth-brand img { display: block; max-height: 44px; width: auto; margin: 0 auto; object-fit: contain; }

.auth-card {
  padding: var(--space-7) 28px var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.auth-card-header { margin-bottom: var(--space-5); text-align: center; }

.auth-card-header h1 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-card-header p { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-muted); }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin-bottom: var(--space-5);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.auth-tab {
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: 500 var(--fs-sm) / 1.3 var(--font-family);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.auth-tab:hover { color: var(--text); }

.auth-tab.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

.auth-panel { display: block; }

.auth-panel[hidden],
.auth-panel:not(.is-active) { display: none !important; }

.auth-form { display: grid; gap: var(--space-4); }

.auth-field { position: relative; display: grid; gap: 6px; }

.auth-field label { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }

.auth-field .auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.auth-input-wrapper { position: relative; display: flex; align-items: center; }

.auth-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.auth-input[type="password"],
#user_pass { padding-right: 42px; }

.auth-input:focus { outline: none; border-color: var(--focus); box-shadow: var(--focus-ring); }

.auth-input-code { font-size: 20px; letter-spacing: 0.3em; text-align: center; }

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-faint);
  cursor: pointer;
}

.password-toggle-btn:hover { color: var(--text-2); background: var(--surface-3); }

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 600 var(--fs-base) / 1.2 var(--font-family);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.auth-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.auth-btn-google { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }

.auth-btn-google:hover { background: var(--surface-3); color: var(--text); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
  color: var(--text-faint);
  font-size: var(--fs-xs);
}

.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.auth-footer a { color: var(--text-muted); font-size: var(--fs-sm); text-decoration: none; }

.auth-footer a:hover { color: var(--text); text-decoration: underline; }

.auth-page .notice { margin-bottom: var(--space-4); }

.captcha-stack { display: grid; gap: var(--space-2); }

/* ==========================================================================
   14. Utilities
   ========================================================================== */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; min-width: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-4); }
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.p-0 { padding: 0 !important; }
.w-auto { width: auto !important; }
.w-full { width: 100% !important; }
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-xs { font-size: var(--fs-xs) !important; }
.text-sm { font-size: var(--fs-sm) !important; }
.text-center { text-align: center !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.mono { font-family: var(--font-mono) !important; }
.nowrap { white-space: nowrap; }
.max-w-180 { max-width: 180px; }
.hint-text { font-size: var(--fs-xs); color: var(--text-muted); }

/* ==========================================================================
   15. Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  #post-body.columns-2 { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media (max-width: 900px) {
  :root { --sidebar-current: 0px; }

  #adminmenumain {
    width: 272px;
    max-width: 86vw;
    transform: translateX(-100%);
    box-shadow: none;
    visibility: hidden;
    transition: transform 0.2s var(--ease), visibility 0s linear 0.2s;
  }

  body.mobile-nav-open #adminmenumain {
    transform: translateX(0);
    visibility: visible;
    box-shadow: var(--shadow-xl);
    transition: transform 0.2s var(--ease), visibility 0s;
  }

  .sidebar-close { display: grid; }

  .sidebar-collapse-btn { display: none; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(9, 9, 11, 0.45);
  }

  body.mobile-nav-open .sidebar-backdrop { display: block; }

  body.mobile-nav-open { overflow: hidden; }

  #wpcontent { margin-left: 0; }

  .mobile-nav-toggle { display: inline-flex; }

  #wpadminbar { padding: 0 var(--space-4); }

  #wpbody { padding: var(--space-5) var(--space-4) 0; }

  #post-body.columns-2,
  .dashboard-widgets { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --control-h: 38px; }

  #wpadminbar { gap: var(--space-2); }

  .topbar-breadcrumb > span:first-child,
  .topbar-breadcrumb .crumb-slash { display: none; }

  .topbar-btn-text { display: none; }

  .btn-view-site,
  .btn-logout { width: 36px; padding: 0; justify-content: center; }

  #wpbody { padding: var(--space-4) var(--space-4) 0; }

  .wp-heading-inline,
  .page-title { font-size: 19px; }

  .postbox .hndle,
  .card-header { padding: var(--space-3) var(--space-4); font-size: 14.5px; }

  .postbox .inside,
  .card-body { padding: var(--space-4); }

  .page-header-area,
  .wrap-header { align-items: stretch; }

  .search-box { max-width: none; }

  .subsubsub {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: calc(var(--space-4) * -1);
    margin-right: calc(var(--space-4) * -1);
    padding: 0 var(--space-4);
  }

  .subsubsub::-webkit-scrollbar { display: none; }

  .subsubsub li { flex-shrink: 0; }

  .settings-tabs { margin-left: calc(var(--space-4) * -1); margin-right: calc(var(--space-4) * -1); padding: 0 var(--space-4); }

  .dashboard-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }

  .stat-icon-wrap { width: 34px; height: 34px; }

  .stat-value { font-size: 20px; }

  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .tablenav { justify-content: center; }


  .auth-card { padding: var(--space-6) var(--space-5) var(--space-5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Dashboard: stat cards link to the matching filtered list. */
.stat-card-link {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat-card-link:hover { border-color: var(--border-strong, var(--text-muted)); box-shadow: var(--shadow-sm, var(--shadow-xs)); }
.stat-card-link:focus-visible { outline: 2px solid var(--focus, #2563eb); outline-offset: 2px; }

/* Edge-to-edge tables inside a card: line the first and last columns up with the card header. */
.postbox .inside.flush .widefat th:first-child,
.postbox .inside.flush .widefat td:first-child { padding-left: var(--space-5); }
.postbox .inside.flush .widefat th:last-child,
.postbox .inside.flush .widefat td:last-child { padding-right: var(--space-5); }

/* Browsers give buttons and form fields their own system font; use the admin font everywhere. */
button, input, select, textarea, optgroup { font-family: inherit; }

/* Row actions (Save + Delete, Edit + Delete...) stay on one line instead of stacking. */
td.col-actions { white-space: nowrap; width: 1%; }
td.col-actions .button-group,
td.col-actions .actions-inline { flex-wrap: nowrap; justify-content: flex-end; }

/* Page header: keep search + view switch together on one line; the search box gives up width first. */
.page-header-area > .cluster { flex: 1 1 260px; flex-wrap: nowrap; min-width: 0; }
.page-header-area > .cluster .search-box { flex: 1 1 auto; }
@media (max-width: 640px) {
  .page-header-area > .cluster { flex-wrap: wrap; }
}

/* Close (x) button in the top-right corner of a collapsible panel. */
.upload-dropzone { position: relative; }
.panel-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.panel-close-btn:hover { background: var(--surface-3); color: var(--text); }
.panel-close-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Media: selection count + bulk delete, same 30px height as the filter pills. */
.bulk-selection { display: inline-flex; align-items: center; gap: 6px; }
.selection-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-full);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* Media on phones: full-width primary action, tools in a 2 x 2 grid,
   search + view switch on one row, filters filling their rows evenly. */
@media (max-width: 640px) {
  .media-header { flex-direction: column; align-items: stretch; }
  .media-header > * { flex: 0 0 auto; }
  .media-header .page-title-group { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .media-header .page-title-group > :first-child { grid-column: 1 / -1; }
  .media-header .page-title-group > .button { width: 100%; justify-content: center; }
  .page-header-area.media-header > .cluster { flex: 0 0 auto; flex-wrap: nowrap; width: 100%; }
  .media-header .search-box { flex: 1 1 auto; max-width: none; }

  .media-toolbar { flex-direction: column; align-items: stretch; }
  .media-toolbar .filter-pills { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .media-toolbar .filter-pills > .button { width: 100%; justify-content: center; }
  .media-toolbar .filter-pills > .search-chip,
  .media-toolbar .bulk-selection { grid-column: 1 / -1; }
  .media-toolbar .bulk-selection { justify-content: space-between; }
  .media-toolbar > .cluster { justify-content: space-between; }
}

/* Screen Options: top-bar button with a small dropdown for items per page. */
.screen-options { position: relative; }
.screen-options-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 260px;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(16, 16, 24, 0.12));
}
.screen-options-panel[hidden] { display: none; }
.screen-options-panel label { display: block; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.screen-options-row { display: flex; gap: var(--space-2); }
.screen-options-row input { flex: 1 1 auto; min-width: 0; }
.screen-options-panel .description { margin: 8px 0 0; font-size: var(--fs-xs); }
@media (max-width: 640px) {
  .screen-options-panel { position: fixed; top: calc(var(--topbar-h) + 8px); left: var(--space-4); right: var(--space-4); width: auto; }
}

/* Logos list: post titles in the info blue, 1px larger than the other cells. */
table.widefat .row-logo-title a,
table.widefat .row-logo-title span { color: var(--info); font-size: 14px; }
table.widefat .row-logo-title a:hover { color: var(--info); }

/* .button sets display, which would otherwise override the hidden attribute. */
.storage-actions [hidden] { display: none !important; }

/* Logo editor: most used tags, one click to add */
.popular-tags {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--neutral-200, #e2e8f0);
}
.popular-tags-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}
.popular-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.popular-tag-btn {
  font: inherit;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 2px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}
.popular-tag-btn:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}
.popular-tag-btn.is-added {
  display: none;
}
