:root {
  --bg: #eef5f8;
  --surface: #ffffff;
  --text: #2a3642;
  --text-secondary: #5c6d7a;
  --accent: #3d9cad;
  --accent-hover: #328893;
  --accent-soft: rgba(61, 156, 173, 0.14);
  --border: rgba(45, 90, 110, 0.1);
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(45, 90, 110, 0.08);
  --bip-bg-image: url('/illustrations/bg-logistics-mix.png');
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; }
body {
  font-family: 'Comfortaa', sans-serif;
  background: transparent;
  min-height: 100vh;
  padding: 16px;
  color: var(--text);
  position: relative;
  -webkit-text-size-adjust: 100%;
}

.bip-page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #e8f2f6;
  background-image: var(--bip-bg-image);
  background-size: cover;
  background-position: center;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.card {
  background: rgba(255,255,255,0.88);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
}

h1 { font-size: 22px; margin-bottom: 6px; }
h2 { font-size: 17px; margin-bottom: 12px; }

.sub,
.hint,
.cc-hint {
  font-size: 13px;
  color: #5d6d7e;
  line-height: 1.5;
  margin-bottom: 14px;
}

label,
.cc-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

select,
input[type="text"],
input[type="password"],
textarea,
.cc-field input,
.cc-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  color: #2c3e50;
}

.cc-field { margin-bottom: 14px; }

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  border: 2px solid #d5dce3;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5c6a;
  cursor: pointer;
  user-select: none;
}

.remember-me input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.btn,
.cc-btn.block {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #27ae60;
  color: #fff;
}

.btn:hover,
.cc-btn.block:hover { filter: brightness(1.03); }
.btn:disabled,
.cc-btn:disabled { opacity: 0.6; cursor: wait; }

.btn-outline,
.cc-btn.secondary {
  background: #fff;
  color: var(--accent);
  border: 2px solid var(--accent);
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.msg,
.cc-msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  display: none;
}

.msg.ok,
.cc-msg.ok { display: block; background: #d5f5e3; color: #1e6f43; }
.msg.err,
.cc-msg.err { display: block; background: #fdecea; color: #922b21; }

.hidden { display: none !important; }

#cabinetScreen { display: none; }
#cabinetScreen.active { display: block; }

.profile {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.profile-name { font-size: 18px; font-weight: 700; }
.profile-meta { font-size: 12px; color: #666; margin-top: 4px; line-height: 1.4; }

.cabinet-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cabinet-tab {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #ecf0f1;
  color: #444;
}

.cabinet-tab.active { background: var(--accent); color: #fff; }
.cabinet-tab-wrap { position: relative; display: inline-block; }
.cabinet-tab-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  animation: access-badge-blink 1s ease-in-out infinite;
}

@keyframes access-badge-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.92); }
}

.panel,
.cc-panel { display: none; }
.panel.active,
.cc-panel.active { display: block; }

#cabinetScreen.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.cc-chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cc-chat-head h2 {
  margin: 0;
  font-size: 17px;
  flex: 1;
}

.cc-identity-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 12px;
  color: #6b7280;
}

.cc-identity-bar select {
  flex: 1;
  min-width: 140px;
}

.cc-messages {
  width: 100%;
  min-height: 280px;
  max-height: 48vh;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid #e0e7ef;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(244,249,251,0.95));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-chat-day-group {
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.45);
}

.cc-chat-day-group.today {
  border-color: #aed6f1;
  background: rgba(255,255,255,0.55);
}

.cc-chat-day-group.collapsed .cc-chat-day-messages { display: none; }

.cc-chat-day-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #e8ecef;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #2c3e50;
  text-align: left;
  font-family: inherit;
}

.cc-chat-day-group.today .cc-chat-day-header {
  background: #d4e6f1;
  color: #1a5276;
}

.cc-chat-day-header:hover { filter: brightness(0.97); }

.cc-chat-day-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #7f8c8d;
}

.cc-chat-day-count {
  font-size: 11px;
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 10px;
}

.cc-chat-day-chevron {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 10px;
}

.cc-chat-day-group.collapsed .cc-chat-day-chevron { transform: rotate(-90deg); }

.cc-chat-day-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 10px 10px;
}

.cc-msg-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  touch-action: manipulation;
}

.cc-msg-bubble.me {
  align-self: flex-end;
  background: #d6eaf8;
  border: 1px solid #aed6f1;
}

.cc-msg-bubble.them {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #d9e3ea;
}

.cc-msg-bubble.system {
  align-self: center;
  background: #fff4d6;
  border: 1px solid #f7d58b;
  font-size: 12px;
}

.cc-msg-meta {
  font-size: 10px;
  color: #7f8c8d;
  margin-bottom: 4px;
  font-weight: 600;
}

.cc-msg-shop {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #5d6d7e;
  color: #fff;
  margin-right: 4px;
}

.courier-chat-compose,
.cc-compose {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  width: 100%;
}

.cc-compose .cc-mention-wrap {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: block;
}

.cc-compose .cc-mention-wrap textarea,
.courier-chat-compose textarea,
.cc-compose textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  min-height: 52px;
  max-height: 140px;
  padding: 12px 14px;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  resize: none;
  margin-bottom: 0;
  line-height: 1.35;
}

.cc-compose .btn,
.cc-send-btn {
  width: auto;
  flex-shrink: 0;
  min-width: 48px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
}

.cc-chat-footer {
  flex-shrink: 0;
  margin-top: 8px;
  padding-top: 4px;
  overflow: visible;
}

.cc-header-card { margin-bottom: 10px; }
.cc-header-card .profile { margin-bottom: 0; }

.cc-panel-card {
  margin-bottom: 0;
  min-height: calc(100vh - 200px);
}

.cc-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(45, 90, 110, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cc-nav-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 14px;
  padding: 8px 4px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}

.cc-nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.cc-nav-icon { font-size: 22px; line-height: 1; }
.cc-nav-label { font-size: 10px; font-weight: 700; }

.cc-nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 28px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.cc-thread-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.cc-back-btn { flex-shrink: 0; }

.cc-thread-title-inline {
  margin: 0;
  font-size: 16px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-chat-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
}

.cc-chat-panel.active,
.cc-panel.cc-chat-panel.active {
  display: flex;
}

.cc-scroll-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.cc-couriers-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cc-couriers-panel .cc-list-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.cc-couriers-panel .cc-thread-view.active {
  display: flex;
  flex: 1;
  min-height: 0;
}

.cc-messages {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.cc-emoji-btn,
.cc-attach-btn {
  border: 1px solid #d5dce3;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cc-attach-btn { display: inline-flex; align-items: center; }

.cc-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.cc-courier-search-wrap {
  position: relative;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.cc-courier-search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  background: #fff;
  color: #2c3e50;
}

.cc-courier-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cc-courier-search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: #fff;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cc-courier-search-suggestions.hidden {
  display: none !important;
}

.cc-courier-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: #2c3e50;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.cc-courier-search-item:last-child {
  border-bottom: none;
}

.cc-courier-search-item:hover,
.cc-courier-search-item:focus {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.cc-courier-search-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: #94a3b8;
}

.cc-thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.cc-thread-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 0;
  padding: 12px 14px;
  border: 2px solid #c5dde6;
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.cc-thread-btn:hover { background: #f4fafc; border-color: var(--accent); }
.cc-thread-btn.active {
  background: #f0f8fb;
  color: #1f3340;
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.cc-thread-btn.unread {
  background: #fff5f5;
  border-color: #f1a9a0;
}

.cc-thread-title { font-size: 14px; font-weight: 700; }
.cc-thread-preview { font-size: 12px; color: #566573; margin-top: 6px; line-height: 1.35; }

.cc-thread-view { display: none; }
.cc-list-view.hidden-by-thread { display: none; }

.cc-compose-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
  overflow: visible;
}

.cc-emoji-wrap { position: relative; overflow: visible; }

.cc-emoji-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px;
  width: 260px;
  max-height: 180px;
  overflow-y: auto;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.cc-emoji-picker.open { display: grid; }

.cc-emoji-picker button {
  border: none;
  background: transparent;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
}

.cc-emoji-picker button:hover { background: #ecf0f1; }

.cc-emoji-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.28);
  -webkit-tap-highlight-color: transparent;
}

.cc-emoji-backdrop.open {
  display: block;
}

.cc-attach-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f4f8fb;
  font-size: 12px;
  color: #566573;
}

.cc-reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef6ff;
  border: 1px solid #c5dff5;
  font-size: 12px;
}

.cc-reply-banner.hidden { display: none !important; }

.cc-reply-banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cc-reply-cancel {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: #7f8c8d;
  padding: 2px 6px;
}

.cc-msg-reply-quote {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.55);
  border-radius: 8px;
  font-size: 11px;
  color: #5d6d7e;
}

.cc-msg-text { word-break: break-word; }

.cc-msg-image {
  display: block;
  max-width: 100%;
  max-height: min(50vh, 420px);
  border-radius: 10px;
  margin-top: 8px;
  object-fit: contain;
}

.cc-msg-file {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f4f6f8;
  color: #2c3e50;
  text-decoration: none;
  font-size: 13px;
}

.cc-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cc-reaction-chip {
  border: 1px solid #dfe6e9;
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.4;
}

.cc-reaction-count { font-size: 11px; color: #666; margin-left: 2px; }

.cc-mention {
  font-weight: 700;
  padding: 0 2px;
  border-radius: 4px;
}

.cc-mention-staff { color: #d35400; background: rgba(230,126,34,0.18); }
.cc-mention-shop { color: #fff; }

.cc-mention-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.cc-mention-popup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  z-index: 80;
  -webkit-overflow-scrolling: touch;
}

.cc-mention-popup.hidden { display: none; }

.cc-mention-popup-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f3f6;
  touch-action: manipulation;
}

.cc-mention-popup-item:last-child { border-bottom: none; }
.cc-mention-popup-item.active,
.cc-mention-popup-item:active { background: #ecf0f1; }

.cc-context-favorite {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.cc-context-favorite:active { background: #f4f8fb; }

.cc-fav-scope {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7f8c8d;
  margin-bottom: 4px;
}

.cc-favorites-messages {
  max-height: none;
  flex: 1;
}

.cc-context-menu {
  display: none;
  position: fixed;
  z-index: 10050;
  min-width: 200px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 10px;
}

.cc-context-menu.open { display: block; }

.cc-context-reply {
  width: 100%;
  border: none;
  background: #f4f6f8;
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 8px;
  text-align: left;
}

.cc-context-label { font-size: 11px; color: #888; margin-bottom: 6px; }

.cc-context-reactions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.cc-context-reactions button {
  border: none;
  background: #f4f6f8;
  border-radius: 8px;
  padding: 8px 0;
  font-size: 20px;
  cursor: pointer;
}

body.cc-cabinet-on {
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

body.cc-cabinet-on .wrap {
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
}

body.cc-cabinet-on .cc-header-card {
  margin: 0;
  border-radius: 0;
  flex-shrink: 0;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-left: none;
  border-right: none;
  border-top: none;
}

body.cc-cabinet-on .cc-panel-card {
  flex: 1;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px calc(72px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  border-left: none;
  border-right: none;
}

body.cc-cabinet-on .cc-panel-card > .cc-panel.active {
  flex: 1;
  min-height: 0;
}

body.cc-cabinet-on .cc-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
}

body.cc-cabinet-on .cc-thread-list {
  flex: 1;
  min-height: 0;
  max-height: none;
}

body.cc-cabinet-on .cc-stat-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
}

body.cc-cabinet-on .cc-bottom-nav {
  max-width: 560px;
  margin: 0 auto;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--cc-kb-offset, 0);
}

body.cc-thread-mode .cc-bottom-nav {
  display: none;
}

body.cc-thread-mode .cc-panel-card {
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

body.cc-input-focus .cc-bottom-nav {
  opacity: 0.92;
}

@media (max-width: 640px) {
  body { padding: 12px; }
  body.cc-cabinet-on { padding: 0; }
  .wrap { max-width: 100%; }
  .card { padding: 18px 16px; }
  .cc-panel-hint { display: none; }
  .cc-msg-bubble { max-width: 92%; font-size: 15px; }
  .cc-chat-head h2 { font-size: 16px; }
  .cc-identity-bar {
    font-size: 11px;
    margin-bottom: 8px;
  }
  .cc-identity-bar select {
    min-width: 0;
    font-size: 14px;
    padding: 8px 10px;
  }
  .cc-emoji-picker.open {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px) + var(--cc-kb-offset, 0px));
    width: auto;
    max-width: none;
    max-height: min(30vh, 152px);
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    padding: 6px 4px;
    z-index: 80;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.16);
    border-radius: 10px;
  }
  body.cc-thread-mode .cc-emoji-picker.open {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--cc-kb-offset, 0px));
    max-height: min(28vh, 140px);
  }
  .cc-emoji-picker button {
    font-size: 18px;
    line-height: 1;
    padding: 4px 1px;
    min-height: 30px;
    border-radius: 4px;
  }
  .cc-context-menu {
    left: 12px !important;
    right: 12px !important;
    min-width: 0;
    width: auto;
  }
}

@media (min-width: 641px) {
  body.cc-cabinet-on .wrap {
    max-width: 560px;
    margin: 0 auto;
  }
  body.cc-cabinet-on {
    padding: 16px;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  body.cc-cabinet-on .cc-header-card,
  body.cc-cabinet-on .cc-panel-card {
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    border: 1px solid var(--border);
  }
  body.cc-cabinet-on .cc-bottom-nav {
    position: sticky;
    transform: none;
    left: auto;
    max-width: none;
    margin-top: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-messages { scroll-behavior: auto; }
  .cabinet-tab-badge { animation: none; }
}

.cc-stat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(68vh, 620px);
  overflow-y: auto;
  padding: 4px 2px 8px;
}

.cc-stat-msg {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.cc-stat-meta {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 8px;
}

.cc-stat-text {
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.cc-msg-reactions { display: none !important; }
.ct-react-row, .ct-react-chip, .ct-react-add, .ct-quick-inline,
body.courier-cabinet .team-react-row { display: none !important; }

.cc-msg-bubble {
  max-width: 82%;
  border-radius: 15px;
  overflow-wrap: anywhere;
}
.cc-msg-bubble.me {
  background: #7ecde0;
  border: none;
  border-top-right-radius: 5px;
  color: #13323d;
}
.cc-msg-bubble.them {
  background: #ffffff;
  border: 1px solid #e4e9ee;
  border-top-left-radius: 5px;
}
.cc-msg-bubble .cc-msg-text { white-space: pre-wrap; }
.cc-msg-image { border-radius: 12px; }
.cc-send-btn {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  min-width: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cc-compose textarea,
.cc-compose .cc-mention-wrap textarea,
.courier-chat-compose textarea {
  border-radius: 16px;
  min-height: clamp(56px, 14vh, 140px);
  line-height: 1.45;
}

/* === Полноэкранный адаптивный режим для веб (широкие экраны) === */
@media (min-width: 900px) {
  body.cc-cabinet-on .wrap {
    max-width: none;
    width: 100%;
    padding: 0 14px 110px;
  }
  body.cc-cabinet-on .cc-header-card {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
  }
  body.cc-cabinet-on .cc-panel-card {
    max-width: none;
    min-height: calc(100vh - 215px);
  }
  body.cc-cabinet-on .cc-panel-card > .cc-panel.active {
    display: flex;
    flex-direction: column;
  }
  body.cc-cabinet-on .cc-chat-panel {
    height: calc(100vh - 225px);
    min-height: 420px;
  }
  body.cc-cabinet-on .cc-panel-card .cc-messages {
    flex: 1 1 auto;
    max-height: none;
    height: auto;
    min-height: 200px;
  }
  body.cc-cabinet-on .cc-chat-footer {
    flex-shrink: 0;
  }
  #panelTeam .ct-frame {
    height: calc(100vh - 260px);
    min-height: 440px;
  }
}

/* === Полноэкранный режим для ВСЕХ чатов куратора === */
body.cur-fullscreen .bip-page-bg { display: none !important; }
body.cur-fullscreen .cc-header-card,
body.cur-fullscreen .cc-bottom-nav { display: none !important; }
body.cur-fullscreen .cc-panel-card {
  position: fixed !important;
  inset: 0 !important;
  margin: 0 !important;
  z-index: 2000 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #eef2f5 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  min-height: 0 !important;
}
body.cur-fullscreen .cc-panel-card > .cc-panel.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}
body.cur-fullscreen .cc-chat-panel .cc-messages,
body.cur-fullscreen .cc-couriers-panel .cc-messages {
  flex: 1 1 auto;
  max-height: none;
  height: auto;
  min-height: 0;
}
body.cur-fullscreen .cc-chat-footer { flex-shrink: 0; }
body.cur-fullscreen .cc-couriers-panel .cc-list-view,
body.cur-fullscreen .cc-couriers-panel .cc-thread-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.cur-fullscreen .cc-couriers-panel .cc-list-view .cc-messages-threads,
body.cur-fullscreen .cc-couriers-panel .cc-list-view {
  overflow-y: auto;
}

