/* Bridge /app — shared layout + namespaced tab styles */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header bar ───────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid #334155;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.app-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}

/* ── Tab buttons ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: stretch;
}

.tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 0 16px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.tab-btn:hover { color: #e2e8f0; }

.tab-btn.active {
  color: #fff;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: #1e40af;
  border-radius: 2px 2px 0 0;
}

/* ── Environment badge (header, next to the logo) ─────────────── */
.env-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 5px; color: #fff; }
.env-badge.env-blue { background: #3b82f6; }
.env-badge.env-green { background: #10b981; }
.env-badge.env-amber { background: #f59e0b; color: #1e293b; }
.env-badge.env-red { background: #ef4444; }

/* ── Profile dropdown (shared header, right side) ─────────────── */
.profile-mount { margin-left: auto; position: relative; }

.pf-button {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 4px;
  border-radius: 999px;
}
.pf-button:hover { background: rgba(148, 163, 184, 0.12); }
.pf-chevron { color: #94a3b8; font-size: 9px; transition: transform 0.15s; }
.pf-button[aria-expanded="true"] .pf-chevron { transform: rotate(180deg); }

.pf-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: #1e40af; color: #fff; font-weight: 600;
  position: relative;
}
.pf-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.pf-avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.pf-avatar .pf-photo { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.pf-initials { line-height: 1; }

.pf-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 280px; background: #1e293b; border: 1px solid #334155;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 8px; z-index: 1000;
}
.pf-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.pf-id { min-width: 0; }
.pf-name { font-size: 14px; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-email { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-role { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 4px; }
.pf-role-admin { background: rgba(124, 58, 237, 0.2); color: #c4b5fd; }
.pf-role-user { background: #334155; color: #cbd5e1; }
.pf-sep { height: 1px; background: #334155; margin: 4px 0; }

.pf-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: #e2e8f0;
  text-align: left; text-decoration: none; padding: 10px; border-radius: 6px;
}
.pf-item:hover { background: rgba(148, 163, 184, 0.12); }
.pf-item svg { flex-shrink: 0; color: #94a3b8; }
.pf-signout { color: #f87171; }
.pf-signout svg { color: #f87171; }

/* ── Content panels ───────────────────────────────────────────── */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-content {
  display: none;
  flex: 1;
  overflow: auto;
  padding: 32px;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ── Console tab — full-bleed layout (Phase 1) ───────────────── */
.console-tab.active { padding: 0; overflow: hidden; }

.console-tab .ct-container { display: flex; height: 100%; }
.console-tab .ct-sidebar { width: 340px; border-right: 1px solid #334155; overflow: hidden; background: #1e293b; flex-shrink: 0; display: flex; flex-direction: column; }
.console-tab .ct-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.console-tab .ct-controls { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.console-tab .ct-control-row { display: flex; flex-direction: column; gap: 6px; }
.console-tab .ct-control-row label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.console-tab select, .console-tab input[type=text] { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit; flex: 1; }
.console-tab select:focus, .console-tab input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.console-tab .ct-search-wrap { display: flex; background: #0f172a; border: 1px solid #334155; border-radius: 6px; overflow: hidden; }
.console-tab .ct-search-wrap input[type=text] { border: none; background: transparent; border-radius: 0; flex: 1; }
.console-tab .ct-search-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.console-tab .ct-search-wrap input[type=text]:focus { box-shadow: none; }
.console-tab .ct-search-wrap .ct-btn { border: none; border-left: 1px solid #334155; border-radius: 0; background: #1e293b; padding: 8px 14px; font-size: 12px; }
.console-tab .ct-search-wrap .ct-btn:hover { background: #334155; }
.console-tab .ct-tool-list { padding: 4px 8px; flex: 1; overflow-y: auto; }
.console-tab .ct-tool-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: #cbd5e1; transition: background 0.1s; }
.console-tab .ct-tool-item:hover { background: #334155; }
.console-tab .ct-tool-item.active { background: #1e40af; color: #fff; }
.console-tab .ct-tool-item .ct-tool-desc { font-size: 11px; color: #64748b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console-tab .ct-tool-item.active .ct-tool-desc { color: #93c5fd; }
.console-tab .ct-site-group { padding: 8px 12px 4px; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.console-tab .ct-editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.console-tab .ct-editor-header { padding: 12px 16px; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; background: #1e293b; }
.console-tab .ct-editor-header h3 { font-size: 14px; font-weight: 500; }
.console-tab .ct-btn-group { display: flex; gap: 8px; }
.console-tab .ct-btn { padding: 6px 16px; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.1s; }
.console-tab .ct-btn:hover { border-color: #475569; background: #334155; }
.console-tab .ct-btn-primary { background: #1e40af; border-color: #1e40af; color: #fff; }
.console-tab .ct-btn-primary:hover { background: #1d4ed8; }
.console-tab .ct-btn-success { background: #059669; border-color: #059669; color: #fff; }
.console-tab .ct-btn-success:hover { background: #047857; }
.console-tab .ct-btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.console-tab .ct-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.console-tab .ct-btn-sm { padding: 4px 12px; font-size: 11px; }
.console-tab .ct-btn-link { background: transparent; border: none; color: #64748b; font-size: 11px; cursor: pointer; padding: 4px 8px; font-family: inherit; text-decoration: underline; text-transform: none; letter-spacing: normal; }
.console-tab .ct-btn-link:hover { color: #cbd5e1; }
.console-tab .ct-panels { flex: 1; display: flex; overflow: hidden; }
.console-tab .ct-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.console-tab .ct-panel + .ct-panel { border-left: 1px solid #334155; }
.console-tab .ct-panel-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 16px; border-bottom: 1px solid #334155; background: #1e293b; display: flex; justify-content: space-between; align-items: center; }
.console-tab .ct-panel-label-group { display: flex; gap: 12px; align-items: center; }
.console-tab .ct-args-actions { display: flex; gap: 8px; align-items: center; text-transform: none; letter-spacing: normal; }
.console-tab textarea { flex: 1; background: #0f172a; color: #e2e8f0; border: none; padding: 16px; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px; resize: none; line-height: 1.5; }
.console-tab textarea:focus { outline: none; }
.console-tab .ct-response-meta { padding: 8px 16px; border-top: 1px solid #334155; font-size: 11px; color: #64748b; background: #1e293b; display: flex; gap: 16px; }
.console-tab .ct-response-meta .ct-status { font-weight: 600; }
.console-tab .ct-response-meta .ct-status.ok { color: #22c55e; }
.console-tab .ct-response-meta .ct-status.err { color: #ef4444; }
.console-tab .ct-curl-box { background: #0f172a; border: 1px solid #334155; border-radius: 6px; padding: 12px; margin: 8px 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #94a3b8; white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow-y: auto; display: none; }
.console-tab .ct-curl-box.visible { display: block; }
.console-tab .ct-envelope-preview { background: #0b1220; color: #94a3b8; border-bottom: 1px solid #334155; padding: 12px 16px; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; max-height: 35%; overflow-y: auto; margin: 0; }
.console-tab .ct-var-panel { border-top: 1px solid #334155; background: #1e293b; padding: 8px 16px; max-height: 160px; overflow-y: auto; }
.console-tab .ct-var-panel-title { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.console-tab .ct-var-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.console-tab .ct-var-row label { font-size: 12px; color: #c4b5fd; font-family: 'JetBrains Mono', monospace; min-width: 140px; }
.console-tab .ct-var-row input { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: inherit; flex: 1; }
.console-tab .ct-var-row input:focus { outline: none; border-color: #3b82f6; }
.console-tab .ct-var-count { color: #a78bfa; font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: normal; }
.console-tab .ct-field-panel { border-top: 1px solid #334155; background: #1e293b; padding: 8px 16px; max-height: 200px; overflow-y: auto; }
.console-tab .ct-field-panel-title { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.console-tab .ct-field-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.console-tab .ct-field-name { font-size: 12px; color: #e2e8f0; font-family: 'JetBrains Mono', monospace; min-width: 120px; }
.console-tab .ct-field-badge { font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 600; display: inline-block; }
.console-tab .ct-field-badge.type { background: #1e3a5f; color: #3b82f6; }
.console-tab .ct-field-badge.required { background: #3b1020; color: #ef4444; }
.console-tab .ct-field-badge.optional { background: #1e293b; color: #64748b; border: 1px solid #334155; }
.console-tab .ct-field-default { font-size: 11px; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }
.console-tab .ct-field-enum { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 128px; margin-top: 2px; margin-bottom: 4px; }
.console-tab .ct-field-enum-chip { font-size: 10px; padding: 1px 8px; border-radius: 3px; background: #2e1065; color: #a78bfa; cursor: pointer; font-family: 'JetBrains Mono', monospace; border: 1px solid #3b1f7e; }
.console-tab .ct-field-enum-chip:hover { background: #3b1f7e; color: #c4b5fd; }
.console-tab .ct-empty-state { flex: 1; display: flex; align-items: center; justify-content: center; color: #475569; font-size: 14px; }
.console-tab .ct-loading { opacity: 0.5; pointer-events: none; }
.console-tab .ct-header-inputs { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-bottom: 1px solid #334155; }
.console-tab .ct-header-inputs .ct-hdr-row { display: flex; gap: 8px; align-items: center; }
.console-tab .ct-header-inputs label { font-size: 11px; color: #64748b; min-width: 110px; }
.console-tab .ct-header-inputs input { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 5px 8px; border-radius: 4px; font-size: 12px; font-family: inherit; flex: 1; }
.console-tab .ct-header-inputs input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.console-tab .ct-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.console-tab .ct-modal { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 24px; width: 360px; max-width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.console-tab .ct-modal h3 { font-size: 15px; font-weight: 600; color: #f1f5f9; margin-bottom: 8px; }
.console-tab .ct-modal-desc { font-size: 12px; color: #94a3b8; margin-bottom: 16px; line-height: 1.5; }
.console-tab .ct-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── Status tab — dashboard layout (Phase 2) ──────────────────── */
.status-tab { padding: 24px !important; overflow-y: auto !important; }

.status-tab .st-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.status-tab .st-bar { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 12px 18px; }
.status-tab .st-bar-item { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.status-tab .st-bar-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; margin-right: 8px; font-weight: 600; }
.status-tab .st-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.status-tab .st-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.status-tab .st-card-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }

.status-tab .st-badge { display: inline-block; padding: 6px 14px; border-radius: 4px; font-size: 12px; font-weight: 700; width: fit-content; letter-spacing: 0.05em; background: #334155; color: #94a3b8; }

.status-tab .st-stat { font-size: 32px; font-weight: 700; color: #f1f5f9; line-height: 1; }
.status-tab .st-detail { font-size: 12px; color: #94a3b8; }

.status-tab .st-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.status-tab .st-metric { background: #0f172a; border: 1px solid #334155; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.status-tab .st-metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.status-tab .st-metric-value { font-size: 18px; font-weight: 700; color: #3b82f6; }

.status-tab .st-sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.status-tab .st-site-chip { background: #0f172a; border: 1px solid #334155; border-radius: 6px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.status-tab .st-site-name { font-size: 13px; font-weight: 500; color: #e2e8f0; }
.status-tab .st-site-count { font-size: 11px; color: #64748b; }

.status-tab .st-dep-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-tab .st-dep-badge.ok { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-tab .st-dep-badge.warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-tab .st-dep-badge.err { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.status-tab .st-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.status-tab .st-table thead { background: #0f172a; }
.status-tab .st-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #334155; }
.status-tab .st-table td { padding: 8px 12px; border-bottom: 1px solid #1e293b; color: #cbd5e1; }
.status-tab .st-table tbody tr:hover { background: #334155; }
.status-tab .st-truncate { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-tab .st-time { white-space: nowrap; color: #94a3b8; font-size: 11px; }

.status-tab .st-error-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.status-tab .st-error-item { display: flex; gap: 10px; font-size: 12px; padding: 8px 10px; background: #0f172a; border-left: 3px solid #64748b; border-radius: 4px; align-items: center; }
.status-tab .st-error-item:has(.error) { border-left-color: #ef4444; }
.status-tab .st-error-item:has(.warning) { border-left-color: #f59e0b; }

.status-tab .st-error-level { font-weight: 600; text-transform: uppercase; font-size: 10px; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; }
.status-tab .st-error-level.error { background: #ef4444; color: #fff; }
.status-tab .st-error-level.warning { background: #f59e0b; color: #000; }
.status-tab .st-error-time { color: #94a3b8; min-width: 75px; flex-shrink: 0; font-size: 11px; }
.status-tab .st-error-logger { color: #64748b; min-width: 60px; max-width: 100px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.status-tab .st-error-msg { color: #cbd5e1; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-tab .st-empty { color: #64748b; font-style: italic; padding: 16px; text-align: center; }
.status-tab .st-error-box { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 6px; padding: 16px; color: #fca5a5; font-size: 13px; }
.status-tab .st-footer { font-size: 11px; color: #475569; text-align: right; padding-top: 12px; border-top: 1px solid #1e293b; }

/* ── Admin tab — admin panel layout (Phase 4) ──────────────────── */
.admin-tab { padding: 24px !important; overflow-y: auto !important; }

.admin-tab .at-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; width: 100%; }

/* Header bar */
.admin-tab .at-header { display: flex; justify-content: space-between; align-items: center; }
.admin-tab .at-header-left { display: flex; align-items: center; gap: 12px; }
.admin-tab .at-header-title { font-size: 18px; font-weight: 700; color: #f1f5f9; }
.admin-tab .at-role-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-tab .at-role-admin { background: #1e40af; color: #fff; }
.admin-tab .at-role-viewer { background: #334155; color: #94a3b8; }

/* Login form */
.admin-tab .at-login-wrap { display: flex; align-items: center; justify-content: center; min-height: 400px; }
.admin-tab .at-login-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 32px; width: 360px; max-width: 100%; }
.admin-tab .at-login-title { font-size: 16px; font-weight: 600; color: #f1f5f9; margin-bottom: 20px; text-align: center; }
.admin-tab .at-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.admin-tab .at-label { font-size: 12px; font-weight: 500; color: #94a3b8; }
.admin-tab .at-input { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 10px 12px; border-radius: 6px; font-size: 13px; font-family: inherit; width: 100%; }
.admin-tab .at-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.admin-tab .at-login-error { color: #fca5a5; font-size: 12px; margin-bottom: 12px; display: none; }

/* Buttons */
.admin-tab .at-btn { padding: 8px 16px; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.1s; }
.admin-tab .at-btn:hover { border-color: #475569; background: #334155; }
.admin-tab .at-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-tab .at-btn-primary { background: #1e40af; border-color: #1e40af; color: #fff; }
.admin-tab .at-btn-primary:hover { background: #1d4ed8; }
.admin-tab .at-btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.admin-tab .at-btn-danger:hover { background: #b91c1c; }
.admin-tab .at-btn-sm { padding: 4px 12px; font-size: 11px; }
.admin-tab .at-btn-block { width: 100%; }
.admin-tab .at-btn-ghost { background: transparent; border-color: transparent; color: #94a3b8; }
.admin-tab .at-btn-ghost:hover { color: #e2e8f0; background: #334155; }

/* Section cards */
.admin-tab .at-section { background: #1e293b; border: 1px solid #334155; border-radius: 8px; overflow: hidden; }
.admin-tab .at-user-cell { display: flex; align-items: center; gap: 10px; }
.admin-tab .at-user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #1e40af; color: #fff; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.admin-tab .at-user-card { display: flex; align-items: center; gap: 12px; background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.admin-tab .at-user-card .at-user-avatar { width: 40px; height: 40px; font-size: 14px; }
.admin-tab .at-role-opts { display: flex; flex-direction: column; gap: 10px; }
.admin-tab .at-role-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #334155; border-radius: 8px; cursor: pointer; }
.admin-tab .at-role-opt:has(input:checked) { border-color: #3b82f6; background: rgba(59, 130, 246, 0.08); }
.admin-tab .at-role-opt input { margin-top: 3px; }
.admin-tab .at-role-opt-title { font-size: 14px; font-weight: 600; color: #f1f5f9; }
.admin-tab .at-notice { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 32px; max-width: 520px; margin: 40px auto; text-align: center; }
.admin-tab .at-notice-title { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.admin-tab .at-danger-zone { border-color: rgba(239, 68, 68, 0.45); }
.admin-tab .at-danger-zone .at-section-title { color: #f87171; }
.admin-tab .at-maint-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-tab .at-section-body code { background: #0f172a; padding: 1px 5px; border-radius: 4px; font-size: 12px; color: #93c5fd; }
.admin-tab .at-section-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #334155; }
.admin-tab .at-section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.admin-tab .at-section-actions { display: flex; gap: 8px; }
.admin-tab .at-section-body { padding: 0; }

/* Tables */
.admin-tab .at-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-tab .at-table thead { background: #0f172a; }
.admin-tab .at-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #334155; }
.admin-tab .at-table td { padding: 8px 12px; border-bottom: 1px solid #1e293b; color: #cbd5e1; vertical-align: top; }
.admin-tab .at-table tbody tr:hover { background: #334155; }

/* Config editor */
.admin-tab .at-config-key { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: #e2e8f0; white-space: nowrap; }
.admin-tab .at-config-value { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: #94a3b8; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-tab .at-config-category { font-size: 11px; color: #64748b; }
.admin-tab .at-config-input { background: #0f172a; border: 1px solid #3b82f6; color: #e2e8f0; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: 'JetBrains Mono', monospace; width: 100%; }
.admin-tab .at-config-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.admin-tab .at-inline-actions { display: flex; gap: 4px; margin-top: 4px; }

/* Key manager */
.admin-tab .at-key-prefix { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: #0f172a; padding: 2px 8px; border-radius: 4px; color: #e2e8f0; }
.admin-tab .at-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-tab .at-badge-active { background: rgba(5,150,105,0.2); color: #34d399; }
.admin-tab .at-badge-revoked { background: rgba(220,38,38,0.2); color: #fca5a5; }
.admin-tab .at-badge-expired { background: rgba(245,158,11,0.2); color: #fbbf24; }

/* Audit log */
.admin-tab .at-audit-action { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: #0f172a; color: #94a3b8; white-space: nowrap; }
.admin-tab .at-audit-time { font-size: 11px; color: #64748b; white-space: nowrap; }
.admin-tab .at-pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #334155; }
.admin-tab .at-page-info { font-size: 11px; color: #64748b; }
.admin-tab .at-page-btns { display: flex; gap: 8px; }

/* Modal */
.admin-tab .at-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.admin-tab .at-modal { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 24px; width: 480px; max-width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.admin-tab .at-modal-title { font-size: 15px; font-weight: 600; color: #f1f5f9; margin-bottom: 12px; }
.admin-tab .at-modal-body { font-size: 13px; color: #94a3b8; line-height: 1.5; margin-bottom: 16px; }
.admin-tab .at-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.admin-tab .at-key-display { background: #0f172a; border: 1px solid #334155; border-radius: 6px; padding: 12px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: #e2e8f0; word-break: break-all; user-select: all; margin-bottom: 8px; }
.admin-tab .at-key-warning { font-size: 11px; color: #fbbf24; margin-bottom: 12px; }

/* Create key inline form */
.admin-tab .at-create-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #334155; align-items: center; }
.admin-tab .at-create-form .at-input { flex: 1; padding: 6px 10px; }

/* Toast */
.admin-tab #at-toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 20px; border-radius: 6px; color: #fff; font-size: 13px; z-index: 9999; transition: opacity 0.3s; opacity: 0; pointer-events: none; }

/* Loading / empty states */
.admin-tab .at-loading { color: #64748b; font-size: 13px; padding: 24px; text-align: center; }
.admin-tab .at-empty { color: #64748b; font-style: italic; padding: 24px; text-align: center; font-size: 13px; }
.admin-tab .at-muted { color: #64748b; }
.admin-tab .at-mono { font-family: 'JetBrains Mono', monospace; }

/* ── Utility: alert boxes ─────────────────────────────────────── */
.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-header { padding: 0 12px; gap: 12px; }
  .tab-btn { padding: 0 10px; font-size: 12px; }
  .tab-content { padding: 16px; }
  .console-tab.active { padding: 0; }
  .console-tab .ct-sidebar { width: 260px; }
  .status-tab { padding: 16px !important; }
  .status-tab .st-row { grid-template-columns: 1fr; }
  .status-tab .st-metrics { grid-template-columns: repeat(2, 1fr); }
  .status-tab .st-sites-grid { grid-template-columns: 1fr; }
  .status-tab .st-error-logger { display: none; }
}
