/* ── Intelletto modal + toast helper styles ─────────────────────────────
 * Shared by all apps via:
 *   <link href="_modals.css" rel="stylesheet">
 *   <script src="_modals.js"></script>
 *
 * Class prefix: im- (Intelletto Modal). Keeps these styles isolated from
 * page-specific CSS that might already define .modal, .toast, .dialog.
 * Matches the v2 elevated-light design system: white cards on the page
 * background, dark text, brand teal/red/amber/green accents.
 */

.im-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 24, 41, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.im-backdrop.im-open { display: flex; }

.im-dialog {
  width: 480px;
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(13, 24, 41, 0.08);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 22px 26px 18px;
}

.im-headrow {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.im-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.im-icon-danger { background: rgba(225, 75, 75, 0.12); color: #e14b4b; }
.im-icon-info   { background: rgba(37, 161, 176, 0.14); color: #25a1b0; }

.im-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #0d1829;
}
.im-subtitle {
  font-size: 12px;
  color: #4a6080;
  margin-top: 3px;
}

.im-context {
  background: #ecf0f7;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.im-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #c9d6e3;
  color: #0d1829;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.im-context-body { flex: 1; min-width: 0; }
.im-context-name { font-weight: 600; font-size: 13px; color: #0d1829; }
.im-context-sub  { font-size: 12px; color: #4a6080; margin-top: 2px; margin-bottom: 8px; }

.im-meta {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 4px 12px;
  font-size: 12px;
}
.im-meta-label { color: #64748b; }
.im-meta-value { color: #0d1829; }

.im-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}

.im-field { display: block; }
.im-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #0d1829;
  margin-bottom: 6px;
}
.im-field .im-soft {
  color: #94a3b8;
  font-weight: 400;
}

.im-field input[type="text"],
.im-field input[type="email"],
.im-field input[type="number"],
.im-field input[type="tel"],
.im-field select,
.im-field textarea {
  width: 100%;
  background: #dbe8ee;
  border: 1px solid #52a4ba;
  color: #0d1829;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.im-field textarea {
  resize: vertical;
  min-height: 60px;
}
.im-field input:focus,
.im-field select:focus,
.im-field textarea:focus {
  border-color: #25a1b0;
  box-shadow: 0 0 0 2px rgba(37, 161, 176, 0.18);
}
.im-field .im-invalid {
  border-color: #e14b4b !important;
  box-shadow: 0 0 0 2px rgba(225, 75, 75, 0.22) !important;
}

.im-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 13px;
  color: #0d1829;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
}
.im-check input[type="checkbox"] {
  margin: 2px 0 0 0;
  accent-color: #25a1b0;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
/* Belt-and-braces spacing — some host pages override flex `gap`
   resolution via aggressive resets. Explicit margin on the span
   guarantees the checkbox-to-text gap regardless. */
.im-check > span {
  margin-left: 8px;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.im-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.im-btn {
  border-radius: 8px;
  padding: 9px 18px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.im-btn:focus { outline: 2px solid #25a1b0; outline-offset: 2px; }

.im-btn-secondary {
  background: #ffffff;
  color: #0d1829;
  border: 1px solid rgba(13, 24, 41, 0.18);
}
.im-btn-secondary:hover { background: #ecf0f7; }

.im-btn-primary {
  background: #25a1b0;
  color: #ffffff;
}
.im-btn-primary:hover { background: #1e8a97; }

.im-btn-danger {
  background: #c43838;
  color: #ffffff;
}
.im-btn-danger:hover { background: #a82e2e; }


/* ── Toasts ─────────────────────────────────────────────────────────────
 * Bottom-right stack. Slide-in, auto-dismiss. ARIA polite — screen
 * readers are notified but not interrupted.
 */
.im-toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  pointer-events: none;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  max-width: 380px;
}

.im-toast {
  background: #0d1829;
  color: #ffffff;
  padding: 10px 36px 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 32px rgba(13, 24, 41, 0.28);
  position: relative;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
  pointer-events: auto;
  border-left: 4px solid #25a1b0;
}
.im-toast-in  { transform: translateX(0); opacity: 1; }
.im-toast-out { transform: translateX(110%); opacity: 0; }

.im-toast-success { border-left-color: #21c55d; }
.im-toast-error   { border-left-color: #e14b4b; }
.im-toast-warning { border-left-color: #eabd23; }
.im-toast-info    { border-left-color: #25a1b0; }

.im-toast-msg { display: block; }

.im-toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.im-toast-close:hover { color: #ffffff; background: rgba(255, 255, 255, 0.08); }
