@font-face { font-family: 'Lobster'; src: url(../fonts/lobster-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: 'Lobster'; src: url(../fonts/lobster-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; font-display: swap; }
@font-face { font-family: 'Nunito'; font-weight: 400; src: url(../fonts/nunito-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Nunito'; font-weight: 400; src: url(../fonts/nunito-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212; }
@font-face { font-family: 'Nunito'; font-weight: 700; src: url(../fonts/nunito-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Nunito'; font-weight: 700; src: url(../fonts/nunito-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212; }
@font-face { font-family: 'Nunito'; font-weight: 800; src: url(../fonts/nunito-cyrillic-800-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Nunito'; font-weight: 800; src: url(../fonts/nunito-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212; }
@font-face { font-family: 'RC'; font-weight: 400; src: url(../fonts/roboto-condensed-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'RC'; font-weight: 400; src: url(../fonts/roboto-condensed-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212,U+2715,U+2702; }
@font-face { font-family: 'RC'; font-weight: 700; src: url(../fonts/roboto-condensed-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'RC'; font-weight: 700; src: url(../fonts/roboto-condensed-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122,U+2212,U+2715,U+2702; }

:root {
  --pink: #ff7eb9; --pink2: #ff4f9a; --lav: #b49cff; --lav2: #8a6cff; --mint: #6fe3c1; --sky: #7cc8ff; --lemon: #ffe27a;
  --ink: #4a2a6b; --card: rgba(255,255,255,.86);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif; color: var(--ink);
  background: linear-gradient(160deg, #ffd6ec 0%, #e6d4ff 35%, #c9e8ff 70%, #d8fff1 100%) fixed;
  overflow: hidden;
}

/* ---------- Позадина: ѕвезди, бонбони, замок ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sparkle { position: absolute; width: 6px; height: 6px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px 3px #fff, 0 0 18px 6px rgba(255,190,240,.7);
  animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }
.candy { position: absolute; font-size: 34px; filter: drop-shadow(0 6px 8px rgba(120,60,160,.25)); animation: floaty 9s ease-in-out infinite; opacity: .9; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-28px) rotate(10deg); } }
.castle { position: fixed; bottom: -6px; left: 50%; transform: translateX(-50%); width: min(1100px, 130vw); opacity: .55; z-index: 0; pointer-events: none; }
.rainbow { position: fixed; top: -260px; left: -260px; width: 620px; height: 620px; border-radius: 50%; z-index: 0; pointer-events: none; opacity: .35;
  background: radial-gradient(circle, transparent 52%, #ff9ad5 52% 56%, #ffd28a 56% 60%, #fff59a 60% 64%, #9ef0c6 64% 68%, #8fd3ff 68% 72%, #c3a5ff 72% 76%, transparent 76%); }

/* ---------- Распоред ---------- */
.app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; padding: 14px 12px 12px; }
header.top { width: 100%; max-width: 920px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 40px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-6px) rotate(6deg); } }
.brand h1 { margin: 0; font-family: 'Lobster', cursive; font-weight: 400; font-size: clamp(26px, 4.5vw, 42px); line-height: 1;
  background: linear-gradient(90deg, #ff4f9a, #ff9a3c, #c86bff, #4fa6ff, #ff4f9a); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 8s linear infinite;
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 4px 10px rgba(200,80,180,.25)); }
@keyframes shimmer { to { background-position: 300% 0; } }
.brand small { display: block; font-weight: 700; font-size: 13px; color: #9b6fc6; letter-spacing: .5px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; }

.chat-card { width: 100%; max-width: 920px; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--card);
  border-radius: 30px; box-shadow: 0 20px 60px rgba(140,70,190,.25), inset 0 0 0 3px rgba(255,255,255,.9); backdrop-filter: blur(10px); overflow: hidden; position: relative; }
.chat-card::before { content: ''; height: 12px; flex: none;
  background: repeating-linear-gradient(-45deg, #ff7eb9 0 14px, #fff 14px 28px, #b49cff 28px 42px, #fff 42px 56px); }

.messages { flex: 1; overflow-y: auto; padding: 18px 18px 8px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-thumb { background: linear-gradient(#ff9ad5, #b49cff); border-radius: 10px; border: 2px solid #fff; }

.msg { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-end; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.msg .avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: radial-gradient(circle at 30% 30%, #fff, #ffd8f0 60%, #e2c8ff); box-shadow: 0 4px 10px rgba(150,80,200,.25), inset 0 0 0 2px #fff; }
.bubble { max-width: 78%; padding: 12px 16px; border-radius: 22px; line-height: 1.45; font-size: 15px; word-wrap: break-word; }
.bot .bubble { background: linear-gradient(135deg, #fff 0%, #f6edff 100%); border-bottom-left-radius: 6px; box-shadow: 0 4px 14px rgba(150,90,210,.15); border: 2px solid #f0e2ff; }
.user { flex-direction: row-reverse; }
.user .bubble { background: linear-gradient(135deg, #ff8fc4, #ff6aa8); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; box-shadow: 0 6px 16px rgba(255,90,160,.35); }
.bubble.wide { max-width: 100%; width: 100%; }
.bubble h3 { margin: 0 0 8px; font-family: 'Lobster', cursive; font-weight: 400; font-size: 22px; color: #c04fa0; }
.hint { font-size: 13px; color: #8d6fb0; }

/* ---------- Внес ---------- */
.composer { display: flex; gap: 10px; padding: 12px 14px 14px; align-items: flex-end; border-top: 2px dashed #f2d6f0; background: rgba(255,255,255,.6); }
.composer textarea { flex: 1; resize: none; min-height: 52px; max-height: 200px; border-radius: 20px; border: 2.5px solid #f3c6e6; padding: 13px 16px;
  font: inherit; font-size: 15px; color: var(--ink); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
.composer textarea:focus { border-color: #c79bff; box-shadow: 0 0 0 5px rgba(199,155,255,.25); }

/* ---------- Копчиња (бонбони) ---------- */
.btn { --c1: #ff8fc4; --c2: #ff4f9a; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 15px; color: #fff; padding: 12px 20px;
  border-radius: 999px; background: linear-gradient(180deg, var(--c1), var(--c2)); position: relative; overflow: hidden; white-space: nowrap;
  box-shadow: 0 6px 0 rgba(0,0,0,.08), 0 8px 18px rgba(255,80,160,.35), inset 0 -4px 0 rgba(0,0,0,.08); transition: transform .12s, filter .2s; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.btn::after { content: ''; position: absolute; top: 4px; left: 14px; right: 14px; height: 40%; border-radius: 999px; background: linear-gradient(rgba(255,255,255,.65), rgba(255,255,255,0)); pointer-events: none; }
.btn:hover { filter: brightness(1.06) saturate(1.1); transform: translateY(-2px); }
.btn:active { transform: translateY(2px); }
.btn:disabled { filter: grayscale(.6); opacity: .7; cursor: wait; }
.btn.lav { --c1: #c4a8ff; --c2: #8a6cff; box-shadow: 0 8px 18px rgba(138,108,255,.35), inset 0 -4px 0 rgba(0,0,0,.08); }
.btn.mint { --c1: #8ff0d3; --c2: #2fc79b; box-shadow: 0 8px 18px rgba(47,199,155,.35), inset 0 -4px 0 rgba(0,0,0,.08); }
.btn.sky { --c1: #a6dcff; --c2: #4fa6ff; box-shadow: 0 8px 18px rgba(79,166,255,.35), inset 0 -4px 0 rgba(0,0,0,.08); }
.btn.lemon { --c1: #fff0a8; --c2: #ffc93c; color: #7a4a00; text-shadow: none; box-shadow: 0 8px 18px rgba(255,190,40,.35), inset 0 -4px 0 rgba(0,0,0,.06); }
.btn.ghost { background: #fff; color: #b05ea8; text-shadow: none; box-shadow: 0 4px 12px rgba(180,100,200,.2), inset 0 0 0 2px #f3c6e6; }
.btn.ghost::after { display: none; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.round { width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- Картичка за преглед ---------- */
.review { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.review .full { grid-column: 1 / -1; }
.fld label { display: block; font-size: 12px; font-weight: 800; color: #a05aa6; margin: 0 0 3px 6px; letter-spacing: .3px; }
.fld input, .fld select, .fld textarea, table.items input { width: 100%; font: inherit; font-size: 14.5px; color: var(--ink); padding: 9px 12px; border-radius: 14px;
  border: 2px solid #ecd8fb; background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
.fld input:focus, .fld textarea:focus, table.items input:focus { border-color: #c79bff; box-shadow: 0 0 0 4px rgba(199,155,255,.22); }
.fld input.missing { border-color: #ff8fa8; background: #fff3f6; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; font-weight: 700; }
.checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: #ff4f9a; }

table.items { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
table.items th { font-size: 12px; color: #a05aa6; text-align: left; padding: 0 6px; font-weight: 800; }
table.items td { padding: 0 3px; }
table.items input { padding: 7px 9px; border-radius: 11px; }
table.items .amt { font-weight: 800; white-space: nowrap; text-align: right; padding-right: 6px; color: #7a3d9a; }
.x-btn { border: 0; background: #ffe0ee; color: #ff4f9a; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-weight: 800; }
.unmatched input.nm { border-color: #ffd27a; background: #fffbea; }
.total-line { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; margin-top: 4px; color: #7a3d9a; }
.total-line .big { font-size: 22px; color: #ff4f9a; font-family: 'Lobster', cursive; font-weight: 400; }
.warn { background: #fff4d6; border: 2px dashed #ffcf5a; border-radius: 14px; padding: 8px 12px; font-size: 13.5px; margin-top: 8px; color: #7a5200; }
.done-card { display: flex; align-items: center; gap: 14px; }
.done-card .big-emoji { font-size: 44px; animation: bob 2.5s ease-in-out infinite; }

/* ---------- Модал (поставки, историја) ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(90,40,120,.35); backdrop-filter: blur(4px); z-index: 50; display: none; align-items: center; justify-content: center; padding: 14px; }
.modal-bg.open { display: flex; }
.modal { background: linear-gradient(180deg, #fff, #fbf3ff); border-radius: 28px; width: 100%; max-width: 680px; max-height: 92vh; overflow: auto; padding: 20px 22px;
  box-shadow: 0 30px 80px rgba(100,40,150,.4), inset 0 0 0 3px #fff; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.modal h2 { margin: 0 0 4px; font-family: 'Lobster', cursive; font-weight: 400; font-size: 30px; color: #c04fa0; }
.modal .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; }
.modal textarea { min-height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.hist-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: #fff; border: 2px solid #f0e2ff; margin-bottom: 8px; }
.hist-item b { color: #7a3d9a; }

/* ---------- Чекање ---------- */
.loading { display: inline-flex; gap: 6px; font-size: 22px; }
.loading span { animation: hop 1s ease-in-out infinite; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120px); background: linear-gradient(90deg, #ff8fc4, #b49cff); color: #fff;
  font-weight: 800; padding: 12px 22px; border-radius: 999px; box-shadow: 0 10px 30px rgba(150,80,200,.4); z-index: 60; transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .review, .modal .grid { grid-template-columns: 1fr; }
  .bubble { max-width: 88%; }
  .msg .avatar { width: 34px; height: 34px; font-size: 19px; }
  .top-actions .lbl { display: none; }
  .brand small { display: none; }
  .brand-icon { font-size: 30px; }
  .msg.bot:has(.bubble.wide) .avatar { display: none; }
  .btn { font-size: 14px; padding: 11px 16px; }
  .messages { padding: 12px 10px 6px; }
  table.items th:nth-child(2), table.items td:nth-child(2) { display: none; }
}
