/* Mihai Group — website chat widget (courier / ops, calm) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --mg-ink: #142033;
  --mg-ink-soft: #3a4658;
  --mg-muted: #6b7585;
  --mg-line: #d8dde5;
  --mg-paper: #f4f6f8;
  --mg-panel: #ffffff;
  --mg-accent: #1f6b5c;
  --mg-accent-hover: #175649;
  --mg-accent-soft: #e6f1ee;
  --mg-warn: #8a5a1a;
  --mg-warn-bg: #f7f0e4;
  --mg-shadow: 0 12px 40px rgba(20, 32, 51, 0.18);
  --mg-radius: 10px;
  --mg-font: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mg-z: 2147483000;
}

.mg-chat-msg.bot a.mg-chat-mailto {
  color: var(--mg-accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mg-chat-msg.bot a.mg-chat-mailto:hover {
  color: var(--mg-accent-hover);
}

.mg-chat-handoff a.mg-chat-mailto {
  color: var(--mg-warn);
  font-weight: 500;
  text-decoration: underline;
}

.mg-chat-root {
  all: initial;
  font-family: var(--mg-font);
  color: var(--mg-ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.mg-chat-root *,
.mg-chat-root *::before,
.mg-chat-root *::after {
  box-sizing: border-box;
}

.mg-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--mg-z);
  width: auto;
  min-height: 64px;
  padding: 10px 18px 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--mg-ink);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--mg-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mg-font);
  transition: background 0.15s ease, transform 0.15s ease;
}

.mg-chat-launcher:hover {
  background: var(--mg-accent);
  transform: translateY(-1px);
}

.mg-chat-launcher:focus-visible {
  outline: 2px solid var(--mg-accent);
  outline-offset: 3px;
}

.mg-chat-launcher-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #fff;
}

.mg-chat-launcher-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.15;
  gap: 2px;
}

.mg-chat-launcher-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mg-chat-launcher-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.88;
}

.mg-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: var(--mg-z);
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: var(--mg-radius);
  box-shadow: var(--mg-shadow);
  overflow: hidden;
}

.mg-chat-panel.mg-open {
  display: flex;
  animation: mg-rise 0.22s ease-out;
}

@keyframes mg-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mg-chat-header {
  flex: 0 0 auto;
  padding: 16px 16px 14px;
  background:
    linear-gradient(160deg, #1a2a3d 0%, #142033 55%, #10352f 100%);
  color: #f5f7fa;
}

.mg-chat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-chat-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.mg-chat-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.mg-chat-brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

.mg-chat-brand-mark {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8b4c4;
}

.mg-chat-header-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: #c5ced9;
  font-weight: 400;
}

.mg-chat-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.mg-chat-header-actions button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #dce3ec;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.mg-chat-header-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mg-chat-close {
  border: 0 !important;
  padding: 4px 8px !important;
  font-size: 16px !important;
  line-height: 1;
  margin-left: auto;
}

.mg-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: var(--mg-paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mg-chat-welcome {
  padding: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mg-chat-welcome .mg-chat-msg.bot {
  max-width: 100%;
}

.mg-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 6px;
  align-self: flex-start;
  max-width: 100%;
}

.mg-chat-chips-welcome {
  padding-top: 2px;
}

.mg-chat-chip {
  font-family: inherit;
  border: 1px solid var(--mg-accent);
  background: var(--mg-panel);
  color: var(--mg-accent-hover);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.25;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
  box-shadow: 0 1px 0 rgba(20, 32, 51, 0.04);
}

.mg-chat-chip:hover {
  background: var(--mg-accent);
  color: #fff;
  transform: translateY(-1px);
}

.mg-chat-chip:focus-visible {
  outline: 2px solid var(--mg-accent);
  outline-offset: 2px;
}

.mg-chat-services {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mg-chat-service {
  font-family: inherit;
  text-align: left;
  width: 100%;
  border: 1px solid var(--mg-line);
  background: var(--mg-panel);
  color: var(--mg-ink);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.mg-chat-service:hover {
  border-color: var(--mg-accent);
  background: var(--mg-accent-soft);
}

.mg-chat-service small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  color: var(--mg-muted);
}

.mg-chat-msg {
  max-width: 92%;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.mg-chat-msg.bot {
  align-self: flex-start;
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  color: var(--mg-ink);
}

.mg-chat-msg.user {
  align-self: flex-end;
  background: var(--mg-ink);
  color: #f5f7fa;
}

.mg-chat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--mg-muted);
  font-size: 12px;
  padding: 2px 0;
}

.mg-chat-links {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: -4px;
  padding-left: 2px;
}

.mg-chat-links a {
  font-size: 12px;
  color: var(--mg-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mg-chat-handoff {
  align-self: stretch;
  background: var(--mg-warn-bg);
  color: var(--mg-warn);
  border: 1px solid #e6d5b5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.mg-chat-quote {
  align-self: stretch;
  background: var(--mg-accent-soft);
  border: 1px solid #c5ddd6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--mg-ink);
}

.mg-chat-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--mg-muted);
  padding: 2px 4px;
}

.mg-chat-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--mg-line);
  background: var(--mg-panel);
  padding: 10px 12px 12px;
}

.mg-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.mg-chat-input {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.35;
  color: var(--mg-ink);
  background: var(--mg-paper);
  border: 1px solid var(--mg-line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: none;
  min-height: 42px;
  max-height: 96px;
}

.mg-chat-input:focus {
  outline: none;
  border-color: var(--mg-accent);
  background: #fff;
}

.mg-chat-input::placeholder {
  color: var(--mg-muted);
}

.mg-chat-send {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--mg-accent);
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  height: 42px;
}

.mg-chat-send:hover:not(:disabled) {
  background: var(--mg-accent-hover);
}

.mg-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mg-chat-fineprint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--mg-muted);
}

@media (max-width: 640px) {
  .mg-chat-launcher {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(56px, calc(12px + env(safe-area-inset-bottom)));
    min-height: 52px;
    padding: 8px 14px 8px 10px;
  }

  .mg-chat-launcher-avatar {
    width: 36px;
    height: 36px;
  }

  .mg-chat-launcher-sub {
    display: none;
  }

  .mg-chat-launcher-name {
    font-size: 14px;
  }

  .mg-chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: min(92dvh, calc(100vh - env(safe-area-inset-bottom)));
    max-height: none;
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .mg-chat-brand-name {
    font-size: 17px;
  }

  .mg-chat-input {
    font-size: 16px; /* avoids iOS zoom on focus */
    min-height: 44px;
  }

  .mg-chat-send {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 420px) {
  .mg-chat-launcher {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(56px, calc(10px + env(safe-area-inset-bottom)));
  }
}
