:root {
  --wine: #6b1340; --wine-2: #561033; --wine-soft: #f4e6ec; --orange: #e8962e; --orange-soft: #fdf0dd;
  --cream: #fbf5f1; --paper: #ffffff; --ink: #2a1420; --muted: #7d6a73; --line: #ecdfe4; --line-2: #e0cfd6;
  --ok: #1f8a5b; --ok-soft: #e3f4ec; --warn: #c76a00; --warn-soft: #fff1dc; --bad: #c62f4c; --bad-soft: #fde8ec;
  --idle: #8a7b82; --idle-soft: #f1ecee;
  --radius: 14px; --shadow: 0 1px 2px rgba(60, 10, 35, .06), 0 8px 24px rgba(60, 10, 35, .07);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--cream); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
a { color: var(--wine); }
img, video { max-width: 100%; display: block; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; background: var(--paper); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--wine); color: #fff; }
.btn.accent { background: var(--orange); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.soft { background: var(--wine-soft); color: var(--wine); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 14px 22px; font-size: 15.5px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--wine-soft); color: var(--wine); }

/* ---------- forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 10px 12px; font: inherit; color: inherit; outline: none; transition: .15s; }
.input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(107, 19, 64, .12); }
textarea.input { resize: vertical; min-height: 90px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid2 .input, .grid3 .input { width: 100%; min-width: 0; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- chips & badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--ink); }
.chip.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.chip .n { font-size: 11.5px; opacity: .75; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending { background: var(--idle-soft); color: var(--idle); }
.st-approved { background: var(--ok-soft); color: var(--ok); }
.st-changes { background: var(--warn-soft); color: var(--warn); }
.st-draft { background: #eee; color: #888; }
.fmt { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--wine); }

/* ---------- cards */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }

/* ---------- modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(30, 6, 18, .55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; opacity: 0; transition: opacity .18s; backdrop-filter: blur(2px); }
.modal-wrap.in { opacity: 1; }
.modal { background: var(--paper); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; transform: translateY(10px); transition: transform .18s; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal-wrap.in .modal { transform: none; }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fdfafb; flex-wrap: wrap; }
.confirm-text { font-size: 15.5px; margin: 4px 0; }
@media (max-width: 640px) {
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; max-width: none; }
  .modal.full { height: 100vh; max-height: 100vh; border-radius: 0; }
}

/* ---------- toast */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: .3s; max-width: 90vw; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- annotation */
.annot-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.annot-wrap img, .annot-wrap video { max-width: 100%; max-height: 62vh; width: auto; height: auto; border-radius: 8px; user-select: none; -webkit-user-select: none; }
.annot { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.annot path, svg.draw path { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.annot path.u, svg.draw path.u { stroke: rgba(255, 255, 255, .85); stroke-width: 7; }

/* ---------- instagram mock */
.ig { width: 100%; max-width: 400px; margin: 0 auto; font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size: 14px; color: #111; }
.ig-feed { background: #fff; border: 1px solid #efefef; border-radius: 10px; overflow: hidden; }
.ig-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ig-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #d6249f; }
.ig-av-fallback { display: inline-grid; place-items: center; background: var(--wine); color: #fff; font-size: 12px; font-weight: 700; }
.ig-who { flex: 1; font-size: 13.5px; }
.ig-dots-menu { letter-spacing: 1px; font-size: 11px; }
.ig-media { position: relative; background: #f2f2f2; }
.ig-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ig-track::-webkit-scrollbar { display: none; }
.ig-slide { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; }
.ig-feed .ig-slide { background: #f2f2f2; }
.ig-slide img, .ig-slide video { width: 100%; height: 100%; object-fit: cover; }
.media-empty { width: 100%; height: 100%; display: grid; place-items: center; color: #999; font-size: 13px; background: repeating-linear-gradient(45deg, #f3f3f3 0 12px, #ececec 12px 24px); min-height: 120px; }
.ig-counter { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; z-index: 2; }
.ig-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); z-index: 3; display: grid; place-items: center; padding: 0 0 3px; color: #222; }
.ig-arrow.l { left: 8px; } .ig-arrow.r { right: 8px; }
@media (hover: none) { .ig-arrow { display: none; } }
.ig-actions { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; position: relative; }
.ig-actions svg { width: 24px; height: 24px; margin-right: 12px; }
.ig-actions > span:last-child svg { margin: 0; }
.ig-dots { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.ig-dots i { width: 6px; height: 6px; border-radius: 50%; background: #c7c7c7; }
.ig-dots i.on { background: #0095f6; }
.ig-body { padding: 2px 12px 12px; }
.ig-cap { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.ig-cap.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ig-cap .tag { color: #00376b; }
.ig-more { border: 0; background: none; color: #737373; padding: 0; cursor: pointer; font-size: 14px; }
.ig-date { color: #737373; font-size: 11px; text-transform: uppercase; margin-top: 6px; letter-spacing: .02em; }
.ig-vertical { max-width: 330px; }
@media (max-width: 760px) { .ig-vertical { max-width: 270px; } }
.ig-frame { position: relative; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #111; color: #fff; }
.ig-frame .ig-track, .ig-frame .ig-slide { height: 100%; }
.ig-frame .ig-slide { aspect-ratio: auto; }
.ig-bars { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 3px; z-index: 2; }
.ig-bars i { flex: 1; height: 2.5px; background: rgba(255, 255, 255, .4); border-radius: 2px; }
.ig-bars i.on { background: #fff; }
.ig-overhead { position: absolute; top: 18px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: center; z-index: 2; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); pointer-events: none; }
.ig-overhead .ig-av { width: 28px; height: 28px; box-shadow: none; }
.ig-overhead small { opacity: .8; }
.ig-reels .ig-overhead { top: auto; bottom: 62px; }
.ig-side { position: absolute; right: 10px; bottom: 70px; display: flex; flex-direction: column; gap: 16px; z-index: 2; pointer-events: none; }
.ig-side svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.ig-reel-cap { position: absolute; left: 12px; right: 52px; bottom: 12px; z-index: 2; font-size: 12.5px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); pointer-events: none; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ig-audio { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.ig-audio svg { width: 13px; height: 13px; }
.ig-frame video { pointer-events: auto; }
.ig-note { margin-top: 10px; background: #fff; border: 1px solid #efefef; border-radius: 10px; padding: 10px 12px; }
.ig-note > span { display: block; font-size: 11px; color: #8e8e8e; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; font-weight: 600; }

/* ---------- misc */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--wine-soft); border-top-color: var(--wine); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; transition: width .4s; }
.progress .p-ok { background: var(--ok); } .progress .p-warn { background: var(--orange); }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #eee; flex: none; }
.ref-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; text-decoration: none; color: var(--ink); max-width: 100%; }
.ref-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.ref-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
