/* =========================================================
   Admin: e-mail šabloni, pozivnice, toast
   ========================================================= */

/* ---------- Izgled e-maila (pregled) ---------- */
.em { background: #eef1f6; padding: 22px 16px 26px; font-family: var(--font); color: #0d1526; border-radius: 0 0 12px 12px; }
.em-pre { display: none; }
.em-head { text-align: center; padding: 6px 0 18px; }
.em-logo { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 20px; color: #14213d; letter-spacing: -.02em; }
.em-logo b { color: #e63946; font-weight: 700; }
.em-mark { width: 30px; height: 30px; border-radius: 8px; background: #e63946; color: #fff; display: grid; place-items: center; font-size: 16px; }
.em-card { background: #fff; border-radius: 16px; padding: 32px 30px; max-width: 560px; margin: 0 auto; box-shadow: 0 4px 20px rgba(13,21,38,.06); border-top: 5px solid #14213d; }
.em-ic { width: 54px; height: 54px; border-radius: 14px; background: #edf1f8; color: #14213d; display: grid; place-items: center; margin-bottom: 16px; }
.em-ic svg.lucide { width: 26px; height: 26px; }
.em-card h1 { font-family: var(--display); font-size: 24px; line-height: 1.25; margin: 0 0 14px; color: #0d1526; }
.em-card p { font-size: 16px; line-height: 1.7; color: #344054; margin: 0 0 14px; }
.em-firm { border: 1px solid #e1e6ef; border-radius: 12px; padding: 14px 16px; margin: 4px 0 18px; background: #f8f9fc; }
.em-firm b { display: block; font-size: 16px; }
.em-firm span { font-size: 14px; color: #667085; }
.em-btn { display: block; text-align: center; background: #e63946; color: #fff !important; font-weight: 800; font-size: 16.5px; padding: 16px 20px; border-radius: 12px; margin: 22px 0 16px; text-decoration: none; }
.em-note { font-size: 14px !important; color: #667085 !important; }
.em-foot { text-align: center; padding-top: 18px; }
.em-foot p { margin: 4px 0; font-size: 12.5px; color: #667085; }

/* ---------- Ekran šablona: lista · uređivanje · pregled ---------- */
.tpl-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.tpl-list { display: grid; gap: 6px; position: sticky; top: 96px; }
.tpl-list a { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.tpl-list a:hover { border-color: var(--brand-100); }
.tpl-list a.active { background: var(--bordo); border-color: var(--bordo); color: #fff; }
.tl-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-50); color: var(--bordo); display: grid; place-items: center; flex-shrink: 0; }
.tl-ic svg.lucide { width: 18px; height: 18px; }
.tpl-list a.active .tl-ic { background: rgba(255,255,255,.14); color: #fff; }
.tpl-list b { display: block; font-size: 14px; line-height: 1.3; }
.tpl-list small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.tpl-list a.active small { color: #c3cde0; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-vars button { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px dashed var(--line-2); background: #f8f9fc; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--bordo); cursor: pointer; }
.tpl-vars button:hover { border-style: solid; border-color: var(--bordo); background: var(--brand-50); }
.tpl-prev { position: sticky; top: 96px; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.tp-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.tp-subj { min-width: 0; }
.tp-subj small { display: block; font-size: 12.5px; color: var(--muted); }
.tp-subj b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-seg { grid-template-columns: 1fr 1fr; width: 96px; flex-shrink: 0; }
.tp-seg button { display: grid; place-items: center; height: 34px; }
.tp-seg svg.lucide { width: 17px; height: 17px; }
.tp-frame { max-height: 76vh; overflow-y: auto; background: #eef1f6; transition: .3s; }
.tp-frame.mobile { max-width: 380px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.tp-frame.mobile .em-card { padding: 24px 18px; }
.tp-frame.mobile .em-card h1 { font-size: 21px; }

/* ---------- Pozivnica: masovno slanje + prozor ---------- */
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--bordo); color: #fff; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .btn-primary { background: #fff; color: var(--bordo); }
.inv-modal[hidden] { display: none; }
.inv-modal { position: fixed; inset: 0; z-index: 3200; display: grid; place-items: center; padding: 16px; }
.inv-bg { position: absolute; inset: 0; background: rgba(8,14,30,.55); backdrop-filter: blur(3px); }
.inv-box { position: relative; width: min(980px, 100%); max-height: 92vh; max-height: 92dvh; background: #fff; border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 40px 100px rgba(8,14,30,.4); animation: mcIn .25s ease; }
.inv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.inv-head b { display: block; font-family: var(--display); font-size: 20px; }
.inv-head span { font-size: 14px; color: var(--muted); }
.inv-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; flex: 1; min-height: 0; }
.inv-form { padding: 20px 22px; display: grid; gap: 14px; align-content: start; overflow-y: auto; }
.inv-prev { background: #eef1f6; padding: 14px; overflow-y: auto; border-left: 1px solid var(--line); }
.inv-prev > small { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 8px 4px; }
.inv-prev .tp-frame { max-height: none; border: 0; }
.inv-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfe; }

/* ---------- Toast ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 4100; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 14px; background: #0b1426; color: #fff; font-weight: 700; font-size: 15px; box-shadow: 0 16px 40px rgba(8,14,30,.35); animation: toastIn .3s cubic-bezier(.2,.8,.2,1); transition: opacity .3s, transform .3s; }
.toast svg.lucide { color: #4ade80; width: 20px; height: 20px; flex-shrink: 0; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }

@media (max-width: 1280px) {
  .tpl-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .tpl-prev { grid-column: 1 / -1; position: static; }
}
@media (max-width: 860px) {
  .tpl-layout { grid-template-columns: minmax(0, 1fr); }
  .tpl-list { position: static; display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; }
  .tpl-list::-webkit-scrollbar { display: none; }
  .tpl-list a { flex: 0 0 auto; max-width: 240px; }
  .tpl-list small { display: none; }
  .tp-frame.mobile { max-width: none; border: 0; }
  .inv-modal { padding: 0; place-items: end stretch; }
  .inv-box { border-radius: 20px 20px 0 0; max-height: 94dvh; }
  .inv-body { grid-template-columns: 1fr; overflow-y: auto; }
  .inv-form, .inv-prev { overflow: visible; }
  .inv-prev { border-left: 0; border-top: 1px solid var(--line); }
  .inv-foot .btn { flex: 1; }
  #toasts { bottom: 90px; }
  .em-card { padding: 24px 18px; }
}
