:root {
  /* Hobuss Advocacia — sistema visual editorial/premium */
  --bg: #0a0c10;
  --bg2: #10141a;
  --bg-grad: #0a0c10;
  --surface: #141920;
  --surface-elev: #171d25;
  --surface2: #1b222b;
  --surface3: #252d37;
  --surface-hi: #2d3744;
  --border: #262e38;
  --border-strong: #343d48;
  --text: #edece7;
  --text2: #a8adb5;
  --text3: #737982;
  --text4: #525862;

  /* Accent — champagne + âmbar */
  --accent: #c9a773;
  --accent2: #dbbe90;
  --accent3: #a88551;
  --accent-glow: rgba(201, 167, 115, 0.18);
  --accent-soft: rgba(201, 167, 115, 0.08);
  --accent-grad: linear-gradient(135deg, #d4b886 0%, #c9a773 50%, #a88551 100%);

  /* Cores de apoio (status / categoria) */
  --blue: #6ba3d6;
  --blue-bg: rgba(107, 163, 214, 0.1);
  --blue-grad: linear-gradient(135deg, #7fb4e0 0%, #5a90c4 100%);
  --purple: #a78bc7;
  --purple-bg: rgba(167, 139, 199, 0.1);
  --teal: #6bbfa8;
  --teal-bg: rgba(107, 191, 168, 0.1);
  --danger: #e37171;
  --danger2: #c95555;
  --danger-bg: rgba(227, 113, 113, 0.1);
  --danger-grad: linear-gradient(135deg, #e88585 0%, #c95555 100%);
  --success: #72c48c;
  --success-bg: rgba(114, 196, 140, 0.1);
  --success-grad: linear-gradient(135deg, #85d19e 0%, #5bb076 100%);
  --warn: #e0b168;
  --warn-bg: rgba(224, 177, 104, 0.1);
  --warn-grad: linear-gradient(135deg, #edbf78 0%, #d19a4c 100%);

  /* Radius / spacing scale */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --sidebar-w: 264px;
  --contacts-w: 320px;

  /* Tipografia unificada — sans-serif moderna em todo o site
     (antes era Fraunces serif nos títulos, ficava ilegível em caixa alta) */
  --font-head: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Shadows (com cor) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-accent: 0 8px 24px -8px rgba(201, 167, 115, 0.35), 0 2px 6px rgba(201, 167, 115, 0.18);
  --shadow-danger: 0 8px 24px -8px rgba(227, 113, 113, 0.35);
  --shadow-success: 0 8px 24px -8px rgba(114, 196, 140, 0.35);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.03);

  --hairline: 1px solid var(--border);
  --hairline-strong: 1px solid var(--border-strong);
}

/* Modo claro — off-white editorial premium */
[data-theme="light"] {
  --bg: #f6f3ec;
  --bg2: #fbf9f4;
  --bg-grad: #f6f3ec;
  --surface: #ffffff;
  --surface-elev: #ffffff;
  --surface2: #f6f2e8;
  --surface3: #eae5d7;
  --surface-hi: #ddd6c2;
  --border: #dcd4c2;
  --border-strong: #c5bca6;
  --text: #14181d;
  --text2: #4e535c;
  --text3: #7e8490;
  --text4: #a0a5ad;

  --accent: #8f7443;
  --accent2: #a3844e;
  --accent3: #735a30;
  --accent-glow: rgba(143, 116, 67, 0.1);
  --accent-soft: rgba(143, 116, 67, 0.06);
  --accent-grad: linear-gradient(135deg, #a88650 0%, #8f7443 50%, #6f5728 100%);

  --blue: #3b6ea8;
  --blue-bg: rgba(59, 110, 168, 0.07);
  --blue-grad: linear-gradient(135deg, #4a7fbc 0%, #2d5890 100%);
  --purple: #6f52a0;
  --purple-bg: rgba(111, 82, 160, 0.07);
  --teal: #2d8b72;
  --teal-bg: rgba(45, 139, 114, 0.07);
  --danger: #a83a3a;
  --danger2: #8a2a2a;
  --danger-bg: rgba(168, 58, 58, 0.06);
  --danger-grad: linear-gradient(135deg, #b94a4a 0%, #8a2a2a 100%);
  --success: #2e7a4d;
  --success-bg: rgba(46, 122, 77, 0.06);
  --success-grad: linear-gradient(135deg, #3a8a5c 0%, #236640 100%);
  --warn: #936517;
  --warn-bg: rgba(147, 101, 23, 0.06);
  --warn-grad: linear-gradient(135deg, #a87524 0%, #7a5211 100%);

  --shadow-xs: 0 1px 2px rgba(20, 24, 29, 0.04);
  --shadow-sm: 0 2px 6px rgba(20, 24, 29, 0.06);
  --shadow: 0 4px 14px rgba(20, 24, 29, 0.06), 0 1px 2px rgba(20, 24, 29, 0.04);
  --shadow-md: 0 12px 32px -8px rgba(20, 24, 29, 0.12), 0 2px 6px rgba(20, 24, 29, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(20, 24, 29, 0.15), 0 6px 16px rgba(20, 24, 29, 0.06);
  --shadow-accent: 0 8px 24px -8px rgba(143, 116, 67, 0.3), 0 2px 6px rgba(143, 116, 67, 0.12);
  --shadow-danger: 0 8px 24px -8px rgba(168, 58, 58, 0.25);
  --shadow-success: 0 8px 24px -8px rgba(46, 122, 77, 0.25);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .mine .msg-content {
  color: #fff;
  background: var(--accent);
}

[data-theme="light"] .msg-day-divider span {
  background: var(--bg)
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%;
  overflow: hidden
}

body {
  font-family: var(--font-body);
  background: var(--bg-grad);
  color: var(--text);
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

/* Fraunces optical sizing + serif refinado */
h1, h2, h3, h4,
.logo-text,
.auth-form h1,
.contacts-header h2,
.chat-header-name,
.modal-header h3,
.sidebar-brand-name,
.recados-header h2,
.admin-header h2,
.inss-header h2 {
  font-variation-settings: "opsz" 112, "SOFT" 30;
  font-feature-settings: "ss01";
}

/* Scrollbars globais elegantes */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.15s;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: padding-box;
}

/* Seleção de texto */
::selection {
  background: var(--accent);
  color: #14181d;
}

/* Material Symbols helper */
.mi, .material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: inherit;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  vertical-align: middle;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
}
.mi.mi-sm { font-size: 16px; }
.mi.mi-md { font-size: 20px; }
.mi.mi-lg { font-size: 28px; }
.mi.mi-xl { font-size: 40px; }
.mi.mi-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

#app {
  height: 100vh;
  display: flex
}

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0
}

.screen.hidden {
  display: none !important
}

/* AUTH */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden
}


.auth-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 44px
}

.logo-mark {
  width: 48px;
  height: 48px;
  color: var(--accent);
  flex-shrink: 0
}

.logo-mark svg {
  width: 100%;
  height: 100%
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-text {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
  color: var(--text);
  line-height: 1.1;
}

.logo-sub {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text3);
}

.auth-footnote {
  text-align: center;
  color: var(--text3);
  font-size: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: var(--hairline);
}
.auth-footnote strong {
  color: var(--accent2);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 28px;
  box-shadow: var(--shadow);
  animation: slideUp .3s ease;
}

.auth-form.hidden {
  display: none !important
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.auth-form h1 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.5px;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-subtitle {
  color: var(--text2);
  font-size: 13.5px;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* FORMS */
.form-group {
  margin-bottom: 18px
}

.form-group label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  resize: vertical
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text3);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow)
}

.form-group select option {
  background: var(--surface2)
}

.input-eye {
  position: relative
}

.input-eye input {
  padding-right: 44px
}

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s
}

.eye-btn:hover {
  color: var(--text)
}

.eye-btn svg, .eye-btn .mi {
  width: 16px;
  height: 16px;
  font-size: 16px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #14181d;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.btn-primary svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 2;
}

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

.btn-primary:active {
  transform: scale(.98)
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.btn-secondary:hover {
  background: var(--surface2);
  border-color: var(--text3);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent2);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  transition: color .2s
}

.btn-link:hover {
  color: var(--text)
}

.btn-save-inline {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s
}

.btn-save-inline:hover {
  background: var(--accent2)
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  display: none
}

.error-msg:not(:empty) {
  display: block
}

.success-msg {
  color: var(--success);
  font-size: 13px;
  padding: 8px 12px;
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 12px
}

.success-msg.hidden {
  display: none
}

/* MAIN APP */
#main-app {
  display: flex;
  width: 100%;
  height: 100%
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border) 10%, var(--border) 90%, transparent);
  pointer-events: none;
}

.sidebar-header {
  padding: 22px 18px 20px;
  border-bottom: var(--hairline);
  position: relative;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--accent);
  position: relative;
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-brand-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16.5px;
  color: var(--text);
  letter-spacing: -.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.sidebar-brand-sub {
  display: none;
}

.sidebar-logo span:not([class]) {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  color: var(--text)
}

/* Seções da sidebar com label */
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text4);
  padding: 14px 16px 8px;
  margin-top: 4px;
}
.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 10px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s cubic-bezier(.4,0,.2,1);
  position: relative;
  text-align: left;
  letter-spacing: -.1px;
}

/* Ícone em "chip" colorido por categoria */
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
  padding: 7px;
  width: 30px;
  height: 30px;
  box-sizing: content-box;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  color: var(--text2);
  transition: all .15s;
}
.nav-item[data-tab="chat"] svg { color: var(--blue); background: var(--blue-bg); }
.nav-item[data-tab="recados"] svg { color: var(--warn); background: var(--warn-bg); }
.nav-item[data-tab="pessoal"] svg { color: var(--purple); background: var(--purple-bg); }
.nav-item[data-tab="profile"] svg { color: var(--purple); background: var(--purple-bg); }
.nav-item[data-tab="inss"] svg { color: var(--teal); background: var(--teal-bg); }
.nav-item[data-tab="publicacoes"] svg { color: var(--accent); background: var(--accent-soft); }
.nav-item[data-tab="admin"] svg { color: var(--danger); background: var(--danger-bg); }

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}
.nav-item:hover svg {
  transform: scale(1.05);
}

.nav-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item .badge {
  margin-left: auto;
}

.badge {
  background: var(--danger);
  color: #fff;
  border-radius: 20px;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge.hidden {
  display: none
}

.sidebar-footer {
  padding: 10px 12px 12px;
  border-top: var(--hairline);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
  position: relative;
  background: linear-gradient(to top, var(--surface), transparent);
}

.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
  padding: 7px 8px;
  border-radius: var(--radius);
  transition: background .15s, transform .1s;
  min-width: 0;
  border: 1px solid transparent;
}

.current-user:hover {
  background: var(--surface2);
  border-color: var(--border);
}

.user-info-sm {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.user-info-sm span:first-child {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  letter-spacing: -.15px;
}

.user-role-badge {
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: all .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger);
  transform: translateY(-1px);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
  display: block
}

/* AVATARS */
.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-glow)
}

.user-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.user-avatar-md {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface3), var(--surface2));
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs), var(--shadow-inset);
  position: relative;
}
.contact-item:hover .user-avatar-md {
  border-color: var(--accent);
}

.user-avatar-md img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

/* CONTENT */
.content-area {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative
}

.tab-content {
  width: 100%;
  height: 100%;
  overflow: hidden
}

.tab-content.hidden {
  display: none !important
}

/* CHAT LAYOUT */
.chat-layout {
  display: flex;
  height: 100%
}

.contacts-panel {
  width: var(--contacts-w);
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  flex-shrink: 0
}

.contacts-header {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border)
}

.contacts-header h2 {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -.3px;
  color: var(--text);
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
}

.icon-btn:hover {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 15px;
  height: 15px
}
.icon-btn .mi { font-size: 17px; }

/* Variante danger — usada em admin actions (limpar conversa, etc) */
.icon-btn.icon-btn-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.search-box {
  margin: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  transition: all .15s;
  box-shadow: var(--shadow-xs);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
  width: 14px;
  height: 14px;
  color: var(--text3);
  flex-shrink: 0
}

.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px 0;
  outline: none;
  width: 100%;
}
.search-box input::placeholder { color: var(--text3); }

.search-box input::placeholder {
  color: var(--text3)
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 10px;
}

.contact-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, transform .1s;
  position: relative;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.contact-item:hover {
  background: var(--surface);
  border-color: var(--border);
}

.contact-item.active {
  background: var(--surface2);
  border-color: var(--border);
}
.contact-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.contact-item.pinned .contact-name::after {
  content: '📌';
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.6;
}

.contact-item.has-unread {
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
}

.contact-item.has-unread .contact-name {
  font-weight: 700;
  color: var(--text);
}
.contact-item.has-unread .contact-preview {
  color: var(--text2);
  font-weight: 500;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #14181d;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 6px;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0
}

.contact-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  letter-spacing: -.15px;
}

.contact-preview {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* CHAT WINDOW */
.chat-window {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  gap: 6px;
  padding: 40px;
  text-align: center;
}
.chat-empty-state h3 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.2px;
  color: var(--text2);
  margin: 0;
}
.chat-empty-state p {
  font-size: 13px;
  color: var(--text3);
  margin: 0;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: var(--hairline);
  background: var(--bg2);
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-header-info {
  flex: 1;
  min-width: 0
}

.chat-header-name {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.25px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.chat-header-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}

.chat-header-actions {
  display: flex;
  gap: 6px
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  background: var(--bg);
}

.chat-messages::-webkit-scrollbar {
  width: 4px
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 4px
}

.msg-day-divider {
  text-align: center;
  color: var(--text3);
  font-size: 11px;
  padding: 8px 0;
  position: relative
}

.msg-day-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border)
}

.msg-day-divider span {
  background: var(--bg);
  padding: 0 12px;
  position: relative
}

.msg-bubble {
  display: flex;
  flex-direction: column;
  max-width: 65%;
  gap: 2px
}

.msg-bubble.mine {
  align-self: flex-end;
  align-items: flex-end
}

.msg-bubble.theirs {
  align-self: flex-start
}

.msg-sender-name {
  font-size: 11px;
  color: var(--text3);
  padding: 0 10px
}

.msg-content {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.mine .msg-content {
  background: var(--accent);
  color: #14181d;
  border-bottom-right-radius: 4px;
}

.theirs .msg-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-meta {
  font-size: 10px;
  color: var(--text3);
  padding: 0 4px
}

.chat-input-area {
  padding: 14px 20px 18px;
  border-top: var(--hairline);
  background: var(--bg2);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input-area textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 18px;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: all .2s;
  box-shadow: var(--shadow-xs);
}

.chat-input-area textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-xs);
}

.chat-input-area textarea::placeholder {
  color: var(--text3)
}

.send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}

.send-btn:hover {
  background: var(--accent2);
}

.send-btn:active {
  transform: scale(.95)
}

.send-btn svg {
  width: 18px;
  height: 18px;
  color: #14181d;
  stroke-width: 2.4;
}

/* RECADOS */
.recados-layout {
  height: 100%;
  overflow-y: auto;
  padding: 36px 40px;
  max-width: 100%;
}
@media (max-width: 768px) {
  .recados-layout { padding: 18px 14px 24px; }
  .recados-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  .recados-header h2 { font-size: 22px; }
  .recados-header .btn-primary { width: 100%; justify-content: center; }
  .recado-card { padding: 16px 18px; }
  .recado-card-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .recado-title { font-size: 16px; }
  .recado-info { font-size: 11px; }
}

.recados-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: var(--hairline);
  max-width: 900px;
  gap: 20px;
  flex-wrap: wrap;
}
.recados-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.recados-header h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.3px;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text3);
  margin: 0;
  line-height: 1.5;
  max-width: 520px;
}

.recados-header .btn-primary {
  width: auto;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.recados-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
}

.recado-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  animation: slideUp .25s ease;
  transition: border-color .15s;
}

.recado-card:hover {
  border-color: var(--border-strong);
}

.recado-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.recado-card-meta {
  flex: 1;
  min-width: 0;
}

.recado-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.3px;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.25;
}

.recado-info {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recado-info > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.recado-info > span:not(:last-child)::after {
  content: '•';
  margin-left: 6px;
  color: var(--text4);
  font-size: 8px;
}

.recado-body {
  font-size: 14.5px;
  color: var(--text2);
  line-height: 1.7;
  white-space: pre-wrap;
  padding-top: 14px;
  border-top: var(--hairline);
  margin-top: 4px;
}

.recado-dest-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent2);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: .8px;
  text-transform: uppercase;
  border: 1px solid var(--accent-glow);
}

/* PROFILE — modal */
.modal-profile-wrap {
  max-width: 640px !important;
  padding: 0 !important;
  /* Mantém scroll quando o conteúdo (avatar + bio + senha) ultrapassa a altura */
  max-height: 92vh;
  overflow-y: auto !important;
  overflow-x: hidden;
}
.modal-profile-wrap .profile-card {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
.profile-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.profile-modal-close:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.05);
}
.profile-modal-close .mi { font-size: 18px; }

/* PROFILE core */
.profile-card {
  max-width: 780px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.profile-cover {
  height: 140px;
  background:
    radial-gradient(circle at 30% 50%, rgba(193,154,78,0.25), transparent 60%),
    linear-gradient(135deg, #2a2520 0%, #1a1f27 100%);
  position: relative;
  overflow: hidden;
}

.profile-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 28px 22px;
  margin-top: -55px;
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0
}

.profile-avatar-big {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 5px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35)
}

.profile-avatar-big img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s
}

.avatar-upload-btn:hover {
  background: var(--accent2)
}

.avatar-upload-btn svg {
  width: 12px;
  height: 12px;
  color: #fff
}

.profile-names {
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.profile-names h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.4px;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.username-tag {
  font-size: 12px;
  color: var(--text2);
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: .3px;
}

.role-tag {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(193, 154, 78, 0.2)
}

.profile-fields {
  padding: 24px 28px 28px;
}

.profile-section {
  margin-bottom: 28px
}
.profile-section:last-child { margin-bottom: 0; }

.profile-section h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-section h3 .mi {
  font-size: 16px;
  color: var(--accent);
}

.profile-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.inline-edit {
  display: flex;
  gap: 10px;
  align-items: flex-start
}

.inline-edit input,
.inline-edit textarea {
  flex: 1
}

/* ADMIN */
.admin-layout {
  height: 100%;
  overflow-y: auto;
  padding: 36px 40px;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: var(--hairline);
  max-width: 960px;
  gap: 20px;
  flex-wrap: wrap;
}
.admin-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.admin-header h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.3px;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.admin-header .btn-primary {
  width: auto;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

/* ── Admin Stats Cards ───────────────────────────── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 960px;
  margin-bottom: 24px;
}
.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.admin-stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.admin-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-stat-icon .mi {
  font-size: 22px;
}
.admin-stat-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.admin-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.admin-stat-label {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
}

/* ── Admin Toolbar (Search + Filters) ────────────── */
.admin-toolbar {
  max-width: 960px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  transition: border-color .2s, box-shadow .2s;
}
.admin-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.admin-search-wrap > svg {
  width: 18px;
  height: 18px;
  color: var(--text3);
  flex-shrink: 0;
}
.admin-search-wrap input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  padding: 12px 0;
  outline: none;
}
.admin-search-wrap input::placeholder {
  color: var(--text3);
}
.admin-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.admin-search-clear:hover {
  background: var(--surface2);
  color: var(--text);
}
.admin-search-clear svg {
  width: 14px;
  height: 14px;
}
.admin-search-clear.hidden { display: none; }

/* Filter chips */
.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: -.1px;
}
.admin-filter-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface2);
  color: var(--text);
}
.admin-filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.admin-filter-chip.active .filter-dot {
  background: rgba(255,255,255,.8) !important;
}
.filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.filter-dot.active-dot { background: var(--success); }
.filter-dot.disabled-dot { background: #dc2626; }
.filter-dot.pending-dot { background: var(--warn); }
.filter-dot.admin-dot { background: var(--purple); }

/* Results bar */
.admin-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin-bottom: 12px;
  padding: 0 2px;
}
.admin-results-bar span {
  font-size: 12.5px;
  color: var(--text3);
  font-weight: 500;
}
.admin-results-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 12px;
  font-family: var(--font-body);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.admin-results-bar select:focus {
  border-color: var(--accent);
}

/* Empty state */
.admin-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 8px;
  max-width: 960px;
}
.admin-empty-state.hidden { display: none; }
.admin-empty-state p {
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  margin: 0;
}
.admin-empty-state span {
  font-size: 13px;
  color: var(--text3);
}

/* ── Admin Tabs ──────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: var(--hairline);
  margin-bottom: 24px;
  max-width: 960px;
}

.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all .15s;
  letter-spacing: -.1px;
}

.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-tab:hover:not(.active) {
  color: var(--text);
}

.admin-panel.hidden {
  display: none
}

/* ── User List & Rows ────────────────────────────── */
.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 960px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* Status indicator dot on the avatar */
.admin-user-row .user-status-dot {
  position: absolute;
  top: 14px;
  left: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  z-index: 1;
}
.admin-user-row .user-status-dot.status-active { background: var(--success); }
.admin-user-row .user-status-dot.status-disabled { background: #dc2626; }
.admin-user-row .user-status-dot.status-pending { background: var(--warn); }

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .admin-stat-card {
    padding: 12px 14px;
  }
  .admin-stat-value { font-size: 18px; }
  .admin-stat-icon { width: 36px; height: 36px; }
  .admin-stat-icon .mi { font-size: 18px; }
  .admin-user-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    padding: 14px 16px;
    align-items: center;
  }
  .admin-user-row > .user-avatar-md { grid-row: 1; grid-column: 1; }
  .admin-user-row > .admin-user-info { grid-row: 1; grid-column: 2; min-width: 0; }
  .admin-user-row > .admin-user-info .admin-user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-user-row > .admin-user-actions { grid-row: 1; grid-column: 3; }
  .admin-user-row > .admin-user-badges {
    grid-row: 2;
    grid-column: 1 / -1;
    padding-top: 6px;
    border-top: var(--hairline);
    margin-top: 2px;
  }
  .admin-user-row .user-status-dot {
    top: 12px;
    left: 13px;
    width: 9px;
    height: 9px;
  }
  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-header h2 { font-size: 22px; }
  .admin-header-left { gap: 2px; }
  .admin-header .btn-primary { width: 100%; justify-content: center; }
  .admin-filters { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .admin-filters::-webkit-scrollbar { display: none; }
}

.admin-user-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.admin-user-info {
  flex: 1;
  min-width: 0
}

.admin-user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.15px;
}

.admin-user-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}

.admin-user-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.admin-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  letter-spacing: .5px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tag-admin {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: rgba(167, 139, 199, 0.2);
}

.tag-user {
  background: var(--surface2);
  color: var(--text3);
  border-color: var(--border);
}

.tag-recados {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(114, 196, 140, 0.25);
}

.tag-inss {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: rgba(107, 191, 168, 0.25);
}

.tag-pending {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: rgba(224, 177, 104, 0.25);
}


/* ================================================================
   Cargos e permissões
   ================================================================ */
.cargos-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: var(--hairline);
  max-width: 900px;
}
.cargos-header h3 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.2px;
  margin: 0 0 3px;
  color: var(--text);
}
.cargos-header p {
  font-size: 13px;
  color: var(--text3);
  margin: 0;
  line-height: 1.5;
}
.cargos-header .btn-primary {
  width: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.cargos-header .btn-primary .mi { font-size: 16px; }

.cargos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 900px;
}

.cargo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: border-color .12s;
}
.cargo-card:hover { border-color: var(--border-strong); }

.cargo-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.cargo-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cargo-card-nome {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.2px;
  color: var(--text);
}
.cargo-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.cargo-tag-admin { background: var(--purple-bg); color: var(--purple); border-color: rgba(167,139,199,.25); }
.cargo-tag-protegido { background: var(--surface2); color: var(--text3); border-color: var(--border); }

.cargo-card-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cargo-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.cargo-card-sem-perms {
  font-size: 11.5px;
  color: var(--text3);
  font-style: italic;
}
.cargo-card-count {
  font-size: 11.5px;
  color: var(--text3);
}
.cargo-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.cargo-card-actions .btn-icon-sm .mi { font-size: 16px; }

.cargo-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 13.5px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
}

/* Modal de cargo */
.cargo-permissoes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cargo-perm-row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s;
}
.cargo-perm-row:hover { border-color: var(--border-strong); }
.cargo-perm-row input[type=checkbox] {
  margin-top: 3px;
  accent-color: var(--accent);
  cursor: pointer;
}
.cargo-perm-row input[type=checkbox]:disabled { cursor: not-allowed; opacity: 0.5; }
.cargo-perm-info { display: flex; flex-direction: column; gap: 2px; }
.cargo-perm-label { font-size: 13px; font-weight: 600; color: var(--text); }
.cargo-perm-desc { font-size: 11.5px; color: var(--text3); line-height: 1.4; }

.cargo-aviso {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--warn-bg);
  border: 1px solid rgba(224, 177, 104, 0.3);
  color: var(--warn);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}
.cargo-btn-danger {
  color: var(--danger) !important;
  border-color: var(--danger) !important;
  margin-right: auto !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cargo-btn-danger:hover { background: var(--danger-bg) !important; }
.cargo-btn-danger .mi { font-size: 15px; }

/* Modal de usuário — preview de permissões do cargo */
.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin: 6px 0 0;
  font-style: italic;
}
.user-perms-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 38px;
  align-items: center;
  margin-bottom: 12px;
}
.user-perms-none {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
}
.perm-custom-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 12.5px;
  color: var(--text2);
  cursor: pointer;
}
.perm-custom-toggle input[type=checkbox] {
  accent-color: var(--accent);
  cursor: pointer;
}

.admin-user-actions {
  display: flex;
  gap: 6px
}

.btn-icon-sm {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s
}

.btn-icon-sm:hover {
  background: var(--surface3);
  color: var(--text)
}

.btn-icon-sm.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger)
}

.btn-icon-sm svg {
  width: 13px;
  height: 13px
}

.roles-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px
}

.role-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px
}

.role-summary-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px
}

.role-summary-count {
  font-size: 12px;
  color: var(--text3)
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease
}

.modal-overlay.hidden {
  display: none
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}

.modal.modal-lg {
  max-width: 620px
}

.modal.modal-sm {
  max-width: 380px
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: var(--hairline);
}

.modal-header h3 {
  font-family: var(--font-head);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.3px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface2)
}

.modal-close svg {
  width: 18px;
  height: 18px;
  display: block
}

.modal-body {
  padding: 24px 28px 8px;
}

.modal-footer {
  padding: 18px 28px 24px;
  border-top: var(--hairline);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--bg2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto
}

.permissions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px
}

.form-group label.perm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  text-transform: none;
  margin-bottom: 0;
  letter-spacing: normal;
}

.form-group label.perm-check input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin: 0;
}

.recipient-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all .15s;
}

.form-group label.radio-option {
  display: flex;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
}

.radio-option:hover {
  background: var(--surface3);
  border-color: var(--accent)
}

.form-group label.radio-option input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
}

.radio-option span {
  font-weight: 500
}

.recipients-checkboxes,
.members-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent
}

.recipients-checkboxes label,
.members-checklist label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: all .15s;
  color: var(--text)
}

.form-group .recipients-checkboxes label,
.form-group .members-checklist label {
  display: flex;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
}

.form-group .recipients-checkboxes label input,
.form-group .members-checklist label input {
  margin: 0;
}

.recipients-checkboxes label:hover,
.members-checklist label:hover {
  background: var(--surface3)
}

.recipients-checkboxes input,
.members-checklist input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer
}

/* CONTEXT MENU */
.ctx-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 2000;
  min-width: 160px;
  padding: 4px;
  animation: fadeIn .1s ease
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .1s
}

.ctx-item:hover {
  background: var(--surface2)
}

.ctx-item.danger {
  color: var(--danger)
}

.ctx-item.danger:hover {
  background: var(--danger-bg)
}

.ctx-item svg {
  width: 14px;
  height: 14px
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow);
  animation: slideUp .25s ease
}

.toast.hidden {
  display: none
}

.toast.success {
  border-color: var(--success);
  color: var(--success)
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger)
}

/* LOADING */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center
}

.loading-overlay.hidden {
  display: none
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text2);
  font-size: 14px
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite
}

.spinner.large {
  width: 40px;
  height: 40px
}

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

.loading-contacts {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--text3);
  font-size: 13px
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent
}

/* Theme toggle */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

/* Mobile chat back button */
.chat-back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  flex-shrink: 0
}

.chat-back-btn:hover {
  color: var(--text);
  background: var(--surface2)
}

.chat-back-btn svg {
  width: 20px;
  height: 20px;
  display: block
}

/* Notification Bell */
.notif-bell-wrap {
  position: relative
}

.notif-bell-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: all .15s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-bell-btn:hover {
  color: var(--accent);
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.notif-bell-btn svg {
  width: 20px;
  height: 20px
}

.notif-bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  border: 2px solid var(--bg2);
}

.notif-bell-badge.hidden {
  display: none
}

.notif-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 340px;
  max-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}

.notif-dropdown.hidden {
  display: none
}

.notif-dropdown-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px
}

.notif-dropdown-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent)
}

.notif-dropdown-list {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border)
}

.notif-item:last-child {
  border-bottom: none
}

.notif-item:hover {
  background: var(--surface2)
}

.notif-item .notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px
}

.notif-icon.chat-notif {
  background: var(--accent-glow);
  color: var(--accent)
}

.notif-icon.recado-notif {
  background: var(--success-bg);
  color: var(--success)
}

.notif-item .notif-text {
  flex: 1;
  min-width: 0
}

.notif-text-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.notif-text-preview {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text3);
  font-size: 13px
}

/* In-app notification toast (floating) */
.notif-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  animation: slideInRight .3s ease;
  transition: opacity .3s, transform .3s
}

.notif-toast.hiding {
  opacity: 0;
  transform: translateX(100px)
}

.notif-toast.hidden {
  display: none
}

.notif-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px
}

.notif-toast-body {
  flex: 1;
  min-width: 0
}

.notif-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text)
}

.notif-toast-msg {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px
}

.notif-toast-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0
}

.notif-toast-close:hover {
  color: var(--text)
}

.notif-toast-close svg {
  width: 14px;
  height: 14px
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

/* Desktop: topbar mobile escondida */
.mobile-topbar { display: none; }
.mobile-avatar-btn { display: none; }

@media(max-width:768px) {
  :root {
    --sidebar-w: 0px;
    --contacts-w: 100%
  }

  /* Topbar mobile — logo + notif + avatar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--bg2);
    border-bottom: var(--hairline);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    min-width: 0;
  }
  .mobile-topbar-brand svg {
    width: 26px; height: 26px;
    flex-shrink: 0;
  }
  .mobile-topbar-brand span {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -.2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .mobile-avatar-btn {
    display: inline-flex;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    transition: border-color .12s;
  }
  .mobile-avatar-btn:hover { border-color: var(--accent); }
  .mobile-topbar-actions .notif-bell-btn {
    padding: 6px;
    width: 36px;
    height: 36px;
  }

  /* Sidebar vira bottom tab bar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: var(--hairline);
    z-index: 150;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg2);
  }
  .sidebar::before { display: none; }

  .sidebar-header, .sidebar-footer { display: none; }
  /* Desktop notif bell fica no footer da sidebar; mobile usa do topbar */
  #notif-bell-desktop { display: none; }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    padding: 2px 4px;
    gap: 0;
    align-items: stretch;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    /* distribui uniforme quando cabe; quando não cabe, os itens encolhem via flex: 1 1 0 */
    justify-content: space-between;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-section-label { display: none; }

  .nav-item {
    position: relative;
    flex-direction: column;
    gap: 3px;
    padding: 6px 3px 5px;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    border-radius: var(--radius-sm);
    color: var(--text3);
  }
  .nav-item svg {
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    background: none !important;
    color: inherit !important;
    border-radius: 0;
    box-sizing: border-box;
    stroke-width: 2;
  }
  .nav-item span:not(.badge) {
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 2px;
  }
  /* Mostra versão abreviada (data-short) em mobile pra caber */
  .nav-item span[data-short] {
    font-size: 0;
  }
  .nav-item span[data-short]::before {
    content: attr(data-short);
    font-size: 9.5px;
  }
  .nav-item:active { background: var(--surface); }
  .nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }
  .nav-item.active svg { color: var(--accent) !important; }
  .nav-item.active::before {
    left: 50%;
    top: 1px;
    bottom: auto;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent);
    box-shadow: none;
    border-radius: 0 0 2px 2px;
  }
  .nav-item .badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    margin-left: 0;
    min-width: 13px;
    height: 13px;
    font-size: 8.5px;
    padding: 0 3px;
  }

  #app { flex-direction: column; }

  #main-app {
    flex-direction: column;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }

  .content-area {
    height: auto;
    flex: 1;
    min-height: 0;
    overflow: auto;
  }

  .chat-layout {
    flex-direction: column;
    position: relative
  }

  .contacts-panel {
    width: 100%;
    height: 100%;
    border-right: none
  }

  .contacts-panel.mobile-hidden {
    display: none
  }

  .chat-window {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: none
  }

  .chat-window.mobile-active {
    display: flex
  }

  .chat-back-btn {
    display: flex
  }

  .chat-empty-state {
    display: none
  }

  .modal {
    max-width: 95vw
  }

  .recados-layout,
  .profile-layout,
  .admin-layout {
    padding: 16px
  }

  .auth-container {
    padding: 12px
  }

  .profile-avatar-area {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 16px 16px
  }

  .profile-names {
    text-align: center
  }

  .profile-fields {
    padding: 16px
  }

  /* No mobile: dropdown do sino do topbar abre PRA BAIXO (não pra cima) */
  #notif-bell-mobile .notif-dropdown {
    top: calc(100% + 8px);
    bottom: auto;
    right: 0;
    left: auto;
    width: calc(100vw - 24px);
    max-width: 340px;
  }
  #notif-bell-desktop .notif-dropdown {
    left: 0;
    right: auto;
    width: 290px;
  }

  .notif-toast {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto
  }
}

/* Chat Media & Forwarding Styles */
.msg-bubble {
  position: relative;
}
.msg-forward-badge {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-style: italic;
  opacity: 0.8;
}
.mine .msg-forward-badge {
  color: rgba(255, 255, 255, 0.8);
}
.msg-forward-badge svg {
  width: 12px;
  height: 12px;
}
.msg-image {
  max-width: 250px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
  display: block;
}
.msg-audio {
  height: 36px;
  max-width: 250px;
  margin-top: 4px;
  border-radius: 18px;
  outline: none;
}
.msg-file-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 4px;
  color: var(--text);
  text-decoration: none;
}
.mine .msg-file-wrap {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.msg-file-icon {
  background: var(--surface2);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.mine .msg-file-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.msg-file-icon svg {
  width: 16px;
  height: 16px;
}
.msg-file-info {
  display: flex;
  flex-direction: column;
}
.msg-file-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-file-dl {
  font-size: 11px;
  opacity: 0.65;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.msg-file-dl svg { width: 11px; height: 11px; }
.msg-image-wrap {
  position: relative;
  display: inline-block;
}
.msg-download-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.msg-image-wrap:hover .msg-download-btn { opacity: 1; }
.msg-download-btn svg { width: 14px; height: 14px; }
.msg-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.mine .msg-actions {
  right: calc(100% + 4px);
}
.theirs .msg-actions {
  left: calc(100% + 4px);
}
.msg-bubble:hover .msg-actions {
  opacity: 1;
}
.msg-action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}
.msg-action-btn:hover {
  background: var(--surface3);
  color: var(--text);
}
.msg-action-btn svg {
  width: 12px;
  height: 12px;
}
.chat-input-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-right: 4px;
}
.chat-action-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-action-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.chat-action-btn svg {
  width: 18px;
  height: 18px;
}
.chat-action-btn.recording {
  color: var(--danger);
  animation: pulseRecording 1.5s infinite ease-in-out;
}
@keyframes pulseRecording {
  0% { transform: scale(1); background: transparent; }
  50% { transform: scale(1.1); background: rgba(239, 68, 68, 0.1); }
  100% { transform: scale(1); background: transparent; }
}

.contact-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.mute-icon {
  color: var(--text3);
  opacity: 0.6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.mute-icon svg {
  width: 12px;
  height: 12px;
}
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  flex: 1;
}
.recording-indicator span.dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0; }
}
.recording-actions {
  display: flex;
  gap: 6px;
}

.audio-preview-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
}

.audio-preview-panel audio {
  height: 32px;
  flex: 1;
  outline: none;
}

.btn-icon {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 8px;
  border-radius: 50%;
  color: var(--text);
}

.btn-icon:hover {
  background: var(--surface2);
}

.btn-icon.danger {
  color: var(--danger);
}
.btn-icon.danger:hover {
  background: var(--danger-bg);
}

.btn-icon.success {
  background: var(--accent);
  color: white;
}
.btn-icon.success:hover {
  background: var(--accent2);
}

/* ── Reply System ─────────────────────────────────── */
.chat-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.chat-input-wrapper #msg-input {
  width: 100%;
  resize: none;
}
.chat-share-target-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  font-size: 11.5px;
}
.chat-share-target-bar .mi { font-size: 15px; color: var(--accent); }
.chat-share-target-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-share-target-send,
.chat-share-target-cancel {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px 8px;
}
.chat-share-target-cancel {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-reply-bar {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  transition: all 0.2s ease;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.chat-reply-bar.hidden {
  display: none;
}
.reply-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 6px 10px;
}
.reply-bar-accent {
  width: 3px;
  min-height: 28px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}
.reply-bar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.reply-bar-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.reply-bar-text {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.reply-bar-close:hover {
  background: var(--surface3);
  color: var(--danger);
}

/* Bloco de citação dentro do balão */
.msg-reply-quote {
  background: rgba(0,0,0,0.12);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 5px 9px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: background 0.15s;
  max-width: 100%;
}
.msg-bubble.mine .msg-reply-quote {
  background: rgba(0,0,0,0.15);
}
.msg-reply-quote:hover {
  background: rgba(0,0,0,0.2);
}
.msg-reply-quote-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.msg-reply-quote-text {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flash de destaque ao clicar na citação */
@keyframes msgHighlight {
  0%   { box-shadow: 0 0 0 3px var(--accent); background: rgba(var(--accent-rgb, 99,102,241), 0.18); }
  80%  { box-shadow: 0 0 0 3px var(--accent); background: rgba(var(--accent-rgb, 99,102,241), 0.10); }
  100% { box-shadow: none; background: transparent; }
}
.msg-bubble.msg-highlight {
  animation: msgHighlight 1.5s ease forwards;
  border-radius: var(--radius);
}
/* ================================================================
   AUDITORIA ADMIN + DISABLED USERS + SOFT DELETE
   ================================================================ */

/* Linha de admin para usuário desabilitado */
.admin-row.user-disabled,
tr.user-disabled {
  opacity: 0.55;
  background: rgba(220, 38, 38, 0.04);
}
.admin-row.user-disabled td {
  text-decoration: line-through;
  text-decoration-color: rgba(220, 38, 38, 0.5);
}

/* Tag/badge de status disabled */
.tag-disabled {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Badge dashboard (admin) */
.tag-dash {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Botões de ação pequenos (warn) */
.btn-icon-sm.warn {
  color: #d97706;
}
.btn-icon-sm.warn:hover {
  background: rgba(217, 119, 6, 0.12);
}
.btn-icon-sm.danger {
  color: #dc2626;
}
.btn-icon-sm.danger:hover {
  background: rgba(220, 38, 38, 0.12);
}

/* ===== Modal: lista de conversas (auditoria) ===== */
.audit-lgpd-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.audit-lgpd-notice .mi {
  color: #f59e0b;
  flex-shrink: 0;
}

.user-chats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.user-chats-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2, rgba(0,0,0,0.03));
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
  color: var(--text);
}
.user-chats-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}
.user-chats-item-name {
  font-size: 14px;
  color: var(--text);
}
.user-chats-item-meta {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  word-break: break-word;
}
.user-chats-item-date {
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
  margin-top: 2px;
}
.user-chats-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

/* ===== Banner de modo auditoria no topo do chat ===== */
.audit-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  border-bottom: 2px solid #f59e0b;
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 5;
}
.audit-banner .mi {
  color: #f59e0b;
  font-size: 24px;
  flex-shrink: 0;
}
.audit-banner > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audit-banner b {
  font-size: 13px;
  color: #d97706;
}
.audit-banner span:not(.mi) {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.audit-banner .btn-secondary {
  flex-shrink: 0;
}

/* ===== Mensagem soft-deleted (placeholder visível ao usuário) ===== */
.msg-deleted .msg-bubble {
  background: rgba(0,0,0,0.04) !important;
  border: 1px dashed rgba(0,0,0,0.2) !important;
  color: var(--text-muted, #6b7280) !important;
  font-style: italic;
}
.msg-deleted .msg-bubble::before {
  content: "🚫 ";
}

/* ===== Mensagem apagada vista por admin (audit mode) ===== */
.msg-was-deleted .msg-bubble {
  position: relative;
  border: 1px dashed #f59e0b !important;
  background: rgba(245, 158, 11, 0.08) !important;
}
.msg-was-deleted .msg-bubble::after {
  content: "⚠ apagada";
  position: absolute;
  top: -8px;
  right: 8px;
  background: #f59e0b;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

/* Botão de delete na ação de mensagem */
.msg-action-btn.msg-action-del {
  color: #dc2626;
}
.msg-action-btn.msg-action-del:hover {
  background: rgba(220, 38, 38, 0.12);
}

/* Mobile: modal-user-chats e banner */
@media (max-width: 600px) {
  .audit-banner {
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  .audit-banner > div { width: 100%; order: 2; }
  .audit-banner .btn-secondary { order: 3; margin-left: auto; }
  .user-chats-list { max-height: 50vh; }
}

/* ================================================================
   PASSWORD LOCK — força troca de senha provisória no primeiro acesso
   ================================================================ */
/* Bloqueia o app inteiro (sidebar, topbar, conteúdo) — modais são irmãos do
   #main-app dentro de #app, então precisamos pegá-los por id específico. */
body.password-locked #main-app {
  pointer-events: none !important;
  filter: blur(3px) brightness(0.55);
  user-select: none;
}
/* Esconde qualquer outro modal eventualmente aberto */
body.password-locked .modal-overlay:not(#modal-profile) {
  display: none !important;
}
/* Modal de perfil continua interativo e nítido */
body.password-locked #modal-profile,
body.password-locked #modal-profile * {
  pointer-events: auto;
  filter: none;
}
/* Esconde botão de fechar enquanto bloqueado */
body.password-locked #modal-profile .modal-close,
body.password-locked #modal-profile .profile-modal-close {
  display: none !important;
}
/* Aviso visível dentro do modal */
body.password-locked .password-lock-banner {
  display: flex !important;
}
.password-lock-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 0 0 16px 0;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(220,38,38,0.12), rgba(220,38,38,0.04));
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.password-lock-banner .mi {
  color: #dc2626;
  flex-shrink: 0;
}
.password-lock-banner b { color: #dc2626; }

/* Encaminhar mensagem: label de seção (Grupos / Contatos) */
.forward-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text3, #888);
  padding: 12px 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.forward-section-label:first-child { padding-top: 4px; }

/* ================================================================
   VISTO / VISUALIZADO — receipts estilo WhatsApp
   ================================================================ */
.msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.msg-receipt {
  font-size: 12px;
  line-height: 1;
  letter-spacing: -2px;
  font-weight: 700;
  margin-left: 2px;
  display: inline-block;
}
.msg-receipt.sent { color: rgba(255,255,255,0.55); }
.msg-receipt.pending { color: rgba(255,255,255,0.4); letter-spacing: 0; }
.msg-receipt.seen { color: #4fc3f7; }
/* No tema claro, ajusta cores */
:root[data-theme="light"] .msg-receipt.sent { color: rgba(0,0,0,0.4); }
:root[data-theme="light"] .msg-receipt.pending { color: rgba(0,0,0,0.35); }

.msg-meta[style*="cursor: pointer"]:hover .msg-receipt { opacity: 0.85; }

/* Modal de detalhes da mensagem */
.msg-details-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.msg-details-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.msg-details-row:last-child { border-bottom: none; }
.msg-details-row .mi {
  font-size: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}
.msg-details-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3, #888);
  margin-bottom: 2px;
}
.msg-details-value {
  font-size: 14px;
  color: var(--text);
}

/* ================================================================
   ADMIN — ABA SISTEMA
   ================================================================ */
.system-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 32px;
}
.sys-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.sys-section-head h3 { margin-bottom: 0 !important; }
.sys-refresh-btn { width: auto; white-space: nowrap; }
.backend-health-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.health-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.health-summary > div,
.health-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.health-summary.ok > div:first-child { border-color: rgba(114,196,140,.35); background: var(--success-bg); }
.health-summary.error > div:first-child { border-color: rgba(227,113,113,.4); background: var(--danger-bg); }
.health-summary-label {
  display: block;
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.health-summary strong {
  color: var(--text);
  font-size: 13px;
}
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.health-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.health-card-head .mi { font-size: 18px; }
.health-card.ok .mi { color: var(--success); }
.health-card.warn .mi { color: var(--warn); }
.health-card.error .mi { color: var(--danger); }
.health-card p {
  margin: 7px 0 0;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.45;
}
.health-freshness {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--text2);
  font-size: 11px;
}
.health-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.health-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.health-error {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(227,113,113,.35);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--text);
}
.health-error .mi { color: var(--danger); }
.health-error p { margin: 3px 0 0; color: var(--text2); font-size: 12px; }

.sys-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-glow), var(--surface2));
  border: 1px solid var(--border);
}
.sys-hero-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.sys-hero-icon .mi { font-size: 28px; color: var(--accent); }
.sys-hero-name {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.sys-hero-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sys-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
}
.sys-pill.ok { color: #16a34a; border-color: rgba(22,163,74,0.3); background: rgba(22,163,74,0.08); }
.sys-pill.warn { color: #dc2626; border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.08); }
.sys-pill .mi { font-size: 14px; }

.sys-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.sys-section h3 {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-transform: none;
  color: var(--text);
  margin: 0 0 18px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.sys-section h3 .mi {
  color: var(--accent);
  font-size: 22px;
  background: var(--accent-glow);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Stats grid */
.sys-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.sys-stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  text-align: center;
}
.sys-stat-num {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.sys-stat-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3, #888);
}
.sys-stat.ok .sys-stat-num { color: #16a34a; }
.sys-stat.warn .sys-stat-num { color: #dc2626; }
.sys-stat.pending .sys-stat-num { color: #d97706; }

/* Checklist */
.sys-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sys-check {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
}
.sys-check-icon {
  color: #16a34a;
  font-size: 20px !important;
  flex-shrink: 0;
  margin-top: 1px;
}
.sys-check-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.sys-check-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}
.sys-check-desc code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
}

/* Info grid (sessão) */
.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.sys-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
}
.sys-info-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3, #888);
  font-weight: 600;
}
.sys-info-val {
  font-size: 13px;
  color: var(--text);
}
.sys-info-ua {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sys-info-ua code {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: var(--text2);
  word-break: break-all;
}

/* Ações de manutenção */
.sys-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.sys-actions .btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}
.sys-actions .mi { font-size: 16px; }

.sys-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text3, #888);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
}

@media (max-width: 600px) {
  .sys-hero { flex-direction: column; text-align: center; }
  .sys-stats { grid-template-columns: repeat(2, 1fr); }
  .sys-info-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   MOBILE FIXES — produção
   ================================================================ */

/* Anti-zoom iOS: inputs precisam ser >= 16px no mobile pra não dar
   auto-zoom ao focar. Aplica só em telas pequenas pra não inflar
   tipografia no desktop. */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="number"],
  input[type="url"],
  input[type="date"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* viewport correto: 100dvh respeita a barra do navegador / teclado */
@supports (height: 100dvh) {
  #app { height: 100dvh; }
}

/* Touch-only fixes — desabilita estados :hover que ficam "sticky" no toque */
@media (hover: none) and (pointer: coarse) {
  .contact-item:hover,
  .recado-card:hover,
  .admin-user-row:hover,
  .nav-item:hover:not(.active),
  .msg-action-btn:hover,
  .icon-btn:hover,
  .btn-icon:hover,
  .btn-icon-sm:hover,
  .ctx-item:hover {
    background: inherit;
    color: inherit;
    transform: none;
  }
}

/* Touch targets mínimos de 44×44 nos botões críticos */
@media (max-width: 768px) {
  .send-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }
  .modal-close {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
  .eye-btn {
    min-width: 40px;
    min-height: 40px;
  }
  .chat-action-btn {
    min-width: 40px;
    min-height: 40px;
  }
  /* Bottom nav mais respirável */
  .nav-item {
    min-height: 52px;
  }
  /* Botões de ação de mensagem maiores no toque */
  .msg-action-btn {
    min-width: 36px;
    min-height: 36px;
  }
}

/* Chat input não pode ser coberto pela bottom-nav */
@media (max-width: 768px) {
  /* Quando o chat tá ativo (mostrando a janela de mensagem), some a
     bottom-nav pra não roubar espaço do input nem cobrir o teclado */
  .chat-window.mobile-active ~ * .mobile-bottom-nav,
  body:has(.chat-window.mobile-active) .sidebar.bottom-nav,
  body:has(#chat-window.mobile-active) > #app .sidebar {
    display: none !important;
  }
  /* Input do chat fica acima de qualquer nav */
  .chat-input-area {
    z-index: 200;
    position: relative;
  }
}

/* Modal: padding interno menor no celular pra não comer largura */
@media (max-width: 600px) {
  .modal-header {
    padding: 16px 18px 12px;
  }
  .modal-header h3 {
    font-size: 16px;
  }
  .modal-body {
    padding: 16px 18px;
  }
  .modal-footer {
    padding: 12px 18px 16px;
  }
  /* Modal de perfil também respeita altura no landscape */
  .modal-profile-wrap {
    max-height: 92dvh !important;
  }
  /* Tabelas em modais não estouram a viewport */
  .modal-body table,
  .modal-body .md-table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
}

/* Notif dropdown alinhado à direita no mobile */
@media (max-width: 768px) {
  .notif-dropdown {
    width: min(calc(100vw - 24px), 360px);
    right: 0;
    left: auto;
  }
}

/* Safe-area pra iOS com notch */
.mobile-topbar {
  padding-top: max(env(safe-area-inset-top), 8px);
  background: var(--surface);
}
@media (max-width: 768px) {
  body, html { background: var(--surface); }
  .sidebar.bottom-nav,
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Botão "voltar" do chat mobile maior */
@media (max-width: 768px) {
  .chat-back-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
}

/* Quando teclado virtual está aberto, esconde a bottom-nav pra que o
   chat-input fique visível e o usuário enxergue o que digita. */
@media (max-width: 768px) {
  body.keyboard-open .sidebar { display: none !important; }
  body.keyboard-open .mobile-topbar { position: relative; }
}

/* Quando o chat está com a janela ativa em mobile, esconde a bottom-nav
   (.sidebar vira bottom-nav no mobile) pra liberar a área de input. */
@media (max-width: 768px) {
  body.chat-mobile-active .sidebar { display: none !important; }
  body.chat-mobile-active #main-app { padding-bottom: 0 !important; }
}

/* Botões de ação no modal de perfil (preferencias / sair) */
.profile-actions-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-action-btn {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px !important;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  justify-content: flex-start !important;
}
.profile-action-btn .mi { font-size: 20px; }
.profile-action-btn.danger {
  color: #dc2626;
  border-color: rgba(220,38,38,0.3);
}
.profile-action-btn.danger:hover {
  background: rgba(220,38,38,0.08);
  border-color: rgba(220,38,38,0.5);
}

/* Caixa pra exibir senha provisória recém-gerada */
.temp-pass-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--accent-glow);
  border: 1px dashed var(--accent);
  border-radius: 10px;
}
.temp-pass-box code {
  flex: 1;
  font-family: var(--font-mono, monospace);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent2);
  letter-spacing: 1px;
  user-select: all;
  word-break: break-all;
}
.temp-pass-box .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px !important;
  font-size: 12px !important;
  width: auto !important;
  flex-shrink: 0;
}
.temp-pass-box .btn-secondary .mi { font-size: 14px; }

/* ================================================================
   Banner "Nova versão disponível"
   ================================================================ */
.update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: calc(100vw - 24px);
  animation: updateBannerSlideIn 0.3s ease;
}
@keyframes updateBannerSlideIn {
  from { transform: translate(-50%, -120%); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.update-banner.hidden { display: none; }
.update-banner .mi {
  font-size: 24px;
  flex-shrink: 0;
  color: #fff;
}
.update-banner-text {
  font-size: 13px;
  line-height: 1.4;
}
.update-banner-text b { display: block; font-size: 14px; }
.update-banner-btn {
  flex-shrink: 0;
  padding: 8px 14px !important;
  font-size: 13px !important;
  background: rgba(255,255,255,0.95) !important;
  color: var(--accent2) !important;
  border: none !important;
  width: auto !important;
  font-weight: 700;
}
.update-banner-btn:hover { background: #fff !important; }
.update-banner-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.update-banner-close:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.update-banner-close .mi { font-size: 18px; }

/* Mobile: empilha verticalmente */
@media (max-width: 600px) {
  .update-banner {
    flex-wrap: wrap;
    top: 8px;
    padding: 10px 12px;
    gap: 8px;
  }
  .update-banner-text { flex: 1 1 60%; font-size: 12px; }
  .update-banner-btn { flex: 1 1 100%; order: 3; }
  .update-banner-close { order: 2; }
}

/* ================================================================
   MOBILE/iOS POLISH — produção
   ================================================================ */

/* Fallback de altura pra iOS pré-16.4 e Safari antigo (não suporta dvh) */
@supports (-webkit-touch-callout: none) {
  #app { min-height: -webkit-fill-available; }
}

/* Overscroll: impede pull-to-refresh dentro do chat e bounce indesejado */
.chat-messages,
.kb-col-body,
.contacts-panel,
.recados-list {
  overscroll-behavior: contain;
}

/* Long-press no Kanban: bloqueia callout iOS em todo o body do kanban */
.kb-board, .kb-col, .kb-col-body, .kb-card, .kb-card * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Banner reposicionar — abaixo da mobile-topbar pra não cobrir sino/avatar */
@media (max-width: 768px) {
  .update-banner,
  .install-banner,
  .notif-permission-banner {
    top: calc(60px + env(safe-area-inset-top, 0px)) !important;
  }
}

/* INSTALL BANNER (mesmo estilo do update-banner mas com cor levemente diferente) */
.install-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #5b8ef2, #4f6fb5);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: calc(100vw - 24px);
  animation: updateBannerSlideIn 0.3s ease;
}
.install-banner.hidden { display: none; }
.install-banner .mi { font-size: 24px; flex-shrink: 0; color: #fff; }
.install-banner-text { font-size: 13px; line-height: 1.4; }
.install-banner-text b { display: block; font-size: 14px; }
.install-banner-tip { font-size: 12px; opacity: 0.95; }
.install-banner-btn {
  flex-shrink: 0;
  padding: 8px 14px !important;
  font-size: 13px !important;
  background: rgba(255,255,255,0.95) !important;
  color: #4f6fb5 !important;
  border: none !important;
  width: auto !important;
  font-weight: 700;
}
.install-banner-close {
  flex-shrink: 0; background: transparent; border: none;
  color: rgba(255,255,255,0.85); cursor: pointer; padding: 4px; border-radius: 6px;
}
.install-banner-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.install-banner-close .mi { font-size: 18px; }

/* NOTIFICATION PERMISSION BANNER — verde "ativar" */
.notif-permission-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #16a34a, #0e7c39);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: calc(100vw - 24px);
  animation: updateBannerSlideIn 0.3s ease;
}
.notif-permission-banner .mi { font-size: 24px; flex-shrink: 0; color: #fff; }
.notif-permission-text { font-size: 13px; line-height: 1.4; }
.notif-permission-text b { display: block; font-size: 14px; }
.notif-permission-btn {
  flex-shrink: 0;
  padding: 8px 14px !important;
  font-size: 13px !important;
  background: rgba(255,255,255,0.95) !important;
  color: #0e7c39 !important;
  border: none !important;
  width: auto !important;
  font-weight: 700;
}
.notif-permission-close {
  flex-shrink: 0; background: transparent; border: none;
  color: rgba(255,255,255,0.85); cursor: pointer; padding: 4px; border-radius: 6px;
}
.notif-permission-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.notif-permission-close .mi { font-size: 18px; }

/* Mobile: banners empilham e ficam menores */
@media (max-width: 600px) {
  .install-banner,
  .notif-permission-banner {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .install-banner-text,
  .notif-permission-text { flex: 1 1 60%; font-size: 12px; }
  .install-banner-btn,
  .notif-permission-btn { flex: 1 1 100%; order: 3; }
  .install-banner-close,
  .notif-permission-close { order: 2; }
}

/* keyboard-open: zera padding-bottom pra input não ficar abaixo da viewport */
@media (max-width: 768px) {
  body.keyboard-open #main-app { padding-bottom: 0 !important; }
}

/* Presença online no painel admin */
.user-status-dot.status-online {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
  animation: pulseOnline 2s ease-in-out infinite;
}
.user-status-dot.status-offline {
  background: var(--text3, #9ca3af);
}
@keyframes pulseOnline {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.05); }
}
.admin-user-presence {
  font-size: 11px;
  color: var(--text3, #6b7280);
  margin-top: 2px;
}
.admin-user-presence.is-online {
  color: #16a34a;
  font-weight: 600;
}
.admin-tag.tag-online {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}

/* ================================================================
   ADMIN — Lista de grupos (todos do sistema)
   ================================================================ */
.admin-groups-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.admin-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background .15s;
}
.admin-group-row:hover { background: var(--surface2); }
.admin-group-row.group-deleted { opacity: 0.55; }

.admin-group-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.18);
  color: #a855f7;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.admin-group-icon img {
  width: 100%; height: 100%; object-fit: cover;
}
.admin-group-icon .mi { font-size: 22px; }

.admin-group-info {
  flex: 1;
  min-width: 0;
}
.admin-group-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-group-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.admin-group-actions {
  display: flex; gap: 4px;
  flex-shrink: 0;
}

.admin-group-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
}
.admin-group-member-item small { font-size: 11px; }

@media (max-width: 600px) {
  .admin-group-row { flex-wrap: wrap; }
  .admin-group-actions { width: 100%; justify-content: flex-end; }
}

/* ================================================================
   REAÇÕES + VISTO em RECADOS
   ================================================================ */
.recado-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.recado-reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}
.recado-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.recado-reaction:hover { background: var(--accent-glow); border-color: var(--accent); }
.recado-reaction.mine { background: var(--accent-glow); border-color: var(--accent); color: var(--accent2); font-weight: 600; }
.recado-reaction span { font-size: 11px; opacity: 0.85; }

.recado-react-add {
  background: transparent;
  border: 1px dashed var(--border);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
}
.recado-react-add:hover { background: var(--accent-glow); border-color: var(--accent); border-style: solid; color: var(--accent); }
.recado-react-add .mi { font-size: 18px; }

/* Popover de seleção de reação */
.recado-react-popover {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9998;
  display: flex;
  gap: 4px;
  animation: fadeIn 0.15s ease;
}
.recado-react-popover button {
  background: transparent;
  border: none;
  font-size: 20px;
  padding: 4px 6px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}
.recado-react-popover button:hover { background: var(--surface2); transform: scale(1.2); }

/* Badge "visto" */
.recado-seen-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.recado-seen-badge:hover { background: rgba(22,163,74,0.2); }
.recado-seen-mark {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(22, 163, 74, 0.08);
  border-radius: 10px;
}

/* Lista de quem viu (modal) */
.seen-list-section { margin-bottom: 16px; }
.seen-list-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3);
}
.seen-list-section ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.seen-list-section li {
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.seen-list-empty { font-size: 12px; color: var(--text3); margin: 0; padding: 8px; }

/* ================================================================
   EMOJI PICKER no CHAT
   ================================================================ */
.chat-emoji-popover {
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  padding: 8px;
  z-index: 9998;
  animation: fadeIn 0.15s ease;
}
.emoji-cat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3);
  font-weight: 700;
  padding: 8px 4px 4px;
}
.emoji-cat-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-cat-row button {
  background: transparent;
  border: none;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.emoji-cat-row button:hover { background: var(--surface2); }

@media (max-width: 600px) {
  .chat-emoji-popover { width: calc(100vw - 16px); }
  .emoji-cat-row { grid-template-columns: repeat(7, 1fr); }
  .emoji-cat-row button { font-size: 22px; padding: 6px; }
}

/* ================================================================
   Drag & drop de arquivos no chat (PC)
   ================================================================ */
.chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(193, 154, 78, 0.18);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  animation: dropFadeIn 0.15s ease;
}
.chat-drop-overlay.active { display: flex; }
.chat-drop-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chat-drop-inner .mi {
  font-size: 56px;
  color: var(--accent);
}
.chat-drop-inner b {
  font-size: 18px;
  color: var(--text);
}
.chat-drop-inner small {
  font-size: 12px;
  color: var(--text2);
  max-width: 280px;
}
@keyframes dropFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Garante que o chat-window é o contêiner relativo pro overlay */
#chat-window {
  position: relative;
}

/* Esconde overlay no mobile (drag não funciona em touch) */
@media (max-width: 768px) {
  .chat-drop-overlay { display: none !important; }
}

/* ================================================================
   Painel de diagnóstico in-app (debug=1)
   ================================================================ */
.debug-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1f2937;
  color: #fff;
  border: 2px solid #f59e0b;
  font-size: 22px;
  cursor: pointer;
  z-index: 99998;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.debug-fab:active { transform: scale(0.94); }

.debug-panel {
  position: fixed;
  inset: auto 8px 8px 8px;
  top: 60px;
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  max-height: calc(100dvh - 80px);
}
.dbg-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: #111827;
  border-bottom: 1px solid #374151;
  border-radius: 10px 10px 0 0;
}
.dbg-header b { flex: 1; font-size: 13px; }
.dbg-btn {
  background: #374151; color: #fff; border: none;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  font-size: 11px; font-family: inherit;
}
.dbg-btn:active { background: #4b5563; }
#dbg-close { background: #dc2626; padding: 4px 8px; font-size: 16px; line-height: 1; }

.dbg-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
}
.dbg-line {
  padding: 6px 8px;
  margin-bottom: 4px;
  background: #0b1220;
  border-left: 3px solid #6b7280;
  border-radius: 4px;
}
.dbg-line.lvl-warn { border-left-color: #f59e0b; }
.dbg-line.lvl-error { border-left-color: #dc2626; background: rgba(220,38,38,0.1); }
.dbg-line.lvl-info { border-left-color: #3b82f6; }
.dbg-t {
  color: #9ca3af;
  font-size: 10px;
  display: block;
  margin-bottom: 2px;
}
.dbg-line pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 11px;
}

/* Checkbox "Manter conectado" no login */
.login-keep-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  user-select: none;
}
.login-keep-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.login-keep-row:hover { color: var(--text); }

/* ================================================================
   MENSAGENS AGENDADAS
   ================================================================ */
.chat-scheduled-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(193,154,78,0.12), rgba(193,154,78,0.05));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
}
.chat-scheduled-bar .mi {
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}
.csb-text { flex: 1; line-height: 1.3; }
.csb-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}
.csb-btn:hover { background: var(--accent2); }

/* Modal de agendamento */
.sched-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.sched-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}
.sched-quick button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 10px;
  border-radius: 14px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.sched-quick button:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent2);
}

/* Lista de agendadas */
.sched-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.sched-item-when {
  font-size: 11px;
  color: var(--accent2);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sched-item-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.sched-item > div:first-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.sched-item > button { flex-shrink: 0; }

/* ================================================================
   COBRANÇAS — controle de cobrança baseado na planilha
   ================================================================ */
.cobrancas-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* IMPORTANTE: .tab-content tem overflow:hidden, então o scroll precisa
     acontecer aqui dentro pra ver tudo até o fim da lista */
  height: 100%;
  overflow-y: auto;
}
.cobrancas-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.cobrancas-header h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 600;
}
.cobrancas-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text3);
  max-width: 600px;
}

.cobrancas-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.cobr-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.cobr-kpi-num {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.cobr-kpi-lbl {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-top: 2px;
}
.cobr-kpi.warn .cobr-kpi-num { color: #d97706; }
.cobr-kpi.danger .cobr-kpi-num { color: #dc2626; }

.cobrancas-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.cobrancas-search-wrap {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.cobrancas-search-wrap .mi { color: var(--text3); }
.cobrancas-search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.cobrancas-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cobrancas-filters select {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}

.cobrancas-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cobr-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cobr-row:hover { background: var(--surface2); border-color: var(--accent); }

.cobr-row-main {
  flex: 1;
  min-width: 0;
}
.cobr-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cobr-row-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text3);
  flex-wrap: wrap;
  align-items: center;
}
.cobr-row-contact {
  margin-top: 4px;
  font-size: 11px;
}
.cobr-row-values { text-align: right; flex-shrink: 0; }
.cobr-val { font-size: 15px; font-weight: 700; color: var(--text); }
.cobr-val.pending { color: #d97706; }
.cobr-val-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }

.cobr-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.cobr-tag.tag-ok { background: rgba(22,163,74,0.1); color: #16a34a; border: 1px solid rgba(22,163,74,0.3); }
.cobr-tag.tag-warn { background: rgba(217,119,6,0.1); color: #d97706; border: 1px solid rgba(217,119,6,0.3); }
.cobr-tag.tag-danger { background: rgba(220,38,38,0.1); color: #dc2626; border: 1px solid rgba(220,38,38,0.3); }
.cobr-tag.tag-info { background: rgba(59,130,246,0.1); color: #3b82f6; border: 1px solid rgba(59,130,246,0.3); }

.cobrancas-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text3);
}
.cobrancas-empty .mi { font-size: 48px; color: var(--text3); }
.cobrancas-empty h3 { margin: 12px 0 4px; font-size: 16px; color: var(--text); }
.cobrancas-empty p { font-size: 13px; margin: 0 0 16px; }

/* Modal de cliente */
.cobr-modal-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 18px;
}
.cobr-modal-title {
  margin: 14px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
  font-weight: 700;
}
.cobr-parcelas { display: flex; flex-direction: column; gap: 4px; }
.cobr-parcela {
  display: grid;
  grid-template-columns: 40px 100px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface2);
  border-left: 3px solid var(--text3);
}
.cobr-parcela.pago { border-left-color: #16a34a; }
.cobr-parcela.pendente { border-left-color: #d97706; background: rgba(217,119,6,0.04); }
.cobr-parcela-num { font-weight: 700; color: var(--text3); }
.cobr-parcela-valor { font-weight: 700; color: var(--text); }
.cobr-parcela-status { font-size: 11px; color: var(--text2); }
.cobr-parcela-data { font-size: 11px; color: var(--text3); text-align: right; }

.cobr-contatos { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.cobr-contato {
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cobr-contato-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.cobr-contato-tipo { font-size: 12px; font-weight: 600; color: var(--text); }
.cobr-contato-result { font-size: 11px; color: var(--accent2); background: var(--accent-glow); padding: 2px 8px; border-radius: 999px; }
.cobr-contato-data { font-size: 10px; color: var(--text3); margin-left: auto; }
.cobr-contato-obs { font-size: 12px; color: var(--text); margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.cobr-contato-by { font-size: 10px; color: var(--text3); }

.cobr-form { display: flex; flex-direction: column; gap: 10px; }
.cobr-form label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; display: flex; flex-direction: column; gap: 4px; }
.cobr-form select, .cobr-form textarea, .cobr-notes-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.cobr-form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cobr-form-row label { flex: 1; min-width: 140px; }
.cobr-form-row select { width: 100%; }

@media (max-width: 768px) {
  .cobrancas-layout { padding: 16px; }
  .cobr-row { flex-wrap: wrap; }
  .cobr-row-values { text-align: left; }
  .cobr-parcela { grid-template-columns: 30px 90px 1fr; }
  .cobr-parcela-data { grid-column: 1 / -1; }
}

/* Seções da lista de Cobranças */
.cobr-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.cobr-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  border-radius: 0;
  border-left: 4px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.cobr-section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cobr-section-header .mi { font-size: 20px; color: var(--text2); }
.cobr-section-count {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.cobr-section-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}
.cobr-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

/* Urgente (sem contato 15+ dias) */
.cobr-section-urgent .cobr-section-header {
  border-left-color: #dc2626;
  background: rgba(220,38,38,0.05);
}
.cobr-section-urgent .cobr-section-header h3 { color: #dc2626; }
.cobr-section-urgent .cobr-section-header .mi { color: #dc2626; }
.cobr-section-urgent .cobr-section-count { background: #dc2626; }

/* Quitados (collapsible) */
.cobr-section-paid .cobr-section-header {
  cursor: pointer;
  user-select: none;
  border-left-color: #16a34a;
}
.cobr-section-paid .cobr-section-header .mi:first-child { color: #16a34a; }
.cobr-section-paid .cobr-section-count { background: #16a34a; }
.cobr-section-paid .cobr-section-chevron {
  margin-left: 4px;
  transition: transform .2s;
}
.cobr-section-paid:not(.collapsed) .cobr-section-chevron {
  transform: rotate(180deg);
}
.cobr-section-paid.collapsed .cobr-section-body {
  display: none;
}
.cobr-section-paid .cobr-row {
  opacity: 0.72;
}
.cobr-row-paid .cobr-val.ok { color: #16a34a; }

/* Mini-tags de status (granular, por valor da coluna I da planilha) */
.cobr-row-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.cobr-status-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.cobr-status-tag b { font-weight: 800; margin-right: 2px; }

/* KPI verde (Quitados) */
.cobr-kpi.ok .cobr-kpi-num { color: #16a34a; }

/* KPI de valor monetário em Cobranças — card maior e fonte menor pra
   o R$ não quebrar linha (ex: "R$ 263.919,68") */
.cobr-kpi-money {
  grid-column: span 2;
}
.cobr-kpi-money .cobr-kpi-num {
  font-size: 18px;
  white-space: nowrap;
  letter-spacing: -0.3px;
}
@media (max-width: 600px) {
  .cobr-kpi-money { grid-column: span 2; }
  .cobr-kpi-money .cobr-kpi-num { font-size: 16px; }
}

/* ── KPI clicável ── */
.cobr-kpi.clickable { cursor: pointer; transition: transform .12s, border-color .12s; }
.cobr-kpi.clickable:hover { transform: translateY(-1px); border-color: var(--accent); }
.cobr-kpi.active { border-color: var(--accent); background: var(--accent-glow); }

/* ── Chips de filtro rápido ── */
.cobr-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 14px 0;
}
.cobr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.cobr-chip:hover { border-color: var(--accent); color: var(--text); }
.cobr-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cobr-chip.active .cobr-chip-badge { background: rgba(255,255,255,0.25); color: #fff; }
.cobr-chip-badge {
  display: inline-block; min-width: 18px;
  padding: 0 6px; border-radius: 999px;
  background: var(--surface2); color: var(--text2);
  font-size: 10px; font-weight: 700; text-align: center;
}

/* ── Responsável + lembrete na linha ── */
.cobr-row-extras {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.cobr-mini-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border);
}
.cobr-mini-tag .mi { font-size: 12px; }
.cobr-mini-tag.reminder-today { background: rgba(220,38,38,0.12); color: #dc2626; border-color: rgba(220,38,38,0.3); }
.cobr-mini-tag.reminder-soon { background: rgba(217,119,6,0.12); color: #d97706; border-color: rgba(217,119,6,0.3); }
.cobr-mini-tag.reminder-future { background: rgba(59,130,246,0.12); color: #3b82f6; border-color: rgba(59,130,246,0.3); }

/* ── Modal com abas ── */
.cobr-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.cobr-tabs::-webkit-scrollbar { display: none; }
.cobr-tab-btn {
  appearance: none; background: transparent; border: none;
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.cobr-tab-btn:hover { color: var(--text); }
.cobr-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.cobr-tab-badge {
  background: var(--surface2); color: var(--text2);
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  font-weight: 700;
}
.cobr-tab-btn.active .cobr-tab-badge { background: var(--accent-glow); color: var(--accent); }
.cobr-tab-panel { display: none; }
.cobr-tab-panel.active { display: block; }

/* ── Painel responsável dentro do modal ── */
.cobr-resp-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  padding: 10px 12px; border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.cobr-resp-row label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.cobr-resp-row select {
  flex: 1; padding: 6px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px;
}

/* ── Templates de mensagem ── */
.cobr-templates { display: flex; flex-direction: column; gap: 10px; }
.cobr-template-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}
.cobr-template-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.cobr-template-label { font-size: 12px; font-weight: 700; color: var(--text); }
.cobr-template-text {
  font-size: 12px; color: var(--text2);
  white-space: pre-wrap;
  background: var(--surface2);
  padding: 8px 10px; border-radius: 6px;
  max-height: 130px; overflow-y: auto;
  line-height: 1.45;
}
.cobr-template-copy {
  appearance: none;
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.cobr-template-copy:hover { filter: brightness(1.1); }
.cobr-template-copy .mi { font-size: 14px; }
.cobr-template-copy.copied { background: #16a34a; }

/* ── Follow-up modal ── */
.cobr-followup-modal .modal { max-width: 420px; }
.cobr-followup-options {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin: 12px 0;
}
.cobr-followup-opt {
  appearance: none;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  transition: all .12s;
}
.cobr-followup-opt:hover { border-color: var(--accent); }
.cobr-followup-opt.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.btn-link-sm {
  appearance: none; background: transparent; border: none;
  color: var(--accent); cursor: pointer;
  font-size: 11px; padding: 0 4px; text-decoration: underline;
}
.btn-link-sm:hover { filter: brightness(1.2); }

/* ── Links dentro de mensagens do chat / recados ── */
.msg-link, .recado-body a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.6);
  text-underline-offset: 2px;
  word-break: break-all;
  cursor: pointer;
}
.theirs .msg-link { text-decoration-color: var(--accent); color: var(--accent); }
.recado-body a { color: var(--accent); text-decoration-color: var(--accent); }
.msg-link:hover, .recado-body a:hover { filter: brightness(1.1); text-decoration-thickness: 2px; }

/* Preserva quebras de linha do que o usuário digitou no chat (Shift+Enter no
   desktop ou Enter no mobile geram \n; sem pre-wrap o HTML colapsa). */
.msg-text-body {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================
   BROADCAST — popup admin pra todos os usuários
   ============================================================ */
.admin-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.broadcast-popup .modal {
  max-width: 440px;
  text-align: center;
  padding: 28px 24px 22px;
  animation: bc-bounce-in .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes bc-bounce-in {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}
.broadcast-emoji { font-size: 56px; line-height: 1; margin-bottom: 10px; }
.broadcast-title {
  margin: 0 0 12px;
  font-size: 20px; font-weight: 700;
  color: var(--text);
}
.broadcast-message {
  font-size: 14px; color: var(--text2);
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 18px;
  line-height: 1.5;
  text-align: left;
}
.broadcast-ok-btn {
  min-width: 140px;
  padding: 10px 22px;
  font-size: 14px; font-weight: 700;
}

/* Modal de composição do admin */
.broadcast-compose-modal .modal { max-width: 540px; }
.bc-form { display: flex; flex-direction: column; gap: 10px; }
.bc-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .4px;
}
.bc-form input, .bc-form textarea {
  padding: 8px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.bc-form #bc-emoji { width: 80px; font-size: 22px; text-align: center; }
.bc-form textarea { resize: vertical; min-height: 80px; }

.bc-preview-box {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: var(--surface2);
}

/* Destinatários */
.bc-dest-toggle { display: flex; gap: 10px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; }
.bc-dest-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px; color: var(--text);
  text-transform: none; letter-spacing: 0;
}
.bc-dest-opt input { margin: 0; }
.bc-dest-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface2);
}
.bc-dest-search-wrap {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.bc-dest-search-wrap input {
  flex: 1; min-width: 160px;
  padding: 6px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px;
}
.bc-dest-bulk { display: flex; gap: 8px; }
.bc-dest-checkboxes {
  max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface);
  border-radius: 6px;
  padding: 4px;
}
.bc-dest-cb {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px;
  font-size: 13px; color: var(--text);
  text-transform: none; letter-spacing: 0;
  cursor: pointer;
  border-radius: 4px;
}
.bc-dest-cb:hover { background: var(--surface2); }
.bc-dest-cb input { margin: 0; }

/* ============================================================
   PASTE PREVIEW — confirma antes de enviar imagem do clipboard
   ============================================================ */
.paste-preview-modal .modal { max-width: 520px; }
.paste-preview-img {
  display: block;
  max-width: 100%;
  max-height: 50vh;
  margin: 0 auto 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  object-fit: contain;
}
.paste-preview-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text3);
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.paste-preview-caption-label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .4px;
}
.paste-preview-caption-label textarea {
  padding: 8px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit;
  resize: vertical; min-height: 50px;
}

/* ============================================================
   IMAGE LIGHTBOX — abre imagem em overlay (não em nova aba)
   ============================================================ */
.image-lightbox {
  position: fixed; inset: 0; z-index: 10003;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  animation: lb-fade .15s ease-out;
  cursor: zoom-out;
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.image-lightbox img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
  animation: lb-zoom .2s ease-out;
}
@keyframes lb-zoom { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.img-lb-close, .img-lb-download {
  position: fixed;
  top: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
  backdrop-filter: blur(8px);
}
.img-lb-close:hover, .img-lb-download:hover { background: rgba(255, 255, 255, 0.25); }
.img-lb-close { right: 16px; }
.img-lb-download { right: 70px; }
.img-lb-close .mi, .img-lb-download .mi { font-size: 24px; }
@media (max-width: 600px) {
  .img-lb-close { top: max(env(safe-area-inset-top, 0), 12px); right: 12px; }
  .img-lb-download { top: max(env(safe-area-inset-top, 0), 12px); right: 64px; }
}

/* ================================================================
   Meu Espaço — anotações, cofre e kanban pessoal
   ================================================================ */
.personal-root,
.personal-shell {
  height: 100%;
  min-height: 0;
}
.personal-shell {
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  gap: 18px;
  background: var(--bg);
}
.personal-shell .hidden {
  display: none !important;
}
.personal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.personal-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 500;
}
.personal-head p {
  margin: 4px 0 0;
  color: var(--text3);
  font-size: 13px;
}
.personal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.personal-audit-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--text);
}
.personal-audit-banner .mi {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(224, 177, 104, .16);
  color: var(--warn);
  font-size: 21px;
  flex-shrink: 0;
}
.personal-audit-banner div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.personal-audit-banner b {
  font-size: 13px;
  font-weight: 800;
}
.personal-audit-banner span:not(.mi) {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.4;
}
.personal-user-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.personal-user-picker span {
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.personal-user-picker select {
  min-width: 170px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 800;
}
.personal-tabs {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.personal-tabs button,
.personal-primary,
.personal-secondary,
.personal-icon,
.personal-task-actions button {
  appearance: none;
  border: none;
  font-family: var(--font-body);
  cursor: pointer;
}
.personal-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text3);
  font-size: 12px;
  font-weight: 800;
}
.personal-tabs button.active {
  background: var(--accent);
  color: #14181d;
}
.personal-tabs .mi { font-size: 17px; }
.personal-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.personal-primary,
.personal-secondary,
.personal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  min-height: 36px;
  padding: 0 12px;
}
.personal-primary {
  background: var(--accent);
  color: #14181d;
}
.personal-secondary,
.personal-icon {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.personal-icon {
  width: 36px;
  padding: 0;
}
.personal-icon.danger,
.personal-task-actions .danger {
  color: var(--danger);
}
.personal-muted {
  padding: 16px;
  color: var(--text3);
  font-size: 12px;
  text-align: center;
}
.note-editor input[readonly],
.note-editor textarea[readonly] {
  cursor: default;
  background: var(--surface);
  color: var(--text2);
}
.personal-empty {
  max-width: 440px;
  margin: 70px auto;
  text-align: center;
  color: var(--text3);
}
.personal-empty.inline {
  margin: 0;
  padding: 80px 20px;
  max-width: none;
}
.personal-empty .mi {
  font-size: 42px;
  color: var(--accent);
}
.personal-empty h3 {
  margin: 8px 0 4px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}
.notes-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}
.notes-list,
.note-editor,
.kanban-col-personal {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.notes-list {
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.notes-items {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes-item {
  appearance: none;
  border: 1px solid transparent;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 11px;
  text-align: left;
  cursor: pointer;
}
.notes-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.notes-item b,
.notes-item span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.notes-item b {
  color: var(--text);
  font-size: 13px;
}
.notes-item span {
  margin-top: 3px;
  color: var(--text3);
  font-size: 11px;
}
.note-editor {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.note-canvas-editor {
  overflow: hidden;
}
.note-editor-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.note-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-wrap: wrap;
}
.note-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.note-tool-group button,
.note-tool-group select,
.note-tool-group input[type="color"] {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 800;
}
.note-tool-group button {
  min-width: 34px;
  padding: 0 9px;
  cursor: pointer;
}
.note-tool-group button.active {
  background: var(--accent);
  color: #14181d;
  border-color: var(--accent);
}
.note-tool-group button.danger {
  color: var(--danger);
}
.note-tool-group select {
  padding: 0 8px;
}
.note-tool-group input[type="color"] {
  width: 36px;
  padding: 3px;
  cursor: pointer;
}
.note-size {
  min-width: 42px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.note-swatches {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.note-swatches button {
  min-width: 22px;
  width: 22px;
  min-height: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: var(--sw);
}
.note-editor input,
.note-editor textarea,
.kanban-actions-personal input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
}
.note-editor input {
  background: transparent;
  border: none;
  font-size: 20px;
  font-weight: 700;
}
.note-editor textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  border: none;
  border-radius: 0;
  padding: 18px;
  font-size: 14px;
  line-height: 1.7;
  background: transparent;
}
.note-board-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  background-color: var(--bg);
  padding: 28px;
}
.note-board {
  width: 1200px;
  height: 800px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  user-select: none;
}
body.note-is-drawing,
body.note-is-drawing * {
  -webkit-user-select: none !important;
  user-select: none !important;
}
.note-board.drawing {
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.note-board.drawing[data-tool="eraser"] {
  cursor: cell;
}
.note-board.drawing[data-tool="line"] {
  cursor: crosshair;
}
.note-paper {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
}
.note-paper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.note-board.show-ruler .note-paper {
  box-shadow:
    inset 32px 0 0 rgba(201, 167, 115, .06),
    inset 0 32px 0 rgba(201, 167, 115, .06);
}
.note-board.show-ruler .note-paper::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(201,167,115,.55) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(0deg, rgba(201,167,115,.55) 0 1px, transparent 1px 40px),
    linear-gradient(90deg, rgba(201,167,115,.22), rgba(201,167,115,.22)) 0 0 / 100% 32px no-repeat,
    linear-gradient(0deg, rgba(201,167,115,.22), rgba(201,167,115,.22)) 0 0 / 32px 100% no-repeat;
  opacity: .42;
}
.note-element {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  line-height: 1.35;
  box-shadow: none;
  overflow: visible;
  display: flex;
}
.note-element.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.note-element.readonly {
  border-color: transparent;
}
.note-el-title {
  letter-spacing: 0;
}
.note-el-text {
  border-color: rgba(255,255,255,.04);
}
.note-el-section {
  border-color: var(--border);
}
.note-el-sticky {
  box-shadow: 0 12px 24px rgba(0, 0, 0, .16);
  transform: rotate(-1deg);
}
.note-element-content {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  min-height: 24px;
  white-space: pre-wrap;
  outline: none;
  user-select: text;
}
.note-board.drawing .note-element-content,
.note-board.drawing .note-element {
  user-select: none;
  pointer-events: none;
}
.note-drag-handle {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text3);
  cursor: grab;
}
.note-drag-handle:active {
  cursor: grabbing;
}
.note-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 5px;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  cursor: nwse-resize;
}
.note-resize-handle::before {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-right: 1px solid #14181d;
  border-bottom: 1px solid #14181d;
}
.note-drawing-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.note-status {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 11px;
}
.kanban-actions-personal input {
  min-height: 38px;
  padding: 9px 11px;
}
.personal-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  margin-bottom: 8px;
}
.personal-task b {
  display: block;
  color: var(--text);
  font-size: 13px;
}
.personal-task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.personal-task-actions button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text2);
  font-size: 11px;
  font-weight: 800;
}
.kanban-personal {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-toolbar-personal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.kanban-toolbar-personal h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.kanban-toolbar-personal p {
  margin: 2px 0 0;
  color: var(--text3);
  font-size: 11.5px;
}
.kanban-actions-personal {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 420px;
}
.kanban-board-personal {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.kanban-col-personal {
  width: 270px;
  flex: 0 0 270px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: border-color .12s, background .12s;
  position: relative;
}
.kanban-col-personal.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.kanban-col-personal.col-dragging {
  opacity: .45;
}
.kanban-col-personal.col-drop-before::after,
.kanban-col-personal.col-drop-after::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  z-index: 2;
}
.kanban-col-personal.col-drop-before::after { left: -6px; }
.kanban-col-personal.col-drop-after::after { right: -6px; }
.kanban-col-personal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 9px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  position: relative;
  cursor: grab;
  user-select: none;
}
.kanban-col-personal header:active { cursor: grabbing; }
.kanban-col-personal.readonly header,
.personal-task.readonly {
  cursor: default;
}
.kanban-col-personal header::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--col-color, var(--accent));
  border-radius: 999px;
}
.kanban-col-personal header small {
  display: block;
  margin-top: 2px;
  color: var(--text3);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kanban-col-personal header span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kanban-col-personal header span .mi {
  color: var(--text4);
  font-size: 16px;
  margin-left: -3px;
}
.kanban-col-tools {
  display: inline-flex;
  gap: 4px;
  opacity: .72;
}
.kanban-col-tools button {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text3);
  width: 25px;
  height: 25px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.kanban-col-tools .mi { font-size: 15px; }
.kanban-col-tools button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.kanban-col-body {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}
.personal-task {
  align-items: flex-start;
  padding: 8px 9px;
  gap: 8px;
  cursor: grab;
}
.personal-task:active { cursor: grabbing; }
.personal-task.dragging {
  opacity: .5;
  border-color: var(--accent);
}
.personal-task-main {
  min-width: 0;
  flex: 1;
}
.personal-task b {
  font-size: 12px;
  line-height: 1.25;
}
.personal-task small {
  display: block;
  margin-top: 3px;
  color: var(--text3);
  font-size: 10.5px;
  line-height: 1.3;
}
.personal-task-actions {
  gap: 3px;
}
.personal-task-actions button {
  width: 25px;
  min-height: 25px;
  padding: 0;
}
.personal-task .mi { font-size: 15px; }

@media (max-width: 900px) {
  .personal-shell { padding: 14px 12px; }
  .personal-head-actions,
  .personal-user-picker,
  .personal-user-picker select,
  .personal-tabs {
    width: 100%;
  }
  .personal-tabs button { flex: 1; justify-content: center; }
  .notes-layout,
  .kanban-board-personal {
    grid-template-columns: 1fr;
  }
  .notes-list { max-height: 220px; }
  .kanban-toolbar-personal,
  .kanban-actions-personal {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }
}
