:root {
  --ink: #172033;
  --muted: #657084;
  --border: #dce2ec;
  --panel: #fff;
  --blue: #0b5fff;
  --bg: #f4f6fa;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue); }
.carret-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding: 0.65rem 1rem; background: var(--panel); border-bottom: 1px solid var(--border);
}
.carret-brand { font-weight: 700; text-decoration: none; color: var(--ink); display: inline-flex; align-items: baseline; gap: 0.55rem; }
.carret-tagline { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.carret-nav { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.carret-nav a { padding: 0.35rem 0.65rem; border-radius: 8px; text-decoration: none; color: #273247; }
.carret-nav a.is-active, .carret-nav a:hover { background: #edf3ff; color: var(--blue); }
.carret-account { display: flex; gap: 0.75rem; align-items: center; font-size: 0.9rem; }
.carret-main { max-width: 1480px; margin: 0 auto; padding: 1rem; }
.notice { padding: 0.6rem 0.8rem; border: 1px dashed #bcc7d8; border-radius: 10px; background: #fbfcff; margin-bottom: 1rem; font-size: 0.88rem; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { border-bottom: 1px solid var(--border); padding: 0.45rem 0.5rem; text-align: left; }
table.data th { background: #f4f7fc; }
.pill { display: inline-block; padding: 0.12rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.pill-queued { background: #eef2f7; }
.pill-running { background: #e7f6fc; color: #075985; }
.pill-done { background: #e7f7ee; color: #14542a; }
.pill-failed { background: #fff0f0; color: #a32929; }
.muted { color: var(--muted); font-size: 0.9rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 0.5rem 0; }
form.inline label { display: block; margin: 0.35rem 0; font-size: 0.85rem; color: var(--muted); }
input, select, textarea { width: 100%; max-width: 32rem; padding: 0.45rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
button, .btn { padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--border); background: #edf3ff; color: var(--blue); font-weight: 600; cursor: pointer; }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.login-panel { max-width: 42rem; margin: 2rem auto; }
.login-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .login-grid.two { grid-template-columns: 1fr 1fr; } }
.msg-error { color: #a32929; }
.msg-ok { color: #14542a; }

/* ---------- Intro / landing page, matching v1 intro mockup ---------- */
.intro-hero { padding: 1.6rem; }
.hero .lede { margin: 0 0 0.85rem; color: #d6deee; max-width: 78ch; font-size: 1rem; }
.hero code { background: #eef2f7; color: #101827; border: 1px solid rgba(255,255,255,0.18); }
.hero-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-primary { background: #2cc4d9; color: #061d24; border-color: #2cc4d9; }
.btn-primary:hover { background: #25b6ca; text-decoration: none; }
.btn-ghost { color: #eef5ff; border-color: rgba(255,255,255,0.28); background: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.intro-grid { align-items: start; }
.illus {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  background: #f7fafd;
  border: 1px solid #e3e8f0;
  border-radius: 12px;
  padding: 0.6rem;
}
.panel h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.panel p { color: #2a3245; }
.pill.pass { color: #197a3a; background: #e7f7ee; border: 1px solid #acdaba; font-weight: 700; }
.pill.fail { color: #a32929; background: #fff0f0; border: 1px solid #f0bcbc; font-weight: 700; }
.pill.info { color: #075985; background: #e7f6fc; border: 1px solid #b8e0ef; }
.pill.muted { color: #4a566c; background: #eef2f7; border: 1px solid #d2d9e3; }

/* ---------- Root landing explanation ---------- */
.landing-hero {
  background: linear-gradient(135deg, #101a33 0%, #162440 60%, #20375d 100%);
  color: #f8fbff;
  border-radius: 16px;
  padding: 1.45rem;
  margin-bottom: 1rem;
}
.landing-hero h1 { margin: 0 0 0.55rem; font-size: 1.8rem; }
.landing-hero .lede { margin: 0 0 0.9rem; color: #d6deee; max-width: 84ch; font-size: 1rem; }
.landing-hero .hero-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.landing-hero .hero-actions .btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.28);
  color: #eef5ff;
  padding: 0.52rem 0.92rem;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
}
.landing-hero .hero-actions .btn:hover { background: rgba(255,255,255,0.08); }
.landing-hero .hero-actions .btn.primary { background: #2cc4d9; border-color: #2cc4d9; color: #061d24; }
.landing-controls { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 0 0 0.65rem; }
.landing-accordion {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(12, 22, 44, 0.04);
  overflow: hidden;
}
.landing-accordion summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: #fbfcff;
  border-bottom: 1px solid transparent;
  font-weight: 800;
}
.landing-accordion[open] summary { border-bottom-color: var(--border); }
.landing-accordion summary small { color: var(--muted); font-weight: 500; font-size: 0.86rem; }
.landing-accordion-body { padding: 1rem; }
.quickstart-grid,
.pagecards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}
.quick-card,
.explain-card,
.pagecard {
  background: #fbfcff;
  border: 1px solid #e3e8f0;
  border-radius: 12px;
  padding: 0.95rem 1rem;
}
.quick-card h3,
.explain-card h3,
.pagecard h4 { margin: 0 0 0.5rem; }
.quick-card p,
.explain-card p,
.pagecard p { margin: 0 0 0.6rem; color: #2a3245; }
.quick-step {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  margin-bottom: 0.6rem;
}
.landing-callout {
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f4f8ff;
  color: #2a3245;
}
.landing-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0.55rem;
  margin-top: 0.5rem;
}
.step {
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}
.step strong { display: block; font-size: 0.92rem; }
.step span { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }
.step.best { border-color: #c8e3cf; background: #f1faf3; }
.step.best strong { color: #14542a; }
.caption { color: var(--muted); font-size: 0.84rem; margin-top: 0.65rem; }
.checks { display: grid; gap: 0.55rem; margin-top: 0.65rem; }
.check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  background: #fff;
  border: 1px solid #e4e9f1;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.check .mark {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #197a3a;
  font-size: 0.78rem;
  font-weight: 800;
}
.check small { display: block; color: var(--muted); margin-top: 0.12rem; }
.pagecard {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pagecard:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(11, 95, 255, 0.10); }
.pagecard .cta { color: var(--blue); font-weight: 700; margin-top: auto; }

/* ---------- README page styling ---------- */
.readme-content { font-size: 0.95rem; line-height: 1.6; }
.readme-content h1 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; }
.readme-content h2 { font-size: 1.25rem; margin: 1.25rem 0 0.6rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.readme-content h3 { font-size: 1.1rem; margin: 1rem 0 0.5rem; }
.readme-content h4 { font-size: 1rem; margin: 0.85rem 0 0.4rem; }
.readme-content p { margin: 0.6rem 0; }
.readme-content pre { background: #0f172a; color: #e2e8f0; padding: 0.85rem 1rem; border-radius: 10px; overflow-x: auto; font-size: 0.85rem; margin: 0.75rem 0; }
.readme-content code { background: #eef2f7; padding: 0.12rem 0.35rem; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
.readme-content pre code { background: transparent; padding: 0; }
.readme-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
.readme-content th, .readme-content td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; }
.readme-content th { background: #f4f7fc; font-weight: 600; }
.readme-content hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--border); }
.readme-content ul, .readme-content ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.readme-content li { margin: 0.25rem 0; }
.readme-content blockquote { border-left: 3px solid var(--blue); margin: 0.75rem 0; padding: 0.5rem 0.75rem; background: #f4f8ff; border-radius: 0 8px 8px 0; }
.readme-content a { color: var(--blue); }
.readme-content a:hover { text-decoration: underline; }
@media (max-width: 1040px) {
  .landing-grid.two { grid-template-columns: 1fr; }
  .ladder { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .check { grid-template-columns: 28px 1fr; }
  .check .pill { grid-column: 2; justify-self: start; }
}
@media (max-width: 640px) {
  .landing-accordion summary { display: block; }
  .landing-accordion summary small { display: block; margin-top: 0.25rem; }
  .tier-grid, .ladder { grid-template-columns: 1fr; }
}

/* ---------- Dashboard hero (project pitch + tier strip) ---------- */
.dash-hero {
  background: linear-gradient(135deg, #101a33 0%, #162440 60%, #20375d 100%);
  color: #f8fbff; border-radius: 16px; padding: 1.25rem; margin-bottom: 1rem;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); gap: 1rem;
}
.dash-hero h2 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.dash-hero p  { margin: 0; color: #d6deee; max-width: 70ch; }
.dash-hero code { background: #eef2f7; color: #101827; border: 1px solid rgba(255,255,255,0.18); padding: 0.08rem 0.32rem; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
.dash-hero .hero-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; flex-wrap: wrap; }
.dash-hero .hero-actions .btn {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.28);
  color: #eef5ff; padding: 0.5rem 0.85rem; border-radius: 9px;
  font-weight: 600; font-size: 0.9rem; text-decoration: none;
}
.dash-hero .hero-actions .btn:hover { background: rgba(255,255,255,0.14); }
.dash-hero .hero-actions .btn.primary { background: #2cc4d9; color: #061d24; border-color: #2cc4d9; }
.dash-hero .hero-actions .btn.primary:hover { background: #45d3e6; }
.tier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
.tier { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15); border-radius: 11px; padding: 0.75rem; }
.tier strong { display: block; font-size: 0.95rem; color: #f8fbff; }
.tier span   { display: block; margin-top: 0.2rem; color: #c5cee2; font-size: 0.8rem; }
.dash-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.dash-metric { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem; }
.dash-metric span.label { display: block; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
.dash-metric strong { display: block; margin-top: 0.22rem; font-size: 1.15rem; }
.dash-metric p.small { color: var(--muted); font-size: 0.82rem; margin: 0.55rem 0 0; }
@media (max-width: 1180px) {
  .dash-hero, .dash-cards { grid-template-columns: 1fr; }
  .tier-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Help-page rich content (ported from v1 mockups) ---------- */
.help-shell { max-width: 1080px; margin: 0 auto; }
.help-shell code { background: #eef2f7; color: #172033; padding: 0.08rem 0.32rem; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
.help-shell pre.example { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 0.85rem 1rem; overflow-x: auto; font-size: 0.85rem; margin: 0.5rem 0; }
.help-shell .panel h3 { margin: 0 0 0.55rem; font-size: 1.12rem; }
.help-shell .panel h4 { margin: 0.95rem 0 0.35rem; font-size: 1rem; }
.help-shell .panel p  { margin: 0 0 0.55rem; color: #2a3245; }
.help-shell .panel ul, .help-shell .panel ol { margin: 0.4rem 0 0.55rem; padding-left: 1.2rem; }
.help-shell .panel li { margin: 0.18rem 0; }
.help-shell .toc { display: grid; gap: 0.25rem; padding: 0; list-style: none; }
.help-shell .toc a { display: inline-block; padding: 0.18rem 0; }
.hero {
  background: linear-gradient(135deg, #101a33 0%, #162440 60%, #20375d 100%);
  color: #f8fbff; border-radius: 16px; padding: 1.4rem; margin-bottom: 1rem;
}
.hero h2 { margin: 0 0 0.45rem; font-size: 1.55rem; }
.hero p  { margin: 0; color: #d6deee; max-width: 78ch; }
.hero .crumbs { color: #9fb1d4; font-size: 0.82rem; margin-bottom: 0.4rem; letter-spacing: 0.06em; text-transform: uppercase; }
.callout { border-left: 4px solid var(--blue); background: #f4f8ff; border-radius: 8px; padding: 0.7rem 0.85rem; margin: 0.55rem 0 0.65rem; }
.callout.warn   { border-left-color: #9a5b00; background: #fff7e8; }
.callout.danger { border-left-color: #a32929; background: #fff0f0; }
.callout strong { display: block; margin-bottom: 0.18rem; }
.definitions { display: grid; grid-template-columns: 200px 1fr; gap: 0.45rem 0.85rem; font-size: 0.94rem; margin: 0.4rem 0 0; }
.definitions dt { color: var(--muted); font-weight: 600; }
.definitions dd { margin: 0; }
@media (max-width: 720px) { .definitions { grid-template-columns: 1fr; } .definitions dt { margin-top: 0.35rem; } }
.help-shell .pill { display: inline-flex; align-items: center; border: 1px solid #cbd5e1; background: #f8fafc; color: #243044; border-radius: 999px; padding: 0.16rem 0.5rem; font-size: 0.76rem; margin: 0.05rem; font-weight: 500; }
.help-shell .pill.pass  { color: #197a3a; background: #e7f7ee; border-color: #acdaba; font-weight: 700; }
.help-shell .pill.fail  { color: #a32929; background: #fff0f0; border-color: #f0bcbc; font-weight: 700; }
.help-shell .pill.info  { color: #075985; background: #e7f6fc; border-color: #b8e0ef; }
.help-shell .pill.muted { color: #4a566c; background: #eef2f7; border-color: #d2d9e3; }
.help-shell .pill.amber { color: #9a5b00; background: #fff7e8; border-color: #f0d3a2; }
.relgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.relcard { display: block; padding: 0.7rem 0.8rem; border: 1px solid #e3e8f0; border-radius: 10px; background: #fbfcff; color: var(--ink); text-decoration: none; }
.relcard:hover { border-color: var(--blue); }
.relcard strong { display: block; }
.relcard span { color: var(--muted); font-size: 0.85rem; }
table.schema, table.metrics, table.fams { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 0.4rem; }
table.schema th, table.schema td,
table.metrics th, table.metrics td,
table.fams th, table.fams td { border-bottom: 1px solid #e3e8f0; padding: 0.45rem 0.55rem; text-align: left; vertical-align: top; }
table.schema th, table.metrics th, table.fams th { background: #f4f7fc; color: #2a3245; font-weight: 600; }
.phaseflow { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 0.4rem; margin: 0.6rem 0; }
.phasebox  { background: #fbfcff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 0.55rem 0.6rem; text-align: center; font-size: 0.82rem; }
.phasebox strong { display: block; font-size: 0.85rem; }
.phasebox span   { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 0.15rem; }
@media (max-width: 920px) { .phaseflow { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.ownerships { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.ownerbox { background: #fbfcff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 0.7rem 0.85rem; }
.ownerbox h4 { margin: 0 0 0.4rem; }
.ownerbox.orcus  { border-color: #b9c8e3; }
.ownerbox.delphi { border-color: #c5d8b6; }
.ownerbox.atrium { border-color: #d2c4e3; }
@media (max-width: 720px) { .ownerships { grid-template-columns: 1fr; } }

/* ---------- Help nav (split button + chevron + dropdown) ---------- */
.carret-help-group { position: relative; display: inline-flex; align-items: stretch; }
.carret-help-group .help-btn,
.carret-help-group .help-chev {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  padding: 0.35rem 0.6rem; color: #273247; font: inherit; border-radius: 8px;
}
.carret-help-group .help-btn:hover,
.carret-help-group .help-chev:hover,
.carret-help-group.is-active .help-btn { background: #edf3ff; color: var(--blue); }
.carret-help-group .help-chev { padding-left: 0.25rem; padding-right: 0.5rem; font-size: 0.7rem; }
.help-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 280px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(12,22,44,0.12); padding: 0.35rem; z-index: 9000; display: none;
}
.help-dropdown.is-open { display: block; }
.help-dropdown a { display: block; padding: 0.45rem 0.6rem; border-radius: 6px; color: #273247; text-decoration: none; font-size: 0.92rem; }
.help-dropdown a:hover { background: #edf3ff; color: var(--blue); }
.help-dropdown small { display: block; color: var(--muted); font-size: 0.8rem; }

/* ---------- Help modal (draggable + resizable, X-only close) ---------- */
.help-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 22, 41, 0.35); z-index: 9500; display: none; }
.help-modal-backdrop.is-open { display: block; }
.help-modal {
  position: fixed; z-index: 9600; display: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(12, 22, 44, 0.32);
  min-width: 360px; min-height: 240px; width: 760px; height: 560px;
  top: 8vh; left: calc(50% - 380px);
  resize: both; overflow: hidden;
}
.help-modal.is-open { display: flex; flex-direction: column; }
.help-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.6rem 0.75rem; cursor: move; user-select: none;
  background: #f4f7fc; border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0;
}
.help-modal-title { margin: 0; font-size: 1rem; font-weight: 700; }
.help-modal-close {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 0.25rem 0.5rem; border-radius: 6px; color: var(--ink);
}
.help-modal-close:hover { background: #e3e9f3; color: #a32929; }
.help-modal-body { flex: 1; overflow: auto; padding: 1rem 1.1rem; background: #f4f6fa; }
.help-modal-body .panel { background: var(--panel); }
.help-modal-resizer {
  position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px;
  cursor: nwse-resize; pointer-events: none;
  background: linear-gradient(135deg, transparent 50%, #b6c0d4 50%, #b6c0d4 60%, transparent 60%, transparent 70%, #b6c0d4 70%, #b6c0d4 80%, transparent 80%);
}
