:root {
  --bg: #131314;
  --panel: #1e1f20;
  --panel-2: #282a2c;
  --line: #3c4043;
  --text: #e3e3e3;
  --muted: #9aa0a6;
  --accent: #8ab4f8;
  --danger: #f28b82;
  --ok: #81c995;
  --grad: linear-gradient(90deg, #4285f4, #9b72cb 45%, #d96570);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Google Sans", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.4em; }
.grow { flex: 1; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.spark { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; background: var(--grad);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1c.6 5.6 4.4 9.4 11 11-6.6 1.6-10.4 5.4-11 11-.6-5.6-4.4-9.4-11-11 6.6-1.6 10.4-5.4 11-11z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1c.6 5.6 4.4 9.4 11 11-6.6 1.6-10.4 5.4-11 11-.6-5.6-4.4-9.4-11-11 6.6-1.6 10.4-5.4 11-11z'/%3E%3C/svg%3E") center/contain no-repeat; }
.spark.big { width: 44px; height: 44px; }
.spark.spin { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn { border: 0; border-radius: 999px; padding: 10px 18px; background: var(--panel-2); cursor: pointer; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: #a8c7fa; color: #062e6f; font-weight: 600; }
.btn.danger { background: #5c2b29; color: #ffdad6; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: var(--panel-2); }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.chip.active { background: #004a77; border-color: #004a77; color: #c2e7ff; }
.chip.select { appearance: none; background: var(--panel-2); border-color: transparent; padding-right: 14px; }
/* language of the words in the result (🇮🇩 / 🇬🇧): one toggle chip next to ratio / quality */
.chip.lang { background: var(--panel-2); border-color: transparent; white-space: nowrap; }
.chip.lang .flag { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 28px; padding: 32px 28px; display: grid; gap: 14px; text-align: center; }
.login-card h1 { margin: 4px 0 0; font-size: 28px; font-weight: 500; }
.login-card label { display: grid; gap: 6px; text-align: left; font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--panel-2); border: 1px solid transparent; border-radius: 12px; padding: 11px 14px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* layout */
.app { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { width: 272px; flex: none; background: var(--panel); display: flex; flex-direction: column; padding: 12px; gap: 6px; }
.side-top { display: flex; align-items: center; gap: 6px; padding: 4px 6px 10px; }
.brand { color: var(--text); font-size: 18px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.new-chat { text-align: left; background: var(--panel-2); }
.side-label { font-size: 12.5px; color: var(--muted); padding: 14px 12px 4px; }
.chat-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.chat-list { grid-template-columns: minmax(0, 1fr); }
.chat-item { display: flex; align-items: center; border-radius: 999px; min-width: 0; }
.chat-item a { flex: 1; min-width: 0; color: var(--text); padding: 8px 4px 8px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: #004a77; }
.chat-item.active a { color: #c2e7ff; }
.del-chat { flex: none; border: 0; background: transparent; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; font-size: 15px; opacity: 0; transition: opacity .15s; }
.chat-item:hover .del-chat, .chat-item.active .del-chat, .del-chat:focus { opacity: .85; }
.del-chat:hover { background: #5c2b29; opacity: 1; }
@media (hover: none) { .del-chat { opacity: .7; } }
.side-bottom { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 2px; position: relative; }
.side-link { color: var(--text); padding: 8px 12px; border-radius: 999px; }
.side-link:hover, .side-link.active { background: var(--panel-2); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 4px 2px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.me-info { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.me-info b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info small { color: var(--muted); }
.menu { position: absolute; bottom: 52px; right: 4px; background: var(--panel-2); border-radius: 14px; padding: 6px; display: grid; box-shadow: 0 8px 24px #0008; z-index: 5; }
.menu button { border: 0; background: transparent; text-align: left; padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.menu button:hover { background: var(--line); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.top-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.queue-info { font-size: 13px; color: var(--muted); white-space: nowrap; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page { overflow-y: auto; padding: 8px max(16px, calc((100% - 960px) / 2)) 40px; display: block; }
.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: #0009; z-index: 9; }

/* messages */
.messages { flex: 1; overflow-y: auto; padding: 12px max(16px, calc((100% - 820px) / 2)) 24px; scroll-behavior: smooth; }
.welcome { margin-top: 8vh; }
.welcome h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 500; margin: 0; line-height: 1.15; }
.welcome h1 + p { font-size: clamp(20px, 3vw, 30px); color: #444746; margin: 2px 0 28px; }
.suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.suggest button { text-align: left; border: 0; background: var(--panel); border-radius: 16px; padding: 14px; min-height: 110px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.suggest button:hover { background: var(--panel-2); }
.msg { margin: 18px 0; display: flex; gap: 14px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--panel-2); border-radius: 20px 20px 6px 20px; padding: 10px 16px; max-width: min(560px, 85%); white-space: pre-wrap; word-wrap: break-word; }
.msg.user .bubble img { display: block; max-width: 220px; border-radius: 12px; margin-bottom: 8px; }
.msg.ai .spark { flex: none; margin-top: 2px; }
.msg.ai .body { flex: 1; min-width: 0; }
.stage { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.bar { height: 4px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin: 10px 0 2px; max-width: 420px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .6s; }
.result { margin-top: 10px; display: grid; gap: 8px; justify-items: start; }
.result img, .result video { max-width: 100%; max-height: 70vh; border-radius: 16px; background: #000; cursor: zoom-in; }
.result video { cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
details.en { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
details.en summary { cursor: pointer; }
details.en p { white-space: pre-wrap; background: var(--panel); padding: 10px 12px; border-radius: 12px; }
.fail { color: var(--danger); }
.answer { max-width: 680px; line-height: 1.65; }
.answer p { margin: 0 0 10px; }
.answer ul { margin: 0 0 10px; padding-left: 20px; }
.answer li { margin: 3px 0; }
.answer .cite { display: inline-block; font-size: 11px; line-height: 16px; min-width: 16px; padding: 0 4px; margin: 0 1px;
  text-align: center; vertical-align: 2px; border-radius: 8px; background: var(--panel-2); color: var(--accent); }
.sources-label { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sources { margin: 6px 0 0; padding-left: 20px; font-size: 13.5px; }
.sources li { margin: 4px 0; overflow-wrap: anywhere; }
.meta { font-size: 12.5px; color: var(--muted); }
/* chat memory (Feature B): how a follow-up was understood + notes */
.ctx-line { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; overflow-wrap: anywhere; }
.ctx-thumb { height: 32px; width: auto; max-width: 64px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.ctx-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* composer */
.composer-wrap { padding: 0 max(12px, calc((100% - 820px) / 2)) 10px; }
.composer { background: var(--panel); border-radius: var(--radius); padding: 12px 12px 8px 18px; }
.composer textarea { width: 100%; resize: none; background: transparent; border: 0; padding: 4px 0; max-height: 220px; font-size: 16px; }
.composer-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.modes { display: flex; gap: 6px; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #a8c7fa; color: #062e6f; font-size: 17px; cursor: pointer; }
.send:disabled { background: var(--panel-2); color: var(--muted); cursor: default; }
.hint { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.composer-wrap.drop-over .composer { outline: 2px dashed var(--accent); outline-offset: 4px; }
.attach-chip { display: inline-flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 6px 8px 6px 6px; margin-bottom: 8px; }
.attach-chip img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; }

/* pages */
.page h2 { font-weight: 500; }
.drop { display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 20px; padding: 34px 16px; cursor: pointer; margin: 14px 0; }
.drop.over { border-color: var(--accent); background: #8ab4f810; }
.upload-progress { display: grid; gap: 6px; margin-bottom: 10px; }
.upload-progress .row { background: var(--panel); border-radius: 12px; padding: 8px 12px; font-size: 13.5px; }
.tabs { display: flex; gap: 6px; margin: 16px 0 12px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.tab.active { background: #004a77; border-color: #004a77; color: #c2e7ff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.tile .thumb { aspect-ratio: 4/3; background: #000 center/cover no-repeat; display: grid; place-items: center; font-size: 34px; cursor: zoom-in; }
.tile .info { padding: 8px 10px; font-size: 12.5px; display: grid; gap: 4px; }
.tile .info b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 30px 0; }
.card { background: var(--panel); border-radius: 20px; padding: 16px 18px; margin: 14px 0; }
.card h3 { margin: 0 0 12px; font-weight: 500; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; }
.form-row input, .form-row select { flex: 1 1 160px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td .btn { margin: 2px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); }
.badge.off { background: #5c2b29; color: #ffdad6; }
.badge.admin { background: #004a77; color: #c2e7ff; }
.back { display: inline-block; margin: 8px 0; }
.chat-links { display: grid; gap: 6px; }
.chat-links a { background: var(--panel); padding: 10px 14px; border-radius: 12px; color: var(--text); }

.lightbox { position: fixed; inset: 0; background: #000e; z-index: 20; display: grid; place-items: center; padding: 16px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 92vh; border-radius: 8px; }
.lb-close { position: absolute; top: 12px; right: 12px; color: #fff; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #e3e3e3; color: #1f1f1f; padding: 10px 18px; border-radius: 12px; z-index: 30; max-width: calc(100% - 32px); }

@media (max-width: 820px) {
  .only-mobile { display: inline-block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; transform: translateX(-100%); transition: transform .2s; width: min(300px, 85vw); }
  .sidebar.open { transform: none; }
  .composer { padding-left: 14px; }
  .chip { padding: 6px 10px; }
}
@media (max-width: 480px) {
  .composer-row { flex-wrap: nowrap; gap: 4px; }
  .modes { gap: 4px; }
  .chip { padding: 5px 8px; font-size: 12.5px; white-space: nowrap; }
  .chip.select { min-width: 0; max-width: 92px; }
  .chip.lang { flex: none; padding: 5px 7px; }
  .chip.lang .lang-name { display: none; }  /* the phone row is full: the flag alone */
  .composer-row .icon-btn { width: 34px; height: 34px; flex: none; }
  .send { width: 38px; height: 38px; flex: none; }
}

/* ---------------- datasheet text editor ---------------- */
body.noscroll { overflow: hidden; }
.editor { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; }
.ed-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-title { font-size: 16px; }
.ed-tabs { display: flex; gap: 6px; }
.ed-status { color: var(--muted); font-size: 13px; }
.ed-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 0; }
.ed-stage { overflow: auto; overflow-anchor: none; padding: 14px 20px 48px; background: #0b0b0c; }
.ed-hint { margin: 0 auto 10px; max-width: 780px; color: var(--muted); font-size: 13px; }
.ed-canvas { position: relative; margin: 0 auto; max-width: 780px; width: 100%; background: #fff; box-shadow: 0 6px 30px #0008; }
.ed-canvas img { display: block; width: 100%; height: 100%; }
.ed-hits { position: absolute; inset: 0; }
.ed-hit { position: absolute; border-radius: 3px; cursor: text; }
.ed-hit:hover { outline: 1.5px dashed #4285f4; background: #4285f414; }
.ed-hit.on { outline: 2px solid #4285f4; background: #4285f41f; }
/* in-place typing box (Canva-like): same typeface as the datasheet, sitting exactly on the clicked text */
@font-face { font-family: "Jakarta"; src: url("/fonts/PlusJakartaSans-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/fonts/PlusJakartaSans-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/fonts/PlusJakartaSans-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/fonts/PlusJakartaSans-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/fonts/PlusJakartaSans-800.ttf") format("truetype"); font-weight: 800; font-display: swap; }
.ed-inline { position: absolute; z-index: 4; }
.ed-inline-tag { position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: #1a73e8; color: #fff; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 4px 4px 10px; border-radius: 7px; box-shadow: 0 2px 8px #0005; }
.ed-inline-tag button { border: 0; background: #ffffff33; color: #fff; border-radius: 5px; padding: 4px 8px; cursor: pointer; font-size: 12px; }
.ed-inline-in { display: block; font-family: "Jakarta", "Plus Jakarta Sans", system-ui, sans-serif; color: #1d2433; background: #fffffff7;
  border: 0; outline: 2px solid #1a73e8; border-radius: 3px; padding: 2px 4px; line-height: 1.25; resize: none; overflow: hidden; box-shadow: 0 6px 22px #0004; }
textarea.ed-inline-in { line-height: 1.55; }
.ed-f input, .ed-f textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; resize: vertical; }
.ed-f input:focus, .ed-f textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.upd-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 16px; box-shadow: 0 6px 20px #0008; }
.result img.editable { cursor: text; }
.result img.editable:hover { outline: 2px solid #4285f4; outline-offset: 2px; }
.ed-panel { overflow: auto; border-left: 1px solid var(--line); padding: 6px 14px 60px; background: var(--panel); }
.ed-group { border-bottom: 1px solid var(--line); padding: 4px 0 10px; }
.ed-group summary { cursor: pointer; font-weight: 600; padding: 8px 0 4px; }
.ed-f { display: block; margin: 6px 0; flex: 1; min-width: 0; }
.ed-f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.ed-f.flash input, .ed-f.flash textarea { outline: 2px solid #fbbc04; }
.ed-row { display: flex; gap: 6px; align-items: flex-end; }
.ed-row .ed-f.w40 { flex: 0 0 36%; }
.ed-x { flex: none; width: 30px; height: 30px; font-size: 14px; margin-bottom: 8px; color: var(--muted); }
.ed-add { margin-top: 4px; }
.ed-sub { font-size: 12px; color: var(--muted); margin-top: 12px; }
@media (max-width: 900px) {
  .ed-body { grid-template-columns: 1fr; grid-template-rows: 55% 45%; }
  .ed-panel { border-left: 0; border-top: 1px solid var(--line); }
  .ed-title { display: none; }
}

/* ---------------- canva-like design editor ---------------- */
@font-face { font-family: "lucide"; src: url("/fonts/lucide.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; }
.ds { position: fixed; inset: 0; z-index: 26; background: var(--bg); display: flex; flex-direction: column; }
.ds-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ds-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ds-tabs { display: flex; gap: 6px; }
.ds-tabs .tab { padding: 5px 12px; font-size: 13.5px; }
.ds-group, .ds-seg { display: flex; align-items: center; gap: 4px; }
.ds-group { flex-wrap: wrap; }
.ds .btn.small { padding: 5px 10px; font-size: 13px; line-height: 1.35; white-space: nowrap; }
.ds .btn:disabled { opacity: .38; cursor: default; filter: none; }
.ds .btn.on { background: #004a77; color: #c2e7ff; }
.ds-ic { display: inline-block; min-width: 1em; text-align: center; }
.ds-status { color: #fbbc04; font-size: 13px; white-space: nowrap; min-width: 118px; text-align: right; }  /* reserved: no reflow when it appears */
/* selection toolbar: one fixed-height row (scrolls sideways when narrow) so selecting never moves the page */
.ds-bar { flex: none; display: flex; align-items: center; height: 48px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ds-ctx { flex: 1 1 auto; min-width: 0; height: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ds-ctx > * { flex: none; }
.ds-ctx .btn.small { padding: 5px 9px; }
.ds-ico { font-family: "lucide"; font-size: 16px; line-height: 1; font-weight: 400; vertical-align: -3px; }
.ds-bold { font-weight: 800; min-width: 32px; }
.ds-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ds-what { font-size: 12.5px; color: var(--muted); }
.ds-ctx > .ds-hint { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-num { width: 58px; padding: 4px 6px; border-radius: 8px; font-size: 13px; text-align: center; border: 1px solid var(--line); }
.ds-field { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.ds-color { width: 34px; height: 28px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.ds-color::-webkit-color-swatch-wrapper { padding: 0; }
.ds-color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.ds-color::-moz-color-swatch { border: 0; border-radius: 5px; }
.ds-zoom { position: absolute; right: 22px; bottom: 18px; z-index: 1; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 6px 20px #000a; }
.ds-zoom .btn.small { background: transparent; min-width: 32px; }
.ds-zoom .btn.small:hover { background: var(--line); filter: none; }
.ds-zpct { min-width: 44px; padding-right: 6px; text-align: center; font-size: 12.5px; color: var(--muted); }
.ds-main { flex: 1; min-height: 0; position: relative; display: flex; }
.ds-stage { flex: 1; min-width: 0; overflow: auto; display: flex; padding: 28px; background: #0b0b0c; overscroll-behavior: contain; }
.ds-page { margin: auto; flex: none; line-height: 0; background: #fff; box-shadow: 0 8px 36px #000c, 0 0 0 1px #ffffff12; }
.ds-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: #0b0b0c; color: var(--muted); font-size: 15px; }
textarea[data-fabric-hiddentextarea] { font-size: 16px !important; }  /* iOS would zoom the page into a tiny input */
@media (max-width: 1420px) { .ds-hide-m { display: none; } }
@media (max-width: 1360px) { .ds-top .ds-hide-s { display: none; } }
@media (max-width: 640px) {
  .ds-top { padding: 6px 8px; gap: 5px; }
  .ds-bar { padding: 0 8px; height: 46px; }
  .ds-zoom { right: 10px; bottom: 10px; }
  .ds-title { display: none; }
  .ds .btn.small { padding: 5px 8px; }
  .ds-tabs .tab { padding: 4px 10px; font-size: 13px; }
  .ds-stage { padding: 12px; }
  .ds-ctx > .ds-hint { font-size: 12px; }
}

/* ---------------- Tanya answers: code blocks, steps, catalogue citations ---------------- */
.answer pre.code { background: #0d1117; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font-size: 13px; line-height: 1.45; }
.answer pre.code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.answer ol { padding-left: 22px; }
.answer h4 { margin: 12px 0 4px; font-size: 15px; }
.answer a.cite.kb { background: #3b2a08; color: #fbbc04; }
.sources-more { margin-top: 6px; color: var(--muted); font-size: 13px; }
.sources-more summary { cursor: pointer; }

/* design editor: dimension fields */
.ds-dim { position: absolute; z-index: 5; top: 118px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 32px #000a;
  display: grid; gap: 8px; }
.ds-dim-row { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; align-items: end; }
.ds-dim-row > i { font-style: normal; font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.ds-dim-f span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.ds-dim-f input { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 15px; }
.ds-dim-f input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.ds-dim-btns { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .ds-dim { top: 150px; } .ds-dim-row { grid-template-columns: 1fr 1fr; } .ds-dim-row > i { grid-column: 1 / -1; padding: 0; } }
