/* ============================================
   SHARED STYLES — DataLink Nexus
   Clean / modern theme with sharp lines,
   system fonts, and minimal shadows.
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ---- CSS Variables (Light) ---- */
:root {
  --primary: #3b82f6; --primary-hover: #2563eb; --success: #22c55e; --warning: #f59e0b; --danger: #ef4444;
  --bg: #f8fafc; --bg-card: #ffffff; --border: #e2e8f0; --text: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
  --stat-bg-primary: #eff6ff; --stat-bg-success: #f0fdf4; --stat-bg-warning: #fffbeb; --stat-bg-danger: #fef2f2; --stat-bg-teal: #f5f3ff;
  --sketch-border: 1px solid #e2e8f0; --sketch-radius: 8px;
  --sketch-radius-sm: 6px;
  --sketch-radius-pill: 9999px;
  --font-hand: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-data: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --input-radius: 6px;
}

/* ---- CSS Variables (Dark) ---- */
[data-theme="dark"] {
  --primary: #60a5fa; --primary-hover: #3b82f6; --success: #4ade80; --warning: #fbbf24; --danger: #f87171;
  --bg: #0f172a; --bg-card: #1e293b; --border: #334155; --text: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b;
  --sketch-border: 1px solid #334155;
  --stat-bg-primary: #1e3a5f; --stat-bg-success: #14532d; --stat-bg-warning: #422006; --stat-bg-danger: #450a0a; --stat-bg-teal: #2e1065;
}

/* ---- Body ---- */
body {
  font-family: var(--font-hand); background: var(--bg); color: var(--text); font-size: 12px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ---- Header ---- */
.header-bar { background: var(--bg-card); border-bottom: var(--sketch-border); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.header-left { display: flex; align-items: center; gap: 24px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo img { height: 32px; width: auto; }
.logo-text { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }

/* ---- Connection Status ---- */
.connection-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; border: none; }
.status-dot.connected { background: var(--success); }
.status-dot.degraded { background: var(--warning); }
.status-dot.disconnected { background: var(--danger); }

/* ---- Nav Links (index.html / queue-types.html style) ---- */
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-link { padding: 6px 14px; border-radius: var(--sketch-radius-sm); font-size: 12px; font-family: var(--font-hand); color: var(--text-secondary); transition: all 0.15s; border: 1px solid transparent; text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--bg); color: var(--text); font-weight: 600; }
.nav-link.highlight { background: var(--primary); color: white; border-color: transparent; }
.nav-link.highlight:hover { background: var(--primary-hover); color: white; }

/* ---- Nav Tabs (dashboard style) ---- */
.nav-tabs { display: flex; gap: 2px; }
.nav-tab { padding: 8px 16px; border-radius: var(--sketch-radius-sm); cursor: pointer; font-size: 12px; font-weight: 500; font-family: var(--font-hand); color: var(--text-secondary); transition: all 0.15s; border: 1px solid transparent; background: none; }
.nav-tab:hover { background: var(--bg); color: var(--text); }
.nav-tab.active { background: var(--primary); color: white; border-color: transparent; }

/* ---- Theme Toggle ---- */
.theme-toggle { background: var(--bg); border: 1px solid var(--border); border-radius: var(--sketch-radius-sm); padding: 6px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; font-family: var(--font-hand); color: var(--text-secondary); transition: all 0.15s; }
.theme-toggle:hover { background: var(--border); color: var(--text); }
.theme-toggle:active { transform: scale(0.97); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ---- Buttons ---- */
.btn { padding: 8px 18px; border-radius: var(--sketch-radius-sm); font-size: 12px; font-weight: 500; font-family: var(--font-hand); cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none; text-align: center; display: inline-block; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; opacity: 0.6; }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---- Content ---- */
.content { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ---- Section Heading ---- */
.section-heading { font-size: 30px; font-family: var(--font-display); font-weight: 700; position: relative; display: inline-block; margin-bottom: 24px; }
.section-heading::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 3px; background: var(--primary); border-radius: 2px; }

/* ---- Main Content ---- */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 26px; font-family: var(--font-display); font-weight: 700; position: relative; display: inline-block; }
.page-title::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 3px; background: var(--primary); border-radius: 2px; }

/* ---- Cards ---- */
.card { background: var(--bg-card); border: var(--sketch-border); border-radius: var(--sketch-radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-weight: 600; font-size: 16px; font-family: var(--font-display); }

/* ---- Stats ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-box { background: var(--bg-card); border: var(--sketch-border); border-radius: var(--sketch-radius); padding: 14px 18px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--font-display); }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-box.stat-primary { background: var(--stat-bg-primary); border-color: var(--primary); }
.stat-box.stat-success { background: var(--stat-bg-success); border-color: var(--success); }
.stat-box.stat-warning { background: var(--stat-bg-warning); border-color: var(--warning); }
.stat-box.stat-danger { background: var(--stat-bg-danger); border-color: var(--danger); }
.stat-box.stat-teal { background: var(--stat-bg-teal); border-color: #7c3aed; }

/* ---- Forms ---- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px; color: var(--text-secondary); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--input-radius); font-size: 12px; font-family: var(--font-data); background: var(--bg-card); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.form-input::placeholder { color: var(--text-muted); }
.form-input.input-error { border-color: var(--danger); }
.form-input.input-error:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-row-3 { display: flex; gap: 12px; }
.form-row-3 .form-group { flex: 1; }
.form-checkboxes { display: flex; gap: 20px; margin-bottom: 8px; }
.form-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.form-checkbox input { width: 16px; height: 16px; cursor: pointer; }

/* ---- Queue Type Badges ---- */
.queue-type { font-size: 11px; padding: 2px 8px; border-radius: var(--sketch-radius-pill); font-weight: 500; border: 1px solid; font-family: var(--font-data); display: inline-block; white-space: nowrap; }
.queue-type.one-to-one { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.queue-type.one-to-many { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.queue-type.key-value { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.queue-type.time-series { background: #f5f3ff; color: #6d28d9; border-color: #c4b5fd; }
.queue-type.stream-to-one { background: #fdf2f8; color: #be185d; border-color: #f9a8d4; }
.queue-type.stream-to-many { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.queue-type.document { background: #ecfeff; color: #0e7490; border-color: #67e8f9; }
.queue-type.text-document { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
[data-theme="dark"] .queue-type.one-to-one { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .queue-type.one-to-many { background: #14532d; color: #86efac; border-color: #22c55e; }
[data-theme="dark"] .queue-type.key-value { background: #422006; color: #fcd34d; border-color: #f59e0b; }
[data-theme="dark"] .queue-type.time-series { background: #2e1065; color: #c4b5fd; border-color: #8b5cf6; }
[data-theme="dark"] .queue-type.stream-to-one { background: #500724; color: #f9a8d4; border-color: #ec4899; }
[data-theme="dark"] .queue-type.stream-to-many { background: #450a0a; color: #fca5a5; border-color: #ef4444; }
[data-theme="dark"] .queue-type.document { background: #083344; color: #67e8f9; border-color: #06b6d4; }
[data-theme="dark"] .queue-type.text-document { background: #1e293b; color: #cbd5e1; border-color: #475569; }

/* ---- General Badges ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--sketch-radius-pill); font-size: 12px; font-weight: 400; border: 1px solid; font-family: var(--font-data); white-space: nowrap; }
.badge-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.badge-warning { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.badge-danger { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
[data-theme="dark"] .badge-success { background: #14532d; color: #86efac; border-color: #22c55e; }
[data-theme="dark"] .badge-warning { background: #422006; color: #fcd34d; border-color: #f59e0b; }
[data-theme="dark"] .badge-danger { background: #450a0a; color: #fca5a5; border-color: #ef4444; }

/* ---- Count Badges ---- */
.count-badge { display: inline-flex; align-items: center; padding: 2px 10px; background: var(--bg); border-radius: var(--sketch-radius-pill); font-size: 12px; font-weight: 400; font-family: var(--font-data); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.count-badge.primary { background: var(--stat-bg-primary); color: var(--primary); border-color: var(--primary); }
.count-badge.success { background: var(--stat-bg-success); color: var(--success); border-color: var(--success); }
.count-badge.warning { background: var(--stat-bg-warning); color: var(--warning); border-color: var(--warning); }
.count-badge.danger { background: var(--stat-bg-danger); color: var(--danger); border-color: var(--danger); }

/* ---- Permission Badges ---- */
.perm-badge { display: inline-block; padding: 2px 8px; border-radius: var(--sketch-radius-pill); font-size: 12px; font-weight: 600; }
.perm-badge-full { background: #dcfce7; color: #166534; }
.perm-badge-partial { background: #fef9c3; color: #854d0e; }
.perm-badge-none { background: #fee2e2; color: #991b1b; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--sketch-radius-sm); font-size: 12px; margin-bottom: 12px; border: 1px solid; }
.alert-error { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.alert-info { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
[data-theme="dark"] .alert-error { background: #450a0a; border-color: #ef4444; color: #fca5a5; }
[data-theme="dark"] .alert-success { background: #14532d; border-color: #22c55e; color: #86efac; }
[data-theme="dark"] .alert-info { background: #1e3a5f; border-color: #60a5fa; color: #93c5fd; }

.error-hint { color: var(--danger); font-size: 12px; font-weight: normal; }
[data-theme="dark"] .error-hint { color: #fca5a5; }

/* ---- Item Cards ---- */
.item-card { background: var(--bg-card); border: var(--sketch-border); border-radius: var(--sketch-radius); padding: 16px; transition: all 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: relative; }
.item-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: var(--primary); }
.item-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.item-card-title { font-weight: 600; font-size: 15px; font-family: var(--font-display); }
.item-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.item-card-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); align-items: center; }
.item-card-stat span { font-weight: 600; color: var(--text); font-family: var(--font-display); font-size: 15px; }

/* ---- Tables ---- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-family: var(--font-data); }
th, td { padding: 10px 12px; text-align: left; }
table th { border-bottom: 2px solid var(--border); font-family: var(--font-data); font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
table td { border-bottom: 1px solid var(--border); font-family: var(--font-data); font-size: 12px; line-height: 1.5; color: var(--text); }
tr:hover { background: var(--bg); }
table .btn { font-size: 12px; font-family: var(--font-data); }

/* ---- Charts ---- */
.chart-container { width: 100%; height: 280px; }
.chart-legend { display: flex; justify-content: center; gap: 20px; margin-top: 12px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); cursor: pointer; padding: 4px 10px; border-radius: var(--sketch-radius-pill); transition: all 0.15s; user-select: none; border: 1px solid transparent; }
.legend-item:hover { background: var(--bg); border-color: var(--border); }
.legend-item.disabled { opacity: 0.4; }
.legend-item.disabled .legend-color { background: var(--text-muted) !important; }
.legend-color { width: 10px; height: 10px; border-radius: 50%; border: none; transition: background 0.15s; }

/* ---- D3 Tooltip ---- */
.d3-tooltip { position: absolute; background: var(--bg-card); border: var(--sketch-border); border-radius: var(--sketch-radius-sm); padding: 12px; font-size: 12px; font-family: var(--font-hand); pointer-events: none; z-index: 1000; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.d3-tooltip .tooltip-title { font-weight: 600; margin-bottom: 6px; font-family: var(--font-display); font-size: 12px; }
.d3-tooltip .tooltip-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.d3-tooltip .tooltip-label { color: var(--text-secondary); }
.d3-tooltip .tooltip-value { font-weight: 600; font-family: var(--font-display); font-size: 12px; }

/* ---- Modals ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--bg-card); border: var(--sketch-border); border-radius: 12px; padding: 20px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.12); display: flex; flex-direction: column; }
.modal-lg { max-width: 640px; }
.modal-body { flex: 1; min-height: 0; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 12px; flex-shrink: 0; }
.modal-title { font-size: 18px; font-family: var(--font-display); font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; font-family: var(--font-hand); padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--danger); background: var(--bg); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; flex-shrink: 0; }
.modal .form-group { margin-bottom: 8px; }
.modal .form-input { padding: 6px 10px; font-size: 12px; }
.modal .form-label { font-size: 12px; margin-bottom: 2px; }
.modal .form-hint { font-size: 11px; margin-top: 2px; }
.modal .section-title { margin: 12px 0 8px 0; padding-top: 12px; }

/* ---- Section Title (inside cards/modals) ---- */
.section-title { font-size: 12px; font-family: var(--font-display); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 12px 0; padding-top: 16px; border-top: 1px solid var(--border); }
.section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.modal-header + .section-title { margin-top: 0; padding-top: 0; border-top: none; }

/* ---- Loading / Spinner ---- */
.loading { display: flex; justify-content: center; align-items: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state-icon svg { width: 100%; height: 100%; stroke: var(--text-muted); fill: none; stroke-width: 1.5; }
.empty-state-text { font-size: 18px; font-family: var(--font-display); margin-bottom: 8px; font-weight: 600; }
.empty-state-hint { font-size: 12px; opacity: 0.7; }

/* ---- Skeleton Loading ---- */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; border-radius: var(--sketch-radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 100px; border-radius: var(--sketch-radius); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-stat { height: 32px; width: 80px; }

/* ---- Login Screen ---- */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--bg-card); border: var(--sketch-border); border-radius: 12px; padding: 36px; width: 100%; max-width: 480px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); position: relative; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.login-logo img { height: 44px; width: auto; }
.login-logo .logo-text { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text); }
.login-title { font-size: 24px; font-family: var(--font-display); font-weight: 700; text-align: center; margin-bottom: 24px; color: var(--text); }

/* ---- Login Tabs ---- */
.login-tabs { display: flex; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.login-tab { flex: 1; padding: 12px; text-align: center; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; background: none; border-left: none; border-right: none; border-top: none; font-size: 12px; font-weight: 500; font-family: var(--font-hand); }
.login-tab:hover { color: var(--text); }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Secret Display ---- */
.secret-display { background: var(--bg); border: 1px solid var(--border); border-radius: var(--input-radius); padding: 12px; margin: 12px 0; }
.secret-display label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.secret-display code { font-size: 12px; font-family: 'SF Mono', 'Fira Code', monospace; color: var(--primary); word-break: break-all; }

/* ---- Logout Button ---- */
.logout-btn { background: none; border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 12px; border-radius: var(--sketch-radius-sm); font-size: 12px; font-family: var(--font-hand); cursor: pointer; transition: all 0.15s; font-weight: 500; }
.logout-btn:hover { background: var(--stat-bg-danger); border-color: var(--danger); color: var(--danger); }

/* ---- Pre/Code Blocks ---- */
pre { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--input-radius); padding: 12px; line-height: 1.6; }

/* ---- Select Elements ---- */
select.form-input { appearance: none; font-family: var(--font-data); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
[data-theme="dark"] select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* ---- Grids ---- */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }

/* ---- Section ---- */
.section { padding: 48px 0; }
.section + .section { border-top: 1px solid var(--border); }

/* ---- Tabs (content tabs) ---- */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 16px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; font-size: 12px; font-weight: 500; font-family: var(--font-hand); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Hero ---- */
.hero { text-align: center; padding: 64px 24px 48px; }
.hero-logo { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 20px; }
.hero-logo img { height: 56px; width: auto; }
.hero-title { font-family: var(--font-display); font-size: 52px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.hero-subtitle { font-family: var(--font-display); font-size: 24px; color: var(--primary); margin-bottom: 16px; font-weight: 600; }
.hero-description { font-size: 16px; color: var(--text-secondary); max-width: 650px; margin: 0 auto 28px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--border); padding: 32px 24px; margin-top: 48px; }
.footer-content { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-logo { display: flex; align-items: center; gap: 8px; }
.footer-logo img { height: 24px; width: auto; }
.footer-logo span { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-muted); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 12px; color: var(--text-muted); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--primary); }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-card); border: var(--sketch-border); border-radius: var(--sketch-radius); padding: 14px 18px; min-width: 280px; box-shadow: 0 8px 32px rgba(0,0,0,0.12); z-index: 9999; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease-out; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast-message { flex: 1; font-size: 12px; }
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(400px); opacity: 0; } }
.toast.hiding { animation: slideOut 0.3s ease-in forwards; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--sketch-radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Utility Classes ---- */
.mono-sm { font-size: 10px; font-family: 'SF Mono', 'Fira Code', monospace; }
.mono-xs { font-size: 11px; font-family: 'SF Mono', 'Fira Code', monospace; }
.mono-code { font-size: 12px; font-family: 'SF Mono', 'Fira Code', monospace; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }
.w-auto { width: auto; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.ml-6 { margin-left: 6px; }
.ml-8 { margin-left: 8px; }
.d-block { display: block; }
.d-flex { display: flex; }
.flex-1 { flex: 1; }
.align-center { align-items: center; }
.align-end { align-items: end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.user-select-all { user-select: all; }
.cursor-pointer { cursor: pointer; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.truncate-wide { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-x-auto { overflow-x: auto; }
.w-full { width: 100%; }
.w-80 { width: 80px; }
.w-120 { width: 120px; }
.w-140 { width: 140px; }
.w-150 { width: 150px; }
.w-320 { width: 320px; }
.max-w-360 { max-width: 360px; }
.max-w-400 { max-width: 400px; }
.max-w-420 { max-width: 420px; }
.max-w-480 { max-width: 480px; width: 100%; }
.max-w-520 { max-width: 520px; width: 100%; }
.max-w-560 { max-width: 560px; }
.max-w-600 { max-width: 600px; }
.max-w-700 { max-width: 700px; }
.min-w-500 { min-width: 500px; }
.filter-bar { display: flex; gap: 8px; align-items: center; }
.filter-bar-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter-hint { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.stale-hint { margin-left: auto; font-size: 12px; opacity: 0.7; }
.alert-flex { display: flex; align-items: center; gap: 8px; }
.credential-code { flex: 1; background: #f1f5f9; padding: 8px; border-radius: 4px; word-break: break-all; font-size: 12px; color: #1e293b; }
[data-theme="dark"] .credential-code { background: var(--bg); color: var(--text); }
.credential-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.credential-warning { color: var(--warning); display: block; margin-top: 8px; }
.mono-display { background: var(--bg); padding: 10px 12px; border-radius: 6px; font-family: monospace; font-size: 12px; word-break: break-all; }
.settings-separator { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.stat-value-teal { color: #7c3aed; }
.legend-published { background: #2563eb; }
.legend-acked { background: #16a34a; }
.legend-nacked { background: #d97706; }
.legend-deadletter { background: #dc2626; }
.legend-requeued { background: #7c3aed; }
.tooltip-published { color: #2563eb; }
.tooltip-acked { color: #16a34a; }
.tooltip-nacked { color: #d97706; }
.tooltip-deadletter { color: #dc2626; }
.tooltip-requeued { color: #7c3aed; }
.btn-icon { padding: 4px 8px; }
.min-h-200 { min-height: 200px; }
.batch-result-panel { max-height: 150px; overflow-y: auto; font-size: 12px; font-family: monospace; background: var(--bg); padding: 8px; border-radius: 4px; }
.batch-item-gap { margin-bottom: 4px; }
.copy-btn-sm { margin-left: 6px; padding: 2px 8px; font-size: 11px; }
.bucket-tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.bucket-tag-info { background: var(--stat-bg-info); color: var(--info); }
.bucket-tag-warning { background: var(--stat-bg-warning); color: var(--warning); }
.bucket-tag-primary { background: var(--stat-bg-primary); color: var(--primary); }
.bucket-field-item { background: var(--bg); padding: 8px; border-radius: 4px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 11px; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.grid-2col-12 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mask-option { display: flex; align-items: center; gap: 8px; }
.form-group-inline { display: flex; align-items: end; }
.pre-code { background: var(--bg); padding: 10px; border-radius: 6px; font-size: 11px; overflow-x: auto; color: var(--text); border: 1px solid var(--border); }
.pre-config { background: var(--bg); padding: 12px; border-radius: 6px; font-size: 11px; overflow-x: auto; }
.pre-payload { background: var(--bg); padding: 12px; border-radius: 6px; font-size: 11px; overflow-x: auto; max-height: 100px; }
.pre-payload-lg { background: var(--bg); padding: 12px; border-radius: 6px; font-size: 11px; overflow-x: auto; max-height: 250px; }
.code-block { background: var(--bg); padding: 8px; border-radius: 4px; display: block; word-break: break-all; font-size: 11px; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.billing-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 16px; align-items: end; }
.billing-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.settings-center { display: flex; justify-content: center; }
.settings-column { display: flex; flex-direction: column; align-items: center; padding-top: 40px; }
.form-input-readonly { background: var(--bg); cursor: default; }
.optional-label { font-weight: 400; color: var(--text-muted); }
.height-36 { height: 36px; }
.dlq-msg-meta { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-title { font-size: 36px; }
  .hero-subtitle { font-size: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
}
