/* Open FC Data Repository — UI stylesheet
   Layout: top bar / left sidebar / right canvas / footer bar (CSS grid). */
:root {
  --bg: #f3f5f8; --surface: #ffffff; --surface-2: #f8f9fb; --border: #dde2ea; --border-strong: #c6cdd8;
  --text: #1b2433; --muted: #5d6879; --faint: #8a94a5;
  --brand: #0d2340; --brand-2: #16345c; --accent: #0b7a83; --accent-soft: #e2f3f4;
  --ok: #1d7a46; --ok-soft: #e3f4ea; --warn: #9a6200; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fdecea;
  --info: #2556a8; --info-soft: #e7eefb;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --topbar-h: 56px; --footer-h: 34px; --sidebar-w: 236px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 620; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.nowrap { white-space: nowrap; } .right { text-align: right; }

/* ---------- shell grid ---------- */
.shell { display: grid; height: 100vh;
  grid-template: "top top" var(--topbar-h) "side main" 1fr "foot foot" var(--footer-h) / var(--sidebar-w) 1fr; }
.topbar { grid-area: top; background: var(--brand); color: #fff; display: flex; align-items: center;
  gap: 16px; padding: 0 18px; border-bottom: 1px solid #08182d; z-index: 5; }
.sidebar { grid-area: side; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 10px; }
.canvas { grid-area: main; overflow-y: auto; padding: 24px 28px 40px; }
.footer { grid-area: foot; background: var(--surface); border-top: 1px solid var(--border); display: flex;
  align-items: center; gap: 18px; padding: 0 18px; font-size: 12px; color: var(--muted); }
.footer .spacer { flex: 1; }
.footer .pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }

/* ---------- top bar ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #38bdf8, #2dd4bf 55%, #fbbf24);
  display: grid; place-items: center; font-size: 17px; font-weight: 800; color: #0b1f3a; }
/* Selidik wordmark: raw data (sky) -> cleaned (teal) -> insight (amber) */
.wordmark { font-weight: 800; letter-spacing: -.01em; background: linear-gradient(90deg, #38bdf8 0%, #2dd4bf 50%, #fbbf24 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #2dd4bf; }
.brand .wordmark { display: block; font-size: 18px; line-height: 1.1; }
.wordmark.xl { display: block; font-size: clamp(44px, 6vw, 68px); line-height: 1.05; letter-spacing: -.03em; margin-bottom: 10px; }
.footer .wordmark { font-size: 12.5px; }
.brand small { display: block; font-weight: 450; font-size: 11px; color: #a9b8cf; }
.topsearch { flex: 1; max-width: 520px; margin-left: 24px; }
.topsearch input { width: 100%; height: 34px; border-radius: 7px; border: 1px solid #2b4569; background: #142c4d;
  color: #fff; padding: 0 12px; font: inherit; }
.topsearch input::placeholder { color: #8ea2c0; }
.topbar .spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.usermenu .who { text-align: right; line-height: 1.25; }
.usermenu .who small { display: block; color: #a9b8cf; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #234a7a; display: grid; place-items: center; font-weight: 700; }
.btn-ghost-light { background: transparent; color: #d5deeb; border: 1px solid #2f4b72; border-radius: 6px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 12.5px; }
.btn-ghost-light:hover { background: #18355d; color: #fff; }

/* ---------- sidebar ---------- */
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin: 14px 10px 6px; font-weight: 600; }
.nav-section:first-child { margin-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .scope { margin: 18px 8px 0; padding: 10px; border: 1px dashed var(--border-strong); border-radius: 8px; font-size: 12px; color: var(--muted); }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head .grow { flex: 1; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 18px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--faint); }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); padding: 8px 12px; white-space: nowrap; }
table.data td { border-bottom: 1px solid var(--border); padding: 8px 12px; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv { border-collapse: collapse; width: 100%; font-size: 13px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; width: 190px; padding: 6px 12px 6px 0; vertical-align: top; }
table.kv td { padding: 6px 0; vertical-align: top; word-break: break-word; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; border: 1px solid transparent; }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); } .b-info { background: var(--info-soft); color: var(--info); }
.b-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-block; font-size: 11px; background: #eef1f5; color: #45526a; padding: 1px 7px; border-radius: 4px; margin: 1px 2px 1px 0; }

/* ---------- forms & buttons ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=search], select {
  width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: 7px; padding: 0 10px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 2px solid #9fd6da; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #096a72; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.filters { display: grid; grid-template-columns: 2.2fr 1fr 1.2fr .8fr 1fr auto; gap: 10px; align-items: end; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select, .inline-form input { height: 28px; font-size: 12.5px; width: auto; }
.alert { border-radius: 7px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.alert.err { background: var(--bad-soft); color: var(--bad); border-color: #f5c2bd; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #b8e2c8; }
.alert.info { background: var(--info-soft); color: var(--info); border-color: #c5d6f3; }

/* ---------- pipeline stages ---------- */
.stages { display: flex; gap: 6px; flex-wrap: wrap; }
.stage { flex: 1; min-width: 120px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; background: var(--surface-2); }
.stage .n { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stage .t { font-weight: 620; }
.stage.ok { border-color: #b8e2c8; background: var(--ok-soft); } .stage.warn { border-color: #f1d39d; background: var(--warn-soft); }
.stage.failed { border-color: #f5c2bd; background: var(--bad-soft); } .stage.running { border-color: #c5d6f3; background: var(--info-soft); }
pre.log { background: #0f1a2b; color: #cfe0f5; border-radius: 8px; padding: 12px 14px; font: 12px/1.55 var(--mono); max-height: 320px; overflow: auto; white-space: pre-wrap; margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
pre.json { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 10px; font: 12px/1.5 var(--mono); overflow: auto; max-height: 360px; }

/* ---------- bars ---------- */
.bar { height: 8px; background: #edf0f4; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- graph ---------- */
#graph { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfd; }
#graph text { font: 11px var(--font); fill: #2b3546; pointer-events: none; }
#graph .edge { stroke: #b6c0ce; stroke-width: 1.3; }
#graph .edge.same_as { stroke: #d08b1a; stroke-dasharray: 4 3; }
#graph .elabel { font-size: 9.5px; fill: #8a94a5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; }
.split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); }
.intro { background: radial-gradient(900px 500px at 10% 0%, #1d4a7a 0%, transparent 60%), linear-gradient(160deg, var(--brand) 0%, #091a30 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 36px clamp(28px, 6vw, 80px); }
.intro-body { max-width: 600px; }
.eyebrow { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7fd6dc;
  border: 1px solid rgba(127,214,220,.35); border-radius: 999px; padding: 3px 12px; margin-bottom: 20px; }
.intro h1 { margin: 0 0 16px; font-weight: 700; }
.intro .tagline { display: block; font-size: clamp(20px, 2.2vw, 26px); line-height: 1.25; letter-spacing: -.01em; color: #e6eefb; }
.intro .lead { font-size: 15.5px; line-height: 1.65; color: #b9c7dc; margin: 0; }
.facts { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 0; border-top: 1px solid rgba(255,255,255,.12); }
.facts li { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.fact-icon { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font: 600 12px var(--mono);
  color: #7fd6dc; background: rgba(18,163,173,.14); border: 1px solid rgba(127,214,220,.25); }
.facts b { display: block; font-size: 15px; font-weight: 650; }
.facts span:not(.fact-icon) { display: block; font-size: 13px; color: #9fb0c8; margin-top: 2px; }
.intro-foot { font-size: 12px; color: #7e90ab; margin: 0; }
.access { background: var(--bg); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 28px; gap: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(13,35,64,.10); padding: 32px; }
.login-card h2 .wordmark { background: linear-gradient(90deg, #0284c7, #0d9488 55%, #d97706); -webkit-background-clip: text; background-clip: text; }
.login-card h2 { font-size: 22px; margin: 0 0 2px; letter-spacing: -.01em; }
.login-card > .muted { margin: 0 0 22px; font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card input { height: 40px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 8px; }
.scope-note { margin: 18px 0 0; font-size: 12px; color: var(--faint); text-align: center; }
.access-foot .pill { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; color: var(--faint); }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .intro { padding: 28px 24px; gap: 28px; }
  .intro-foot { display: none; }
  .access { padding: 32px 20px 40px; }
}

/* ---------- changelog ---------- */
.prose h2 { font-size: 17px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border); }
.prose h3 { font-size: 15px; margin-top: 20px; } .prose h4 { font-size: 13.5px; margin: 14px 0 4px; color: var(--muted); }
.prose ul { margin: 4px 0 8px; padding-left: 20px; } .prose li { margin: 2px 0; }
.prose code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }

.htmx-indicator { opacity: 0; transition: opacity .2s; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }

@media (max-width: 980px) {
  .shell { grid-template: "top" var(--topbar-h) "main" 1fr "foot" var(--footer-h) / 1fr; }
  .sidebar { display: none; } .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr; } .filters { grid-template-columns: 1fr 1fr; } .topsearch { display: none; }
}
