/* WhatsApp Web Theme - RabindraLabs */
:root {
  --bg-app: #d1d7db;
  --top-bar: #00a884;
  --panel: #ffffff;
  --panel-hover: #f5f6f6;
  --panel-active: #ebebeb;
  --line: #e9edef;
  --text: #111b21;
  --muted: #667781;
  --accent: #00a884;
  --accent-hover: #029070;
  --accent-ink: #ffffff;
  --in: #ffffff;
  --out: #d9fdd3;
  --badge-green: #25d366;
  --tick-read: #53bdeb;
  --tick-gray: #8696a0;
  --err: #ea0038;
  --pill-bg: rgba(255, 255, 255, 0.95);
  --pill-border: rgba(11, 20, 26, 0.08);
  --pill-warn-bg: #fff8e5;
  --pill-warn-text: #855b00;
  --input-bg: #f0f2f5;
  --chat-bg: #efeae2;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --header-bg: #f0f2f5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #0c1317;
    --top-bar: #202c33;
    --panel: #111b21;
    --panel-hover: #202c33;
    --panel-active: #2a3942;
    --line: #222d34;
    --text: #e9edef;
    --muted: #8696a0;
    --accent: #00a884;
    --accent-hover: #029070;
    --accent-ink: #111b21;
    --in: #202c33;
    --out: #005c4b;
    --badge-green: #00a884;
    --tick-read: #53bdeb;
    --tick-gray: #8696a0;
    --err: #f15c6d;
    --pill-bg: rgba(24, 34, 41, 0.92);
    --pill-border: rgba(233, 237, 239, 0.08);
    --pill-warn-bg: #2d2616;
    --pill-warn-text: #ffd279;
    --input-bg: #2a3942;
    --chat-bg: #0b141a;
    --shadow: 0 1px 0.5px rgba(0, 0, 0, 0.35);
    --header-bg: #202c33;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 var(--font);
  background: var(--bg-app);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Top Banner (Iconic WhatsApp Web green band) */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 127px;
  background: var(--top-bar);
  z-index: 0;
}

button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.strong { font-weight: 500; }

/* ---------------- SIGN IN SCREEN ---------------- */
.login {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  width: min(400px, 100%);
  display: grid;
  gap: 16px;
  box-shadow: 0 17px 50px 0 rgba(11,20,26,.19), 0 12px 15px 0 rgba(11,20,26,.24);
}
.brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}
.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.card label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.card input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

/* ---------------- APP MAIN LAYOUT ---------------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(11,20,26,.08);
}
@media (min-width: 1441px) {
  .app {
    height: calc(100% - 38px);
    margin: 19px auto;
    border-radius: 4px;
    overflow: hidden;
  }
}

/* ---------------- SIDEBAR ---------------- */
.side {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}
.side-header {
  padding: 10px 16px;
  background: var(--header-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  border-bottom: 1px solid var(--line);
}
.side-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
}
.side-header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search bar under header */
.search-wrapper {
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
}
.search-box svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: none;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13.5px;
  color: var(--text);
}
.search-box input::placeholder {
  color: var(--muted);
}

/* Conversation list */
.list {
  overflow-y: auto;
  flex: 1;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

.conv {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid rgba(134, 150, 160, 0.12);
  transition: background-color .12s ease;
  position: relative;
}
.conv:hover {
  background: var(--panel-hover);
}
.conv.active {
  background: var(--panel-active);
}
.conv-av {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  background: #dfe5e7;
  color: #54656f;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 18px;
  flex: none;
  user-select: none;
}
@media (prefers-color-scheme: dark) {
  .conv-av { background: #374248; color: #aebac1; }
}
.conv .meta {
  min-width: 0;
  flex: 1;
}
.conv .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}
.conv .name {
  font-weight: 500;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv .time {
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.conv.active .time, .conv:hover .time {
  color: var(--muted);
}
.conv .last {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.conv .last span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  background: var(--badge-green);
  color: #ffffff;
  border-radius: 12px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  min-width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  flex: none;
}

/* Sidebar Footer (User profile & controls) */
.me {
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.me .who {
  display: flex;
  flex-direction: column;
}
.me .who strong {
  font-size: 14px;
  color: var(--text);
  line-height: 1.2;
}
.me .who span {
  font-size: 12px;
  text-transform: capitalize;
}
.me .menu {
  display: flex;
  gap: 6px;
}

/* ---------------- CHAT PANEL ---------------- */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--chat-bg);
  position: relative;
}

/* WhatsApp subtle pattern background */
.chat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(0,0,0,0.04) 1px, transparent 0);
  background-size: 16px 16px;
  opacity: 0.7;
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  .chat::before {
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 0);
  }
}

.chat-header {
  position: relative;
  z-index: 2;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  height: 60px;
}
.chat-header-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe5e7;
  color: #54656f;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 15px;
  flex: none;
}
@media (prefers-color-scheme: dark) {
  .chat-header-av { background: #374248; color: #aebac1; }
}
.chat-header .title {
  flex: 1;
  min-width: 0;
}
.chat-header #chatName {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-header .sub .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #25d366;
  display: inline-block;
}

/* Messages container */
.msgs {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 16px 5% 16px 5%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msgs::-webkit-scrollbar { width: 6px; }
.msgs::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* System Window / Security Pill Badge */
.system-pill {
  align-self: center;
  background: var(--pill-bg);
  color: var(--muted);
  border: 1px solid var(--pill-border);
  box-shadow: 0 1px 1px rgba(11,20,26,.05);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  margin: 8px auto 12px;
  text-align: center;
  max-width: 90%;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.system-pill.warn {
  background: var(--pill-warn-bg);
  color: var(--pill-warn-text);
  border-color: rgba(255, 174, 0, 0.25);
}
.system-pill svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex: none;
}

/* WhatsApp Message Bubbles */
.bubble {
  max-width: min(72%, 600px);
  padding: 6px 9px 8px 10px;
  border-radius: 7.5px;
  background: var(--in);
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow);
  position: relative;
  margin-bottom: 2px;
  font-size: 14.2px;
  line-height: 19px;
  color: var(--text);
}
.bubble.in {
  align-self: flex-start;
  border-top-left-radius: 0;
}
.bubble.out {
  align-self: flex-end;
  background: var(--out);
  border-top-right-radius: 0;
}
.bubble .foot {
  float: right;
  margin: 3px 0 -4px 10px;
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  user-select: none;
  white-space: nowrap;
}
.bubble .agent-tag {
  color: var(--muted);
  font-style: italic;
  font-size: 10.5px;
}
.bubble .tick {
  display: inline-flex;
  align-items: center;
}
.bubble .tick svg {
  width: 16px;
  height: 11px;
  fill: var(--tick-gray);
}
.bubble .tick.read svg {
  fill: var(--tick-read);
}
.bubble .err {
  color: var(--err);
  font-size: 12px;
  margin-top: 4px;
  clear: both;
}
.bubble img, .bubble video {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin-bottom: 6px;
}
.bubble audio { max-width: 100%; }
.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  padding: 32px 16px;
  font-size: 14px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 320px;
}

/* ---------------- COMPOSER ---------------- */
.composer {
  position: relative;
  z-index: 2;
  background: var(--header-bg);
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}
.composer .tpl {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  max-height: 400px;
  overflow-y: auto;
}
.tpl-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.composer .tpl select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  width: 100%;
  font-size: 13.5px;
  outline: none;
  color: var(--text);
  font-weight: 500;
}
.composer .tpl select:focus {
  border-color: var(--accent);
}
.composer .tpl .two {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}
.composer .tpl input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  width: 100%;
  font-size: 13.5px;
  outline: none;
  color: var(--text);
}
.composer .tpl input:focus {
  border-color: var(--accent);
}
.tpl-fields-grid {
  display: grid;
  gap: 8px;
}
.tpl-field {
  display: grid;
  gap: 3px;
}
.tpl-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.tpl-preview {
  background: var(--chat-bg);
  border: 1px dashed rgba(0, 168, 132, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  display: none;
}
.tpl-preview:not(:empty) {
  display: block;
}

.btn-attach {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background-color .15s ease, color .15s ease;
}
.btn-attach:hover {
  background: var(--panel-hover);
  color: var(--text);
}
.btn-attach.active {
  color: var(--accent);
  background: rgba(0, 168, 132, 0.12);
}
.btn-attach svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.media-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.media-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.media-box-body {
  display: grid;
  gap: 8px;
}
.media-box-body .two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.media-box-body input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  width: 100%;
  font-size: 13px;
  outline: none;
  color: var(--text);
}
.media-box-body input:focus {
  border-color: var(--accent);
}

.composer .row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.composer .input-wrap {
  flex: 1;
  background: var(--panel);
  border-radius: 24px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 1.5px rgba(11,20,26,.08);
  border: 1px solid var(--line);
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  border: none;
  background: transparent;
  outline: none;
  padding: 4px 0;
  font-size: 14.5px;
  line-height: 20px;
  color: var(--text);
  overflow-y: auto;
}
.composer textarea::placeholder {
  color: var(--muted);
}
.composer textarea:disabled {
  opacity: 0.6;
}

/* WhatsApp Circular Send Button */
.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  box-shadow: 0 2px 5px rgba(0, 168, 132, 0.3);
  transition: transform .15s ease, background-color .15s ease;
}
.btn-send:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}
.btn-send:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.btn-send svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  margin-left: 2px;
}

/* Template Toggle Button */
.btn-tpl {
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all .15s ease;
  flex: none;
}
.btn-tpl:hover {
  background: var(--panel-hover);
  color: var(--text);
}
.btn-tpl.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-tpl svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---------------- BUTTONS & CONTROLS ---------------- */
.btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 500;
}
.btn.ghost:hover { background: var(--panel-hover); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: default; }

.notice { font-size: 12.5px; color: var(--muted); }
.notice.warn { color: var(--err); }

/* ---------------- DIALOGS ---------------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  width: min(420px, 94vw);
  box-shadow: 0 17px 50px 0 rgba(11,20,26,.19);
}
dialog.wide { width: min(780px, 95vw); }
dialog::backdrop {
  background: rgba(11, 20, 26, 0.6);
  backdrop-filter: blur(4px);
}
dialog h2 { margin-bottom: 12px; font-size: 17px; font-weight: 600; }
dialog h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; }
dialog input, dialog select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  width: 100%;
  margin-bottom: 12px;
  font-size: 13.5px;
  outline: none;
}
dialog input:focus, dialog select:focus {
  border-color: var(--accent);
}
dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs .btn { flex: 1; text-align: center; }

.dialog-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.dialog-logo { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: none; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .off { opacity: .55; }
.tbl select { width: auto; margin: 0; padding: 5px 8px; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; }
.grid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr 100px auto; gap: 8px; align-items: start; }
.grid input, .grid select { margin: 0; }
.auditlist { max-height: 380px; overflow-y: auto; font-size: 12.5px; }
.auditlist div {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 140px 110px 1fr;
  gap: 8px;
}

/* ---------------- RESPONSIVE (MOBILE) ---------------- */
.back { display: none; }
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }
  body::before { display: none; }
  .chat { display: none; }
  .app.in-chat .side { display: none; }
  .app.in-chat .chat { display: flex; }
  .back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
  }
  .bubble { max-width: 86%; }
  .grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- DOCUMENT & MEDIA CARDS ---------------- */
.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 2px 0 4px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  min-width: 250px;
  max-width: 380px;
  user-select: none;
}
.bubble.out .doc-card {
  background: rgba(0, 0, 0, 0.06);
}
.bubble.out .doc-card:hover {
  background: rgba(0, 0, 0, 0.10);
}
.bubble.in .doc-card {
  background: rgba(0, 0, 0, 0.04);
}
.bubble.in .doc-card:hover {
  background: rgba(0, 0, 0, 0.08);
}

.doc-icon-wrap {
  width: 40px;
  height: 46px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  position: relative;
}
.doc-type-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-transform: uppercase;
  margin-top: 1px;
}

.doc-content {
  flex: 1;
  min-width: 0;
}
.doc-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.doc-sub {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.doc-dot { opacity: 0.6; }
.doc-view-hint {
  color: var(--accent);
  font-weight: 500;
}

.doc-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
  flex: none;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.doc-action-btn:hover {
  background: var(--accent);
  color: #fff;
}

.doc-caption {
  font-size: 13.5px;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.4;
  word-break: break-word;
}

/* Inline Images */
.bubble-img-wrap {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
}
.bubble-img {
  display: block;
  max-width: 320px;
  max-height: 300px;
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}
.bubble-img:hover {
  opacity: 0.95;
}

/* Document Preview Dialog */
.doc-dialog {
  width: min(920px, 94vw);
  height: min(85vh, 750px);
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-bg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.doc-dialog[open] {
  display: flex;
  flex-direction: column;
}
.doc-dialog-header {
  padding: 12px 18px;
  background: var(--side-header-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.doc-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
}
#docDlgFilename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-dialog-badge {
  background: #ea4335;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.doc-dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.doc-dialog-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.doc-dialog-body {
  flex: 1;
  background: #525659;
  position: relative;
  overflow: hidden;
}
#docDlgIframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #525659;
}
