    :root {
      --bg: #f4f6fb;
      --panel: #ffffff;
      --panel-soft: #f7f8fc;
      --line: #dfe3ee;
      --text: #171923;
      --muted: #6f7687;
      --blue: #1f67f2;
      --blue-dark: #1557d6;
      --green: #16a34a;
      --red: #dc2626;
      --shadow: 0 20px 60px rgba(30, 41, 59, 0.18);
      --radius-xl: 24px;
      --radius-lg: 18px;
      --radius-md: 14px;
      --app-dvh: 100dvh;
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-right: env(safe-area-inset-right, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-left: env(safe-area-inset-left, 0px);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html, body {
      width: 100%;
      min-height: 100%;
      height: 100%;
      overflow: hidden;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      -webkit-text-size-adjust: 100%;
      overscroll-behavior: none;
      background:
        radial-gradient(circle at top right, rgba(31, 103, 242, 0.18), transparent 28%),
        linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
      color: var(--text);
    }

    body {
      margin: 0;
      padding: 16px;
    }

    img {
      display: block;
      max-width: 100%;
    }

    .hidden {
      display: none !important;
    }

    .page {
      width: 100%;
      min-height: calc(var(--app-dvh) - 32px);
      height: calc(var(--app-dvh) - 32px);
      border-radius: 24px;
      overflow: hidden;
      background: rgba(255,255,255,0.72);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255,255,255,0.7);
      box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
      display: flex;
      flex-direction: column;
    }

    .topbar {
      min-height: 74px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 12px 22px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(90deg, rgba(255,255,255,0.95), rgba(218,230,255,0.88));
      flex-shrink: 0;
    }

    .brand {
      display: flex;
      align-items: center;
      min-width: 0;
      flex-shrink: 0;
    }

    .brand-logo {
      height: 42px;
      width: auto;
      object-fit: contain;
    }

    .topbar-right {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 12px;
      min-width: 0;
      margin-left: auto;
    }

    .topbar-text {
      font-size: 14px;
      color: #334155;
      text-align: right;
      max-width: 420px;
      line-height: 1.4;
    }

    .layout {
      flex: 1;
      min-height: 0;
      display: grid;
      grid-template-columns: 1.08fr 0.92fr;
      align-items: stretch;
      overflow: hidden;
    }

    .hero {
      padding: 42px 44px 36px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      background: rgba(255,255,255,0.58);
      border-right: 1px solid var(--line);
      min-height: 0;
    }

    .hero-badge {
      width: 94px;
      height: 94px;
      border-radius: 24px;
      background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 24px;
      padding: 14px;
      box-shadow:
        0 18px 30px rgba(31, 103, 242, 0.14),
        inset 0 1px 0 rgba(255,255,255,0.9);
      border: 1px solid #dce8ff;
      flex-shrink: 0;
    }

    .hero-badge img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .hero h1 {
      font-size: 64px;
      line-height: 1;
      margin-bottom: 24px;
      letter-spacing: -1.6px;
      color: #111827;
    }

    .hero p {
      max-width: 640px;
      font-size: 24px;
      line-height: 1.45;
      color: #1f2937;
    }

    .hero p + p {
      margin-top: 8px;
    }

    .chat-side {
      display: flex;
      align-items: stretch;
      justify-content: center;
      padding: 24px 32px 28px;
      background:
        radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,0.35), rgba(206, 229, 255, 0.35));
      min-height: 0;
    }
    .chat-shell {
      width: 100%;
      max-width: 460px;
      min-height: 0;
      height: 100%;
      max-height: min(780px, 100%);
      background: rgba(255,255,255,0.9);
      border: 1px solid rgba(255,255,255,0.82);
      border-radius: 28px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      margin-top: 0;
      position: relative;
    }

    .chat-top {
      padding: 16px 18px 10px;
      border-bottom: 1px solid rgba(223, 227, 238, 0.95);
      background: rgba(255,255,255,0.8);
      flex-shrink: 0;
      position: relative;
      transition: opacity 0.18s ease;
    }

    .circle-btn {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      border: 1px solid #e5eaf3;
      background: #ffffff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #111827;
      font-size: 18px;
      font-weight: 800;
      cursor: pointer;
      user-select: none;
      transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
      box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
      flex-shrink: 0;
    }

    .circle-btn:hover {
      transform: scale(1.04);
    }

    .circle-btn:disabled {
      cursor: not-allowed;
      opacity: 0.55;
      transform: none;
      box-shadow: none;
    }

    .close-chat-btn {
      color: #dc2626;
      background: #fff5f5;
      border-color: #fecaca;
    }

    .close-chat-btn:hover {
      background: #fee2e2;
      box-shadow: 0 10px 22px rgba(220, 38, 38, 0.14);
    }

    .close-chat-btn span {
      line-height: 1;
      transform: translateY(-1px);
    }

    /* =========================
      CLOSE CHAT CONFIRM MODAL
      ========================= */

    .close-chat-confirm {
      position: absolute;
      inset: 0;
      z-index: 60;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
    }

    .close-chat-confirm.hidden {
      display: none !important;
    }

    .close-chat-confirm__backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, 0.28);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }

    .close-chat-confirm__dialog {
      position: relative;
      z-index: 1;
      width: min(100%, 356px);
      background: rgba(255,255,255,0.98);
      border: 1px solid rgba(223, 227, 238, 0.95);
      border-radius: 22px;
      box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.24),
        0 8px 20px rgba(15, 23, 42, 0.10);
      padding: 24px 20px 18px;
      text-align: center;
    }

    .close-chat-confirm__x {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 34px;
      height: 34px;
      border: 0;
      border-radius: 50%;
      background: transparent;
      color: #111827;
      font-size: 18px;
      font-weight: 800;
      cursor: pointer;
      transition: background 0.18s ease, transform 0.18s ease;
    }

    .close-chat-confirm__x:hover {
      background: #f3f4f6;
      transform: scale(1.04);
    }

    .close-chat-confirm__icon {
      width: 74px;
      height: 74px;
      margin: 10px auto 16px;
      border-radius: 50%;
      background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
      color: #475569;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.95);
    }

    .close-chat-confirm__icon svg {
      width: 30px;
      height: 30px;
    }

    .close-chat-confirm__title {
      font-size: 22px;
      line-height: 1.2;
      font-weight: 800;
      color: #111827;
      margin-bottom: 8px;
      letter-spacing: -0.02em;
    }

    .close-chat-confirm__desc {
      font-size: 14px;
      line-height: 1.6;
      color: #64748b;
      margin-bottom: 18px;
    }

    .close-chat-confirm__actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .close-chat-confirm__btn {
      min-height: 48px;
      border-radius: 14px;
      border: 1px solid transparent;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
    }

    .close-chat-confirm__btn:hover {
      transform: translateY(-1px);
    }

    .close-chat-confirm__btn:disabled {
      cursor: not-allowed;
      opacity: 0.7;
      transform: none;
      filter: none;
      box-shadow: none;
    }

    .close-chat-confirm__btn--ghost {
      background: #ffffff;
      color: #334155;
      border-color: #dbe3ee;
      box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    }

    .close-chat-confirm__btn--ghost:hover {
      background: #f8fafc;
    }

    .close-chat-confirm__btn--danger {
      background: linear-gradient(180deg, #ff5a36 0%, #e8340d 100%);
      color: #ffffff;
      border-color: rgba(0,0,0,0.02);
      box-shadow: 0 14px 28px rgba(232, 52, 13, 0.24);
    }

    .close-chat-confirm__btn--danger:hover {
      filter: brightness(1.03);
    }

    /* =========================
      IMAGE PREVIEW MODAL
      ========================= */

    .image-preview-modal {
      position: absolute;
      inset: 0;
      z-index: 70;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
    }

    .image-preview-modal.hidden {
      display: none !important;
    }

    .image-preview-modal__backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, 0.82);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .image-preview-modal__dialog {
      position: relative;
      z-index: 1;
      width: min(100%, 920px);
      height: min(100%, 720px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 56px 20px 20px;
      border-radius: 24px;
    }

    .image-preview-modal__close {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 42px;
      height: 42px;
      border: 0;
      border-radius: 50%;
      background: rgba(255,255,255,0.14);
      color: #ffffff;
      font-size: 22px;
      font-weight: 800;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .image-preview-modal__close:hover {
      transform: scale(1.04);
      background: rgba(255,255,255,0.22);
    }

    .image-preview-modal__frame {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 22px;
      overflow: hidden;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
    }

    .image-preview-modal__img {
      display: block;
      max-width: 100%;
      max-height: 100%;
      width: auto;
      height: auto;
      object-fit: contain;
      border-radius: 18px;
      user-select: none;
      -webkit-user-drag: none;
      box-shadow: 0 18px 44px rgba(0,0,0,0.32);
      background: #0f172a;
    }

    @media (max-width: 640px) {
      .image-preview-modal {
        padding: 10px;
      }

      .image-preview-modal__dialog {
        width: 100%;
        height: 100%;
        padding: 52px 8px 8px;
        border-radius: 0;
      }

      .image-preview-modal__frame {
        border-radius: 16px;
      }

      .image-preview-modal__img {
        border-radius: 12px;
      }

      .image-preview-modal__close {
        top: 4px;
        right: 4px;
        width: 40px;
        height: 40px;
      }
    }

    @media (max-width: 480px) {
      .close-chat-confirm {
        padding: 14px;
      }

      .close-chat-confirm__dialog {
        width: 100%;
        border-radius: 20px;
        padding: 22px 16px 16px;
      }

      .close-chat-confirm__title {
        font-size: 20px;
      }
    }

    .chat-brand-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .agent-card {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      border-radius: 18px;
      background: #ffffff;
      box-shadow: 0 10px 26px rgba(15, 23, 42, 0.10);
      border: 1px solid #eef1f7;
      width: 100%;
    }

    .agent-avatar-wrap {
      position: relative;
      flex-shrink: 0;
    }

    .agent-avatar {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: #ffffff;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #e7edf7;
      box-shadow: 0 8px 18px rgba(31, 103, 242, 0.16);
      overflow: hidden;
      position: relative;
      color: #1f67f2;
      font-size: 18px;
      font-weight: 800;
      text-transform: uppercase;
      line-height: 1;
      padding: 0;
    }

    .agent-avatar.has-image {
      background: #ffffff;
      color: transparent;
      border: 1px solid #e7edf7;
    }

    .agent-avatar img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
      object-position: center center;
      border-radius: 50%;
    }

    .agent-avatar-fallback {
      position: relative;
      z-index: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      line-height: 1;
    }

    .agent-avatar.has-image .agent-avatar-fallback {
      display: none;
    }

    .agent-online {
      position: absolute;
      right: 1px;
      top: 1px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--green);
      border: 2px solid #fff;
    }

    .agent-meta {
      min-width: 0;
    }

    .agent-name {
      font-size: 18px;
      font-weight: 800;
      line-height: 1.1;
      margin-bottom: 4px;
    }

    .agent-role {
      font-size: 14px;
      color: var(--muted);
    }

    .chat-body {
      flex: 1;
      min-height: 0;
      padding: 18px 16px;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      background: linear-gradient(180deg, #fbfcff 0%, #f3f6fc 100%);
      position: relative;
      transition: opacity 0.18s ease;
    }

    .message-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .session-line {
      align-self: center;
      margin: 4px auto 10px;
      padding: 8px 12px;
      border-radius: 999px;
      background: #eef4ff;
      border: 1px solid #dbe7ff;
      color: #334155;
      font-size: 12px;
      font-weight: 700;
      box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    }

    .msg-row {
      display: flex;
      align-items: flex-end;
      gap: 10px;
      max-width: 100%;
    }

    .msg-row.right {
      justify-content: flex-end;
    }

    .msg-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 800;
      color: #fff;
      box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
      text-transform: uppercase;
      overflow: hidden;
      position: relative;
    }

    .msg-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .msg-avatar.has-image {
      background: transparent;
      color: transparent;
    }

    .msg-avatar.has-image img {
      border-radius: 50%;
      object-fit: cover;
      object-position: center;
    }

    .msg-avatar.agent {
      background: linear-gradient(180deg, #ff6a00 0%, #ff4d00 100%);
    }

    .msg-avatar.user {
      background: linear-gradient(180deg, #1f67f2 0%, #1557d6 100%);
    }

    /* =========================
      MESSAGE LAYOUT SYNC ADMIN
      ========================= */

    .message-block {
      width: 100%;
      display: flex;
    }

    .message-block.left {
      justify-content: flex-start;
    }

    .message-block.right {
      justify-content: flex-end;
    }

    .message-shell {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      width: fit-content;
      max-width: min(78%, 760px);
    }

    .message-block.right .message-shell {
      flex-direction: row-reverse;
    }

    .message-content {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
      max-width: 100%;
    }

    .message-block.left .message-content {
      align-items: flex-start;
    }

    .message-block.right .message-content {
      align-items: flex-end;
    }

    .sender-name {
      font-size: 11px;
      color: #6f7687;
      padding: 0 4px;
      margin: 0;
    }

    .message-block.is-grouped .sender-name {
      display: none;
    }

    .message-block.is-grouped .message-shell {
      align-items: flex-start;
    }

    .avatar-spacer {
      width: 32px;
      height: 32px;
      flex-shrink: 0;
      visibility: hidden;
      pointer-events: none;
    }

    /* grouped spacing seperti admin */

    .message-block.is-grouped {
      margin-top: -2px;
    }

    .message-block.is-image {
      margin-top: -4px;
    }

    .message-block.is-image + .message-block.is-image {
      margin-top: -5px;
    }

    .message-block.is-grouped.is-image {
      margin-top: -5px;
    }

    .message-block.is-grouped.is-image + .message-block.is-image {
      margin-top: -6px;
    }

    .message-block.is-text + .message-block.is-image,
    .message-block.is-image + .message-block.is-text {
      margin-top: -3px;
    }

    .message-block.is-image .message-content {
      gap: 2px;
    }

    .message-block.system {
      justify-content: center;
      margin: 10px 0 14px;
    }

    .message-block.system .message-shell {
      width: 100%;
      max-width: min(92%, 560px);
      justify-content: center;
    }

    .message-block.system .message-content {
      width: 100%;
      align-items: center;
      gap: 3px;
    }

    .system-event {
      display: inline-block;
      width: max-content;
      max-width: min(100%, 460px);
      margin: 0 auto;
      padding: 0;
      border-radius: 0;
      background: transparent;
      border: 0;
      box-shadow: none;
      color: #7f8898;
      text-align: center;
      font-size: 13px;
      line-height: 1.5;
      font-weight: 500;
      white-space: normal;
      word-break: normal;
      overflow-wrap: anywhere;
    }

    .system-event a {
      color: inherit;
      text-decoration: underline;
    }

    .system-event-time,
    .message-meta {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 0;
      font-size: 11px;
      line-height: 1.2;
      color: #a4acb9;
    }

    .system-event-time {
      justify-content: center;
    }

    .message-block.left .message-meta {
      justify-content: flex-start;
    }

    .message-block.right .message-meta {
      justify-content: flex-end;
    }

    .message-meta-dot {
      width: 3px;
      height: 3px;
      border-radius: 999px;
      background: currentColor;
      opacity: 0.55;
      flex-shrink: 0;
    }

    .message-meta-status {
      font-weight: 700;
    }

    /* bubble text */

    .bubble {
      max-width: 100%;
      padding: 13px 16px;
      border-radius: 18px;
      font-size: 15px;
      line-height: 1.45;
      word-break: break-word;
      white-space: pre-wrap;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.14);
    }

    .bubble.left {
      background: #ffffff;
      color: #111827;
      border-top-left-radius: 8px;
      border: 1px solid #e5e7eb;
      box-shadow:
        0 6px 18px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255,255,255,0.9);
    }

    .bubble.right {
      background: linear-gradient(180deg, #1d66ed 0%, #1557d6 100%);
      color: #fff;
      border-top-right-radius: 8px;
      border: 1px solid rgba(255,255,255,0.04);
    }

    .bubble a {
      text-decoration: underline;
      font-weight: 600;
      word-break: break-all;
    }

    .bubble.left a {
      color: #1d4ed8;
    }

    .bubble.right a {
      color: #ffffff;
    }

    .bubble.bubble-media {
      padding: 0;
      overflow: hidden;
      border-radius: 16px;
      max-width: min(200px, 60vw);
      background: transparent;
      box-shadow: none;
      white-space: normal;
      line-height: 0;
      border: 0;
    }

    .bubble.bubble-media .bubble-image-caption {
      white-space: pre-wrap;
      line-height: 1.42;
    }

    .bubble.bubble-media.has-caption {
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.14);
    }

    .bubble.left.bubble-media.has-caption {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      box-shadow:
        0 6px 18px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255,255,255,0.9);
    }

    .bubble.right.bubble-media.has-caption {
      background: linear-gradient(180deg, #1d66ed 0%, #1557d6 100%);
    }

    .bubble-image-wrap {
      width: 100%;
      max-width: 100%;
      border-radius: 16px;
      overflow: hidden;
      cursor: zoom-in;
      position: relative;
      line-height: 0;
      background: #11141b;
    }

    .bubble-image-trigger {
      appearance: none;
      -webkit-appearance: none;
      display: block;
      width: 100%;
      padding: 0;
      margin: 0;
      border: 0;
      background: transparent;
      cursor: zoom-in;
      line-height: 0;
      text-align: inherit;
      color: inherit;
      font: inherit;
      -webkit-tap-highlight-color: transparent;
    }

    .bubble.bubble-media.has-caption .bubble-image-wrap {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }

    .bubble-image-wrap img {
      width: 100%;
      max-height: min(200px, 44vh);
      object-fit: cover;
      display: block;
      border-radius: inherit;
      background: #1a1d24;
      transition: transform 0.18s ease, filter 0.18s ease;
    }

    .bubble-image-caption {
      padding: 8px 11px 10px;
      font-size: 13px;
      line-height: 1.42;
      color: #fff;
      word-break: break-word;
      white-space: pre-wrap;
    }

    .bubble.left.bubble-media .bubble-image-caption {
      color: #111827;
    }

    .bubble.right.bubble-media .bubble-image-caption {
      color: #fff;
    }

    .bubble-image-wrap:hover img {
      filter: brightness(0.98);
      transform: scale(1.01);
    }

    .admin-typing-row {
      opacity: 0.98;
    }

    .admin-typing-bubble {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 56px;
      min-height: 42px;
      padding: 0 14px;
      border-top-left-radius: 18px;
    }

    /* ============================================
      MESSAGE TIMESTAMP + READ STATUS
      ============================================ */

    .bubble-footer {
      display: inline-flex;
      float: right;
      clear: right;
      align-items: center;
      gap: 2px;
      margin: 5px 0 -3px 6px;
      line-height: 1;
      user-select: none;
      pointer-events: none;
    }

    .bubble-footer-spacer {
      display: inline-block;
      width: 0;
      height: 1px;
      vertical-align: baseline;
      pointer-events: none;
      user-select: none;
    }

    .bubble-time {
      font-size: 10.5px;
      color: rgba(255,255,255,0.42);
      white-space: nowrap;
      letter-spacing: 0.01em;
    }

    .bubble.right .bubble-time {
      color: rgba(255,255,255,0.55);
    }

    .bubble.left .bubble-time {
      color: rgba(17, 24, 39, 0.52);
    }

    .bubble-check {
      display: inline-flex;
      align-items: center;
      flex-shrink: 0;
      line-height: 0;
    }

    .bubble-check svg {
      width: 18px;
      height: 11px;
    }

    .bubble-check.is-sent {
      color: rgba(255,255,255,0.42);
    }

    .bubble.left .bubble-check.is-sent {
      color: rgba(17, 24, 39, 0.42);
    }

    .bubble-check.is-read {
      color: #53bdeb;
    }

    .bubble-image-caption .bubble-footer {
      margin: 2px 0 -3px 8px;
    }

    .bubble-footer-overlay {
      position: absolute;
      right: 6px;
      bottom: 5px;
      margin: 0;
      padding: 2px 6px;
      border-radius: 8px;
      background: rgba(0,0,0,0.52);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
      pointer-events: none;
    }

    .bubble-footer-overlay .bubble-time {
      color: rgba(255,255,255,0.88);
    }

    .bubble.left .bubble-footer-overlay .bubble-time,
    .bubble.right .bubble-footer-overlay .bubble-time {
      color: rgba(255,255,255,0.92);
    }

    .bubble-footer-overlay .bubble-check.is-sent {
      color: rgba(255,255,255,0.62);
    }

    .bubble.left .bubble-footer-overlay .bubble-check.is-sent,
    .bubble.right .bubble-footer-overlay .bubble-check.is-sent {
      color: rgba(255,255,255,0.72);
    }

    .bubble-footer-overlay .bubble-check.is-read {
      color: #53bdeb;
    }

    .admin-typing-dots {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .admin-typing-dots span {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: #94a3b8;
      opacity: 0.32;
      animation: publicAdminTypingPulse 1.15s infinite ease-in-out;
    }

    .admin-typing-dots span:nth-child(2) {
      animation-delay: 0.14s;
    }

    .admin-typing-dots span:nth-child(3) {
      animation-delay: 0.28s;
    }

    @keyframes publicAdminTypingPulse {
      0%, 80%, 100% {
        opacity: 0.32;
        transform: translateY(0);
      }
      40% {
        opacity: 1;
        transform: translateY(-2px);
      }
    }

/* INLINE REOPEN FORM (bubble dari admin) */
    .inline-reopen-form {
      padding: 8px 16px 12px;
    }

    .inline-reopen-bubble {
      padding: 16px !important;
      white-space: normal !important;
      max-width: 280px !important;
    }

    .inline-reopen-title {
      font-size: 15px;
      font-weight: 800;
      color: #111827;
      margin-bottom: 4px;
    }

    .inline-reopen-desc {
      font-size: 13px;
      color: #64748b;
      margin-bottom: 12px;
      line-height: 1.5;
    }

    .inline-reopen-field {
      margin-bottom: 10px;
    }

    .inline-reopen-label {
      display: block;
      font-size: 13px;
      font-weight: 700;
      color: #334155;
      margin-bottom: 4px;
    }

    .inline-reopen-input {
      width: 100%;
      height: 40px;
      border-radius: 10px;
      border: 1px solid #dbe3f0;
      background: #f8fafc;
      padding: 0 12px;
      font-size: 14px;
      outline: none;
      color: #111827;
      font-family: inherit;
      box-sizing: border-box;
    }

    .inline-reopen-input:focus {
      border-color: #1f67f2;
      background: #ffffff;
      box-shadow: 0 0 0 3px rgba(31, 103, 242, 0.10);
    }

    .inline-reopen-submit {
      width: 100%;
      height: 40px;
      border: 0;
      border-radius: 10px;
      background: linear-gradient(180deg, #1f67f2 0%, #1557d6 100%);
      color: #fff;
      font-weight: 800;
      font-size: 14px;
      cursor: pointer;
      margin-top: 2px;
      box-shadow: 0 8px 16px rgba(31, 103, 242, 0.18);
      transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
    }

    .inline-reopen-submit:hover {
      filter: brightness(1.04);
      transform: translateY(-1px);
    }

    .inline-reopen-submit:disabled {
      cursor: not-allowed;
      opacity: 0.7;
      transform: none;
      filter: none;
    }

    .inline-reopen-error {
      min-height: 14px;
      font-size: 12px;
      color: #dc2626;
      margin-top: 4px;
    }

    .name-gate {
      position: absolute;
      inset: 0;
      z-index: 5;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(243, 246, 252, 0.92);
      backdrop-filter: blur(4px);
    }

    .name-gate.hidden {
      display: none;
    }

    .name-card {
      width: 100%;
      max-width: 360px;
      background: #ffffff;
      border: 1px solid #e6ebf5;
      border-radius: 24px;
      padding: 22px;
      box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    }

    .name-card h3 {
      font-size: 22px;
      line-height: 1.2;
      margin-bottom: 8px;
      color: #111827;
    }

    .name-card p {
      font-size: 14px;
      line-height: 1.5;
      color: #64748b;
      margin-bottom: 16px;
    }

    .name-form {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .name-input {
      width: 100%;
      height: 48px;
      border-radius: 14px;
      border: 1px solid #dbe3f0;
      background: #f8fafc;
      padding: 0 14px;
      font-size: 15px;
      outline: none;
      color: #111827;
    }

    .name-input:focus {
      border-color: #1f67f2;
      background: #ffffff;
      box-shadow: 0 0 0 4px rgba(31, 103, 242, 0.10);
    }

    .name-submit {
      height: 48px;
      border: 0;
      border-radius: 14px;
      background: linear-gradient(180deg, #1f67f2 0%, #1557d6 100%);
      color: #fff;
      font-weight: 800;
      font-size: 15px;
      cursor: pointer;
      box-shadow: 0 10px 20px rgba(31, 103, 242, 0.18);
      transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
    }

    .name-submit:hover {
      filter: brightness(1.04);
      transform: translateY(-1px);
    }

    .name-submit:disabled {
      cursor: not-allowed;
      opacity: 0.7;
      transform: none;
      filter: none;
    }

    .name-error {
      min-height: 20px;
      font-size: 13px;
      color: var(--red);
    }

    .composer {
      padding: 14px 16px 12px;
      border-top: 1px solid #e7ebf5;
      background: rgba(255,255,255,0.92);
      flex-shrink: 0;
      position: relative;
      transition: opacity 0.18s ease;
    }

    .composer-box {
      min-height: 58px;
      background: #f7f8fc;
      border: 1px solid #dfe5f0;
      border-radius: 999px;
      display: flex;
      align-items: center;
      padding: 6px 6px 6px 16px;
      gap: 10px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
    }

    .composer-icon,
    .send-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      user-select: none;
    }

    .composer-icon {
      width: 40px;
      height: 40px;
      border-radius: 14px;
      border: 0;
      background: transparent;
      color: #475569;
      cursor: pointer;
      font-size: 18px;
      transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
    }

    .composer-icon svg {
      width: 20px;
      height: 20px;
      display: block;
      flex-shrink: 0;
    }

    .upload-image-input {
      display: none !important;
    }

    .composer-icon:hover {
      background: #e9eefb;
      color: #1f67f2;
      transform: scale(1.05);
    }

    .composer-icon:disabled {
      cursor: not-allowed;
      opacity: 0.45;
      transform: none;
      background: transparent;
      color: #64748b;
    }

    .emoji-btn.active {
      background: #e0ebff;
      color: #1f67f2;
    }

    .composer-input {
      flex: 1;
      min-width: 0;
      border: 0;
      outline: none;
      background: transparent;
      font-size: 15px;
      color: #111827;
      padding-right: 2px;
      resize: none;
      overflow-y: auto;
      min-height: 24px;
      max-height: 120px;
      line-height: 1.45;
      white-space: pre-wrap;
      word-break: break-word;
      font-family: inherit;
    }

    .composer-input::placeholder {
      color: #8b93a7;
    }

    .composer.disabled {
      opacity: 0.7;
      pointer-events: none;
    }

    .send-btn {
      width: 44px;
      height: 44px;
      border: 0;
      border-radius: 16px;
      background: linear-gradient(180deg, #1f67f2 0%, #1557d6 100%);
      color: #fff;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 10px 18px rgba(31, 103, 242, 0.22);
      transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    }

    .send-btn svg {
      width: 18px;
      height: 18px;
      display: block;
      transform: translateX(1px);
    }

    .send-btn:hover {
      transform: translateY(-1px);
      filter: brightness(1.04);
      box-shadow: 0 14px 24px rgba(31, 103, 242, 0.26);
    }

    .send-btn:active {
      transform: translateY(0);
    }

    .send-btn:disabled {
      cursor: not-allowed;
      opacity: 0.55;
      box-shadow: none;
      transform: none;
      filter: none;
    }

    .emoji-picker {
      position: absolute;
      right: 16px;
      bottom: 72px;
      width: min(280px, calc(100% - 32px));
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
      padding: 12px;
      background: #ffffff;
      border: 1px solid #dfe5f0;
      border-radius: 20px;
      box-shadow: 0 20px 36px rgba(15, 23, 42, 0.14);
      z-index: 20;
    }

    .emoji-item {
      width: 100%;
      aspect-ratio: 1 / 1;
      border: 0;
      border-radius: 12px;
      background: #f8fafc;
      font-size: 20px;
      cursor: pointer;
      transition: background 0.18s ease, transform 0.18s ease;
    }

    .emoji-item:hover {
      background: #eaf1ff;
      transform: scale(1.05);
    }

    .chat-footer {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-align: center;
      font-size: 12px;
      color: #6b7280;
      padding-top: 10px;
    }

    .chat-footer-fixed {
      flex-shrink: 0;
      padding: 10px 16px 12px;
      border-top: 1px solid #e7ebf5;
      background: rgba(255,255,255,0.95);
    }
    
    .chat-footer-logo {
      width: 14px;
      height: 14px;
      object-fit: contain;
      flex-shrink: 0;
    }

    .chat-footer strong {
      color: #111827;
      letter-spacing: 0.02em;
    }

    .chat-closed {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      padding: 14px 16px 12px;
      border-top: 1px solid #e7ebf5;
      background: rgba(255,255,255,0.95);
      flex-shrink: 0;
    }

    .chat-shell.closed .chat-closed {
      display: flex;
    }

    .chat-shell.closed .chat-top {
      pointer-events: auto;
      opacity: 1;
    }

    .chat-shell.closed .chat-body {
      pointer-events: auto;
      opacity: 1;
    }

    .chat-shell.closed .composer {
      display: none;
    }

    .chat-shell.closed.awaiting-name-reopen .chat-closed {
      display: none;
    }

    .chat-shell.closed.awaiting-name-reopen .chat-body {
      pointer-events: auto;
      opacity: 1;
    }

    .chat-shell.closed.awaiting-name-reopen .chat-top {
      pointer-events: auto;
      opacity: 1;
    }

    .chat-shell.closed.awaiting-name-reopen .composer {
      display: none;
    }

    .chat-closed-card {
      width: 100%;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }

    .chat-closed-icon {
      display: none;
    }

    .chat-closed-card h3 {
      display: none;
    }

    .chat-closed-card p {
      font-size: 13px;
      line-height: 1.5;
      color: #64748b;
      margin: 0;
    }

    .reopen-chat-btn {
      appearance: none;
      -webkit-appearance: none;
      width: 100%;
      min-height: 50px;
      border: 0;
      border-radius: 16px;
      background: linear-gradient(180deg, #2b72ff 0%, #1557d6 100%);
      color: #ffffff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 18px;
      font-size: 15px;
      font-weight: 800;
      line-height: 1;
      letter-spacing: 0.01em;
      cursor: pointer;
      box-shadow: 0 10px 20px rgba(31, 103, 242, 0.22);
      transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease,
        opacity 0.18s ease;
    }

    .reopen-chat-btn:hover {
      transform: translateY(-1px);
      filter: brightness(1.03);
      box-shadow: 0 14px 26px rgba(31, 103, 242, 0.28);
    }

    .reopen-chat-btn:active {
      transform: translateY(0);
      filter: brightness(0.99);
    }

    .reopen-chat-btn:focus-visible {
      outline: none;
      box-shadow:
        0 0 0 4px rgba(31, 103, 242, 0.14),
        0 10px 20px rgba(31, 103, 242, 0.22);
    }

    .reopen-chat-btn:disabled {
      cursor: not-allowed;
      opacity: 0.7;
      transform: none;
      filter: none;
      box-shadow: none;
    }

    @media (max-width: 1100px) {
      .layout {
        grid-template-columns: 1fr;
      }

      .hero {
        display: none;
      }

      .chat-side {
        padding: 20px;
        align-items: stretch;
      }

      .chat-shell {
        max-width: 100%;
        height: 100%;
        max-height: none;
      }
    }

    @media (max-width: 640px) {
      html,
      body {
        height: var(--app-dvh);
      }

      .chat-closed {
        padding: 12px 12px calc(12px + var(--safe-bottom));
      }

      body {
        padding: 0;
        background: #ffffff;
      }

      .page {
        width: 100%;
        min-height: var(--app-dvh);
        height: var(--app-dvh);
        border-radius: 0;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        background: #ffffff;
      }

      .layout {
        display: block;
        height: 100%;
        min-height: 0;
      }

      .topbar {
        min-height: 64px;
        padding:
          calc(10px + var(--safe-top))
          calc(12px + var(--safe-right))
          10px
          calc(12px + var(--safe-left));
      }

      .topbar-right {
        gap: 10px;
      }

      .topbar-text {
        display: none;
      }

      .brand-logo {
        height: 36px;
      }

      .chat-side {
        padding: 0;
        height: 100%;
        min-height: 0;
        background: #ffffff;
        align-items: stretch;
        justify-content: stretch;
      }

      .chat-shell {
        width: 100%;
        max-width: none;
        min-height: 0;
        height: 100%;
        max-height: none;
        margin: 0;
        border-radius: 0;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
      }

      .chat-top {
        padding: 12px 12px 10px;
      }

      .circle-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
      }

      .agent-card {
        padding: 10px 12px;
        border-radius: 16px;
        box-shadow: none;
      }

      .agent-name {
        font-size: 16px;
      }

      .chat-body {
        padding: 14px 12px;
      }

      .bubble {
        max-width: 88%;
      }

      .bubble.bubble-media {
        max-width: min(220px, 68vw);
      }

      .name-gate {
        padding: 16px 12px calc(16px + var(--safe-bottom));
      }

      .name-card {
        max-width: 100%;
        border-radius: 20px;
      }

      .composer {
        padding: 10px 12px calc(10px + var(--safe-bottom));
        background: rgba(255,255,255,0.98);
      }

      .composer-box {
        min-height: 52px;
        padding: 4px 4px 4px 12px;
        gap: 8px;
        border-radius: 18px;
      }

      .composer-icon {
        width: 38px;
        height: 38px;
      }

      .composer-input {
        font-size: 16px;
      }

      .send-btn {
        width: 42px;
        height: 42px;
        border-radius: 14px;
      }

      .emoji-picker {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: calc(72px + var(--safe-bottom));
      }
    }

    html.embed-mode,
    html.embed-mode body {
      width: 100%;
      min-height: var(--app-dvh);
      height: var(--app-dvh);
      overflow: hidden;
    }

    html.embed-mode body {
      padding: 0;
      background: #ffffff;
    }

    html.embed-mode .page {
      width: 100%;
      min-height: var(--app-dvh);
      height: var(--app-dvh);
      border-radius: 0;
      border: 0;
      box-shadow: none;
      backdrop-filter: none;
      background: #ffffff;
    }

    html.embed-mode .topbar,
    html.embed-mode .hero {
      display: none !important;
    }

    html.embed-mode .layout {
      display: block;
      height: 100%;
      min-height: 0;
      overflow: hidden;
    }

    html.embed-mode .chat-side {
      padding: 0;
      background: #ffffff;
      height: 100%;
      min-height: 0;
      align-items: stretch;
      justify-content: stretch;
    }

    html.embed-mode .chat-shell {
      width: 100%;
      max-width: none;
      min-height: 0;
      height: 100%;
      max-height: none;
      margin: 0;
      border-radius: 0;
      border: 0;
      box-shadow: none;
      backdrop-filter: none;
    }

    html.embed-mode .chat-top,
    html.embed-mode .chat-body,
    html.embed-mode .composer {
      border-radius: 0;
    }

    html.embed-mode .composer {
      padding-bottom: calc(12px + var(--safe-bottom));
    }

    html.embed-mode .chat-closed {
      padding-bottom: calc(14px + var(--safe-bottom));
    }

    html.embed-mode .chat-footer {
      display: none;
    }

    /* =========================================
      LOAD HISTORY HINT
      ========================================= */

    .load-history-hint {
      align-self: center;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(31, 103, 242, 0.14);
      background: rgba(255,255,255,0.92);
      color: #1f67f2;
      font-size: 12px;
      font-weight: 700;
      padding: 8px 14px;
      border-radius: 999px;
      cursor: pointer;
      margin: 0 auto 10px;
      transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
      box-shadow: 0 8px 20px rgba(31, 103, 242, 0.10);
    }

    .load-history-hint:hover {
      background: #ffffff;
      border-color: rgba(31, 103, 242, 0.24);
      transform: translateY(-1px);
    }

    .load-history-hint:disabled {
      opacity: 0.7;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }