﻿:root {
  --bg: #f3f2ee; --panel: #ffffff; --ink: #1c1b19; --mute: #6f6c66; --line: #dedbd3;
  --acc: #b3261e; --acc-ink: #fff; --sel: #0a6cff; --ok: #1b7f3b; --warn: #b26a00; --bad: #b3261e;
  --r: 10px; --bar: 48px; --tap: 40px;
  font: 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (pointer: coarse) { :root { --tap: 44px; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
h1 { font-size: 20px; margin: 0 0 4px; } h2 { font-size: 15px; margin: 0 0 8px; } h3 { font-size: 12px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
p { margin: 0 0 8px; } a { color: inherit; }
.mute { color: var(--mute); } .small { font-size: 12px; } .grow { flex: 1; min-width: 0; } .row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; }
.hide { display: none !important; }

button, .btn {
  font: inherit; min-height: var(--tap); padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; white-space: nowrap; touch-action: manipulation; user-select: none;
}
button:hover { border-color: #b9b5ab; } button:disabled { opacity: .5; cursor: default; }
button.pri, .btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
button.ghost { border-color: transparent; background: transparent; }
button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
button.danger { color: var(--bad); }
button.ico { width: var(--tap); padding: 0; font-size: 17px; }
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  min-height: 36px; padding: 6px 8px; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.4; }
/* 16px on touch screens stops iOS from zooming the page when a field gets focus */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; min-height: 40px; } }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; padding: 0; }
input[type=color] { padding: 2px; width: 44px; }
input[type=range] { padding: 0; border: 0; background: none; }
label.f { display: block; font-size: 11px; color: var(--mute); margin-bottom: 8px; }
label.f > span { display: block; margin-bottom: 3px; }
label.c { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.auth form { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.logo { font: 700 22px/1 Georgia, serif; letter-spacing: -.02em; } .logo b { color: var(--acc); }
.err { color: var(--bad); margin: 8px 0; min-height: 18px; }

/* ---------- dashboard ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1180px; margin: 0 auto; padding: 0 12px; height: var(--bar); display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 0 12px; height: var(--bar); display: flex; align-items: center; text-decoration: none; color: var(--mute); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--acc); font-weight: 600; }
main.dash { max-width: 1180px; margin: 0 auto; padding: 16px 12px 80px; }
.head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; position: relative; }
.card:hover { border-color: #b9b5ab; }
.card .th { aspect-ratio: 297 / 400; background: #e9e7e1 center top / cover no-repeat; border-bottom: 1px solid var(--line); display: grid; place-items: center; color: var(--mute); }
.card .bd { padding: 8px 10px; } .card .bd b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .more { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.92); width: 34px; min-height: 34px; }
.card.sel { outline: 2px solid var(--sel); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eceae4; color: var(--mute); margin: 2px 2px 0 0; }
.tag.ok { background: #e2f3e7; color: var(--ok); } .tag.bad { background: #fbe6e4; color: var(--bad); } .tag.warn { background: #fdf0d8; color: var(--warn); }
.empty { border: 1px dashed #c8c4ba; border-radius: var(--r); padding: 28px 16px; text-align: center; color: var(--mute); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; border-radius: 0; min-height: 34px; } .seg button.on { background: var(--ink); color: #fff; }
table.t { width: 100%; border-collapse: collapse; } table.t td, table.t th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #bbb; } .dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

/* ---------- dialogs / sheets ---------- */
.veil { position: fixed; inset: 0; background: rgba(20,18,15,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; }
.dlg { background: var(--panel); border-radius: 14px; width: min(520px, 100%); max-height: 92dvh; overflow: auto; padding: 16px; }
.dlg.wide { width: min(860px, 100%); }
.dlg .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .veil { align-items: flex-end; padding: 0; }
  .dlg { width: 100%; border-radius: 16px 16px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
.menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 4px; min-width: 190px; }
.menu button { width: 100%; justify-content: flex-start; border: 0; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 99px; z-index: 90; max-width: 92vw; text-align: center; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- editor ---------- */
.ed { position: fixed; inset: 0; display: grid; grid-template-rows: var(--bar) 1fr; grid-template-columns: 1fr 330px; background: #d9d6ce; }
.ed-top { grid-column: 1 / -1; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 4px; padding: 0 6px; min-width: 0; }
.ed-top .ttl { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 40px; }
.ed-top .st { font-size: 11px; color: var(--mute); white-space: nowrap; }
.pgnav { display: flex; align-items: center; gap: 0; } .pgnav button.n { min-width: 62px; }
.stage { position: relative; overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; }
.stage-in { margin: 0 auto; padding: 20px 20px 110px; width: max-content; min-width: 100%; display: flex; justify-content: center; }
.scaler { position: relative; flex: none; } .scaler > .pg { transform-origin: 0 0; box-shadow: 0 2px 18px rgba(0,0,0,.28); position: absolute; left: 0; top: 0; }

.ed .blk { cursor: pointer; }
.ed .blk::after { content: ''; position: absolute; inset: 0; outline: calc(1px / var(--z)) dashed rgba(10,108,255,.45); pointer-events: none; }
.ed .blk.is-sample .blk-t { color: #a9a59c !important; }
.ed .blk.is-empty { background: repeating-linear-gradient(45deg, #ecebe7 0 3mm, #e1dfd9 3mm 6mm); }
.ed .blk.is-empty::before { content: 'ФОТО'; position: absolute; inset: 0; display: grid; place-items: center; font: 600 10pt system-ui; color: #99958b; }
.ed.trace .blk.is-sample .blk-t { visibility: hidden; }
.ed.trace .blk-shape { opacity: .28; }
.ed.trace .blk.is-empty { background: rgba(10,108,255,.10); } .ed.trace .blk.is-empty::before { content: ''; }
.ed.trace .blk::after { outline-style: solid; outline-color: rgba(10,108,255,.8); }
.ed .blk.over::after { outline: calc(2px / var(--z)) solid var(--bad); }
.ed .blk.sel::after { outline: calc(2px / var(--z)) solid var(--sel); }
.ed .blk.sel { touch-action: none; cursor: move; z-index: 3; }
.ed .blk .ovf { position: absolute; right: 0; bottom: 0; transform: scale(calc(1 / var(--z))); transform-origin: 100% 100%; background: var(--bad); color: #fff; font: 600 11px system-ui; padding: 2px 6px; border-radius: 6px 0 0 0; pointer-events: none; z-index: 2; }
.ed .blk .lbl { position: absolute; left: 0; top: 0; transform: scale(calc(1 / var(--z))); transform-origin: 0 0; background: rgba(10,108,255,.88); color: #fff; font: 600 10px system-ui; padding: 1px 5px; border-radius: 0 0 6px 0; pointer-events: none; white-space: nowrap; z-index: 2; }
.hnd { position: absolute; width: var(--hs); height: var(--hs); margin: calc(var(--hs) / -2); background: #fff; border: calc(2px / var(--z)) solid var(--sel); border-radius: 50%; z-index: 6; touch-action: none; --hs: calc(12px / var(--z)); }
@media (pointer: coarse) { .hnd { --hs: calc(22px / var(--z)); } }
.hnd[data-h=nw] { left: 0; top: 0; cursor: nwse-resize; } .hnd[data-h=ne] { left: 100%; top: 0; cursor: nesw-resize; }
.hnd[data-h=sw] { left: 0; top: 100%; cursor: nesw-resize; } .hnd[data-h=se] { left: 100%; top: 100%; cursor: nwse-resize; }
.hnd[data-h=n] { left: 50%; top: 0; cursor: ns-resize; } .hnd[data-h=s] { left: 50%; top: 100%; cursor: ns-resize; }
.hnd[data-h=w] { left: 0; top: 50%; cursor: ew-resize; } .hnd[data-h=e] { left: 100%; top: 50%; cursor: ew-resize; }
.guide { position: absolute; background: #ff2d8a; z-index: 7; pointer-events: none; }

/* notes layer (pins, ink) */
.ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; }
.ed.tool-draw .ink, .ed.tool-note .ink, .ed.tool-erase .ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.pin { position: absolute; z-index: 9; width: 30px; height: 30px; margin: -15px; transform: scale(calc(1 / var(--z))); border-radius: 50%; background: var(--acc); color: #fff; font: 700 13px system-ui; display: grid; place-items: center; box-shadow: 0 1px 6px rgba(0,0,0,.4); cursor: pointer; border: 2px solid #fff; }

/* floating toolbar */
.tools { position: fixed; z-index: 20; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.22); display: flex; gap: 2px; padding: 4px; max-width: calc(100vw - 12px); overflow-x: auto; scrollbar-width: none; }
.tools button { border: 0; flex-direction: column; gap: 1px; min-width: 52px; padding: 2px 6px; font-size: 10px; line-height: 1.1; min-height: 46px; }
.tools button .i { font-size: 18px; line-height: 1; } .tools .sep { width: 1px; background: var(--line); margin: 6px 2px; flex: none; }

/* inspector */
.side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-h { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.side-h .tabs2 { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.side-h .tabs2 button { border: 0; min-height: 34px; padding: 0 9px; } .side-h .tabs2 button.on { background: #eceae4; color: var(--ink); font-weight: 600; }
.side-b { overflow: auto; padding: 10px; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.side .x { display: none; }
.cnt { font-size: 11px; color: var(--mute); } .cnt.bad { color: var(--bad); font-weight: 600; }
.chat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.msg { padding: 7px 10px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; } .msg.u { background: #e8eefc; align-self: flex-end; } .msg.a { background: #f1efe9; align-self: flex-start; }
.note-i { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; display: flex; gap: 8px; align-items: flex-start; }
.note-i .n { background: var(--acc); color: #fff; border-radius: 50%; width: 20px; height: 20px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.plist .p { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; text-align: center; font-size: 11px; }
.plist .p.on { outline: 2px solid var(--sel); } .plist .p .th { aspect-ratio: 297/400; background: #eee center top / cover; display: grid; place-items: center; font-size: 20px; color: #aaa; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; } .lib img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid var(--line); }

@media (max-width: 640px) {
  .head { align-items: stretch; } .head > .grow { flex: 1 1 100%; }
  .seg { max-width: 100%; overflow-x: auto; }
  .head > button { flex: 1; }
  .tools button { min-width: 45px; padding: 2px 3px; font-size: 9.5px; }
  .ed-top { gap: 0; } .ed-top .st { display: none; }
}
@media (max-width: 860px) {
  .ed { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: min(52dvh, 460px); border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25); transform: translateY(105%); transition: transform .18s ease; padding-bottom: env(safe-area-inset-bottom); }
  .ed.sheet .side { transform: none; }
  .ed.sheet .tools { display: none; }
  .ed.sheet .stage-in { padding-bottom: 56dvh; }
  .side .x { display: inline-flex; }
  .ed-top .hide-m { display: none; }
}

.foot-note { max-width: 1180px; margin: 0 auto; padding: 14px 12px 28px; font-size: 12px; color: var(--mute); }
.foot-note a { color: var(--acc); }
a.btn { display: inline-flex; }

/* ---------- page switcher: finger-sized ---------- */
.pgnav { gap: 4px; margin: 0 2px; } .pgnav button { min-height: 40px; } .pgnav button.ico { width: 44px; font-size: 22px; } .pgnav button.n { min-width: 58px; font-weight: 600; }
.menu { max-height: 62dvh; overflow-y: auto; max-width: min(92vw, 420px); } .menu button { white-space: normal; text-align: left; height: auto; padding: 8px 12px; }
/* ---------- folded sections ---------- */
details.fold { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; background: #fff; }
details.fold > summary { list-style: none; cursor: pointer; padding: 0 12px; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '▾'; margin-left: auto; color: var(--mute); transition: transform .15s; } details.fold[open] > summary::after { transform: rotate(180deg); }
.fold-b { padding: 4px 12px 12px; }
/* ---------- AI composer ---------- */
.ai { display: flex; flex-direction: column; min-height: 100%; } .ai .chat { flex: 1; margin-bottom: 8px; }
.cmp { border: 1px solid #cfcbc1; border-radius: 18px; background: #fff; padding: 8px 8px 6px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.cmp:focus-within { border-color: #9b968a; }
.cmp-ta { border: 0; outline: 0; resize: none; padding: 4px 6px; min-height: 28px; max-height: 160px; background: transparent; display: block; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 4px; } .cmp-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2fd; border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 12px; max-width: 100%; }
.chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 50%; margin-left: -6px; }
.chip button { border: 0; background: transparent; min-height: 24px; width: 24px; padding: 0; font-size: 11px; }
.cmp-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; min-width: 0; }
.cmp-b { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; border-color: transparent; background: transparent; font-size: 17px; flex: none; }
.cmp-b:hover, .cmp-b.on { background: #eceae4; color: var(--ink); border-color: transparent; }
.cmp-send { background: var(--acc); color: #fff; font-weight: 700; } .cmp-send:hover { background: #981f18; color: #fff; }
.cmp-pick { border: 0; background: transparent; min-height: 34px; padding: 0 6px; color: var(--mute); gap: 3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cmp-pick i { font-style: normal; font-size: 10px; } .cmp-pick:hover { background: #eceae4; color: var(--ink); }
@media (pointer: coarse) { .cmp-b { width: 40px; min-height: 40px; } .cmp-ta { font-size: 16px; } }
.cmp-ta { scrollbar-width: none; } .cmp-ta::-webkit-scrollbar { display: none; }

/* =====================================================================================
   Buttons and feedback after Apple's Human Interface Guidelines:
   - every control answers the finger at once (pressed state), not on release;
   - one prominent action per view (filled), the rest quiet (tinted grey), destructive in red;
   - targets of at least 44pt on touch screens; hover effects only where a pointer can hover;
   - an action in progress shows it in place and keeps the button's size; results are confirmed;
   - on/off is a switch; motion is short and yields to "reduce motion".
   ===================================================================================== */
:root { --press: cubic-bezier(.2, .8, .2, 1); --fill: rgba(118, 118, 128, .12); --fill-2: rgba(118, 118, 128, .2); --green: #34c759; }
* { -webkit-tap-highlight-color: transparent; }
button, .btn { border-color: transparent; background: var(--fill); border-radius: 12px; font-weight: 500;
  transition: transform .12s var(--press), background-color .15s, opacity .15s, box-shadow .15s; -webkit-user-select: none; user-select: none; }
button:hover, .btn:hover { border-color: transparent; }
@media (hover: hover) { button:hover:not(:disabled), a.btn:hover { background: var(--fill-2); } button.pri:hover:not(:disabled), .btn.pri:hover { background: #9d2019; } button.ghost:hover:not(:disabled) { background: var(--fill); } }
button:active:not(:disabled), .btn:active, .card:active, .plist .p:active, details.fold > summary:active { transform: scale(.97); opacity: .82; }
button.pri, .btn.pri { background: var(--acc); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(11, 122, 139, .35); }
button.ghost { background: transparent; }
button.on { background: var(--ink); color: #fff; }
button.danger { color: var(--bad); background: rgba(11, 122, 139, .1); } button.danger.ghost { background: transparent; }
button:disabled { opacity: .38; }
button[aria-busy=true] { opacity: 1; pointer-events: none; }
:focus-visible { outline: 3px solid rgba(10, 108, 255, .55); outline-offset: 2px; }
@media (pointer: coarse) { button, .btn { min-height: 44px; } button.ico { width: 44px; } .cmp-b { width: 44px; min-height: 44px; } .chip button { width: 30px; min-height: 30px; } }
.card, .plist .p { transition: transform .12s var(--press), opacity .15s, border-color .15s; }
.seg { background: var(--fill); border: 0; padding: 2px; gap: 2px; border-radius: 10px; }
.seg button { background: transparent; border-radius: 8px; min-height: 32px; } .seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); font-weight: 600; }
.tabs2 button { background: transparent; } .side-h .tabs2 button.on { background: var(--fill-2); }
.tools button, .menu button, .cmp-b, .cmp-pick { background: transparent; } .tools button.on { background: var(--ink); color: #fff; }
.cmp-send, .cmp-send:hover { background: var(--acc) !important; color: #fff; }
.menu { border: 0; border-radius: 14px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: pop .16s var(--press); transform-origin: top right; }
.menu button { border-radius: 9px; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* on / off is a switch */
input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; width: 46px; min-height: 28px; height: 28px; border-radius: 99px; border: 0; background: rgba(120, 120, 128, .28);
  position: relative; cursor: pointer; transition: background-color .2s; padding: 0; }
input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--press); }
input[type=checkbox]:checked { background: var(--green); } input[type=checkbox]:checked::after { transform: translateX(18px); }
input[type=checkbox]:active::after { width: 28px; } input[type=checkbox]:checked:active::after { transform: translateX(14px); }
input, select, textarea { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: #6ea1ff; box-shadow: 0 0 0 3px rgba(10, 108, 255, .18); }
.cmp-ta:focus { box-shadow: none; }

/* sheets: grabber, soft entrance, swipe down to dismiss */
.veil { animation: fade .18s ease-out; } .dlg { animation: rise .26s var(--press); }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (max-width: 860px) {
  .side { transition: transform .32s var(--press); }
  .side::before, .dlg::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 99px; background: rgba(60, 60, 67, .3); margin: 6px auto 0; flex: none; }
  .side-h { touch-action: none; }
}
@media (max-width: 640px) { .dlg::before { margin: -6px auto 10px; } .dlg { animation-name: sheet; } @keyframes sheet { from { transform: translateY(100%); } } }

/* results are confirmed */
.toast { border-radius: 14px; padding: 11px 16px; background: rgba(28, 27, 25, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: rise .22s var(--press); display: flex; gap: 8px; align-items: center; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); }
.toast.ok::before { content: '✓'; color: var(--green); font-weight: 700; } .toast.err::before { content: '!'; width: 18px; height: 18px; border-radius: 50%; background: #ff453a; color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 12px; flex: none; }
.ed-top .st { transition: color .2s; } .ed-top .st.saved { color: var(--ok); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } button:active:not(:disabled), .btn:active, .card:active { transform: none; } }

/* =====================================================================================
   Look of the app: warm paper-grey ground, white rounded cards with a hairline and a soft
   shadow, quiet line icons, one clay accent — the visual language of the Claude mobile app.
   ===================================================================================== */
:root {
  --bg: #f0eee6; --panel: #ffffff; --ink: #1f1e1d; --mute: #73726c; --line: #e3e0d5; --line-2: #d1cfc5;
  --acc: #c6613f; --acc-d: #b05730; --sel: #2c84db; --ok: #2f7d4f; --bad: #b53333; --warn: #9a6a00;
  --r: 16px; --card: 0 1px 2px rgba(31, 30, 29, .04), 0 4px 18px rgba(31, 30, 29, .05);
  --float: 0 2px 6px rgba(31, 30, 29, .06), 0 12px 32px rgba(31, 30, 29, .12);
  --fill: #f5f4ee; --fill-2: #ebe9e0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
html, body { background: var(--bg); color: var(--ink); }
h1, .logo, .dlg h2, .panel > h2 { font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 26px; } .logo b { color: var(--acc); }
h3 { color: var(--mute); font-weight: 600; letter-spacing: .03em; }
.ic { display: inline-flex; } .ic svg { display: block; }

/* buttons: white squares with a hairline and a small shadow; the main action is clay */
button, .btn { background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 1px 2px rgba(31, 30, 29, .05); font-weight: 500; }
button:hover, .btn:hover { border-color: var(--line); }
@media (hover: hover) { button:hover:not(:disabled), a.btn:hover { background: var(--fill); border-color: var(--line-2); } button.ghost:hover:not(:disabled) { background: var(--fill-2); } }
button.pri, .btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: 0 1px 2px rgba(11, 122, 139, .4); }
@media (hover: hover) { button.pri:hover:not(:disabled), .btn.pri:hover { background: var(--acc-d); border-color: var(--acc-d); } }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
button.danger { background: #fff; color: var(--bad); border-color: #ecd3d0; } button.danger.ghost { background: transparent; border-color: transparent; }
button.ico { border-radius: 12px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
input:focus, select:focus, textarea:focus { border-color: #b9b6aa; box-shadow: 0 0 0 3px rgba(31, 30, 29, .07); }
input[type=checkbox]:checked { background: var(--acc); }
label.f { color: var(--mute); }

/* cards, panels, lists: white on grey, hairline, soft shadow, dividing lines */
.top { background: rgba(240, 238, 230, .86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.tabs a { color: var(--mute); } .tabs a.on { color: var(--ink); border-color: var(--ink); }
.card, .panel, .auth form, details.fold, .note-i, .plist .p { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--card); }
.card .th { background-color: #f5f4ee; border-bottom: 1px solid var(--line); }
.card .more { background: rgba(255, 255, 255, .95); border: 1px solid var(--line); }
.empty { border: 1px dashed var(--line-2); border-radius: var(--r); background: transparent; }
.tag { background: var(--fill-2); color: var(--mute); border-radius: 8px; }
.tag.ok { background: #e3f1e7; } .tag.bad { background: #f7e1df; } .tag.warn { background: #f6ecd3; }
table.t td, table.t th { border-bottom: 1px solid var(--line); } table.t th { color: var(--mute); font-weight: 500; font-size: 12px; }
.note-i { border-radius: 12px; box-shadow: none; }
details.fold > summary { font-weight: 500; } details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.7px solid var(--mute); border-bottom: 1.7px solid var(--mute); transform: rotate(45deg); margin-top: -4px; }
details.fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.fold-b { padding-top: 12px; }
.plist .p.on { outline: 2px solid var(--ink); } .card.sel { outline: 2px solid var(--ink); }
.seg { background: var(--fill-2); border-radius: 12px; padding: 3px; } .seg button { border: 0; box-shadow: none; border-radius: 9px; } .seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31, 30, 29, .14); }
.foot-note a { color: var(--acc); }
.dot.ok { background: var(--ok); }

/* sheets, dialogs, menus */
.veil { background: rgba(31, 30, 29, .36); }
.dlg { border-radius: 22px; box-shadow: var(--float); border: 1px solid var(--line); }
.menu { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--float); padding: 6px; backdrop-filter: none; }
.menu button { border: 0; box-shadow: none; border-radius: 10px; background: transparent; } .menu button + button { border-top: 1px solid #f0eee6; border-radius: 0; }
.menu button:first-child { border-radius: 10px 10px 0 0; } .menu button:last-child { border-radius: 0 0 10px 10px; }
.toast { background: var(--ink); border-radius: 14px; }
.msg { border-radius: 16px; padding: 9px 13px; } .msg.u { background: var(--fill-2); } .msg.a { background: transparent; padding-left: 2px; }
.spin { border-width: 2px; }

/* editor */
.ed { background: #e8e6dc; }
.ed-top { background: rgba(250, 249, 245, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); gap: 6px; padding: 0 8px; }
.ed-top .ttl { font-family: ui-serif, Georgia, serif; font-weight: 500; font-size: 15px; }
.ed-top button.pri { border-radius: 12px; padding: 0 14px; }
.pgnav button { background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(31, 30, 29, .05); } .pgnav button.ico { font-size: 0; }
.scaler > .pg { box-shadow: 0 1px 3px rgba(31, 30, 29, .12), 0 10px 34px rgba(31, 30, 29, .16); }
.side { background: #faf9f5; border-left: 1px solid var(--line); }
.side-h { border-bottom: 1px solid var(--line); background: #faf9f5; padding: 6px 8px; }
.side-h .tabs2 { background: var(--fill-2); border-radius: 12px; padding: 3px; flex: 0 1 auto; margin-right: auto; }
.side-h .tabs2 button { border: 0; box-shadow: none; border-radius: 9px; background: transparent; color: var(--mute); min-height: 32px; }
.side-h .tabs2 button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31, 30, 29, .14); font-weight: 600; }
.tools { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--float); padding: 5px; }
.tools button { border: 0; box-shadow: none; background: transparent; color: var(--mute); border-radius: 14px; font-weight: 500; } .tools button .i { color: var(--ink); height: 22px; }
.tools button.on { background: var(--ink); color: #fff; } .tools button.on .i { color: #fff; }
.tools .sep { background: var(--line); }
@media (max-width: 860px) { .side { border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(31, 30, 29, .18); border: 1px solid var(--line); } }
.pin { background: var(--acc); }

/* composer */
.cmp { border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--card); padding: 10px 10px 8px; }
.cmp:focus-within { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(31, 30, 29, .05), 0 6px 22px rgba(31, 30, 29, .09); }
.cmp-ta { border: 0; box-shadow: none !important; font-size: 16px; }
.cmp-b { border: 1px solid var(--line); background: #fff; box-shadow: none; color: var(--ink); border-radius: 12px; }
.cmp-b.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cmp-send, .cmp-send:hover { background: var(--acc) !important; border-color: var(--acc); color: #fff; border-radius: 12px; }
.cmp-pick { border: 0; box-shadow: none; background: transparent; color: var(--mute); font-weight: 500; border-radius: 10px; }
.chip { background: var(--fill-2); border-radius: 10px; color: var(--ink); } .chip button { border: 0; box-shadow: none; background: transparent; }

/* a note being written: its spot pulses and its frame is outlined, so it is clear what the note is about */
.pin-new { animation: pinpulse 1.2s ease-in-out infinite; z-index: 12; }
@keyframes pinpulse { 50% { box-shadow: 0 0 0 calc(10px / var(--z)) rgba(14, 148, 168, .25); } }
.ed .blk.noted::after { outline: calc(3px / var(--z)) solid var(--acc); z-index: 5; }
.ed .blk.noted { background-color: rgba(14, 148, 168, .08); }

/* notes on the page: pin + text + delete, at a constant screen size whatever the zoom */
.note-pin { position: absolute; z-index: 9; width: 0; height: 0; transform: scale(calc(1 / var(--z))); transform-origin: 0 0; }
.note-pin .pin { position: absolute; left: -15px; top: -15px; margin: 0; transform: none; padding: 0; min-height: 30px; width: 30px; height: 30px; cursor: pointer; }
.note-b { position: absolute; left: 20px; top: -16px; width: max-content; max-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--float); }
.note-pin.left .note-b { left: auto; right: 20px; }
.note-tx { padding: 7px 34px 7px 10px; color: var(--ink); font: 13px/1.3 system-ui, sans-serif; cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note-b .note-x { position: absolute; right: 3px; top: 3px; width: 26px; min-height: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; box-shadow: none; background: var(--fill-2); color: var(--mute); }

/* while a frame is dragged: its size, and in clay when it sits exactly on the column grid */
.ed .blk .lbl.drag-tip { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(calc(1 / var(--z))); transform-origin: 50% 50%; border-radius: 10px; padding: 5px 10px; font: 600 13px system-ui, sans-serif; background: rgba(31, 30, 29, .88); z-index: 11; }
.ed .blk .lbl.drag-tip.on-grid { background: var(--acc); }
.guide { background: var(--acc); }

/* ---------- touch editing ---------- */
/* a handle is small to look at and large to hit */
.hnd::before { content: ''; position: absolute; inset: calc(-14px / var(--z)); }
.ed .blk.sel.locked { cursor: default; touch-action: auto; } .ed .blk.sel.locked::after { outline-style: dashed; outline-color: var(--mute); }
.ed.dragging .blk.sel { box-shadow: 0 calc(10px / var(--z)) calc(30px / var(--z)) rgba(31, 30, 29, .28); opacity: .96; }
.ed.dragging .tools, .ed.dragging .side { opacity: .25; pointer-events: none; transition: opacity .15s; }
/* stepper: - value + */
.stp { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.stp input { border: 0; border-radius: 0; text-align: center; padding: 6px 2px; min-width: 0; box-shadow: none !important; -moz-appearance: textfield; }
.stp input::-webkit-outer-spin-button, .stp input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stp button { border: 0; border-radius: 0; box-shadow: none; background: var(--fill); width: 34px; min-height: 36px; padding: 0; flex: none; color: var(--mute); }
.grid4 .stp button { width: 26px; }
@media (max-width: 860px) { .side .grid4 { grid-template-columns: 1fr 1fr; } .grid4 .stp button { width: 38px; } .stp button { min-height: 44px; width: 40px; } }
/* tall sheet */
@media (max-width: 860px) { .ed.sheet-full .side { height: 90dvh; } .side { transition: transform .32s var(--press), height .28s var(--press); } }
/* toast with an action */
.toast.act { padding-right: 6px; } .toast button { background: rgba(255, 255, 255, .16); color: #fff; border: 0; box-shadow: none; min-height: 32px; border-radius: 9px; padding: 0 12px; font-weight: 600; }

/* no browser zoom of the app: double-tap and pinch zoom are off everywhere; the page stage pans and zooms on its own */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; }
button, a, input, select, textarea, label, summary { touch-action: manipulation; }
.stage { touch-action: pan-x pan-y; }

/* ---------- the bottom toolbar fits the screen: equal cells, no sideways scrolling ---------- */
@media (max-width: 860px) {
  .tools { left: 8px; right: 8px; transform: none; max-width: none; overflow: hidden; justify-content: space-between; padding: 4px 3px; gap: 0; }
  .tools button { flex: 1 1 0; min-width: 0; padding: 2px 0; font-size: 10px; }
  .tools button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; }
  .tools .sep { display: none; }
}
.tools button .i svg { stroke-width: 1.7; }
.ic svg path[d^="M6 12h.01"] { stroke-width: 3; }
/* ---------- header on a phone: logo + account on top, sections as an even row below ---------- */
.acct { display: inline-flex; align-items: center; gap: 6px; } .ava { width: 32px; height: 32px; border-radius: 50%; background: var(--fill-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--ink); }
@media (max-width: 640px) {
  .top .in { flex-wrap: wrap; height: auto; padding-top: 6px; row-gap: 0; }
  .top .in > .logo { flex: 1; }
  .top .tabs { order: 3; flex: 1 1 100%; justify-content: space-between; overflow: hidden; }
  .top .tabs a { flex: 1 1 0; justify-content: center; padding: 0 2px; height: 42px; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .acct .nm { display: none; }
}

/* ---------- start choice and project wizard ---------- */
.choose { display: grid; gap: 10px; }
.choose button.big { flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; padding: 14px 16px; min-height: 0; gap: 4px; border-radius: 16px; }
.choose button.big span { font-weight: 400; font-size: 13px; opacity: .85; }
.wiz-steps { display: flex; gap: 6px; margin-bottom: 12px; } .wiz-steps span { flex: 1; text-align: center; font-size: 12px; padding: 6px 4px; border-radius: 10px; background: var(--fill); color: var(--mute); }
.wiz-steps span.on { background: var(--ink); color: #fff; } .wiz-steps span.done { background: var(--fill-2); color: var(--ink); }
.wiz .q textarea { flex: 1; } .wiz .q .ico { flex: none; }
.logo-box { border: 1px dashed var(--line-2); border-radius: 16px; min-height: 120px; display: grid; place-items: center; padding: 16px; background: #fff; overflow: hidden; }
.logo-type { font-size: clamp(28px, 8vw, 56px); font-weight: 900; line-height: 1; text-align: center; letter-spacing: -.01em; }
.logo-prev { max-width: 100%; max-height: 160px; object-fit: contain; }
.wiz-steps span { cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 2px; }
.wiz .q input { flex: 1; }
.wiz-h { font-size: 15px; margin: 16px 0 6px; }
.gate { background: #fff7e6; border-color: #f1dcb0; margin-bottom: 10px; }
/* masthead preview: a small copy of the front page top */
.mh-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.05); }
.mh-top { display: flex; gap: 8px; align-items: stretch; min-height: 64px; }
.mh-name { font-size: clamp(26px, 8vw, 48px); font-weight: 900; line-height: .95; overflow-wrap: anywhere; min-width: 0; }
.mh-emb { width: 60px; height: 60px; object-fit: contain; flex: none; }
.mh-logo { flex: 1; min-width: 0; max-height: 80px; object-fit: contain; object-position: left center; }
.mh-box { flex: none; width: 84px; border-radius: 4px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 11px; line-height: 1.25; padding: 4px; margin-left: auto; }
.mh-box b { font-size: 14px; }
.mh-slogan { text-align: center; text-transform: uppercase; font: 700 10px/1.3 "PT Sans", sans-serif; letter-spacing: .04em; margin-top: 6px; }
.mh-date { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid #000; margin-top: 4px; padding-top: 2px; font: 10px/1.3 "PT Sans", sans-serif; }
.mh-date b { text-align: right; }
.mh-rule { height: 3px; margin-top: 3px; }
/* style preview and rubric icons */
.style-prev { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.sp-rub { display: flex; gap: 6px; align-items: center; font: 700 12px "PT Sans", sans-serif; text-transform: uppercase; border-top: 1px solid #000; padding-top: 4px; }
.sp-head { font-size: 22px; font-weight: 700; line-height: 1.1; margin: 6px 0; }
.sp-body { font-size: 13px; line-height: 1.4; color: #222; }
.ic { display: inline-block; flex: none; } .ic svg { width: 100%; height: 100%; display: block; }
.ic-empty { display: inline-block; border: 1px dashed var(--line-2); border-radius: 6px; flex: none; }
.ic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 4px 0 6px; }
.ic-cell { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 12px; min-width: 0; }
.ic-cell span:not(.ic):not(.ic-empty) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-cell button { min-height: 0; padding: 2px 6px; }
.emb-gal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.emb-gal button { padding: 4px; background: #fff; border: 2px solid var(--line); border-radius: 12px; min-height: 0; aspect-ratio: 1; }
.emb-gal button.on { border-color: var(--ink); }
.emb-gal img { width: 100%; height: 100%; object-fit: contain; }
.wiz button.idea { min-height: 30px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; border-radius: 999px; background: var(--fill); border: 0; box-shadow: none; }
/* rubric heading styles: line / plate / tab label / light plate — as on the pages */
.rh { font: 700 12px/1 "PT Sans", sans-serif; text-transform: uppercase; letter-spacing: .02em; min-width: 0; }
.rh-plate { display: flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-plate > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.rh-line { border-top: 1px solid #000; } .rh-line .rh-plate { color: var(--rh); padding: 0; }
.rh-bar .rh-plate { background: var(--rh); color: #fff; }
.rh-tab { border-bottom: 2px solid var(--rh); } .rh-tab .rh-plate { display: inline-flex; max-width: 100%; background: var(--rh); color: #fff; border-radius: 3px 3px 0 0; }
.rh-tint .rh-plate { background: var(--rh-tint); color: var(--rh); box-shadow: inset 4px 0 0 var(--rh); padding-left: 10px; }
.rh-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 4px 0 10px; }
.rh-pick button { min-width: 0; overflow: hidden; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; min-height: 0; background: #fff; border: 2px solid var(--line); border-radius: 12px; text-align: left; box-shadow: none; }
.rh-pick button.on { border-color: var(--ink); }
.rh-pick small { font-size: 12px; color: var(--mute); font-weight: 500; }
.style-prev .rh { margin-bottom: 2px; }
/* a note's spot can be moved: the sheet lets the page behind it be touched, and pins follow the finger */
.veil.see-through { pointer-events: none; background: transparent; } .veil.see-through .dlg { pointer-events: auto; box-shadow: 0 -8px 30px rgba(0,0,0,.18); }
.note-pin .pin, .pin-new { touch-action: none; cursor: grab; }
.note-pin.dragging .pin { transform: scale(1.25); } .note-pin.dragging .pin, .pin-new.dragging { cursor: grabbing; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.note-pin.dragging .note-b { opacity: .55; }
.pin-new.dragging { animation: none; transform: scale(calc(1.25 / var(--z))); }
/* authors' styles */
.style-list { display: grid; gap: 8px; }
.style-card { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 0; box-shadow: none; font-weight: 400; white-space: normal; }
.style-card b { font-size: 15px; }
.byline-box { background: var(--fill); border-radius: 14px; padding: 10px 12px; }
/* header: interface language */
.lang-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; min-height: 36px; font-size: 13px; font-weight: 600; border-radius: 999px; }
/* templates: one card per uploaded PDF, its pages inside */
.card .th.many { box-shadow: 4px 4px 0 -1px #fff, 4px 4px 0 0 var(--line-2), 8px 8px 0 -1px #fff, 8px 8px 0 0 var(--line-2); margin: 0 8px 8px 0; position: relative; }
.pages-badge { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; background: rgba(20,18,15,.78); color: #fff; font: 600 12px system-ui, sans-serif; padding: 3px 8px; border-radius: 999px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; color: var(--mute); text-decoration: none; font-size: 14px; margin-bottom: 4px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.sheet-p { display: flex; flex-direction: column; gap: 6px; padding: 0; background: transparent; border: 0; box-shadow: none; min-height: 0; text-align: left; font-weight: 400; }
.sheet-p .th { width: 100%; background: #fff center / cover no-repeat; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.08); transition: transform .15s var(--press, ease); }
.sheet-p:active .th { transform: scale(.97); }
.sheet-cap { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-cap b { font-size: 14px; }

/* ---------- labels are never cut off, whatever the interface language ----------
   Text wraps onto the next line instead of ending in "…"; long words (German, Ukrainian compounds) are hyphenated
   by the browser using <html lang>, and a word longer than its box may break anywhere. */
button, .btn, .tabs a, .seg button, .card .bd b, .sheet-cap, .ic-cell span, .rh-plate, .rh-plate > span:last-child, .wiz-steps span,
.cmp-pick, .tools button, h1, h2, h3, label, .tag, .chip, .menu button, .ed-top .ttl {
  white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
}
/* controls break between words only, never inside one ("По-лоса", "Доба-вить"): a word is the smallest piece */
button, .btn, .tabs a, .seg button, .cmp-pick, .tag, .chip, .menu button, .wiz-steps span { hyphens: manual; -webkit-hyphens: manual; overflow-wrap: normal; word-break: keep-all; min-width: min-content; }
button, .btn { line-height: 1.2; padding-top: 4px; padding-bottom: 4px; text-align: center; }
button.ico { padding-top: 0; padding-bottom: 0; }
.card .bd b { line-height: 1.25; }
.tag { display: inline-block; max-width: 100%; }
/* the top section tabs: two lines rather than "Шабл…" */
.tabs a { text-align: center; line-height: 1.15; height: auto; min-height: var(--bar); }
@media (max-width: 640px) { .top .tabs a { height: auto; min-height: 42px; font-size: clamp(12px, 3.6vw, 14px); } }
/* the editor's bottom toolbar: equal cells, the word may take two short lines */
.tools button { text-align: center; line-height: 1.05; }
@media (max-width: 860px) { .tools button { overflow: visible; min-height: 50px; font-size: clamp(8.5px, 2.45vw, 10px); letter-spacing: -.01em; } }
/* the editor's title bar grows to fit a long name instead of cutting it */
.ed { grid-template-rows: auto 1fr; }
.ed-top { min-height: var(--bar); padding-top: 4px; padding-bottom: 4px; }
.ed-top .ttl { line-height: 1.15; font-size: clamp(12px, 3.4vw, 15px); min-width: 64px; flex: 1 1 64px; }
/* wizard steps and segmented switches wrap too */
.wiz-steps { align-items: stretch; } .wiz-steps span { display: flex; align-items: center; justify-content: center; font-size: 11.5px; line-height: 1.15; }
.seg { flex-wrap: wrap; } .seg button { flex: 1 1 auto; }
/* two fields side by side only where both fit; on a phone each gets the full width, so a select's text is not cut */
.grid2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.meta-line { display: inline-block; margin: 3px 0 2px; padding: 1px 7px; border-radius: 6px; background: var(--fill-2); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.4; }
/* ---------- frame signs on the page: quiet corner icons; words only on the selected frame (or while learning) ---------- */
.ed .blk .lbl { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font: 600 11px/1 system-ui, sans-serif; padding: 3px 7px 3px 4px; border-radius: 0 0 8px 0; background: rgba(10, 108, 255, .92); }
.ed .blk .lbl .g { display: inline-grid; place-items: center; width: 14px; height: 14px; }
.ed .blk .lbl svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ed .blk .lbl.sign { left: 2px; top: 2px; padding: 0; width: 18px; height: 18px; justify-content: center; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #0a6cff; box-shadow: 0 0 0 1px rgba(10, 108, 255, .35), 0 1px 3px rgba(0, 0, 0, .18); opacity: .85; }
.ed .blk .lbl.sign svg { width: 11px; height: 11px; stroke-width: 2.4; }
.ed .blk .lbl.sign.words { width: auto; padding: 0 7px 0 3px; border-radius: 9px; gap: 3px; font-size: 10px; }
.ed .blk .lbl.sign.words .g { width: 13px; height: 13px; }
.ed .blk:hover .lbl.sign { opacity: 1; }
@media (max-width: 860px) { .tools button { padding-left: 1px; padding-right: 1px; overflow-wrap: normal; } .tools { gap: 1px; } }
/* ---------- media: photos into frames ---------- */
.media-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.big-act { flex-direction: column; align-items: flex-start; text-align: left; gap: 4px; padding: 12px 14px; min-height: 76px; border-radius: 16px; font-weight: 600; }
.big-act small { font-weight: 400; font-size: 12px; opacity: .8; }
.lib { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 46dvh; overflow-y: auto; }
.lib-i { padding: 0; min-height: 0; border: 0; background: transparent; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.lib-i img { border: 0; border-radius: 0; display: block; }
.lib-i:active { transform: scale(.96); }
/* an empty photo frame shows a picture-with-plus sign (no words — same in every language) */
.ed .blk-image.is-empty::before { content: ''; background: center / calc(34px / var(--z)) no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2399958b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 5H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-6'/%3E%3Cpath d='M4 16l4-4 3 3 3-3 6 6'/%3E%3Cpath d='M19 2v6M16 5h6'/%3E%3C/svg%3E"); }
.ed.trace .blk-image.is-empty::before { content: ''; filter: hue-rotate(180deg) saturate(3); opacity: .8; }
/* waiting for a tap to place a photo; files dragged over the page */
.ed.placing .stage, .ed.placing .blk { cursor: copy; }
.ed.placing .blk-image { box-shadow: inset 0 0 0 calc(2px / var(--z)) #0a6cff; }
.ed.dropping .stage { outline: 3px dashed #0a6cff; outline-offset: -8px; }
/* toasts use the width they need (up to the screen), so a hint reads in one or two lines, not five */
.toast { width: max-content; max-width: min(92vw, 460px); text-align: left; line-height: 1.3; }
.toast button { flex: none; white-space: nowrap; }
/* the attach popover: big rounded card, icon + label rows (as in a chat app's "+" menu) */
.menu.pop { border-radius: 22px; padding: 8px; min-width: 230px; box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05); background: #fff; }
.menu.pop button { display: flex; align-items: center; justify-content: flex-start; gap: 14px; text-align: left; min-height: 52px; padding: 6px 14px; font-size: 16px; font-weight: 500; border-radius: 14px; border: 0; width: 100%; }
.menu.pop button:active { background: var(--fill); }
.menu.pop .ic { color: var(--ink); flex: none; }
.menu.pop .mi { display: flex; flex-direction: column; line-height: 1.2; } .menu.pop .mi small { color: var(--mute); font-size: 13px; font-weight: 400; }
.menu.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 10px; }
/* the attach popover: big rounded card, icon + label rows (as in a chat app's "+" menu) */
.menu.pop { border-radius: 22px; padding: 8px; min-width: 230px; box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05); background: #fff; }
.menu.pop button { display: flex; align-items: center; justify-content: flex-start; gap: 14px; text-align: left; min-height: 52px; padding: 6px 14px; font-size: 16px; font-weight: 500; border-radius: 14px; border: 0; width: 100%; background: transparent; }
.menu.pop button:active { background: var(--fill); }
.menu.pop .ic { color: var(--ink); flex: none; }
.menu.pop .mi { display: flex; flex-direction: column; line-height: 1.2; } .menu.pop .mi small { color: var(--mute); font-size: 13px; font-weight: 400; }
.menu.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 10px; }
/* the block's text field as a composer: white rounded card, the field grows, controls in one row under it */
.block-cmp { margin: 4px 0 0; }
.block-cmp .cmp-ta { width: 100%; min-height: 84px; resize: none; padding: 12px 14px 4px; font-size: 16px; line-height: 1.45; background: transparent; overflow-y: auto; }
.block-cmp .cmp-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px 6px; }
.block-cmp .cmp-b { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; border: 0; background: var(--fill); color: var(--ink); flex: none; }
.block-cmp .cmp-send, .block-cmp .cmp-send:hover { background: var(--acc) !important; color: #fff; border-radius: 50%; }
.block-cmp .cnt { font-size: 12.5px; color: var(--mute); padding: 0 4px; line-height: 1.25; }
.block-cmp .cnt.bad { color: var(--bad, #b3261e); font-weight: 600; }

/* ---------- accent: Maldives lagoon turquoise ----------
   Deep lagoon for buttons and active marks (white text on it stays readable), shallow water for light fills. */
:root { --acc: #0e94a8; --acc-d: #0a7a8c; --acc-l: #ddf4f7; --acc-ink: #fff; }
button.pri, .btn.pri { background: var(--acc); border-color: var(--acc); box-shadow: 0 1px 2px rgba(11, 122, 139, .35), 0 4px 14px rgba(14, 148, 168, .18); }
.cmp-send:hover { background: var(--acc-d); }
::selection { background: rgba(14, 148, 168, .22); }
input:focus, textarea:focus, select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(14, 148, 168, .16); outline: none; }

/* ---------- phones: no scrollbars at the edge (scrolling works the same) ---------- */
@media (hover: none), (max-width: 860px) {
  * { scrollbar-width: none; }
  *::-webkit-scrollbar { display: none; width: 0; height: 0; }
}
.tabs a.on, .top .tabs a.on { border-bottom-color: var(--acc); color: var(--ink); }
.meta-line { background: var(--acc-l); color: var(--acc-d); }
.tools button.on, .tools button.on .i { color: var(--acc); }
.wiz-steps span.on { background: var(--acc); color: #fff; }
.pages-badge { background: rgba(10, 122, 140, .88); }

/* ---------- accent: red paper napkin ----------
   Coral red with the napkin's embossed texture: a fine grid of pressed dots (a light rim above, a soft shadow below).
   Errors and "did not fit" move to a deeper crimson so they never look like a button. */
:root { --acc: #d93a45; --acc-d: #b82c37; --acc-l: #fde9ea; --acc-ink: #fff; --bad: #9f1a22; }
:root {
  --emboss: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .16) 0 .8px, transparent 1.25px),
            radial-gradient(circle at 50% 62%, rgba(90, 0, 10, .12) 0 .8px, transparent 1.35px);
}
button.pri, .btn.pri, .cmp-send, .block-cmp .cmp-send, .wiz-steps span.on, .mh-box {
  background-color: var(--acc) !important; background-image: var(--emboss); background-size: 5px 5px;
  box-shadow: 0 1px 2px rgba(170, 70, 0, .30), 0 4px 14px rgba(240, 106, 5, .20), inset 0 1px 0 rgba(255, 255, 255, .16);
}
@media (hover: hover) { button.pri:hover:not(:disabled), .btn.pri:hover, .cmp-send:hover { background-color: var(--acc-d) !important; } }
button.pri:active, .cmp-send:active { background-color: var(--acc-d) !important; }
.pages-badge { background: rgba(196, 82, 0, .88); }
::selection { background: rgba(240, 106, 5, .2); }
input:focus, textarea:focus, select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(240, 106, 5, .14); }
@keyframes pinpulse { 50% { box-shadow: 0 0 0 calc(10px / var(--z)) rgba(240, 106, 5, .25); } }
.ed .blk.noted { background-color: rgba(240, 106, 5, .08); }
/* a PDF is being made in the background: the button breathes, the wait panel explains the queue */
button.pri.working { position: relative; animation: breathe 1.4s ease-in-out infinite; }
button.pri.working::after { content: ''; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
@keyframes breathe { 50% { filter: brightness(1.12); transform: scale(1.03); } }
.job-wait { background: var(--acc-l); border-color: transparent; }
.job-wait p { margin: 0 0 6px; } .job-wait p:last-child { margin: 0; }
@media (prefers-reduced-motion: reduce) { button.pri.working { animation: none; } }
/* password field with an eye to show / hide it */
.pw { position: relative; display: block; width: 100%; }
.pw > input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--mute); box-shadow: none; }
.pw-eye:active { background: var(--fill); color: var(--ink); }

/* ================= desktop workspace (861 px and wider) =================
   A wider inspector with fields one can type into, a movable toolbar, a docked note window. */
@media (min-width: 861px) {
  .ed { grid-template-columns: minmax(0, 1fr) 380px; }
  .side-b { padding: 14px 16px 90px; }
  .side h3 { margin: 20px 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
  /* numbers: two per row, a real text field between small − and + */
  .side .grid4, .side .grid2 { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .stp input { font-size: 15px; padding: 8px 4px; min-width: 56px; flex: 1; }
  .stp button, .grid4 .stp button { width: 32px; min-height: 38px; }
  .stp:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(240, 106, 5, .14); }
  .side select, .side input:not([type=checkbox]):not([type=color]):not([type=range]), .side textarea { font-size: 15px; }
  .side .row.wrap { gap: 6px; }
  /* composer chips stay on one line */
  .cmp-pick { white-space: nowrap; flex: none; }
  .cmp-row { gap: 6px; }
  /* the note window docks over the inspector: the page and the point stay in full view */
  .veil.see-through { justify-content: flex-end; align-items: flex-start; padding: 76px 16px 0 0; }
  .veil.see-through .dlg { width: 348px; max-width: 348px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22), 0 0 0 1px var(--line); }
  /* toolbar: can be dragged by its grip; remembers where it was put */
  .tools { cursor: default; }
  .tools .grip { display: flex; align-items: center; justify-content: center; width: 18px; min-width: 18px; align-self: stretch; cursor: grab; color: var(--line-2); border-radius: 10px; touch-action: none; }
  .tools .grip:hover { color: var(--mute); background: var(--fill); }
  .tools.moving { box-shadow: 0 18px 50px rgba(0, 0, 0, .28); } .tools.moving .grip { cursor: grabbing; }
  .tools.placed { transform: none; bottom: auto; }
  .tools button { min-width: 62px; padding: 4px 8px; font-size: 11px; }
}
@media (min-width: 1280px) { .ed { grid-template-columns: minmax(0, 1fr) 420px; } .veil.see-through .dlg { width: 388px; max-width: 388px; } }
@media (max-width: 860px) { .tools .grip { display: none; } }
/* note mode: a clear banner on the page area until the spot is chosen */
.tool-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 25; display: none; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); white-space: nowrap; max-width: calc(100% - 24px); }
.tool-hint kbd { background: rgba(255, 255, 255, .18); border-radius: 6px; padding: 1px 7px; font: 600 12px system-ui, sans-serif; }
.ed.tool-note .tool-hint { display: inline-flex; }
@media (max-width: 860px) { .tool-hint { white-space: normal; text-align: center; font-size: 13px; } .tool-hint kbd { display: none; } }
/* dictation: while the microphone listens the composer shows live bars, the time and a stop button */
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-height: 48px; }
.rec-bar .bars { flex: 1; display: flex; align-items: center; gap: 3px; height: 28px; overflow: hidden; min-width: 0; }
.rec-bar .bars i { flex: none; width: 3px; border-radius: 2px; background: var(--mute); height: 4px; opacity: .55; transition: height .12s ease; }
.rec-bar.live .bars i { background: var(--acc); opacity: 1; animation: recbar 1s ease-in-out infinite; animation-delay: calc(var(--d) * -1s); }
@keyframes recbar { 0%, 100% { height: 4px; } 50% { height: calc(6px + var(--h) * 20px); } }
.rec-bar .t { font: 600 14px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 38px; text-align: right; }
.rec-bar .stop { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; border: 0; background: var(--ink); color: #fff; flex: none; }
.rec-bar .stop::before { content: ''; width: 12px; height: 12px; border-radius: 3px; background: #fff; }
.rec-interim { padding: 0 12px 6px; color: var(--mute); font-size: 14px; min-height: 0; }
.rec-hud { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 96; width: min(420px, calc(100vw - 24px)); background: #fff; border-radius: 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22), 0 0 0 1px var(--line); }
.cmp.recording .cmp-row { display: none; }
@media (prefers-reduced-motion: reduce) { .rec-bar.live .bars i { animation: none; height: 12px; } }
/* the note banner sits over the page area (not over the inspector) */
.tool-hint { top: calc(var(--bar) + 14px); }
@media (min-width: 861px) { .tool-hint { left: calc((100% - 380px) / 2); } }
@media (min-width: 1280px) { .tool-hint { left: calc((100% - 420px) / 2); } }
.cmp-pick { white-space: nowrap; }

/* ---------- pickers: every <select> as a chat-app style field + rounded list with a tick ---------- */
select.sp-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.sp { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 8px 10px 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-weight: 400; text-align: left; box-shadow: none; }
.sp .sp-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp.empty .sp-l { color: var(--mute); }
.sp .ic { color: var(--mute); flex: none; transition: transform .15s ease; }
.sp:hover:not(:disabled) { border-color: var(--line-2); }
.sp:focus-visible { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(240, 106, 5, .14); }
.sp[aria-expanded="true"] .ic, .sp:has(+ .menu) .ic { transform: rotate(180deg); }
.menu.pick { overflow-y: auto; overscroll-behavior: contain; padding: 6px; z-index: 120; }
.menu.pick button { min-height: 44px; font-size: 15px; padding: 6px 10px 6px 12px; gap: 10px; justify-content: space-between; }
.menu.pick button .ml { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.menu.pick button .mk { width: 18px; flex: none; color: var(--acc); display: grid; place-items: center; }
.menu.pick button.on { font-weight: 600; background: var(--fill); }
.menu.pick button:focus-visible { outline: none; background: var(--fill-2); }
.menu.pick button:disabled { opacity: .45; }
/* the header gear */
.top .gear { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--mute); text-decoration: none; }
.top .gear:hover { background: var(--fill); color: var(--ink); }
.top .gear.on { color: var(--acc); background: var(--acc-l); }
.key-how { margin: 0 0 10px; }
/* editable title in the editor's bar: looks like text, a pencil says it can be renamed */
.ed-top .ttl { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; box-shadow: none; padding: 4px 8px; min-height: 36px; border-radius: 10px; text-align: left; color: var(--ink); font-weight: 600; justify-content: flex-start; cursor: text; }
.ed-top .ttl .ttl-t { min-width: 0; }
.ed-top .ttl .ic { color: var(--mute); opacity: .55; flex: none; }
.ed-top .ttl:hover { background: var(--fill); } .ed-top .ttl:hover .ic { opacity: 1; }
.ed-top .ttl.editing { padding: 0; background: transparent; }
.ttl-in { width: 100%; min-width: 120px; font: inherit; font-weight: 600; padding: 6px 10px; border: 1px solid var(--acc); border-radius: 10px; box-shadow: 0 0 0 3px rgba(240, 106, 5, .14); }
/* rename button next to a heading */
.h-edit { display: inline-grid; place-items: center; width: 34px; height: 34px; min-height: 34px; padding: 0; margin-left: 6px; vertical-align: middle; border: 0; border-radius: 10px; background: transparent; color: var(--mute); box-shadow: none; }
.h-edit:hover { background: var(--fill); color: var(--ink); }
.menu.pick button, .menu.pick button.on { color: var(--ink); }
.menu.pick button.on { background: var(--fill); }

/* ---------- editor bar and toolbar: words are never cut into syllables ---------- */
/* toolbar labels stay one word on one line; a long word is made a little smaller instead (fitToolLabels) */
.tools button { white-space: nowrap; hyphens: manual; -webkit-hyphens: manual; overflow-wrap: normal; word-break: normal; min-width: 0; }
@media (max-width: 860px) { .tools button { overflow: hidden; } }
/* the editor's title: at most two lines, broken between words, the rest shown on tap (rename) */
.ed-top .ttl { hyphens: manual; -webkit-hyphens: manual; word-break: normal; overflow-wrap: normal; min-width: 0; flex: 1 1 0; }
.ed-top .ttl .ttl-t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.2; }
.ed-top button.pri, .ed-top .pgnav, .ed-top .pgnav button { white-space: nowrap; hyphens: manual; flex: none; }
@media (max-width: 860px) {
  .ed-top { gap: 4px; padding: 4px 6px; }
  .ed-top .ttl { font-size: 14px; padding: 4px; }
  .ed-top .ttl .ic { display: none; }
  .ed-top .pgnav button.ico { width: 38px; min-width: 38px; }
  .ed-top .pgnav .n { min-width: 46px; padding: 0 6px; }
  .ed-top button.pri { padding: 0 12px; font-size: 14px; }
}
/* the header gear keeps its round shape */
.top .gear .ic, .top .gear svg { width: 22px; height: 22px; flex: none; display: block; }
/* note mode on a phone: a compact pill above the bottom toolbar, not over the title bar */
@media (max-width: 860px) {
  .tool-hint { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100vw - 24px); padding: 8px 8px 8px 14px; font-size: 13.5px; line-height: 1.3; white-space: normal; text-align: left; border-radius: 16px; }
}
/* phone: "AI analysis" is a round icon button, so the title gets the room */
@media (max-width: 860px) {
  .ed-top .ai-an { width: 44px; min-width: 44px; padding: 0; border-radius: 14px; }
  .ed-top .ai-an .lbl-t { display: none; }
  .ed-top .ttl .ttl-t { overflow-wrap: break-word; }
}

/* ================= one message box for the whole app (composer) =================
   White rounded card, borderless growing field, one row of round buttons under it: "+", chips, mic, send. */
.cmp, .block-cmp { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05); margin: 4px 0 0; transition: border-color .15s ease, box-shadow .15s ease; cursor: text; }
.cmp:focus-within { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 22px rgba(0, 0, 0, .08); }
.cmp .cmp-ta, .block-cmp .cmp-ta { display: block; width: 100%; min-height: 44px; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; resize: none; padding: 10px 12px 4px; font-size: 16px; line-height: 1.45; color: var(--ink); overflow-y: auto; border-radius: 16px; }
.cmp .cmp-row, .block-cmp .cmp-row { display: flex; align-items: center; gap: 6px; padding: 2px; margin: 0; min-width: 0; cursor: default; }
.cmp .cmp-b, .block-cmp .cmp-b { width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%; border: 0; background: var(--fill); color: var(--ink); box-shadow: none; flex: none; }
.cmp .cmp-b:active { transform: scale(.94); }
.cmp .cmp-b.on { background: var(--acc-l); color: var(--acc-d); }
.cmp .cmp-send, .cmp .cmp-send:hover, .block-cmp .cmp-send { border-radius: 50%; color: #fff; }
.cmp .cmp-send:disabled { opacity: .35; filter: grayscale(.3); }
.cmp .cmp-pick { min-height: 36px; padding: 0 10px; border-radius: 999px; background: var(--fill); color: var(--ink); font-size: 14px; }
.cmp .cnt { font-size: 12.5px; color: var(--mute); padding: 0 4px; }
/* a one-line box (a new rule, a short answer) */
.cmp-mini { display: flex; align-items: flex-end; border-radius: 999px; padding: 4px 4px 4px 6px; }
.cmp-mini .cmp-ta { min-height: 40px; padding: 9px 10px; flex: 1; }
.cmp-mini .cmp-row { padding: 0; flex: none; } .cmp-mini .cmp-row .grow { display: none; }
.cmp-mini.recording { display: block; border-radius: 22px; }
/* listening: the row turns into live bars at the bottom of the same card; recognised words appear just above them */
.cmp.recording .cmp-row { display: none; }
.rec-in .rec-interim { padding: 2px 12px 0; }
.rec-in .rec-bar { padding: 4px 4px 2px 12px; }
.rec-hud { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
/* other large text fields share the look */
textarea:not(.cmp-ta) { border-radius: 18px; padding: 12px 14px; font-size: 16px; line-height: 1.45; background: #fff; }
.q .cmp { margin-bottom: 10px; }

/* ---------- the active tool and its hint: light, in the accent colour (no black slabs) ---------- */
.tools button.on { background: var(--acc-l) !important; color: var(--acc-d) !important; box-shadow: inset 0 0 0 1px rgba(240, 106, 5, .22); }
.tools button.on .i { color: var(--acc) !important; }
.tool-hint { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 12px 32px rgba(0, 0, 0, .14); font-weight: 500; gap: 10px; }
.tool-hint > .ic { width: 30px; height: 30px; border-radius: 50%; background: var(--acc-l); color: var(--acc); display: grid; place-items: center; flex: none; }
.tool-hint kbd { background: var(--fill); color: var(--mute); }
.tool-hint .th-x { color: var(--mute); min-height: 30px; width: 30px; padding: 0; border-radius: 50%; }
.tool-hint .th-x:hover { background: var(--fill); color: var(--ink); }

/* ---------- footer: always at the bottom of the screen — "made with ♥ 1001site.com" ---------- */
.made-by { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(to top, rgba(240, 238, 230, .96) 55%, rgba(240, 238, 230, 0)); }
.made-by a { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; color: var(--mute); text-decoration: none; font-size: 13px; line-height: 1;
  background: rgba(255, 255, 255, .78); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: color .15s ease, border-color .15s ease; }
.made-by a:hover { color: var(--ink); border-color: var(--line-2); }
.made-by b { color: var(--ink); font-weight: 600; letter-spacing: .01em; }
.made-by .mb-heart { display: inline-grid; color: var(--acc); animation: mbbeat 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes mbbeat { 0%, 70%, 100% { transform: scale(1); } 76% { transform: scale(1.22); } 82% { transform: scale(1); } 88% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .made-by .mb-heart { animation: none; } }
/* content never hides behind it */
main.dash, .auth { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
/* number and date on the cover: a see-through frosted label, readable over any page; the page count moves to the top */
.card .th { position: relative; }
.cover-label { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 1px; padding: 7px 10px 8px; border-radius: 12px;
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12), inset 0 0 0 1px rgba(255, 255, 255, .55); color: var(--ink); line-height: 1.2; pointer-events: none; }
.cover-label b { font-size: 14px; font-weight: 700; color: var(--acc-d); letter-spacing: .01em; }
.cover-label span { font-size: 12.5px; color: #3a3833; }
.card .th .pages-badge { bottom: auto; top: 8px; left: 8px; }
/* required crossword words: picture · word + clue · remove */
.req-list { display: grid; gap: 8px; margin-bottom: 4px; }
.req-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 6px; }
.req-f { flex: 1; min-width: 0; display: grid; gap: 4px; }
.req-f input { border: 0; box-shadow: none !important; padding: 4px 8px; min-height: 30px; background: transparent; }
.req-f .req-a { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.req-f .req-q { font-size: 14px; color: var(--mute); border-top: 1px solid var(--line); border-radius: 0; }
.req-pic { width: 54px; height: 54px; min-height: 54px; flex: none; padding: 0; border-radius: 12px; border: 1px dashed var(--line-2); background: var(--fill) center / cover no-repeat; color: var(--mute); box-shadow: none; }
.req-pic.has { border-style: solid; }
.req-add { justify-self: start; border: 1px dashed var(--line-2); background: transparent; box-shadow: none; border-radius: 999px; min-height: 38px; padding: 0 14px; color: var(--ink); font-weight: 500; }

/* all captions sit on the cover: name (two lines at most), number and date, a quiet line of facts; nothing under it */
.card .th { border-bottom: 0; min-height: 150px; }
.cover-label { gap: 2px; padding: 8px 11px 9px; background: rgba(255, 255, 255, .8); }
.cover-label .cl-t { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.22; letter-spacing: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: normal; }
.cover-label .cl-n { font-size: 13px; font-weight: 700; color: var(--acc-d); }
.cover-label .cl-s { font-size: 12px; color: #55524b; }
.card .th.many { margin-bottom: 8px; }
/* InDesign import report */
.idml-rep { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.idml-rep li { position: relative; padding-left: 24px; line-height: 1.35; overflow-wrap: anywhere; }
.idml-rep li::before { content: '✓'; position: absolute; left: 2px; top: 0; color: #2e8b57; font-weight: 700; }
.idml-rep li.warn::before { content: '!'; color: var(--acc-d); left: 6px; }

/* missing fonts of a layout: upload or find */
.font-fix { display: grid; gap: 8px; margin-top: 10px; }
.font-fix:empty { display: none; }
.ff-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ff-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 9px 10px 9px 12px; }
.ff-row b { overflow-wrap: anywhere; } .ff-row .small { line-height: 1.35; margin-top: 2px; }
.ff-row.linked { background: #f6faf6; border-color: #cfe3d2; }
.ff-row button { flex: none; white-space: nowrap; }
.ff-ok { display: flex; align-items: center; gap: 6px; margin: 0; color: #2e8b57; }

/* ---------- accent: Gazetify orange ----------
   The orange of the icon. Fills (buttons, the send arrow) a touch deeper than the logo so white type on them stays
   readable; text and hover in a darker burnt orange. Errors stay crimson — never confused with a button. */
:root { --acc: #f06a05; --acc-d: #c25200; --acc-l: #fff0e3; --acc-ink: #fff; --brand: #ff7409; --bad: #b3261e; --emboss: none; }
button.pri, .btn.pri, .cmp-send, .block-cmp .cmp-send, .wiz-steps span.on, .mh-box {
  background-image: none !important;
  box-shadow: 0 1px 2px rgba(170, 70, 0, .28), 0 4px 16px rgba(255, 116, 9, .28), inset 0 1px 0 rgba(255, 255, 255, .18) !important;
}
.logo { display: inline-flex; align-items: center; gap: 7px; }
.logo b { color: var(--brand); font-weight: inherit; }
.logo-mark { width: 28px; height: 28px; flex: none; margin: -4px 0; }
.top .logo .logo-mark { width: 26px; height: 26px; }
