/**
 * platform — dashboard styling.
 *
 * Visual language matches /core/cms/ (system font stack, neutral
 * palette, soft shadows, 6px radii) but lives in its own namespace
 * so platform UI can evolve without touching cms's edit-mode look.
 * The .admin-profile-* user-pill markup is styled by /core/lib/chrome.css
 * (shared with cms/), loaded alongside this stylesheet.
 */

:root {
  --plat-bg:         #f6f6f8;
  --plat-card:       #ffffff;
  --plat-border:     #e5e7eb;
  --plat-fg:         #1f2937;
  --plat-muted:      #6b7280;
  --plat-faint:      #9ca3af;
  --plat-accent:     #1f2937;
  --plat-bar-bg:     #1f2937;
  --plat-bar-fg:     #f6f6f8;
  --plat-side-bg:    #ffffff;
  --plat-side-hover: #f3f4f6;
  --plat-side-active:#1f2937;
}

[data-theme="dark"] {
  --plat-bg:         #0f1117;
  --plat-card:       #181b22;
  --plat-border:     #2a2d35;
  --plat-fg:         #f0f0f8;
  --plat-muted:      #8a8a9a;
  --plat-faint:      #5a5a70;
  --plat-accent:     #f0f0f8;
  --plat-bar-bg:     #1f1d1a;
  --plat-bar-fg:     #f6f1ed;
  --plat-side-bg:    #181b22;
  --plat-side-hover: #23262e;
  --plat-side-active:#c0673a;
}

body.is-dashboard-mode {
  margin: 0;
  background: var(--plat-bg);
  color: var(--plat-fg);
  font: 14px/1.5 var(--ui-font-family-sans);
}
body.is-dashboard-mode * { box-sizing: border-box; }
body.is-dashboard-mode a { color: inherit; }

/* ─── Top bar — module-specific styling. Visual base (palette, height,
 * z-index, border, padding) comes from .admin-chrome-bar in chrome.css.
 * Per the "admin chrome stays dark" convention, the bar is hardcoded
 * dark regardless of site theme. */
.dashboard-bar {
  /* Slightly tighter side padding than chrome's default 24px so the
   * burger button and profile pill don't crowd a narrow viewport. */
  padding: 0 16px;
}
.dashboard-bar-title {
  font-weight: 700; letter-spacing: 0.2px; font-size: 14px;
}
.dashboard-bar-title .dashboard-bar-site {
  color: var(--ui-chrome-text-mut); font-weight: 500; margin-left: 8px;
}
.dashboard-bar-spacer { flex: 1; }
.dashboard-bar-link {
  color: var(--ui-chrome-text-mut); text-decoration: none; font-size: 13px;
  padding: 6px 10px; border-radius: 4px;
}
.dashboard-bar-link:hover { color: var(--ui-chrome-text); background: var(--ui-chrome-surface); }

/* The user pill (.admin-profile-*) is defined in /core/lib/chrome.css.
 * Tokenised so the bar palette flips with the active template (ethereal,
 * black-friday, future). */
.dashboard-bar .admin-profile-btn {
  background: var(--ui-chrome-surface); border-color: var(--ui-chrome-border);
  color: var(--ui-chrome-text);
}
.dashboard-bar .admin-profile-btn:hover { background: var(--ui-chrome-surface-hover); }
.dashboard-bar .admin-profile-name { color: var(--ui-chrome-text); }
.dashboard-bar .admin-profile-caret { color: var(--ui-chrome-text-mut); }

/* ─── Shell layout ───────────────────────────────────────────────── */
.dashboard-shell {
  display: flex; min-height: calc(100vh - 48px); padding-top: 48px;
}
.dashboard-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--plat-side-bg);
  border-right: 1px solid var(--plat-border);
  padding: 16px 12px;
  position: sticky; top: 48px; height: calc(100vh - 48px);
  overflow-y: auto;
}
.dashboard-sidebar-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--plat-faint); padding: 6px 10px; margin-top: 6px;
}
.dashboard-sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 2px 0;
  border-radius: 5px;
  text-decoration: none; color: var(--plat-fg); font-size: 13px;
  cursor: pointer;
  position: relative;
}
.dashboard-sidebar-link:hover { background: var(--plat-side-hover); }
.dashboard-sidebar-link.is-active {
  background: var(--plat-side-active); color: #fff; font-weight: 600;
}
.dashboard-sidebar-link.is-disabled {
  color: var(--plat-faint); pointer-events: none;
}
.dashboard-sidebar-link.is-disabled .dashboard-soon {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: var(--plat-border); color: var(--plat-faint); font-weight: 600;
  letter-spacing: 0.4px; text-transform: uppercase;
}
.dashboard-sidebar-icon {
  width: 18px; text-align: center; opacity: 0.8;
}

/* ─── Content ────────────────────────────────────────────────────── */
.dashboard-content {
  flex: 1;
  /* min-width: 0 is critical — without it, the flex child grows to fit
   * min-content of its descendants (a 480px-wide table inside a
   * scrollable .dashboard-section), which pushes the whole shell past
   * the viewport on mobile and causes horizontal page scroll. */
  min-width: 0;
  padding: 28px 36px 60px;
  max-width: 1200px;
}

.dashboard-page-head { margin-bottom: 22px; }
.dashboard-page-head h1 {
  font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.2px;
}
.dashboard-page-sub { color: var(--plat-muted); font-size: 13px; margin-top: 3px; }

/* ─── Cards ──────────────────────────────────────────────────────── */
/* Card primitive (.ui-card / .ui-card--stat / __title / __value / __meta)
 * lives in core/lib/ui/components.css. Only the grid layout below is
 * dashboard-specific. */
.dashboard-card-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 980px) {
  .dashboard-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .dashboard-card-grid { grid-template-columns: 1fr; }
  .dashboard-content   { padding: 20px 18px 40px; }
  /* Sidebar is converted into an off-canvas drawer in the 860px block
   * below — never `display: none` so the toggle keeps working. */
}

/* ─── Section + feed ─────────────────────────────────────────────── */
.dashboard-section {
  background: var(--plat-card);
  border: 1px solid var(--plat-border);
  border-radius: 8px;
  padding: 18px 22px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.dashboard-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.dashboard-section-head h2 { font-size: 14px; font-weight: 700; margin: 0; }
.dashboard-section-sub    { font-size: 12px; color: var(--plat-muted); }

.dashboard-empty {
  padding: 20px 0; color: var(--plat-muted); font-size: 13px; text-align: center;
}

/* Plugin-disabled banner — uses central .ui-banner --warn. See
 * render_plugin_disabled_banner() in core/lib/widget_allowlist.php. */

.dashboard-feed { list-style: none; margin: 0; padding: 0; }
.dashboard-feed-row {
  display: grid; grid-template-columns: 14px 60px 1fr;
  align-items: center; gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--plat-border);
  font-size: 13px;
}
.dashboard-feed-row:first-child { border-top: 0; }
.dashboard-feed-time { color: var(--plat-faint); font-variant-numeric: tabular-nums; font-size: 12px; }
.dashboard-feed-body { color: var(--plat-fg); }
.dashboard-feed-body code {
  font: 600 12px/1 var(--ui-font-family-mono);
  background: var(--plat-bg); padding: 1px 5px; border-radius: 3px;
}
.dashboard-feed-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--plat-faint);
}
.dashboard-feed-dot--chat       { background: #3b82f6; }
.dashboard-feed-dot--chat-start { background: #93c5fd; }
.dashboard-feed-dot--lead       { background: #10b981; }
.dashboard-feed-dot--waitlist   { background: #f59e0b; }
.dashboard-feed-dot--revision   { background: #8b5cf6; }
.dashboard-feed-dot--snapshot   { background: #6b7280; }
.dashboard-feed-dot--handoff    { background: #ef4444; }

/* ─── Chats page ─────────────────────────────────────────────────── */
.chats-list { display: block; }
.chats-session {
  border-top: 1px solid var(--plat-border);
  padding: 0;
}
.chats-session:first-child { border-top: 0; }
.chats-session[open] { background: var(--plat-bg); }
.chats-summary {
  display: grid;
  grid-template-columns: 60px 1fr auto auto 110px;
  gap: 14px;
  align-items: center;
  padding: 10px 6px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}
.chats-summary::-webkit-details-marker { display: none; }
.chats-summary::before {
  content: "▸";
  color: var(--plat-faint);
  margin-right: -8px;
  font-size: 10px;
  transition: transform .15s;
  display: inline-block;
}
.chats-session[open] > .chats-summary::before { transform: rotate(90deg); }
.chats-summary:hover { background: rgba(0,0,0,0.02); }
.chats-time  { color: var(--plat-faint); font-variant-numeric: tabular-nums; font-size: 12px; }
.chats-email { color: var(--plat-fg); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chats-count { color: var(--plat-muted); font-size: 12px; }
.chats-sid   {
  color: var(--plat-faint);
  font: 11px var(--ui-font-family-mono);
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Chat-bubble layout — shows the conversation the way the customer saw it:
   visitor right, bot left, rendered markdown in the bot bubbles. */
.chats-turns {
  padding: 10px 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.chats-empty { color: var(--plat-muted); font-size: 12px; padding: 8px 0; }
.chats-turn {
  display: flex; flex-direction: column; gap: 3px;
  max-width: 80%;
  font-size: 13px; line-height: 1.55;
}
.chats-turn--user { align-self: flex-end;   align-items: flex-end; }
.chats-turn--bot  { align-self: flex-start; align-items: flex-start; }
.chats-turn-meta { display: flex; gap: 8px; align-items: center; padding: 0 4px; }
.chats-turn-role {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 2px 6px; border-radius: 3px;
}
.chats-turn--user .chats-turn-role { background: #dbeafe; color: #1e40af; }
.chats-turn--bot  .chats-turn-role { background: #f3f4f6; color: #4b5563; }
.chats-turn-time { color: var(--plat-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chats-turn-body {
  padding: 9px 13px; border-radius: 14px;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.chats-turn--user .chats-turn-body {
  background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff;
  border-bottom-right-radius: 4px;
}
.chats-turn--bot .chats-turn-body {
  background: #f3f4f6; color: #374151;
  border-bottom-left-radius: 4px;
}
.chats-turn-body--md strong { font-weight: 700; }
.chats-turn-body--md em { font-style: italic; }
.chats-turn-img { display: block; margin-top: 6px; }
.chats-turn-img img {
  max-width: 260px; max-height: 200px; border-radius: 10px;
  border: 1px solid var(--plat-border, #e5e7eb); display: block;
}
.chats-turn-img:hover img { opacity: 0.92; }

@media (max-width: 640px) {
  .chats-summary { grid-template-columns: 60px 1fr auto; gap: 8px; }
  .chats-sid     { display: none; }
  .chats-turn    { max-width: 92%; }
}

/* ─── Content page ───────────────────────────────────────────────── */
.content-key {
  color: var(--plat-fg);
  text-decoration: none;
  border-bottom: 1px dotted var(--plat-faint);
}
.content-key:hover { color: #2563eb; border-bottom-color: #2563eb; }

.content-preview {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--plat-muted);
  font-size: 12px;
}
.content-empty { color: var(--plat-faint); font-style: italic; }

.dashboard-table td.is-stale { color: var(--plat-faint); }
/* Usage page — green tint on rows where Anthropic served cached input,
 * so cost savings stand out at a glance. */
.dashboard-table td.is-cache-hit { color: #10b981; font-weight: 600; }

/* ─── Inline action buttons ──────────────────────────────────────── */
/* (Flash banner uses central .ui-banner --success/--error.) */
.dashboard-action-form {
  display: inline-block;
  margin: 0;
}
/* Inline action buttons in tables/forms → central .ui-btn
 * (--primary / --ghost / .is-disabled). */

/* ── Generic page-level tabs (Users / Audit etc.) ─────────────────── */
.dashboard-tabs {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--plat-border);
  margin: 14px 0 18px;
}
.dashboard-tab {
  display: inline-block;
  padding: 8px 14px;
  font: 13px/1 var(--ui-font-family-sans);
  color: var(--plat-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  position: relative;
  top: 1px;
}
.dashboard-tab:hover { color: var(--plat-fg); }
.dashboard-tab.is-active {
  color: var(--plat-fg);
  background: #fff;
  border-color: var(--plat-border);
  font-weight: 500;
}

/* ── Users page ────────────────────────────────────────────────────── */
.dashboard-user-cell {
  display: flex; align-items: center; gap: 10px;
}
.dashboard-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--plat-bg);
  flex: 0 0 auto;
  object-fit: cover;
}
.dashboard-user-avatar--fallback {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 12px/1 var(--ui-font-family-sans);
  color: var(--plat-muted);
  border: 1px solid var(--plat-border);
}
.dashboard-user-meta {
  min-width: 0;
}
.dashboard-user-name {
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.dashboard-user-self {
  font: 500 10px/1 var(--ui-font-family-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 3px;
}
.dashboard-user-method {
  display: inline-block;
  margin-left: 6px;
  font: 500 10px/1 var(--ui-font-family-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  vertical-align: 1px;
}
.dashboard-user-method--google {
  background: #e0e7ff;
  color: #3730a3;
}
.dashboard-user-method--otp {
  background: #fef3c7;
  color: #92400e;
}
.dashboard-user-method--unknown {
  background: var(--plat-bg);
  color: var(--plat-muted);
  border: 1px solid var(--plat-border);
}
.dashboard-user-email {
  font: 12px/1.4 var(--ui-font-family-mono);
  color: var(--plat-muted);
}
.dashboard-muted { color: var(--plat-muted); }

.dashboard-users-add {
  display: flex; gap: 10px; align-items: center;
  max-width: 480px;
}
/* .dashboard-users-input → .ui-input (core/lib/ui/forms.css).
 * The form row's .dashboard-users-add wrapper still provides
 * flex layout for the input + Add button row. */
.dashboard-users-add .ui-input { flex: 1 1 auto; }
.dashboard-users-domains {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.dashboard-users-domains code {
  font: 12px/1 var(--ui-font-family-mono);
  background: var(--plat-bg);
  border: 1px solid var(--plat-border);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ── Audit log event badges ────────────────────────────────────────── */
.dashboard-audit-event {
  display: inline-block;
  font: 500 11px/1 var(--ui-font-family-sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 3px;
}
.dashboard-audit-event--login   { background: #e0f2fe; color: #075985; }
.dashboard-audit-event--added   { background: #dcfce7; color: #166534; }
.dashboard-audit-event--removed { background: #fee2e2; color: #991b1b; }

/* ─── Config editor ──────────────────────────────────────────────── */
.dashboard-table tr.is-selected {
  background: #eff6ff;
}
.dashboard-table tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #2563eb;
}
.dashboard-config-form { display: flex; flex-direction: column; gap: 10px; }
.dashboard-config-modes {
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--plat-border);
  padding-bottom: 0;
  margin-bottom: -1px;
}
.dashboard-config-mode {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  padding: 7px 14px;
  font: 13px/1 var(--ui-font-family-sans);
  color: var(--plat-muted);
  cursor: pointer;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  position: relative;
  top: 1px;
}
.dashboard-config-mode.is-active {
  background: #fff;
  color: var(--plat-fg);
  border-color: var(--plat-border);
  font-weight: 500;
}
.dashboard-config-modes-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--plat-muted);
}
.dashboard-config-modes-hint code {
  font: 11px/1 var(--ui-font-family-mono);
  background: var(--plat-bg);
  padding: 1px 5px;
  border-radius: 3px;
}
.dashboard-config-editor-host {
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border: 1px solid var(--plat-border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  /* vanilla-jsoneditor reads these CSS vars to theme itself. */
  --jse-theme-color: #1f2937;
  --jse-font-family-mono: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --jse-font-size-mono: 13px;
}
.dashboard-config-form-host {
  width: 100%;
  min-height: 420px;
  max-height: 75vh;
  overflow: auto;
  border: 1px solid var(--plat-border);
  border-radius: 0 6px 6px 6px;
  padding: 18px 20px;
  background: #fff;
  font: 13px/1.5 var(--ui-font-family-sans);
  color: var(--plat-fg);
}
.dashboard-config-form-host h3,
.dashboard-config-form-host h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--plat-fg);
}
.dashboard-config-form-host label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--plat-muted);
  margin: 10px 0 4px;
}
.dashboard-config-form-host input[type="text"],
.dashboard-config-form-host input[type="number"],
.dashboard-config-form-host input[type="email"],
.dashboard-config-form-host select,
.dashboard-config-form-host textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  font: 13px/1.4 var(--ui-font-family-sans);
  border: 1px solid var(--plat-border);
  border-radius: 5px;
  background: #fbfbfd;
  color: var(--plat-fg);
}
.dashboard-config-form-host textarea { min-height: 90px; font-family: var(--ui-font-family-mono); font-size: 12.5px; }
.dashboard-config-form-host input:focus,
.dashboard-config-form-host select:focus,
.dashboard-config-form-host textarea:focus {
  outline: 0;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.dashboard-config-form-host button {
  appearance: none;
  background: var(--plat-bg);
  border: 1px solid var(--plat-border);
  padding: 5px 10px;
  font: 12px/1 var(--ui-font-family-sans);
  color: var(--plat-fg);
  border-radius: 4px;
  cursor: pointer;
  margin: 2px;
}
.dashboard-config-form-host button:hover { background: #fff; }
.dashboard-config-form-host .errmsg,
.dashboard-config-form-host .error {
  color: #b91c1c;
  font-size: 11.5px;
  margin-top: 4px;
}
.dashboard-config-form-host [data-schemapath] {
  margin-bottom: 6px;
}
.dashboard-config-form-host .row {
  border: 1px solid var(--plat-border);
  border-radius: 5px;
  padding: 10px 12px;
  margin: 8px 0;
  background: #fbfbfd;
}

/* ── @json-editor/json-editor tab styling (html theme) ────────────────
   The library renders array-of-objects with format:"tabs" as a sidebar
   on the left + a single object form on the right. We style both that
   layout and the horizontal `tabs-top` variant so they fit the platform
   look. Class names come from the html theme. */
.dashboard-config-form-host .je-tabholder {
  display: flex;
  gap: 14px;
  align-items: stretch;
  margin: 4px 0 6px;
}
.dashboard-config-form-host .je-tabholder--top {
  flex-direction: column;
  gap: 0;
}
/* Vertical tab list (format: "tabs") */
.dashboard-config-form-host .je-tabholder > .je-tabholder--tabs,
.dashboard-config-form-host .je-tabholder > div:first-child {
  flex: 0 0 240px;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--plat-border);
  border-radius: 5px;
  background: #fbfbfd;
  padding: 4px;
}
/* Horizontal tab strip (format: "tabs-top") */
.dashboard-config-form-host .je-tabholder--top > div:first-child {
  flex: 0 0 auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-wrap: nowrap;
  border: 0;
  border-bottom: 1px solid var(--plat-border);
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin-bottom: -1px;
}
/* Each individual tab */
.dashboard-config-form-host .je-tab,
.dashboard-config-form-host div[data-schemapath] .je-tabholder > div:first-child > div {
  display: block;
  padding: 6px 10px;
  margin: 1px 0;
  font: 12.5px/1.35 var(--ui-font-family-sans);
  color: var(--plat-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-config-form-host .je-tab:hover {
  background: #fff;
  color: var(--plat-fg);
}
.dashboard-config-form-host .je-tab.je-tab--active,
.dashboard-config-form-host .je-tab.selected,
.dashboard-config-form-host .je-tab[style*="font-weight: bold"] {
  background: #fff;
  color: #2563eb;
  border-color: var(--plat-border);
  font-weight: 500;
  box-shadow: inset 3px 0 0 #2563eb;
}
/* Top-tab active style: bottom-bar accent instead of left-bar */
.dashboard-config-form-host .je-tabholder--top .je-tab.je-tab--active,
.dashboard-config-form-host .je-tabholder--top .je-tab.selected {
  box-shadow: inset 0 -3px 0 #2563eb;
  border-bottom-color: transparent;
  border-radius: 4px 4px 0 0;
}
/* Form panel next to the tab list */
.dashboard-config-form-host .je-tabholder > .je-tabholder--content,
.dashboard-config-form-host .je-tabholder > div:last-child {
  flex: 1 1 auto;
  min-width: 0;
}
.dashboard-config-form-host .je-tabholder--top > div:last-child {
  border-top: 0;
}
.dashboard-config-status {
  min-height: 18px;
  font: 12px/1.4 var(--ui-font-family-mono);
  color: var(--plat-muted);
}
.dashboard-config-status.is-error {
  color: #b91c1c;
}
.dashboard-config-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
}
.dashboard-config-actions button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.dashboard-config-hidden {
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--plat-muted);
  background: var(--plat-bg);
  border: 1px dashed var(--plat-border);
  border-radius: 5px;
}
.dashboard-config-hidden code {
  font: 12px/1 var(--ui-font-family-mono);
  background: #fff; padding: 1px 5px; border-radius: 3px;
}

/* ─── Tables ─────────────────────────────────────────────────────── */
.dashboard-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.dashboard-table th, .dashboard-table td {
  text-align: left;
  padding: 9px 10px;
  border-top: 1px solid var(--plat-border);
  vertical-align: middle;
}
.dashboard-table thead th {
  border-top: 0; border-bottom: 1px solid var(--plat-border);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--plat-muted); font-weight: 600;
  padding-top: 0; padding-bottom: 8px;
}
.dashboard-table tbody tr:hover { background: var(--plat-bg); }
.dashboard-table .num   { text-align: right; font-variant-numeric: tabular-nums; }
.dashboard-table .mono  { font: 12px/1.4 var(--ui-font-family-mono); }

/* Pill primitive (.ui-pill + state variants) lives in core/lib/ui/components.css. */

/* ─── Meter (inline progress bar) ────────────────────────────────── */
.dashboard-meter {
  display: inline-block; vertical-align: middle;
  width: 90px; height: 6px;
  background: var(--plat-border);
  border-radius: 3px; overflow: hidden;
  margin-right: 8px;
}
.dashboard-meter-fill { height: 100%; transition: width .2s ease; }
.dashboard-meter-fill--ok       { background: #10b981; }
.dashboard-meter-fill--notice   { background: #f59e0b; }
.dashboard-meter-fill--warn     { background: #ef4444; }
.dashboard-meter-fill--unknown  { background: #9ca3af; }
.dashboard-meter-pct {
  font-variant-numeric: tabular-nums;
  font-size: 12px; color: var(--plat-muted);
}

/* ─── DL (key/value list, used on Health > OPcache detail) ───────── */
.dashboard-dl {
  display: grid; grid-template-columns: 140px 1fr; gap: 6px 18px;
  margin: 0; font-size: 13px;
}
.dashboard-dl dt { color: var(--plat-muted); }
.dashboard-dl dd { margin: 0; }
.dashboard-dl dd .dashboard-meter {
  width: 200px; margin-top: 6px; margin-right: 0;
}

/* ─── Filter strip (Leads, future pages) ─────────────────────────── */
.dashboard-filter {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-left: auto;
}
.dashboard-filter select,
.dashboard-filter input[type="search"],
.dashboard-filter button {
  font: inherit; font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--plat-border); border-radius: 5px;
  background: #fff; color: var(--plat-fg);
}
.dashboard-filter input[type="search"] { width: 180px; }
.dashboard-filter button {
  background: var(--plat-fg); color: #fff; border-color: var(--plat-fg);
  cursor: pointer;
}
.dashboard-filter button:hover { background: #111827; }
.dashboard-filter-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--plat-muted);
}
.dashboard-filter-clear {
  font-size: 12px; color: var(--plat-muted);
  text-decoration: underline; text-decoration-style: dotted;
}
.dashboard-filter-clear:hover { color: var(--plat-fg); }
.dashboard-filter-download {
  font-size: 12px; padding: 5px 10px;
  border: 1px solid var(--plat-border); border-radius: 5px;
  background: #fff; color: var(--plat-fg);
  text-decoration: none;
}
.dashboard-filter-download:hover { background: var(--plat-bg); }
.dashboard-section-head { flex-wrap: wrap; }

/* SEO page lists — severity-grouped findings rendered by pages/seo.php. */
.dashboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dashboard-list > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--plat-border, rgba(0, 0, 0, 0.08));
  font-size: 13px;
}
.dashboard-list > li:last-child { border-bottom: none; }
.dashboard-list-detail {
  font-size: 12px;
  color: var(--plat-faint, #888);
  margin-top: 4px;
  line-height: 1.55;
}

/* ─────────────────────────────────────────────────────────────────
 * Mobile / tablet responsive — off-canvas sidebar, scrollable tables
 * + tabs, compact top bar. The hamburger button and backdrop are in
 * the DOM at all sizes (dashboard.php); CSS hides them on desktop.
 * ─────────────────────────────────────────────────────────────── */
.dashboard-bar-burger {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  margin-left: -8px;
  cursor: pointer;
  position: relative;
  z-index: 110; /* above sidebar drawer */
}
.dashboard-bar-burger span {
  display: block;
  width: 22px; height: 2px;
  background: rgba(255, 255, 255, 0.9);
  margin: 4px 0;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
body.dashboard-nav-open .dashboard-bar-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.dashboard-nav-open .dashboard-bar-burger span:nth-child(2) { opacity: 0; }
body.dashboard-nav-open .dashboard-bar-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.dashboard-backdrop {
  position: fixed;
  inset: 48px 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

@media (max-width: 860px) {
  .dashboard-bar-burger { display: block; }
  .dashboard-bar { padding: 0 12px; gap: 12px; }
  .dashboard-bar-title { font-size: 13px; }
  .dashboard-bar-title .dashboard-bar-site {
    /* Site name truncates rather than wrapping the bar. */
    display: inline-block;
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .dashboard-sidebar {
    position: fixed;
    top: 48px; bottom: 0; left: 0;
    width: min(280px, 80vw);
    height: auto;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.18);
  }
  body.dashboard-nav-open .dashboard-sidebar { transform: translateX(0); }
  body.dashboard-nav-open .dashboard-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.dashboard-nav-open { overflow: hidden; }

  .dashboard-content { padding: 20px 18px 40px; }

  /* Generic tab strips horizontally scroll instead of wrapping. */
  .dashboard-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .dashboard-tab { white-space: nowrap; flex-shrink: 0; }

  /* Section bodies (which usually contain tables) scroll horizontally
   * when their contents overflow the column. Box-shadow on .dashboard-
   * section itself is unaffected — only the children are clipped. */
  .dashboard-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dashboard-table { min-width: 480px; }

  /* Tighter section padding so 16px of table breathing room isn't
   * stolen by the section's horizontal padding. */
  .dashboard-section { padding: 14px 14px 12px; }

  /* Page-head row wraps on mobile when actions ride along. */
  .dashboard-page-head { display: flex; flex-wrap: wrap; gap: 10px 12px; }
  .dashboard-page-head h1 { font-size: 19px; }

  /* Shrink the loudest typography for mobile. */
  body.is-dashboard-mode { font-size: 13px; }
  .ui-card__value { font-size: 22px; }
  .dashboard-section-head h2 { font-size: 13px; }
  .dashboard-table { font-size: 12.5px; }
  .dashboard-table th, .dashboard-table td { padding: 8px 8px; }

  /* Long strings (emails, content keys, monospace IDs) wrap inside
   * table cells instead of forcing the column to widen past its
   * neighbours. */
  .dashboard-table td { word-break: break-word; }
  .dashboard-table .mono { word-break: break-all; }
}

@media (max-width: 480px) {
  .dashboard-bar-title .dashboard-bar-site { max-width: 30vw; }
  .dashboard-content { padding: 16px 14px 36px; }
  .dashboard-section { padding: 12px 12px 10px; }
  .dashboard-page-head h1 { font-size: 17px; }
  .ui-card__value { font-size: 20px; }
  .dashboard-table { min-width: 420px; }
}
