/* idea-buzz console — DARK-FIRST theme (session 2).
   Default: dark (data-theme="dark" on <html>, or no attribute).
   Light theme opt-in via <html data-theme="light">, persisted by app.js.
   Palette: deep slate #0b0e14 · panels #10141c · Cloudflare orange #f6821f */

:root, html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7ecf4;            /* primary text */
  --ink-soft: #aeb9c9;       /* secondary text */
  --ink-faint: #74808f;      /* faint text */
  --paper: #0e1219;          /* content area */
  --panel: #10141c;          /* sidebar / panels */
  --card: #151b25;           /* raised surfaces (login card, table heads) */
  --line: #212a38;           /* hairlines */
  --accent: #f6821f;         /* Cloudflare orange */
  --accent-ink: #ffb066;     /* links / accent text on dark */
  --accent-soft: rgba(246, 130, 31, 0.14);
  --danger: #ff8a80;
  --input-bg: #0b0f16;
  --code-bg: #0a0d12;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
html[data-theme="light"] {
  color-scheme: light;
  --ink: #10141c;
  --ink-soft: #47505e;
  --ink-faint: #8b95a3;
  --paper: #ffffff;
  --panel: #f6f7f4;
  --card: #ffffff;
  --line: #e6e8e2;
  --accent: #f6821f;
  --accent-ink: #b35300;
  --accent-soft: #fdeadd;
  --danger: #c0392b;
  --input-bg: #fbfcfa;
  --code-bg: #10141c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.65 -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
  color: var(--ink);
  background: var(--paper);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(246, 130, 31, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(246, 130, 31, 0.10), transparent 55%),
    linear-gradient(160deg, #070a10 0%, #10141c 55%, #17130c 100%);
  padding: 24px;
}
html[data-theme="light"] .login-wrap {
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(246, 130, 31, 0.22), transparent 60%),
    linear-gradient(160deg, #10141c 0%, #1c2230 55%, #2b2113 100%);
}
.login-card {
  width: min(380px, 92vw); background: var(--card); border-radius: 14px;
  border: 1px solid var(--line);
  padding: 34px 34px 26px; box-shadow: var(--shadow);
  text-align: center;
}
.login-card.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }
.login-logo { font-size: 30px; }
.login-card h1 { margin: 6px 0 2px; font-size: 26px; letter-spacing: .5px; }
.login-sub { margin: 0 0 22px; color: var(--ink-faint); font-size: 13px; }
.login-card label { display: block; text-align: left; margin: 12px 0; }
.login-card label span { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.login-card input {
  width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--input-bg); color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 13px; margin: 4px 0 10px; min-height: 18px; }
#login-btn {
  width: 100%; padding: 11px; font-size: 15px; font-weight: 600; color: #fff;
  background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; margin-top: 6px;
}
#login-btn:hover { filter: brightness(1.1); }
.login-mode { margin: 14px 0 0; font-size: 11px; color: var(--ink-faint); }

/* ---------- shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 16px;
  background: var(--panel); color: #e7ecf4; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.nav-toggle { display: none; background: 0; border: 0; color: inherit; font-size: 20px; cursor: pointer; }
.topbar-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand { font-weight: 700; letter-spacing: .4px; }
.crumb { color: var(--ink-faint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.auth-mode { font-size: 11px; color: var(--ink-faint); border: 1px solid var(--line); padding: 2px 8px; border-radius: 99px; }
.ghost-btn {
  background: 0; color: inherit; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

.layout { display: flex; min-height: 0; flex: 1 1 auto; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 264px; flex: 0 0 auto; overflow-y: auto; background: var(--panel);
  border-right: 1px solid var(--line); padding: 14px 10px 30px;
}
.side-group { margin-top: 18px; }
.side-group:first-child { margin-top: 2px; }
.side-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ink-faint); padding: 0 10px 6px;
}
.side-item {
  display: block; width: 100%; text-align: left; border: 0; background: 0;
  padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--ink-soft);
  cursor: pointer; line-height: 1.35;
}
.side-item:hover { background: var(--card); color: var(--ink); }
.side-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ---------- content ---------- */
.content {
  flex: 1 1 auto; overflow-y: auto; scroll-behavior: smooth; background: var(--paper);
  padding: 34px clamp(20px, 5vw, 72px) 90px; outline: none;
}
.content-loading { color: var(--ink-faint); }
.doc { max-width: 980px; margin: 0 auto; }
.doc h1 { font-size: 27px; line-height: 1.25; margin: 4px 0 4px; }
.doc .doc-file { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); margin: 0 0 22px; }
.doc h2 { font-size: 21px; margin: 34px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h2:first-of-type { border-top: 0; }
.doc h3 { font-size: 17px; margin: 26px 0 8px; }
.doc p { margin: 10px 0; }
.doc a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.doc code {
  font-family: var(--mono); font-size: 12.5px; background: var(--card);
  padding: 1px 5px; border-radius: 5px;
}
.doc pre {
  background: var(--code-bg); color: #e7ebf3; padding: 18px; border-radius: 10px;
  border: 1px solid var(--line);
  overflow-x: auto; line-height: 1.5;
}
html[data-theme="light"] .doc pre { border-color: transparent; }
.doc pre code { background: 0; color: inherit; padding: 0; font-size: 12.5px; }
.doc table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13.5px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--card); }
.doc tr:nth-child(even) td { background: rgba(127, 152, 188, 0.06); }
.doc blockquote { margin: 14px 0; padding: 6px 16px; border-left: 3px solid var(--accent); background: var(--panel); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.doc ul { padding-left: 22px; }

/* ---------- notice ---------- */
.notice {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 18px;
  box-shadow: var(--shadow); font-size: 13.5px; max-width: min(520px, 90vw);
  z-index: 60;
}
.notice a { color: var(--accent-ink); }

/* ---------- scrollbars ---------- */
.sidebar::-webkit-scrollbar, .content::-webkit-scrollbar { width: 10px; height: 10px; }
.sidebar::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: content-box;
}
::selection { background: var(--accent-soft); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 40; top: 54px; bottom: 0; left: 0;
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: 8px 0 24px rgba(0,0,0,.45);
  }
  .app.nav-open .sidebar { transform: none; }
  .nav-toggle { display: inline-block; }
  .content { padding: 24px 18px 80px; }
}
