:root {
  --bg: #fbf8f3; --panel: #ffffff; --ink: #2b2118; --muted: #7a6b5d; --line: #e7ddd0;
  --accent: #b4531a; --accent-ink: #ffffff; --accent-soft: #f6e7da;
  --warn: #9a5b00; --warn-bg: #fff4dc; --info: #3d5a80; --info-bg: #eaf0f8; --ok: #2f7a3d; --ok-bg: #e6f3e8; --bad: #a3271d; --bad-bg: #fbe9e7;
  --radius: 10px; --deva: "Noto Sans Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1713; --panel: #241f1a; --ink: #efe6dc; --muted: #a8998a; --line: #3a322a;
    --accent: #e0803f; --accent-ink: #1b1713; --accent-soft: #3a2a1d;
    --warn: #f0b85a; --warn-bg: #3a2c12; --info: #9fbbe0; --info-bg: #1f2a38; --ok: #7fcf8c; --ok-bg: #1d3322; --bad: #f08a80; --bad-bg: #3a1d1a;
    color-scheme: dark; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 18px var(--deva); }
.name { font-weight: 600; font-size: 18px; line-height: 1.1; display: flex; flex-direction: column; }
.name b { color: var(--accent); }
.name small { font: 12px var(--deva); color: var(--muted); }
nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
nav a, nav button { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav .who { color: var(--muted); font-size: 13px; padding: 0 6px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; }
main.wide { max-width: none; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 24px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.deva { font-family: var(--deva); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.course { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.course .t { font: 600 17px var(--deva); } .course .s { font: 14px var(--deva); color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
table.list tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.msg.err { background: var(--bad-bg); color: var(--bad); } .msg.ok { background: var(--ok-bg); color: var(--ok); } .msg.warn { background: var(--warn-bg); color: var(--warn); } .msg.info { background: var(--info-bg); color: var(--info); }
.devcode { font: 600 28px ui-monospace, monospace; letter-spacing: .2em; }
.signin { max-width: 420px; margin: 40px auto; }
/* studio grid */
.gridwrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.sheet { border-collapse: separate; border-spacing: 0; min-width: 100%; }
table.sheet th, table.sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; vertical-align: top; }
table.sheet thead th { position: sticky; top: 0; background: var(--bg); z-index: 2; font-size: 12px; padding: 4px 6px; text-align: left; min-width: 90px; }
table.sheet thead th.text, table.sheet thead th.layer { min-width: 280px; }
table.sheet th .colname { font-weight: 600; display: block; }
table.sheet th .coltype { color: var(--muted); font-weight: 400; }
table.sheet td.rn { position: sticky; left: 0; background: var(--bg); font-size: 12px; color: var(--muted); padding: 6px; text-align: right; min-width: 44px; z-index: 1; }
table.sheet td.rn.warn { color: var(--warn); font-weight: 700; }
table.sheet textarea { field-sizing: content; border: 0; border-radius: 0; resize: none; min-height: 34px; padding: 6px 8px; display: block; background: transparent; overflow: hidden; }
table.sheet td.text textarea, table.sheet td.layer textarea { font-family: var(--deva); font-size: 16px; }
table.sheet td.miss textarea { background: var(--warn-bg); }
table.sheet tr.sel td.rn { background: var(--accent-soft); color: var(--accent); }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; position: sticky; top: 64px; background: var(--bg); padding: 6px 0; z-index: 5; }
.warnlist { max-height: 240px; overflow: auto; margin: 0; padding-left: 18px; font-size: 13px; }
.warnlist li.warn { color: var(--warn); } .warnlist li.info { color: var(--info); }
.dz { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); }
.dz.over { border-color: var(--accent); background: var(--accent-soft); }
.notes { list-style: none; padding: 0; margin: 0; } .notes li { padding: 10px 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; }
.notes li.sys { color: var(--muted); font-size: 13px; }
pre.ctx { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 300px; overflow: auto; }
.fab { position: fixed; right: 16px; bottom: 16px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 16px; box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 20; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 70px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: min(560px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.35); }
@media (max-width: 640px) { .toolbar { top: 0; position: static; } nav { margin-left: 0; } }
