/* Land Grou AI — дизайн-система (редизайн 11.2026).
   Бренд з landgrou.com: зелений #228F5D, графіт #1D2D3C, знак-полум'я.
   Шкала відступів 4/8/12/16/24/32/48, радіуси 10 (поля) / 16 (картки) / 24 (hero). */

:root {
  --brand:#228F5D; --brand-600:#1C7A4F; --brand-50:#E8F5EE; --on-brand:#fff; --ink:#1D2D3C;
  --bg:#F5F7F6; --surface:#FFFFFF; --surface-2:#F0F3F1; --line:#E3E8E5; --line-strong:#D2D9D5;
  --text:#14201A; --muted:#5E6B64; --faint:#8A958F;
  --legal:#4F5FD0; --legal-50:#EEF0FC; --lab:#C27A2C; --lab-50:#FBF1E4; --kadry:#1F9A8A; --kadry-50:#E4F5F2;
  --warn:#B97C10; --warn-50:#FDF4E2; --danger:#C2453B; --danger-50:#FCECEA; --ok:#228F5D;
  --sh-1:0 1px 2px rgba(16,32,24,.05),0 1px 1px rgba(16,32,24,.03);
  --sh-2:0 1px 2px rgba(16,32,24,.04),0 12px 32px -8px rgba(16,32,24,.12);
  --r-field:10px; --r-card:16px; --r-hero:24px;
  --side-bg:rgba(251,252,251,.78); --side-solid:#FBFCFB; --user-bubble:#1D2D3C; --user-text:#fff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand:#3DBF83; --brand-600:#33A671; --brand-50:#15281F; --on-brand:#06140D; --ink:#E6EEE9;
  --bg:#0E1512; --surface:#141D19; --surface-2:#1A2420; --line:#24302B; --line-strong:#2F3D37;
  --text:#E8EFEB; --muted:#9AA8A1; --faint:#6E7C75;
  --legal:#8E9BF0; --legal-50:#1C2140; --lab:#E3A35C; --lab-50:#2E2214; --kadry:#5CCDBB; --kadry-50:#132B27;
  --warn:#E5B04A; --warn-50:#2D2410; --danger:#EE7C71; --danger-50:#2E1715; --ok:#3DBF83;
  --sh-1:0 0 0 1px transparent; --sh-2:0 16px 40px -12px rgba(0,0,0,.6);
  --side-bg:rgba(18,26,22,.78); --side-solid:#121A16; --user-bubble:#2A3A33; --user-text:#E8EFEB;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand:#3DBF83; --brand-600:#33A671; --brand-50:#15281F; --on-brand:#06140D; --ink:#E6EEE9;
    --bg:#0E1512; --surface:#141D19; --surface-2:#1A2420; --line:#24302B; --line-strong:#2F3D37;
    --text:#E8EFEB; --muted:#9AA8A1; --faint:#6E7C75;
    --legal:#8E9BF0; --legal-50:#1C2140; --lab:#E3A35C; --lab-50:#2E2214; --kadry:#5CCDBB; --kadry-50:#132B27;
    --warn:#E5B04A; --warn-50:#2D2410; --danger:#EE7C71; --danger-50:#2E1715; --ok:#3DBF83;
    --sh-1:0 0 0 1px transparent; --sh-2:0 16px 40px -12px rgba(0,0,0,.6);
    --side-bg:rgba(18,26,22,.78); --side-solid:#121A16; --user-bubble:#2A3A33; --user-text:#E8EFEB;
    color-scheme: dark;
  }
}

* { box-sizing:border-box; }
html, body { margin:0; }
html { background:var(--bg); scroll-padding-top:24px; }
body { overflow-x:clip; background:var(--bg); color:var(--text); font:400 15px/1.5 Inter,system-ui,-apple-system,"Segoe UI",sans-serif; -webkit-font-smoothing:antialiased; }
h1,h2,h3,h4 { font-family:Manrope,Inter,sans-serif; margin:0; letter-spacing:-.015em; color:var(--text); }
a { color:inherit; }
button, input, select, textarea { font:inherit; color:inherit; }
:focus-visible { outline:2px solid var(--brand); outline-offset:2px; border-radius:6px; }
[hidden] { display:none !important; }
svg.i { width:18px; height:18px; flex:none; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.num { font-variant-numeric:tabular-nums; }
.hint { font-size:12.5px; color:var(--faint); }
.legal { --c:var(--legal); --c50:var(--legal-50); }
.lab   { --c:var(--lab);   --c50:var(--lab-50); }
.kadry { --c:var(--kadry); --c50:var(--kadry-50); }
.warn  { --c:var(--warn);  --c50:var(--warn-50); }
.danger{ --c:var(--danger);--c50:var(--danger-50); }
.dot { width:8px; height:8px; border-radius:50%; background:var(--c, var(--brand)); flex:none; display:inline-block; }

/* ============ оболонка ============ */
.app { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh;
  background:linear-gradient(90deg, var(--side-solid) 0 247px, var(--line) 247px 248px, transparent 248px); }
.side { position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:24px; padding:24px 16px;
  background:var(--side-bg); backdrop-filter:blur(16px) saturate(1.4); -webkit-backdrop-filter:blur(16px) saturate(1.4); border-right:1px solid var(--line); }
.logo { display:flex; align-items:center; gap:10px; padding:0 8px; text-decoration:none; }
.logo-mark { width:34px; height:34px; color:var(--brand); flex:none; }
.logo-txt b { display:block; font:800 17px/1 Manrope,sans-serif; color:var(--brand); letter-spacing:.01em; }
.logo-txt span { font:500 11px/1.6 Inter,sans-serif; color:var(--faint); }
.search { display:flex; align-items:center; gap:8px; padding:8px 12px; border:1px solid var(--line); border-radius:var(--r-field);
  background:var(--surface); color:var(--faint); font-size:13px; cursor:pointer; text-align:left; transition:border-color .15s; }
.search:hover { border-color:var(--line-strong); color:var(--muted); }
.search kbd { margin-left:auto; font:500 11px Inter,sans-serif; padding:2px 6px; border-radius:6px; background:var(--surface-2); color:var(--muted); }
.nav { display:flex; flex-direction:column; gap:4px; }
.nav a { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:12px; color:var(--muted); text-decoration:none;
  font-weight:500; font-size:14px; transition:background .15s, color .15s; }
.nav a:hover { background:var(--surface-2); color:var(--text); }
.nav a.on { background:var(--surface); color:var(--text); box-shadow:var(--sh-1), 0 0 0 1px var(--line); }
.nav a.on svg { color:var(--brand); }
.nav .cnt { margin-left:auto; font-size:11px; font-weight:600; padding:1px 7px; border-radius:999px; background:var(--warn-50); color:var(--warn); }
.side-foot { margin-top:auto; display:flex; align-items:center; gap:8px; padding:0 4px; }
.side-foot small { color:var(--faint); font-size:11px; margin-left:auto; }
.theme-t { display:flex; padding:3px; border-radius:999px; background:var(--surface-2); border:1px solid var(--line); }
.theme-t button { border:0; background:none; color:var(--faint); width:30px; height:26px; border-radius:999px; display:grid; place-items:center; cursor:pointer; }
.theme-t button svg { width:15px; height:15px; }
.theme-t button.on { background:var(--surface); color:var(--text); box-shadow:var(--sh-1), 0 0 0 1px var(--line); }
.main { min-width:0; padding:32px 48px 64px; }
.wrap { max-width:1100px; margin:0 auto; }
.mtop { display:none; }
.view { display:none; }
.view.on { display:block; animation:fade .35s ease; }
@keyframes fade { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.subpanel { display:none; }
.subpanel.on { display:block; animation:fade .3s ease; }
.subpanel.check-grid.on { display:grid; }

/* ============ примітиви ============ */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card); box-shadow:var(--sh-1); }
.panel { padding:20px; }
.panel-h { display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.panel-h h3 { font-size:16px; font-weight:700; }
.panel-h .hint, .panel-h .pill { margin-left:auto; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; height:40px; padding:0 16px; border-radius:var(--r-field);
  font:600 14px Inter,sans-serif; border:1px solid transparent; cursor:pointer; text-decoration:none; white-space:nowrap;
  transition:transform .12s, background .15s, box-shadow .15s, border-color .15s, color .15s; }
.btn:active:not(:disabled) { transform:scale(.98); }
.btn:disabled { opacity:.55; cursor:default; }
.btn-primary { background:var(--brand); color:var(--on-brand); box-shadow:inset 0 1px 0 rgba(255,255,255,.15), 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-primary:hover:not(:disabled) { background:var(--brand-600); }
.btn-secondary { background:var(--surface); border-color:var(--line-strong); color:var(--text); }
.btn-secondary:hover { background:var(--surface-2); }
.btn-ghost { background:none; color:var(--muted); }
.btn-ghost:hover { background:var(--surface-2); color:var(--text); }
.btn-danger { background:var(--surface); border-color:var(--line-strong); color:var(--muted); }
.btn-danger:hover { border-color:var(--danger); color:var(--danger); }
.btn-lg { height:48px; padding:0 22px; font-size:15px; }
.btn-block { width:100%; }
.icon-btn { width:44px; height:44px; border-radius:14px; border:0; display:grid; place-items:center; cursor:pointer; background:var(--surface-2); color:var(--muted); flex:none; transition:background .15s, color .15s, transform .12s; }
.icon-btn:hover:not(:disabled) { color:var(--text); }
.icon-btn:active:not(:disabled) { transform:scale(.95); }
.icon-btn.sm { width:38px; height:38px; border-radius:12px; }
.icon-btn.go { background:var(--brand); color:var(--on-brand); }
.icon-btn.go:hover:not(:disabled) { background:var(--brand-600); color:var(--on-brand); }
.icon-btn:disabled { opacity:.45; cursor:default; }
.field { width:100%; font:400 14px Inter,sans-serif; color:var(--text); background:var(--surface); border:1px solid var(--line-strong);
  border-radius:var(--r-field); padding:10px 12px; outline:none; transition:border-color .15s, box-shadow .15s; }
.field:focus { border-color:var(--brand); box-shadow:0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.field::placeholder { color:var(--faint); }
textarea.field { resize:vertical; min-height:140px; line-height:1.55; }
select.field { appearance:none; padding-right:36px; cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A958F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center; }
.seg { display:inline-flex; padding:4px; gap:2px; border-radius:12px; background:var(--surface-2); border:1px solid var(--line); }
.seg button { border:0; background:none; font:600 13px Inter,sans-serif; color:var(--muted); padding:7px 14px; border-radius:9px; cursor:pointer; display:flex; align-items:center; gap:7px; white-space:nowrap; transition:color .15s; }
.seg button svg { width:15px; height:15px; }
.seg button:hover { color:var(--text); }
.seg button.on { background:var(--surface); color:var(--text); box-shadow:var(--sh-1), 0 0 0 1px var(--line); }
.seg.sm { padding:3px; }
.seg.sm button { padding:5px 10px; font-size:12.5px; }
.pill { font:600 12px Inter,sans-serif; padding:3px 9px; border-radius:999px; white-space:nowrap; }
.pill.ok { background:var(--brand-50); color:var(--ok); } .pill.warn { background:var(--warn-50); color:var(--warn); }
.pill.bad { background:var(--danger-50); color:var(--danger); } .pill.n { background:var(--surface-2); color:var(--muted); }
.head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:24px; flex-wrap:wrap; }
.head h1 { font-size:28px; font-weight:700; }
.head p { margin:4px 0 0; color:var(--muted); font-size:14px; }
.crumb { color:var(--faint); font-size:13px; margin-bottom:6px; }
.sect-title { display:flex; align-items:baseline; gap:12px; margin:32px 0 14px; flex-wrap:wrap; }
.sect-title:first-child { margin-top:0; }
.sect-title h2 { font-size:15px; font-weight:700; color:var(--muted); letter-spacing:0; }
.sub-h { margin:16px 0 8px; font-size:13px; color:var(--muted); font-weight:700; }
.row-actions { display:flex; gap:10px; margin-top:12px; align-items:center; flex-wrap:wrap; }
.row-actions .field { flex:1 1 220px; width:auto; }
.row-actions .btn:last-child { margin-left:auto; }

/* статус: спінер + текст (єдиний для всього сайту) */
.status { display:none; align-items:center; gap:10px; margin-top:12px; font-size:13.5px; color:var(--muted); }
.status.show { display:flex; }
.spinner { width:16px; height:16px; border-radius:50%; border:2px solid var(--line-strong); border-top-color:var(--brand); animation:spin .8s linear infinite; flex:none; }
@keyframes spin { to { transform:rotate(360deg); } }

/* відповідь / результат */
.gen-answer { display:none; margin-top:14px; padding:14px 16px; background:var(--brand-50); border-radius:12px; font-size:14px; white-space:pre-wrap; line-height:1.55; color:var(--text); }
.gen-answer.show, .gen-answer[id]:not(:empty) { display:block; }
.gen-answer.error { background:var(--danger-50); color:var(--danger); }
.gen-answer a.download-link { display:flex; align-items:center; justify-content:center; gap:8px; margin-top:12px; height:40px; border-radius:var(--r-field);
  background:var(--surface); border:1px solid var(--line-strong); font-weight:600; text-decoration:none; color:var(--text); white-space:normal; }
.gen-answer a.download-link:hover { border-color:var(--brand); color:var(--brand); }
.gen-answer br + a.download-link { margin-top:4px; }
.alerts-empty { color:var(--faint); font-size:13.5px; padding:8px 0; }

/* ============ асистент ============ */
.chat-shell { display:flex; flex-direction:column; }
.hero { position:relative; padding:48px 0 28px; text-align:center; }
.hero::before { content:""; position:absolute; inset:-32px -48px auto; height:420px; z-index:-1; pointer-events:none;
  background:radial-gradient(600px 260px at 50% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
             radial-gradient(400px 200px at 80% 30%, color-mix(in srgb, var(--kadry) 10%, transparent), transparent 70%),
             radial-gradient(400px 200px at 20% 40%, color-mix(in srgb, var(--lab) 8%, transparent), transparent 70%); }
.hero h1 { font-size:40px; font-weight:800; letter-spacing:-.03em; text-wrap:balance; }
.hero p { color:var(--muted); margin:8px 0 0; font-size:16px; }
.dock { width:100%; max-width:760px; margin:0 auto; }
.ask { display:flex; align-items:flex-end; gap:8px; padding:10px 10px 10px 20px; background:var(--surface);
  border:1px solid var(--line-strong); border-radius:var(--r-hero); box-shadow:var(--sh-2); transition:border-color .15s, box-shadow .15s; }
.ask:focus-within { border-color:color-mix(in srgb, var(--brand) 55%, var(--line-strong)); box-shadow:var(--sh-2), 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); }
.ask textarea { flex:1; min-width:0; border:0; outline:0; resize:none; background:none; font:400 16px/1.5 Inter,sans-serif; color:var(--text); padding:10px 0; min-height:48px; max-height:220px; }
.ask textarea::placeholder { color:var(--faint); }
.ask textarea:focus-visible { outline:none; }
.mic-btn.listening { background:var(--danger); color:#fff; animation:pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow:0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); } 50% { box-shadow:0 0 0 8px transparent; } }
.dock .status { justify-content:center; }
.chips { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; max-width:820px; margin:16px auto 0; }
.chip { display:inline-flex; align-items:center; gap:7px; font-size:13px; color:var(--muted); padding:7px 12px; border-radius:999px;
  background:var(--surface); border:1px solid var(--line); cursor:pointer; transition:border-color .15s, color .15s, transform .12s; }
.chip:hover { border-color:var(--line-strong); color:var(--text); }
.chip:active { transform:scale(.98); }
.chat-top { display:none; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; }
.chat-title { font-size:20px; font-weight:700; }
.chat-shell.chatting { max-width:860px; min-height:calc(100vh - 96px); }
.chat-shell.chatting .hero, .chat-shell.chatting .chips, .chat-shell.chatting .home-actions { display:none; }
.chat-shell.chatting .chat-top { display:flex; }
.chat-shell.chatting .dock { position:sticky; bottom:16px; max-width:none; margin-top:auto; padding-top:24px;
  background:linear-gradient(to top, var(--bg) 70%, transparent); }
.chat-feed { display:flex; flex-direction:column; gap:22px; }
.chat-feed:empty { display:none; }
.chat-shell.chatting .chat-feed { padding-bottom:8px; }
.msg { display:flex; flex-direction:column; gap:8px; max-width:88%; position:relative; animation:fade .3s ease; }
.msg-user { align-self:flex-end; align-items:flex-end; max-width:72%; }
.msg-user .bubble { background:var(--user-bubble); color:var(--user-text); padding:12px 16px; border-radius:18px 18px 6px 18px; font-size:15px; white-space:pre-wrap; }
.msg-bot { align-self:flex-start; align-items:flex-start; padding-left:44px; --c:var(--brand); --c50:var(--brand-50); }
.msg-legal { --c:var(--legal); --c50:var(--legal-50); } .msg-lab { --c:var(--lab); --c50:var(--lab-50); } .msg-kadry { --c:var(--kadry); --c50:var(--kadry-50); }
.msg-bot::before { content:""; position:absolute; left:0; top:0; width:32px; height:32px; border-radius:10px; background:var(--c50); }
.msg-bot::after { content:""; position:absolute; left:8px; top:8px; width:16px; height:16px; background:var(--c);
  -webkit-mask:var(--ico) center/contain no-repeat; mask:var(--ico) center/contain no-repeat;
  --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z'/%3E%3C/svg%3E"); }
.msg-legal::after { --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z'/%3E%3Cpath d='m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z'/%3E%3Cpath d='M7 21h10M12 3v18M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2'/%3E%3C/svg%3E"); }
.msg-lab::after { --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 2v7.31M14 9.3V2M8.5 2h7M14 9.3a6.5 6.5 0 1 1-4 0M5.52 16h12.96'/%3E%3C/svg%3E"); }
.msg-kadry::after { --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3C/svg%3E"); }
.msg-bot .bubble { background:var(--surface); border:1px solid var(--line); border-radius:6px 18px 18px 18px; padding:14px 16px;
  box-shadow:var(--sh-1); font-size:15px; white-space:pre-wrap; line-height:1.6; max-width:100%; overflow-wrap:anywhere; }
.msg-bot .bubble.error { background:var(--danger-50); border-color:transparent; color:var(--danger); }
.msg-thinking .bubble { background:none; border:0; box-shadow:none; padding:6px 0; font-size:14px;
  background-image:linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size:200% 100%;
  -webkit-background-clip:text; background-clip:text; color:transparent; animation:shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position:-200% 0; } }
.bot-badge { display:inline-flex; align-items:center; gap:6px; font:700 11px/1 Inter,sans-serif; letter-spacing:.05em; text-transform:uppercase;
  color:var(--c); background:var(--c50); padding:5px 9px; border-radius:999px; margin-top:6px; }
.sources-box { font-size:12.5px; color:var(--muted); }
.sources-box > summary { display:inline-flex; align-items:center; gap:6px; cursor:pointer; list-style:none; padding:5px 10px; border-radius:999px;
  background:var(--surface); border:1px solid var(--line); font-weight:500; }
.sources-box > summary::-webkit-details-marker { display:none; }
.sources-box > summary::before { content:"›"; display:inline-block; transition:transform .15s; color:var(--faint); }
.sources-box[open] > summary::before { transform:rotate(90deg); }
.sources-box ul { margin:8px 0 0; padding:10px 12px 10px 28px; background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.sources-box li { padding:2px 0; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; }
.sql-pre { margin:8px 0 0; padding:10px 12px; background:var(--surface-2); border-radius:12px; font-size:12px; white-space:pre-wrap; word-break:break-word; overflow-x:auto; }
.tool-badge { display:inline-flex; font:500 11.5px ui-monospace,Menlo,monospace; color:var(--faint); padding:4px 9px; border-radius:999px; border:1px dashed var(--line-strong); }
.rate-row { display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--faint); }
.rate-btn { width:30px; height:28px; border-radius:999px; border:1px solid var(--line); background:var(--surface); cursor:pointer; font-size:13px; line-height:1; }
.rate-btn:hover:not(:disabled) { border-color:var(--line-strong); }
.rate-btn:disabled { opacity:.4; cursor:default; }
.rate-btn.chosen { opacity:1; border-color:var(--brand); background:var(--brand-50); }

/* bento швидких дій */
.home-actions .sect-title { margin-top:40px; }
.bento { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:14px; }
.tile { position:relative; padding:20px; display:flex; flex-direction:column; gap:10px; text-decoration:none; color:inherit; cursor:pointer;
  transition:transform .18s, box-shadow .18s, border-color .18s; overflow:hidden; min-height:150px; }
.tile:hover { transform:translateY(-2px); box-shadow:var(--sh-2); border-color:var(--line-strong); }
.tile .ic, .drop .ic, .empty-state .ic { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:var(--c50, var(--brand-50)); color:var(--c, var(--brand)); flex:none; }
.tile .ic svg { width:20px; height:20px; }
.tile h3 { font-size:16px; font-weight:700; }
.tile p { margin:0; color:var(--muted); font-size:13px; line-height:1.45; }
.tile .go-arrow { position:absolute; top:20px; right:20px; color:var(--faint); transition:transform .18s, color .18s; }
.tile:hover .go-arrow { transform:translateX(3px); color:var(--text); }
.tile.wide { grid-column:span 2; }
.tile.tall { grid-row:span 2; }
.tile-head { display:flex; align-items:center; gap:12px; padding-right:24px; }
.tile .big-n { font:800 36px/1 Manrope,sans-serif; letter-spacing:-.03em; color:var(--c); }
.tile .d { font-size:12.5px; color:var(--faint); margin-top:auto; }
.mini-list { list-style:none; margin:6px 0 0; padding:0; display:flex; flex-direction:column; }
.mini-list li { display:flex; align-items:center; gap:10px; font-size:13px; padding:10px 0; border-top:1px solid var(--line); min-height:41px; }
.mini-list li:first-child { border-top:0; }
.mini-list li .t { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mini-list li.muted { color:var(--faint); }
.mini-list li.skeleton { border-radius:8px; border:0; margin:4px 0; background:linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size:200% 100%; animation:shimmer 1.4s linear infinite; }

/* ============ створити ============ */
.split { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:20px; align-items:start; }
.gen-main { display:flex; flex-direction:column; gap:16px; min-width:0; }
.gen-main > textarea.field { min-height:260px; }
.type-bar { display:flex; align-items:center; gap:14px; padding:12px 16px; }
.type-bar label { font-size:13px; font-weight:600; color:var(--muted); white-space:nowrap; }
.type-bar select { max-width:360px; }
.block-canvas { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:16px; align-items:start; }
.block-canvas:empty { display:none; }
.block-canvas[data-bot="legal"] .block-section:nth-child(3):last-child { grid-column:1/-1; }
.block-canvas[data-bot="legal"] .block-section:nth-child(3):last-child .block-list { display:grid; grid-template-columns:repeat(auto-fit, minmax(260px,1fr)); }
.block-section { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card); box-shadow:var(--sh-1); padding:16px; }
.block-section h4 { font:700 11.5px Inter,sans-serif; text-transform:uppercase; letter-spacing:.07em; color:var(--faint); margin:0 0 12px; }
.block-list { display:flex; flex-direction:column; gap:8px; }
.field-block { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface);
  position:relative; transition:border-color .15s, box-shadow .15s, background .3s; }
.field-block:hover { border-color:var(--line-strong); }
.field-block:focus-within { border-color:var(--brand); box-shadow:0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); z-index:6; }
.field-block.sortable-ghost { opacity:.35; }
.field-block.sortable-drag { box-shadow:var(--sh-2); }
.block-handle { cursor:grab; color:var(--line-strong); font-size:13px; line-height:1; user-select:none; touch-action:none; transition:color .15s; }
.field-block:hover .block-handle { color:var(--faint); }
.block-handle:active { cursor:grabbing; }
.field-block-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.field-block-label-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.field-block label { font-size:11.5px; color:var(--faint); font-weight:500; }
.field-block input, .field-block select, .field-block textarea { width:100%; border:0; outline:0; background:none; font:500 14px Inter,sans-serif; color:var(--text); padding:2px 0 0; }
.field-block input::placeholder { color:var(--faint); opacity:.75; font-weight:400; }
.field-block input:focus-visible { outline:none; }
.block-status { flex:0 0 auto; width:8px; height:8px; border-radius:50%; background:var(--line-strong); transition:background .25s, transform .25s; }
.field-block.filled .block-status { background:var(--ok); transform:scale(1.1); }
.field-block.autofilled { background:color-mix(in srgb, var(--c, var(--legal)) 5%, var(--surface)); border-color:color-mix(in srgb, var(--c, var(--legal)) 28%, var(--line)); }
.autofilled-tag, .derived-tag, .unclear-tag { display:none; font:600 10px Inter,sans-serif; padding:2px 6px; border-radius:999px; }
.autofilled-tag { background:var(--c50, var(--legal-50)); color:var(--c, var(--legal)); }
.field-block.autofilled .autofilled-tag { display:inline-block; }
.field-block.auto-derived { border-style:dashed; }
.field-block.auto-derived .block-status { background:transparent; border:1.5px dashed var(--faint); }
.derived-tag { background:var(--surface-2); color:var(--muted); }
.field-block.auto-derived .derived-tag { display:inline-block; }
.field-block.auto-derived.filled .derived-tag { display:none; }
.unclear-tag { display:inline-block; background:var(--warn-50); color:var(--warn); margin-left:4px; }
.field-block.unclear { border-color:color-mix(in srgb, var(--warn) 45%, var(--line)); background:color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.block-suggestions { position:absolute; left:0; right:0; top:calc(100% + 6px); background:var(--surface); border:1px solid var(--line-strong); border-radius:12px;
  box-shadow:var(--sh-2); z-index:10; overflow:hidden; display:none; }
.block-suggestions.show { display:block; animation:fade .15s ease; }
.block-suggestion-item { padding:9px 12px; font-size:13.5px; cursor:pointer; display:flex; justify-content:space-between; gap:12px; }
.block-suggestion-item:hover { background:var(--surface-2); }
.block-suggestion-item .sugg-meta { color:var(--faint); font-size:12px; white-space:nowrap; }
.block-suggestion-loading { padding:9px 12px; font-size:12.5px; color:var(--faint); display:flex; align-items:center; gap:8px; }
.block-suggestion-loading .spin { width:12px; height:12px; border-radius:50%; flex:none; border:1.5px solid var(--line-strong); border-top-color:var(--muted); animation:spin .7s linear infinite; }
.sumcard { position:sticky; top:24px; padding:20px; display:flex; flex-direction:column; gap:16px; }
.ring-row { display:flex; align-items:center; gap:16px; }
.ring-row h3 { font-size:16px; font-weight:700; }
.ring-row p { margin:2px 0 0; font-size:12.5px; color:var(--muted); line-height:1.4; }
.gen-progress-ring { --pct:0; position:relative; flex:none; width:80px; height:80px; border-radius:50%; display:grid; place-items:center;
  background:conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--surface-2) 0); transition:background .4s ease; }
.gen-progress-ring::before { content:""; position:absolute; inset:7px; border-radius:50%; background:var(--surface); }
.gen-progress-text { position:relative; font:800 15px Manrope,sans-serif; }
.gen-progress-ring.complete { background:conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--surface-2) 0); }
.todo { list-style:none; margin:0; padding:14px 0 0; border-top:1px solid var(--line); font-size:13px; display:flex; flex-direction:column; gap:7px; }
.todo:empty { display:none; }
.todo li { display:flex; align-items:center; gap:8px; color:var(--muted); }
.todo li::before { content:""; width:6px; height:6px; border-radius:50%; border:1.5px solid var(--warn); flex:none; }
.todo li.more { color:var(--faint); }
.todo li.more::before { border-color:var(--line-strong); }
.sumcard .status { margin-top:0; }
.sumcard .gen-answer { margin-top:0; }

/* ============ додати в базу ============ */
.photo-flow > * + * { margin-top:16px; }
.photo-flow > .status { margin-top:12px; }
.stepper { display:flex; align-items:center; list-style:none; margin:0; padding:16px 20px; }
.step { display:flex; align-items:center; gap:10px; font-size:13px; font-weight:600; color:var(--faint); white-space:nowrap; }
.step i { width:26px; height:26px; border-radius:50%; display:grid; place-items:center; font:700 12px Inter,sans-serif; font-style:normal;
  background:var(--surface-2); color:var(--faint); border:1px solid var(--line); transition:all .25s; flex:none; }
.step.done, .step.cur { color:var(--text); }
.step.done i { background:var(--brand); color:var(--on-brand); border-color:var(--brand); font-size:0; }
.step.done i::before { content:"✓"; font-size:13px; }
.step.cur i { background:var(--surface); color:var(--brand); border:2px solid var(--brand); box-shadow:0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.step-line { flex:1; height:2px; margin:0 14px; background:var(--line); border-radius:2px; transition:background .3s; min-width:16px; }
.step-line.done { background:var(--brand); }
.drop { border:1.5px dashed var(--line-strong); border-radius:var(--r-card); padding:32px 24px; text-align:center; display:flex; flex-direction:column; align-items:center; gap:10px;
  background:radial-gradient(320px 120px at 50% 0, color-mix(in srgb, var(--c, var(--brand)) 7%, transparent), transparent), var(--surface);
  transition:border-color .15s, background-color .15s, transform .15s; }
.drop.over { border-color:var(--brand); background-color:var(--brand-50); transform:scale(1.005); }
.drop .ic { width:52px; height:52px; border-radius:16px; }
.drop .ic svg { width:24px; height:24px; }
.drop h3 { font-size:17px; font-weight:700; }
.drop p { margin:0; color:var(--muted); font-size:13px; }
.photo-upload-row { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:6px; }
.photo-pages-count { font-size:13px; color:var(--brand); font-weight:600; }
.photo-pages-count:empty { display:none; }
.hint-input { max-width:440px; margin-top:4px; }
.review { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); gap:20px; align-items:start; }
.photo { padding:12px; }
.photo-preview { display:block; width:100%; max-height:560px; object-fit:contain; border-radius:10px; background:var(--surface-2); }
.fields { padding:20px; }
.fields h3 { font-size:16px; font-weight:700; }
.fields .lead { margin:4px 0 14px; color:var(--muted); font-size:13px; }
.photo-fields { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; }
.photo-fields > * { min-width:0; }
.photo-unclear { margin-top:12px; font-size:13px; color:var(--warn); background:var(--warn-50); padding:10px 12px; border-radius:10px; }
.photo-sensitive-row { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); padding:14px 0 4px; cursor:pointer; }
.photo-sensitive-row input { accent-color:var(--brand); width:16px; height:16px; }
.photo-actions { display:flex; gap:10px; justify-content:flex-end; padding-top:14px; border-top:1px solid var(--line); margin-top:14px; flex-wrap:wrap; }
.doc-text textarea.field { min-height:220px; }

/* ============ перевірити ============ */
.check-grid { grid-template-columns:repeat(2, minmax(0,1fr)); gap:20px; align-items:start; }
#draft-review-input { min-height:340px; }
.review-out { min-height:200px; }
.review-out .gen-answer { margin:0; padding:0; background:none; white-space:normal; }
.review-out .gen-answer.error { padding:14px 16px; background:var(--danger-50); }
.review-out .status { margin:0 0 12px; }
.review-out:has(.gen-answer.show) .empty-state, .review-out:has(.status.show) .empty-state { display:none; }
.empty-state { display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px; padding:40px 16px; color:var(--muted); }
.empty-state h3 { font-size:16px; }
.empty-state p { margin:0; font-size:13px; max-width:40ch; }
.empty-state .ic svg { width:20px; height:20px; }
.review-meta { font-size:13.5px; line-height:1.7; margin-bottom:16px; padding:12px 14px; background:var(--surface-2); border-radius:12px; }
.review-section { margin-bottom:16px; }
.review-section h4 { font-size:14px; margin:0 0 8px; font-weight:700; }
.review-redflag-title { color:var(--danger); }
.review-redflag-list, .review-finding-list { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; gap:8px; font-size:13.5px; line-height:1.5; }
.review-redflag-list li, .review-finding-list li { padding:10px 12px 10px 14px; border-radius:10px; background:var(--surface-2); border-left:3px solid var(--warn); }
.review-redflag-list li { border-left-color:var(--danger); background:var(--danger-50); }
.review-finding-meta { display:block; color:var(--muted); font-size:12.5px; margin-top:2px; }
.review-ok { color:var(--ok); font-size:14px; font-weight:600; padding:10px 12px; background:var(--brand-50); border-radius:10px; }
.review-caveat { font-size:12px; color:var(--faint); border-top:1px solid var(--line); padding-top:10px; margin-top:6px; }
.cp-card { max-width:640px; }
.cp-row { display:flex; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.cp-row .cp-edrpou { flex:1 1 200px; width:auto; font-variant-numeric:tabular-nums; letter-spacing:.04em; }
.cp-card .hint { margin:4px 0 0; }

/* ============ аналітика ============ */
.kpis { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.kpi { padding:18px 20px; }
.kpi small { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; font-weight:500; }
.kpi small svg { width:15px; height:15px; }
.kpi .big-n { font:800 32px/1 Manrope,sans-serif; letter-spacing:-.03em; margin:12px 0 6px; }
.kpi .d { font-size:12px; color:var(--faint); min-height:18px; }
.kpi.bad .big-n { color:var(--danger); } .kpi.warn .big-n { color:var(--warn); }
.alerts-controls { display:flex; align-items:center; gap:16px; margin-bottom:16px; flex-wrap:wrap; }
.alerts-controls .hint { margin-left:auto; }
.switch { display:inline-flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); cursor:pointer; user-select:none; }
.switch input { position:absolute; opacity:0; width:0; height:0; }
.switch span { width:34px; height:20px; border-radius:999px; background:var(--line-strong); position:relative; transition:background .2s; flex:none; }
.switch span::after { content:""; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.2); transition:transform .2s; }
.switch input:checked + span { background:var(--brand); }
.switch input:checked + span::after { transform:translateX(14px); }
.switch input:focus-visible + span { outline:2px solid var(--brand); outline-offset:2px; }
.alerts-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; align-items:start; }
.alerts-grid .panel-h { margin-bottom:6px; }
.alert-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:12px 0; border-top:1px solid var(--line); font-size:13.5px; }
.alert-row:first-child { border-top:0; }
.alert-main { flex:1; min-width:0; }
.alert-subject { font-weight:600; overflow-wrap:anywhere; }
.alert-field { color:var(--muted); font-size:12.5px; margin-top:2px; }
.alert-note { color:var(--faint); font-size:12px; margin-top:4px; }
.alert-badge { flex:none; font:600 11.5px Inter,sans-serif; padding:3px 9px; border-radius:999px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.alert-badge.overdue { background:var(--danger-50); color:var(--danger); }
.alert-badge.upcoming { background:var(--warn-50); color:var(--warn); }
.an-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:16px; align-items:start; }
.an-grid:empty { display:none; }
.bars { display:flex; flex-direction:column; gap:12px; }
.bar-r { display:grid; grid-template-columns:minmax(0,230px) 1fr 52px; gap:12px; align-items:center; font-size:13px; }
.bar-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-r .track { height:8px; border-radius:99px; background:var(--surface-2); overflow:hidden; }
.bar-r .track i { display:block; height:100%; border-radius:99px; background:var(--danger); transform-origin:left; animation:grow .6s ease; }
.bar-r .track i.mid { background:var(--warn); } .bar-r .track i.low { background:var(--faint); }
@keyframes grow { from { transform:scaleX(0); } }
.bar-r b { text-align:right; font-weight:600; }
.stat-host:empty { display:none; }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:12px; margin-bottom:12px; }
.stat-mini { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:var(--sh-1); }
.stat-mini .n { font:800 24px/1.1 Manrope,sans-serif; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.stat-mini .l { font-size:12.5px; color:var(--muted); margin-top:4px; }
.acc-list { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card); box-shadow:var(--sh-1); overflow:hidden; }
.acc-list:empty { display:none; }
.acc-list > .alerts-empty { padding:16px 20px; }
details.cat { border-top:1px solid var(--line); }
details.cat:first-child { border-top:0; }
details.cat > summary { list-style:none; cursor:pointer; padding:14px 20px; display:flex; align-items:center; justify-content:space-between; gap:16px; font-weight:600; font-size:14px; transition:background .15s; }
details.cat > summary:hover { background:var(--surface-2); }
details.cat > summary::-webkit-details-marker { display:none; }
details.cat > summary::before { content:"›"; color:var(--faint); font-weight:700; font-size:16px; display:inline-block; transition:transform .15s; margin-right:-6px; }
details.cat[open] > summary::before { transform:rotate(90deg); }
.cat-name { flex:1; min-width:0; overflow-wrap:anywhere; }
.cat-count { font:600 12px Inter,sans-serif; background:var(--danger-50); color:var(--danger); padding:3px 9px; border-radius:999px; white-space:nowrap; }
ul.q-list { margin:0; padding:0 20px 16px 46px; display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); }
.list-card h3 { font-size:15px; font-weight:700; margin-bottom:10px; }
.list-card ul { list-style:none; margin:0; padding:0; counter-reset:n; }
.list-card li { counter-increment:n; display:flex; gap:12px; padding:10px 0; border-top:1px solid var(--line); font-size:13.5px; }
.list-card li:first-child { border-top:0; }
.list-card li::before { content:counter(n); font:700 12px Inter,sans-serif; color:var(--faint); width:18px; text-align:right; flex:none; padding-top:1px; }
.list-card .alerts-empty { font-size:12.5px; }

/* ============ структура (оргчарт) ============ */
.org-search-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.org-search { flex:1; min-width:220px; max-width:420px; display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-field); padding:0 12px; height:40px; }
.org-search svg.i { color:var(--faint); }
.org-search input { flex:1; border:0; background:none; outline:0; font-size:13.5px; color:var(--text); height:100%; }
#org-count-hint { white-space:nowrap; }
.org-tree-host[hidden], #org-search-results[hidden] { display:none; }
#org-search-results { display:flex; flex-direction:column; gap:10px; }
#org-search-results .org-card { box-shadow:none; }
ul.org-tree { list-style:none; margin:0; padding:0; }
ul.org-tree.org-tree-root { padding-bottom:8px; }
li.org-node { margin:10px 0; }
li.org-node > ul.org-tree { margin:10px 0 0 17px; padding-left:17px; border-left:2px solid var(--line); }
.org-card { display:flex; align-items:flex-start; gap:12px; background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:12px 14px; box-shadow:var(--sh-1); max-width:420px; }
.org-card.org-root { max-width:460px; border-color:var(--brand); border-width:1.5px; background:var(--brand-50); }
.org-card.org-vacant { border-style:dashed; background:var(--surface-2); box-shadow:none; }
.org-avatar { flex:none; width:36px; height:36px; border-radius:50%; background:var(--brand-50); color:var(--brand-600); display:flex; align-items:center; justify-content:center; font:700 12.5px Inter,sans-serif; text-transform:uppercase; }
.org-card.org-root .org-avatar { background:var(--brand); color:var(--on-brand); }
.org-card.org-vacant .org-avatar { background:var(--surface); color:var(--faint); }
.org-body { min-width:0; }
.org-name { font-weight:700; font-size:13.5px; line-height:1.3; }
.org-card.org-vacant .org-name { color:var(--faint); font-style:italic; font-weight:600; }
.org-position { font-size:12px; color:var(--muted); margin-top:1px; }
.org-email { display:inline-block; font-size:12px; color:var(--brand-600); text-decoration:none; margin-top:3px; overflow-wrap:anywhere; }
.org-email:hover { text-decoration:underline; }
.idea-card h3 { font-size:14.5px; font-weight:700; margin-bottom:6px; }
.idea-card p { font-size:13px; color:var(--muted); margin:0; line-height:1.45; }
@media (max-width:860px) {
  li.org-node > ul.org-tree { margin-left:10px; padding-left:12px; }
  .org-card, .org-card.org-root { max-width:none; }
}

/* ============ палітра і тости ============ */
.kbar { position:fixed; inset:0; z-index:60; background:color-mix(in srgb, #0A140F 40%, transparent); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px);
  display:flex; align-items:flex-start; justify-content:center; padding:14vh 16px 0; animation:fade .15s ease; }
.kbox { width:580px; max-width:100%; background:var(--surface); border-radius:18px; border:1px solid var(--line); box-shadow:0 30px 80px -20px rgba(0,0,0,.45); overflow:hidden; }
.kbox-in { display:flex; align-items:center; gap:12px; padding:0 20px; border-bottom:1px solid var(--line); color:var(--faint); }
.kbox-in input { flex:1; border:0; outline:0; padding:18px 0; font:500 16px Inter,sans-serif; background:none; color:var(--text); }
.kbox ul { list-style:none; margin:0; padding:8px; max-height:50vh; overflow-y:auto; }
.kbox li { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px; font-size:14px; color:var(--muted); cursor:pointer; }
.kbox li.on { background:var(--surface-2); color:var(--text); }
.kbox li.on svg { color:var(--brand); }
.toasts { position:fixed; right:24px; bottom:24px; display:flex; flex-direction:column; gap:10px; z-index:70; pointer-events:none; }
.toast { display:flex; align-items:center; gap:12px; padding:12px 16px; border-radius:14px; background:#1D2D3C; color:#fff; box-shadow:0 16px 40px -12px rgba(0,0,0,.4);
  font-size:14px; max-width:420px; animation:toast-in .3s cubic-bezier(.2,.9,.3,1.2); transition:opacity .4s, transform .4s; pointer-events:auto; }
.toast.out { opacity:0; transform:translateY(8px); }
.toast .ic { width:26px; height:26px; border-radius:8px; display:grid; place-items:center; background:rgba(61,191,131,.22); color:#5BD69B; flex:none; }
.toast .ic svg { width:15px; height:15px; }
.toast.error .ic { background:rgba(238,124,113,.22); color:#F29A90; }
@keyframes toast-in { from { opacity:0; transform:translateY(12px) scale(.98); } }

/* ============ планшет / телефон ============ */
.tabbar { display:none; }
@media (max-width:1180px) {
  .bento { grid-template-columns:repeat(3, minmax(0,1fr)); }
  .tile.tall { grid-row:auto; }
  .alerts-grid { grid-template-columns:1fr; }
  .kpis { grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@media (max-width:980px) {
  .split { grid-template-columns:minmax(0,1fr); }
  .sumcard { position:sticky; top:auto; bottom:16px; }
  .main { padding:24px 24px 64px; }
}
@media (max-width:860px) {
  .app { grid-template-columns:minmax(0,1fr); background:none; }
  .side { display:none; }
  .main { padding:12px 16px calc(96px + env(safe-area-inset-bottom)); }
  .mtop { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
  .mtop .logo { padding:0; }
  .mtop .logo-mark { width:28px; height:28px; }
  .mtop .logo-txt b { font-size:15px; }
  .mtop-actions { display:flex; gap:8px; }
  .hero { padding:20px 0 18px; }
  .hero::before { inset:-12px -16px auto; height:300px; }
  .hero h1 { font-size:28px; }
  .hero p { font-size:14px; }
  .ask { padding:6px 6px 6px 16px; align-items:center; }
  .ask textarea { min-height:40px; font-size:16px; padding:8px 0; }
  .ask .icon-btn { width:40px; height:40px; }
  .chips { justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; margin:14px -16px 0; padding:0 16px; scrollbar-width:none; }
  .chips::-webkit-scrollbar { display:none; }
  .chip { flex:none; }
  .bento { grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
  .tile { padding:14px; gap:8px; min-height:0; }
  .tile h3 { font-size:14px; }
  .tile p { display:none; }
  .tile p.keep, .tile-head p { display:block; }
  .tile .go-arrow { display:none; }
  .tile.wide, .tile.tall { grid-column:span 2; }
  .tile .big-n { font-size:28px; }
  .chat-shell.chatting { min-height:calc(100vh - 160px); }
  .chat-shell.chatting .dock { bottom:calc(84px + env(safe-area-inset-bottom)); }
  .msg, .msg-user { max-width:100%; }
  .head { margin-bottom:18px; }
  .head h1 { font-size:24px; }
  .head .seg { width:100%; }
  .head .seg button { flex:1; justify-content:center; padding:8px 6px; }
  .block-canvas { grid-template-columns:minmax(0,1fr); }
  .sumcard { position:sticky; top:auto; bottom:calc(84px + env(safe-area-inset-bottom)); z-index:8; padding:12px 14px; gap:10px; box-shadow:var(--sh-2); }
  .sumcard .todo, .ring-row p { display:none; }
  .ring-row { gap:12px; }
  .ring-row h3 { font-size:14px; }
  .gen-progress-ring { width:48px; height:48px; }
  .gen-progress-ring::before { inset:5px; }
  .gen-progress-text { font-size:12px; }
  .sumcard .btn-lg { height:44px; }
  .sumcard .gen-answer { max-height:40vh; overflow:auto; }
  .type-bar { flex-direction:column; align-items:stretch; gap:6px; }
  .type-bar select { max-width:none; }
  .stepper { padding:12px 14px; }
  .step-line { margin:0 8px; }
  .step:not(.cur) span { display:none; }
  .drop { padding:24px 16px; }
  .drop .photo-upload-row { width:100%; }
  .drop .photo-upload-row .btn { flex:1; }
  .review, .check-grid, .an-grid { grid-template-columns:minmax(0,1fr); }
  .photo-fields { grid-template-columns:minmax(0,1fr); }
  .photo-actions .btn { flex:1; }
  .row-actions .btn:last-child { margin-left:0; flex:1; }
  .kpis { gap:10px; }
  .kpi { padding:14px 16px; }
  .kpi .big-n { font-size:26px; }
  .alerts-controls .hint { margin-left:0; }
  .bar-r { grid-template-columns:minmax(0,110px) 1fr 40px; }
  .tabbar { display:flex; position:fixed; left:12px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); justify-content:space-around; padding:6px; border-radius:20px;
    background:var(--side-bg); backdrop-filter:blur(16px) saturate(1.4); -webkit-backdrop-filter:blur(16px) saturate(1.4); border:1px solid var(--line); box-shadow:var(--sh-2); z-index:30; }
  .tabbar a { display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10.5px; font-weight:600; color:var(--faint); text-decoration:none; padding:6px 8px; border-radius:14px; min-width:56px; }
  .tabbar a.on { color:var(--brand); background:var(--brand-50); }
  .toasts { left:12px; right:12px; bottom:calc(92px + env(safe-area-inset-bottom)); }
  .toast { max-width:none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition:none !important; }
}

/* крок 2+: зона завантаження вже не потрібна - фото видно поруч із полями */
.photo-flow:has(.photo-draft:not([hidden])) .drop { display:none; }
.photo-fields .field-block:has(textarea) { grid-column:1/-1; }
.photo-fields .field-block textarea { min-height:90px; resize:vertical; line-height:1.5; }

/* ============ вільний документ ============ */
.tile.brand { --c:var(--brand); --c50:var(--brand-50);
  background:radial-gradient(400px 160px at 100% 0, color-mix(in srgb, var(--brand) 12%, transparent), transparent), var(--surface);
  border-color:color-mix(in srgb, var(--brand) 30%, var(--line)); }
.freedoc .fd-step > .split { align-items:start; }
.fd-kinds { margin-bottom:12px; flex-wrap:wrap; }
.fd-themes { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:14px; min-height:8px; }
.fd-themes .chip { font-size:12.5px; padding:6px 11px; }
.chip.on { background:var(--brand-50); border-color:var(--brand); color:var(--brand); font-weight:600; }
.fd-text { min-height:200px; font-size:15px; }
.fd-hint { margin:8px 0 0; }
.side-h { font-size:15px; font-weight:700; }
.mini-field { display:flex; flex-direction:column; gap:4px; position:relative; }
.mini-field > span, .side-label { font-size:12px; font-weight:600; color:var(--muted); }
.mini-field .field { padding:8px 10px; }
.fd-company { font-size:12px; color:var(--muted); background:var(--surface-2); border-radius:12px; padding:10px 12px; }
.fd-company-h { font-weight:700; color:var(--text); margin-bottom:4px; display:flex; align-items:center; gap:6px; }
.fd-company-h::before { content:"✓"; color:var(--ok); }
.fd-company ul { margin:0; padding-left:16px; display:flex; flex-direction:column; gap:2px; }
.fd-questions { border-color:color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow:var(--sh-2); animation:fade .3s ease; }
.ai-badge { width:28px; height:28px; border-radius:9px; display:grid; place-items:center; background:var(--brand-50); color:var(--brand); }
.ai-badge svg { width:16px; height:16px; }
.fd-qlist { display:flex; flex-direction:column; gap:12px; }
.fd-q { display:flex; flex-direction:column; gap:6px; font-size:14px; font-weight:500; }
.fd-q .field { padding:9px 11px; }
.fd-typed p { margin:0 0 4px; font-size:14px; }
.fd-split { grid-template-columns:minmax(0,1fr) 340px; }
.fd-side .hint { margin:6px 0 0; }
.fd-meta { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.fd-meta .hint { width:100%; }
.fd-warn ul { list-style:none; margin:6px 0 0; padding:0; display:flex; flex-direction:column; gap:6px; max-height:260px; overflow:auto; }
.fd-warn li { font-size:12.5px; padding:8px 10px; border-radius:10px; cursor:pointer; display:flex; flex-direction:column; gap:2px; border-left:3px solid var(--warn); background:var(--warn-50); }
.fd-warn li.ph { border-left-color:var(--legal); background:var(--legal-50); }
.fd-warn li b { font-weight:600; color:var(--text); overflow-wrap:anywhere; }
.fd-warn li span { color:var(--muted); }
.fd-open-q { display:flex; flex-direction:column; gap:10px; }
.fd-open-q:empty, .fd-warn:empty { display:none; }
.fd-refine { display:flex; flex-direction:column; gap:6px; padding-top:12px; border-top:1px solid var(--line); }
.fd-refine textarea.field { min-height:64px; }
.fd-done { display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; padding:40px 20px; }
.fd-done .ic { width:56px; height:56px; border-radius:18px; display:grid; place-items:center; background:var(--brand-50); color:var(--brand); }
.fd-done .ic svg { width:26px; height:26px; }
.fd-done .row-actions { justify-content:center; }
.fd-done .row-actions .btn:last-child { margin-left:0; }

/* аркуш A4 - типографіка як у реальних наказах (Times, 14pt, поля 3/1.5 см) */
.paper-wrap { background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-card); padding:28px; overflow:auto; }
.paper { width:100%; max-width:794px; min-height:1000px; margin:0 auto; background:#fff; color:#111; box-shadow:0 2px 6px rgba(0,0,0,.08), 0 20px 50px -20px rgba(0,0,0,.25);
  padding:56px 42px 64px 84px; font:15px/1.45 "Times New Roman", Times, serif; text-align:justify; border-radius:2px; }
.paper p { margin:0 0 8px; }
.paper .ed { outline:none; border-radius:3px; transition:background .15s, box-shadow .15s; }
.paper .ed:hover { background:#f3f6ff; }
.paper .ed:focus { background:#eef3ff; box-shadow:0 0 0 2px #c9d6ff; }
.paper div.ed.inline { display:inline; }
.paper mark { background:#fff1c2; color:inherit; border-radius:2px; padding:0 1px; }
.paper mark.w-ph { background:#e4e8ff; color:#2b3aa8; }
.paper mark.pulse { animation:markpulse 1.2s ease; }
@keyframes markpulse { 0%,100% { box-shadow:none; } 30% { box-shadow:0 0 0 4px #ffcf4d; } }
.pp-co { text-align:center; margin-bottom:22px; }
.pp-co-name { font-weight:700; font-size:16px; line-height:1.25; padding-bottom:3px; border-bottom:1.5px solid #111; }
.pp-co-req { font-size:11px; margin-top:3px; }
.pp-title { text-align:center; font-weight:700; letter-spacing:.25em; margin:6px 0 14px; }
.pp-meta { display:flex; justify-content:space-between; font-weight:700; margin-bottom:18px; }
.pp-subj { font-weight:700; text-align:left; margin-bottom:14px !important; }
.pp-subj.center { text-align:center; }
.pp-par { text-indent:1.25cm; white-space:pre-wrap; }
.pp-order { text-align:center; font-weight:700; letter-spacing:.2em; margin:10px 0; }
.pp-point { text-indent:1.25cm; margin-bottom:8px; white-space:pre-wrap; }
.pp-sub { text-indent:1.25cm; margin:4px 0; }
.pp-att { text-align:left; }
.pp-sign { display:flex; justify-content:space-between; font-weight:700; margin-top:44px; }
.pp-visas { font-size:12.5px; margin-top:22px; text-align:left; }
.pp-visas b { display:block; margin-bottom:3px; }
.pp-row { display:grid; grid-template-columns:1fr 90px 1fr; gap:8px; align-items:end; margin-bottom:3px; }
.pp-row > span:last-child { text-align:right; }
.pp-line { border-bottom:1px solid #111; height:1em; }
.pp-lh { text-align:center; border-bottom:1.5px solid #111; padding-bottom:6px; margin-bottom:12px; }
.pp-lh-name { font-weight:700; font-size:22px; letter-spacing:.02em; }
.pp-lh-sub { font-size:11px; letter-spacing:.06em; }
.pp-lh-req { font-size:10.5px; line-height:1.35; margin-top:4px; }
.pp-out { font-size:13px; text-align:left; }
.pp-addr { margin:10px 0 18px 50%; font-weight:700; text-align:left; display:flex; flex-direction:column; gap:2px; }
.pp-salut { text-align:center; }
.pp-exec { font-size:11px; margin-top:36px !important; text-align:left; }
.pp-date { text-align:left; }
.pp-stamp { margin:0 0 16px 55%; font-size:13px; text-align:left; white-space:pre-wrap; }
.pp-sec h4 { font:700 15px "Times New Roman", serif; text-align:center; text-transform:uppercase; margin:12px 0 6px; letter-spacing:0; color:#111; }
:root[data-theme="dark"] .paper-wrap { background:#0b100e; }
@media (max-width:1180px) { .fd-split { grid-template-columns:minmax(0,1fr); } .fd-split .sumcard { position:static; } }
@media (max-width:860px) {
  .paper-wrap { padding:8px; margin:0 -8px; }
  .paper { padding:24px 16px 32px 22px; font-size:13.5px; min-height:0; }
  .pp-addr, .pp-stamp { margin-left:30%; }
  .fd-kinds { width:100%; }
  .fd-kinds button { flex:1 1 45%; justify-content:center; }
  .freedoc .sumcard.fd-side { position:static; box-shadow:var(--sh-1); }
}
@media (max-width:980px) { .freedoc .fd-side { position:static; } }
.fd-themes .chip { max-width:100%; white-space:normal; text-align:left; line-height:1.3; }
.chip-more { border-style:dashed; color:var(--faint); }
.pp-table { width:100%; border-collapse:collapse; margin:8px 0 12px; font-size:13px; text-indent:0; text-align:left; }
.pp-table th, .pp-table td { border:1px solid #333; padding:4px 6px; vertical-align:top; }
.pp-table th { font-weight:700; text-align:center; background:#fafafa; }
.fd-review { display:flex; gap:10px; align-items:center; width:100%; padding:10px 12px; background:var(--brand-50); border-radius:12px; margin-top:4px; }
.fd-review div { display:flex; flex-direction:column; font-size:12.5px; }
.fd-review b { font-size:13px; }
.fd-review span:not(.ai-badge) { color:var(--muted); }
.fd-low { width:100%; font-size:12.5px; color:var(--muted); }
.fd-low summary { cursor:pointer; font-weight:600; }
.fd-low ul { margin:6px 0 0; padding-left:16px; display:flex; flex-direction:column; gap:4px; }
.pp-req td { width:50%; font-size:12px; line-height:1.4; }
.pp-spec { margin-top:28px; padding-top:18px; border-top:1px dashed #bbb; }
.fd-feedback { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:center; padding-top:14px; margin-top:6px; border-top:1px solid var(--line); font-size:13px; color:var(--muted); }
.fd-feedback .rate-btn { width:38px; height:34px; font-size:16px; }
