@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

/* ═══════════════════════════════════════════════════════════════════
   FLOWBYTE IDENTITY — DESIGN SYSTEM
   Modern · Clean · Enterprise
═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  --accent:           #2563EB;
  --accent-hover:     #1D4ED8;
  --accent-active:    #1E40AF;
  --accent-subtle:    rgba(37, 99, 235, 0.07);
  --accent-border:    rgba(37, 99, 235, 0.18);

  --success:          #059669;
  --success-subtle:   rgba(5, 150, 105, 0.08);
  --success-border:   rgba(5, 150, 105, 0.2);
  --warning:          #D97706;
  --warning-subtle:   rgba(217, 119, 6, 0.08);
  --danger:           #DC2626;
  --danger-hover:     #B91C1C;
  --danger-subtle:    rgba(220, 38, 38, 0.08);
  --danger-border:    rgba(220, 38, 38, 0.2);

  --sidebar-width:    236px;

  --bg:               #F7F8FA;
  --surface:          #FFFFFF;

  --border:           #E4E7EC;
  --border-strong:    #C8CDD8;

  --text-primary:     #101828;
  --text-secondary:   #667085;
  --text-muted:       #98A2B3;
  --text-on-accent:   #FFFFFF;

  --header-height:    52px;
  --footer-height:    40px;
  --header-bg:        #FFFFFF;
  --header-border:    #E4E7EC;
  --footer-bg:        #FFFFFF;
  --footer-border:    #E4E7EC;

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px -4px rgba(16, 24, 40, 0.14), 0 4px 10px rgba(16, 24, 40, 0.07);

  --font-display: 'Outfit', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* ── Fluent token overrides ── */
  --body-font: var(--font-body);
  --type-ramp-base-font-size: 14px;
  --accent-fill-rest:           var(--accent);
  --accent-fill-hover:          var(--accent-hover);
  --accent-fill-active:         var(--accent-active);
  --accent-foreground-rest:     var(--accent);
  --accent-foreground-hover:    var(--accent-hover);
  --foreground-on-accent-rest:  var(--text-on-accent);
  --foreground-on-accent-hover: var(--text-on-accent);
  --neutral-fill-layer-rest:    var(--bg);
  --neutral-fill-rest:          #F2F4F7;
  --neutral-fill-hover:         #E9ECF1;
  --neutral-fill-active:        #D8DCE5;
  --neutral-fill-stealth-rest:  transparent;
  --neutral-fill-stealth-hover: rgba(16, 24, 40, 0.04);
  --neutral-fill-stealth-active:rgba(16, 24, 40, 0.08);
  --neutral-foreground-rest:    var(--text-primary);
  --neutral-foreground-hint:    var(--text-secondary);
  --neutral-stroke-rest:        var(--border);
  --neutral-stroke-hover:       var(--border-strong);
  --neutral-stroke-active:      var(--border-strong);
  --neutral-layer-1: var(--surface);
  --neutral-layer-2: #F7F8FA;
  --neutral-layer-3: #F2F4F7;
  --neutral-layer-4: var(--surface);
}

/* ─── Dark Mode ──────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:               #0D1117;
  --surface:          #161B22;
  --border:           #30363D;
  --border-strong:    #484F58;
  --text-primary:     #E6EDF3;
  --text-secondary:   #8B949E;
  --text-muted:       #6E7681;
  --header-bg:        #161B22;
  --header-border:    #30363D;
  --footer-bg:        #161B22;
  --footer-border:    #30363D;
  --neutral-fill-layer-rest: #0D1117;
  --neutral-fill-rest:       #1C2128;
  --neutral-fill-hover:      #21262D;
  --neutral-fill-active:     #2D333B;
  --neutral-foreground-rest: #E6EDF3;
  --neutral-foreground-hint: #8B949E;
  --neutral-stroke-rest:     #30363D;
  --neutral-layer-1:         #161B22;
  --neutral-layer-2:         #1C2128;
  --neutral-layer-3:         #21262D;
  --neutral-layer-4:         #161B22;
}

/* ═══════════════════════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: 0;
  margin: 0;
  color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Header ─── */
.app-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow-xs);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none !important;
  user-select: none;
}

.header-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--text-primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.header-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  line-height: 1;
}

.header-brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  padding: 2px 8px;
  border-radius: 4px;
}

.header-spacer { flex: 1; }

.header-company-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--neutral-fill-rest);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* ─── Body ─── */
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
}

/* ─── Footer ─── */
.app-footer {
  height: var(--footer-height);
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.footer-brand-accent { color: var(--accent); }
.footer-spacer { flex: 1; }

.footer-copy {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE LAYOUT
═══════════════════════════════════════════════════════════════════ */
.page-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 36px 28px;
}

.page-header { margin-bottom: 28px; }

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  height: 34px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.13s, border-color 0.13s, box-shadow 0.13s, transform 0.09s;
  white-space: nowrap;
  user-select: none;
  text-decoration: none !important;
  line-height: 1;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.30);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--neutral-fill-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--neutral-fill-hover);
  color: var(--text-primary);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-subtle);
  color: var(--danger);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 5px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn svg { flex-shrink: 0; }

/* ─── Action Bar ─── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.action-bar-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════
   FORM INPUTS
═══════════════════════════════════════════════════════════════════ */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.13s, box-shadow 0.13s;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2398A2B3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 30px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:disabled,
.form-select:disabled { opacity: 0.55; cursor: not-allowed; background: var(--neutral-fill-rest); }

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-hint { font-size: 12px; color: var(--text-muted); }

/* ─── Checkbox ─── */
.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--neutral-fill-rest);
  cursor: pointer;
  user-select: none;
}

.form-checkbox-row:hover { background: var(--neutral-fill-hover); }

.form-checkbox {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}

.form-checkbox:checked { background: var(--accent); border-color: var(--accent); }

.form-checkbox:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e") center/contain no-repeat;
}

.form-checkbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-checkbox-label {
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   SEARCH
═══════════════════════════════════════════════════════════════════ */
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-box-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input {
  height: 34px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  width: 280px;
  transition: border-color 0.13s, box-shadow 0.13s;
  -webkit-appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.search-input::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   SPINNER / LOADING
═══════════════════════════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-border); }
.badge-success .badge-dot { background: var(--success); }
.badge-neutral { background: var(--neutral-fill-rest); color: var(--text-muted); border: 1px solid var(--border); }
.badge-neutral .badge-dot { background: var(--text-muted); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-danger { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-border); }

/* ═══════════════════════════════════════════════════════════════════
   FLUENT DATAGRID OVERRIDES
═══════════════════════════════════════════════════════════════════ */
.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

fluent-data-grid {
  width: 100%;
  border: none !important;
  background: var(--surface) !important;
  --neutral-layer-1: var(--surface);
}

fluent-data-grid-row {
  border-bottom: 1px solid var(--border) !important;
}

fluent-data-grid-row:last-child {
  border-bottom: none !important;
}

fluent-data-grid-row[row-type="header"] {
  background: #F9FAFB !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] fluent-data-grid-row[row-type="header"] {
  background: var(--neutral-layer-2) !important;
}

fluent-data-grid-row:not([row-type="header"]):hover {
  background: var(--neutral-fill-rest) !important;
}

fluent-data-grid-cell[cell-type="columnheader"] {
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.07em !important;
  color: var(--text-muted) !important;
  padding: 9px 16px !important;
}

fluent-data-grid-cell {
  padding: 11px 16px !important;
  font-size: 13.5px !important;
  color: var(--text-primary) !important;
  align-items: center !important;
  border: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FLUENT DIALOG OVERRIDES
═══════════════════════════════════════════════════════════════════ */
fluent-dialog::part(overlay) {
  background: rgba(16, 24, 40, 0.45) !important;
  backdrop-filter: blur(4px) !important;
}

fluent-dialog::part(dialog) {
  border-radius: var(--radius-xl) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  background: var(--surface) !important;
}

/* ─── Dialog structural helpers ─── */
.dialog-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.dialog-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.dialog-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 64vh;
  overflow-y: auto;
}

.dialog-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Import email chips ─── */
.email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}

.email-chip-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition: background 0.12s;
}

.email-chip-remove:hover { background: rgba(255, 255, 255, 0.35); }

/* ─── Progress bar ─── */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── Import result items ─── */
.import-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.import-result-success {
  background: var(--success-subtle);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.import-result-error {
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.import-result-message {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════
   FLUENT PAGINATOR OVERRIDES
═══════════════════════════════════════════════════════════════════ */
.pagination-wrap {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════
   STATES
═══════════════════════════════════════════════════════════════════ */
.error-state {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  font-size: 13.5px;
  color: var(--danger);
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   HOME — DASHBOARD CARDS
═══════════════════════════════════════════════════════════════════ */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  box-shadow: var(--shadow-xs);
  text-decoration: none !important;
}

.nav-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.nav-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-card-body { flex: 1; min-width: 0; }

.nav-card-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0;
  margin-bottom: 3px;
}

.nav-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.nav-card-arrow {
  font-size: 15px;
  color: var(--text-muted);
  transition: transform .15s, color .15s;
  flex-shrink: 0;
}

.nav-card:hover .nav-card-arrow { transform: translateX(3px); color: var(--accent); }

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  margin-bottom: 14px;
}

.welcome-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.welcome-badge-text { font-size: 12px; font-weight: 500; color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════
   MANAGE ACCOUNT LAYOUT
═══════════════════════════════════════════════════════════════════ */
.manage-layout {
  padding: 36px 28px;
  max-width: 900px;
  margin: 0 auto;
}

.manage-layout-header { margin-bottom: 24px; }

.manage-layout-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.manage-layout-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.manage-layout-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 28px;
}

.manage-layout-body {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 36px;
  align-items: start;
}

.manage-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: sticky;
  top: 20px;
}

.manage-nav-link {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-secondary);
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0;
}

.manage-nav-link:hover { background: var(--neutral-fill-hover); color: var(--text-primary); }

.manage-nav-link.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 550;
}

/* ═══════════════════════════════════════════════════════════════════
   ALERT / ERROR
═══════════════════════════════════════════════════════════════════ */
.alert {
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  font-size: 13.5px;
}

.alert-danger {
  background: var(--danger-subtle) !important;
  border-color: var(--danger-border) !important;
  border-left-color: var(--danger) !important;
  color: var(--danger) !important;
}

.alert-success {
  background: var(--success-subtle) !important;
  border-color: var(--success-border) !important;
  border-left-color: var(--success) !important;
  color: var(--success) !important;
}

/* ── Manage account form styles ── */
.manage-section { margin-bottom: 32px; }

.manage-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.manage-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.manage-submit {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s;
}

.manage-submit:hover { background: var(--accent-hover); }

/* Manage alerts */
.manage-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.manage-alert svg { flex-shrink: 0; margin-top: 1px; }
.manage-alert strong { display: block; margin-bottom: 2px; }
.manage-alert-warning {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}
.manage-alert-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}
.manage-alert-warning a, .manage-alert-danger a { color: inherit; font-weight: 600; }

/* Manage info cards */
.manage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--surface);
}
.manage-card-header { display: flex; flex-direction: column; gap: 3px; }
.manage-card-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.manage-card-desc { font-size: 13px; color: var(--text-secondary); margin: 0; }
.manage-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ═══════════════════════════════════════════════════════════════════
   BLAZOR ERROR / LOADING PROGRESS
═══════════════════════════════════════════════════════════════════ */
#blazor-error-ui {
  background: #FFFBEB;
  border-top: 2px solid #F59E0B;
  bottom: 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  display: none;
  left: 0;
  padding: 12px 20px;
  position: fixed;
  width: 100%;
  z-index: 10000;
  font-family: var(--font-body);
  font-size: 13px;
  color: #92400E;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  font-style: normal;
}

#blazor-error-ui .dismiss:hover { opacity: 1; }

.blazor-error-boundary {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: #991B1B;
  font-family: var(--font-body);
}

.blazor-error-boundary::before { content: "An error has occurred. "; font-weight: 600; }

.loading-progress {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  margin: 20vh auto 1.5rem auto;
}

.loading-progress circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 5;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.08s ease;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  inset: calc(20vh + 5rem) 0 auto 0.2rem;
}

.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGES (Login, Register)
═══════════════════════════════════════════════════════════════════ */
.auth-shell {
  min-height: calc(100dvh - var(--header-height) - var(--footer-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-xl);
  width: 420px;
  max-width: 100%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 40px;
  height: 40px;
  background: var(--text-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto 16px auto;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-field { margin-bottom: 18px; }

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.auth-input::placeholder { color: var(--text-muted); }

.auth-submit {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s, box-shadow 0.13s;
  margin-top: 6px;
}

.auth-submit:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.auth-forgot {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}

.auth-forgot a { font-size: 13px; color: var(--accent); text-decoration: none; }
.auth-forgot a:hover { text-decoration: underline; }

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-remember input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.auth-remember label {
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-divider span {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.auth-footer a { color: var(--accent); font-weight: 500; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.text-danger { font-size: 12px; color: var(--danger); margin-top: 4px; display: block; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .search-input { width: 200px; }
  .page-wrap { padding: 20px 16px; }
  .manage-layout { padding: 20px 16px; }
  .manage-layout-body { grid-template-columns: 1fr; }
  .app-body { overflow: visible; }
  .app-main { overflow-y: auto; }
}

/* ==========================================================================
   SHADCN-STYLE REDESIGN LAYER
   Compact neutral surfaces, crisp borders, and token-driven controls.
   NavMenu.razor keeps its scoped styles.
========================================================================== */
:root {
  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-active: #09090b;
  --accent-subtle: #f4f4f5;
  --accent-border: #d4d4d8;

  --success: #16a34a;
  --success-subtle: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #ca8a04;
  --warning-subtle: #fefce8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-subtle: #fef2f2;
  --danger-border: #fecaca;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-subtle: #f4f4f5;
  --surface-muted: #f8fafc;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --ring: rgba(24, 24, 27, 0.16);

  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-on-accent: #fafafa;

  --header-height: 56px;
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-border: #e4e4e7;
  --footer-bg: #ffffff;
  --footer-border: #e4e4e7;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.18);

  --font-display: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --accent-fill-rest: var(--accent);
  --accent-fill-hover: var(--accent-hover);
  --accent-fill-active: var(--accent-active);
  --accent-foreground-rest: var(--accent);
  --accent-foreground-hover: var(--accent-hover);
  --foreground-on-accent-rest: var(--text-on-accent);
  --foreground-on-accent-hover: var(--text-on-accent);
  --neutral-fill-layer-rest: var(--bg);
  --neutral-fill-rest: var(--surface-subtle);
  --neutral-fill-hover: #e4e4e7;
  --neutral-fill-active: #d4d4d8;
  --neutral-fill-stealth-rest: transparent;
  --neutral-fill-stealth-hover: var(--surface-subtle);
  --neutral-fill-stealth-active: #e4e4e7;
  --neutral-foreground-rest: var(--text-primary);
  --neutral-foreground-hint: var(--text-muted);
  --neutral-stroke-rest: var(--border);
  --neutral-stroke-hover: var(--border-strong);
  --neutral-stroke-active: var(--border-strong);
  --neutral-layer-1: var(--surface);
  --neutral-layer-2: var(--surface-subtle);
  --neutral-layer-3: #e4e4e7;
  --neutral-layer-4: var(--surface);
}

html, body {
  font-family: var(--font-body);
  letter-spacing: 0;
  color: var(--text-primary);
  background:
    linear-gradient(180deg, rgba(244, 244, 245, 0.7) 0, rgba(250, 250, 250, 0) 280px),
    var(--bg);
}

h1, h2, h3, h4, h5, h6,
.page-title,
.nav-card-title,
.dialog-title,
.auth-title,
.manage-layout-title,
.manage-section-title {
  font-family: var(--font-display);
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 4px;
}

.app-header {
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.header-brand-icon,
.auth-logo {
  background: var(--accent);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.header-brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.header-brand-badge,
.header-company-pill,
.welcome-badge {
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.header-company-pill {
  height: 30px;
}

.app-main {
  background:
    radial-gradient(circle at top left, rgba(228, 228, 231, 0.55), transparent 360px),
    var(--bg);
}

.app-footer {
  border-top: 1px solid var(--border);
  box-shadow: none;
}

.page-wrap {
  max-width: 1280px;
  padding: 32px;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}

.page-title {
  font-size: 26px;
  font-weight: 650;
  line-height: 1.15;
}

.page-subtitle {
  max-width: 720px;
  color: var(--text-muted);
}

.action-bar {
  min-height: 54px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(10px);
}

.btn,
.auth-submit,
.manage-submit,
.fluent-button,
button[type="submit"] {
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}

.btn {
  height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-primary,
.auth-submit,
.manage-submit {
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid var(--accent);
}

.btn-primary:hover:not(:disabled),
.auth-submit:hover,
.manage-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.btn-ghost,
.btn-danger-ghost {
  color: var(--text-muted);
}

.btn-icon {
  width: 34px;
  height: 34px;
}

.form-label,
.auth-label {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea,
.search-input,
.auth-input,
.form-control,
.form-select.form-control {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--surface);
  box-shadow: none;
  font-size: 13px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus,
.auth-input:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.search-input {
  width: min(320px, 38vw);
}

.form-checkbox-row,
.user-select-item {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-md);
}

.form-checkbox-row:hover,
.user-select-item:hover {
  background: var(--surface-subtle);
}

.form-checkbox {
  border-color: var(--border-strong);
}

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

fluent-data-grid {
  background: var(--surface) !important;
}

fluent-data-grid-row[row-type="header"] {
  background: var(--surface-subtle) !important;
}

fluent-data-grid-cell[cell-type="columnheader"] {
  color: var(--text-muted) !important;
  font-size: 11px !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

fluent-data-grid-cell {
  color: var(--text-primary) !important;
  font-size: 13px !important;
}

.pagination-wrap {
  justify-content: flex-end;
  color: var(--text-muted);
}

.badge {
  border-radius: 999px;
  font-size: 12px;
}

.badge-success {
  background: var(--success-subtle);
  color: #15803d;
}

.badge-neutral {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

fluent-dialog::part(overlay) {
  background: rgba(9, 9, 11, 0.48) !important;
}

fluent-dialog::part(dialog) {
  border-radius: var(--radius-xl) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.dialog-header {
  padding: 22px 24px 16px;
}

.dialog-title {
  font-size: 18px;
  font-weight: 650;
}

.dialog-subtitle,
.form-hint,
.auth-subtitle,
.manage-layout-subtitle {
  color: var(--text-muted);
}

.dialog-body {
  gap: 16px;
}

.dialog-footer {
  background: var(--surface-muted);
}

.empty-state,
.error-state,
.loading-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.error-state {
  border-color: var(--danger-border);
  background: var(--danger-subtle);
}

.grid-container {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.page-note {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
}

.info-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 620px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.info-panel-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--accent);
}

.info-panel-title {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.info-panel-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.detail-card {
  display: flex;
  min-height: 96px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.nav-card {
  min-height: 128px;
  align-items: flex-start;
  border-radius: var(--radius-lg);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.nav-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.nav-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
}

.nav-card-title {
  font-size: 14px;
  font-weight: 600;
}

.nav-card-desc {
  color: var(--text-muted);
}

.welcome-badge-dot {
  background: var(--accent);
}

.welcome-badge-text {
  color: var(--text-secondary);
}

.auth-shell {
  align-items: flex-start;
  padding: 56px 20px;
  background:
    radial-gradient(circle at top, rgba(228, 228, 231, 0.75), transparent 360px),
    var(--bg);
}

.auth-card {
  width: 420px;
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-header {
  margin-bottom: 24px;
}

.auth-title {
  font-size: 22px;
  font-weight: 650;
}

.auth-input {
  padding: 8px 11px;
}

.auth-submit,
.manage-submit {
  height: 38px;
}

.auth-divider {
  margin: 20px 0;
}

.manage-layout {
  max-width: 1040px;
  padding: 32px;
}

.manage-layout-header {
  margin-bottom: 18px;
}

.manage-layout-title {
  font-size: 24px;
  font-weight: 650;
}

.manage-layout-divider {
  margin-bottom: 20px;
  background: var(--border);
}

.manage-layout-body {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
}

.manage-content {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.manage-section {
  margin-bottom: 0;
}

.manage-section-title {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 650;
}

.manage-card,
.alert,
.manage-alert {
  border-radius: var(--radius-lg);
  border-color: var(--border);
  background: var(--surface);
}

.breadcrumb {
  margin-bottom: 10px;
}

.breadcrumb-current,
.breadcrumb-sep {
  color: var(--text-muted);
}

.user-select-list {
  border-color: var(--border);
  border-radius: var(--radius-lg);
}

.user-select-item--selected {
  background: var(--surface-subtle);
}

.app-main > h1,
.app-main > h2,
.app-main > p,
.app-main > hr,
.app-main > fluent-grid {
  margin-left: 32px;
  margin-right: 32px;
}

.app-main > h1 {
  margin-top: 32px;
  font-size: 26px;
  font-weight: 650;
}

.app-main > h2 {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 400;
}

.app-main > fluent-grid {
  max-width: 520px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

fluent-text-field,
fluent-button {
  border-radius: var(--radius-md);
}

@media (max-width: 900px) {
  .page-wrap,
  .manage-layout {
    padding: 24px 18px;
  }

  .action-bar {
    align-items: stretch;
  }

  .action-bar .search-box,
  .search-input {
    width: 100%;
  }

  .action-bar-spacer {
    display: none;
  }

  .manage-layout-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-title {
    font-size: 23px;
  }

  .action-bar {
    flex-direction: column;
  }

  .btn,
  .action-bar .form-select {
    width: 100%;
  }
}

/* ==========================================================================
   NATIVE DATA TABLE  (replaces fluent-data-grid)
========================================================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--surface-subtle, #f4f4f5);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-subtle, #f4f4f5);
}

.data-table .col-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.data-table .cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.data-table .cell-muted {
  color: var(--text-muted);
}

.data-table-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ==========================================================================
   MODAL  (replaces fluent-dialog)
========================================================================== */
.fb-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  overflow-y: auto;
}

.fb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(9, 9, 11, 0.48);
  backdrop-filter: blur(4px);
  animation: modal-fade 0.14s ease;
}

.fb-modal-dialog {
  position: relative;
  z-index: 1;
  width: var(--modal-width, 480px);
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-modal-dialog .dialog-header {
  position: relative;
  padding-right: 48px;
}

.fb-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.fb-modal-close:hover {
  background: var(--surface-subtle, #f4f4f5);
  color: var(--text-primary);
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   PAGER  (replaces fluent-paginator)
========================================================================== */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pager-info {
  font-size: 12.5px;
  color: var(--text-muted);
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pager-btn:hover:not(:disabled):not(.active) {
  background: var(--surface-subtle, #f4f4f5);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pager-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  cursor: default;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ==========================================================================
   STATUS PAGE CARD  (account confirmation / error pages)
========================================================================== */
.status-card {
  background: var(--surface);
  width: 440px;
  max-width: 100%;
  padding: 36px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.status-card-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-card-icon.is-info    { background: var(--accent-subtle); color: var(--accent); }
.status-card-icon.is-success { background: var(--success-subtle); color: var(--success); }
.status-card-icon.is-warning { background: var(--warning-subtle); color: var(--warning); }
.status-card-icon.is-danger  { background: var(--danger-subtle);  color: var(--danger); }

.status-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.status-card-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.status-card-text a {
  color: var(--accent);
  font-weight: 500;
}

.status-card-actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Auth helper: code grid + checkbox row reused on 2FA pages */
.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-checkbox label {
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   RELAY DESIGN SYSTEM  (dark palette + shadcn-style components)
   Appended layer — token-driven, wins the cascade. See docs/telemetry & FEATURES.md.
========================================================================== */

/* ---- Dark theme: override the shadcn tokens (zinc-dark) ---- */
/* Native form controls, scrollbars and autofill follow the active theme.
   Without this, the browser renders <select>/<input>/checkboxes in light mode
   (white) even on a dark page. */
:root { color-scheme: light; }

/* GitHub-style dark theme — flat surfaces, no gradients. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --accent: #2f81f7;
  --accent-hover: #4a9bff;
  --accent-active: #1f6feb;
  --accent-subtle: rgba(56, 139, 253, 0.15);
  --accent-border: #1f6feb;

  --success: #3fb950;
  --success-subtle: #0f2417;
  --success-border: #238636;
  --warning: #d29922;
  --warning-subtle: #272013;
  --danger: #f85149;
  --danger-hover: #ff6a63;
  --danger-subtle: #25100f;
  --danger-border: #da3633;

  --bg: #0d1117;
  --surface: #161b22;
  --surface-subtle: #21262d;
  --surface-muted: #1c2128;
  --border: #30363d;
  --border-strong: #444c56;
  --ring: rgba(47, 129, 247, 0.40);

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-on-accent: #ffffff;

  --header-bg: rgba(22, 27, 34, 0.92);
  --header-border: #30363d;
  --footer-bg: #161b22;
  --footer-border: #30363d;

  --shadow-xs: 0 1px 0 rgba(1, 4, 9, 0.20);
  --shadow-sm: 0 1px 3px rgba(1, 4, 9, 0.40);
  --shadow-md: 0 8px 24px rgba(1, 4, 9, 0.50);
  --shadow-lg: 0 16px 48px rgba(1, 4, 9, 0.60);

  --neutral-fill-layer-rest: var(--bg);
  --neutral-fill-rest: var(--surface-subtle);
  --neutral-fill-hover: #30363d;
  --neutral-fill-active: #444c56;
  --neutral-fill-stealth-hover: var(--surface-subtle);
  --neutral-fill-stealth-active: #30363d;
  --neutral-layer-1: var(--surface);
  --neutral-layer-2: var(--surface-subtle);
  --neutral-layer-3: #30363d;
  --neutral-layer-4: var(--surface);
}

/* Dark background wins over the light-mode gradients — flat surfaces in dark
   (html/body linear glow, the .app-main top-left radial glow, and the auth radial). */
:root[data-theme="dark"] html,
:root[data-theme="dark"] body,
:root[data-theme="dark"] .app-main,
:root[data-theme="dark"] .auth-shell {
  background: var(--bg);
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 18px; }
.card-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.card-actions { display: flex; gap: 8px; align-items: center; }

/* ---- Tabs ---- */
.tabs { display: flex; flex-direction: column; gap: 16px; }
.tab-list { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-subtle); border-radius: var(--radius-lg); align-self: flex-start; }
.tab {
  border: none; background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 13.5px; font-weight: 500; padding: 6px 14px;
  border-radius: var(--radius-md); cursor: pointer; transition: .15s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-xs); }

/* ---- Dropdown menu ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-backdrop { position: fixed; inset: 0; z-index: 40; background: transparent; border: none; cursor: default; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 5px; display: flex; flex-direction: column; gap: 1px;
}
.dropdown-menu.align-end { left: auto; right: 0; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text-primary); font: inherit; font-size: 13.5px;
  padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-subtle); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-subtle); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---- Toasts ---- */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 12px 14px;
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info { border-left-color: var(--text-muted); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.toast-msg { font-size: 13px; color: var(--text-secondary); margin-top: 1px; word-break: break-word; }
.toast-close { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px; }
.toast-close:hover { color: var(--text-primary); }

/* ---- Skeleton ---- */
.skeleton {
  display: block; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-subtle) 25%, var(--surface-muted) 37%, var(--surface-subtle) 63%);
  background-size: 400% 100%; animation: skeleton 1.4s ease infinite;
}
@keyframes skeleton { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
/* Flat (gradient-free) skeleton in dark — subtle opacity pulse instead of a shimmer sweep. */
:root[data-theme="dark"] .skeleton { background: var(--surface-subtle); animation: skeletonPulse 1.4s ease-in-out infinite; }
@keyframes skeletonPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---- Stat / KPI cards ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px 18px; box-shadow: var(--shadow-xs); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-icon { color: var(--text-muted); display: flex; }
.stat-value { font-size: 26px; font-weight: 650; color: var(--text-primary); margin-top: 8px; font-family: var(--font-display); letter-spacing: -.01em; }
.stat-unit { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 3px; }
.stat-delta { font-size: 12px; margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--text-muted); }

/* ---- Chart wrapper ---- */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }

/* ---- Copy field (reveal-once secrets) ---- */
.copy-field { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-subtle); }
.copy-field code { flex: 1; padding: 9px 12px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-primary); overflow-x: auto; white-space: nowrap; }
.copy-btn { border: none; border-left: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); padding: 0 14px; cursor: pointer; font-size: 12.5px; }
.copy-btn:hover { color: var(--text-primary); background: var(--surface-subtle); }

/* ---- Theme toggle ---- */
.theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); width: 34px; height: 34px; border-radius: var(--radius-md); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* ═══════════════════════════════════════════════════════════════════
   PLAYGROUND (fills the viewport; only the message thread scrolls)
═══════════════════════════════════════════════════════════════════ */
.pg { height: calc(100dvh - var(--header-height) - var(--footer-height)); display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* ── Top toolbar ── */
.pg-toolbar { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.pg-heading { display: flex; flex-direction: column; gap: 1px; }
.pg-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.pg-sub { font-size: 11.5px; color: var(--text-muted); }
.pg-toolbar-spacer { flex: 1; }
.pg-select { height: 34px; min-width: 200px; padding: 0 32px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center; color: var(--text-primary); font-size: 13.5px; font-family: var(--font-body); appearance: none; cursor: pointer; }
.pg-select:hover { border-color: var(--border-strong); }
.pg-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.pg-icon-btn { width: 34px; height: 34px; flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: var(--radius-md); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.pg-icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-subtle); }
.pg-icon-btn.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-subtle); }
.pg-conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.pg-conn-dot.ready { background: #22c55e; }

/* ── Settings drawer ── */
.pg-settings { flex-shrink: 0; background: var(--surface-subtle); border-bottom: 1px solid var(--border); padding: 14px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; animation: pgSlide .16s ease; }
@keyframes pgSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.pg-field { display: flex; flex-direction: column; gap: 4px; }
.pg-field label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pg-field input,
.pg-field select,
.pg-field textarea { width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); font-size: 13px; font-family: var(--font-mono); box-sizing: border-box; transition: border-color .13s, box-shadow .13s; }
.pg-field select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 30px; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2398A2B3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.pg-field textarea { height: auto; min-height: 34px; padding: 8px 12px; line-height: 1.5; resize: vertical; }
.pg-field input:focus,
.pg-field select:focus,
.pg-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.pg-field input::placeholder,
.pg-field textarea::placeholder { color: var(--text-muted); }

/* ── Message thread ── */
.pg-messages { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.pg-thread { max-width: 900px; margin: 0 auto; padding: 26px 22px 8px; display: flex; flex-direction: column; gap: 20px; }
.pg-msg { display: flex; gap: 13px; align-items: flex-start; animation: pgFade .18s ease; }
@keyframes pgFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.pg-avatar { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.pg-msg.user .pg-avatar { background: var(--accent); color: var(--text-on-accent); }
.pg-msg.assistant .pg-avatar { background: var(--text-primary); color: var(--bg); }
.pg-msg-body { min-width: 0; flex: 1; padding-top: 4px; }
.pg-msg-role { font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.pg-msg-text { font-size: 14.5px; line-height: 1.62; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
.pg-cursor { display: inline-block; width: 7px; height: 15px; background: var(--accent); margin-left: 2px; border-radius: 1px; vertical-align: text-bottom; animation: pgBlink 1s steps(2) infinite; }
@keyframes pgBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Empty / welcome state ── */
.pg-welcome { max-width: 620px; margin: 0 auto; padding: 8vh 22px 0; text-align: center; }
.pg-welcome-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: var(--text-on-accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.pg-welcome h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.pg-welcome p { font-size: 14px; color: var(--text-secondary); margin: 0 0 22px; }
.pg-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.pg-suggestion { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg); padding: 13px 15px; cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .08s ease; }
.pg-suggestion:hover { border-color: var(--border-strong); background: var(--surface-subtle); transform: translateY(-1px); }
.pg-suggestion-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.pg-suggestion-desc { font-size: 12px; color: var(--text-muted); }

/* ── Composer (full width) ── */
.pg-composer { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--surface); padding: 14px 22px 10px; }
.pg-input-wrap { display: flex; align-items: flex-end; gap: 8px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--bg); padding: 8px 8px 8px 16px; transition: border-color .12s ease, box-shadow .12s ease; }
.pg-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.pg-input { flex: 1; border: none; background: transparent; resize: none; outline: none; color: var(--text-primary); font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; max-height: 200px; padding: 6px 0; }
.pg-input::placeholder { color: var(--text-muted); }
.pg-send { width: 38px; height: 38px; flex-shrink: 0; border: none; border-radius: var(--radius-lg); background: var(--accent); color: var(--text-on-accent); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: opacity .12s ease, transform .08s ease; }
.pg-send:hover:not(:disabled) { transform: translateY(-1px); }
.pg-send:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-stop { background: var(--danger); }
.pg-hint { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 7px; }
.pg-hint kbd { font-family: var(--font-mono); font-size: 10.5px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

@media (max-width: 768px) {
  .pg-toolbar { flex-wrap: wrap; padding: 10px 14px; }
  .pg-select { min-width: 0; flex: 1; }
  .pg-settings { grid-template-columns: 1fr; padding: 12px 14px; }
  .pg-thread { padding: 18px 14px 8px; }
  .pg-composer { padding: 12px 14px 8px; }
  .pg-suggestions { grid-template-columns: 1fr; }
}

/* Markdown (AI output rendering) — theme-aware via CSS variables. */
.md { white-space: normal; overflow-wrap: anywhere; line-height: 1.55; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 16px 0 8px; line-height: 1.3; font-weight: 600; color: var(--text-primary); }
.md h1 { font-size: 1.5em; }
.md h2 { font-size: 1.3em; }
.md h3 { font-size: 1.15em; }
.md h4 { font-size: 1.02em; }
.md h5, .md h6 { font-size: 0.95em; color: var(--text-secondary); }
.md ul, .md ol { margin: 0 0 10px; padding-left: 1.5em; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md a:hover { text-decoration: none; }
.md strong { font-weight: 650; }
.md em { font-style: italic; }
.md del { opacity: 0.7; }
.md code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 5px; overflow-wrap: anywhere; }
.md pre { margin: 0 0 12px; padding: 12px 14px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); overflow-x: auto; }
.md pre code { display: block; background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.5; white-space: pre; overflow-wrap: normal; color: var(--text-primary); }
.md blockquote { margin: 0 0 12px; padding: 4px 14px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }
.md blockquote > *:last-child { margin-bottom: 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md table { border-collapse: collapse; margin: 0 0 12px; display: block; overflow-x: auto; max-width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-subtle); font-weight: 600; }
.md tbody tr:nth-child(even) td { background: var(--surface-subtle); }

/* ============================================================================
   Control-panel UX build-out (Phase 1: command palette, notifications, shell)
   All theme-aware via the design tokens above.
   ============================================================================ */

/* --- Command palette trigger (header) --- */
.cmd-trigger { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-muted); cursor: pointer; font-size: 12.5px; transition: border-color .12s, color .12s; }
.cmd-trigger:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.cmd-trigger-label { min-width: 92px; text-align: left; }
.cmd-kbd, .cmd-foot kbd, .cmd-help kbd { font-family: var(--font-mono); font-size: 10.5px; line-height: 1; padding: 3px 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); }

/* --- Command palette overlay --- */
.cmd-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.32); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
:root[data-theme="dark"] .cmd-overlay { background: rgba(0,0,0,0.55); }
.cmd-panel { width: min(600px, 92vw); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.cmd-input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; color: var(--text-primary); font-family: var(--font-body); }
.cmd-input::placeholder { color: var(--text-muted); }
.cmd-spin { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.cmd-results { overflow-y: auto; padding: 6px; }
.cmd-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 8px 10px 4px; }
.cmd-item { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-primary); font-size: 13.5px; }
.cmd-item.active { background: var(--accent-subtle); }
.cmd-item-label { font-weight: 500; }
.cmd-item-sub { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.cmd-noresults { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }
.cmd-foot { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
.cmd-foot kbd { margin-right: 2px; }
.cmd-foot-spacer { flex: 1; }
.cmd-help { padding: 18px; }
.cmd-help-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text-primary); }
.cmd-help-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cmd-help-list li { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.cmd-help-list li span { flex: 1; }

/* --- Notification bell + menu --- */
.notif { position: relative; display: inline-flex; }
.notif-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 32px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); color: var(--text-secondary); cursor: pointer; }
.notif-btn:hover { background: var(--surface-subtle); border-color: var(--border); color: var(--text-primary); }
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; line-height: 1; color: #fff; background: var(--danger); border-radius: 8px; border: 2px solid var(--surface); }
.notif-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 360px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-head-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.notif-mark { border: none; background: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; }
.notif-mark:hover { text-decoration: underline; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: none; border-bottom: 1px solid var(--border); background: none; cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-subtle); }
.notif-item.unread { background: var(--accent-subtle); }
.notif-item.unread:hover { background: var(--accent-subtle); }
.notif-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--text-muted); }
.notif-dot.notif-info { background: var(--accent); }
.notif-dot.notif-success { background: var(--success); }
.notif-dot.notif-warning { background: var(--warning); }
.notif-dot.notif-danger { background: var(--danger); }
.notif-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 550; color: var(--text-primary); }
.notif-msg { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.notif-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* --- Right slide-out drawer --- */
.drawer-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.32); }
:root[data-theme="dark"] .drawer-overlay { background: rgba(0,0,0,0.55); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; width: var(--drawer-width, 460px); max-width: 96vw; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(16px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.drawer-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* --- Empty state block --- */
.empty-block { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--text-secondary); }
.empty-block-icon { color: var(--text-muted); margin-bottom: 4px; }
.empty-block-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.empty-block-msg { font-size: 13px; color: var(--text-muted); max-width: 380px; }
.empty-block-cta { margin-top: 8px; }

/* --- Onboarding checklist (Dashboard) --- */
.onboard-card { margin-bottom: 16px; }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.onboard-step { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.onboard-step:last-child { border-bottom: none; }
.onboard-check { flex: 0 0 auto; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 12px; font-weight: 600; background: var(--surface-subtle); border: 1px solid var(--border); color: var(--text-muted); }
.onboard-step.done .onboard-check { background: var(--success); border-color: var(--success); color: #fff; }
.onboard-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.onboard-text strong { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.onboard-text span { font-size: 12px; color: var(--text-muted); }
.onboard-step.done .onboard-text strong { color: var(--text-secondary); }

/* Header trigger collapses to icon-only on narrow screens */
@media (max-width: 640px) {
  .cmd-trigger-label, .cmd-kbd { display: none; }
  .cmd-trigger { width: 34px; justify-content: center; padding: 0; }
  .notif-menu { width: 300px; }
  .header-company-pill { display: none; }
}

/* --- Workspace switcher (clickable header pill + dropdown) --- */
.ws-switch { position: relative; display: inline-flex; }
.ws-switch-btn { cursor: pointer; gap: 6px; }
.ws-switch-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch-caret { opacity: 0.55; flex-shrink: 0; }
.ws-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; min-width: 240px; max-width: 340px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 4px; }
.ws-menu-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 8px 10px 4px; }
.ws-menu-empty { padding: 10px; color: var(--text-muted); font-size: 13px; }
.ws-menu-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-primary); font-size: 13px; font-family: var(--font-body); }
.ws-menu-item:hover { background: var(--surface-subtle); }
.ws-menu-item.active { background: var(--accent-subtle); }
.ws-menu-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-menu-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.ws-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.ws-menu-manage { color: var(--text-secondary); font-size: 12.5px; justify-content: flex-start; }

/* --- Playground depth (Phase 2: compare, params, cost meter) --- */
.pg-mode { display: inline-flex; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 2px; }
.pg-mode-btn { border: none; background: none; padding: 4px 12px; font-size: 12.5px; border-radius: calc(var(--radius-md) - 2px); color: var(--text-muted); cursor: pointer; }
.pg-mode-btn.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-xs); }
.pg-params { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pg-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.pg-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.pg-meter { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); }
.pg-meter-sep { opacity: .5; }
.pg-compare-wrap { flex: 1; overflow-y: auto; padding: 16px 20px; }
.pg-compare-prompt { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; color: var(--text-primary); margin-bottom: 14px; }
.pg-compare-prompt-label { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-right: 8px; }
.pg-compare-grid { display: grid; gap: 12px; align-items: start; }
.pg-compare-col { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); display: flex; flex-direction: column; min-height: 120px; overflow: hidden; }
.pg-compare-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.pg-compare-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-compare-remove { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; }
.pg-compare-remove:hover { color: var(--danger); }
.pg-compare-body { padding: 12px; font-size: 13.5px; color: var(--text-primary); overflow-x: auto; flex: 1; }
.pg-compare-error { color: var(--danger); font-size: 12.5px; }
.pg-compare-metrics { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
@media (max-width: 760px) { .pg-compare-grid { grid-template-columns: 1fr !important; } }

/* --- Dashboard/telemetry controls (Phase 3) --- */
.dash-controls { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* --- Budget burn-down + cost explorer (Phase 4) --- */
.burn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.burn-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 14px; }
.burn-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.burn-team { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.burn-bar { height: 8px; border-radius: 4px; background: var(--surface-subtle); overflow: hidden; }
.burn-fill { height: 100%; background: var(--success); border-radius: 4px; transition: width .3s; }
.burn-fill.warn { background: var(--warning); }
.burn-fill.over { background: var(--danger); }
.burn-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.burn-proj { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.cost-exp { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.cost-exp-list { display: flex; flex-direction: column; gap: 8px; }
.cost-exp-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.cost-exp-key { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-exp-track { height: 8px; background: var(--surface-subtle); border-radius: 4px; overflow: hidden; }
.cost-exp-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cost-exp-val { font-family: var(--font-mono); color: var(--text-secondary); }
@media (max-width: 640px) { .cost-exp { grid-template-columns: 1fr; } }

/* --- Provider status board (Phase 5) --- */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.status-card { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-lg); background: var(--surface); padding: 14px; }
.status-card.status-ok { border-left-color: var(--success); }
.status-card.status-warn { border-left-color: var(--warning); }
.status-card.status-down { border-left-color: var(--danger); }
.status-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.status-led { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--text-muted); }
.status-ok .status-led { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.status-warn .status-led { background: var(--warning); }
.status-down .status-led { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.status-name { font-weight: 600; font-size: 13px; color: var(--text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-metrics { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.status-metrics > div { display: flex; flex-direction: column; gap: 2px; }
.status-ml { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.status-err { margin-top: 8px; font-size: 11px; color: var(--danger); overflow-wrap: anywhere; }

/* --- Knowledge document viewer (Phase 6) --- */
.doc-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.doc-content { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.55; font-family: var(--font-mono); background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin: 0; overflow-x: auto; }

/* --- Evals heatmap + A/B bars (Phase 7) --- */
.eval-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.eval-bar-row { display: grid; grid-template-columns: 140px 1fr 52px; align-items: center; gap: 10px; font-size: 12.5px; }
.eval-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.eval-bar-track { height: 10px; background: var(--surface-subtle); border-radius: 5px; overflow: hidden; }
.eval-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.eval-bar-fill.variant { background: var(--warning); }
.eval-bar-val { font-family: var(--font-mono); text-align: right; color: var(--text-secondary); }
.eval-heat { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.eval-heat-label { width: 140px; flex: 0 0 auto; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eval-heat-cells { display: flex; flex-wrap: wrap; gap: 3px; }
.eval-cell { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 9px; color: #fff; cursor: default; }
.eval-cell.pass { background: var(--success); }
.eval-cell.fail { background: var(--danger); }

/* --- Line diff (shared: prompt + agent config, Phase 8) --- */
.prompt-diff { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; font-family: var(--font-mono); font-size: 12px; max-height: 460px; overflow: auto; }
.prompt-diff > div { white-space: pre-wrap; word-break: break-word; padding: 0 4px; }
.diff-add { background: rgba(34, 197, 94, 0.16); }
.diff-del { background: rgba(239, 68, 68, 0.16); }
.diff-ctx { color: var(--text-muted); }

/* --- Developer snippet generator (Phase 9) --- */
.dev-code { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; white-space: pre; overflow-x: auto; margin: 0 0 12px; color: var(--text-primary); }
.dev-langs { display: inline-flex; gap: 4px; }
.dev-lang { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 11.5px; padding: 3px 9px; border-radius: var(--radius-sm); cursor: pointer; }
.dev-lang.active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }

/* ============================================================================================
   WORKFLOWS — canvas, editor, run lineage
   Appended at the very end of the file on purpose. app.css stacks three :root token layers
   (Flowbyte identity, then the shadcn redesign, then the Relay design system), so this is the
   only position that reliably wins the cascade. Deliberately NOT a page-local <style> block:
   that would also force Razor's @@media / @@keyframes escaping.
   Every class is wf- prefixed. Bootstrap 5.3 is live from a CDN and owns .card .badge .btn*
   .modal* .dropdown* .nav* .form-* .table .collapse .tooltip .popover — hence the prefix, and
   hence the new tooltip below is .tt rather than .tooltip (Bootstrap sets opacity:0 on that).
   ============================================================================================ */

/* --- missing primitive: Badge.razor documents an "accent" variant that no rule defined --- */
.badge-accent { background: var(--accent-subtle); color: var(--accent); border: 1px solid var(--accent-border); }

/* --- CSS-only tooltip (no JS, no re-render). Not .tooltip: see note above. --- */
.tt { position: relative; display: inline-flex; }
.tt::after {
  content: attr(data-tip); position: absolute; z-index: 60; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--text-primary); color: var(--surface);
  font-family: var(--font-body); font-size: 11.5px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; padding: 4px 8px; border-radius: var(--radius-sm);
  opacity: 0; pointer-events: none; transition: opacity .12s ease .35s; box-shadow: var(--shadow-md);
}
.tt:hover::after, .tt:focus-within::after { opacity: 1; }
.tt[data-placement="bottom"]::after { bottom: auto; top: calc(100% + 6px); }
.tt[data-placement="right"]::after { bottom: auto; top: 50%; left: calc(100% + 6px); transform: translateY(-50%); }

/* --- Switch --- */
.wf-switch-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; user-select: none; }
.wf-switch { position: relative; flex: 0 0 auto; width: 34px; height: 20px; border-radius: 999px;
  background: var(--border-strong); transition: background .15s ease; }
.wf-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-xs); transition: transform .15s ease; }
.wf-switch.is-on { background: var(--accent); }
.wf-switch.is-on::after { transform: translateX(14px); }
.wf-switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.wf-switch-row input:focus-visible + .wf-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-switch-label { font-size: 13px; color: var(--text-primary); }

/* --- metric chips (latency / tokens / cost) --- */
.wf-chips { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text-muted); background: var(--surface-subtle);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 6px; }

/* ---------- shell ---------- */
.wf-shell {
  height: calc(100dvh - var(--header-height) - var(--footer-height));
  display: grid; grid-template-rows: 44px 1fr auto; overflow: hidden; background: var(--bg);
}
.wf-topbar { display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-bottom: 1px solid var(--border); background: var(--surface); min-width: 0; }
.wf-topbar-spacer { flex: 1 1 auto; }
.wf-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.wf-crumbs a { color: var(--text-muted); text-decoration: none; }
.wf-crumbs a:hover { color: var(--text-primary); }
.wf-crumb-sep { color: var(--text-muted); }
.wf-crumb-current { font-weight: 600; color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.wf-status-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-subtle); }
.wf-status-pill.is-dirty { color: var(--warning); border-color: var(--warning-border); background: var(--warning-subtle); }
.wf-status-pill.is-published { color: var(--success); border-color: var(--success-border); background: var(--success-subtle); }

.wf-body { display: grid; min-height: 0;
  grid-template-columns: var(--wf-palette-w, 220px) 4px 1fr 4px var(--wf-inspector-w, 320px); }
.wf-body.no-palette { grid-template-columns: 0 0 1fr 4px var(--wf-inspector-w, 320px); }
.wf-body.no-inspector { grid-template-columns: var(--wf-palette-w, 220px) 4px 1fr 0 0; }

.wf-panel { min-width: 0; min-height: 0; overflow: auto; background: var(--surface);
  display: flex; flex-direction: column; }
.wf-panel--left { border-right: 1px solid var(--border); }
.wf-panel--right { border-left: 1px solid var(--border); }
.wf-panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.wf-panel-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); }
.wf-panel-body { padding: 10px 12px; }

.wf-resizer { cursor: col-resize; background: transparent; transition: background .12s ease; }
.wf-resizer:hover, .wf-resizer.is-dragging { background: var(--accent-border); }
.wf-resizer--v { cursor: row-resize; height: 4px; }

.wf-issues { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border);
  background: var(--surface); padding: 6px 14px; max-height: 132px; overflow: auto; }
.wf-issue { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary);
  background: none; border: 0; padding: 2px 0; text-align: left; cursor: pointer; }
.wf-issue:hover { color: var(--text-primary); }
.wf-issue.is-error { color: var(--danger); }
.wf-issue.is-warn { color: var(--warning); }
.wf-issue-node { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* ---------- palette ---------- */
.wf-palette-search { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.wf-palette-group { padding: 8px 8px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted); }
.wf-palette-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; color: var(--text-primary); text-align: left; }
.wf-palette-item:hover { background: var(--surface-subtle); }
.wf-palette-item:disabled { opacity: .45; cursor: not-allowed; }
.wf-palette-icon { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--surface-subtle); color: var(--text-secondary); }
.wf-palette-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- canvas ---------- */
.wf-canvas {
  position: relative; overflow: hidden; min-width: 0; min-height: 0;
  background: var(--bg); outline: none; touch-action: none;   /* or mobile steals the gesture */
}
.wf-canvas.is-panning { cursor: grabbing; }
.wf-canvas.is-linking { cursor: crosshair; }
/* During a node drag the edges are stale until the drop recomputes layout, so fade them rather than showing
   connections that no longer line up. */
.wf-canvas.is-nodedrag .wf-edges { opacity: .3; }
.wf-canvas.is-nodedrag .wf-node { transition: none; cursor: grabbing; }
.wf-canvas.is-nodedrag .wf-edge-insert { display: none; }
.wf-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.wf-viewport { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }

/* Dots live on the viewport so scale() scales them for free — no JS background-position bookkeeping. */
.wf-grid { position: absolute; pointer-events: none;
  background-image: radial-gradient(var(--wf-grid) 1px, transparent 1px); background-size: 24px 24px; }

.wf-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.wf-edges path { fill: none; }
.wf-edge { stroke: var(--wf-edge); stroke-width: 1.75; vector-effect: non-scaling-stroke; }
/* An unfilled path won't receive interior clicks, so every edge gets a fat transparent twin. */
.wf-edge-hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.wf-edge-hit:hover + .wf-edge, .wf-edge.is-hot { stroke: var(--accent); stroke-width: 2.5; }
.wf-edge--back { stroke-dasharray: 5 4; stroke: var(--text-muted); }
.wf-edge--data { stroke: var(--accent); stroke-dasharray: 2 4; stroke-width: 1.5; opacity: .8; }
.wf-edge--ok { stroke: var(--success); }
.wf-edge--bad { stroke: var(--danger); }
.wf-edge--skipped { stroke: var(--text-muted); stroke-dasharray: 4 4; opacity: .4; }
.wf-edge--active { stroke: var(--accent); stroke-dasharray: 6 4; animation: wf-dash 1s linear infinite; }
@keyframes wf-dash { to { stroke-dashoffset: -20; } }
.wf-linkghost { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; fill: none; }
.wf-edge-label { font-family: var(--font-body); font-size: 10.5px; fill: var(--text-muted); }

.wf-marquee { position: absolute; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); pointer-events: none; }

/* ---------- node ---------- */
.wf-node {
  position: absolute; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--wf-node-accent, var(--border-strong));
  border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
  cursor: grab; user-select: none;
  /* `contain: layout` only. `paint` would clip descendants to the node box, which silently hides the
     append-a-node button positioned at right:-30px. */
  contain: layout;
  /* Above the edge-insert affordances, so grabbing a node never gets swallowed by an invisible ⊕. */
  z-index: 2;
  transition: transform .18s ease, box-shadow .12s ease, border-color .12s ease;
}
.wf-node:active { cursor: grabbing; }
.wf-node:hover { box-shadow: var(--shadow-sm); }
.wf-node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.wf-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-node.is-match { box-shadow: 0 0 0 2px var(--accent); }
.wf-node.is-dim { opacity: .35; }
.wf-node.is-detached { border-style: dashed; }
.wf-node.is-pinned .wf-node-pin { display: inline-flex; }
.wf-node-pin { display: none; color: var(--text-muted); }

.wf-node-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wf-node-icon { flex: 0 0 auto; width: 16px; height: 16px; color: var(--wf-node-accent, var(--text-secondary)); }
.wf-node-title { flex: 1 1 auto; font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-node-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.wf-node-meta { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 10.5px; color: var(--text-muted); }
.wf-node-badges { position: absolute; top: -8px; right: 8px; display: inline-flex; gap: 4px; }

/* kind accents */
.wf-node--trigger   { --wf-node-accent: #7c3aed; }
.wf-node--prompt,
.wf-node--model     { --wf-node-accent: #2563eb; }
.wf-node--knowledge { --wf-node-accent: #0891b2; }
.wf-node--tools     { --wf-node-accent: #ca8a04; }
.wf-node--logic     { --wf-node-accent: #db2777; }
.wf-node--data      { --wf-node-accent: #059669; }
.wf-node--guard     { --wf-node-accent: #dc2626; }
.wf-node--output    { --wf-node-accent: #475569; }

/* run states — mapped onto the existing semantic tokens, so dark mode needs no extra rules */
.wf-node.is-running { border-color: var(--accent); background: var(--accent-subtle); }
.wf-node.is-ok { border-color: var(--success-border); }
.wf-node.is-failed { border-color: var(--danger); background: var(--danger-subtle); }
.wf-node.is-skipped { border-style: dashed; opacity: .45; }
.wf-node.is-canceled { border-style: dashed; border-color: var(--warning); }
.wf-node.is-pending { opacity: .75; }

.wf-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-border);
  border-top-color: var(--accent); animation: wf-rotate .7s linear infinite; }
@keyframes wf-rotate { to { transform: rotate(360deg); } }

/* ports */
.wf-port { position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); cursor: crosshair; z-index: 2; }
/* A 10px dot is a punishing drag target, so expand the hit area without changing how it looks. Generous
   horizontally (where a drag starts) but tight vertically: a switch's ports are only 18px apart, so a taller
   area would have neighbours stealing each other's hits. */
.wf-port::after { content: ''; position: absolute; inset: -4px -10px; }
.wf-port:hover, .wf-port.is-valid { border-color: var(--accent); background: var(--accent-subtle);
  transform: scale(1.25); }
/* While a link is being dragged, every candidate input port is highlighted. */
.wf-canvas.is-linking .wf-port--in { border-color: var(--accent); background: var(--accent-subtle); }
.wf-canvas.is-linking .wf-port--out { opacity: .35; }
.wf-port.is-connected { background: var(--border-strong); }
.wf-port.is-invalid { opacity: .25; cursor: not-allowed; }
.wf-port--in { left: -6px; }
.wf-port--out { right: -6px; }
.wf-port-label { position: absolute; right: 10px; font-size: 10px; color: var(--text-muted);
  white-space: nowrap; pointer-events: none; }

.wf-node-insert, .wf-edge-insert { position: absolute; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; line-height: 1; cursor: pointer;
  transition: opacity .12s ease, border-color .12s ease; padding: 0; }

/* The append button lives inside a node, so it can reveal on node hover. */
.wf-node-insert { opacity: 0; z-index: 3; }
.wf-node:hover .wf-node-insert { opacity: 1; }

/* Edge-insert buttons are siblings of the SVG, not descendants of the <g>, so no ":hover the edge" selector
   can ever reach them. They are therefore faintly visible at rest — invisible-but-clickable is worse than
   slightly noisy, and it made them undiscoverable. z-index keeps them under the nodes. */
.wf-edge-insert { opacity: .32; z-index: 1; }
.wf-edge-insert:hover { opacity: 1; }

.wf-node-insert:hover, .wf-edge-insert:hover { border-color: var(--accent); color: var(--accent); }

/* Never let an affordance intercept a gesture in progress. */
.wf-canvas.is-panning .wf-edge-insert,
.wf-canvas.is-linking .wf-edge-insert { display: none; }

.wf-detached-group { position: absolute; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); pointer-events: none; }

/* ---------- level of detail: JS writes the class + --wf-k, CSS does the rest, zero re-renders ---------- */
.wf-canvas.is-far .wf-node-sub,
.wf-canvas.is-far .wf-node-meta,
.wf-canvas.is-far .wf-node-badges,
.wf-canvas.is-far .wf-port-label,
.wf-canvas.is-far .wf-edge-label,
.wf-canvas.is-far .wf-node-insert,
.wf-canvas.is-far .wf-edge-insert { display: none; }
.wf-canvas.is-far .wf-grid { background-image: none; }
.wf-canvas.is-far .wf-port { width: 5px; height: 5px; border-width: 1px; }
.wf-canvas.is-mid .wf-node-meta, .wf-canvas.is-mid .wf-edge-label { display: none; }
/* Counter-scale the title so a zoomed-out graph stays readable. */
.wf-canvas.is-far .wf-node-title { transform: scale(calc(1 / var(--wf-k, 1))); transform-origin: left center; }

/* ---------- chrome: toolbar, zoom, minimap ---------- */
.wf-toolbar { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 4px; box-shadow: var(--shadow-sm); z-index: 5; }
.wf-tool-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; padding: 0;
  background: none; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; }
.wf-tool-btn:hover { background: var(--surface-subtle); color: var(--text-primary); }
.wf-tool-btn.is-active { background: var(--accent); color: var(--text-on-accent); }
.wf-tool-sep { width: 1px; height: 20px; background: var(--border); }
.wf-zoom-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  min-width: 40px; text-align: center; }

.wf-minimap { position: absolute; right: 12px; bottom: 12px; width: 168px; height: 108px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; z-index: 5; box-shadow: var(--shadow-sm); }
.wf-minimap svg { display: block; width: 100%; height: 100%; }
.wf-minimap-node { fill: var(--border-strong); }
.wf-minimap-node.is-ok { fill: var(--success); }
.wf-minimap-node.is-failed { fill: var(--danger); }
.wf-minimap-node.is-running { fill: var(--accent); }
.wf-minimap-view { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 1; }

.wf-search { position: absolute; top: 12px; left: 12px; z-index: 5; display: flex; align-items: center;
  gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 4px 8px; box-shadow: var(--shadow-sm); }
.wf-search input { border: 0; outline: none; background: none; font-size: 12.5px; width: 160px;
  color: var(--text-primary); }
.wf-search-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* Node-anchored popovers render inside the viewport, so they pan with the graph and need no measurement.
   Not .popover — Bootstrap owns that. */
.wf-popover { position: absolute; z-index: 20; min-width: 190px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 4px; }
.wf-picker { max-height: 260px; overflow: auto; }
.wf-picker-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0;
  background: none; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-primary);
  text-align: left; cursor: pointer; }
.wf-picker-item:hover, .wf-picker-item.is-active { background: var(--surface-subtle); }

/* ---------- inspector ---------- */
.wf-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.wf-field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.wf-field-help { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.wf-field-error { font-size: 11px; color: var(--danger); }
.wf-inspector-empty { padding: 24px 12px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
.wf-group { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 10px; }
.wf-group > summary { cursor: pointer; padding: 8px 10px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); list-style: none; }
.wf-group > summary::-webkit-details-marker { display: none; }
.wf-group > summary::before { content: '▸ '; color: var(--text-muted); }
.wf-group[open] > summary::before { content: '▾ '; }
.wf-group-body { padding: 4px 10px 10px; border-top: 1px solid var(--border); }
.wf-kv-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.wf-case-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.wf-op-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.wf-var-hint { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.wf-var-chip { font-family: var(--font-mono); font-size: 10.5px; padding: 1px 5px; border-radius: var(--radius-sm);
  background: var(--accent-subtle); color: var(--accent); border: 1px solid var(--accent-border);
  cursor: pointer; }

/* ---------- run view: waterfall ---------- */
.wf-runbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface); }
.wf-fall { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; overflow: auto; }
.wf-fall-row { display: grid; grid-template-columns: 190px 1fr 150px; gap: 10px; align-items: center;
  font-size: 12px; padding: 2px 0; border: 0; background: none; text-align: left; cursor: pointer; }
.wf-fall-row:hover { background: var(--surface-subtle); }
.wf-fall-row.is-selected { background: var(--accent-subtle); }
.wf-fall-label { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-primary); }
.wf-fall-track { position: relative; height: 14px; background: var(--surface-subtle);
  border-radius: var(--radius-sm); overflow: hidden; }
.wf-fall-bar { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-sm);
  background: var(--border-strong); min-width: 2px; }
.wf-fall-bar.is-ok { background: var(--success); }
.wf-fall-bar.is-failed { background: var(--danger); }
.wf-fall-bar.is-running { background: var(--accent); opacity: .75; }
.wf-fall-bar.is-skipped { background: var(--text-muted); opacity: .3; }
.wf-fall-metrics { display: flex; align-items: center; gap: 6px; justify-content: flex-end;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.wf-fall-axis { display: flex; justify-content: space-between; font-family: var(--font-mono);
  font-size: 10px; color: var(--text-muted); border-top: 1px solid var(--border);
  margin-top: 6px; padding-top: 4px; }

/* ---------- test panel ---------- */
.wf-testpanel { border-top: 1px solid var(--border); background: var(--surface);
  height: var(--wf-test-h, 260px); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.wf-testpanel-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-bottom: 1px solid var(--border); }
.wf-testpanel-body { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.wf-testpanel-input { border-right: 1px solid var(--border); padding: 10px 12px; overflow: auto;
  display: flex; flex-direction: column; gap: 8px; }
.wf-testpanel-output { min-height: 0; overflow: auto; }

/* ---------- list / tree fallback (also the print and mobile view) ---------- */
.wf-tree { padding: 10px 14px; font-size: 13px; }
.wf-tree-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  width: 100%; border: 0; background: none; text-align: left; padding: 4px 0; cursor: pointer;
  color: var(--text-primary); }
.wf-tree-row:hover { background: var(--surface-subtle); }
.wf-tree-row.is-selected { background: var(--accent-subtle); }
.wf-tree-rail { font-family: var(--font-mono); color: var(--text-muted); white-space: pre; }
.wf-tree-note { font-size: 11.5px; color: var(--text-muted); padding: 4px 0 4px 12px; }
.wf-tree-section { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); margin: 12px 0 4px; }

.wf-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- theme tokens ---------- */
:root { --wf-grid: rgba(16, 24, 40, .10); --wf-edge: var(--border-strong); }
:root[data-theme="dark"] { --wf-grid: rgba(230, 237, 243, .09); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wf-node { transition: none; }
  .wf-edge--active { animation: none; }
  .wf-spin { animation-duration: 2s; }
}

/* ---------- mobile: a pan/zoom canvas on a phone is a bad experience, so force the outline view ---------- */
@media (max-width: 900px) {
  .wf-body { grid-template-columns: 1fr; }
  .wf-panel--left, .wf-resizer, .wf-minimap { display: none; }
  .wf-panel--right { border-left: 0; border-top: 1px solid var(--border); }
  .wf-canvas { display: none; }
  .wf-mobile-tree { display: block; }
}
.wf-mobile-tree { display: none; }

