/* ===== BASE / VARIABLES ===== */
:root {
  --bg: #0a0a1a; --card-bg: rgba(22,27,34,0.85); --card-border: rgba(48,54,61,0.8);
  --text-primary: #e6edf3; --text-secondary: #8b949e; --text-body: #c9d1d9;
  --code-bg: rgba(13,17,23,0.7); --link: #58a6ff; --link-hover: #79c0ff;
  --note-border: #C9A84C; --note-bg: rgba(22,27,34,0.7);
  --quick: #6366f1; --kiro: #0B8953;
  --check-done: #0B8953; --check-pending: #c7c7cc;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Amazon Ember', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0a0a1a; color: var(--text-primary); line-height: 1.6; }

/* ===== SPACE THEME BACKGROUND ===== */
body::before {
  content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(11,137,83,0.04) 0%, transparent 50%),
              #0a0a1a;
}
body::after {
  content: ''; position: fixed; top: 0; left: 0; width: 200%; height: 200%; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(150,180,220,0.4), transparent),
    radial-gradient(1px 1px at 25% 65%, rgba(150,180,220,0.3), transparent),
    radial-gradient(1.5px 1.5px at 45% 15%, rgba(150,180,220,0.5), transparent),
    radial-gradient(1px 1px at 60% 80%, rgba(150,180,220,0.3), transparent),
    radial-gradient(1px 1px at 75% 35%, rgba(150,180,220,0.35), transparent),
    radial-gradient(1.5px 1.5px at 90% 55%, rgba(150,180,220,0.45), transparent),
    radial-gradient(1px 1px at 35% 45%, rgba(150,180,220,0.25), transparent),
    radial-gradient(1px 1px at 55% 90%, rgba(150,180,220,0.3), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(150,180,220,0.35), transparent),
    radial-gradient(1.5px 1.5px at 15% 85%, rgba(150,180,220,0.4), transparent);
  background-size: 300px 300px;
  animation: starDrift 120s linear infinite;
}
@keyframes starDrift { from { transform: translate(0,0); } to { transform: translate(-50%,-50%); } }

/* ===== LAYOUT ===== */
.page { max-width: 960px; margin: 0 auto; padding: 40px 24px 60px; }
.page-header { text-align: center; margin-bottom: 40px; }
.page-header h1 { font-size: 28px; font-weight: 800; color: #f0f6fc; margin-bottom: 6px; }
.page-header p { font-size: 15px; color: var(--text-secondary); }

/* ===== TYPOGRAPHY ===== */
h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 32px 0 14px; }
h3:first-of-type { margin-top: 0; }
p, li { font-size: 14px; color: var(--text-body); margin-bottom: 6px; }
ol, ul { padding-left: 24px; margin-bottom: 16px; }
ol li { margin: 14px 0; }
ul li { margin: 4px 0; }

/* ===== LINKS ===== */
a { color: var(--link); text-decoration: none; transition: color 0.15s, text-decoration 0.15s; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ===== TAB NAVIGATION ===== */
.tab-nav { display: flex; justify-content: center; gap: 8px; margin-bottom: 32px; flex-wrap: wrap; }
.tab-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: 10px; font-size: 14px; font-weight: 600;
  text-decoration: none; transition: all 0.2s;
  border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-secondary); backdrop-filter: blur(12px);
}
.tab-nav a:hover { border-color: var(--link); color: var(--link); text-decoration: none; background: rgba(22,27,34,0.95); }
.tab-nav a.active { background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%); border-color: #6366f1; color: #fff; }
.tab-nav a.active-agents { background: linear-gradient(135deg, #0B8953 0%, #34d399 100%); border-color: #0B8953; color: #fff; }
.tab-nav a.active-solutions { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); border-color: #f59e0b; color: #fff; }
.tab-nav a.active-skills { background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%); border-color: #8b5cf6; color: #fff; }

/* ===== TAB SUB-CARDS ===== */
.tab-subcards { display: flex; justify-content: center; gap: 12px; margin-bottom: 36px; flex-wrap: wrap; }
.tab-subcard {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 12px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all 0.2s;
  border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); backdrop-filter: blur(12px);
  min-width: 180px;
}
.tab-subcard:hover { border-color: var(--link); box-shadow: 0 2px 12px rgba(0,0,0,0.3); text-decoration: none; color: var(--text-primary); }
.tab-subcard .subcard-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.tab-subcard .subcard-text { display: flex; flex-direction: column; }
.tab-subcard .subcard-title { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.tab-subcard .subcard-desc { font-weight: 400; font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

/* ===== IFRAME BANNER ===== */
.iframe-banner { display: block; background: #6366f1; border: 2px solid #818cf8; color: #fff; border-radius: 12px; padding: 18px 28px; margin-bottom: 28px; font-size: 15px; text-align: center; line-height: 1.6; box-shadow: 0 4px 20px rgba(99,102,241,0.35); }
.iframe-banner strong { color: #fff; }
.iframe-banner a { color: #fde68a; font-weight: 700; text-decoration: underline; }
.iframe-banner a:hover { color: #fff; }

/* ===== CARDS ===== */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 36px 40px; margin-bottom: 32px; transition: box-shadow 0.2s; backdrop-filter: blur(12px); }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.card-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.card-icon svg { width: 28px; height: 28px; }
.icon-quick { background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%); }
.icon-kiro { background: linear-gradient(135deg, #0B8953 0%, #34d399 100%); }
.icon-beaconiq { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
.icon-seer { background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); }
.card-header-text h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.card-header-text p { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* ===== CODE + COPY ===== */
code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: 'SF Mono', Monaco, monospace; color: var(--text-body); }
.copyable { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.copy-btn { background: none; border: 1px solid var(--card-border); border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; vertical-align: middle; }
.copy-btn:hover { border-color: var(--link); color: var(--link); }
.copy-btn.copied { border-color: var(--kiro); color: var(--kiro); }

/* ===== DOWNLOAD LINK ===== */
.download-link { display: inline-flex; align-items: center; gap: 6px; background: var(--code-bg); border: 1px solid var(--card-border); border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--link); text-decoration: none; margin: 4px 4px 4px 0; transition: all 0.15s; }
.download-link:hover { background: #e8e8ed; border-color: var(--link); text-decoration: none; }
.download-link::before { content: "⬇"; font-size: 12px; }

/* ===== STEPS WITH CHECKBOXES ===== */
.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; margin: 22px 0; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; background: var(--code-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--text-primary); transition: all 0.2s; }
.steps li.done::before { background: var(--check-done); color: #fff; content: "✓"; }
.step-check { position: absolute; right: 0; top: 2px; }
.step-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--check-done); cursor: pointer; }

/* ===== NEXT STEPS CHECKBOXES ===== */
.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding: 8px 0 8px 32px; margin: 4px 0; border-radius: 6px; transition: opacity 0.2s; }
.checklist li.done { opacity: 0.55; text-decoration: line-through; }
.checklist li input[type="checkbox"] { position: absolute; left: 0; top: 10px; width: 18px; height: 18px; accent-color: var(--check-done); cursor: pointer; }

/* ===== NOTES ===== */
.note { background: var(--note-bg); border-left: 3px solid var(--note-border); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; font-size: 13px; color: var(--text-secondary); }
.note strong { color: var(--text-primary); }

/* ===== OUTCOMES ===== */
.outcomes { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; margin: 12px 0; font-size: 13px; }
.outcomes .num { font-weight: 700; color: var(--text-secondary); text-align: right; }
.outcomes .desc { color: var(--text-body); }

/* ===== EXAMPLE SECTION ===== */
.example-divider { text-align: center; margin: 48px 0 8px; position: relative; }
.example-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--card-border); }
.example-divider span { position: relative; background: var(--bg); padding: 0 16px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px; }
.example-intro { text-align: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }

/* ===== DETAILS / SUMMARY ===== */
details { margin-top: 12px; }
details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--link); padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::before { content: "▶"; font-size: 16px; transition: transform 0.2s; }
details[open] summary::before { transform: rotate(90deg); }
details summary::-webkit-details-marker { display: none; }
details summary:hover { text-decoration: underline; }
details[open] summary { margin-bottom: 16px; }
details > div { padding: 4px 0 4px 18px; border-left: 2px solid var(--card-border); margin-left: 4px; }

/* ===== STAT BOXES ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; text-align: center; }
.stat-box { background: var(--code-bg); border-radius: 12px; padding: 16px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--text-primary); }
.stat-num.accent { color: var(--kiro); }
.stat-label { font-size: 12px; color: var(--text-secondary); }

/* ===== TABLES ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 20px; }
.tbl th { background: var(--code-bg); text-align: left; padding: 6px 10px; font-weight: 600; color: var(--text-primary); }
.tbl td { padding: 4px 10px; border-bottom: 1px solid #eee; color: var(--text-body); }

/* ===== SKILL LIST (Skills Library page) ===== */
.skill-list { border-top: 1px solid var(--card-border); }
.skill-row { display: flex; align-items: flex-start; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--card-border); }
.skill-row:last-child { border-bottom: none; }
.skill-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; line-height: 1; }
.skill-body { flex: 1; min-width: 0; }
.skill-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.skill-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 8px; }
.skill-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 8px; }
.skill-tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 4px; line-height: 1.4; }
.tag-quick { background: #ede9fe; color: #6d28d9; }
.tag-integration { background: var(--code-bg); color: var(--text-secondary); }
.tag-community { background: #d1fae5; color: #065f46; }
.skill-note { font-size: 10.5px; color: var(--text-secondary); font-style: italic; }

/* ===== SKILL SEARCH ===== */
.skill-search-wrap { margin: 32px 0 28px; padding: 24px; position: relative; background: linear-gradient(135deg, rgba(99,102,241,0.06) 0%, rgba(168,85,247,0.06) 100%); border-radius: 16px; border: 1px solid rgba(99,102,241,0.12); }
.skill-search-label { font-size: 13px; font-weight: 600; color: var(--quick); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; display: block; }
.skill-search { width: 100%; padding: 16px 20px 16px 48px; font-size: 17px; border: 2px solid var(--card-border); border-radius: 14px; background: var(--card-bg); color: var(--text-primary); font-family: inherit; outline: none; transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box; }
.skill-search:focus { border-color: var(--quick); box-shadow: 0 0 0 4px rgba(99,102,241,0.18); }
.skill-search::placeholder { color: var(--text-secondary); }
.skill-search-icon { position: absolute; left: 40px; top: calc(100% - 30px); transform: translateY(-50%); font-size: 20px; color: var(--text-secondary); pointer-events: none; }
.skill-search-count { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 10px; display: none; }
.skill-row.search-hidden { display: none; }
.card.search-hidden-card { display: none; }
.search-no-results { text-align: center; padding: 32px 16px; font-size: 14px; color: var(--text-secondary); display: none; }

/* ===== EXTRACTED CSS CLASSES (Phase 3a) ===== */
.icon-csm-os { background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%); }
.icon-resources { background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%); }
.icon-community { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.download-link-sm { font-size: 12px; padding: 4px 12px; }
.badge-utility { display: inline-block; font-size: 10px; background: var(--code-bg); color: var(--text-secondary); padding: 2px 8px; border-radius: 4px; font-weight: 600; margin-left: 6px; }
.badge-preview { display: inline-block; font-size: 10px; background: #f59e0b; color: #000; padding: 1px 6px; border-radius: 4px; font-weight: 700; vertical-align: middle; margin-left: 4px; }
.note-csm-os { border-left-color: #8b5cf6; }
.note-community { border-left-color: #10b981; }
.section-divider { border-top: 1px solid var(--card-border); margin-top: 20px; padding-top: 16px; }
.footer-text { text-align: center; font-size: 11px; color: var(--text-secondary); margin-top: 40px; padding-bottom: 20px; }

/* ===== SPACE THEME OVERRIDES (always dark) ===== */
.card-icon { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.stat-box { background: var(--code-bg) !important; }
.tbl th { background: var(--code-bg); color: var(--text-primary); }
.tbl td { border-bottom-color: var(--card-border); }
.download-link { background: var(--code-bg); border-color: var(--card-border); color: var(--link); }
.download-link:hover { background: rgba(51,51,88,0.8); border-color: var(--link); }
.tag-quick { background: #3b1f7e; color: #c4b5fd; }
.tag-integration { background: var(--code-bg); color: var(--text-secondary); }
.tag-community { background: #064e3b; color: #6ee7b7; }
.skill-search { background: var(--code-bg); border-color: var(--card-border); color: var(--text-primary); border-width: 2px; }
.skill-search-wrap { background: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(168,85,247,0.08) 100%); border-color: rgba(99,102,241,0.2); }

/* ===== TABLET (768px) ===== */
@media (max-width: 768px) {
  .tab-nav { gap: 6px; }
  .tab-nav a { padding: 8px 14px; font-size: 12px; }
  .tab-subcards { gap: 8px; }
  .tab-subcard { min-width: 150px; padding: 10px 14px; }
}

/* ===== MOBILE (640px) ===== */
@media (max-width: 640px) {
  .page { padding: 24px 16px 40px; }
  .card { padding: 24px 20px; }
  .card-header-text h2 { font-size: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .outcomes { grid-template-columns: 32px 1fr; }
  .tbl { font-size: 11px; }
  .tbl th, .tbl td { padding: 4px 6px; }
  .skill-row { padding: 12px 0; }
  .tab-nav a { padding: 8px 12px; font-size: 11px; }
}

/* ===== PRINT ===== */
@media print {
  body { background: #fff !important; color: #333 !important; }
  body::before, body::after { display: none !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; background: #fff !important; backdrop-filter: none !important; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .copy-btn, .step-check, .tab-nav, .tab-subcards, .skill-search-wrap { display: none !important; }
  details { display: block; }
  details > div { display: block; border-left: none; padding-left: 0; }
  details summary::before { content: ""; }
  a { color: #333; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 10px; color: #888; word-break: break-all; }
  .download-link::after { content: ""; }
  h1, h2, h3 { color: #1a1a1a !important; }
  p, li, .note, .note strong { color: #333 !important; }
  .page-header h1 { color: #1a1a1a !important; }
  .page-header p { color: #555 !important; }
  .note { background: #f8f9fa !important; border-left-color: #ccc !important; }
}
