:root {
  --ink: #1f2328;
  --soft: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f7f8;
  --accent: #ff7a45;
  --accent-soft: #ffede4;
  --go: #22a06b;
  --bad: #d93a3a;
  --warn: #b7791f;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
.bn, textarea.bn, input.bn { font-family: "Noto Sans Bengali", "Kohinoor Bangla", sans-serif; }
.hi, textarea.hi, input.hi { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif; }
.muted { color: var(--soft); }
.small { font-size: 13px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 24px 0 10px; }

/* Sidebar */
#side { width: 260px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--soft); }
#library { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
#library a { display: block; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none; cursor: pointer; }
#library a:hover { background: var(--bg); }
#library a.on { background: var(--accent-soft); }
#library a .t { font-weight: 600; }
#library a .s { font-size: 12px; color: var(--soft); }

/* Buttons and fields */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #cfd3d8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); width: 100%; }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; font-size: 16px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; background: #fff; font-weight: 500; color: var(--ink); cursor: pointer; }
.chips input { width: auto; }

/* Editor */
#main { flex: 1; min-width: 0; }
.empty { padding: 80px 48px; }
.bar { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; gap: 24px; align-items: center; justify-content: space-between; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--soft); cursor: pointer; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tab-body { padding: 24px 28px 80px; max-width: 1100px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* Pages */
.page { display: grid; grid-template-columns: 240px 1fr; gap: 18px; margin-bottom: 16px; }
.page .pid { font-weight: 700; }
.drop { aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--soft); cursor: pointer; overflow: hidden; background: var(--bg); position: relative; }
.drop img { width: 100%; height: 100%; object-fit: cover; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.small { aspect-ratio: 4 / 3; width: 110px; }
.choice { display: grid; grid-template-columns: 110px 1fr 1fr 160px auto; gap: 8px; align-items: center; margin-top: 8px; }
.flow { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* Record */
.rec { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.takes { max-height: calc(100vh - 160px); overflow: auto; }
.take { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.take:hover { background: var(--bg); }
.take.on { background: var(--accent-soft); }
.take .tick { width: 16px; flex: none; color: var(--go); font-weight: 700; }
.take .name { color: var(--soft); font-size: 12px; flex: none; width: 70px; }
.prompter { font-size: 40px; line-height: 1.5; min-height: 200px; padding: 24px; }
.meter { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--go); transition: width 60ms linear; }
.state { font-weight: 700; }
.state.rec-on { color: var(--bad); }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; background: #fff; }

/* Publish */
.issues li { margin: 4px 0; }
.issues .error { color: var(--bad); }
.issues .warning { color: var(--warn); }
.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre-wrap; background: #111827; color: #e5e7eb; border-radius: 10px; padding: 12px; max-height: 300px; overflow: auto; }

dialog { border: 0; border-radius: 16px; padding: 22px; width: min(640px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(17,24,39,.35); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
