/* =========================================================
   portal.css — Phase 2 styles: Change Requests, File Browser,
   Settings, Team, Notifications, Diff viewer
   ========================================================= */

/* ══════════════════════════════════════════════════════════
   LOGIN — Modern Landing Splash + Auth Form
   ══════════════════════════════════════════════════════════ */

.login-overlay-v2 {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
}

/* ── Stage 1: Splash ──────────────────────────────────────── */
.splash-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s cubic-bezier(.4,0,.2,1), transform .5s cubic-bezier(.4,0,.2,1);
  z-index: 2;
}
.splash-stage.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.97);
}

.splash-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
}
/* Animated mesh gradient overlay */
.splash-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(99,102,241,.25) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(139,92,246,.2) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(6,182,212,.1) 0%, transparent 70%);
  animation: meshShift 8s ease-in-out infinite alternate;
}
@keyframes meshShift {
  0%   { opacity: .7; transform: scale(1) rotate(0deg); }
  100% { opacity: 1;  transform: scale(1.05) rotate(2deg); }
}
/* Grid lines */
.splash-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.splash-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  max-width: 600px;
  animation: splashFadeIn .8s cubic-bezier(.4,0,.2,1) both;
}
@keyframes splashFadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-logo {
  margin-bottom: 16px;
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.splash-wordmark {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 24px;
}

.splash-tagline {
  font-family: 'Inter', sans-serif;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.75) 50%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.splash-sub {
  font-size: 16px;
  color: rgba(255,255,255,.55);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 36px;
  font-weight: 400;
}

.splash-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  box-shadow: 0 8px 32px rgba(99,102,241,.4);
  letter-spacing: .2px;
}
.splash-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(99,102,241,.55);
}
.splash-cta:active { transform: translateY(0); }

.splash-footnote {
  margin-top: 32px;
  font-size: 12px;
  color: rgba(255,255,255,.25);
  letter-spacing: .3px;
}

/* ── Stage 2: Auth form ───────────────────────────────────── */
.auth-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
  opacity: 0;
  pointer-events: none;
  transform: translateX(40px);
  transition: opacity .45s cubic-bezier(.4,0,.2,1), transform .45s cubic-bezier(.4,0,.2,1);
  z-index: 1;
}
.auth-stage.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

.auth-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px 36px 32px;
  backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
  animation: authSlideIn .45s cubic-bezier(.4,0,.2,1) both;
}
@keyframes authSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-back {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-back:hover { background: rgba(255,255,255,.12); color: #fff; }

.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}

.auth-panel h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -.3px;
}

.auth-panel p {
  font-size: 13px;
  color: rgba(255,255,255,.45);
  text-align: center;
  margin-bottom: 24px;
}

.auth-input-group {
  margin-bottom: 14px;
}
.auth-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap svg {
  position: absolute;
  left: 12px;
  pointer-events: none;
}
.auth-input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color .15s, background .15s;
}
.auth-input-wrap input::placeholder { color: rgba(255,255,255,.25); }
.auth-input-wrap input:focus {
  border-color: #6366f1;
  background: rgba(99,102,241,.1);
}

.auth-error {
  color: #f87171;
  font-size: 12px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 18px;
}

.auth-submit {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: box-shadow .2s, opacity .15s, transform .1s;
  box-shadow: 0 4px 20px rgba(99,102,241,.4);
  margin-bottom: 16px;
  letter-spacing: .2px;
}
.auth-submit:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 28px rgba(99,102,241,.5); }
.auth-submit:active { transform: translateY(0); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.1);
}
.auth-divider span { font-size: 12px; color: rgba(255,255,255,.3); }

.auth-toggle {
  width: 100%;
  height: 42px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }


/* ── Typography override for Inter ───────────────────────── */
body, .shell, .main, .sidebar {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Page subtitle bar (replaces duplicate in-page h2 titles) ── */
.page-subtitle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #64748b;
  padding: 0 0 16px 0;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 20px;
  font-weight: 400;
  line-height: 1.5;
}
.page-subtitle-bar .header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Notification Bell ───────────────────────────────────── */
.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  transition: background .15s, color .15s;
  margin-right: 4px;
}
.notif-bell:hover { background: #f1f5f9; color: #1e293b; }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ── Notification slide-out panel ───────────────────────── */
.notif-panel {
  position: fixed;
  top: 56px; right: 0;
  width: 340px;
  height: calc(100vh - 56px);
  background: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 24px rgba(0,0,0,.08);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  flex-shrink: 0;
}
#notif-list { flex: 1; overflow-y: auto; }
.notif-empty { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .12s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.notif-icon.cr    { background: #ede9fe; color: #7c3aed; }
.notif-icon.pipe  { background: #dcfce7; color: #16a34a; }
.notif-icon.alert { background: #fee2e2; color: #dc2626; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: #0f172a; margin-bottom: 2px; }
.notif-desc  { font-size: 12px; color: #64748b; line-height: 1.4; }
.notif-time  { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ── Page skeleton (for loading state) ──────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row { height: 18px; margin-bottom: 10px; border-radius: 6px; }
.skeleton-row.short { width: 40%; }
.skeleton-row.medium { width: 65%; }

/* ── Page header bar ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.page-header .subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Status badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-draft     { background: #f1f5f9; color: #64748b; }
.badge-open      { background: #dbeafe; color: #1d4ed8; }
.badge-reviewing { background: #fef3c7; color: #b45309; }
.badge-approved  { background: #d1fae5; color: #065f46; }
.badge-rejected  { background: #fee2e2; color: #991b1b; }
.badge-merged    { background: #ede9fe; color: #5b21b6; }
.badge-closed    { background: #f1f5f9; color: #94a3b8; }
.badge-conflict  { background: #ffedd5; color: #c2410c; }

/* ── CR List ─────────────────────────────────────────────── */
.cr-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.cr-toolbar input[type="text"],
.cr-toolbar select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.cr-toolbar input[type="text"] { flex: 1; min-width: 200px; }
.cr-toolbar input[type="text"]:focus,
.cr-toolbar select:focus { border-color: #6366f1; }

.cr-list { display: flex; flex-direction: column; gap: 8px; }

.cr-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.cr-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.07);
  border-color: #c7d2fe;
  transform: translateY(-1px);
}
.cr-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: #ede9fe;
  color: #7c3aed;
}
.cr-card-body { flex: 1; min-width: 0; }
.cr-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-card-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.cr-card-meta .dot { color: #cbd5e1; }
.cr-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.cr-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
}
.cr-stats .add { color: #16a34a; }
.cr-stats .del { color: #dc2626; }
.cr-stats .files { color: #64748b; }

.cr-empty {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}
.cr-empty svg { opacity: .35; margin-bottom: 12px; }
.cr-empty h3 { font-size: 15px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.cr-empty p  { font-size: 13px; }

/* ── CR Detail view ──────────────────────────────────────── */
.cr-detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .cr-detail-layout { grid-template-columns: 1fr; }
}
.cr-detail-main { min-width: 0; }
.cr-detail-sidebar { display: flex; flex-direction: column; gap: 12px; }

.cr-detail-header {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.cr-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.cr-detail-branch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  margin-bottom: 12px;
}
.branch-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.cr-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

/* Files changed tab ────── */
.cr-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
  gap: 0;
}
.cr-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.cr-tab.active { color: #6366f1; border-color: #6366f1; font-weight: 600; }
.cr-tab:hover:not(.active) { color: #334155; }

/* Diff viewer ────────────── */
.diff-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  color: #1e293b;
  margin-top: 12px;
  cursor: pointer;
}
.diff-file-header:hover { background: #f1f5f9; }
.diff-body {
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  margin-bottom: 4px;
}
.diff-line {
  display: flex;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11.5px;
  line-height: 20px;
  white-space: pre;
}
.diff-line-num {
  width: 40px;
  text-align: right;
  padding: 0 8px;
  color: #94a3b8;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
  user-select: none;
}
.diff-line-content { padding: 0 12px; flex: 1; overflow-x: auto; }
.diff-line.add    { background: #f0fdf4; }
.diff-line.add    .diff-line-num  { background: #dcfce7; color: #16a34a; }
.diff-line.add    .diff-line-content { color: #15803d; }
.diff-line.del    { background: #fef2f2; }
.diff-line.del    .diff-line-num  { background: #fee2e2; color: #dc2626; }
.diff-line.del    .diff-line-content { color: #b91c1c; }
.diff-line.hunk   { background: #f0f9ff; }
.diff-line.hunk   .diff-line-content { color: #0369a1; font-style: italic; }

/* Review comments ────────── */
.comment-thread {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.comment-thread-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
  font-family: 'Fira Code', monospace;
}
.comment-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.comment-item:last-child { border-bottom: none; }
.comment-author {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comment-author-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.comment-body {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
}
.comment-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.comment-input-area {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.comment-input-area textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
  color: #1e293b;
}
.comment-input-area textarea:focus { border-color: #6366f1; }
.comment-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* Sidebar info card ─────── */
.info-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}
.info-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #94a3b8;
  margin-bottom: 12px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f8fafc;
  font-size: 12px;
}
.info-row:last-child { border: none; }
.info-row .label { color: #64748b; }
.info-row .value { color: #1e293b; font-weight: 500; }

/* Action buttons in CR sidebar */
.cr-action-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cr-action-btn:hover { opacity: .88; transform: translateY(-1px); }
.cr-action-btn:active { transform: translateY(0); }
.cr-action-btn.approve  { background: #22c55e; color: #fff; }
.cr-action-btn.reject   { background: #ef4444; color: #fff; }
.cr-action-btn.request  { background: #f59e0b; color: #fff; }
.cr-action-btn.merge    { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; }
.cr-action-btn.submit   { background: #3b82f6; color: #fff; }
.cr-action-btn.close    { background: #f1f5f9; color: #475569; }

/* ── File Browser ─────────────────────────────────────────── */
.fb-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  min-height: 600px;
}
@media (max-width: 768px) { .fb-layout { grid-template-columns: 1fr; } }

.fb-tree {
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  background: #f8fafc;
}
.fb-tree-header {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #94a3b8;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fb-tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  color: #334155;
  border-left: 2px solid transparent;
  transition: background .1s, border-color .1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-tree-node:hover { background: #f1f5f9; }
.fb-tree-node.active { background: #ede9fe; border-color: #6366f1; color: #5b21b6; font-weight: 600; }
.fb-tree-node.dir { font-weight: 500; }
.fb-tree-node svg { flex-shrink: 0; }
.fb-tree-indent { padding-left: calc(14px + var(--depth, 0) * 14px); }

.fb-editor {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fb-editor-topbar {
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  flex-wrap: wrap;
}
.fb-breadcrumb {
  font-size: 12px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  color: #64748b;
}
.fb-breadcrumb span { color: #94a3b8; }
.fb-editor-actions { display: flex; gap: 6px; }

.fb-editor-body {
  flex: 1;
  overflow: auto;
  position: relative;
  min-height: 400px;
}
.fb-code {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  background: #0f172a;
  color: #e2e8f0;
  box-sizing: border-box;
}
.fb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  color: #94a3b8;
  text-align: center;
  padding: 40px;
}
.fb-placeholder svg { opacity: .3; margin-bottom: 16px; }
.fb-placeholder h3 { font-size: 15px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.fb-placeholder p  { font-size: 13px; }

/* ── Settings page ───────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 700px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-item {
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: background .1s, color .1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-nav-item:hover { background: #f1f5f9; color: #1e293b; }
.settings-nav-item.active { background: #ede9fe; color: #5b21b6; font-weight: 600; }

.settings-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
}
.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.settings-section-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
}
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus,
.form-field select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.5; }
.form-field .hint { font-size: 11px; color: #94a3b8; margin-top: 5px; }

/* Credential cards ──────── */
.cred-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow .12s;
}
.cred-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.cred-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cred-card-body { flex: 1; min-width: 0; }
.cred-card-label { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.cred-card-meta  { font-size: 11px; color: #94a3b8; }
.cred-card-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: #fff;
  color: #64748b;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: #f1f5f9; color: #1e293b; }
.icon-btn.danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* ── Team Access page ────────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.team-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.team-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.team-info { flex: 1; min-width: 0; }
.team-name { font-size: 14px; font-weight: 600; color: #0f172a; }
.team-role { font-size: 12px; color: #64748b; margin-top: 2px; }
.team-access {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.access-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: #dbeafe;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ── Empty state for pages ───────────────────────────────── */
.page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
  color: #94a3b8;
}
.page-empty svg { opacity: .3; margin-bottom: 16px; }
.page-empty h3 { font-size: 16px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.page-empty p  { font-size: 13px; max-width: 340px; line-height: 1.6; }

/* ── CR Create modal ─────────────────────────────────────── */
.modal-wide { max-width: 600px; width: 100%; }
.modal-section { margin-bottom: 18px; }
.modal-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #374151;
  margin-bottom: 6px;
}
.modal-section input,
.modal-section select,
.modal-section textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.modal-section input:focus,
.modal-section select:focus,
.modal-section textarea:focus { border-color: #6366f1; }
.modal-section textarea { min-height: 100px; resize: vertical; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Node Hover Delete Button */
.fb-node-del-btn {
  background: transparent;
  border: none;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.fb-tree-node:hover .fb-node-del-btn {
  opacity: 1;
}
.fb-node-del-btn:hover {
  background: #fee2e2;
}

/* Inline Blue Ring Spinner */
.inline-blue-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #e0e7ff;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: inlineSpin 0.8s linear infinite;
}
@keyframes inlineSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}


/* =========================================================
   CodeMirror Overrides
   ========================================================= */
.CodeMirror {
  height: 100% !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}
.CodeMirror-gutters {
  border-right: 1px solid #334155 !important;
  background-color: #1e293b !important;
}
.CodeMirror-linenumber {
  color: #64748b !important;
}
