:root {
  --bg-main: #0b1720;
  --bg-panel: #001f2a;
  --bg-panel-soft: #022737;
  --fg-primary: #e5f2f7;
  --fg-muted: #8fa1ad;
  --fg-accent: #b3ecff;
  --accent-cyan: #2aa198;
  --accent-blue: #268bd2;
  --accent-magenta: #d33682;
  --accent-yellow: #b58900;
  --accent-orange: #cb4b16;
  --accent-green: #859900;
  --border-subtle: #123345;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --font-mono: "Fira Code", "Courier New", monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at 20% 20%, rgba(42,161,152,0.06), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(38,139,210,0.07), transparent 30%),
    var(--bg-main);
  color: var(--fg-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--fg-accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-cyan); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
h3 { font-size: 1.1rem; }

p { color: var(--fg-primary); }
code { font-family: var(--font-mono); background: var(--bg-panel-soft); padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); }

.hidden { display: none !important; }
.muted { color: var(--fg-muted); }

/* Top mode bar */
.top-mode-bar {
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-panel-soft) 100%);
  box-shadow: var(--shadow-soft);
}
.top-mode-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.top-mode-title { display: flex; align-items: center; gap: 12px; }
.top-mode-title i { color: var(--accent-cyan); font-size: 1.5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--fg-muted); margin-bottom: 4px; }
.mode-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 20px;
  background: var(--bg-panel-soft); border: 1px solid var(--border-subtle);
  color: var(--fg-primary); cursor: pointer;
  transition: all var(--transition-fast);
}
.mode-btn:hover { border-color: var(--accent-cyan); background: var(--bg-panel); }
.mode-btn.active { background: var(--accent-cyan); color: var(--bg-main); border-color: var(--accent-cyan); }

/* Layout */
.relab-shell { max-width: 1400px; margin: 24px auto 72px; padding: 0 20px; display: grid; grid-template-columns: 290px 1fr; gap: 20px; }
.workflow-sidebar { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 18px; position: sticky; top: 16px; height: fit-content; box-shadow: var(--shadow-soft); }
.workflow-brand { margin-bottom: 14px; }
.workflow-nav { display: flex; flex-direction: column; gap: 8px; }
.workflow-link {
  width: 100%; text-align: left; border: 1px solid var(--border-subtle);
  background: var(--bg-panel-soft); color: var(--fg-primary);
  padding: 10px 12px; border-radius: var(--radius-md);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  cursor: pointer; transition: all var(--transition-fast);
}
.workflow-link i { color: var(--fg-muted); }
.workflow-link:hover { border-color: var(--accent-cyan); color: var(--fg-accent); }
.workflow-link.active { background: var(--accent-cyan); color: var(--bg-main); border-color: var(--accent-cyan); }
.workflow-link.active i { color: var(--bg-main); }
.step-status { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border-subtle); background: transparent; flex-shrink: 0; }
.step-status.completed { background: var(--accent-green); border-color: var(--accent-green); }

.content-area { display: flex; flex-direction: column; gap: 28px; }
.section { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-soft); display: none; }
.section.active { display: block; }
.section-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); padding-bottom: 12px; margin-bottom: 16px; }
.subtitle { color: var(--fg-muted); }
.section-tip { background: var(--bg-panel-soft); border: 1px dashed var(--border-subtle); padding: 10px 12px; border-radius: var(--radius-md); color: var(--fg-accent); font-size: 0.9rem; }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--accent-orange); background: rgba(203, 75, 22, 0.12); }
.banner-warning { border-color: var(--accent-yellow); background: rgba(181, 137, 0, 0.12); }
.banner i { color: var(--accent-yellow); font-size: 1.2rem; }

.description-card, .form-card, .info-card, .report-preview { background: var(--bg-panel-soft); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 16px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.quick-start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.quick-start-card { cursor: pointer; border: 1px solid var(--border-subtle); background: var(--bg-panel-soft); padding: 14px; border-radius: var(--radius-md); transition: all var(--transition-fast); }
.quick-start-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); }

.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: rgba(42,161,152,0.14); color: var(--fg-accent); font-size: 0.85rem; border: 1px solid var(--border-subtle); }
.pill-soft { background: rgba(38,139,210,0.12); color: var(--fg-primary); }

.two-column { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--fg-primary); font-weight: 600; }
input, select, textarea { width: 100%; padding: 10px 12px; background: var(--bg-main); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--fg-primary); font-family: var(--font-sans); transition: border-color var(--transition-fast); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-cyan); box-shadow: 0 0 0 3px rgba(42,161,152,0.25); }
textarea { resize: vertical; }
.code-input { font-family: var(--font-mono); background: #031420; }
.checkbox-group, .radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.checkbox-label, .radio-label { display: inline-flex; gap: 8px; align-items: flex-start; color: var(--fg-primary); cursor: pointer; }
.checkbox-group.inline { align-items: center; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--accent-cyan); color: var(--bg-main); font-weight: 600; cursor: pointer; transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn-secondary { background: var(--bg-panel); color: var(--fg-primary); border-color: var(--border-subtle); }
.btn-outline { background: transparent; color: var(--fg-primary); border-color: var(--border-subtle); }
.btn-danger { background: var(--accent-magenta); color: var(--bg-main); }
.file-btn input { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-filter { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-main); border: 1px solid var(--border-subtle); padding: 8px 10px; border-radius: var(--radius-sm); color: var(--fg-muted); }
.inline-filter input { background: transparent; border: none; padding: 0; color: var(--fg-primary); }
.inline-filter input:focus { outline: none; box-shadow: none; }
.toolbar { border: 1px solid var(--border-subtle); padding: 12px; border-radius: var(--radius-md); background: var(--bg-panel-soft); }

.summary-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card, .summary-chip { background: var(--bg-panel-soft); border: 1px solid var(--border-subtle); padding: 12px; border-radius: var(--radius-sm); text-align: left; }
.stat-number { font-size: 1.4rem; font-weight: 700; color: var(--accent-cyan); }
.stat-label { color: var(--fg-muted); font-size: 0.9rem; }

.tabs-container { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-panel-soft); }
.tabs-nav { display: flex; gap: 2px; background: var(--bg-panel); position: sticky; top: 0; z-index: 5; }
.tab-btn { flex: 1; padding: 12px; background: transparent; color: var(--fg-muted); border: none; cursor: pointer; transition: all var(--transition-fast); font-weight: 600; }
.tab-btn:hover { color: var(--fg-primary); background: var(--bg-panel-soft); }
.tab-btn.active { background: var(--bg-panel-soft); color: var(--fg-primary); border-bottom: 2px solid var(--accent-cyan); }
.tabs-content { padding: 14px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.ioc-table-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ioc-item { padding: 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-main); color: var(--fg-primary); word-break: break-all; }
.notes-box textarea { background: var(--bg-main); }
.empty-state { color: var(--fg-muted); font-style: italic; }

.capabilities-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.capability-chip { padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(42,161,152,0.12); border: 1px solid var(--border-subtle); color: var(--fg-primary); font-size: 0.9rem; }
.capability-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.capability-card { background: var(--bg-main); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px; cursor: pointer; transition: border-color var(--transition-fast), transform var(--transition-fast); }
.capability-card:hover { border-color: var(--accent-cyan); transform: translateY(-1px); }
.capability-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.capability-title { font-weight: 700; color: var(--fg-primary); }
.capability-count { background: var(--bg-panel-soft); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 2px 8px; font-size: 0.85rem; color: var(--fg-muted); }
.capability-apis { margin-top: 10px; display: none; flex-direction: column; gap: 6px; }
.capability-card.open .capability-apis { display: flex; }
.api-item { padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-panel); }
.api-name { color: var(--accent-cyan); font-weight: 600; }
.api-description { color: var(--fg-muted); font-size: 0.9rem; }

.functions-list { display: flex; flex-direction: column; gap: 10px; }
.function-card { background: var(--bg-main); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px; }
.function-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.function-title { font-family: var(--font-mono); color: var(--accent-cyan); }
.function-role { background: rgba(38,139,210,0.14); border: 1px solid var(--border-subtle); padding: 4px 10px; border-radius: 12px; color: var(--fg-primary); font-size: 0.85rem; }
.function-status { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0; font-weight: 600; }
.function-status.understood { color: var(--accent-green); }
.function-status.partial { color: var(--accent-yellow); }
.function-status.unknown { color: var(--accent-orange); }
.function-code { background: #031420; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px; color: var(--fg-muted); white-space: pre-wrap; font-family: var(--font-mono); }
.function-actions { display: flex; gap: 8px; margin-top: 6px; }
.btn-small { padding: 8px 10px; font-size: 0.9rem; }

.indicators-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 12px; }
.indicator-item { background: var(--bg-main); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 10px; }
.indicator-item:hover { border-color: var(--accent-cyan); }

.radar-content { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; }
.score-circle { width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--accent-cyan); display: grid; place-items: center; margin: 0 auto; background: radial-gradient(circle at 30% 30%, rgba(42,161,152,0.25), transparent 70%); }
.score-number { font-size: 2rem; font-weight: 800; color: var(--accent-cyan); }
.score-label { color: var(--fg-muted); font-weight: 600; }
.score-label-text { text-align: center; color: var(--fg-primary); font-weight: 600; }

.report-preview { border: 1px solid var(--border-subtle); }
.info-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.report-content { background: var(--bg-main); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 12px; min-height: 180px; }

.binary-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.info-item { padding: 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-main); }
.info-label { color: var(--fg-muted); font-size: 0.85rem; margin-bottom: 4px; }
.info-value { color: var(--fg-primary); font-weight: 600; word-break: break-word; }
.info-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 6px 10px; border-radius: 12px; border: 1px solid var(--accent-cyan); color: var(--accent-cyan); font-size: 0.85rem; }

.footer { text-align: center; color: var(--fg-muted); padding: 24px 12px 40px; font-size: 0.9rem; }

@media (max-width: 1024px) {
  .relab-shell { grid-template-columns: 1fr; }
  .workflow-sidebar { position: relative; top: 0; }
}
@media (max-width: 640px) {
  .section-header { flex-direction: column; }
  .tabs-nav { flex-direction: column; position: relative; }
}
