/* Layout CSS — loaded in <head> on purpose (correct first paint, no layout shift). */
:root { --font: system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans Devanagari","Nirmala UI",Mangal,sans-serif;
  --topbar-h:60px; --side-w:248px; --r:10px; --r-sm:6px; --gap:16px; }
*,*::before,*::after { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; scroll-padding-top:76px; }
body { margin:0; background:var(--bg); color:var(--ink); font:400 15px/1.55 var(--font); -webkit-font-smoothing:antialiased; }
:lang(mr) body, :lang(hi) body { line-height:1.7; }
h1,h2,h3,p,ul,ol,figure,dl { margin:0; }
ul[role=list] { list-style:none; padding:0; }
img,svg { max-width:100%; }
a { color:var(--primary); }
button,input,select { font:inherit; color:inherit; }
:focus-visible { outline:3px solid var(--primary); outline-offset:2px; }
.i { width:20px; height:20px; flex:none; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; }
.logo-mark { width:30px; height:30px; flex:none; }
.skip { position:absolute; left:8px; top:-60px; background:var(--primary); color:#fff; padding:10px 14px; border-radius:var(--r-sm); z-index:99; }
.skip:focus { top:8px; }
.i18n-wait [data-i18n] { visibility:hidden; }
.hide { display:none !important; }
.spacer { flex:1; }
.muted { color:var(--muted); }
/* Devanagari: negative tracking breaks conjuncts */
h1,h2,h3 { letter-spacing:-.015em; line-height:1.2; }
:lang(mr) :is(h1,h2,h3), :lang(hi) :is(h1,h2,h3) { letter-spacing:0; line-height:1.4; }

/* ---------- App shell (fixed sizes => zero layout shift) ---------- */
.topbar { position:fixed; inset:0 0 auto 0; height:var(--topbar-h); z-index:30; display:flex; align-items:center; gap:12px;
  padding:0 16px; background:var(--surface); border-bottom:1px solid var(--line); }
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--ink); font-weight:700; font-size:18px; }
.sidebar { position:fixed; top:var(--topbar-h); bottom:0; left:0; width:var(--side-w); overflow-y:auto; z-index:20;
  background:var(--surface); border-right:1px solid var(--line); padding:8px 10px 24px; }
.main { margin-left:var(--side-w); padding:calc(var(--topbar-h) + 28px) 32px 56px; }
.page { max-width:1180px; }
.page-h { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:8px 16px; margin-bottom:20px; }
.page-h h1 { font-size:26px; }
.scrim { display:none; }
.icon-btn { flex:none; display:inline-grid; place-items:center; width:40px; height:40px; border:0; background:transparent; border-radius:var(--r-sm); cursor:pointer; color:var(--ink); }
.icon-btn:hover { background:var(--soft); }
.menu-btn { display:none; }
.nav-group h2 { font-size:12.5px; font-weight:600; color:var(--muted); padding:16px 12px 6px; }
.nav a { display:flex; align-items:center; gap:12px; min-height:42px; padding:0 12px; border-radius:var(--r-sm); color:var(--ink); text-decoration:none; }
.nav a:hover { background:var(--soft); }
.nav a[aria-current=page] { background:var(--soft); color:var(--primary); font-weight:600; }
.nav a[aria-disabled=true] { color:var(--muted); }
.nav a .badge { margin-left:auto; }
.stack > * + * { margin-top:var(--gap); }
.grid-2 { display:grid; grid-template-columns:3fr 2fr; gap:var(--gap); align-items:start; }

@media (max-width:960px) {
  .main { margin-left:0; padding:calc(var(--topbar-h) + 20px) 16px 48px; }
  .menu-btn { display:inline-grid; }
  .sidebar { transform:translateX(-100%); transition:transform .18s ease; width:min(300px,86vw); z-index:41; }
  .nav-open .sidebar { transform:none; }
  .nav-open .scrim { display:block; position:fixed; inset:0; background:rgba(16,22,34,.45); z-index:40; }
  .grid-2 { grid-template-columns:1fr; }
  .hide-sm { display:none !important; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important; animation:none !important; } }

/* loading spinner (see boot.js) */
#boot-spin { display:none; position:fixed; top:76px; left:50%; width:34px; height:34px; margin-left:-17px; z-index:3000; box-sizing:border-box; border:3px solid var(--line); border-top-color:var(--primary); border-radius:50%; background:var(--surface,#fff); box-shadow:0 1px 6px rgba(0,0,0,.18); animation:boot-spin .8s linear infinite; }
#boot-spin.on { display:block; }
@keyframes boot-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { #boot-spin { animation-duration:2.4s; } }
@media print { #boot-spin { display:none !important; } }
/* tab bar for long settings pages (core/tabs.js) */
.tabbar { display:flex; gap:2px; flex-wrap:wrap; border-bottom:1px solid var(--line); }
.tabbar button { background:none; border:0; border-bottom:2px solid transparent; margin-bottom:-1px; padding:10px 14px; font:inherit; font-weight:600; color:var(--muted); cursor:pointer; }
.tabbar button:hover { color:var(--ink); }
.tabbar button[aria-selected="true"] { color:var(--primary); border-bottom-color:var(--primary); }
.tabbar button:focus-visible { outline:2px solid var(--primary); outline-offset:-2px; }
