/* Shared alert/toast/confirm framework styling — paired with ui-alerts.js. Include
   both on every page (see the <link>/<script> pair near the end of <head> on any
   page) instead of using window.alert/confirm/prompt or a one-off inline message
   box, so every notification and confirmation in the app looks and behaves the same
   way. Self-contained --ui-* tokens (not borrowed from shell.css or the marketing
   pages' own design tokens, since not every page defines those) so this renders
   identically everywhere it's used; still respects OS dark mode. */
:root {
  --ui-bg: #ffffff;
  --ui-text: #1f2430;
  --ui-muted: #6b7280;
  --ui-border: #e5e7eb;
  --ui-shadow: 0 12px 32px -8px rgba(15, 15, 25, 0.28), 0 2px 8px rgba(15, 15, 25, 0.08);
  --ui-radius: 12px;
  --ui-accent: #4f46e5;
  --ui-accent-hover: #4338ca;
  --ui-success: #16a34a;
  --ui-error: #dc2626;
  --ui-warning: #d97706;
  --ui-info: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ui-bg: #1c2027;
    --ui-text: #e8eaed;
    --ui-muted: #9aa1ac;
    --ui-border: #333a45;
    --ui-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- toasts ---------- */
#ui-toast-host {
  position: fixed;
  z-index: 99999;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  max-width: calc(100vw - 36px);
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 12px 12px 14px;
  background: var(--ui-bg);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  border-left: 4px solid var(--ui-info);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  font: 13.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ui-toast-in { opacity: 1; transform: translateY(0) scale(1); }
.ui-toast-out { opacity: 0; transform: translateY(6px) scale(0.98); }
.ui-toast-success { border-left-color: var(--ui-success); }
.ui-toast-error { border-left-color: var(--ui-error); }
.ui-toast-warning { border-left-color: var(--ui-warning); }
.ui-toast-info { border-left-color: var(--ui-info); }
.ui-toast-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.ui-toast-icon svg { width: 100%; height: 100%; display: block; }
.ui-toast-success .ui-toast-icon { color: var(--ui-success); }
.ui-toast-error .ui-toast-icon { color: var(--ui-error); }
.ui-toast-warning .ui-toast-icon { color: var(--ui-warning); }
.ui-toast-info .ui-toast-icon { color: var(--ui-info); }
.ui-toast-msg { flex: 1; min-width: 0; overflow-wrap: break-word; padding-top: 1px; }
.ui-toast-close {
  flex: none;
  width: auto;
  border: none;
  background: none;
  color: var(--ui-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 3px;
  margin: -3px -3px -3px 0;
  border-radius: 5px;
}
.ui-toast-close:hover { color: var(--ui-text); background: rgba(127, 127, 127, 0.12); }
@media (max-width: 480px) {
  #ui-toast-host { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .ui-toast { max-width: none; }
}

/* ---------- confirm / alert modal ---------- */
body.ui-modal-open { overflow: hidden; }
.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 25, 0.5);
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.ui-modal-backdrop.ui-modal-in { opacity: 1; }
.ui-modal {
  width: 100%;
  max-width: 400px;
  background: var(--ui-bg);
  color: var(--ui-text);
  border-radius: 16px;
  box-shadow: var(--ui-shadow);
  padding: 22px 24px;
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
}
.ui-modal-backdrop.ui-modal-in .ui-modal { transform: translateY(0) scale(1); }
.ui-modal-title { display: flex; align-items: center; gap: 10px; font-size: 16.5px; font-weight: 700; margin-bottom: 8px; }
.ui-modal-title .ui-modal-icon { flex: none; width: 22px; height: 22px; }
.ui-modal-title .ui-modal-icon svg { width: 100%; height: 100%; display: block; }
.ui-modal-body { color: var(--ui-muted); white-space: pre-wrap; }
.ui-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.ui-btn {
  width: auto;
  flex: none;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.ui-btn-primary { background: var(--ui-accent); color: #fff; }
.ui-btn-primary:hover { background: var(--ui-accent-hover); }
.ui-btn-danger { background: var(--ui-error); color: #fff; }
.ui-btn-danger:hover { filter: brightness(0.92); }
.ui-btn-ghost { background: none; border-color: var(--ui-border); color: var(--ui-text); }
.ui-btn-ghost:hover { background: rgba(127, 127, 127, 0.08); }
.ui-btn:disabled { opacity: 0.55; cursor: default; pointer-events: none; }
