/* ── Brand palette ────────────────────────────────────────────── */
/* Three Remobi brand colours. Yellow indicates structure (filter icons,
   section accents, eyebrows). Purple is the brand/interactive colour (PDF
   pills, hover, focus, links). Teal flags positive state (success
   messages, the body gradient bottom-right, strong metric values). */
:root {
  --brand-yellow:  #ffc310;
  --brand-purple:  #af52ff;
  --brand-teal:    #4bdca3;
  --brand-yellow-soft: rgba(255, 195, 16, 0.18);
  --brand-purple-soft: rgba(175, 82, 255, 0.18);
  --brand-teal-soft:   rgba( 75, 220, 163, 0.18);
}

/* ── Reset & Base ─────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f0f; color: #ccc; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* ── Forms ────────────────────────────────────────────────────── */
input, select, textarea { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px; color: #eee; font-size: 14px; padding: 10px 12px; width: 100%; outline: none; transition: border-color .15s; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: #555; }
textarea { resize: vertical; min-height: 100px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 6px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity .15s; font-family: inherit; }
.btn:hover { opacity: .85; }
.btn-primary { background: #fff; color: #000; }
.btn-ghost { background: transparent; border: 1px solid #2a2a2a; color: #aaa; }
.btn-danger { background: #3a1010; border: 1px solid #5a2020; color: #e05050; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Cards ────────────────────────────────────────────────────── */
.card { background: #141414; border: 1px solid #1e1e1e; border-radius: 10px; padding: 24px; }
.card + .card { margin-top: 16px; }

/* ── Labels & Fields ──────────────────────────────────────────── */
.label { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #555; margin-bottom: 6px; }
.field { margin-bottom: 16px; }

/* ── Messages ─────────────────────────────────────────────────── */
.msg { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.msg-ok  { background: rgba(75, 220, 163, 0.08); border: 1px solid rgba(75, 220, 163, 0.4); color: var(--brand-teal); }
.msg-err { background: #2a0d0d; border: 1px solid #5a2020; color: #e05050; }

/* ── Navigation ───────────────────────────────────────────────── */
nav { background: #0a0a0a; border-bottom: 1px solid #1a1a1a; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; height: 52px; }
nav .logo { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -.02em; }
nav .nav-links { display: flex; align-items: center; gap: 24px; }
nav .nav-links a { font-size: 13px; color: #666; transition: color .15s; }
nav .nav-links a:hover { color: #ccc; }
nav .nav-links a.active { color: #fff; }

/* ── Layout ───────────────────────────────────────────────────── */
.page { max-width: 960px; margin: 0 auto; padding: 48px 24px; }
.page-narrow { max-width: 440px; margin: 0 auto; padding: 80px 24px; }
.page-mid { max-width: 640px; margin: 0 auto; padding: 48px 24px; }

/* ── Typography ───────────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 600; color: #fff; margin-bottom: 6px; }
h2 { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 16px; }
h3 { font-size: 14px; font-weight: 600; color: #eee; margin-bottom: 8px; }
.sub { font-size: 13px; color: #555; margin-bottom: 32px; }

/* ── Tables ───────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #444; text-align: left; padding: 10px 12px; border-bottom: 1px solid #1a1a1a; }
td { padding: 12px; border-bottom: 1px solid #141414; font-size: 13px; color: #aaa; vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.badge-admin  { background: #1a1a2a; color: #7070e0; border: 1px solid #2a2a4a; }
.badge-owner  { background: #2a2a1a; color: #c0a040; border: 1px solid #4a4a2a; }
.badge-member { background: #1a1a1a; color: #555; border: 1px solid #2a2a2a; }

/* ── Avatar ───────────────────────────────────────────────────── */
.avatar { border-radius: 50%; background: #1a1a2a; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #7070e0; flex-shrink: 0; border: 1px solid #2a2a4a; }
.avatar-img { border-radius: 50%; object-fit: cover; }
.profile-avatar { border-radius: 50%; background: #1a1a2a; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #7070e0; flex-shrink: 0; border: 2px solid #2a2a4a; }

/* ── Markdown Content ─────────────────────────────────────────── */
.md-content { font-size: 14px; color: #ccc; line-height: 1.7; }
.md-content p { margin-bottom: 12px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content strong { color: #eee; }
.md-content a { color: var(--brand-purple); }
.md-content a:hover { color: #c789ff; }
.md-content ul, .md-content ol { margin: 8px 0 12px 20px; }
.md-content li { margin-bottom: 4px; }
.md-content code { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 3px; padding: 1px 6px; font-size: 13px; color: #e0a040; }
.md-content pre { background: #0a0a0a; border: 1px solid #1e1e1e; border-radius: 4px; padding: 14px; margin: 12px 0; overflow-x: auto; }
.md-content pre code { background: none; border: none; padding: 0; color: #ccc; }
.md-content blockquote { border-left: 3px solid #2a2a4a; margin: 12px 0; padding: 8px 16px; color: #999; }
.md-content img { max-width: 100%; border-radius: 4px; margin: 8px 0; }
.md-content h1, .md-content h2, .md-content h3 { color: #fff; margin: 16px 0 8px; }
.md-content h1 { font-size: 20px; }
.md-content h2 { font-size: 17px; }
.md-content h3 { font-size: 15px; }
.md-content hr { border: none; border-top: 1px solid #1e1e1e; margin: 16px 0; }
.md-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.md-content th, .md-content td { border: 1px solid #1e1e1e; padding: 8px 12px; text-align: left; }
.md-content th { background: #111; color: #eee; }

/* ── Item Cards (for CRUD lists) ─────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.item-card { display: block; background: #141414; border: 1px solid #1e1e1e; border-radius: 10px; padding: 18px 20px; transition: border-color .15s; text-decoration: none; color: inherit; }
.item-card:hover { border-color: #333; }
.item-card-title { font-size: 15px; font-weight: 600; color: #eee; margin-bottom: 4px; }
.item-card-meta { font-size: 12px; color: #555; margin-bottom: 4px; }
.item-card-preview { font-size: 13px; color: #777; line-height: 1.4; }

/* ── Empty State ──────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 24px; color: #444; font-size: 13px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 48px; color: #1e1e1e; margin-bottom: 16px; }
.empty-state h2 { color: #fff; margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: #555; }

/* ── Landing Page ─────────────────────────────────────────────── */
.landing-hero { text-align: center; padding: 100px 24px 60px; max-width: 640px; margin: 0 auto; }
.landing-title { font-size: 40px; font-weight: 700; color: #fff; margin-bottom: 16px; letter-spacing: -.02em; }
.landing-sub { font-size: 16px; color: #777; line-height: 1.6; margin-bottom: 32px; }
.landing-actions { display: flex; gap: 12px; justify-content: center; }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 60px; }
.feature-card { background: #141414; border: 1px solid #1e1e1e; border-radius: 10px; padding: 24px; text-align: center; }
.feature-icon { font-size: 24px; margin-bottom: 12px; }
.feature-card h3 { color: #fff; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: #777; line-height: 1.5; }

/* ── Lobby (branded landing) ──────────────────────────────────── */
.lobby-body { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              background: radial-gradient(ellipse at top, #1a1530 0%, #0f0f0f 55%); }
.lobby { width: 100%; max-width: 520px; padding: 32px 24px; }
.lobby-card { text-align: center; background: rgba(20, 20, 28, 0.72); border: 1px solid #20202c;
              border-radius: 16px; padding: 56px 40px; backdrop-filter: blur(8px);
              box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45); }
.lobby-logo { max-width: 220px; height: auto; margin: 0 auto 28px; display: block; }
.lobby-wordmark { font-size: 56px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 28px;
                  background: linear-gradient(90deg, #c9bff0 0%, #8f7fd6 100%);
                  -webkit-background-clip: text; background-clip: text; color: transparent; }
.lobby-title { font-size: 28px; font-weight: 600; color: #fff; margin-bottom: 8px; letter-spacing: -.01em; }
.lobby-sub { font-size: 14px; color: #888; line-height: 1.6; margin-bottom: 36px; }
.lobby-actions { display: flex; justify-content: center; }
.lobby-btn { padding: 12px 40px; font-size: 15px; }
@media (max-width: 480px) {
  .lobby-card { padding: 40px 24px; }
  .lobby-logo { max-width: 160px; }
  .lobby-wordmark { font-size: 44px; }
}

/* ── Admin Bar ────────────────────────────────────────────────── */
.admin-bar { background: linear-gradient(90deg, #1a1000 0%, #201800 100%); border-bottom: 1px solid #3a3000; padding: 0 24px; height: 36px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.ab-left { display: flex; align-items: center; gap: 16px; }
.ab-pulse { width: 6px; height: 6px; background: #c0a040; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.ab-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: #c0a040; }
.ab-link { color: #888; transition: color .15s; display: flex; align-items: center; gap: 4px; }
.ab-link:hover { color: #c0a040; }
.ab-icon { font-size: 13px; }
.ab-text { }

/* ── Impersonate Banner ──────────────────────────────────────── */
.impersonate-banner { background: #2a0d0d; border-bottom: 1px solid #5a2020; padding: 8px 24px; font-size: 13px; color: #e05050; text-align: center; }

/* ── Verify Banner ───────────────────────────────────────────── */
.verify-banner { background: #1a1400; border: 1px solid #3a3000; border-radius: 6px; padding: 12px 16px; font-size: 13px; color: #c0a040; }

/* ── Admin Dashboard ─────────────────────────────────────────── */
.adm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.adm-title { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -.02em; margin-bottom: 2px; }
.adm-subtitle { font-size: 13px; color: #555; }
.adm-pulse { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #5adb8a; font-weight: 500; }
.adm-pulse-dot { width: 8px; height: 8px; background: #5adb8a; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }

.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.adm-stat { background: #111; border: 1px solid #1e1e1e; border-radius: 4px; padding: 16px; display: flex; align-items: center; gap: 12px; position: relative; overflow: hidden; }
.adm-stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.adm-stat-blue { background: #0a1a2a; color: #4090e0; border: 1px solid #1a2a4a; }
.adm-stat-value { font-size: 24px; font-weight: 700; color: #fff; }
.adm-stat-label { font-size: 11px; color: #555; text-transform: uppercase; letter-spacing: .5px; }
.adm-stat-delta { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 500; }
.adm-delta-up { color: #5adb8a; }

.adm-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.adm-tab { display: flex; align-items: center; gap: 6px; padding: 10px 18px; font-size: 13px; color: #555; background: #111; border: 1px solid #1e1e1e; border-radius: 4px 4px 0 0; transition: all .12s; }
.adm-tab:hover { color: #ccc; border-color: #2a2a2a; }
.adm-tab.active { color: #fff; background: #141414; border-color: #2a2a2a; border-bottom-color: #141414; }
.adm-tab-icon { font-size: 14px; }

.adm-panel { background: #141414; border: 1px solid #2a2a2a; border-radius: 0 4px 4px 4px; overflow: hidden; }
.adm-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #1e1e1e; }
.adm-panel-header h2 { margin: 0; font-size: 15px; }
.adm-count { font-size: 12px; color: #555; background: #1a1a1a; padding: 2px 10px; border-radius: 10px; }
.adm-empty { padding: 48px 20px; text-align: center; color: #444; font-size: 13px; }

.adm-activity-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #1a1a1a; transition: background .1s; }
.adm-activity-row:last-child { border-bottom: none; }
.adm-activity-row:hover { background: #181818; }
.adm-activity-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.adm-ai-signup { background: #0d2a1a; color: #5adb8a; border: 1px solid #1a5a30; }
.adm-activity-body { flex: 1; font-size: 13px; color: #ccc; min-width: 0; }
.adm-activity-body strong { color: #fff; }
.adm-activity-time { font-size: 11px; color: #444; flex-shrink: 0; white-space: nowrap; }

.adm-user-list { }
.adm-user-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #1a1a1a; transition: background .1s; }
.adm-user-row:last-child { border-bottom: none; }
.adm-user-row:hover { background: #181818; }
.adm-user-avatar { width: 32px; height: 32px; border-radius: 6px; background: #1a1a2a; border: 1px solid #2a2a4a; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #7070e0; flex-shrink: 0; }
.adm-user-info { flex: 1; min-width: 0; }
.adm-user-name { font-size: 13px; font-weight: 600; color: #eee; }
.adm-user-email { font-size: 11px; color: #555; }
.adm-user-meta { flex-shrink: 0; }
.adm-user-date { font-size: 11px; color: #444; flex-shrink: 0; }
.adm-user-actions { display: flex; gap: 4px; flex-shrink: 0; }

.adm-action-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 4px; color: #666; font-size: 13px; cursor: pointer; transition: all .12s; font-family: inherit; text-decoration: none; }
.adm-action-btn:hover { background: #222; border-color: #333; color: #ccc; }
.adm-action-view:hover { background: #1a1a2a; border-color: #2a2a4a; color: #7070e0; }
.adm-action-danger:hover { background: #2a0d0d; border-color: #5a2020; color: #e05050; }

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card { background: #141414; border: 1px solid #1e1e1e; border-radius: 10px; padding: 20px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #555; }

/* ── Footer ──────────────────────────────────────────────────── */
.platform-footer { text-align: center; padding: 32px 24px; font-size: 12px; color: #333; border-top: 1px solid #1a1a1a; }
.platform-footer a { color: #444; }
.platform-footer a:hover { color: #888; }
.footer-sep { margin: 0 8px; }

/* ── Cookie Banner ───────────────────────────────────────────── */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #1a1a1a; border-top: 1px solid #2a2a2a; padding: 14px 24px; display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 13px; color: #888; z-index: 1000; }

/* ── Toast Notifications ─────────────────────────────────────── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 12px; transform: translateX(120%); transition: transform .3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.toast-show { transform: translateX(0); }
.toast-success { background: #0d2a1a; border: 1px solid #1a5a30; color: #5adb8a; }
.toast-error { background: #2a0d0d; border: 1px solid #5a2020; color: #e05050; }
.toast-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; padding: 0; opacity: 0.5; }
.toast-close:hover { opacity: 1; }

/* ── Back to Top ─────────────────────────────────────────────── */
.back-to-top { position: fixed; bottom: 24px; right: 24px; width: 36px; height: 36px; border-radius: 50%; background: #1a1a1a; border: 1px solid #2a2a2a; color: #666; font-size: 14px; cursor: pointer; opacity: 0; transition: opacity .2s; z-index: 100; display: flex; align-items: center; justify-content: center; }
.btt-show { opacity: 1; }
.back-to-top:hover { background: #222; color: #fff; }

/* ── Utilities ────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-right { text-align: right; }

/* ── Case studies ─────────────────────────────────────────────── */
/* Subtle radial gradient on the page background so frosted glass has something
   to bite into. Uses the three Remobi brand colours at very low opacity. */
body {
  background:
    radial-gradient(circle at 15% 12%, rgba(175, 82, 255, 0.10), transparent 45%),  /* purple top-left */
    radial-gradient(circle at 88% 78%, rgba(75, 220, 163, 0.08), transparent 50%),  /* teal bottom-right */
    radial-gradient(circle at 78% 8%,  rgba(255, 195, 16, 0.06), transparent 40%),  /* yellow top-right */
    #0f0f0f;
  background-attachment: fixed;
}

/* Generic frosted-glass surface — drop the .glass class on any container. */
.glass {
  background: rgba(22, 22, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 4px 24px rgba(0,0,0,0.35);
}

/* ── AI search loading overlay ────────────────────────────────── */
.ai-search-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  animation: ai-loader-fade-in 0.18s ease-out;
}
body.is-ai-searching .ai-search-loader { display: flex; }
body.is-ai-searching { overflow: hidden; }

.ai-search-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(175, 82, 255, 0.18);
  border-top-color: var(--brand-purple);
  border-radius: 50%;
  animation: ai-loader-spin 0.9s linear infinite;
  box-shadow: 0 0 32px rgba(175, 82, 255, 0.25);
}
.ai-search-loader-text {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.ai-search-loader-sub {
  font-size: 12px;
  color: #888;
  letter-spacing: 0.2px;
}
@keyframes ai-loader-spin { to { transform: rotate(360deg); } }
@keyframes ai-loader-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── AI search (primary input above the filter bar) ─────────── */
.cs-ai-search {
  border-radius: 12px;
  padding: 18px 18px 16px;
  background:
    linear-gradient(180deg, rgba(175, 82, 255, 0.05), rgba(175, 82, 255, 0.01)),
    rgba(22, 22, 24, 0.55);
  border: 1px solid rgba(175, 82, 255, 0.18);
}
.cs-ai-search-label {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.cs-ai-search-input {
  width: 100%;
  min-height: 56px;
  font-size: 14px;
  line-height: 1.45;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
}
.cs-ai-search-input:focus { border-color: var(--brand-purple); outline: none; }
.cs-ai-search-input:disabled { opacity: 0.55; cursor: not-allowed; }

/* Inferred-filters banner that appears after an AI search */
.cs-ai-banner {
  background: rgba(175, 82, 255, 0.06);
  border: 1px solid rgba(175, 82, 255, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
}
.cs-ai-banner-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.cs-ai-banner-q { font-size: 13px; color: #ccc; }
.cs-ai-banner-q em { color: #fff; font-style: normal; }
.cs-ai-banner-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-tag--kw {
  color: #d2afff;
  background: rgba(175, 82, 255, 0.12);
  border-color: rgba(175, 82, 255, 0.25);
}
.badge-tag--kw::before { content: '~ '; opacity: 0.6; }

/* ── Filter bar ──────────────────────────────────────────────── */
.cs-filters { border-radius: 12px; padding: 16px; }
.cs-filter-search { margin-bottom: 12px; background: rgba(0,0,0,0.25); }

.cs-filter-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.cs-filter-cell { position: relative; min-width: 0; }
.cs-filter-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #ffc310;
  pointer-events: none;
  z-index: 1;
}
.cs-filter-select {
  width: 100%;
  font-size: 12.5px;
  padding: 8px 8px 8px 30px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #ddd;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 5 5 9 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 24px;
  text-overflow: ellipsis;
}
.cs-filter-select:focus { border-color: rgba(255, 195, 16, 0.45); outline: none; }

.cs-filter-actions { margin-top: 14px; align-items: center; }
.cs-filter-count { margin-left: auto; font-size: 12px; color: #777; }

/* ── New/edit form ───────────────────────────────────────────── */
.cs-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cs-form-grid .field { margin-bottom: 0; }

.cs-tags-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid #1e1e1e; }

/* Multi-select tag dropdowns (one per category) */
.cs-tag-pickers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.cs-tag-picker { position: relative; }
.cs-tag-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #ddd;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s;
}
.cs-tag-picker-trigger:hover { border-color: rgba(255, 255, 255, 0.18); }
.cs-tag-picker-trigger[aria-expanded="true"] { border-color: var(--brand-purple); }
.cs-tag-picker-icon { width: 14px; height: 14px; color: var(--brand-yellow); flex-shrink: 0; }
.cs-tag-picker-label {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888;
  flex-shrink: 0;
}
.cs-tag-picker-selected {
  flex: 1;
  min-width: 0;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.cs-tag-picker-selected:empty::before {
  content: attr(data-empty-text);
  color: #666;
  font-weight: 400;
}
.cs-tag-picker-caret { color: #777; font-size: 9px; flex-shrink: 0; }

.cs-tag-picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(20, 20, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px;
  max-height: 260px;
  overflow-y: auto;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* The hidden attribute is overridden by display:flex above — re-assert it.
   Specificity 0,2,0 beats 0,1,0 so this wins when [hidden] is present. */
.cs-tag-picker-panel[hidden] { display: none; }
.cs-tag-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: #bbb;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cs-tag-picker-option:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.cs-tag-picker-option input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--brand-purple);
  flex-shrink: 0;
}
.cs-tag-picker-option input:checked + span { color: #fff; font-weight: 500; }

.cs-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  background: rgba(255, 255, 255, 0.04);
  color: #bbb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: none;
  letter-spacing: 0.2px;
  font-size: 11px;
  font-weight: 500;
}
.badge-tag-icon { width: 11px; height: 11px; color: #ffc310; flex-shrink: 0; }

/* ── Card grid (2-up) with cover preview ─────────────────────── */
.cs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.cs-card {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, border-color .15s, box-shadow .15s;
  min-height: 280px;
}
.cs-grid { grid-auto-rows: 1fr; }  /* unify card heights across rows */

/* Match-score chip — top-right of each card, only shown when AI keywords matched */
.cs-card-score {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}
.cs-card-score--high {
  background: rgba(75, 220, 163, 0.18);
  color: var(--brand-teal);
  border: 1px solid rgba(75, 220, 163, 0.4);
}
.cs-card-score--mid {
  background: rgba(255, 195, 16, 0.16);
  color: var(--brand-yellow);
  border: 1px solid rgba(255, 195, 16, 0.4);
}
.cs-card-score--low {
  background: rgba(255, 255, 255, 0.06);
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.cs-card:hover {
  transform: translateY(-2px);
  border-color: rgba(175, 82, 255, 0.35);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(175, 82, 255, 0.18);
}

.cs-card-cover {
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.cs-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-card-cover::after {
  /* Soft fade on the right edge of the cover so it blends into the dark card */
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 28px;
  background: linear-gradient(to right, transparent, rgba(15, 15, 15, 0.55));
  pointer-events: none;
}
/* Brand-origin pill in group view (top-right of cover) */
.cs-card-brand-pill {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 1;
  padding: 4px 8px;
  background: rgba(8, 8, 10, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #ddd;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: 78px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cs-card-brand-pill img {
  max-width: 100%;
  max-height: 14px;
  object-fit: contain;
  display: block;
}

.cs-card-cover-pdf {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(175, 82, 255, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}
.cs-card-cover-tmpl { background: rgba(75, 220, 163, 0.62); }
.cs-card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(175, 82, 255, 0.22), rgba(75, 220, 163, 0.18) 60%, rgba(255, 195, 16, 0.18));
  color: rgba(255, 255, 255, 0.85);
  font-size: 48px; font-weight: 700; letter-spacing: -0.02em;
}

.cs-card-body {
  padding: 18px 18px 16px;
  display: flex; flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cs-card-client {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #ffc310;
  margin-bottom: 2px;
}
.cs-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #f0f0f0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-card-role {
  font-size: 12.5px;
  color: #888;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-card-facts {
  display: flex; gap: 5px; flex-wrap: wrap;
  margin-top: 4px;
}
.cs-card-facts span {
  font-size: 10.5px;
  color: #999;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
}
.cs-card-facts strong { color: #fff; font-weight: 600; }
.cs-card-preview {
  font-size: 12.5px;
  color: #888;
  line-height: 1.45;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-card .cs-tag-row {
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: nowrap;
  overflow: hidden;
  /* fade out anything that overflows the row instead of hard-clipping */
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
}
.cs-card .cs-tag-row .badge { flex-shrink: 0; }
.badge-tag--more {
  background: transparent;
  border-style: dashed;
  color: #888;
}

/* ── View page (2-col with PDF sidebar) ──────────────────────── */
.cs-view-page { max-width: 1120px; }
.cs-view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}
.cs-view-grid--solo { grid-template-columns: minmax(0, 1fr); }
.cs-view-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cs-view-side { position: sticky; top: 24px; }

/* ── Hero ─────────────────────────────────────────────────────── */
.cs-hero { padding: 4px 0 20px; }
.cs-hero-client {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #ffc310;
  margin-bottom: 10px;
}
.cs-hero-title {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.cs-hero-role {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 16px;
}
.cs-hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.cs-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  font-size: 12.5px;
  color: #aaa;
}
.cs-fact strong { color: #fff; font-weight: 600; }
.cs-fact-label { color: #888; }
.cs-hero-tags { margin-top: 4px; }

/* ── Section cards ────────────────────────────────────────────── */
.cs-section { padding: 22px 24px; border-radius: 14px; }
.cs-section + .cs-section { margin-top: 0; }
.cs-section h2 {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #ddd;
  margin-bottom: 12px;
}
.cs-section h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 3px;
  background: #ffc310;
  border-radius: 2px;
}
.cs-section .md-content { font-size: 14px; line-height: 1.65; color: #c8c8c8; }

/* Italic first paragraph (the PDF-style subtitle line) renders as a hero blurb. */
.cs-section .md-content > p:first-child:has(em:only-child) {
  font-size: 15.5px;
  line-height: 1.45;
  color: #d2afff;
  margin-bottom: 16px;
}
.cs-section .md-content > p:first-child:has(em:only-child) em { font-style: normal; }

.cs-section--quote .md-content blockquote {
  font-size: 15px;
  color: #ddd;
  font-style: italic;
  border-left: 3px solid rgba(255, 195, 16, 0.5);
  padding: 4px 16px;
}

.cs-pdf-card {
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-pdf-card-head { display: flex; align-items: center; gap: 8px; }
.cs-pdf-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  background: var(--brand-purple-soft);
  color: #d2afff;
  border: 1px solid rgba(175, 82, 255, 0.35);
  padding: 2px 8px; border-radius: 4px;
}
.cs-pdf-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: #888;
}

.cs-pdf-preview {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1 / 1.414; /* A4 portrait */
}
.cs-pdf-preview object { width: 100%; height: 100%; display: block; }
.cs-pdf-preview--icon { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; }
.cs-pdf-fallback {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center;
  color: #888; text-align: center; padding: 16px;
}
.cs-pdf-fallback-icon {
  font-size: 28px; font-weight: 700; letter-spacing: 1px;
  padding: 14px 22px; border-radius: 8px;
  background: rgba(175, 82, 255, 0.12);
  border: 1px solid rgba(175, 82, 255, 0.3);
  color: #d2afff;
}
.cs-pdf-fallback-text { font-size: 12px; }

.cs-pdf-meta { display: flex; flex-direction: column; gap: 10px; }
.cs-pdf-filename {
  font-size: 13px;
  font-weight: 600;
  color: #ddd;
  word-break: break-all;
  line-height: 1.35;
}
.cs-pdf-details {
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}
.cs-pdf-detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
}
.cs-pdf-detail + .cs-pdf-detail {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.cs-pdf-detail-k {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #777;
}
.cs-pdf-detail-v {
  font-size: 12.5px;
  color: #ddd;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cs-pdf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.cs-pdf-actions .btn { flex: 1; justify-content: center; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  nav { padding: 0 16px; }
  .page, .page-narrow, .page-mid { padding-left: 16px; padding-right: 16px; }
  .landing-features { grid-template-columns: 1fr; }
  .landing-title { font-size: 28px; }
  .landing-hero { padding: 60px 16px 40px; }
  .adm-stats { grid-template-columns: 1fr; }
  .adm-tabs { flex-wrap: wrap; }
  .adm-user-row { flex-wrap: wrap; gap: 8px; }
  .adm-user-date { display: none; }
  .admin-bar .ab-text { display: none; }
  .cs-form-grid { grid-template-columns: 1fr; }
  .cs-grid { grid-template-columns: 1fr; }
  .cs-card { grid-template-columns: 96px 1fr; min-height: 132px; }
  .cs-card-cover-placeholder { min-height: 132px; font-size: 32px; }
  .cs-view-grid { grid-template-columns: 1fr; }
  .cs-view-side { position: static; }
  .cs-pdf-preview { aspect-ratio: 4 / 3; }
  .cs-filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .cs-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .cs-template-grid { grid-template-columns: 1fr; }
  .cs-content-templates { grid-template-columns: 1fr; }
  .cs-template-hero { padding: 18px 18px 16px; }
  .cs-tab-pill { padding: 8px 14px; font-size: 12.5px; }
}

/* ── Section tabs (pill-in-pill, left-aligned, frosted) ──────── */
.cs-tabs-wrap {
  display: flex;
  justify-content: flex-start;
  overflow-x: auto;            /* scroll instead of clip on narrow screens */
  scrollbar-width: none;
}
.cs-tabs-wrap::-webkit-scrollbar { display: none; }
.cs-tabs-pill {
  display: inline-flex;
  padding: 5px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.cs-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  border-radius: 999px;
  transition: color .15s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.cs-tab-pill:hover { color: #ddd; }
.cs-tab-pill--active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.cs-tab-pill-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── JSON drop zone (new case study form) ────────────────────── */
.cs-json-drop {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: rgba(175, 82, 255, 0.04);
  border: 1px dashed rgba(175, 82, 255, 0.28);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  outline: none;
}
.cs-json-drop:hover,
.cs-json-drop:focus-visible,
.cs-json-drop.is-drag-over {
  background: rgba(175, 82, 255, 0.10);
  border-color: var(--brand-purple);
  border-style: solid;
}
.cs-json-drop-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-purple);
  background: rgba(175, 82, 255, 0.10);
  border-radius: 8px;
}
.cs-json-drop-icon svg { width: 18px; height: 18px; }
.cs-json-drop-title { font-size: 14px; font-weight: 600; color: #eee; margin-bottom: 3px; }
.cs-json-drop-sub {
  font-size: 11.5px;
  color: #888;
  line-height: 1.45;
}
.cs-json-drop-sub code {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  color: #bbb;
}
.cs-json-drop-status {
  font-size: 12px;
  color: #888;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}
.cs-json-drop-status--ok  { color: var(--brand-teal); }
.cs-json-drop-status--err { color: #e05050; }

/* ── Template page (hero + sections) ─────────────────────────── */
.cs-template-hero {
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 28px;
  background:
    linear-gradient(180deg, rgba(175, 82, 255, 0.07), rgba(175, 82, 255, 0.02)),
    rgba(22, 22, 24, 0.55);
  border: 1px solid rgba(175, 82, 255, 0.20);
}
.cs-template-hero-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.cs-template-hero-textarea {
  min-height: 180px;
}

.cs-section-head {
  margin-top: 20px;
  margin-bottom: 14px;
}
.cs-section-head h2 { margin-bottom: 4px; }
.cs-section-head .sub { margin-bottom: 0; font-size: 13px; }

.mb-32 { margin-bottom: 32px; }

/* Content templates row: 1fr 1fr 2fr — prompt card gets more room */
.cs-content-templates {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 14px;
  align-items: stretch;
}
.cs-content-card {
  padding: 18px 20px;
  border-radius: 12px;
  display: flex; flex-direction: column;
}
.cs-content-card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.cs-content-card-blurb {
  font-size: 12.5px;
  color: #888;
  line-height: 1.5;
  margin-bottom: 14px;
  flex-grow: 0;
}
.cs-content-card .btn { align-self: flex-start; margin-top: auto; }
.cs-content-card--wide { /* prompt card */ }
.cs-content-card--wide .btn { align-self: flex-start; margin-top: 0; }

/* Keep the old 2-col grid class around for any other usage */
.cs-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.cs-template-card { padding: 22px 24px; border-radius: 14px; display: flex; flex-direction: column; }
.cs-template-card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.cs-template-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  padding: 3px 8px; border-radius: 4px;
}
.cs-template-badge--yellow {
  background: var(--brand-yellow-soft);
  color: var(--brand-yellow);
  border: 1px solid rgba(255, 195, 16, 0.35);
}
.cs-template-badge--purple {
  background: var(--brand-purple-soft);
  color: #d2afff;
  border: 1px solid rgba(175, 82, 255, 0.35);
}
.cs-template-blurb {
  font-size: 13px;
  color: #aaa;
  line-height: 1.55;
  margin-bottom: 16px;
}
/* ── Canva template row-widgets ──────────────────────────────── */
.cs-canva-rows { display: flex; flex-direction: column; gap: 10px; }
.cs-canva-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  transition: border-color .15s;
}
.cs-canva-row:hover { border-color: rgba(175, 82, 255, 0.25); }
.cs-canva-row--empty { opacity: 0.7; }
.cs-canva-thumb {
  width: 88px; height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.cs-canva-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cs-canva-thumb-placeholder {
  font-size: 28px; font-weight: 700;
  color: #555;
  letter-spacing: -0.02em;
}
.cs-canva-meta { min-width: 0; }
.cs-canva-name {
  font-size: 14px; font-weight: 600; color: #eee;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cs-canva-empty-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: #777;
  padding: 2px 7px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.cs-canva-sub { font-size: 12px; color: #888; margin-top: 2px; }
.cs-canva-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cs-canva-actions .btn:disabled,
.cs-canva-actions button:disabled {
  opacity: 0.4; cursor: not-allowed;
}

@media (max-width: 768px) {
  .cs-canva-row {
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
  }
  .cs-canva-thumb { width: 60px; height: 42px; }
  .cs-canva-actions { grid-column: 1 / -1; flex-wrap: wrap; }
}

.cs-ai-textarea {
  width: 100%;
  min-height: 220px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
}
.cs-ai-textarea:focus { border-color: var(--brand-purple); outline: none; }

/* ── App shell: sidebar + main ───────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.app-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: rgba(8, 8, 10, 0.72);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 0 12px;
}
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* No-sidebar layout for auth/legal pages — let .app-main fill freely */
body.no-sidebar .app-main { width: 100%; }

/* ── Sidebar: brand ────────────────────────────────────────── */
.app-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.app-brand-logo { max-height: 28px; max-width: 130px; display: block; }
.app-brand-glyph { font-size: 18px; color: var(--brand-yellow); line-height: 1; }
.app-brand-text {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ── Sidebar: nav ──────────────────────────────────────────── */
.app-nav { flex: 1; padding: 6px 0; }
.app-nav-section { margin-bottom: 18px; }
.app-nav-section:last-child { margin-bottom: 0; }
.app-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #666;
  padding: 0 18px;
  margin-bottom: 6px;
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  font-size: 13px;
  color: #aaa;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.app-nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.03); }
.app-nav-link.is-active {
  color: #fff;
  background: rgba(175, 82, 255, 0.08);
  border-left-color: var(--brand-purple);
}
.app-nav-icon { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Sidebar: footer (user + logout) ──────────────────────── */
.app-sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}
.app-user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple), rgba(175, 82, 255, 0.5));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-user-name {
  font-size: 13px;
  color: #ddd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-nav-link--ghost { color: #777; }

/* ── Main content area ─────────────────────────────────────── */
.app-flash-stack {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 0 24px;
}
.app-flash-stack .msg { margin-bottom: 0; }
.app-flash-stack .msg + .msg { margin-top: 8px; }

/* The existing .page wrapper still drives content width inside .app-main */
.app-main .page { max-width: 1120px; margin: 0 auto; padding: 36px 28px 48px; }

/* Move the footer to sit at the bottom of .app-main */
.app-main .platform-footer { margin-top: auto; }

/* ── Responsive: collapse to an icon-only rail on narrow screens ── */
@media (max-width: 900px) {
  .app-sidebar {
    width: 64px;
    padding: 14px 0 10px;
  }
  .app-brand-text,
  .app-nav-label,
  .app-nav-link span:not(.app-nav-icon),
  .app-user-name {
    display: none;
  }
  .app-nav-link {
    justify-content: center;
    padding: 11px 0;
    gap: 0;
    border-left-width: 3px;
  }
  .app-brand {
    justify-content: center;
    padding: 0 6px 14px;
    margin-bottom: 4px;
  }
  .app-brand-logo { max-height: 24px; max-width: 48px; }
  .app-nav-section { margin-bottom: 10px; }
  .app-main .page { padding-left: 18px; padding-right: 18px; }
}

/* ── Workspace switcher (in top nav) ──────────────────────────── */
nav .nav-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ws-switcher { position: relative; }
.ws-switcher-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: #ddd;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.ws-switcher-trigger:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255,255,255,0.14); }
.ws-switcher-trigger[aria-expanded="true"] { border-color: var(--brand-purple); }
.ws-switcher-current { font-weight: 600; color: #fff; letter-spacing: -0.005em; }
.ws-switcher-trigger svg { color: #888; flex-shrink: 0; }

.ws-switcher-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  background: rgba(20, 20, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; gap: 1px;
}
.ws-switcher-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #666;
  padding: 6px 10px 4px;
}
.ws-switcher-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #ccc;
  transition: background .12s, color .12s;
}
.ws-switcher-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.ws-switcher-item.is-current { background: rgba(175, 82, 255, 0.10); color: #fff; }
.ws-switcher-logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ws-switcher-logo img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 3px; }
.ws-switcher-initial {
  font-size: 12px; font-weight: 700; color: var(--brand-purple);
  letter-spacing: -0.02em;
}
.ws-switcher-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switcher-check { width: 14px; height: 14px; color: var(--brand-purple); flex-shrink: 0; }
.ws-switcher-panel[hidden] { display: none; }

/* ── Global search (top nav input + results page) ─────────── */
.global-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 320px;
  margin-left: 4px;
}
.global-search-icon {
  position: absolute;
  left: 10px;
  width: 13px; height: 13px;
  color: #777;
  pointer-events: none;
}
.global-search input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: #ddd;
  font-family: inherit;
}
.global-search input::placeholder { color: #666; }
.global-search input:focus {
  border-color: var(--brand-purple);
  outline: none;
  background: rgba(255, 255, 255, 0.05);
}

.search-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
}

.search-section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.search-type-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid;
}
.search-type-pill--case {
  color: var(--brand-purple);
  border-color: rgba(175, 82, 255, 0.45);
  background: rgba(175, 82, 255, 0.12);
}
.search-type-pill--rig {
  color: var(--brand-teal);
  border-color: rgba(75, 220, 163, 0.45);
  background: rgba(75, 220, 163, 0.12);
}
.search-section-count {
  font-size: 12px;
  color: #666;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-result {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  transition: border-color .15s, transform .12s;
}
.search-result:hover {
  border-color: rgba(175, 82, 255, 0.25);
  transform: translateY(-1px);
}
.search-result-cover {
  width: 60px; height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.search-result-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.search-result-cover-placeholder {
  font-size: 22px;
  font-weight: 700;
  color: #555;
}
.search-result-body { min-width: 0; }
.search-result-client {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--brand-yellow);
  margin-bottom: 2px;
}
.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: #f0f0f0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.search-result-meta {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.search-result-brand {
  padding: 4px 8px;
  background: rgba(8, 8, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #aaa;
  flex-shrink: 0;
  max-width: 70px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-result-brand img {
  max-width: 100%;
  max-height: 14px;
  object-fit: contain;
}

/* On narrower screens, hide the search box to give the nav room */
@media (max-width: 768px) {
  .global-search { display: none; }
}

/* ── Rigs (specialism cards + detail subtabs) ───────────────── */
.rigs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.rigs-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.rigs-card:hover {
  border-color: rgba(175, 82, 255, 0.30);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.rigs-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 12px currentColor;
}
.rigs-card-body { flex: 1; min-width: 0; }
.rigs-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #f0f0f0;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.rigs-card-desc {
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}
.rigs-card-arrow {
  color: #555;
  font-size: 16px;
  flex-shrink: 0;
}
.rigs-card:hover .rigs-card-arrow { color: var(--brand-purple); }

/* Admin affordances on the rigs list */
.rigs-card-wrap { position: relative; }
.rigs-card-edit {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #999;
  font-size: 12px;
  text-decoration: none;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.rigs-card-wrap:hover .rigs-card-edit { opacity: 1; }
.rigs-card-edit:hover {
  color: var(--brand-purple);
  background: rgba(175, 82, 255, 0.15);
}

/* "Add new specialism" tile */
.rigs-card-add {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-style: dashed !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: #888;
  min-height: 84px;
}
.rigs-card-add:hover {
  border-color: rgba(175, 82, 255, 0.40) !important;
  color: var(--brand-purple);
}
.rigs-card-add-plus { font-size: 22px; line-height: 1; font-weight: 300; }
.rigs-card-add-label { font-size: 12px; font-weight: 500; }

/* Specialism form */
.rigs-form .form-row { margin-bottom: 18px; }
.rigs-form .form-row-split {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 16px;
}
.rigs-form .form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #999;
  margin-bottom: 6px;
}
.rigs-form .form-label .req { color: var(--brand-purple); }
.rigs-form input[type="text"],
.rigs-form input[type="number"],
.rigs-form textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  color: #eee;
  font-size: 13px;
  font-family: inherit;
}
.rigs-form input:focus,
.rigs-form textarea:focus {
  outline: none;
  border-color: rgba(175, 82, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
}
.rigs-form textarea { resize: vertical; min-height: 64px; }
.rigs-form .form-hint {
  font-size: 11px;
  color: #666;
  margin-top: 6px;
  line-height: 1.5;
}
.rigs-form .form-hint code {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
  color: #aaa;
}
.rigs-form .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.rigs-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rigs-color-picker {
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

/* Danger zone (edit page) */
.danger-zone {
  margin-top: 24px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: rgba(220, 70, 70, 0.20) !important;
}
.danger-zone strong { color: #e55; font-size: 13px; }
.btn-danger {
  background: rgba(220, 70, 70, 0.12);
  border: 1px solid rgba(220, 70, 70, 0.35);
  color: #ff7a7a;
}
.btn-danger:hover {
  background: rgba(220, 70, 70, 0.20);
  border-color: rgba(220, 70, 70, 0.55);
}

.rigs-detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Branding / logo placement ────────────────────────────────── */
nav .logo { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
nav .logo .logo-img { height: 30px; width: auto; display: block; flex-shrink: 0; }
nav .logo .logo-glyph { font-size: 15px; line-height: 1; }
nav .logo .logo-text { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: -0.01em; white-space: nowrap; }

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { max-height: 72px; width: auto; max-width: 220px; margin: 0 auto 14px; display: block; }
.auth-logo-glyph { font-size: 28px; margin-bottom: 8px; }

/* Logo removed from page headers — it already lives in the top nav; the
   duplicate 64px mark made every list/index header tall and clunky. */
.cs-page-header { align-items: flex-start; margin-bottom: 14px; }
.cs-page-header h1 { font-size: 26px; letter-spacing: -0.01em; }

/* ── Outcome section: teal accent (signals "the win") ─────────── */
.cs-section--outcome h2::before { background: var(--brand-teal); }
.cs-section--outcome .md-content > ul > li > strong:first-child {
  color: var(--brand-teal);
}

/* ── Testimonial: purple-tinted blockquote rail ───────────────── */
.cs-section--quote .md-content blockquote { border-left-color: var(--brand-purple); }

/* ── Rigs detail page (QXi-style layout) ────────────────────────── */

.rigs-detail-page { max-width: 1280px; }

.rigs-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}
.rigs-detail-topbar-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500; color: #ddd;
}
.rigs-detail-topbar-logo {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #666;
  font-family: 'DM Mono', ui-monospace, monospace;
}

.rigs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: flex-start;
}
@media (max-width: 800px) {
  .rigs-layout { grid-template-columns: 1fr; }
  .rigs-sidebar { position: static !important; }
}

.rigs-sidebar {
  position: sticky;
  top: 16px;
  padding: 16px 0;
}
.rigs-sidebar-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #666;
  font-weight: 600;
  padding: 0 14px 12px;
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.rigs-sidebar-item:hover {
  color: #ddd;
  background: rgba(255, 255, 255, 0.02);
}
.rigs-sidebar-item--active {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--accent, #888);
}
.rigs-sidebar-glyph {
  font-size: 12px;
  color: var(--accent, #555);
  width: 14px;
  display: inline-block;
  text-align: center;
}
.rigs-sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 12px 14px;
}

.rigs-content { min-width: 0; }
.rigs-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.rigs-content-h1 {
  font-size: 28px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.rigs-content-sub {
  font-size: 14px;
  color: #888;
  line-height: 1.6;
  max-width: 720px;
  margin: 0 0 24px;
}
.rigs-empty {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

/* Role explorer */
.rigs-role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.rigs-role-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s;
  display: block;
}
.rigs-role-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}
.rigs-role-card--active {
  background: color-mix(in srgb, var(--accent, #888) 12%, transparent);
  border-color: var(--accent, #888);
}
.rigs-role-card .rigs-card-dot { width: 8px; height: 8px; display: inline-block; margin-bottom: 8px; }
.rigs-role-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #eee;
  line-height: 1.3;
}
.rigs-role-card-tag {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  letter-spacing: 0.4px;
}

.rigs-role-detail { padding: 24px; }
.rigs-role-detail-head { padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); margin-bottom: 18px; }
.rigs-role-detail-head h2 { margin: 0 0 4px; font-size: 22px; }
.rigs-role-detail-meta {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #888;
  font-family: 'DM Mono', ui-monospace, monospace;
  margin-bottom: 12px;
}
.rigs-role-detail-what { color: #bbb; font-size: 14px; line-height: 1.6; margin: 0; }

.rigs-role-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 18px;
}
@media (max-width: 680px) { .rigs-role-detail-grid { grid-template-columns: 1fr; gap: 20px; } }
.rigs-role-detail-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #777;
  font-weight: 600;
  margin-bottom: 10px;
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-arrow-list { list-style: none; padding: 0; margin: 0; }
.rigs-arrow-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
}
.rigs-arrow-list li::before {
  content: "->";
  position: absolute;
  left: 0;
  color: #666;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  top: 2px;
}

.rigs-role-detail-foot {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}
.rigs-role-detail-salary {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #aaa;
}
.rigs-role-detail-note {
  font-size: 12px;
  color: #888;
  max-width: 380px;
  text-align: right;
  line-height: 1.6;
}

/* Market intel */
.rigs-region-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.rigs-region-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  text-decoration: none;
  color: #aaa;
  transition: all .15s;
}
.rigs-region-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.rigs-region-tab--active {
  background: color-mix(in srgb, var(--accent, #888) 14%, transparent);
  border-color: var(--accent, #888);
  color: #fff;
}
.rigs-region-tab-demand {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #888;
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-region-detail { padding: 24px; }
.rigs-region-detail-head { padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); margin-bottom: 18px; }
.rigs-region-detail-head h2 { margin: 0 0 4px; font-size: 22px; }
.rigs-region-demand {
  font-size: 12px;
  color: #888;
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-region-section { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.rigs-region-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.rigs-region-text { color: #bbb; font-size: 13px; line-height: 1.6; margin: 0; }
.rigs-region-tip { background: rgba(255, 255, 255, 0.02); border-radius: 6px; padding: 14px; }

/* Salary matrix */
.rigs-salary-matrix {
  width: 100%;
  border-collapse: collapse;
}
.rigs-salary-matrix thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #888;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-salary-matrix tbody td {
  padding: 12px 16px;
  font-size: 12px;
  color: #bbb;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-salary-matrix tbody tr:last-child td { border-bottom: 0; }
.rigs-salary-matrix tbody tr:hover td { background: rgba(255, 255, 255, 0.02); color: #fff; }
.rigs-salary-role { color: #eee !important; font-weight: 500; font-family: inherit !important; }

/* Knowledge check */
#rigs-quiz { max-width: 720px; }
.rigs-quiz-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
}
.rigs-quiz-progress {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: #888; font-family: 'DM Mono', ui-monospace, monospace;
  margin-bottom: 16px;
}
.rigs-quiz-progress-bar {
  flex: 1; height: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 2px; overflow: hidden;
}
.rigs-quiz-progress-fill {
  height: 100%; background: var(--accent, #888); transition: width .25s ease;
}
.rigs-quiz-question { font-size: 16px; color: #eee; line-height: 1.5; margin: 0 0 16px; }
.rigs-quiz-options { display: flex; flex-direction: column; gap: 8px; }
.rigs-quiz-option {
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #ccc;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.rigs-quiz-option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
}
.rigs-quiz-option:disabled { cursor: default; }
.rigs-quiz-option--correct {
  background: color-mix(in srgb, #4caf50 18%, transparent);
  border-color: #4caf50;
  color: #fff;
}
.rigs-quiz-option--wrong {
  background: color-mix(in srgb, #d35454 16%, transparent);
  border-color: #d35454;
  color: #fff;
}
.rigs-quiz-feedback {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 13px;
  color: #bbb;
  line-height: 1.6;
}
.rigs-quiz-next {
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--accent, #888);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.rigs-quiz-next:hover { filter: brightness(1.1); }
.rigs-quiz-final {
  text-align: center;
  padding: 32px;
}
.rigs-quiz-final-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent, #888);
  font-family: 'DM Mono', ui-monospace, monospace;
}
.rigs-quiz-final-message {
  font-size: 14px;
  color: #aaa;
  margin: 12px 0 24px;
}

/* ── Case Study Builder: form + live preview ─────────────────── */
.csb-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 24px;
  align-items: start;
}
.csb-form { min-width: 0; }

/* Collapsible section cards (native <details>) */
.csb-section {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 12px;
  background: rgba(22, 22, 24, 0.45);
}
.csb-section > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #eee;
  cursor: pointer;
  list-style: none;
}
.csb-section > summary::-webkit-details-marker { display: none; }
.csb-section > summary::before {
  content: '▸';
  color: var(--brand-purple);
  font-size: 11px;
  transition: transform .15s;
}
.csb-section[open] > summary::before { transform: rotate(90deg); }
.csb-section-body { padding: 4px 16px 18px; }

/* Dynamic list rows (roles, shift points) */
.csb-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.csb-row { display: flex; gap: 8px; align-items: flex-start; }
.csb-row > input { flex: 1; }
.csb-row--block {
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
}
.csb-row--block .csb-row-del { align-self: flex-end; }

/* Sticky save bar at the foot of the form column */
.csb-savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 18px;
  margin-top: 8px;
  background: linear-gradient(to bottom, transparent, #0f0f0f 45%);
}

/* Preview column — A4 (794×1123) scaled to fit the rail */
.csb-preview { position: sticky; top: 24px; }
.csb-preview-frame-wrap {
  width: 437px;
  height: 618px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
}
#csb-preview-frame {
  width: 794px;
  height: 1123px;
  border: 0;
  transform: scale(0.55);
  transform-origin: top left;
}

@media (max-width: 980px) {
  .csb-editor { grid-template-columns: 1fr; }
  .csb-preview { position: static; }
}
