:root {
  --bg-app: #060907;
  --bg-panel: #0a100d;
  --bg-surface: #101814;
  --bg-hover: #16221c;
  --border: #17241e;
  --border-light: #22352c;

  --cargo-green: #00b075;
  --cargo-green-bright: #10b981;
  --cargo-green-dark: #00875a;
  --cargo-green-soft: rgba(0, 176, 117, 0.14);
  --cargo-green-glow: rgba(0, 176, 117, 0.28);

  --jnt-red: #00b075;
  --jnt-red-hover: #009e69;
  --jnt-red-soft: rgba(0, 176, 117, 0.14);

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);

  --wa-green: #00b075;
  --wa-bubble-in: #101814;
  --wa-bubble-out: #09261a;
  --wa-bubble-draft: rgba(0, 176, 117, 0.08);

  --text-primary: #f2f7f4;
  --text-secondary: #94a39b;
  --text-dim: #5c6e64;

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* 1. Left Icon Rail */
.icon-rail {
  width: 64px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  flex-shrink: 0;
  z-index: 30;
}

.rail-brand {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #00b075, #00875a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  box-shadow: 0 4px 14px var(--cargo-green-glow);
  margin-bottom: 24px;
  user-select: none;
}

.rail-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
  flex: 1;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
  outline: none;
}

.rail-btn:focus-visible {
  outline: 2px solid var(--jnt-red);
}

.rail-btn svg.icon {
  width: 20px;
  height: 20px;
}

.rail-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rail-btn.active {
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
}

.rail-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--jnt-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* 2. Workspace & Tab Panes */
.workspace {
  flex: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none !important;
  width: 100%;
  height: 100%;
}

.tab-pane.active {
  display: flex !important;
}

/* Tab Split Workspace for Inbox */
.split-workspace {
  width: 100%;
  height: 100%;
}

/* 3. Left Column: Chat List Pane (380px) */
.list-pane {
  width: 380px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  transition: width 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  overflow: hidden;
}

.list-pane.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.list-pane .list-header,
.list-pane .filter-chips,
.list-pane .chat-list {
  width: 380px;
}

.list-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hub-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.branch-tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 176, 117, 0.3);
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--cargo-green-bright);
  padding: 5px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11.5px;
  font-weight: 600;
}

.sound-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--cargo-green);
}

.sound-toggle-btn.muted {
  color: var(--text-dim);
  border-color: var(--border);
  opacity: 0.7;
}

.sound-toggle-btn.muted:hover {
  opacity: 1;
  color: var(--text-secondary);
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 168, 132, 0.12);
  border: 1px solid rgba(0, 168, 132, 0.3);
  padding: 3px 8px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  color: #25d366;
}

.live-status-pill.status-disconnected {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #f87171;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.mode-label {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}

.mode-btn-group {
  display: flex;
  background: #0b141a;
  border-radius: 6px;
  padding: 2px;
  border: 1px solid var(--border);
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab.active {
  background: var(--jnt-red);
  color: #fff;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  background: #0c1317;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--border-light);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}

.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip-btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.chip-btn.active {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border-light);
}

.chip-badge {
  background: #374751;
  color: #fff;
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 8px;
}

.chip-badge.alert {
  background: var(--jnt-red);
  color: #fff;
}

/* Chat Item List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-gutter: stable;
}

.chat-list::-webkit-scrollbar,
.chat-stream::-webkit-scrollbar,
.page-container::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-stream::-webkit-scrollbar-thumb,
.page-container::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.chat-list::-webkit-scrollbar-track,
.chat-stream::-webkit-scrollbar-track,
.page-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.chat-item:hover {
  background: var(--bg-surface);
}

.chat-item.active {
  background: linear-gradient(90deg, rgba(0, 176, 117, 0.12), transparent);
  border-left: 3px solid var(--cargo-green-bright);
}

.chat-item.needs-action {
  background: rgba(245, 158, 11, 0.04);
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #233138;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chat-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 11px;
  color: var(--text-dim);
}

.chat-snippet {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.chat-snippet span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.status-mini-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.mini-pending {
  background: var(--amber-soft);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mini-sent {
  color: #25d366;
  background: rgba(37, 211, 102, 0.1);
}

.mini-rejected {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* 4. Center/Right Column: Detail Pane (Active Chat) */
.detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
}

.placeholder-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  stroke: var(--text-dim);
}

.placeholder-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.placeholder-sub {
  font-size: 13px;
  max-width: 320px;
  line-height: 1.5;
}

.chat-active-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  height: 60px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toggle-queue-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toggle-queue-btn:hover {
  background: var(--bg-hover);
  color: var(--cargo-green-bright);
  border-color: var(--cargo-green);
}

.toggle-queue-btn.active {
  color: var(--cargo-green-bright);
  border-color: var(--cargo-green);
  background: var(--cargo-green-soft);
}

.btn-back-mobile {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.btn-back-mobile:hover {
  background: var(--bg-hover);
  color: #fff;
}

.contact-title-group {
  min-width: 0;
}

.contact-title-group h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#header-phone {
  white-space: nowrap;
}

.contact-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  border: 1px solid rgba(0, 176, 117, 0.3);
  white-space: nowrap;
}

.contact-meta {
  font-size: 11.5px;
  color: var(--text-dim);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#btn-sound-toggle-chat {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.header-btn:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border);
}

@media (max-width: 1360px) {
  .contact-tag {
    display: none !important;
  }
}

/* Pending Approval Alert Banner */
.approval-alert-banner {
  background: linear-gradient(90deg, rgba(0, 176, 117, 0.14), rgba(0, 176, 117, 0.04));
  border-bottom: 1px solid rgba(0, 176, 117, 0.25);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-primary);
}

.banner-icon {
  color: var(--cargo-green-bright);
  flex-shrink: 0;
}

.banner-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-approve-banner {
  background: var(--cargo-green);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px var(--cargo-green-glow);
  transition: background 0.15s;
}

.btn-approve-banner:hover {
  background: var(--cargo-green-bright);
}

.btn-reject-banner {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-reject-banner:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Chat Messages Stream */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 32px 20px;
  scroll-padding-bottom: 32px;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: 
    radial-gradient(circle at 80% 20%, rgba(0, 176, 117, 0.04), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(0, 135, 90, 0.03), transparent 50%),
    var(--bg-app);
}

.stream-date-divider {
  align-self: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  margin: 4px 0;
}

.bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  min-width: unset;
  width: fit-content;
  margin-bottom: 2px;
}

.bubble-wrapper.inbound {
  align-self: flex-start;
}

.bubble-wrapper.outbound {
  align-self: flex-end;
}

.bubble-card {
  padding: 6px 9px 5px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.35;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  white-space: normal;
  width: fit-content;
  max-width: 100%;
}

.bubble-content {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 2px 7px;
}

.bubble-text {
  flex: 1 1 auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  padding-bottom: 1px;
}

.bubble-wrapper.outbound .bubble-meta-inline {
  color: rgba(209, 250, 229, 0.7);
}

.bubble-wrapper.inbound .bubble-card {
  background: var(--wa-bubble-in);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-top-left-radius: 2px;
}

.bubble-wrapper.outbound .bubble-card {
  background: var(--wa-bubble-out);
  color: #d1fae5;
  border: 1px solid rgba(0, 176, 117, 0.35);
  border-top-right-radius: 2px;
}

.bubble-wrapper.draft {
  align-self: flex-end;
  max-width: 85%;
  margin-top: 6px;
}

.bubble-card.draft-accordion {
  background: rgba(0, 176, 117, 0.06);
  border: 1px dashed rgba(0, 176, 117, 0.45);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: normal;
}

.bubble-card.draft-accordion:hover {
  background: rgba(0, 176, 117, 0.12);
  border-color: var(--cargo-green-bright);
}

.draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.draft-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cargo-green-bright);
}

.draft-toggle-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 500;
}

.draft-accordion:not(.expanded) .draft-toggle-hint::after {
  content: 'Lihat draf ▾';
}

.draft-accordion.expanded .draft-toggle-hint::after {
  content: 'Tutup ▴';
}

.draft-body {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 176, 117, 0.25);
  font-size: 12px;
  line-height: 1.45;
  color: #d1fae5;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  cursor: text;
}

.draft-accordion.expanded .draft-body {
  display: block;
}

.bubble-sender-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.bubble-wrapper.outbound .bubble-sender-label {
  color: #4ade80;
}

.bubble-meta-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-dim);
}

.bubble-wrapper.outbound .bubble-meta-row {
  color: rgba(255, 255, 255, 0.7);
}

.template-box {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--cargo-green);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  margin-top: 4px;
  font-size: 12px;
  white-space: pre-wrap;
  font-family: inherit;
}

/* 1-Click Resi Tracker Card */
.resi-tracker-card {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 176, 117, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resi-tracker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.resi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cargo-green-bright);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.resi-num {
  font-family: monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  background: rgba(0, 176, 117, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 176, 117, 0.25);
}

.resi-tracker-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resi-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: 1px solid transparent;
}

.resi-btn-copy {
  background: var(--bg-surface);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.resi-btn-copy:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border);
}

.resi-btn-copy.copied {
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  border-color: var(--cargo-green);
}

.resi-btn-track {
  background: linear-gradient(135deg, #00b075, #00875a);
  color: #fff;
  box-shadow: 0 2px 8px var(--cargo-green-glow);
}

.resi-btn-track:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Chat Input Bar */
.chat-input-bar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.quick-templates-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-templates-strip::-webkit-scrollbar { display: none; }

.qt-label {
  font-size: 11px;
  color: var(--text-dim);
  align-self: center;
  margin-right: 4px;
}

.qt-pill {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.qt-pill:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border-light);
}

.input-compose-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.compose-textarea {
  flex: 1;
  height: 48px;
  min-height: 48px;
  max-height: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

.compose-textarea:focus {
  border-color: var(--cargo-green-bright);
}

.btn-send {
  height: 48px;
  padding: 0 18px;
  background: linear-gradient(135deg, #00b075, #00875a);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px var(--cargo-green-glow);
  transition: opacity 0.15s;
}

.btn-send:hover {
  opacity: 0.9;
}

/* 5. Right Column: Info Pane (Desktop > 1200px) */
.info-pane {
  width: 290px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 16px;
  flex-shrink: 0;
}

.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card.info-danger {
  border-color: rgba(227, 6, 19, 0.25);
}

.info-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.stat-metric {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}

.stat-metric span {
  color: var(--text-secondary);
}

.stat-metric strong {
  color: #fff;
}

.info-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 6. Pages (Contacts, Settings, Health) */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1000px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

/* TAB 2 & 3 REDESIGN: Logistics Directory & Emerald Settings */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.contacts-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-refresh-contacts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.contacts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.contacts-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  flex: 1;
  max-width: 420px;
  transition: border-color 0.15s;
}

.contacts-search-box:focus-within {
  border-color: var(--cargo-green);
  box-shadow: 0 0 0 2px rgba(0, 176, 117, 0.15);
}

.contacts-search-box svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.contacts-search-box input {
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.contacts-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.contacts-stat-pill strong {
  color: var(--cargo-green-bright);
  font-weight: 700;
}

.contacts-table-container {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.contacts-table th {
  padding: 12px 16px;
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.contacts-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.contacts-table tr:last-child td {
  border-bottom: none;
}

.contacts-table tr:hover td {
  background: rgba(0, 176, 117, 0.03);
}

.contact-cell-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-cell-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 176, 117, 0.2), rgba(0, 176, 117, 0.05));
  border: 1px solid rgba(0, 176, 117, 0.3);
  color: var(--cargo-green-bright);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-phone-primary {
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  display: block;
}

.contact-phone-primary:hover {
  color: var(--cargo-green-bright);
  text-decoration: underline;
}

.contact-tag-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  border: 1px solid rgba(0, 176, 117, 0.25);
  margin-top: 2px;
  white-space: nowrap;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.count-badge.inbound {
  background: rgba(0, 176, 117, 0.08);
  color: #a7f3d0;
  border: 1px solid rgba(0, 176, 117, 0.22);
}

.count-badge.outbound {
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  border: 1px solid rgba(0, 176, 117, 0.3);
}

.table-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.contact-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-table-action {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
}

.btn-table-action:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border-light);
}

.btn-table-action.primary {
  background: var(--cargo-green-soft);
  border-color: rgba(0, 176, 117, 0.35);
  color: var(--cargo-green-bright);
}

.btn-table-action.primary:hover {
  background: var(--cargo-green);
  color: #fff;
}

/* Settings Sections */
.settings-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 20px;
}

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.settings-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.settings-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.save-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--cargo-green-bright);
  background: var(--cargo-green-soft);
  border: 1px solid rgba(0, 176, 117, 0.25);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.mode-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.mode-card-item {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.mode-card-item:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.mode-card-item.active {
  border-color: var(--cargo-green);
  background: linear-gradient(180deg, rgba(0, 176, 117, 0.12) 0%, rgba(0, 176, 117, 0.03) 100%);
  box-shadow: 0 4px 16px rgba(0, 176, 117, 0.15);
}

.mode-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mode-badge-rec {
  font-size: 10.5px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
}

.mode-badge-normal {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
}

.mode-active-pill {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cargo-green-bright);
}

.mode-card-item.active .mode-active-pill {
  display: flex;
}

.mode-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mode-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mode-card-item.active .mode-icon-box {
  background: var(--cargo-green-soft);
  border-color: rgba(0, 176, 117, 0.3);
  color: var(--cargo-green-bright);
}

.mode-title-row h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.mode-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Skiplist Styles */
.skiplist-form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.skiplist-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  flex: 1;
  transition: border-color 0.15s;
}

.skiplist-input-wrapper:focus-within {
  border-color: var(--cargo-green);
  box-shadow: 0 0 0 2px rgba(0, 176, 117, 0.15);
}

.skiplist-input-wrapper svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.skiplist-input-wrapper input {
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.skiplist-table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.skiplist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.skiplist-table th {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.skiplist-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.skiplist-table tr:last-child td {
  border-bottom: none;
}

.badge-skiplist-filter {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-skiplist-delete {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-skiplist-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fff;
}

/* Templates Preview */
.template-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.template-preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.template-card-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--cargo-green-bright);
  background: var(--cargo-green-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.template-card-content {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  white-space: pre-wrap;
  font-family: monospace;
  background: var(--bg-app);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.quick-templates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qt-row {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  background: var(--bg-app);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.qt-row strong {
  color: #fff;
  display: inline-block;
  margin-right: 4px;
}

/* Health Stats & Diagnostics */
.health-hero-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(17, 27, 33, 0.8) 100%);
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 24px;
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-health 2s infinite;
}

.hero-pulse-dot.disconnected {
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse-health {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.hero-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-card-accent-emerald::before { background: #22c55e; }
.stat-card-accent-amber::before { background: #f59e0b; }
.stat-card-accent-cyan::before { background: #38bdf8; }
.stat-card-accent-purple::before { background: #a855f7; }
.stat-card-accent-indigo::before { background: #818cf8; }
.stat-card-accent-teal::before { background: #14b8a6; }
.stat-card-accent-rose::before { background: #f43f5e; }

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon-pill {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-emerald { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.icon-amber { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.icon-cyan { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.icon-purple { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.icon-indigo { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.icon-teal { background: rgba(20, 184, 166, 0.12); color: #2dd4bf; }
.icon-rose { background: rgba(244, 63, 94, 0.12); color: #f43f5e; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.text-emerald { color: #4ade80; }
.text-amber { color: #fbbf24; }
.text-cyan { color: #38bdf8; }
.text-purple { color: #c084fc; }
.text-indigo { color: #a5b4fc; }
.text-teal { color: #2dd4bf; }
.text-rose { color: #fb7185; }

.stat-subtext {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Diagnostics & Infra Section */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.diag-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.diag-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.diag-label {
  color: var(--text-secondary);
}

.diag-val {
  color: #fff;
  font-weight: 500;
}

.diag-val code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11.5px;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-tag-online {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

/* Deleted Message Bubble Notice */
.revoked-notice-row {
  display: flex;
  margin: 3px 0;
}

.revoked-notice-row.right {
  justify-content: flex-end;
}

.revoked-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-dim);
}

.revoked-chip svg {
  stroke: var(--text-dim);
  opacity: 0.7;
}

.revoked-time {
  font-size: 10px;
  font-style: normal;
  opacity: 0.6;
  margin-left: 2px;
}

.bubble-deleted-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-dim);
}

.bubble-deleted-notice svg {
  flex-shrink: 0;
  stroke: #ef4444;
}

.bubble-wrapper.deleted-msg .bubble-card {
  border: 1px dashed rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.04);
}

/* Generic Button Utilities */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--jnt-red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--jnt-red-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: #fff;
}

.btn-full {
  width: 100%;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #202c33;
  border: 1px solid #374751;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  transition: all 0.2s ease;
}

/* Login Page Styles (Retained for login.html) */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-app);
  padding: 16px;
}

.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.input-row {
  margin-bottom: 12px;
}

.input-row input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}

.input-row input:focus {
  border-color: var(--cargo-green-bright);
}

/* Bot Account Card & Pairing Module */
.bot-account-card {
  border-left: 3px solid var(--cargo-green);
}

.bot-account-info-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bot-account-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.bot-account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--cargo-green-soft);
  border: 1px solid rgba(0, 176, 117, 0.3);
  color: var(--cargo-green-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bot-account-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.bot-account-val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}

.bot-account-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--cargo-green-soft);
  color: var(--cargo-green-bright);
  border: 1px solid rgba(0, 176, 117, 0.25);
  margin-left: auto;
}

.bot-account-status-pill.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.bot-account-status-pill.disconnected .pulse-dot {
  background: #f87171;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.bot-account-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}

/* Modal Backdrop & Card */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 176, 117, 0.2);
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--cargo-green-soft);
  border: 1px solid rgba(0, 176, 117, 0.3);
  color: var(--cargo-green-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title-box h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.modal-title-box p {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.btn-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 20px;
}

.pair-step.hidden {
  display: none;
}

.pair-security-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #fcd34d;
  margin-bottom: 16px;
}

.pair-security-notice svg {
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 1px;
}

.pair-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pair-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pair-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pair-input-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.pair-input-box:focus-within {
  border-color: var(--cargo-green);
  box-shadow: 0 0 0 2px rgba(0, 176, 117, 0.15);
}

.pair-input-prefix {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--cargo-green-bright);
  font-weight: 700;
  font-size: 13px;
  border-right: 1px solid var(--border);
  user-select: none;
}

.pair-input-box input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
  font-family: monospace;
}

.pair-text-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.pair-text-input:focus {
  border-color: var(--cargo-green);
  box-shadow: 0 0 0 2px rgba(0, 176, 117, 0.15);
}

.pair-input-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-pair-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  margin-top: 4px;
  font-size: 13px;
  cursor: pointer;
}

/* Step 2 Code Box */
.pair-waiting-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--cargo-green-soft);
  border: 1px solid rgba(0, 176, 117, 0.25);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  color: var(--cargo-green-bright);
  font-weight: 600;
  margin-bottom: 16px;
}

.pairing-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.pairing-code-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 8px;
}

.pairing-code-box {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 4px;
  font-family: monospace;
  background: var(--bg-surface);
  border: 2px dashed var(--cargo-green);
  border-radius: 8px;
  padding: 10px 24px;
  margin-bottom: 12px;
  user-select: all;
  box-shadow: 0 0 20px rgba(0, 176, 117, 0.15);
}

.btn-copy-code {
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
}

.pairing-instructions {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.pairing-instructions h4 {
  font-size: 12.5px;
  color: #fff;
  font-weight: 700;
  margin-bottom: 8px;
}

.pairing-instructions ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.pairing-instructions strong {
  color: #fff;
}

/* Step 3 Success */
.pair-success-box {
  text-align: center;
  padding: 30px 16px;
}

.pair-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cargo-green-soft);
  border: 2px solid var(--cargo-green);
  color: var(--cargo-green-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 24px rgba(0, 176, 117, 0.3);
}

.pair-success-box h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.pair-success-box p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .info-pane {
    display: none;
  }
}

@media (max-width: 820px) {
  body {
    flex-direction: column-reverse;
  }

  .icon-rail {
    width: 100%;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    padding: 0 16px env(safe-area-inset-bottom, 0px) 16px;
    border-right: none;
    border-top: 1px solid var(--border);
    justify-content: space-around;
    background: var(--bg-panel);
    z-index: 50;
    flex-shrink: 0;
  }

  .rail-brand {
    display: none;
  }

  .rail-menu {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }

  .rail-bottom {
    display: none;
  }

  .workspace {
    height: calc(100dvh - 52px - env(safe-area-inset-bottom, 0px));
    height: calc(100vh - 52px - env(safe-area-inset-bottom, 0px));
  }

  .list-pane {
    width: 100%;
    display: flex;
  }

  .detail-pane {
    display: none;
    width: 100%;
  }

  body.mobile-view-chat .list-pane {
    display: none;
  }

  body.mobile-view-chat .detail-pane {
    display: flex;
  }

  .toggle-queue-btn {
    display: none !important;
  }

  .contact-tag {
    display: none !important;
  }

  .chat-header {
    height: 52px;
    padding: 0 10px;
  }

  .chat-header-left {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .btn-back-mobile {
    display: inline-flex;
    padding: 4px;
    margin-right: -2px;
  }

  .chat-header-actions {
    flex-shrink: 0;
    gap: 4px;
  }

  .header-btn {
    padding: 6px 8px;
  }

  .header-btn span {
    display: none;
  }

  .contact-title-group {
    min-width: 0;
    flex: 1;
  }

  .contact-title-group h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .contact-title-group h2 #header-phone {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
  }

  .contact-meta {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-input-area {
    padding: 8px 10px;
  }

  .compose-textarea {
    height: 42px;
    min-height: 42px;
    font-size: 13px;
    padding: 9px 12px;
  }

  .btn-send {
    height: 42px;
    padding: 0 14px;
  }

  .quick-templates-strip {
    padding: 4px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .quick-templates-strip::-webkit-scrollbar {
    display: none;
  }

  .quick-templates-strip::after {
    content: '';
    display: inline-block;
    width: 20px;
    flex-shrink: 0;
  }

  .bubble-wrapper {
    max-width: 90%;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
