:root {
  --bg: #f7f1e8;
  --panel: #ffffff;
  --ink: #1f1a13;
  --muted: #6e6156;
  --accent: #0f6b5f;
  --accent-strong: #0b4f47;
  --accent-soft: rgba(15, 107, 95, 0.16);
  --accent-cream: #f6efe5;
  --border: rgba(31, 26, 19, 0.08);
  --shadow: 0 16px 40px rgba(22, 18, 12, 0.12);
  --radius: 20px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fdf6ec 0%, #f3ece2 55%, #e7dfd3 100%);
  color: var(--ink);
  height: 100vh;
  position: relative;
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20% auto auto -10%;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle at center, rgba(15, 107, 95, 0.14), transparent 65%);
  filter: blur(20px);
  z-index: -1;
}

body::after {
  inset: auto -15% -20% auto;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle at center, rgba(210, 150, 78, 0.18), transparent 68%);
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 20px;
}

.app {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: auto;
  gap: 20px;
  height: 100%;
  min-height: 0;
  position: relative;
}

.sidebar {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  height: 100%;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  overflow: visible;
}

.sidebar-toolbar .toolbar-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-toolbar .icon-btn {
  min-width: 46px;
  max-width: 46px;
  height: 46px;
  font-size: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-actions-row .ghost-btn {
  flex: 1 1 120px;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38a169;
  box-shadow: 0 0 0 4px rgba(56, 161, 105, 0.15);
}

.connection-status.offline .status-dot {
  background: #d65d5d;
  box-shadow: 0 0 0 4px rgba(214, 93, 93, 0.15);
}

.connection-status.loading .status-dot {
  background: #f4b044;
  box-shadow: 0 0 0 4px rgba(244, 176, 68, 0.15);
}

.menu-accordion {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(29, 27, 24, 0.04);
  overflow: hidden;
}

.menu-accordion.toolbar {
  flex: 0 0 auto;
  max-width: 160px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  position: relative;
  overflow: visible;
}

.menu-accordion-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.menu-accordion.toolbar .menu-accordion-summary {
  padding: 10px 16px;
  border-radius: 999px;
}

.menu-accordion.toolbar .menu-accordion-body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.menu-accordion-summary::-webkit-details-marker {
  display: none;
}

.menu-accordion-icon {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.menu-accordion[open] .menu-accordion-icon {
  transform: rotate(-135deg);
}

.menu-accordion[open] .menu-accordion-summary {
  border-bottom: 1px solid var(--border);
}

.menu-accordion-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.doctor-tag {
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(15, 107, 95, 0.08);
  border: 1px solid rgba(15, 107, 95, 0.12);
}

.doctor-tag-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.doctor-tag-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.doctor-tag-crm {
  font-size: 12px;
  color: var(--muted);
}

.doctor-swap {
  border: none;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(31, 26, 19, 0.08);
}

.doctor-swap:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 26, 19, 0.14);
}

.refresh {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.refresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px rgba(31, 28, 23, 0.18);
}

.messages-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 241, 232, 0.75);
  backdrop-filter: blur(3px);
  z-index: 20;
}

.messages-loader.is-hidden {
  display: none;
}

.messages-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-weight: 600;
  color: var(--accent-strong);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(15, 107, 95, 0.2);
  border-top-color: var(--accent-strong);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-list {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  align-content: start;
  grid-auto-rows: min-content;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(15, 107, 95, 0.06);
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
  animation: fadeIn 0.25s ease;
  min-height: 64px;
}

.chat-item-delete {
  margin-left: auto;
  width: 18px;
  height: 18px;
  color: rgba(14, 59, 54, 0.6);
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-item:hover .chat-item-delete {
  opacity: 0.9;
  transform: scale(1.05);
}

.chat-item-delete svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.chat-item-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22b469;
  box-shadow: 0 0 0 4px rgba(34, 180, 105, 0.16);
  flex-shrink: 0;
}

.chat-item-unread-dot.is-hidden {
  display: none;
}

.chat-item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 107, 95, 0.12);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  overflow: hidden;
}

.chat-item-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chat-item.active {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}

.chat-item:hover {
  border-color: rgba(15, 107, 95, 0.28);
  background: rgba(15, 107, 95, 0.12);
}

.chat-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-number {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vacancies-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(29, 27, 24, 0.03);
  display: grid;
  gap: 12px;
}

.vacancies-bar {
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}

.vacancies-card h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.vacancies-meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.vacancies-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 16px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 107, 95, 0.35) rgba(15, 107, 95, 0.05);
  padding-bottom: 4px;
}

.vacancies-card li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink);
  gap: 8px;
  white-space: nowrap;
}

.chat {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.chat-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(15, 107, 95, 0.07), rgba(255, 255, 255, 0));
}

.chat-header-info {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  width: 100%;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 107, 95, 0.12);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  grid-row: 1 / span 2;
  overflow: hidden;
}

.chat-item-avatar img,
.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.chat-item-avatar.placeholder,
.chat-avatar.placeholder {
  background: rgba(15, 107, 95, 0.16);
}

.chat-name {
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 6px;
  grid-column: 2;
}

.chat-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  grid-column: 2;
}

.chat-messages {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, #fbf7f0 0%, #f7f1e8 100%);
  scroll-behavior: smooth;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.message {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.message.in {
  justify-content: flex-start;
}

.message.out {
  justify-content: flex-end;
}

.bubble {
  max-width: 70%;
  padding: 12px 14px;
  padding-bottom: 22px;
  border-radius: 18px;
  background: #f3efe7;
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
  position: relative;
}

.message.out .bubble {
  background: linear-gradient(145deg, rgba(15, 107, 95, 0.18), rgba(15, 107, 95, 0.08));
  border-color: rgba(15, 107, 95, 0.25);
}

.bubble .text {
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bubble .time {
  font-size: 10px;
  color: var(--muted);
  position: absolute;
  bottom: 6px;
  right: 10px;
  opacity: 0.7;
  white-space: nowrap;
}

.bubble img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.bubble img.thumb {
  max-width: 220px;
  max-height: 180px;
  object-fit: cover;
}

.bubble .video-thumb {
  display: grid;
  gap: 8px;
  max-width: 240px;
}

.bubble .video-thumb video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

.bubble .file {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(29, 27, 24, 0.05);
  color: var(--muted);
  font-size: 14px;
}

.bubble .file a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.bubble .file a:hover {
  text-decoration: underline;
}

.bubble audio {
  width: 240px;
  max-width: 100%;
  margin-top: 4px;
}

.bubble .actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.bubble .forward-btn {
  border: none;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.bubble .contact-btn {
  border: none;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.bubble .forward-btn:hover {
  text-decoration: underline;
}

.bubble .contact-btn:hover {
  text-decoration: underline;
}

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.image-modal.open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 22, 19, 0.65);
  backdrop-filter: blur(2px);
}

.image-modal-dialog {
  position: relative;
  width: min(90vw, 960px);
  max-height: 88vh;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(20, 18, 15, 0.28);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  z-index: 1;
}

.image-modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.image-modal-title {
  font-weight: 600;
}

.image-modal-canvas {
  padding: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7f1e8, #efe6d7);
  overflow: auto;
}

.image-modal-canvas img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 16px;
  border: 1px solid var(--border);
  transform-origin: center;
  cursor: grab;
}

.image-modal-canvas img.dragging {
  cursor: grabbing;
}

.video-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.video-modal.open {
  display: flex;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 22, 19, 0.65);
  backdrop-filter: blur(2px);
}

.video-modal-dialog {
  position: relative;
  width: min(90vw, 980px);
  max-height: 88vh;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(20, 18, 15, 0.28);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  z-index: 1;
}

.video-modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.video-modal-title {
  font-weight: 600;
}

.video-modal-canvas {
  padding: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7f1e8, #efe6d7);
}

.video-modal-canvas video {
  width: min(100%, 900px);
  max-height: 65vh;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #000;
}

.forward-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.forward-modal.open {
  display: flex;
}

.forward-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 22, 19, 0.65);
  backdrop-filter: blur(2px);
}

.forward-modal-dialog {
  position: relative;
  width: min(90vw, 560px);
  max-height: 85vh;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(20, 18, 15, 0.28);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  z-index: 1;
}

.forward-modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.forward-modal-title {
  font-weight: 600;
}

.forward-modal-body {
  padding: 16px 18px;
  display: grid;
  gap: 14px;
  overflow: auto;
}

.forward-modal-body .field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.forward-modal-body input,
.forward-modal-body textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.forward-contact-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #faf7f2;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.forward-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 26, 19, 0.08);
  font-size: 13px;
}

.forward-contact-item input {
  margin: 0;
}

.forward-notice {
  margin: 0;
  font-size: 12px;
  color: #8a6b3a;
}

.forward-error {
  margin: 0;
  font-size: 12px;
  color: #9b2c2c;
}

.forward-modal-actions {
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.qr-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.qr-modal.open {
  display: flex;
}

.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 22, 19, 0.65);
  backdrop-filter: blur(2px);
}

.qr-modal-dialog {
  position: relative;
  width: min(90vw, 420px);
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(20, 18, 15, 0.28);
  overflow: hidden;
  z-index: 1;
}

.qr-modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.qr-modal-title {
  font-weight: 600;
}

.qr-modal-body {
  padding: 18px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.qr-modal-body img {
  width: min(70vw, 280px);
  max-width: 280px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
}

.qr-modal-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.qr-modal-error {
  margin: 0;
  font-size: 12px;
  color: #9b2c2c;
  min-height: 16px;
  text-align: center;
}

.ghost-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
}

.image-modal-actions {
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  justify-content: center;
}

.icon-btn,
.ghost-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost-btn.small {
  font-size: 12px;
  padding: 6px 12px;
}

.icon-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(29, 27, 24, 0.12);
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.chat-input input[type="text"] {
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  background: #f7f1e8;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.chat-input input[type="text"] {
  flex: 1;
}

.chat-input input[type="text"]:focus {
  outline: none;
  border-color: rgba(15, 107, 95, 0.3);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.14);
}

.file-input-hidden {
  display: none;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-weight: 600;
  letter-spacing: 2px;
  margin-left: auto;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip:empty {
  display: none;
}

.chat-input button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
}

.chat-input .send-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chat-search input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #f7f1e8;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.chat-search input:focus {
  outline: none;
  border-color: rgba(15, 107, 95, 0.3);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.14);
}

.new-chat {
  display: grid;
  gap: 10px;
}

body.auth-locked .layout {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.auth-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 26, 19, 0.55);
  backdrop-filter: blur(2px);
}

.auth-modal-dialog {
  position: relative;
  background: var(--panel);
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: min(520px, calc(100vw - 28px));
  overflow: hidden;
}

.auth-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(15, 107, 95, 0.18), rgba(15, 107, 95, 0.02));
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.auth-eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--muted);
}

.auth-modal-body {
  padding: 18px 24px 22px;
}

.auth-step {
  display: none;
  gap: 16px;
}

.auth-step.active {
  display: grid;
}

.auth-field {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.auth-field span {
  font-weight: 600;
  color: var(--ink);
}

.auth-field input {
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #f7f1e8;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(15, 107, 95, 0.3);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.14);
}

.auth-card {
  border-radius: 16px;
  background: rgba(15, 107, 95, 0.08);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.auth-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-message {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 16px;
}

.auth-message.error {
  color: #9b2c2c;
}

.hidden {
  display: none !important;
}

.new-chat-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.new-chat-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.new-chat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 26, 19, 0.45);
}

.new-chat-modal-dialog {
  position: relative;
  background: var(--panel);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: min(480px, calc(100vw - 28px));
  display: grid;
  gap: 0;
  overflow: hidden;
}

.new-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(15, 107, 95, 0.12), rgba(15, 107, 95, 0.02));
}

.new-chat-modal-title {
  font-weight: 600;
}

.new-chat-modal-body {
  padding: 18px 22px 8px;
  display: grid;
  gap: 16px;
}

.new-chat-modal-actions {
  padding: 16px 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: rgba(15, 107, 95, 0.03);
}

.new-chat-modal-body .field {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.new-chat-modal-body .field span {
  font-weight: 600;
  color: var(--ink);
}

.new-chat-number-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.new-chat-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(15, 107, 95, 0.12);
  color: var(--accent-strong);
  font-weight: 600;
  border: 1px solid rgba(15, 107, 95, 0.12);
}

.new-chat-modal input,
.new-chat-modal textarea {
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #f7f1e8;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.new-chat-number-row input {
  width: 100%;
}

.new-chat-modal textarea {
  border-radius: 16px;
  resize: vertical;
  min-height: 110px;
}

.new-chat-modal input:focus,
.new-chat-modal textarea:focus {
  outline: none;
  border-color: rgba(15, 107, 95, 0.3);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.14);
}

.new-chat-error {
  margin: 0;
  font-size: 12px;
  color: #c14444;
  min-height: 16px;
}

/* Scrollbar */
.chat-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.forward-contact-list::-webkit-scrollbar {
  width: 8px;
}

.chat-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.forward-contact-list::-webkit-scrollbar-track {
  background: rgba(15, 107, 95, 0.05);
  border-radius: 999px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.forward-contact-list::-webkit-scrollbar-thumb {
  background: rgba(15, 107, 95, 0.35);
  border-radius: 999px;
}

.chat-list,
.chat-messages,
.forward-contact-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 107, 95, 0.35) rgba(15, 107, 95, 0.05);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  body {
    height: auto;
    overflow: auto;
  }

  .layout {
    grid-template-rows: auto auto;
    padding: 20px 14px 30px;
    height: auto;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: 0;
  }

  .sidebar-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-toolbar .toolbar-group {
    justify-content: space-between;
  }

  .menu-accordion.toolbar {
    align-self: flex-end;
  }

  .sidebar,
  .chat {
    min-height: 0;
    height: auto;
  }

  .chat-input {
    flex-direction: column;
    align-items: stretch;
  }

  .vacancies-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .vacancies-card {
    width: 100%;
    gap: 10px;
  }

  .vacancies-card ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .vacancies-card li {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 107, 95, 0.06);
    border: 1px solid rgba(15, 107, 95, 0.12);
  }
}

@media (max-height: 720px) {
  body {
    height: auto;
    overflow: auto;
  }

  .layout {
    height: auto;
  }
}
