/* SMRITI Registry — app styles */
:root {
	--bg: #f6f5f2;
	--panel: #ffffff;
	--ink: #1d2433;
	--muted: #5b6475;
	--line: #e2e0da;
	--brand: #3b4f8c;
	--brand-2: #6a4c93;
	--brand-ink: #ffffff;
	--soft: #eef0f7;
	--ok: #2f7d4f;
	--ok-bg: #e5f3ea;
	--info: #2f5f9e;
	--info-bg: #e6eef9;
	--warn: #93600a;
	--warn-bg: #fbf0d9;
	--alert: #a8322d;
	--alert-bg: #fbe6e4;
	--chart-1: #3b4f8c;
	--chart-2: #c0662b;
	--chart-3: #2f7d4f;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
	--font: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Malayalam", "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #14161c; --panel: #1c1f27; --ink: #e8eaf0; --muted: #a2a9b8; --line: #2e323d; --brand: #8ea3e6; --brand-2: #b79be0; --brand-ink: #10131a; --soft: #232838;
		--ok: #6fcf97; --ok-bg: #1d3226; --info: #8fb4ec; --info-bg: #1d2a3d; --warn: #e9b65c; --warn-bg: #352a17; --alert: #f08a84; --alert-bg: #3a1f1e;
		--chart-1: #8ea3e6; --chart-2: #f0a26a; --chart-3: #6fcf97; --shadow: none;
	}
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.smr { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.boot { padding: 40px; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.brand strong { display: block; letter-spacing: .08em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--soft); }
.nav a.on { background: var(--soft); color: var(--brand); font-weight: 600; }
.nav .badge { margin-left: auto; }
.side .who { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side .who b { color: var(--ink); display: block; }
.main { padding: 22px 26px 60px; min-width: 0; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.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)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card .k { color: var(--muted); font-size: 12.5px; }
.stat { font-size: 1.6rem; font-weight: 700; }
.stat small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--alert); border-color: var(--alert); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* chips */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.draft { background: var(--soft); color: var(--muted); }
.chip.submitted { background: var(--info-bg); color: var(--info); }
.chip.checked { background: #e3f1f1; color: #1e6e6e; }
.chip.verified, .chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.query, .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.alert { background: var(--alert-bg); color: var(--alert); }
.chip.info { background: var(--info-bg); color: var(--info); }
@media (prefers-color-scheme: dark) { .chip.checked { background: #18302f; color: #7fd3d3; } }
.badge { background: var(--alert); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }

/* messages */
.msg { border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin: 6px 0; border-left: 4px solid; }
.msg.ok { background: var(--ok-bg); border-color: var(--ok); }
.msg.info { background: var(--info-bg); border-color: var(--info); }
.msg.warn { background: var(--warn-bg); border-color: var(--warn); }
.msg.alert { background: var(--alert-bg); border-color: var(--alert); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .lab { font-size: 13.5px; font-weight: 500; }
.field .req { color: var(--alert); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--alert); }
.field .ml { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=search], select, textarea {
	width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 9px; min-height: 36px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: flex-start; font-size: 13.5px; font-weight: 400; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.fields .wide { grid-column: 1 / -1; }
.section { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.section:first-child { border-top: 0; padding-top: 0; }
.section > h3 { margin-bottom: 4px; }
.section > .note { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.gridtbl input, .gridtbl select { min-height: 32px; padding: 4px 6px; font-size: 13px; }
.gridtbl td { padding: 4px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.scorepanel { position: sticky; top: 14px; }
.scorepanel .item { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.scorepanel .item b { text-align: right; }
.scorepanel .item.warn b { color: var(--warn); } .scorepanel .item.alert b { color: var(--alert); } .scorepanel .item.ok b { color: var(--ok); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.ro .val { font-weight: 500; }
.ro .lab { color: var(--muted); font-size: 12.5px; }
.ro .fields > div { border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* person */
.phead { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.avatar { width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-weight: 700; color: var(--brand); flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.timeline td:first-child { white-space: nowrap; }
.spark { width: 100%; height: 70px; display: block; }
.menu-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.menu-forms button { text-align: left; }
.grp { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; grid-column: 1 / -1; }

/* indicators */
.ind { display: grid; grid-template-columns: minmax(0, 1fr) 220px 90px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bar { position: relative; height: 12px; background: var(--soft); border-radius: 6px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--chart-1); border-radius: 6px; }
.bar s { position: absolute; top: -3px; bottom: -3px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); opacity: .35; }
.ind.lower .bar i { background: var(--chart-2); }
.hbars div { display: grid; grid-template-columns: 180px 1fr 40px; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }

/* modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; padding: 18px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; max-width: 90vw; }
.toast.err { background: var(--alert); color: #fff; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(400px, 100%); box-shadow: var(--shadow); }
.login-card .brand { padding: 0 0 16px; }
.login-card p label { display: block; font-size: 13.5px; margin-bottom: 4px; }
.login-card input[type=text], .login-card input[type=password] { margin-bottom: 4px; }
.login-card input[type=submit] { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; width: 100%; }
.login-card .note { color: var(--muted); font-size: 12.5px; }

/* card print */
.idcard { border: 2px solid var(--brand); border-radius: 12px; padding: 14px; max-width: 420px; }
.idcard .big { font-size: 1.3rem; font-weight: 700; letter-spacing: .05em; }

@media (max-width: 980px) {
	.form-layout { grid-template-columns: 1fr; }
	.scorepanel { position: static; }
	.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.g3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
	.shell { grid-template-columns: 1fr; }
	.side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.2); }
	.side.open { transform: none; }
	.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
	.main { padding: 14px 16px 60px; }
	.g2, .g4 { grid-template-columns: 1fr; }
	.ind { grid-template-columns: 1fr; }
	.hbars div { grid-template-columns: 110px 1fr 34px; }
	.fields { grid-template-columns: 1fr; }
}
@media print {
	.side, .topbar, .actions, .noprint, .btn { display: none !important; }
	.shell { display: block; }
	.main { padding: 0; }
	body.smr { background: #fff; color: #000; }
	.card { box-shadow: none; }
}
.row > select, .row > input[type=search] { width: auto; flex: 1 1 170px; }
.tbl td.mono, .tbl td.nw { white-space: nowrap; }
.row > input[type=number] { width: auto; flex: 1 1 80px; }
