/* =================================================================
   Canva Master Club — үндсэн загвар (сурагч + админ)
   ================================================================= */
:root {
  --ink: #1E1745;
  --ink-2: #3A3170;
  --muted: #6E6892;
  --paper: #F7F6FB;
  --surface: #FFFFFF;
  --line: #E7E4F2;
  --line-2: #D8D3EA;
  --violet: #6C3CE9;
  --violet-2: #5629D1;
  --violet-soft: #EFE9FF;
  --teal: #00A9B5;
  --teal-soft: #DDF7F8;
  --sun: #F2A01C;
  --sun-soft: #FFF3DC;
  --rose: #D93B41;
  --rose-soft: #FDE8E8;
  --shadow-lg: 0 24px 60px -20px rgba(40, 20, 110, .35);
  --shadow-sm: 0 2px 10px -4px rgba(40, 20, 110, .18);
  --r-xl: 28px;
  --r-lg: 18px;
  --r-md: 12px;
  --font-display: "Unbounded", "Onest", system-ui, sans-serif;
  --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--violet); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 24px; height: 24px; }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--violet) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r-md);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--violet-2); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover:not(:disabled) { background: var(--ink-2); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--violet); color: var(--violet); }
.btn-soft { background: var(--violet-soft); color: var(--violet-2); }
.btn-soft:hover:not(:disabled) { background: #E3D9FF; }
.btn-danger { background: var(--rose-soft); color: var(--rose); }
.btn-danger:hover:not(:disabled) { background: var(--rose); color: #fff; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover:not(:disabled) { background: #008F9A; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 36px; width: 36px; padding: 0; border-radius: 10px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Forms ---------------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  font: inherit; font-size: 16px; /* iOS zoom-оос сэргийлнэ */
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: #C3BBDF; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-wrap .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.input-wrap .reveal:hover { color: var(--violet); background: var(--violet-soft); }
.form-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--rose-soft); color: var(--rose); font-size: 14px; font-weight: 500; }
.form-ok { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--teal-soft); color: #00707A; font-size: 14px; font-weight: 500; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--violet) 55%, transparent); outline-offset: 2px; }

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--sun-soft); color: #9A5E00; }
.badge-approved { background: var(--teal-soft); color: #00707A; }
.badge-rejected { background: var(--rose-soft); color: var(--rose); }
.badge-neutral { background: #EFEDF6; color: var(--muted); }
.badge-violet { background: var(--violet-soft); color: var(--violet-2); }
.badge-plain::before { display: none; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(22, 16, 56, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .18s ease-out;
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 22px; flex-wrap: wrap; }
.modal-close { border: 0; background: var(--paper); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.modal-close:hover { color: var(--ink); background: var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }

@media (max-width: 600px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; max-height: 92dvh; padding-bottom: var(--safe-bottom); animation: sheet .25s cubic-bezier(.2, .9, .3, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
}

/* ---------------- Toast ---------------- */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); top: calc(16px + var(--safe-top)); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast .25s ease-out; pointer-events: auto; }
.toast.error { background: var(--rose); }
.toast .ico { color: #7FE7EE; }
.toast.error .ico { color: #fff; }
@keyframes toast { from { opacity: 0; transform: translateY(-10px); } }

/* ---------------- Misc ---------------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ico { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--line-2); }
.skeleton { background: linear-gradient(90deg, #EEEBF7 0%, #F7F5FC 50%, #EEEBF7 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-lg); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- Announcement popup ---------------- */
.announce { max-width: 460px; overflow: hidden; }
.announce .modal-body { padding: 0; }
.announce-img { width: 100%; max-height: 260px; object-fit: cover; }
.announce-in { padding: 24px 24px 22px; }
.announce-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--violet-2); margin-bottom: 10px; }
.announce h3 { font-family: var(--font-display); font-weight: 600; font-size: 21px; line-height: 1.25; margin-bottom: 10px; }
.announce-msg { color: var(--ink-2); white-space: pre-line; font-size: 15px; line-height: 1.6; }
.announce-actions { display: flex; gap: 10px; margin-top: 22px; }
.announce-actions .btn { flex: 1; }
.announce-bar { height: 6px; background: linear-gradient(90deg, #8E6BFF, #2EE6E6); }
.announce.tone-warning .announce-bar { background: linear-gradient(90deg, #F2A01C, #FFC860); }
.announce.tone-warning .announce-kicker { color: #9A5E00; }
.announce.tone-promo .announce-bar { background: linear-gradient(90deg, #E64AA8, #8E6BFF); }
.announce.tone-promo .announce-kicker { color: #B0287A; }
.announce .modal-close { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .92); }
.announce { position: relative; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.ico-xs { width: 13px; height: 13px; }
