/* Скрыть input[type=file] внутри attach-label, но оставить кликабельным через label */
.attach-label input[type="file"] {
  display: none;
}
:root {
  --bg: #f5efe5;
  --bg-accent: #efe4d1;
  --panel: rgba(255, 250, 243, 0.82);
  --panel-strong: rgba(255, 247, 235, 0.96);
  --line: rgba(62, 44, 28, 0.12);
  --text: #1f1b16;
  --muted: #6d5f4c;
  --brand: #0e8a6a;
  --brand-strong: #0a6e55;
  --warning: #bc5f2a;
  --shadow: 0 18px 44px rgba(79, 54, 31, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 138, 106, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(188, 95, 42, 0.12), transparent 26%),
    linear-gradient(180deg, var(--bg), #f8f4ec 55%, #f1e7d7);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 20px;
  height: 100vh;
  overflow: hidden;
}

.admin-standalone-page {
  min-height: 100vh;
}

.admin-standalone-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
  gap: 16px;
  box-sizing: border-box;
}

.admin-standalone-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  padding: 18px 22px;
}

.admin-standalone-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.admin-standalone-body {
  flex: 1;
  min-height: 0;
}

.admin-settings-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr);
  gap: 20px;
  overflow-y: auto;
  padding: 20px 24px 28px;
  align-content: start;
}

@media (max-width: 960px) {
  .admin-settings-body {
    grid-template-columns: 1fr;
  }
}

.admin-settings-section {
  box-shadow: var(--shadow);
  min-height: 0;
}

.admin-settings-section .qr-wrap {
  min-height: min(420px, 50vh);
}

.admin-settings-section .qr-wrap img {
  max-width: min(360px, 80vw);
  max-height: min(360px, 45vh);
  width: auto;
  height: auto;
}

.admin-settings-section .manager-list {
  max-height: none;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.panel,
.topbar,
.kanban-header {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.topbar,
.kanban-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: 2.1rem;
  line-height: 1.02;
}

h2 {
  font-size: 1.1rem;
}

.eyebrow {
  color: var(--brand-strong);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
}

.muted,
.label,
.conversation-time,
.manager-meta,
.deal-contact,
.deal-manager,
.deal-value,
.message-time {
  color: var(--muted);
}

.panel-head,
.toolbar,
.status-grid,
.conversation-headline,
.deal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wa-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(62, 44, 28, 0.1);
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(62, 44, 28, 0.1);
  color: var(--muted);
  white-space: nowrap;
}

.switch-inline input {
  width: auto;
  margin: 0;
}

.status-badge {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(14, 138, 106, 0.14);
  border: 1px solid rgba(14, 138, 106, 0.32);
  color: var(--brand-strong);
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.closed {
  background: rgba(188, 95, 42, 0.14);
  border-color: rgba(188, 95, 42, 0.32);
  color: #9e4f22;
}

.status-badge.muted-badge {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(62, 44, 28, 0.12);
  color: var(--muted);
  font-weight: 600;
}

.status-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.inline-form,
.reply-form {
  display: flex;
  gap: 10px;
}

.inline-form {
  margin-top: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(62, 44, 28, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  padding: 13px 14px;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--brand), #26a37f);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.voice-button {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 12px 15px;
  font-size: 18px;
  line-height: 1;
  background: linear-gradient(135deg, var(--brand), #26a37f);
}

.emoji-picker-wrap {
  position: relative;
  align-self: flex-end;
}

.emoji-button {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 12px 14px;
  font-size: 18px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid rgba(62, 44, 28, 0.12);
}

.emoji-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: grid;
  grid-template-columns: repeat(5, minmax(36px, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(62, 44, 28, 0.12);
  background: rgba(255, 250, 243, 0.98);
  box-shadow: 0 10px 24px rgba(31, 27, 22, 0.14);
  z-index: 20;
}

.emoji-item {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  border: 1px solid rgba(62, 44, 28, 0.1);
  font-size: 20px;
  line-height: 1;
}

.voice-button.recording {
  background: linear-gradient(135deg, #d64545, #e26b6b);
  animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.5);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(214, 69, 69, 0);
  }
}

.voice-timer {
  align-self: flex-end;
  padding: 0 6px 14px 0;
  font-weight: 700;
  color: #d64545;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid rgba(62, 44, 28, 0.12);
}

.manager-list,
.conversation-list,
.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manager-list,
.conversation-list {
  margin-top: 14px;
  max-height: 340px;
  overflow: auto;
}

.manager-card,
.conversation-card,
.deal-card {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 18px;
  background: var(--panel-strong);
}

.manager-card {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.toggle input {
  width: auto;
}

.tab-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 0;
}

.tab-button {
  padding: 10px 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--brand), #26a37f);
  color: #fff;
  border-color: transparent;
}

.tab-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-pane[data-tab="kanban"] {
  overflow: hidden;
  gap: 18px;
  padding-bottom: 20px;
}

.kanban-header {
  flex-shrink: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
}

.inbox-panel {
  overflow-y: auto;
  min-height: 0;
}

.conversation-card {
  width: 100%;
  padding: 14px;
  text-align: left;
  background: var(--panel-strong);
  color: var(--text);
}

.conversation-card.active {
  outline: 2px solid rgba(14, 138, 106, 0.34);
}

.conversation-card.is-closed {
  opacity: 0.75;
}

.conversation-flags {
  margin-top: 6px;
  min-height: 20px;
}

.conversation-need-reply {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(220, 38, 38, 0.14);
  color: #8f1212;
  border: 1px solid rgba(220, 38, 38, 0.28);
}

.conversation-preview {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}

.chat-head {
  align-items: start;
}

.contact-name-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.contact-name-editor.hidden {
  display: none;
}

.contact-name-editor input {
  padding: 6px 10px;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
}

.contact-name-editor .ghost-button {
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assign-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assign-wrap select {
  min-width: 170px;
}

.ai-assistant-panel {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.64);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 42vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: max-height 0.25s ease;
}

.ai-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.ai-assistant-panel.collapsed {
  max-height: 56px;
  overflow: hidden;
}

.ai-assistant-panel.collapsed .ai-panel-body {
  display: none;
}

.ai-collapse-btn {
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  line-height: 1;
}

.ai-assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-assistant-head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.ai-assistant-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-assistant-controls select {
  min-width: 160px;
}

.ai-assistant-result {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  white-space: pre-wrap;
  font-size: 0.93rem;
}

.ai-reply-variants {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ai-variant {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-variant-title {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.ai-variant-text {
  white-space: pre-wrap;
  font-size: 0.94rem;
}

.ai-variant-translation {
  white-space: pre-wrap;
  font-size: 0.84rem;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(31, 27, 22, 0.05);
  border: 1px dashed rgba(62, 44, 28, 0.16);
}

.ai-insert-button {
  align-self: flex-end;
  padding: 8px 12px;
  border-radius: 10px;
}

.message-list {
  flex: 1;
  min-height: 0;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.message-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-item.outbound {
  align-items: flex-end;
}

.message-bubble {
  max-width: min(80%, 560px);
  padding: 12px 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(62, 44, 28, 0.08);
  white-space: pre-wrap;
}

.message-item.outbound .message-bubble {
  background: rgba(14, 138, 106, 0.12);
}

.media-ai-hint {
  margin-top: 6px;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(14, 138, 106, 0.24);
  background: rgba(14, 138, 106, 0.1);
  color: #0a6e55;
  font-size: 0.75rem;
  font-weight: 700;
}

.audio-transcript-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(31, 27, 22, 0.06);
  border: 1px solid rgba(62, 44, 28, 0.1);
  color: var(--text);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.audio-transcribe-button {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
}

.assignment-history {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.assignment-history h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.assignment-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 140px;
  overflow: auto;
}

.assignment-history-item {
  font-size: 0.9rem;
  color: var(--muted);
}

.history-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid rgba(62, 44, 28, 0.14);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 250, 243, 0.98);
}

.history-dialog::backdrop {
  background: rgba(23, 18, 12, 0.42);
}

.history-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.delete-manager-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.delete-warning {
  color: #9e4f22;
  font-weight: 700;
}

.delete-manager-actions {
  display: flex;
  justify-content: flex-end;
}

.delete-manager-actions button {
  background: linear-gradient(135deg, #b84a2d, #d96a42);
}

.deal-chat-dialog {
  width: min(920px, calc(100vw - 32px));
}

.deal-chat-dialog .history-dialog-head {
  align-items: flex-start;
}

.deal-chat-dialog-ai-panel {
  margin: 10px 0;
  max-height: 30vh;
}

.deal-task-panel {
  border: 1px solid rgba(62, 44, 28, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  margin: 8px 0 10px;
}

.deal-task-panel-head h4 {
  margin: 0 0 8px;
  font-size: 0.94rem;
}

.deal-task-create-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.deal-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.deal-task-item {
  border: 1px solid rgba(62, 44, 28, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.84);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.deal-task-item.done {
  opacity: 0.74;
}

.deal-task-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}

.deal-task-title {
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.deal-chat-dialog-assign-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.deal-chat-dialog-assign-row select {
  min-width: 220px;
}

.deal-chat-dialog-messages {
  min-height: 240px;
  max-height: 58vh;
  overflow-y: auto;
  border: 1px solid rgba(62, 44, 28, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deal-chat-dialog-reply {
  margin-top: 10px;
}

.deal-chat-dialog-reply textarea {
  min-height: 72px;
}

.empty-state {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-x;
  align-items: stretch;
  padding-bottom: 8px;
}

.kanban-column {
  height: 100%;
  min-height: 420px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  overflow: hidden;
}

.kanban-column-archive {
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.35);
  opacity: 0.92;
}

.kanban-column-archive .panel-head h2 {
  color: var(--muted);
  font-size: 0.95rem;
}

.kanban-column.drop-target {
  outline: 2px dashed rgba(14, 138, 106, 0.42);
}

.kanban-column .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding: 6px 0;
}

.deal-list {
  margin-top: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.deal-card {
  padding: 14px;
  cursor: grab;
}

.deal-open-button {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
}

.deal-footer {
  margin-top: 12px;
  font-size: 0.88rem;
}

.qr-wrap {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
}

.qr-wrap img {
  width: min(100%, 220px);
  aspect-ratio: 1;
  object-fit: contain;
}

.tab-pane[data-tab="rop"] {
  overflow: auto;
  padding-bottom: 20px;
}

.rop-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.rop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.rop-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.rop-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.rop-field input,
.rop-field select {
  min-width: 180px;
}

.rop-report {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 4px;
}

.rop-section {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.rop-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.rop-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.rop-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.rop-kpi-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

.rop-kpi-card strong {
  font-size: 1.2rem;
}

.rop-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rop-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.rop-manager-card {
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.rop-manager-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rop-score {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 138, 106, 0.14);
  color: #0b6f56;
  font-weight: 700;
  font-size: 0.85rem;
}

.rop-subtitle {
  margin: 10px 0 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.rop-coaching {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(14, 138, 106, 0.08);
}

.rop-issues .rop-list li {
  color: #8f1212;
}

.rop-risks .rop-list li {
  color: #9a3412;
}

.rop-wins .rop-list li,
.rop-reco .rop-list li {
  color: #0b6f56;
}

.rop-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.rop-chat-dialog {
  width: min(760px, calc(100vw - 32px));
}

.rop-chat-dialog-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.rop-chat-dialog .rop-chat-messages {
  max-height: min(60vh, 520px);
  min-height: 280px;
  margin-bottom: 12px;
}

.rop-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.rop-chat-message {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.rop-chat-message.user {
  align-self: flex-end;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.rop-chat-message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.rop-chat-message.loading {
  align-self: flex-start;
  color: var(--muted);
  font-style: italic;
}

.rop-chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.rop-chat-form textarea {
  flex: 1;
  min-height: 52px;
  resize: vertical;
}

.rop-chat-form button {
  flex-shrink: 0;
}

.hidden {
  display: none;
}

.error-text {
  min-height: 20px;
  margin-top: 12px;
  color: var(--warning);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .workspace {
    overflow: visible;
  }

  .tab-pane {
    min-height: auto;
    overflow: visible;
  }

  .chat-panel {
    height: 80vh;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .kanban-header,
  .panel {
    border-radius: 20px;
  }

  .inline-form,
  .reply-form,
  .toolbar,
  .panel-head,
  .ai-assistant-head,
  .ai-assistant-controls,
  .topbar,
  .kanban-header {
    flex-direction: column;
    align-items: stretch;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }
}

.admin-alert-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-alert-wrap select,
.admin-alert-wrap input {
  min-width: 160px;
}

.manager-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 12, 8, 0.92);
  backdrop-filter: blur(4px);
}

.manager-alert-overlay.hidden {
  display: none;
}

.manager-alert-card {
  width: min(900px, 100%);
  padding: 48px 40px;
  border-radius: 28px;
  background: linear-gradient(145deg, #fff8ef 0%, #f4e7d4 100%);
  border: 2px solid #d8c4a8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.manager-alert-message {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1.35;
  font-weight: 700;
  color: #2a1f14;
  white-space: pre-wrap;
  word-break: break-word;
}