/* Tanuh Data Lake — portal design system
   Shares the Tanuh portal brand system with TANUH-DPI and samiksha:
   brand teal #14868c / #107a7f / #0c6468, Inter (self-hosted,
   vendor/fonts.css), Tanuh + Ministry of Education logos, and the
   dark-brand-panel sign-in split. Light, data-dense, governance-grade;
   monospace for identifiers and hashes, soft status colors. */

:root {
  --bg: #f6f8f8;
  --panel: #ffffff;
  --ink: #141415;
  --muted: #5d6468;
  --line: #e5ebeb;
  --line-strong: #cad6d6;
  --accent: #14868c;        /* Tanuh brand primary (all portals) */
  --accent-ink: #107a7f;    /* brand strong — hover / emphasis */
  --accent-dark: #0c6468;   /* brand dark — gradient depth */
  --accent-soft: #e9f6f7;
  --accent-grad: linear-gradient(135deg, #14868c, #0c6468);
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --slate-soft: #eef1f1;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }

/* ---------------- top navigation ---------------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 28px; height: 58px; position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  /* the DPI header's gap between its logos */
}
.brand-logo { width: 38px; height: auto; display: block; }
.brand-moe { width: 36px; }
.brand-name {
  border-left: 1px solid var(--line-strong); padding-left: 12px;
  line-height: 1.25;
}
.brand-product { display: block; font-weight: 600; font-size: 16px; color: var(--ink); }
.brand-sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--accent-ink); }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px;
  padding: 6px 11px; border-radius: 8px;
}
.nav-links a:hover { color: var(--accent-ink); background: var(--accent-soft); }
.nav-links a.active {
  color: var(--accent-ink); background: var(--accent-soft);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-badge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px;
  margin-left: 6px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
  vertical-align: 1px;
}
.caret { font-size: 9px; margin-left: 3px; opacity: .7; }

/* dropdown clusters (Governance, account) — hover or keyboard focus */
.nav-menu { position: relative; display: inline-flex; }
.nav-menu-btn {
  color: var(--muted); background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 13.5px; padding: 6px 11px; border-radius: 8px;
}
.nav-menu-btn:hover, .nav-menu-btn.active { color: var(--accent-ink); background: var(--accent-soft); }
.nav-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 210px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.nav-dropdown-right { min-width: 190px; }
.nav-menu:hover .nav-dropdown, .nav-menu:focus-within .nav-dropdown { display: block; }
.nav-dropdown a {
  display: block; border-radius: 7px; padding: 8px 11px; white-space: nowrap;
}
.nav-dropdown a:hover { background: var(--accent-soft); }

/* account button (right side) */
.nav-account { margin-left: 6px; }
.nav-account-btn {
  display: inline-flex; align-items: center; background: none; border: none;
  cursor: pointer; padding: 4px 6px; border-radius: 999px;
}
.nav-account-btn:hover { background: var(--accent-soft); }
.nav-account-info { padding: 8px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-account-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.avatar {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 12px;
}
.role-chip { text-transform: capitalize; padding: 1px 8px; }

/* in-page sub-tabs (My Data: Requests / Grants) */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
.subtabs a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13.5px;
  padding: 7px 14px; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtabs a:hover { color: var(--accent-ink); background: var(--accent-soft); }
.subtabs a.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------------- layout ---------------- */
.container { max-width: 1200px; margin: 28px auto; padding: 0 24px; }
.footer {
  text-align: center; color: var(--muted); font-size: 12px; padding: 28px;
  border-top: 1px solid var(--line); margin-top: 40px;
}
.footer-brand { font-weight: 600; color: var(--ink); opacity: .7; }

h1, h2, h3, h4, .stat .value, .flow-step .fs-value, .btn, label {
  font-family: var(--font-head);
}
h1 { font-size: 23px; letter-spacing: -.015em; margin: 4px 0 6px; }
h2 { font-size: 16.5px; margin: 26px 0 10px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.page-head { margin-bottom: 20px; }
.page-sub { color: var(--muted); font-size: 13.5px; max-width: 760px; }
.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; margin: 26px 0 10px;
}

/* ---------------- cards & grids ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card h3 { margin: 0 0 6px; font-size: 15.5px; letter-spacing: -.01em; }
.card a.title { color: var(--ink); text-decoration: none; }
.card a.title:hover { color: var(--accent-ink); }

/* stat cards */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .value.ok { color: var(--ok); } .stat .value.danger { color: var(--danger); }
.stat .value.warn { color: var(--warn); } .stat .value.accent { color: var(--accent-ink); }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------------- buttons & forms ---------------- */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 9px;
  padding: 8px 15px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--slate-soft); color: var(--ink); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-warn { background: var(--warn); }
.btn-sm { padding: 4px 11px; font-size: 12.5px; border-radius: 7px; }

input, select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  font: inherit; background: #fff; margin: 4px 0 10px; color: var(--ink);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
label { font-weight: 600; font-size: 12.5px; color: var(--ink); }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }

/* ---------------- badges & chips ---------------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink);
  letter-spacing: .01em;
}
.badge.gray { background: var(--slate-soft); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.chip {
  display: inline-block; padding: 1px 9px; border-radius: 6px; margin: 1px 2px 1px 0;
  font-size: 11.5px; font-weight: 500; background: var(--slate-soft); color: var(--muted);
  font-family: var(--mono);
}
.chip.teal { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
th {
  background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; position: sticky; top: 0;
}
.mono, .audit-action { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }

/* ---------------- pipeline flow strip ---------------- */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin: 6px 0 2px; }
.flow-step {
  flex: 1; min-width: 118px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; position: relative; margin-right: 26px;
  box-shadow: var(--shadow);
}
.flow-step:last-child { margin-right: 0; }
.flow-step:not(:last-child)::after {
  content: "→"; position: absolute; right: -21px; top: 50%; transform: translateY(-50%);
  color: var(--line-strong); font-size: 15px; font-weight: 700;
}
.flow-step .fs-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.flow-step .fs-value { font-size: 17px; font-weight: 700; margin-top: 2px; }
.flow-step.ok .fs-value { color: var(--ok); }
.flow-step.blocked .fs-value { color: var(--warn); }
.flow-step.danger .fs-value { color: var(--danger); }
.flow-step .fs-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------------- lineage timeline ---------------- */
.timeline { position: relative; margin: 10px 0 4px 6px; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line-strong); border-radius: 2px;
}
.tl-item { position: relative; padding: 4px 0 14px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-dot {
  position: absolute; left: -22.5px; top: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 3px var(--bg);
}
.tl-item.ok .tl-dot { background: var(--ok); }
.tl-item.warn .tl-dot { background: var(--warn); }
.tl-item.danger .tl-dot { background: var(--danger); }
.tl-item.info .tl-dot { background: var(--info); }
.tl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-action { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.tl-ts { color: var(--muted); font-size: 11.5px; }
.tl-actor { color: var(--muted); font-size: 11.5px; }
.tl-details { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tl-hash {
  font-family: var(--mono); font-size: 10.5px; color: var(--line-strong);
  background: var(--slate-soft); border-radius: 5px; padding: 0 6px;
}

/* ---------------- previews ---------------- */
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.preview-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
.preview-tile img { width: 100%; height: 140px; object-fit: cover; border-radius: 7px; background: #000; }
.preview-tile pre {
  white-space: pre-wrap; font-size: 11px; max-height: 140px; overflow: hidden;
  background: #f8fafc; padding: 8px; border-radius: 7px; margin: 0; font-family: var(--mono);
}
.preview-tile .meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------------- misc ---------------- */
/* The Tanuh portals' sign-in split (DPI, samiksha): dark brand panel on
   the left, white card on the right. Full-bleed — login.html overrides
   the container class via the main_class block. */
.sign-main { margin: 0; padding: 0; }   /* login.html swaps container for this */
.sign-page {
  display: grid; grid-template-columns: minmax(340px, 430px) 1fr;
  min-height: calc(100vh - 170px); background: #edf5f6;
}
.sign-side {
  background: linear-gradient(175deg, #11444a 0%, #072e30 100%);
  color: #fff; padding: 48px 44px; display: flex; flex-direction: column;
  justify-content: center; gap: 4px;
}
.sign-side-lockup { width: min(300px, 100%); height: auto; display: block; margin-bottom: 26px; }
.sign-name { font-size: 29px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.sign-tagline { color: rgba(255, 255, 255, .7); font-size: 14px; margin: 6px 0 10px; }
.sign-points { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.sign-points li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: rgba(255, 255, 255, .85); }
.sign-point-icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 9px; background: rgba(255, 255, 255, .1); color: #8fd6d6;
}
.sign-point-icon svg { width: 17px; height: 17px; }
.sign-area { display: grid; place-items: center; padding: 40px 24px; }
.sign-card {
  background: var(--panel); border-radius: 12px; border-top: 6px solid var(--accent);
  box-shadow: 0 10px 40px rgba(16, 24, 40, .08);
  width: min(420px, 100%); padding: 28px;
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: #fff; color: var(--ink);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  text-decoration: none;
}
.btn-google:hover { background: var(--slate-soft); }
.login-divider {
  display: flex; align-items: center; gap: 12px; margin: 16px 0 4px;
  color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.success { color: var(--ok); font-size: 13px; }
.empty-state { text-align: center; padding: 46px 20px; }
.empty-state .glyph { font-size: 30px; margin-bottom: 2px; }
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50;
  align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal { background: var(--panel); border-radius: 14px; max-width: 640px; width: 100%; padding: 24px; box-shadow: var(--shadow-lg); }
.terms-box {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 16px; max-height: 260px; overflow-y: auto; white-space: pre-wrap; font-size: 13px;
}
details summary { cursor: pointer; color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.asset-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.kind-icon { font-size: 15px; }

@media (max-width: 880px) {
  /* the sign-in panel drops off narrow screens; the card carries alone */
  .sign-page { grid-template-columns: 1fr; }
  .sign-side { display: none; }
}
@media (max-width: 760px) {
  .nav { padding: 0 14px; height: auto; flex-wrap: wrap; }
  .nav-links { padding: 6px 0; }
  .container { padding: 0 14px; }
  .flow-step { min-width: 45%; margin-bottom: 10px; }
}

/* ---------------- htmx ---------------- */
.htmx-indicator { opacity: 0; transition: opacity .15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner {
  display: inline-block; width: 15px; height: 15px; margin: 10px 0 0 2px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#dataset-grid, #worklist { transition: opacity .12s ease; }
#dataset-grid.htmx-request, #worklist.htmx-request { opacity: .55; }
.toolbar-actions { flex: 0; align-self: end; }
.toolbar-actions .btn { margin-bottom: 10px; }
.decision-row { margin-top: 6px; }
.card-desc { min-height: 38px; margin: 6px 0; }
.card-meta { margin-top: 8px; }
.btn { transition: background .12s ease, transform .05s ease; }
.btn:active { transform: translateY(1px); }
tbody tr { transition: background .1s ease; }
