:root {
      --blue: #082d52;
      --blue2: #0e4d8a;
      --emerald: #0a7abf;
      --emerald2: #00e8b8;
      --white: #ffffff;
      --soft: rgba(255,255,255,0.14);
      --border: rgba(255,255,255,0.22);
      --shadow: rgba(0,0,0,0.35);
    }

    * {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html {
      margin: 0; padding: 0;
      width: 100%; height: 100%;
    }

    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      font-family: Arial, sans-serif;
      background: linear-gradient(160deg, #0a7abf 0%, #00a087 100%);
      color: var(--white);
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* ── Main widget ── */
    .chatbot {
      position: relative;
      top: auto;
      left: auto;
      right: auto;
      bottom: auto;

      width: 440px;
      max-width: 96vw;
      height: 92vh;
      height: 92dvh;
      max-height: 92vh;
      max-height: 92dvh;

      background: rgba(7, 27, 51, 0.89);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 20px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      box-shadow: 0 24px 60px rgba(0,0,0,0.5);
      z-index: 99999;
    }

    .chatbot.minimized {
      height: 52px;
      max-height: 52px;
    }

    .chatbot.minimized .messages,
    .chatbot.minimized .typing,
    .chatbot.minimized .input-area,
    .chatbot.minimized .footer {
      display: none;
    }

    /* ── Header ── */
    .header {
      height: 72px;
      padding: 12px 16px;
      background: linear-gradient(180deg, #021830 0%, #0a2d52 100%);
      display: flex;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      overflow: hidden;
    }

    .logo,
    .logo-fallback {
      width: 52px;
      height: 52px;
    }

    .logo {
      display: block;
      object-fit: contain;
      background: transparent;
      padding: 0;
      border: none;
      border-radius: 0;
      box-shadow: none;
      transform: scale(1.05);
      transform-origin: center;
    }

    .logo-fallback {
      display: none;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 15px;
      font-weight: bold;
    }

    .title {
      flex: 1;
      margin-left: 4px;
    }

    .brand-line {
      display: flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
      overflow: hidden;
    }

    .english-name {
      margin: 0;
      font-size: 22px;
      letter-spacing: 0.5px;
      font-weight: 800;
    }

    .separator {
      opacity: 0.5;
      font-size: 13px;
      font-weight: 300;
    }

    .urdu-name {
      font-family: "Jameel Noori Nastaleeq", "Jameel Noori Nastaleeq Regular", serif;
      font-size: 22px;
      direction: rtl;
      line-height: 1;
      padding-bottom: 4px;
    }

    .subtitle {
      margin: 3px 0 0;
      font-size: 12px;
      opacity: 0.88;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .toggle-btn {
      width: 28px;
      height: 28px;
      border: 1px solid rgba(255,255,255,0.3);
      background: rgba(255,255,255,0.10);
      color: white;
      border-radius: 7px;
      cursor: pointer;
      font-size: 13px;
      font-weight: bold;
      flex-shrink: 0;
      display: none; /* hidden on standalone; shown in embed via override below */
      align-items: center;
      justify-content: center;
    }

    /* Hide minimize button on standalone — only show in embed mode */
    .toggle-btn {
      display: none;
    }

    /* ── Messages ── */
    .messages {
      flex: 1;
      padding: 16px;
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    .msg {
      position: relative;
      z-index: 1;
      margin-bottom: 8px;
      display: flex;
    }

    .msg.user {
      justify-content: flex-end;
    }

    .bubble {
      max-width: 70%;
      padding: 10px 14px;
      border-radius: 14px;
      line-height: 1.5;
      font-size: 15px;
      white-space: pre-wrap;
      word-wrap: break-word;
      overflow-wrap: anywhere;
    }

    .bot .bubble {
      background: var(--soft);
      border: 1px solid var(--border);
      border-bottom-left-radius: 3px;
      color: white;
    }

    .user .bubble {
      background: var(--emerald2);
      color: #022b20;
      border-bottom-right-radius: 3px;
      font-weight: 500;
    }

    .urdu,
    .urdu * {
      font-family: "Jameel Noori Nastaleeq", "Jameel Noori Nastaleeq Regular", serif !important;
      direction: rtl;
      text-align: right;
      line-height: 1.7;
      font-size: 14px;
    }

    .answer-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 5px;
      margin-top: 6px;
    }

    .small-btn {
      background: transparent;
      color: rgba(255,255,255,0.8);
      border: 1px solid rgba(255,255,255,0.28);
      border-radius: 999px;
      padding: 3px 7px;
      font-size: 9.5px;
      font-weight: 500;
      cursor: pointer;
      box-shadow: none;
    }

    .small-btn:hover {
      background: rgba(255,255,255,0.10);
      color: white;
    }

    /* ── Programme buttons ── */
    .programme-actions {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 5px;
      margin-top: 6px;
      margin-bottom: 4px;
    }

    .programme-btn {
      background: linear-gradient(135deg, #0A5FD7, #0A7A63);
      color: white;
      border: none;
      border-radius: 7px;
      padding: 4px 3px;
      font-size: 10px;
      font-weight: 500;
      cursor: pointer;
      transition: all .2s ease;
      min-height: 28px;
      text-align: center;
    }

    .programme-btn:hover {
      transform: translateY(-1px);
      filter: brightness(1.08);
    }

    .programme-btn:active {
      transform: scale(.97);
    }

    /* ── Typing ── */
    .typing {
      display: none;
      padding: 0 10px 6px;
      font-size: 11px;
      opacity: 0.75;
    }

    /* ── Input area ── */
    .input-area {
      display: flex;
      gap: 8px;
      padding: 12px 16px;
      border-top: 1px solid var(--border);
      background: linear-gradient(160deg, #0e4d8a 0%, #0a7abf 55%, #00b890 100%);
      flex-shrink: 0;
    }

    textarea {
      flex: 1;
      resize: none;
      height: 44px;
      max-height: 120px;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px;
      outline: none;
      font-size: 15px;
      color: white;
      background: rgba(255,255,255,0.12);
      font-family: Arial, sans-serif;
    }

    textarea.urdu-input {
      font-family: "Jameel Noori Nastaleeq", "Jameel Noori Nastaleeq Regular", serif !important;
      direction: rtl;
      text-align: right;
      line-height: 1.8;
      font-size: 14px;
      padding-top: 5px;
    }

    textarea::placeholder {
      color: rgba(255,255,255,0.65);
    }

    button {
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-weight: bold;
      touch-action: manipulation;
    }

    .mic, .send {
      min-width: 44px;
      height: 44px;
      flex-shrink: 0;
    }

    .mic {
      background: rgba(255,255,255,0.14);
      color: white;
      font-size: 13px;
    }

    .send {
      padding: 0 16px;
      background: var(--emerald2);
      color: #022b20;
      font-size: 15px;
    }

    .listening {
      background: #ef4444 !important;
      color: white !important;
    }

    /* ── Footer ── */
    .footer {
      padding: 8px 16px 10px;
      font-size: 11px;
      text-align: center;
      opacity: 0.68;
      background: rgba(7, 27, 51, 0.97);
      flex-shrink: 0;
    }

    /* ── Mobile ── */
    @media (max-width: 480px) {
      .chatbot {
        left: 0; right: 0; bottom: 0;
        width: 100%; max-width: none;
        height: 100vh; height: 100dvh;
        max-height: 100vh; max-height: 100dvh;
        border-radius: 0;
      }
      .chatbot.minimized { height: 52px; }
      .english-name { font-size: 13px; }
      .urdu-name    { font-size: 13px; }
      .bubble { max-width: 90%; }
    }

/* ===============================
   EMBED MODE  (?embed=1)
================================ */

body.embed-mode,
body.embed-mode html {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  overflow: hidden !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* Ensure the root html element is also transparent */
body.embed-mode {
  background: transparent !important;
  background-color: transparent !important;
  -webkit-background-color: transparent !important;
}

/* Show minimize button only in embed mode */
body.embed-mode .toggle-btn {
  display: flex !important;
}

body.embed-mode .chatbot {
  position: fixed !important;
  right: 12px !important;
  bottom: 12px !important;
  left: auto !important;
  top: auto !important;

  width: 320px !important;
  height: 520px !important;
  max-width: 320px !important;
  max-height: 85vh !important;

  border-radius: 14px !important;
  box-shadow: 0 8px 28px rgba(0,0,0,.35) !important;
  margin: 0 !important;
}

body.embed-mode .chatbot.minimized {
  height: 52px !important;
  max-height: 52px !important;
}

body.embed-mode .footer {
  font-size: 8.5px;
  padding: 4px 8px 5px;
}

/* Smaller fonts inside the compact embed widget */
body.embed-mode .bubble {
  font-size: 12px !important;
  padding: 7px 10px !important;
  line-height: 1.4 !important;
}
body.embed-mode textarea {
  font-size: 12px !important;
}
body.embed-mode .send {
  font-size: 12px !important;
}
body.embed-mode .typing {
  font-size: 11px !important;
}
body.embed-mode .small-btn {
  font-size: 9px !important;
  padding: 3px 6px !important;
}

    /* Selective letter emphasis in subtitle: M, V, IN larger */
    .sub-hi {
      font-size: 15px;
      font-weight: 800;
      color: #00e8b8;
      line-height: 1;
      vertical-align: middle;
    }
