/* ---------------------------------------------------------------- themes
   Every colour comes from these variables. Themes override them via <html data-theme="...">. */
:root {
  --bg: #f6f5f1; --panel: #ffffff; --panel-2: #fcfcfa; --subtle: #eef0f3; --ink: #1d2433; --ink-2: #475467; --muted: #667085;
  --line: #e4e2da; --line-2: #efede7; --input-line: #d0d5dd; --hover: #f4f6f9; --focus: #b6cdf0; --hover-line: #b8c4d6; --tree-line: #cfd6e3;
  --accent: #1f4e79; --accent-2: #2d6aa3; --accent-soft: #e8eff7; --on-accent: #ffffff;
  --ok: #1e7b4f; --ok-soft: #e4f4ec; --ok-ink: #134d31; --warn: #a15c00; --warn-soft: #fdf1df; --warn-ink: #6b3d00;
  --bad: #b42318; --bad-soft: #fdebea; --bad-ink: #7a1a12; --info-ink: #173a5e; --todo: #fff3c4;
  --side: #14213d; --side-ink: #dfe6f2; --side-2: #1f2f52; --side-3: #2c3f68; --side-active: #2d4a7c; --side-muted: #9fb0cc; --side-line: #263a62; --side-strong: #ffffff;
  --hero-a: #14213d; --hero-b: #1f4e79; --hero-ink-2: #c9d6ea; --toast: #1d2433; --gold: #ffc857;
  --q1-bg: #dcf3e6; --q1: #126b3c; --q2-bg: #e2edfb; --q2: #1f4e79; --q3-bg: #fdf1df; --q3: #8a4f00; --q4-bg: #f2e9e8; --q4: #7a3a32;
  --radius: 10px; color-scheme: light;
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif; --head-weight: 700; --head-vari: normal;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
}
/* Midnight (dark) */
:root[data-theme="dark"] {
  --bg: #0f1420; --panel: #171d2b; --panel-2: #1b2232; --subtle: #232b3c; --ink: #e6e9f0; --ink-2: #c3cad8; --muted: #8f99ab;
  --line: #2a3346; --line-2: #232b3c; --input-line: #36405a; --hover: #1f2738; --focus: #2f4f80; --hover-line: #46536f; --tree-line: #33405a;
  --accent: #6aa3e8; --accent-2: #8bb8f0; --accent-soft: #1c2c46; --on-accent: #0b1220;
  --ok: #4cc98a; --ok-soft: #12301f; --ok-ink: #a8e6c4; --warn: #f0b45a; --warn-soft: #3a2a12; --warn-ink: #f3d6a4;
  --bad: #f2766b; --bad-soft: #3a1614; --bad-ink: #f7b8b2; --info-ink: #bcd4f5; --todo: #4a3f12;
  --side: #0b1019; --side-ink: #c9d3e6; --side-2: #141b2a; --side-3: #1d2638; --side-active: #22314f; --side-muted: #7f8ca6; --side-line: #1d2638;
  --hero-a: #1b2a4a; --hero-b: #0f1830; --toast: #2a3346;
  --q1-bg: #12301f; --q1: #7fdcab; --q2-bg: #1c2c46; --q2: #9cc3f2; --q3-bg: #3a2a12; --q3: #f3c27a; --q4-bg: #3a1e1c; --q4: #f0a49b;
  color-scheme: dark;
}
/* Forest */
:root[data-theme="forest"] {
  --bg: #f4f6f2; --accent: #1f6f50; --accent-2: #2e8a66; --accent-soft: #e3f1ea; --info-ink: #14432f; --focus: #b5dcc8;
  --side: #12302a; --side-2: #1b3f37; --side-3: #255046; --side-active: #2c5e52; --side-line: #1f463d; --side-muted: #9cc0b4; --side-ink: #dcece6;
  --hero-a: #12302a; --hero-b: #1f6f50; --hero-ink-2: #cfe6dc; --q2-bg: #e3f1ea; --q2: #1f6f50;
}
/* Plum */
:root[data-theme="plum"] {
  --bg: #f7f5fa; --accent: #5b3fa6; --accent-2: #7253c4; --accent-soft: #efe9fa; --info-ink: #34226b; --focus: #d3c6f2;
  --side: #23143d; --side-2: #2f1d50; --side-3: #3c2864; --side-active: #4a3279; --side-line: #352155; --side-muted: #b3a3d6; --side-ink: #e8e0f7;
  --hero-a: #23143d; --hero-b: #5b3fa6; --hero-ink-2: #ddd2f3; --q2-bg: #efe9fa; --q2: #5b3fa6;
}
/* Paper (warm sepia) */
:root[data-theme="paper"] {
  --bg: #f3ede2; --panel: #fffdf8; --panel-2: #fbf7ef; --line: #e3d9c7; --line-2: #ebe3d3; --subtle: #efe7d8;
  --accent: #8a4b2a; --accent-2: #a65f39; --accent-soft: #f6e9df; --info-ink: #5a2e17; --focus: #e9c9b4;
  --side: #3b2a20; --side-2: #4a362a; --side-3: #5a4334; --side-active: #6b4f3c; --side-line: #4f3a2d; --side-muted: #c9b29d; --side-ink: #f1e6da;
  --hero-a: #3b2a20; --hero-b: #8a4b2a; --hero-ink-2: #f0dccb; --q2-bg: #f6e9df; --q2: #8a4b2a;
}
/* Ocean (teal) */
:root[data-theme="ocean"] {
  --bg: #f2f7f7; --accent: #0f766e; --accent-2: #14918a; --accent-soft: #e0f2f0; --info-ink: #0b4a45; --focus: #b3e0db;
  --side: #0f3d4a; --side-2: #164c5b; --side-3: #1d5b6c; --side-active: #236a7d; --side-line: #1a5260; --side-muted: #9fc6cf; --side-ink: #ddf0f3;
  --hero-a: #0f3d4a; --hero-b: #0f766e; --hero-ink-2: #cdeae6; --q2-bg: #e0f2f0; --q2: #0f766e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); display: flex; overflow: hidden; }
a { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: var(--head-weight); font-variation-settings: var(--head-vari); margin: 0 0 .4em; }
/* logo style also sets the heading typeface, so the whole app matches the logo */
:root[data-logo="editorial"] { --serif: "DM Serif Display", Georgia, serif; --head-weight: 400; --head-vari: normal; }
:root[data-logo="soft"] { --serif: "Fraunces", Georgia, serif; --head-weight: 600; --head-vari: "SOFT" 100; }
.brand b, .big-score, .result .t, .prose h1, .prose h2, .prose h3 { font-variation-settings: var(--head-vari); }
.logo-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.logo-pick button { border: 2px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px 8px 10px; cursor: pointer; color: var(--ink); font: 500 12px var(--sans); }
.logo-pick button img { width: 52px; height: 52px; display: block; margin: 0 auto 8px; }
.logo-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }

/* sidebar */
#sidebar { width: 232px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 6px 18px; }
.brand b { display: block; font-family: var(--serif); font-size: 17px; color: var(--side-strong); }
.brand small { color: var(--side-muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.logo { width: 38px; height: 38px; border-radius: 9px; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.brand b { letter-spacing: .06em; }
.proj-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 0 6px; }
.proj-row { display: flex; gap: 6px; margin: 4px 0 14px; }
.proj-row select { flex: 1; background: var(--side-2); color: var(--side-strong); border: 1px solid var(--side-3); border-radius: 7px; padding: 6px; min-width: 0; }
.icon-btn { background: var(--side-3); color: var(--side-strong); border: 0; border-radius: 7px; width: 30px; cursor: pointer; font-size: 16px; }
#nav a { display: flex; gap: 10px; align-items: center; color: var(--side-ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
#nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
#nav a:hover { background: var(--side-2); }
#nav a.active { background: var(--side-active); color: var(--side-strong); }
.side-foot { margin-top: auto; font-size: 12px; color: var(--side-muted); padding: 8px 6px; border-top: 1px solid var(--side-line); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #f59e0b; }
.dot.ok { background: #34d399; }

/* main */
#main { flex: 1; overflow: auto; padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); max-width: 760px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.split-wide { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split, .split-wide, .g2, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { #sidebar { display: none; } #main { padding: 16px; } }

/* forms */
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 10px 0 4px; }
label.f small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=email], select, textarea {
  width: 100%; border: 1px solid var(--input-line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--panel); color: var(--ink); }
textarea { resize: vertical; min-height: 80px; }
textarea.mono, .mono { font-family: Consolas, "Cascadia Code", monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); border-color: var(--accent-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }

.btn { border: 1px solid var(--input-line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 13px; font: 500 13px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted); } .small { font-size: 12px; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.gray { background: var(--subtle); color: var(--ink-2); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn-ink); margin-bottom: 14px; }
.notice.info { background: var(--accent-soft); color: var(--info-ink); }
.notice.ok { background: var(--ok-soft); color: var(--ok-ink); }
.notice.bad { background: var(--bad-soft); color: var(--bad-ink); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: 500 13px var(--sans); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.stepper button { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 13px 6px 7px; cursor: pointer; font: 500 13px var(--sans); color: var(--ink-2); }
.stepper button b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle); font-size: 11px; }
.stepper button.done b { background: var(--ok); color: var(--on-accent); }
.stepper button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.stepper button.active b { background: var(--accent); color: var(--on-accent); }
.stepper .phase { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); align-self: center; margin: 0 4px 0 10px; }

/* prose */
.prose { font-family: var(--serif); font-size: 16px; line-height: 1.7; max-width: 860px; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 21px; margin-top: 1.3em; } .prose h3 { font-size: 17px; margin-top: 1.1em; }
.prose table { border-collapse: collapse; font-family: var(--sans); font-size: 13px; margin: 12px 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.prose th { background: var(--subtle); }
.prose blockquote { border-left: 3px solid var(--line); margin: 0; padding-left: 14px; color: var(--ink-2); }
.prose code { background: var(--subtle); padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.cite { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 4px; font-family: var(--sans); font-size: .82em; white-space: nowrap; }
.cite.missing { background: var(--bad-soft); color: var(--bad); }
.todo { background: var(--todo); padding: 0 3px; border-radius: 3px; }
.scroll { max-height: 70vh; overflow: auto; }

/* research tree */
.tree { list-style: none; padding-left: 0; margin: 0; }
.tree .tree { padding-left: 22px; border-left: 1px dashed var(--tree-line); margin-left: 9px; }
.node { margin: 8px 0; }
.node-head { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.node-head .st { flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 2px; display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--muted); }
.st.searching, .st.analyzing { background: #f59e0b; animation: pulse 1.2s infinite; }
.st.done { background: var(--ok); } .st.error { background: var(--bad); }
@keyframes pulse { 50% { opacity: .45; } }
.node-q { font-weight: 600; } .node-goal { font-size: 12px; color: var(--muted); }
.node-body { margin: 6px 0 0 26px; font-size: 13px; display: none; }
.node.open .node-body { display: block; }
.node-body ul { margin: 4px 0; padding-left: 18px; }
.statusbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--accent-soft); border-radius: 8px; font-size: 13px; margin-bottom: 12px; }

/* lists */
.list-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel); cursor: pointer; }
.list-item:hover { border-color: var(--hover-line); }
.list-item.active { border-color: var(--accent); background: var(--accent-soft); }
.list-item .t { font-weight: 600; font-size: 13px; }
.result { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.result:last-child { border-bottom: 0; }
.result .t { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.result .m { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.result .abs { font-size: 13px; color: var(--ink-2); }
.result .abs.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
table.lib { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lib th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.lib td { border-bottom: 1px solid var(--line-2); padding: 8px; vertical-align: top; }
table.lib tr:hover td { background: var(--panel-2); cursor: pointer; }
.key { font-family: Consolas, monospace; font-size: 12px; color: var(--accent); }

/* scores */
.score-row { display: grid; grid-template-columns: 210px 1fr 40px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.bar { height: 8px; background: var(--subtle); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent-2); border-radius: 99px; }
.big-score { font: 700 40px var(--serif); }
.metric { display: inline-flex; flex-direction: column; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; margin: 0 8px 8px 0; background: var(--panel); }
.metric b { font-size: 18px; } .metric span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* editor */
.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-wrap.single { grid-template-columns: 1fr; }
.editor-wrap textarea { min-height: 62vh; font-family: Consolas, "Cascadia Code", monospace; font-size: 13.5px; line-height: 1.6; }
.editor-wrap .preview { min-height: 62vh; max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; background: var(--panel); }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.outline-sec { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }

/* modal & toasts */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); color: var(--ink); border-radius: 12px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 20px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-box.wide { width: min(1000px, 100%); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--toast); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; max-width: 420px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }

.hero { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-radius: 14px; padding: 28px 30px; margin-bottom: 18px; }
.hero h1 { font-size: 30px; color: #fff; } .hero p { color: var(--hero-ink-2); max-width: 720px; margin: 0; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1000px) { .flow { grid-template-columns: 1fr 1fr; } }
.flow a { text-decoration: none; color: inherit; }
.flow .card { height: 100%; transition: border-color .15s; }
.flow .card:hover { border-color: var(--accent-2); }
.flow .n { font: 700 13px var(--sans); color: var(--accent-2); }

.pill.q1 { background: var(--q1-bg); color: var(--q1); } .pill.q2 { background: var(--q2-bg); color: var(--q2); }
.pill.q3 { background: var(--q3-bg); color: var(--q3); } .pill.q4 { background: var(--q4-bg); color: var(--q4); }
.result .btn.ghost { color: var(--accent-2); }

/* copyright */
.side-copy { font-size: 11px; color: var(--side-muted); padding: 6px 6px 0; }
.heart { color: #e5484d; }
.app-footer { margin-top: 40px; padding: 18px 2px 4px; border-top: 1px solid var(--line); display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.app-footer img { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 6px; }

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-sw { border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: var(--panel); text-align: left; font: 500 12px var(--sans); color: var(--ink); }
.theme-sw.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-sw .pv { display: grid; grid-template-columns: 28% 1fr; height: 54px; }
.theme-sw .pv i { display: block; } .theme-sw .pv span { display: flex; flex-direction: column; gap: 5px; padding: 8px; }
.theme-sw .pv b { display: block; height: 7px; border-radius: 4px; }
.theme-sw div.nm { padding: 6px 9px; }

/* the note behind the heart */
.dedi-heart { background: none; border: 0; padding: 0 2px; font: inherit; color: #e5484d; cursor: pointer; display: inline-block; transition: transform .2s; }
.dedi-heart:hover, .dedi-heart:focus-visible { animation: beat 1s ease-in-out infinite; outline: none; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.3); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } }
.dedi { text-align: center; padding: 18px 10px 6px; max-width: 460px; margin: 0 auto; }
.dedi img { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 6px 18px rgba(20,33,61,.18); }
.dedi h2 { font-size: 24px; margin: 16px 0 10px; }
.dedi p { font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 0 0 14px; }
.dedi .sig { font-family: var(--serif); font-style: italic; color: var(--muted); margin-bottom: 18px; }

/* phones: a menu button opens the sidebar over the page */
#menuBtn { display: none; }
@media (max-width: 760px) {
  #menuBtn { display: grid; place-items: center; position: fixed; top: 10px; left: 10px; z-index: 40; width: 42px; height: 42px; border-radius: 11px; border: 0; background: var(--side); color: var(--side-ink); font-size: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.28); cursor: pointer; }
  #main { padding-top: 64px; }
  body.nav-open #sidebar { display: flex; position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; overflow-y: auto; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .modal-box, .modal-box.wide { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
}

/* the heart window: a note, and the private chat (static/chat) */
.dedi-heart { position: relative; }
.dedi-heart.has-msg::after { content: ""; position: absolute; top: -1px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 0 2px var(--panel); }
.dedi-heart.has-msg { animation: beat 1.2s ease-in-out infinite; }
.dedi-tabs { display: flex; justify-content: center; gap: 6px; margin: -4px 0 6px; }
.dedi-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 600 13px var(--sans); color: var(--muted); cursor: pointer; }
.dedi-tabs button.on { background: var(--accent-soft); color: var(--ink); }
.dedi-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 11px; line-height: 18px; }

/* ---------------------------------------------------------------- Slides studio */
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
.dgal { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dgal.small-gal { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.dcard { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.small-gal .dcard { cursor: pointer; }
.small-gal .dcard:hover { border-color: var(--hover-line); }
.dcard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dcard img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--subtle); }
.dcard .dmeta { padding: 8px 10px; }
.dcard .t { font-weight: 600; font-size: 13px; }
.small-gal .dcard .dmeta { padding: 6px 8px; font-size: 12px; }
.dcard .sw { display: flex; gap: 3px; margin: 5px 0 3px; }
.dcard .sw i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line); }
.orow { display: flex; gap: 6px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.orow > select { width: 110px; flex: none; }
.orow .grow { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.orow .col { display: flex; flex-direction: column; gap: 3px; }
.orow .col button { border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); border-radius: 6px; width: 26px; height: 24px; cursor: pointer; }
.srow { border-bottom: 1px solid var(--line-2); padding: 6px 0; }
.srow summary { cursor: pointer; font-size: 13px; }
.srow > input, .srow > textarea { margin-top: 5px; }

/* ---------------------------------------------------------------- Tugas (folders on disk) */
.tg { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .tg { grid-template-columns: 1fr; } }
.tg-tree { padding: 8px 6px; margin: 0; max-height: 72vh; overflow: auto; }
.tg-main { margin: 0; min-height: 60vh; }
.tg-main.drop, .tg-row.drop, .tg-item.drop, .tg-crumbs a.drop { outline: 2px dashed var(--accent-2); outline-offset: -2px; background: var(--accent-soft); }
.tg-row { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.tg-row a { color: var(--ink); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-row:hover { background: var(--hover); } .tg-row.on { background: var(--accent-soft); } .tg-row.on a { color: var(--accent); font-weight: 600; }
.tg-caret { width: 16px; flex: none; text-align: center; color: var(--muted); cursor: pointer; font-size: 11px; user-select: none; }
.tg-caret.none { visibility: hidden; }
.tg-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.tg-crumbs a { color: var(--accent-2); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.tg-crumbs a:hover { background: var(--hover); }
.tg-info { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
#tgselbar { align-items: center; padding: 8px 12px; }
#tgselbar.hidden { display: none; }
.tg-up { display: flex; gap: 10px; align-items: center; padding: 3px 0; font-size: 13px; }
.tg-link a { color: inherit; text-decoration: none; } .tg-link button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 0 0 4px; font-size: 14px; line-height: 1; }
.tg-grid.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.tg-grid.grid .tg-item { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 8px 8px; gap: 6px; }
.tg-grid.grid .tg-date { display: none; }
.tg-grid.grid .tg-meta { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.tg-item { border: 1px solid transparent; border-radius: 8px; cursor: default; user-select: none; min-width: 0; }
.tg-item:hover { background: var(--hover); } .tg-item.sel { background: var(--accent-soft); border-color: var(--focus); }
.tg-name { font-size: 13px; font-weight: 500; word-break: break-word; max-width: 100%; }
.tg-ico { width: 48px; height: 40px; flex: none; }
.tg-file { display: grid; place-items: center; border-radius: 6px; color: #fff; font-size: 11px; letter-spacing: .04em; background: var(--muted); }
.tg-file.pptx { background: #c8502d; } .tg-file.docx { background: #2b6cb0; } .tg-file.pdf { background: #b42318; } .tg-file.image { background: #2f8f6b; }
.tg-grid.list { display: block; }
.tg-grid.list .tg-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) 220px 100px; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 6px; }
.tg-grid.list .tg-item.head { border-bottom: 1px solid var(--line); border-radius: 0; background: none; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.tg-grid.list .tg-ico { width: 28px; height: 24px; font-size: 8px; }
.tg-grid.list .tg-name { font-weight: 500; }
.tg-edit { width: 100%; padding: 2px 6px !important; font-size: 13px !important; text-align: inherit; }
.tg-hit { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.tg-hit:hover { background: var(--hover); } .tg-hit .tg-ico { width: 32px; height: 28px; font-size: 9px; }
.tg-pick { display: flex; gap: 8px; align-items: center; padding: 4px 2px; font-size: 13px; cursor: pointer; }
.tg-menu { position: fixed; z-index: 70; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 5px; }
.tg-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); padding: 7px 10px; border-radius: 6px; font: 13px var(--sans); cursor: pointer; }
.tg-menu button:hover { background: var(--hover); } .tg-menu button.danger { color: var(--bad); }
.tg-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---- Create into PPT (static/create.js) */
.cw-steps { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.cw-step { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 99px; padding: 5px 14px 5px 6px; font: 500 13px var(--sans); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.cw-step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle); font-size: 11px; color: var(--ink-2); }
.cw-step.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); } .cw-step.on b { background: var(--accent); color: var(--on-accent); }
.cw-step.done b { background: var(--ok); color: #fff; } .cw-step:disabled { opacity: .5; cursor: default; }
.cw-nav { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
.cw-nav .grow { flex: 1; }
.cw-mock { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cw-mock { grid-template-columns: 1fr; } }
.cw-list { position: sticky; top: 0; max-height: calc(100vh - 240px); overflow: auto; margin: 0; }
.cw-item { display: flex; gap: 6px; align-items: flex-start; padding: 5px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: grab; background: var(--panel-2); }
.cw-item.sel { border-color: var(--accent); background: var(--accent-soft); } .cw-item.over { border-top: 3px solid var(--accent); }
.cw-n { font-size: 11px; color: var(--muted); width: 14px; padding-top: 2px; } .cw-item .wf { flex: 1; min-width: 0; }
.cw-acts { display: flex; flex-direction: column; gap: 2px; }
.cw-acts button { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 5px; width: 22px; height: 20px; cursor: pointer; font-size: 11px; padding: 0; }
.cw-acts button:disabled { opacity: .4; cursor: default; }
.cw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cw-card { cursor: pointer; padding: 6px; border: 1px solid var(--line); border-radius: 8px; } .cw-card.flag { border-color: var(--warn); } .cw-card:hover { border-color: var(--hover-line); }
/* the wireframe: a plain 16:9 sketch; sizes use the box width (cqw), so thumbnails and the big editor look the same */
.wf { container-type: inline-size; aspect-ratio: 16 / 9; background: #fff; color: #1d2433; border: 1px solid #c9ced8; border-radius: 6px; overflow: hidden; }
.wf-in { height: 100%; padding: 4cqw 5cqw; font: 3cqw/1.35 var(--sans); overflow: hidden; display: flex; flex-direction: column; gap: 2cqw; }
.wf.big { max-width: 880px; }
.wf-t { min-height: 1.3em; outline: none; } .wf-t.title { font-weight: 700; font-size: 4.6cqw; border-bottom: .4cqw solid #c9ced8; padding-bottom: 1cqw; }
.wf-t.h { font-weight: 600; color: #475467; } .wf-t.cap, .wf-t.by { color: #667085; font-size: 2.4cqw; }
.wf-hero { margin: auto 0; display: flex; flex-direction: column; gap: 2cqw; } .wf-t.wfh { font-size: 6.5cqw; font-weight: 700; } .wf-t.sub { font-size: 3.6cqw; color: #475467; }
.wf-ul { margin: 0; padding-left: 4cqw; outline: none; } .wf-ul li { margin-bottom: .8cqw; }
.wf-cols, .wf-row { flex: 1; min-height: 0; display: grid; gap: 3cqw; } .wf-cols, .wf-row { grid-template-columns: 1fr 1fr; }
.wf-img { flex: 1; border: .5cqw dashed #8b93a3; background: #eef0f4; display: grid; place-items: center; align-content: center; color: #667085; font-size: 2.6cqw; text-align: center; padding: 1cqw; min-height: 8cqw; }
.wf-img span { font-size: 2.2cqw; }
.wf-bars { flex: 1; display: flex; align-items: flex-end; gap: 2cqw; border-bottom: .4cqw solid #8b93a3; padding-bottom: 4cqw; min-height: 0; }
.wf-bar { flex: 1; background: #9db4d6; position: relative; } .wf-bar span { position: absolute; top: -3.2cqw; left: 0; right: 0; text-align: center; font-size: 2.2cqw; } .wf-bar em { position: absolute; bottom: -3.6cqw; left: 0; right: 0; text-align: center; font-size: 2.2cqw; font-style: normal; color: #667085; }
.wf-tb { border-collapse: collapse; width: 100%; font-size: 2.6cqw; } .wf-tb td, .wf-tb th { border: 1px solid #c9ced8; padding: .6cqw 1cqw; text-align: left; outline: none; } .wf-tb th { background: #eef0f4; }
.wf-qq { margin: auto 0; } .wf-t.q { font-style: italic; font-size: 4.4cqw; } 
.wf.big [contenteditable]:hover { outline: 1px dashed var(--accent-2); } .wf.big [contenteditable]:focus { outline: 2px solid var(--accent); background: #f5f9ff; }
.wf [contenteditable]:empty::before { content: attr(data-ph); color: #9aa3b2; }
.cw-item .wf { max-width: 260px; }

/* chat pop-up: a bubble bottom right and a small window that leaves the page usable */
#chatFab { position: fixed; right: 18px; bottom: 18px; z-index: 56; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--side); color: #fff; font-size: 24px; box-shadow: 0 6px 20px rgba(0,0,0,.28); display: grid; place-items: center; transition: transform .15s; }
#chatFab:hover { transform: scale(1.06); }
#chatFab .cf-n { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad);
  color: #fff; font: 700 11px/20px system-ui, sans-serif; box-shadow: 0 0 0 2px var(--panel); }
#chatPop { position: fixed; right: 18px; bottom: 84px; z-index: 56; width: 380px; height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 44px rgba(0,0,0,.28); overflow: hidden; }
#chatPop[hidden] { display: none; }
#chatPop.big { width: min(760px, calc(100vw - 36px)); height: calc(100vh - 110px); }
#chatPop .cp-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
#chatPop .cp-btn { border: 0; background: transparent; color: var(--ink); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; text-decoration: none; }
#chatPop .cp-btn:hover { background: var(--bg); }
#chatSlot { flex: 1; background: var(--bg); }
body.chat-open #toasts { bottom: 84px; right: 410px; }
body:not(.chat-open) #toasts { bottom: 84px; }
@media (max-width: 700px) {
  #chatPop, #chatPop.big { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; z-index: 58; }
  body.chat-open #chatFab { display: none; }
  body.chat-open #toasts { right: 18px; }
}

/* Video summary */
.vd-shots { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.vd-shot { width: min(100%, 360px); }
.vd-shot img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--subtle); aspect-ratio: 16/9; object-fit: cover; }
.vd-shot.off img { opacity: .3; filter: grayscale(1); }
.vd-scrub { margin-top: 10px; padding: 10px 12px; background: var(--subtle); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.vd-scrub.hidden { display: none; }
#vmode.hidden, #veveryw.hidden { display: none; }

/* several sources: the picker, and the source line on a wireframe */
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.sp-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 12px; font-weight: 500; }
.sp-chip i { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.sp-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 5px; }
.sp-list { max-height: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.sp-h { padding: 6px 8px 2px; font-weight: 600; } .sp-h span { font-weight: 400; margin-left: 4px; }
.sp-row { display: flex; gap: 8px; align-items: center; padding: 3px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; } .sp-row:hover { background: var(--subtle); }
.sp-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-src { margin-top: auto; font-size: 2.1cqw; color: #667085; border-top: .3cqw solid #e2e5ec; padding-top: .8cqw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* cheatsheet */
.cs-fit { height: 10px; border-radius: 99px; background: var(--subtle); overflow: hidden; } .cs-fit b { display: block; height: 100%; background: var(--ok); border-radius: 99px; } .cs-fit.over b { background: var(--bad); } .cs-fit.warn b { background: var(--warn); }
.cs-sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel); } .cs-sec.over { border-color: var(--accent); }
.cs-it { display: flex; gap: 8px; align-items: flex-start; padding: 4px 2px; border-top: 1px solid var(--line); } .cs-it.off .cs-t { opacity: .45; text-decoration: line-through; } .cs-it.over { border-top: 3px solid var(--accent); }
.cs-t { flex: 1; min-width: 0; outline: none; font-size: 13px; line-height: 1.4; padding: 1px 4px; border-radius: 4px; } .cs-t:focus { background: var(--accent-soft); }
.cs-src { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.cs-acts { display: flex; gap: 2px; } .cs-acts button, .cs-sec button.mini { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 5px; min-width: 22px; height: 22px; cursor: pointer; font-size: 11px; padding: 0 4px; }
.cs-kind { font-size: 11px; width: auto; padding: 1px 2px; }
