:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --panel-soft: #f3f4f6;
  --text: #0f172a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #10a37f;
  --accent-dark: #0b8a6a;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --front-chat-viewport-height: 100dvh;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #ffffff 0%, #f4f6f8 45%, #eef1f4 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

a {
  color: #0f766e;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.muted-text {
  color: var(--muted);
}

.btn-primary {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #111827;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.status-line {
  font-size: 12px;
  color: var(--muted);
}

.status-line.ok {
  color: var(--ok);
}

.status-line.error {
  color: var(--danger);
}

/* ---------------- FRONT PAGE ---------------- */
.front-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 36px;
}

.front-card {
  max-width: 980px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.front-card h1 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.front-card p {
  margin: 0;
  color: var(--muted);
}

.chat-bubble-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  background: #0f172a;
  color: #ffffff;
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.3);
}

.chat-bubble-toggle.has-unread::after {
  content: attr(data-unread-count);
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

.chat-floating-notice {
  position: fixed;
  right: 20px;
  bottom: 94px;
  max-width: min(360px, calc(100vw - 28px));
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  z-index: 30;
}

.chat-floating-notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 94px;
  width: 390px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(var(--front-chat-viewport-height, 100vh) - 118px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.chat-header-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  object-fit: cover;
  background: #ffffff;
  flex: 0 0 auto;
}

.chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.chat-header button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  padding: 6px 9px;
}

.chat-widget.offline-mode {
  background: #3962cd;
  border-color: rgba(255, 255, 255, 0.28);
}

.chat-widget.offline-mode .chat-header {
  background: transparent;
  border-bottom: none;
  justify-content: flex-end;
  padding: 10px 12px;
}

.chat-widget.offline-mode .chat-header > div {
  display: none;
}

.chat-widget.offline-mode .chat-title {
  color: #ffffff;
}

.chat-widget.offline-mode .chat-header button {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.chat-offline-panel {
  flex: 1;
  overflow: auto;
  background: #3962cd;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-offline-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.chat-offline-avatar {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  border: 4px solid rgba(255, 255, 255, 0.88);
  background: #ffffff;
  object-fit: cover;
}

.chat-offline-info {
  margin: 0;
  text-align: center;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
}

.chat-offline-language-row {
  display: flex;
  justify-content: center;
}

.chat-offline-lang-btn {
  min-width: 170px;
  height: 38px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.chat-offline-lang-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.chat-offline-lang-picker {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: rgba(20, 37, 84, 0.35);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.chat-offline-lang-picker .line {
  color: #e2e8f0;
  text-align: center;
  font-size: 13px;
}

.chat-offline-form {
  margin-top: auto;
  background: #f5f6f8;
  border-radius: 22px;
  padding: 14px;
  width: calc(100% - 16px);
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-offline-notice {
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px;
}

.chat-offline-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-offline-field span {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.chat-offline-field input,
.chat-offline-field textarea {
  width: 100%;
  border: 1px solid #d6d9e0;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  font-family: inherit;
  padding: 10px 12px;
}

.chat-offline-field textarea {
  min-height: 96px;
  max-height: 96px;
  resize: none;
  overflow-y: auto;
}

.chat-offline-send {
  margin-top: 4px;
  border: none;
  border-radius: 14px;
  background: #3962cd;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  height: 52px;
  cursor: pointer;
}

.chat-offline-send:hover {
  background: #2e54ba;
}

.language-row {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-label {
  font-size: 11px;
  color: #64748b;
}

.lang-select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font-size: 12px;
  padding: 4px 7px;
}

.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages.welcome-centered {
  justify-content: center;
}

.chat-history-top-sentinel {
  width: 100%;
  height: 1px;
  margin-top: -1px;
  pointer-events: none;
}

.chat-history-loader {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #64748b;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #f8fafc;
  padding: 4px 10px;
}

.chat-history-loader-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  border-top-color: #10a37f;
  animation: chat-spin 0.9s linear infinite;
}

.chat-welcome-card {
  align-self: center;
  width: 100%;
  max-width: 300px;
  text-align: center;
  padding: 6px 6px 10px;
}

.chat-welcome-card .headline {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;
}

.chat-welcome-card .subline {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.2;
  color: #0f172a;
}

.msg {
  max-width: 86%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #ffffff;
  position: relative;
  overflow: visible;
}

.msg.visitor {
  align-self: flex-end;
  background: #e8fbf4;
  border-color: #bfeddc;
}

.msg.operator {
  align-self: flex-start;
}

.msg.system {
  align-self: center;
  max-width: 86%;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  padding: 0;
  border-radius: 0;
}

.msg .line {
  display: block;
  line-height: 1.36;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg .msg-foot {
  position: absolute;
  bottom: -7px;
  transform: none;
  line-height: 1;
}

.msg .msg-foot .time {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1;
}

.msg .subline {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  border-top: 1px dashed #dbe0e7;
  padding-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg .file-link-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg .file-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  width: fit-content;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f8fafc;
  color: #1e293b;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 9px;
  word-break: break-all;
}

.msg .file-link-btn:hover {
  background: #eef2f7;
}

.msg .line a,
.msg .subline a {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}

.chat-messages .msg.visitor {
  background: #3962cd;
  border-color: #2e54ba;
  color: #ffffff;
}

.chat-messages .msg.visitor .line a,
.chat-messages .msg.visitor .subline a {
  color: #dbeafe;
}

.chat-messages .msg.visitor .file-link-btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.chat-messages .msg.visitor .file-link-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-composer {
  background: #ffffff;
  padding: 0 12px 12px;
}

.chat-input-shell {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
}

.chat-composer textarea {
  width: 100%;
  min-height: 64px;
  max-height: 64px;
  resize: none;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  padding: 2px 2px 8px;
  outline: none;
  font-size: 15px;
  line-height: 1.4;
}

.chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-upload-indicator {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-upload-indicator::before {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid #cbd5e1;
  border-top-color: #10a37f;
  border-radius: 50%;
  animation: chat-spin 0.9s linear infinite;
}

@keyframes chat-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.chat-actions-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.chat-lang-btn {
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chat-send-btn {
  min-width: 72px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #3962cd;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-send-btn:hover {
  background: #2e54ba;
}

.chat-send-btn:disabled,
.chat-lang-btn:disabled,
.chat-icon-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.file-label input {
  display: none;
}

.file-icon-btn input {
  display: none;
}

.language-picker-message {
  width: 100%;
  text-align: center;
}

.language-picker-message .line {
  margin-bottom: 8px;
}

.lang-options-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.lang-option-btn {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

.lang-option-btn.active {
  border-color: #10a37f;
  color: #0f766e;
}

/* ---------------- OPERATOR LOGIN ---------------- */
.operator-body {
  min-height: 100vh;
}

.operator-body.login-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.operator-body.dashboard-mode {
  display: block;
  padding: 0;
}

.operator-login {
  width: 100%;
  display: flex;
  justify-content: center;
}

.operator-login-card {
  width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.operator-login-card h1 {
  margin: 0 0 14px;
}

.login-demo-note {
  color: #6b7280;
  margin: 0;
}

.login-status-line {
  margin-top: 10px;
}

.operator-login-card label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.operator-login-card input {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
}

.notification-prompt {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.notification-prompt-card {
  width: min(480px, 100%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.22);
  padding: 22px;
}

.notification-prompt-card h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.notification-prompt-card p {
  margin: 0 0 14px;
  color: #475569;
  line-height: 1.45;
}

.notification-prompt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* ---------------- OPERATOR SHELL ---------------- */
.operator-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px 1fr;
}

.operator-rail {
  border-right: 1px solid var(--line);
  background: #101318;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  padding: 14px 10px;
}

.rail-top {
  display: block;
}

.rail-icons-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #222936;
  background: #141a24;
  color: #d1d5db;
  cursor: pointer;
  margin: 0;
}

.rail-icon.active {
  background: #1d2430;
  border-color: #394457;
}

.served-rail-panel {
  flex: 1;
  min-height: 0;
  background: #141a24;
  border: 1px solid #273247;
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.served-rail-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #d1d5db;
}

.served-rail-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  align-content: start;
}

.served-rail-section {
  margin: 8px 4px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8da0be;
}

.served-rail-item {
  border: 1px solid #2f3a4d;
  background: #111722;
  color: #e2e8f0;
  border-radius: 10px;
  position: relative;
  text-align: left;
}

.served-rail-item:hover {
  border-color: #4c5f7d;
}

.served-rail-item.is-hover {
  border-color: #4c5f7d;
}

.served-rail-item.active {
  border-color: #10a37f;
  box-shadow: inset 0 0 0 1px rgba(16, 163, 127, 0.3);
}

.served-rail-item.needs-attention {
  animation: railPulse 1.05s ease-in-out infinite;
}

@keyframes railPulse {
  0% {
    background: #111722;
    border-color: #2f3a4d;
  }
  50% {
    background: #3b1d57;
    border-color: #9f67ff;
  }
  100% {
    background: #111722;
    border-color: #2f3a4d;
  }
}

.served-rail-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.served-rail-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.served-rail-operators {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  justify-content: center;
  flex: 0 0 auto;
}

.rail-operator-dot {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.served-rail-subline {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #94a3b8;
}

.served-rail-open {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 7px;
  display: grid;
  gap: 2px;
  cursor: pointer;
  transition: padding-left 0.15s ease;
}

.served-rail-item:hover .served-rail-open {
  padding-left: 28px;
}

.served-rail-item.is-hover .served-rail-open {
  padding-left: 28px;
}

.rail-release-btn {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid #3c4860;
  background: #141a24;
  color: #cbd5e1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.served-rail-item:hover .rail-release-btn {
  opacity: 1;
  pointer-events: auto;
}

.served-rail-item.is-hover .rail-release-btn {
  opacity: 1;
  pointer-events: auto;
}

.rail-release-btn:hover {
  border-color: #9ca3af;
  color: #ffffff;
}

.served-rail-item strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #ffffff;
  line-height: 1.1;
}

.served-rail-flag {
  font-size: 16px;
  line-height: 1;
}

.rail-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #6d28d9;
  color: #f5f3ff;
}

.rail-badge-open {
  background: #0f172a;
  color: #e2e8f0;
}

.served-rail-empty {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

.rail-bottom {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.operator-console {
  background: #141a24;
  border: 1px solid #273247;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.operator-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #2e3a4d;
  object-fit: cover;
  background: #ffffff;
}

.operator-console strong {
  display: inline-block;
  font-size: 12px;
  margin: 0 6px 0 0;
}

.operator-console span {
  display: inline-block;
  font-size: 11px;
  color: #94a3b8;
}

.server-health-card {
  background: #141a24;
  border: 1px solid #273247;
  border-radius: 10px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-size: 12px;
}

.server-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.server-health-dot.online {
  background: #22c55e;
}

.server-health-dot.offline {
  background: #ef4444;
}

.operator-main {
  padding: 24px;
}

.board-view {
  display: grid;
  gap: 16px;
}

.settings-view {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: start;
  gap: 12px;
}

.settings-menu {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-tab {
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  padding: 9px 10px;
  text-align: left;
  font-weight: 400;
  cursor: pointer;
}

.settings-tab + .settings-tab {
  margin-top: -1px;
}

.settings-tab:first-child {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.settings-tab:last-child {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.settings-tab.active {
  border-color: #8cb7ff;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.22);
}

.settings-content {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
}

#settingsUsersSection,
#settingsShortcutsSection,
#settingsHoursSection,
#settingsGeneralSection,
#settingsLanguagesSection,
#settingsUploadsSection,
#settingsNotificationsSection,
#settingsLogsSection {
  display: grid;
  align-content: start;
  gap: 14px;
}

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

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

.settings-header h3 {
  margin: 0;
  font-size: 20px;
}

.settings-header p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.settings-general-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  padding: 12px;
}

.settings-embed-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.settings-embed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-embed-head strong {
  font-size: 14px;
}

.settings-embed-snippet {
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  background: #f8fafc;
  color: #0f172a;
}

.settings-notifications-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.settings-notifications-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-notifications-row .label {
  color: #64748b;
  font-size: 13px;
}

.settings-notifications-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-general-summary {
  display: grid;
  gap: 10px;
}

.settings-general-meta {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.settings-upload-form {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.settings-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: center;
}

.settings-upload-grid label {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}

.settings-upload-grid input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.settings-upload-formats-wrap {
  display: grid;
  gap: 8px;
}

.settings-upload-formats-wrap strong {
  font-size: 13px;
  color: #0f172a;
}

.settings-upload-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-format-chip {
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #0f172a;
}

.settings-upload-actions {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 980px) {
  .settings-upload-grid {
    grid-template-columns: 1fr;
  }
}

.settings-general-domains-readonly {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.domain-chip {
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
}

.settings-general-form {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.settings-general-form h4 {
  margin: 0;
  font-size: 15px;
}

.settings-general-help {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.settings-general-help code {
  font-size: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 7px;
  padding: 1px 5px;
  background: #f8fafc;
}

.settings-general-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.settings-general-add-row input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px;
}

.settings-general-domains {
  display: grid;
  gap: 8px;
}

.settings-general-domain-chip {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-general-domain-chip span {
  color: #0f172a;
  font-size: 13px;
  word-break: break-all;
}

.settings-general-actions {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-languages-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.settings-language-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 12px;
}

.settings-language-row:last-child {
  border-bottom: none;
}

.settings-language-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
}

.settings-language-main strong {
  font-size: 13px;
}

.settings-language-side {
  font-size: 12px;
  color: #64748b;
}

.settings-users-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.settings-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 12px;
}

.settings-user-row:last-child {
  border-bottom: none;
}

.settings-user-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.settings-user-meta img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  object-fit: cover;
  background: #ffffff;
}

.settings-user-meta strong {
  display: block;
  font-size: 13px;
}

.settings-user-meta span {
  display: block;
  font-size: 12px;
  color: #64748b;
}

.settings-user-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.settings-user-form {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.settings-form-topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 2px;
}

.settings-back-btn {
  padding: 6px 10px;
}

.settings-user-form h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.settings-user-form label {
  font-size: 12px;
  color: #334155;
}

.settings-user-form label small {
  color: #64748b;
  font-weight: 500;
}

.settings-user-form input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px;
}

.settings-user-actions {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-shortcuts-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.settings-shortcut-row {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  display: grid;
  gap: 8px;
}

.settings-shortcut-row:last-child {
  border-bottom: none;
}

.settings-shortcut-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.settings-shortcut-row-head strong {
  font-size: 13px;
}

.settings-shortcut-row-head code {
  font-size: 12px;
  color: #0f172a;
  background: #eef2ff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 2px 8px;
}

.settings-shortcut-row-preview {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-shortcut-actions-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.settings-shortcut-form {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.settings-shortcut-form h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.settings-shortcut-form label {
  font-size: 12px;
  color: #334155;
}

.settings-shortcut-form input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px;
}

.shortcut-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shortcut-toolbar button {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}

.shortcut-editor {
  min-height: 140px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #111827;
  outline: none;
  white-space: pre-wrap;
}

.shortcut-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.shortcut-editor img {
  max-width: 220px;
  border-radius: 8px;
  display: block;
  margin: 6px 0;
}

.settings-shortcut-actions {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-hours-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  padding: 12px;
}

.settings-hours-quick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe3ee;
  background: #ffffff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.settings-hours-quick-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.settings-hours-summary {
  display: grid;
  gap: 10px;
}

.settings-hours-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.settings-hours-meta {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.settings-hours-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-hours-table th,
.settings-hours-table td {
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  font-size: 13px;
}

.settings-hours-table th {
  width: 120px;
  color: #0f172a;
}

.settings-hours-table td {
  color: #334155;
}

.settings-hours-table tr:last-child th,
.settings-hours-table tr:last-child td {
  border-bottom: none;
}

.settings-hours-form {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.settings-hours-form h4 {
  margin: 0;
  font-size: 15px;
}

.settings-hours-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
}

.settings-hours-checkbox input {
  width: 16px;
  height: 16px;
}

.settings-hours-timezone {
  font-size: 12px;
  color: #475569;
}

.settings-hours-slots-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-hours-slots-head strong {
  font-size: 13px;
}

.settings-hours-slots {
  display: grid;
  gap: 8px;
}

.settings-hours-slot-row {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(90px, 120px) auto minmax(90px, 120px) auto;
  align-items: center;
  gap: 8px;
}

.settings-hours-slot-row select,
.settings-hours-slot-row input[type='time'] {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
}

.settings-hours-slot-row span {
  color: #64748b;
  text-align: center;
}

.settings-hours-slot-row [data-hours-remove-slot] {
  justify-self: end;
}

.settings-hours-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.settings-logs-toolbar {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto minmax(90px, 120px);
  align-items: center;
  gap: 8px;
}

.settings-logs-toolbar label {
  font-size: 12px;
  color: #334155;
}

.settings-logs-toolbar select,
.settings-logs-toolbar input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
}

.settings-logs-output {
  width: 100%;
  min-height: 340px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  background: #0b1220;
  color: #dbeafe;
}

.board-header h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.board-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.group-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.group-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
}

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

.group-header h3 {
  margin: 0;
  font-size: 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active {
  background: #16a34a;
}

.status-dot.served {
  background: #7c3aed;
}

.group-count {
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  min-width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
}

.visitor-table-wrap {
  overflow: auto;
}

.visitor-table {
  min-width: 1120px;
}

.visitor-head,
.visitor-row {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr 1fr 1fr 1fr 1fr 92px 72px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.visitor-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid var(--line);
}

.visitor-row {
  width: 100%;
  border: none;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.visitor-row:hover {
  background: #f8fafc;
}

.visitor-row.needs-attention {
  animation: visitorPulse 1.25s ease-in-out infinite;
}

@keyframes visitorPulse {
  0% {
    box-shadow: inset 0 0 0 0 rgba(124, 58, 237, 0.2);
    background: #ffffff;
  }
  50% {
    box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.22);
    background: #f5f3ff;
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(124, 58, 237, 0.2);
    background: #ffffff;
  }
}

.visitor-row span {
  font-size: 13px;
  color: #111827;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visitor-row strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.country-flag {
  margin-right: 4px;
  font-size: 16px;
  line-height: 1;
}

.assigned-inline {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
}

.assigned-inline img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
}

.empty-table {
  padding: 14px;
  color: var(--muted);
}

.badge-unread {
  display: inline-flex;
  justify-content: center;
  width: 28px;
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  padding: 3px 0;
}

/* ---------------- CHAT VIEW ---------------- */
.chat-view {
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  min-height: 0;
  overflow: hidden;
}

.chat-view-header {
  display: none;
}

.chat-view-header strong {
  display: block;
}

.chat-view-header span {
  color: var(--muted);
  font-size: 13px;
}

.chat-language-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-language-tools label {
  font-size: 12px;
  color: #64748b;
}

.translation-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}

.translation-hint {
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.translation-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.translation-arrow {
  color: #64748b;
  font-size: 12px;
}

.chat-tech-meta {
  font-size: 12px;
  color: #64748b;
}

.chat-tech-meta strong {
  color: #0f172a;
  font-weight: 700;
}

.icon-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 9px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  font-size: 12px;
  color: #7c2d12;
}

.owner-badge img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #cbd5e1;
}

.conversation {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(var(--chat-pane-cols, 1), minmax(0, 1fr));
  gap: 10px;
  align-content: stretch;
  align-items: stretch;
}

.conversation-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.conversation-pane.active {
  border-color: #d8e1ec;
  box-shadow: none;
}

.conversation-pane-head {
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-pane-meta {
  min-width: 0;
}

.conversation-pane-meta strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-pane-meta .pane-head-title {
  color: #111111;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}

.conversation-pane-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pane-search-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 13px;
}

.pane-head-flag {
  font-size: 20px;
  line-height: 1;
}

.pane-search-wrap {
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 6px;
}

.pane-search-input {
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
}

.pane-search-count {
  min-width: 52px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
}

.pane-search-nav,
.pane-search-clear {
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
  padding: 0 8px;
}

.pane-search-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.conversation .msg.search-hit {
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.32);
}

.conversation .msg.search-hit-active {
  box-shadow: inset 0 0 0 2px rgba(14, 165, 233, 0.72);
}

.pane-messages-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.pane-messages {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 10px 10px 44px;
  background: #f8fafb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pane-messages .msg {
  max-width: 94%;
}

.pane-jump-bottom-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  z-index: 4;
}

.pane-jump-bottom-btn:hover {
  background: #f8fafc;
}

.pane-composer {
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 8px;
  display: grid;
  gap: 8px;
  position: relative;
}

.pane-composer textarea {
  min-height: 76px;
  max-height: 180px;
}

.pane-composer .translation-bar {
  padding: 7px 9px;
}

.pane-composer .owner-badge {
  margin-bottom: 0;
}

/* Operator console alignment: visitor left, operator right. */
.conversation .msg.visitor {
  align-self: flex-start;
}

.conversation .msg.operator {
  align-self: flex-end;
  background: #fff4c7;
  border-color: #f3d77f;
}

.chat-messages .msg.visitor .msg-foot {
  left: -24px;
}

.chat-messages .msg.operator .msg-foot {
  right: -24px;
}

.conversation .msg.visitor .msg-foot {
  right: -24px;
}

.conversation .msg.operator .msg-foot {
  left: -24px;
}

.conversation .msg.system {
  max-width: 72%;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px;
}

.conversation .msg.system .line a {
  color: #94a3b8;
  text-decoration: underline;
}

.chat-messages .msg .line,
.chat-messages .msg .subline {
  font-size: 14px;
}

.chat-messages .msg.system .line {
  font-size: 11px;
}

.conversation .msg .line,
.conversation .msg .subline {
  font-size: 14px;
}

.conversation .msg .subline.translation-variant {
  font-size: 12px;
}

.conversation .msg.system .line {
  font-size: 12px;
}

.operator-composer {
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 8px;
  position: relative;
}

.operator-composer textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
}

.composer-input-wrap {
  position: relative;
}

.shortcut-autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  max-height: 220px;
  overflow: auto;
  z-index: 4;
}

.shortcut-autocomplete-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.shortcut-autocomplete-item:last-child {
  border-bottom: none;
}

.shortcut-autocomplete-item:hover,
.shortcut-autocomplete-item.active {
  background: #f8fafc;
}

.shortcut-autocomplete-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shortcut-autocomplete-line code {
  font-size: 12px;
  color: #0f172a;
  background: #eef2ff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 2px 8px;
}

.shortcut-autocomplete-line strong {
  font-size: 12px;
  color: #111827;
}

.shortcut-autocomplete-preview {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.operator-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.operator-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.operator-status-stack {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.typing-preview {
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 12px;
  padding: 8px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.take-overlay {
  position: absolute;
  inset: 10px 10px 52px 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 12px;
}

.take-overlay-controls {
  width: min(620px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.take-operator-select {
  height: 42px;
  min-width: 180px;
  max-width: 260px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  padding: 0 34px 0 12px;
  font-size: 13px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.take-operator-select:focus {
  outline: 2px solid #bfdbfe;
  border-color: #60a5fa;
}

.take-operator-select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.take-overlay .btn-primary {
  width: auto;
  max-width: none;
  flex: 1;
  min-height: 42px;
  font-size: 14px;
}

.take-overlay .btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

@media (max-width: 680px) {
  .front-shell {
    padding: 14px;
  }

  .front-card {
    padding: 18px;
    border-radius: 12px;
  }

  .front-card h1 {
    font-size: 24px;
  }

  body.front-widget-open {
    overflow: hidden;
  }

  .chat-widget {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--front-chat-viewport-height, 100dvh);
    max-height: var(--front-chat-viewport-height, 100dvh);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .chat-header {
    padding: 12px;
  }

  .chat-header button {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .chat-messages {
    padding: 10px 10px 12px;
  }

  .chat-composer {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  }

  .chat-input-shell {
    padding: 8px;
  }

  .chat-composer textarea {
    min-height: 58px;
    max-height: 118px;
    font-size: 16px;
  }

  .chat-actions {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
  }

  .chat-actions-left {
    min-width: 0;
    flex: 1 1 auto;
  }

  .chat-lang-btn {
    min-width: 0;
    max-width: 100%;
    padding: 0 8px;
    font-size: 12px;
  }

  .chat-send-btn {
    min-width: 0;
    flex: 1 1 110px;
  }

  .chat-offline-panel {
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom));
    justify-content: flex-start;
    gap: 12px;
  }

  .chat-offline-form {
    margin-top: 0;
    width: 100%;
    border-radius: 16px;
    padding: 12px;
  }

  .chat-offline-lang-btn {
    min-width: 0;
    width: 100%;
  }

  .chat-floating-notice {
    left: 10px;
    right: 10px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .chat-bubble-toggle {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    font-size: 23px;
  }

  .take-overlay-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .take-operator-select {
    max-width: none;
    width: 100%;
  }
}

.empty-state {
  margin: auto;
  color: #6b7280;
  font-size: 15px;
  text-align: center;
  max-width: 460px;
  padding: 22px;
}

@media (max-width: 1200px) {
  .operator-shell {
    grid-template-columns: 250px 1fr;
  }

  .operator-main {
    padding: 14px;
  }

  .visitor-head,
  .visitor-row {
    grid-template-columns: 1fr 1.2fr 1fr 1fr 1fr 1fr 86px 72px;
  }
}

@media (max-width: 980px) {
  .operator-body.login-mode {
    align-items: flex-start;
    padding-top: 18px;
  }

  .operator-shell {
    grid-template-columns: 1fr;
  }

  .settings-view {
    grid-template-columns: 1fr;
  }

  .settings-menu {
    border-bottom: none;
    margin-bottom: 2px;
  }

  .settings-header {
    flex-wrap: wrap;
  }

  .settings-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .settings-hours-slot-row {
    grid-template-columns: 1fr 1fr;
  }

  .settings-hours-slot-row span {
    display: none;
  }

  .settings-hours-slot-row [data-hours-remove-slot] {
    grid-column: 1 / -1;
    justify-self: flex-end;
  }

  .settings-general-add-row {
    grid-template-columns: 1fr;
  }

  .settings-logs-toolbar {
    grid-template-columns: 1fr;
  }

  .operator-rail {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #2a3448;
    grid-template-columns: 1fr;
  }

  .rail-top {
    display: block;
  }

  .rail-icons-row {
    justify-content: flex-start;
  }

  .served-rail-panel {
    max-height: 180px;
  }

  .chat-tech-meta {
    width: 100%;
  }

  .rail-bottom {
    margin-top: 10px;
  }

  .operator-console {
    text-align: left;
    align-items: center;
    gap: 10px;
  }

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

  .chat-widget {
    right: 10px;
    bottom: 76px;
    width: min(390px, calc(100vw - 20px));
    max-height: calc(var(--front-chat-viewport-height, 100vh) - 90px);
  }

  .chat-floating-notice {
    right: 10px;
    bottom: 76px;
    max-width: calc(100vw - 20px);
  }

  .chat-bubble-toggle {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 680px) {
  .chat-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--front-chat-viewport-height, 100dvh);
    max-height: var(--front-chat-viewport-height, 100dvh);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .chat-floating-notice {
    left: 10px;
    right: 10px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .chat-bubble-toggle {
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
}
