/* Look and layout from the design prototype (Main.dc.html). Fonts are self-hosted (SIL OFL, see fonts/). */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap; src: url("fonts/source-serif-4-latin-600-normal.beb0c8d8bee8.woff2") format("woff2"); }

:root {
  --paper: #F4F1EA; --ink: #1D2530; --ink-2: #333D4A; --muted: #4A5563; --muted-2: #5B6572;
  --slate: #1D2530; --slate-hi: #2F3B4A; --nav: #D5DAE0; --nav-2: #C5CCD4; --nav-label: #9AA4B0; --nav-strong: #E9ECEF;
  --teal: #0E5A5F; --teal-dark: #093E42; --teal-tint: #E3F0EF;
  --line: #DDD8CC; --line-2: #EEEAE0; --head: #F8F6F1; --fold: #FBFAF7; --track: #E6E1D6;
  --field: #C9CED4; --field-2: #B9BFC7;
  --amber: #B45309; --note: #8A4B0B;
  --ok-bg: #DDEFEC; --ok: #093E42; --pend-bg: #FDF1E3; --pend: #7A3E08; --draft-bg: #ECEEF1; --draft: #3E4855;
  --bad-bg: #FBE7E4; --bad: #9B2C1F;
  --serif: "Source Serif 4", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "IBM Plex Sans", system-ui, sans-serif; background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
button, input, select { font-family: inherit; font-size: 14px; }
h1 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.2; }
h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 8px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- app shell: slate sidebar + white header ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 300px; flex-shrink: 0; background: var(--slate); color: var(--nav-strong); padding: 24px 16px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; color: #fff; padding: 0 12px 16px; text-decoration: none; }
.brand:hover { color: #fff; }
.nav { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; color: var(--nav); text-decoration: none; }
.nav:hover { background: var(--slate-hi); color: #fff; }
.nav.active { background: var(--slate-hi); color: #fff; font-weight: 600; }
.nav .count { margin-left: 8px; padding: 2px 8px; border-radius: 10px; background: var(--amber); color: #fff; font-size: 12px; font-weight: 500; }
.nav-label { padding: 18px 12px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-label); }
.attr > summary { list-style: none; cursor: pointer; color: var(--nav-strong); font-weight: 500; }
.attr > summary::-webkit-details-marker { display: none; }
.attr > summary b { font-weight: 600; margin-right: 8px; }
.attr-metrics { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 8px 12px; }
.metric-link { display: block; min-height: 34px; padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--nav-2); text-decoration: none; }
.metric-link span { color: var(--nav-label); margin-right: 8px; }
.metric-link:hover { background: var(--slate-hi); color: #fff; }
.metric-link.active { background: var(--slate-hi); color: #fff; }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.header { min-height: 72px; padding: 12px 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line); }
.header-college { font-size: 17px; font-weight: 600; }
.header-sub { font-size: 13px; color: var(--muted); }
.header-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.header-user a { color: var(--muted); }
.content { flex-grow: 1; padding: 28px 32px 40px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack.narrow { max-width: 1000px; }
.crumb { font-size: 13px; color: var(--muted); }
.lede { font-size: 14px; color: var(--ink-2); }
.facts { display: flex; flex-wrap: wrap; gap: 12px; font-size: 14px; color: var(--ink-2); }
.facts .sep { color: var(--field-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.note { font-size: 13px; color: var(--note); }

/* ---------- messages ---------- */
.toast { padding: 12px 16px; border-radius: 8px; background: var(--teal-tint); color: var(--teal-dark); font-size: 14px; margin-bottom: 16px; }
.toast.error { background: var(--bad-bg); color: var(--bad); }
.toast.warning, .toast.info-warn { background: var(--pend-bg); color: var(--pend); }
.toast.demo { background: #EFE8F7; color: #45306B; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards, tiles, tables ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card.pad { padding: 20px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.tile-label, .tile-note { font-size: 13px; color: var(--muted); }
.tile-value { font-family: var(--serif); font-size: 38px; font-weight: 600; line-height: 1.15; }
.tile-value small { font-size: 18px; color: var(--muted); font-family: "IBM Plex Sans", sans-serif; font-weight: 400; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { padding: 12px 20px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  background: var(--head); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid td { padding: 11px 20px; border-bottom: 1px solid var(--line-2); font-size: 14px; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .strong { font-weight: 600; }
.grid tr.dim td { color: var(--muted); }
.grid tr.na td { color: #9AA1AB; }
.row-actions { white-space: nowrap; text-align: right; }
/* Per-programme tables: many columns side by side, so headings wrap and cells are tighter */
.grid.compact th { white-space: normal; vertical-align: bottom; padding: 10px 10px; }
.grid.compact td { padding: 9px 10px; }
.grid.compact th:first-child, .grid.compact td:first-child { padding-left: 20px; min-width: 140px; }
.grid.compact input[type=number] { width: 72px; }
.grid.compact input[type=date] { width: 140px; }
.grid.compact input.amount { width: 130px; }          /* rupee amounts need room for 9-10 digits */
.grid.compact td.calc, .grid.compact th.calc { padding-left: 8px; padding-right: 8px; }
.grid.compact .seg { gap: 3px; }
.grid.compact .seg label { padding: 0 8px; }
.grid.compact .stacked-action { margin-top: 6px; }
.nowrap { white-space: nowrap; }
.row-actions > * + * { margin-left: 10px; }

/* Dashboard attribute rows that fold open (prototype: click a row to see its metrics) */
.attr-table { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.attr-head, .attr-row { display: grid; grid-template-columns: 90px 1fr 140px 140px 200px; align-items: center; padding: 12px 20px; }
.attr-head { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--head); border-bottom: 1px solid var(--line); }
.attr-fold { border-bottom: 1px solid var(--line-2); }
.attr-fold:last-of-type { border-bottom: 0; }
.attr-fold > summary { list-style: none; cursor: pointer; }
.attr-fold > summary::-webkit-details-marker { display: none; }
.attr-row { padding: 14px 20px; font-size: 14px; }
.attr-row:hover { background: var(--fold); }
.attr-total { border-top: 1px solid var(--line); font-weight: 600; }
.r { text-align: right; }
.share { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.bar { width: 120px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > div { height: 8px; background: var(--teal); }
.share span { width: 40px; text-align: right; color: var(--muted); }
.attr-metrics-table { padding: 8px 20px 16px 110px; background: var(--fold); border-top: 1px solid var(--line-2); }
.m-head, .m-row { display: grid; grid-template-columns: 80px 1fr 90px 90px 90px; padding: 7px 0; }
.m-head { font-size: 12px; font-weight: 600; color: var(--muted); }
.m-row { font-size: 14px; border-top: 1px solid var(--line-2); }
.m-row.na { color: #9AA1AB; }
.m-row a { color: inherit; text-decoration: none; }
.m-row a:hover { color: var(--teal); text-decoration: underline; }

/* ---------- forms and buttons ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
input, select { height: 40px; padding: 0 10px; border: 1px solid var(--field); border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.grid input, .grid select { height: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; padding: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
form.inline { display: inline; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border-radius: 8px;
  border: 1px solid var(--field-2); background: #fff; color: var(--ink-2); font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary { border: 0; background: var(--teal); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--teal-dark); color: #fff; }
.btn.big { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.outline { height: 34px; padding: 0 12px; border: 1px solid var(--teal); color: var(--teal); border-radius: 6px; }
.btn.outline:hover { background: var(--teal-tint); }
.btn.danger { color: var(--bad); border-color: #E4B4AC; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; font: inherit; text-decoration: underline; }
.link.danger { color: var(--bad); }

/* Yes / No segmented choice (prototype) */
.seg { display: inline-flex; gap: 6px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { display: inline-flex; flex-direction: row; justify-content: center; align-items: center; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--field-2);
  background: #fff; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg input:checked + label { border-color: var(--teal); background: var(--teal); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; }
.seg input:disabled + label { cursor: default; opacity: .7; }

/* status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 13px; white-space: nowrap; }
.pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.pending { background: var(--pend-bg); color: var(--pend); }
.pill.draft, .pill.new { background: var(--draft-bg); color: var(--draft); }
.pill.rejected { background: var(--bad-bg); color: var(--bad); }
.pill.demo { background: #EFE8F7; color: #45306B; font-weight: 600; font-size: 11px; letter-spacing: .05em; }
.grade { font-weight: 600; }

/* tabs for metrics with several entry pages */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; color: var(--muted); text-decoration: none; font-size: 14px; border: 1px solid transparent; margin-bottom: -1px; }
.tabs a.active { background: #fff; border-color: var(--line); border-bottom-color: #fff; color: var(--ink); font-weight: 600; }
.tabs span { padding: 8px 14px; color: #9AA1AB; font-size: 14px; }

.placeholder { padding: 24px; background: #fff; border-radius: 12px; border: 1px dashed var(--field-2); font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--slate); padding: 16px; }
.login-card { width: 100%; max-width: 440px; padding: 48px; background: var(--paper); border-radius: 16px; display: flex; flex-direction: column; gap: 20px; }
.login-card .title { font-family: var(--serif); font-size: 34px; font-weight: 600; }
.login-card p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.5; }
.login-card input { height: 44px; padding: 0 12px; border-color: var(--field-2); border-radius: 8px; }
.login-card .btn { height: 48px; font-size: 15px; }
.login-card .fine { font-size: 12px; color: var(--muted-2); }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .header, .content { padding-left: 16px; padding-right: 16px; }
  .tiles { grid-template-columns: 1fr; }
  .attr-head, .attr-row { grid-template-columns: 60px 1fr 80px 80px; }
  .attr-head > :last-child, .attr-row > :last-child { display: none; }
  .attr-metrics-table { padding-left: 20px; }
  .login-card { padding: 28px; }
}

/* import preview */
li.danger, tr.danger td, p.danger, div.danger { color: var(--bad); }

/* owner console */
a.plain { color: inherit; text-decoration: none; }
fieldset.plain-set { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.plain-set legend { font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 0 0 6px; }
label.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; }
label.choice input { height: auto; margin-top: 3px; }
.scope-attr { border-top: 1px solid var(--line-2); padding: 8px 0; }
.scope-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; padding: 6px 0 0 26px; }
.secret { display: flex; flex-wrap: wrap; gap: 24px; padding: 14px 16px; background: var(--head); border-radius: 8px; }
.secret div { display: flex; flex-direction: column; gap: 2px; }
.secret b { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; letter-spacing: .03em; }

/* Calculated figures (read-only, from the last recalculation) */
.grid td.calc { background: var(--fold); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid th.calc { text-align: right; }
.figures-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--muted); }
.figures-note .stale { color: var(--pend); font-weight: 500; }
.figures-note form { display: inline; }

/* A single pooled row of calculated figures (M10.1): summary cards instead of a wide table */
.fig-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fig-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.fig-card .label { font-size: 13px; color: var(--muted); }
.fig-card .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.fig-card.pct { background: var(--teal-tint); border-color: var(--teal); }
.fig-card.pct .value { font-size: 34px; color: var(--teal); }
.fig-period { font-size: 13px; color: var(--muted); }
.retention-missing { padding: 16px 18px; border-color: var(--amber, #d9a400); background: #fffbea; }
