:root {
  --bg: #071922;
  --panel: #0b2934;
  --panel-2: #0f3442;
  --panel-3: #123b4a;
  --text: #f7fbfd;
  --muted: #a7bcc4;
  --primary: #2086c2;
  --primary-2: #40b6f0;
  --danger: #a41e24;
  --ok: #34a853;
  --warning: #f4b400;
  --purple: #8b5cf6;
  --border: rgba(255,255,255,.12);
  --soft: rgba(255,255,255,.075);
  --shadow: 0 22px 60px rgba(0,0,0,.35);
  --radius: 22px;
  --wa-in: rgba(31, 52, 58, .98);
  --wa-out: rgba(0, 92, 75, .98);
  --wa-pattern:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.055) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 70% 40%, rgba(255,255,255,.04) 0 1px, transparent 1px 34px),
    radial-gradient(circle at 45% 80%, rgba(255,255,255,.035) 0 1px, transparent 1px 30px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Montserrat', Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(32,134,194,.25), transparent 34%), var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.home-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.home-card {
  width: min(820px, 100%);
  border: 1px solid var(--border);
  border-radius: 34px;
  padding: clamp(26px, 5vw, 54px);
  background: linear-gradient(145deg, rgba(11,41,52,.96), rgba(8,25,34,.98));
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
  position: relative;
}
.home-card::before {
  content: '';
  position: absolute;
  inset: -140px auto auto -140px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(32,134,194,.24);
  filter: blur(8px);
}
.logo-mark {
  width: 82px;
  height: 82px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 34px rgba(32,134,194,.28);
  font-size: 40px;
}
.logo-mark.small {
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 16px;
  font-size: 24px;
}
.eyebrow {
  display: inline-flex;
  border: 1px solid rgba(64,182,240,.28);
  background: rgba(32,134,194,.13);
  border-radius: 999px;
  padding: 8px 12px;
  color: #bde9ff;
  font-size: 12px;
  font-weight: 800;
}
.home-card h1 {
  margin: 18px 0 8px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -2px;
}
.home-card p {
  max-width: 680px;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.6;
}
.home-actions, .topbar-actions, .home-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.home-features { margin-top: 20px; color: #d9f5ff; font-size: 13px; font-weight: 800; }

.primary-btn, .soft-btn, .ghost-btn, .pill-btn, .mini-btn, .icon-btn, .send-btn, .composer-icon {
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  font-weight: 800;
  transition: .18s ease;
}
.primary-btn, .send-btn {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 26px rgba(32,134,194,.22);
  padding: 12px 18px;
}
.primary-btn:hover, .send-btn:hover, .soft-btn:hover, .pill-btn:hover, .ghost-btn:hover, .mini-btn:hover, .icon-btn:hover, .composer-icon:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.soft-btn, .ghost-btn, .pill-btn, .mini-btn, .icon-btn, .composer-icon {
  background: var(--soft);
  padding: 10px 13px;
}
.pill-btn.active {
  background: rgba(32,134,194,.22);
  border-color: rgba(64,182,240,.65);
  color: #bde9ff;
}
.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.topbar {
  min-height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(6,22,30,.88);
  backdrop-filter: blur(18px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h2 { margin: 0; font-size: 20px; }
.topbar-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  overflow: hidden;
}

.workspace {
  position: relative;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 16px;
  left: 366px;
  z-index: 20;
  width: 32px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 0 999px 999px 0;
  background: rgba(8,25,34,.96);
  color: #d9f5ff;
  font-size: 22px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px rgba(0,0,0,.28);
}

.sidebar-collapse-btn:hover {
  border-color: rgba(64,182,240,.7);
  background: rgba(32,134,194,.24);
}

.sidebar-collapsed-label {
  display: none;
}

.workspace.sidebar-collapsed {
  grid-template-columns: 58px minmax(0, 1fr);
}

.workspace.sidebar-collapsed .sidebar {
  padding: 8px;
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
}

.workspace.sidebar-collapsed .sidebar-card {
  display: none !important;
}

.workspace.sidebar-collapsed .sidebar-collapsed-label {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  color: #d9f5ff;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 13px;
}

.workspace.sidebar-collapsed .sidebar-collapsed-label span {
  font-size: 18px;
}

.workspace.sidebar-collapsed .sidebar-collapse-btn {
  left: 44px;
  border-radius: 999px 0 0 999px;
}
.sidebar {
  min-height: 0;
  padding: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  border-right: 1px solid var(--border);
  background: rgba(6,22,30,.76);
  overflow: hidden;
}
.sidebar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.045);
  box-shadow: 0 14px 30px rgba(0,0,0,.16);
}
.filters-card { padding: 14px; display: grid; gap: 12px; }

.filter-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: end;
}

.search-label {
  min-width: 0;
}

.funnel-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(32,134,194,.45);
  border-radius: 15px;
  background: rgba(255,255,255,.075);
  color: #d9f5ff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
  transition: .18s ease;
}

.funnel-btn svg {
  width: 23px;
  height: 23px;
  display: block;
  fill: currentColor;
  pointer-events: none;
}

.funnel-btn:hover,
.funnel-btn.active {
  background: rgba(32,134,194,.22);
  border-color: rgba(64,182,240,.85);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(32,134,194,.12);
}

.filters-accordion {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  animation: accordionIn .18s ease;
}

@keyframes accordionIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.list-card { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 14px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-title span { color: var(--muted); font-size: 12px; font-weight: 700; }
label {
  display: grid;
  gap: 7px;
  color: #dcebf0;
  font-size: 12px;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.075);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
}
select option { color: #111; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(32,134,194,.85);
  box-shadow: 0 0 0 4px rgba(32,134,194,.16);
}
.filter-grid, .period-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.full { grid-column: 1 / -1; }
.conversation-list {
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  padding-right: 4px;
}
.conversation-card {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 11px;
  color: var(--text);
  text-align: left;
}
.conversation-card.active { border-color: rgba(64,182,240,.85); background: rgba(32,134,194,.16); }
.conversation-card:hover { background: rgba(255,255,255,.09); }
.avatar, .client-photo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #89d7ff);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
  flex: 0 0 auto;
}
.avatar img, .client-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-main { min-width: 0; }
.card-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card-name { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-time { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.card-phone, .card-last { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mini-badge, .status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.status-sem { background: rgba(164,30,36,.85); color: white; }
.status-atendimento { background: rgba(32,134,194,.22); color: #7dd1ff; }
.status-negociacao { background: rgba(244,180,0,.22); color: #ffd86e; }
.status-finalizado { background: rgba(232,232,232,.92); color: #111; }
.tag-badge { background: rgba(139,92,246,.18); color: #ddd2ff; }
.unread-badge { background: var(--danger); color: #fff; min-width: 22px; justify-content: center; }

.chat-area {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #0b2d36;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.045);
}
.chat-client-info { min-width: 0; flex: 1; }
.chat-client-info h3 { margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-client-info p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }
.note-shortcut-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(244,180,0,.42);
  background: rgba(244,180,0,.14);
  color: #ffe8a6;
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(0,0,0,.16);
}
.note-shortcut-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(244,180,0,.78);
  background: rgba(244,180,0,.22);
}
.note-shortcut-btn:disabled { opacity: .45; cursor: not-allowed; }
.chat-accordions {
  display: grid;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.028);
  overflow: auto;
  max-height: clamp(150px, 28vh, 320px);
}
.client-tools-accordion,
.internal-note-accordion {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
  overflow: hidden;
}
.internal-note-accordion {
  border-color: rgba(244,180,0,.36);
  box-shadow: inset 0 0 0 1px rgba(244,180,0,.04);
}
.internal-note-accordion summary {
  background: linear-gradient(135deg, rgba(244,180,0,.14), rgba(255,255,255,.035));
}
.internal-note-accordion[open] summary {
  background: linear-gradient(135deg, rgba(244,180,0,.22), rgba(255,255,255,.055));
}
.client-tools-accordion summary,
.internal-note-accordion summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}
.client-tools-accordion summary::-webkit-details-marker,
.internal-note-accordion summary::-webkit-details-marker { display: none; }
.client-tools-accordion summary::after,
.internal-note-accordion summary::after {
  content: '▾';
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  transition: transform .18s ease;
  flex: 0 0 auto;
}
.client-tools-accordion[open] summary::after,
.internal-note-accordion[open] summary::after { transform: rotate(180deg); }
.client-tools-accordion[open],
.internal-note-accordion[open] { border-color: rgba(64,182,240,.5); }
.client-tools-accordion small,
.internal-note-accordion small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-tools-accordion summary span,
.internal-note-accordion summary span { white-space: nowrap; }
.client-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.035);
}
.internal-note-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(244,180,0,.055);
}
.note-help {
  grid-column: 1 / -1;
  color: #ffe8a6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  background: rgba(244,180,0,.09);
  border: 1px dashed rgba(244,180,0,.26);
  border-radius: 12px;
  padding: 8px 10px;
}
.internal-note-panel textarea {
  min-height: 68px;
  max-height: 130px;
  border-color: rgba(244,180,0,.24);
}
.compact-btn { min-height: 44px; white-space: nowrap; }
.messages-box {
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #0b2d36;
  background-image: linear-gradient(180deg, rgba(4,20,27,.10), rgba(4,20,27,.28)), var(--wa-pattern);
  scroll-behavior: smooth;
}
.empty-state { display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--text); margin: 0 0 6px; }
.message-row { display: flex; }
.message-row.in { justify-content: flex-start; }
.message-row.out { justify-content: flex-end; }
.message-row.internal { justify-content: center; }
.bubble {
  max-width: min(660px, 78%);
  position: relative;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.in .bubble { background: var(--wa-in); border-bottom-left-radius: 6px; }
.out .bubble { background: var(--wa-out); border-bottom-right-radius: 6px; }
.internal .bubble {
  max-width: min(820px, 88%);
  background: rgba(66, 48, 8, .92);
  border-color: rgba(244,180,0,.42);
  border-style: dashed;
  color: #fff6d7;
}
.internal-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(244,180,0,.35);
  border-radius: 999px;
  background: rgba(244,180,0,.18);
  color: #ffe49b;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 7px;
}
.bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
}
.bubble-text { white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.reply-preview-in-bubble {
  border-left: 4px solid rgba(64,182,240,.9);
  background: rgba(255,255,255,.075);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: #d7f4ff;
  font-size: 12px;
  font-weight: 700;
}
.bubble-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
  opacity: .75;
}
.action-mini {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.16);
  color: var(--text);
  border-radius: 999px;
  font-size: 11px;
  padding: 5px 8px;
}
.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}
.attachment-card img {
  width: 110px;
  height: 78px;
  object-fit: cover;
  border-radius: 12px;
}
.audio-demo {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.075);
  border-radius: 16px;
  padding: 9px 12px;
  margin-bottom: 8px;
}
.wave { flex: 1; height: 28px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 3px, transparent 3px 8px); border-radius: 999px; }
.composer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  background: rgba(11,41,52,.96);
  padding: 12px 18px;
  display: grid;
  gap: 10px;
}
.composer-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.composer-icon { width: 44px; height: 44px; padding: 0; font-size: 18px; }
textarea {
  min-height: 44px;
  max-height: 140px;
  resize: none;
}
.reply-bar, .attachment-preview, .emoji-panel, .quick-panel {
  border: 1px solid rgba(64,182,240,.35);
  border-radius: 16px;
  background: rgba(8,25,34,.86);
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}
.reply-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-left: 5px solid var(--primary-2);
}
.reply-bar strong { display: block; font-size: 12px; }
.reply-bar span { display: block; color: var(--muted); font-size: 12px; max-width: 820px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-preview { padding: 10px; color: #d7f4ff; font-size: 13px; font-weight: 700; }
.emoji-panel { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
.emoji-option {
  border: 0;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 20px;
}
.quick-panel { display: grid; gap: 6px; padding: 8px; }
.quick-option {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 10px;
  text-align: left;
}
.quick-option b { color: #bde9ff; }

.kanban-area {
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(11,45,54,.98), rgba(7,25,34,.96));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.kanban-header {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.kanban-header h3 { margin: 0; }
.kanban-header p { margin: 5px 0 0; color: var(--muted); }
.kanban-board {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}
.kanban-column {
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255,255,255,.045);
  overflow: hidden;
}
.kanban-column.drag-over { border-color: rgba(64,182,240,.9); box-shadow: 0 0 0 4px rgba(64,182,240,.12); }
.kanban-column-header {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.04);
}
.kanban-column-header strong { font-size: 14px; }
.kanban-items { display: grid; gap: 10px; padding: 12px; min-height: 210px; }
.kanban-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  background: rgba(6,22,30,.74);
  display: grid;
  gap: 8px;
  cursor: grab;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.kanban-card strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-card span, .kanban-card small { color: var(--muted); font-size: 12px; }

.modal {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: transparent;
  color: var(--text);
  padding: 0;
  overflow: hidden;
}
.small-modal { width: min(640px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
.modal-card {
  background: linear-gradient(145deg, rgba(11,41,52,.98), rgba(7,25,34,.98));
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: calc(100vh - 24px);
}
.small-modal .modal-card { grid-template-rows: auto minmax(0, 1fr); }
.modal-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header strong { display: block; font-size: 18px; }
.modal-header span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 900;
}
.admin-tab.active { background: rgba(32,134,194,.22); border-color: rgba(64,182,240,.7); }
.admin-content { overflow: auto; padding: 16px; }
.admin-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.entity-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,.045);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.entity-list { display: grid; gap: 10px; }
.entity-row {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.045);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.entity-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  max-width: 380px;
  padding: 12px 14px;
  border: 1px solid rgba(64,182,240,.45);
  border-radius: 16px;
  background: rgba(11,41,52,.98);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 330px minmax(0, 1fr); }
  .sidebar-collapse-btn { left: 316px; }
  .workspace.sidebar-collapsed { grid-template-columns: 58px minmax(0, 1fr); }
  .workspace.sidebar-collapsed .sidebar-collapse-btn { left: 44px; }
  .kanban-board { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
  .client-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .internal-note-panel { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .app { height: auto; min-height: 100vh; overflow: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { min-height: auto; grid-template-columns: 1fr; overflow: visible; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; overflow: visible; }
  .sidebar-collapse-btn { top: 10px; right: 12px; left: auto; width: 44px; height: 44px; border-radius: 14px; }
  .workspace.sidebar-collapsed { grid-template-columns: 1fr; }
  .workspace.sidebar-collapsed .sidebar { min-height: 58px; padding: 8px 64px 8px 10px; border-bottom: 1px solid var(--border); }
  .workspace.sidebar-collapsed .sidebar-collapse-btn { right: 12px; left: auto; border-radius: 14px; }
  .workspace.sidebar-collapsed .sidebar-collapsed-label { min-height: 42px; writing-mode: horizontal-tb; transform: none; grid-auto-flow: column; justify-content: start; padding: 0 14px; }
  .conversation-list { max-height: 360px; }
  .chat-area { height: 78vh; min-height: 640px; }
  .kanban-area { min-height: 720px; }
  .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .home-screen { padding: 14px; }
  .chat-header { align-items: flex-start; gap: 10px; padding: 11px 10px; }
  .chat-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .note-shortcut-btn { order: 3; width: 100%; min-height: 34px; padding: 7px 10px; border-radius: 14px; font-size: 12px; }
  .filter-grid, .period-fields, .client-tools, .form-grid-2, .internal-note-panel { grid-template-columns: 1fr; }
  .chat-accordions { padding: 8px 10px; max-height: 34vh; }
  .client-tools-accordion summary, .internal-note-accordion summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .composer-row { grid-template-columns: auto auto auto 1fr; }
  .send-btn { grid-column: 1 / -1; }
  .bubble { max-width: 94%; }
  .kanban-board { grid-template-columns: minmax(250px, 1fr); }
}
