[hidden] { display: none !important; }
/* ProdSync — светлата тема на Еклерия. Cormorant само за логото и заглавията на страници; всичко друго Montserrat. */
:root {
  --paper: #fbf4e7; --sand: #f4e8d0; --card: #fffaf2; --line: #ead9b8; --hair: #f1e6d0;
  --gold: #c9973f; --gold2: #e8b563; --gold3: #f3d9a4; --bronze: #8a5a28;
  --ink: #241509; --ink2: #5b4630; --muted: #75604a; --cocoa: #2a190d;
  --ok: #3f5a22; --ok-bg: #e6ecd2; --warn: #7a4b00; --warn-bg: #f7e3b5; --bad: #8f2f12; --bad-bg: #f5d6c8;
  --radius: 18px; --serif: "Cormorant Garamond", Georgia, serif; --sans: Montserrat, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
a { color: var(--bronze); } a:hover { color: #5e3b16; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.05; margin: 2px 0 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--bronze); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- рамка ---- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--sand); border-right: 1px solid var(--line); padding: 26px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 0 12px; }
.brand b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.brand span { font-size: 10px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--bronze); }
.nav { display: flex; flex-direction: column; gap: 16px; }
.nav .grp { display: flex; flex-direction: column; gap: 2px; }
.nav .grp > span { font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 0 12px 4px; }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: #efe0c2; color: var(--ink); }
.nav a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.badge { font-size: 11px; font-weight: 700; color: var(--cocoa); background: var(--gold2); border-radius: 10px; padding: 1px 8px; }
.who { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; }
.who b { display: block; font-size: 13px; }
.main { flex: 1; min-width: 0; padding: 30px 38px 60px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topbar, .bottomnav { display: none; }

/* ---- компоненти ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.dark { background: var(--cocoa); color: #f6ead2; border-radius: 20px; padding: 22px 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.dark .big { font-size: 40px; font-weight: 600; color: var(--gold3); letter-spacing: -0.01em; }
.dark .eyebrow { color: var(--gold2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.kpi .l { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 32px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 16px; color: var(--ink2); font-weight: 600; }
.grid2 { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.grid2 > .wide { flex: 2 1 520px; min-width: 0; } .grid2 > .narrow { flex: 1 1 300px; min-width: 0; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 20px; padding: 2px 10px; white-space: nowrap; background: #efe2c8; color: var(--ink2); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.gold { background: var(--gold3); color: #5e3b16; } .chip.outline { background: transparent; box-shadow: inset 0 0 0 1px #c9b28a; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--cocoa); color: #f6ead2; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; background: #3a2414; }
.btn.alt { background: var(--card); color: var(--cocoa); box-shadow: inset 0 0 0 1px var(--gold); font-weight: 600; }
.btn.gold { background: var(--gold2); color: var(--cocoa); }
.btn.ghost { background: transparent; color: var(--bad); font-weight: 600; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.flash { padding: 12px 16px; border-radius: 12px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.warn { background: var(--warn-bg); color: var(--warn); } .flash.error { background: var(--bad-bg); color: var(--bad); }
.bar { height: 6px; border-radius: 3px; background: #efe2c8; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--gold); }

/* ---- таблици и форми ---- */
.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.flag td { background: #fbefd6; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); padding: 0 12px; min-height: 42px; width: 100%; }
textarea { padding: 10px 12px; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--bronze); box-shadow: none; }
td input, td select { min-height: 36px; padding: 0 8px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; align-items: end; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 40px; }
.allergens { display: flex; flex-wrap: wrap; gap: 4px 14px; }
details.box { background: var(--card); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 14px 20px; }
details.box summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.pill-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--sand); box-shadow: inset 0 0 0 1px var(--line); }
.pill-tabs a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink2); font-weight: 600; font-size: 13px; }
.pill-tabs a.on { background: var(--cocoa); color: var(--gold3); }
.chain { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.chain > div { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.node { background: var(--card); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); padding: 12px 14px; }
.node.main { box-shadow: inset 0 0 0 1.5px var(--gold); }
.doc-img { width: 100%; border-radius: 8px; background: #fff; box-shadow: 0 8px 26px rgba(42,25,13,.12); }

/* ---- вход ---- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 40px 20px; text-align: center; }
.login .card { width: 100%; max-width: 420px; text-align: left; gap: 14px; }
.gbtn { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }

/* ---- телефон ---- */
@media screen and (max-width: 860px) {
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; background: var(--paper); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); }
  .topbar b { font-family: var(--serif); font-size: 24px; }
  .main { padding: 18px 16px 96px; }
  h1 { font-size: 32px; }
  .bottomnav { display: block; position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
  .bn-scroll { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .bn-scroll::-webkit-scrollbar { display: none; }
  .bn-scroll.more-r { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .bn-scroll.more-l { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
  .bn-scroll.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); }
  .bottomnav a { flex: 0 0 auto; min-width: 70px; padding: 0 6px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; font-size: 10.5px; font-weight: 600; color: var(--ink2); text-decoration: none; white-space: nowrap; border-radius: 10px; }
  .bottomnav a.on { color: var(--ink); background: var(--sand); }
  .bottomnav svg { width: 22px; height: 22px; }
  .kpi .v { font-size: 26px; }
  .card { padding: 16px; }
  /* таблиците стават карти */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tfoot, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cards td::before { content: attr(data-l); font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: left; }
  table.cards td.r { text-align: right; }
  .menu-sheet { display: block; }
}
@page { margin: 14mm 12mm; }
@media print {
  .side, .topbar, .bottomnav, .noprint, .demo-banner, .flash { display: none !important; }
  .cert { box-shadow: none !important; padding: 0 !important; max-width: none !important; }
  .main { padding: 0; } body { background: #fff; } .card, .kpi { box-shadow: 0 0 0 1px #ccc; }
}
fieldset { min-width: 0; }
/* редове на фактура — без хоризонтално скролване */
.inv-lines { display: flex; flex-direction: column; gap: 6px; }
.inv-line { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.2fr); gap: 10px 18px; padding: 14px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--hair); }
.inv-line.flag { background: #fbefd6; box-shadow: inset 0 0 0 1px var(--gold3); }
.il-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.il-head { display: flex; flex-wrap: wrap; gap: 0 4px; }
.il-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px 12px; align-items: start; min-width: 0; }
.il-fields .f, .il-reject { min-width: 0; font-size: 11px; gap: 4px; display: flex; flex-direction: column; font-weight: 600; color: var(--muted); }
.il-wide { grid-column: span 2; }
.il-reject { grid-column: span 2; display: flex; align-items: center; gap: 10px; }
.il-reject .check { min-height: 36px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.inv-line input:not([type=checkbox]), .inv-line select { min-height: 36px; padding: 0 8px; font-size: 13px; min-width: 0; }
/* продажби */
.sale-line .il-main label.f { font-size: 11px; gap: 4px; }
.line-sum { min-height: 36px; display: flex; align-items: center; font-weight: 700; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.line-del { justify-content: flex-end; align-items: flex-start; } .line-del .btn { min-height: 36px; }
.warn-text { color: #a04b14; font-weight: 600; }
.sale-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; align-items: end; padding: 14px 16px; border-radius: 12px; background: var(--sand); box-shadow: inset 0 0 0 1px var(--line); }
.sale-total { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.sale-disc { font-weight: 700; font-size: 16px; min-height: 42px; display: flex; align-items: center; color: var(--bronze); }
.sale-doc { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.sale-doc:first-of-type { border-top: 0; }
.sale-doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.sale-doc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; justify-content: flex-end; font-size: 13.5px; }
/* входящи документи */
.doc-pick { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.doc-pick label { display: flex; align-items: center; gap: 6px; font-weight: 600; color: #f3e6c9; cursor: pointer; }
.doc-pick input { width: 18px; height: 18px; min-height: 0; accent-color: var(--gold2); box-shadow: none; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 16px; align-items: end; }
.match { color: var(--bronze); }
.nowrap { white-space: nowrap; }
.cert-table tr:last-child td { border-bottom: 1px solid #b9a888; }
.total-row td { border-top: 2px solid var(--line); background: var(--sand); }
.receipts-box { box-shadow: inset 0 0 0 1.5px var(--gold); }
.receipt-list { display: flex; flex-direction: column; gap: 4px; }
.receipt-item { align-items: flex-start; } .receipt-item span { line-height: 1.5; }
/* търговски документ (сертификат) */
.cert { background: #fff; color: #1c1209; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 32px 36px; display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.cert-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1c1209; padding-bottom: 12px; }
.cert-org { font-family: var(--serif); font-size: 26px; }
.cert-no { text-align: right; } .cert-no b { font-size: 22px; letter-spacing: .04em; }
.cert-title { text-align: center; font-size: 22px; letter-spacing: .08em; margin: 6px 0; }
.cert-title span { font-size: 14px; letter-spacing: .12em; font-weight: 500; text-transform: uppercase; color: #5b4630; }
.cert-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; }
.cert-meta > div { display: flex; flex-direction: column; gap: 2px; }
.cert-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cert-table th, .cert-table td { border: 1px solid #b9a888; padding: 7px 8px; text-align: left; vertical-align: top; color: #1c1209; }
.cert-table th { background: #f4ecdc; font-size: 11px; letter-spacing: .04em; }
.cert-decl { font-size: 12.5px; line-height: 1.55; }
.cert-sign { display: grid; grid-template-columns: 1fr 1fr auto; gap: 24px; align-items: end; margin-top: 18px; font-size: 13px; }
.sign-line { border-top: 1px solid #1c1209; margin-top: 34px; padding-top: 3px; font-size: 11px; color: #5b4630; }
.stamp { width: 90px; height: 90px; border: 1px dashed #b9a888; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #8a7a5c; font-size: 12px; }
@media screen and (max-width: 860px) { .cert { padding: 18px 14px; } .cert-table { font-size: 12.5px; } .cert-table td { border: 0; } .cert-table tr { border-bottom: 1px solid #b9a888; } .cert-table tr:last-child td { border-bottom: 0; } .cert-sign { grid-template-columns: 1fr; } .nowrap { white-space: normal; } }
.w-kind { min-width: 128px; } .w-unit { min-width: 76px; } .w-num { width: 88px; min-width: 88px; }
.dark > .kpis, .dark > .bar { flex: 1 1 100%; }
.dark .kpi { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.dark .kpi .l { color: #d9c7a4; } .dark .kpi .v { color: var(--gold3); }
.dark .bar { background: rgba(255,255,255,.14); }
.dark h2 { color: #fff7e6; } .dark a { color: inherit; }
.demo-banner { background: #c8792f; color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 6px 12px; position: sticky; top: 0; z-index: 50; }
@media screen and (max-width: 860px) {
  .inv-line { grid-template-columns: minmax(0, 1fr); padding: 12px 10px; }
  .il-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- AI помощник ---- */
.ai { --ai-ink: #2a190d; font-family: var(--sans); }
.ai svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-fab { position: fixed; right: 28px; bottom: 28px; z-index: 40; display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 22px 0 18px; border: 0; border-radius: 28px; cursor: pointer;
  background: linear-gradient(135deg, #3a2414 0%, #2a190d 60%); color: #f6ead2; font: 600 14px/1 var(--sans); letter-spacing: .01em;
  box-shadow: 0 10px 28px rgba(42,25,13,.28), inset 0 0 0 1px rgba(232,181,99,.35); transition: transform .18s ease, box-shadow .18s ease; }
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(42,25,13,.34), inset 0 0 0 1px rgba(232,181,99,.6); }
.ai-fab svg { width: 22px; height: 22px; fill: var(--gold2); stroke: none; filter: drop-shadow(0 0 6px rgba(232,181,99,.55)); }
.ai-fab:focus-visible, .ai-icon:focus-visible, .ai-send:focus-visible, .ai-chip:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.ai.open .ai-fab { opacity: 0; pointer-events: none; transform: scale(.9); }
.ai-panel { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: 420px; height: min(680px, calc(100vh - 48px)); display: flex; flex-direction: column;
  background: var(--paper); border-radius: 24px; overflow: hidden; box-shadow: 0 28px 70px rgba(42,25,13,.30), 0 0 0 1px var(--line);
  transform-origin: bottom right; animation: ai-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes ai-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: linear-gradient(135deg, #3a2414, #2a190d 70%); color: #f6ead2; }
.ai-mark { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(232,181,99,.14); box-shadow: inset 0 0 0 1px rgba(232,181,99,.35); }
.ai-mark svg { fill: var(--gold2); stroke: none; width: 22px; height: 22px; }
.ai-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-title b { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; color: var(--gold3); }
.ai-title span { font-size: 11.5px; color: #d9c7a4; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-icon { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #e9d9b8; cursor: pointer; display: grid; place-items: center; }
.ai-icon:hover { background: rgba(255,255,255,.08); color: #fff; }
.ai-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; overscroll-behavior: contain; }
.ai-msg { max-width: 92%; font-size: 13.8px; line-height: 1.55; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; background: var(--ai-ink); color: #f6ead2; padding: 10px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; background: var(--card); color: var(--ink); padding: 12px 15px; border-radius: 4px 18px 18px 18px; box-shadow: inset 0 0 0 1px var(--line); }
.ai-msg.bot p { margin: 0 0 8px; } .ai-msg.bot p:last-child { margin-bottom: 0; }
.ai-msg.bot ul, .ai-msg.bot ol { margin: 4px 0 8px; padding-left: 20px; } .ai-msg.bot li { margin: 2px 0; }
.ai-msg.bot b { font-weight: 700; color: #1c1209; }
.ai-msg.bot a { color: var(--bronze); font-weight: 600; }
.ai-msg.bot code { background: var(--sand); border-radius: 5px; padding: 0 4px; font-size: 12.5px; }
.ai-msg.bot .ai-tbl { overflow-x: auto; margin: 6px 0 8px; }
.ai-msg.bot table { font-size: 12.5px; } .ai-msg.bot th { padding: 4px 8px 6px; font-size: 10.5px; } .ai-msg.bot td { padding: 5px 8px; }
.ai-msg.err { box-shadow: inset 0 0 0 1px #e9b9a4; background: #fbeee7; }
.ai-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hair); font-size: 11.5px; color: var(--muted); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.ai-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #b9c48f; }
.ai-tag.flash::before { background: var(--gold); }
.ai-more { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--bronze); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ai-hello { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.ai-hello h3 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.05; color: var(--ink); }
.ai-hello p { margin: 0; color: var(--ink2); font-size: 13.5px; }
.ai-chips { display: flex; flex-direction: column; gap: 8px; }
.ai-chip { text-align: left; border: 0; cursor: pointer; padding: 11px 14px; border-radius: 14px; background: var(--card); color: var(--ink); font: 500 13.2px/1.35 var(--sans);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s, transform .15s; display: flex; gap: 10px; align-items: center; }
.ai-chip::before { content: "✦"; color: var(--gold); font-size: 12px; }
.ai-chip:hover { box-shadow: inset 0 0 0 1.5px var(--gold); transform: translateX(2px); }
.ai-typing { align-self: flex-start; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 4px 18px 18px 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 12.5px; }
.ai-dots { display: inline-flex; gap: 4px; } .ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: ai-dot 1.2s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-form { display: flex; align-items: flex-end; gap: 8px; margin: 8px 12px 0; padding: 6px 6px 6px 14px; background: #fff; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line), 0 2px 10px rgba(42,25,13,.05); }
.ai-form:focus-within { box-shadow: inset 0 0 0 1.5px var(--gold), 0 2px 14px rgba(201,151,63,.15); }
.ai-form textarea { flex: 1; min-height: 0; height: 40px; overflow-y: hidden; white-space: pre-wrap; max-height: 128px; resize: none; border: 0; box-shadow: none; background: transparent; padding: 10px 0; font-size: 14px; line-height: 1.4; outline: none; }
.ai-form textarea:focus { outline: none; }
.ai-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 13px; cursor: pointer; display: grid; place-items: center; background: var(--gold2); color: var(--ai-ink); transition: background .15s, opacity .15s; }
.ai-send:hover { background: var(--gold); } .ai-send:disabled { opacity: .45; cursor: default; }
.ai-send svg { stroke-width: 2.2; }
.ai-foot { padding: 8px 18px 12px; font-size: 10.8px; color: var(--muted); text-align: center; }
@media screen and (max-width: 860px) {
  .ai-fab { right: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); height: 52px; width: 52px; padding: 0; justify-content: center; border-radius: 50%; }
  .ai-fab span { display: none; }
  .ai-panel { inset: 0; width: auto; height: auto; border-radius: 0; animation-name: ai-up; }
  @keyframes ai-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .ai-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .ai-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .ai-msg { max-width: 96%; }
  html.ai-lock, html.ai-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .ai-panel, .ai-dots i, .ai-fab, .ai-chip { animation: none; transition: none; } }
