:root {
  --mf-primary: #003d9e;
  --mf-primary-dark: #001d4d;
  --mf-bg: #ffffff;
  --mf-bubble-bot: #f1f5f2;
  --mf-bubble-user: #003d9e;
  --mf-text: #1a1a1a;
  --mf-muted: #6b7280;
  --mf-border: #e5e7eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--mf-bg);
  color: var(--mf-text);
}

.mf-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--mf-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--mf-bg);
}

.mf-header {
  background: var(--mf-primary);
  color: #fff;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mf-header .mf-header-text {
  flex: 1;
}

.mf-close {
  background: transparent;
  border: none;
  color: #fff;
  opacity: 0.85;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.mf-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.mf-header small {
  display: block;
  font-weight: 400;
  opacity: 0.9;
  font-size: 12px;
}

.mf-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 15%;
  background: #fff;
  flex-shrink: 0;
}

.mf-avatar[hidden] { display: none; }

.mf-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 92%;
}

.mf-row .mf-avatar {
  width: 26px;
  height: 26px;
  margin-bottom: 2px;
}

.mf-row .mf-msg.bot {
  max-width: 100%;
}

.mf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}

.mf-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
}

.mf-msg.bot {
  background: var(--mf-bubble-bot);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.mf-msg.user {
  background: var(--mf-bubble-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.mf-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.mf-product-card {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--mf-border);
  border-radius: 10px;
  padding: 8px;
  text-decoration: none;
  color: var(--mf-text);
  background: #fff;
  align-self: flex-start;
  max-width: 90%;
}

.mf-product-card img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1f5f2;
  flex-shrink: 0;
}

.mf-product-card .mf-pinfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mf-product-card .mf-pname {
  font-size: 13px;
  font-weight: 600;
}

.mf-product-card .mf-pcta {
  font-size: 12px;
  color: var(--mf-primary-dark);
  font-weight: 600;
}

.mf-typing {
  font-size: 13px;
  color: var(--mf-muted);
  align-self: flex-start;
  padding: 4px 14px;
}

.mf-inputbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--mf-border);
  background: #fff;
}

.mf-inputbar input {
  flex: 1;
  border: 1px solid var(--mf-border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}

.mf-inputbar input:focus {
  border-color: var(--mf-primary);
}

.mf-inputbar button {
  background: var(--mf-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mf-inputbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mf-inputbar button:hover:not(:disabled) {
  background: var(--mf-primary-dark);
}
