/* ==========================================================================
   SISTEMA DE TEMAS VISUAIS — Glass Dark | Neon Blue | Obsidian | Claro Clean
   ========================================================================== */

/* Padrão & Claro Clean */
:root,
[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-pattern: radial-gradient(ellipse at 80% 0%, rgba(37, 99, 235, 0.06), transparent 55%);
  --bg-size: auto;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-hover: #2563eb;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --btn-primary-text: #ffffff;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 12px;
  --btn-radius: 9px;
  --btn-glow: 0 2px 8px rgba(37, 99, 235, 0.18);
  --glass-blur: none;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --chat-me: #dcfce7;
  --chat-other: #ffffff;
}

/* 1. GLASS DARK — Azul petróleo profundo, cards translúcidos com blur e botões pílula azul-gelo */
[data-theme="glass"],
[data-theme="dark"] {
  --bg: #0c1626;
  --bg-pattern: radial-gradient(ellipse at 78% 15%, rgba(125, 211, 252, 0.13), transparent 52%),
                radial-gradient(ellipse at 12% 85%, rgba(56, 189, 248, 0.08), transparent 48%);
  --bg-size: auto;
  --surface: rgba(20, 34, 56, 0.72);
  --surface-2: rgba(28, 46, 74, 0.78);
  --border: rgba(125, 211, 252, 0.18);
  --border-hover: rgba(125, 211, 252, 0.55);
  --text: #f1f5f9;
  --muted: #8ea4c2;
  --primary: #7dd3fc;
  --primary-hover: #bae6fd;
  --btn-primary-text: #082f49;
  --primary-soft: rgba(125, 211, 252, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.16);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.18);
  --radius: 16px;
  --btn-radius: 999px;
  --btn-glow: 0 4px 18px rgba(125, 211, 252, 0.22);
  --glass-blur: blur(14px);
  --shadow: 0 8px 28px rgba(4, 10, 22, 0.38);
  --chat-me: rgba(14, 116, 144, 0.45);
  --chat-other: rgba(24, 39, 64, 0.85);
}

/* 2. NEON BLUE — Preto abissal com aura e glow ciano luminoso futurista */
[data-theme="neon"] {
  --bg: #050c16;
  --bg-pattern: radial-gradient(circle at 76% 18%, rgba(0, 200, 255, 0.16), transparent 48%),
                radial-gradient(circle at 18% 82%, rgba(0, 132, 255, 0.09), transparent 45%);
  --bg-size: auto;
  --surface: rgba(10, 22, 38, 0.88);
  --surface-2: #0f2038;
  --border: rgba(0, 200, 255, 0.20);
  --border-hover: #00c8ff;
  --text: #f8fafc;
  --muted: #7f9bb8;
  --primary: #00c8ff;
  --primary-hover: #38d9ff;
  --btn-primary-text: #021824;
  --primary-soft: rgba(0, 200, 255, 0.14);
  --success: #00e676;
  --success-soft: rgba(0, 230, 118, 0.15);
  --warn: #ffb300;
  --warn-soft: rgba(255, 179, 0, 0.16);
  --danger: #ff5252;
  --danger-soft: rgba(255, 82, 82, 0.18);
  --radius: 14px;
  --btn-radius: 11px;
  --btn-glow: 0 0 20px rgba(0, 200, 255, 0.42);
  --glass-blur: blur(10px);
  --shadow: 0 6px 26px rgba(0, 0, 0, 0.52);
  --chat-me: rgba(0, 150, 199, 0.34);
  --chat-other: #0d1d33;
}

/* 3. OBSIDIAN — Grafite fosco com malha geométrica técnica, cantos retos e titânio */
[data-theme="obsidian"] {
  --bg: #0b0c0f;
  --bg-pattern: linear-gradient(rgba(255, 255, 255, 0.036) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, 0.036) 1px, transparent 1px);
  --bg-size: 44px 44px;
  --surface: rgba(18, 20, 26, 0.94);
  --surface-2: #181b22;
  --border: #272b36;
  --border-hover: #b8c2d4;
  --text: #f4f6fb;
  --muted: #8b93a5;
  --primary: #b8c2d4;
  --primary-hover: #d0d8e6;
  --btn-primary-text: #0b0c0f;
  --primary-soft: rgba(184, 194, 212, 0.14);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warn: #facc15;
  --warn-soft: rgba(250, 204, 21, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --radius: 6px;
  --btn-radius: 5px;
  --btn-glow: none;
  --glass-blur: none;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.48);
  --chat-me: #232834;
  --chat-other: #161920;
}

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

html,
body {
  height: 100%;
  font-family: "Inter", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-size: var(--bg-size);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 6px;
}

.gap-2 {
  gap: 10px;
}

.gap-3 {
  gap: 16px;
}

.wrap {
  flex-wrap: wrap;
}

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

.small {
  font-size: 12px;
}

.mt-1 {
  margin-top: 6px;
}

.mt-2 {
  margin-top: 12px;
}

.mt-3 {
  margin-top: 18px;
}

.mb-2 {
  margin-bottom: 12px;
}

.w-full {
  width: 100%;
}

/* Layout com abas estilo navegador ocupando 100% da tela com ajuste automático */
.app-tabs-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
}

body.view-chat {
  overflow: hidden;
}

body.view-chat .app-tabs-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.view-chat .main-content {
  overflow: hidden;
  padding: 10px 14px;
}

.app-header {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(12px, 1.5vw, 24px) 6px;
  width: 100%;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--btn-radius);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-inline h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
}

.brand-inline h1 em {
  font-style: normal;
  color: var(--primary);
}

.brand-inline span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.theme-select {
  padding: 5px 10px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.theme-select:hover,
.theme-select:focus {
  border-color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-nome-top {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px clamp(10px, 1.5vw, 24px) 0;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.browser-tabs::-webkit-scrollbar {
  display: none;
}

.browser-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px clamp(10px, 1.1vw, 16px);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  position: relative;
  transition: background 0.15s, color 0.15s;
  margin-bottom: -1px;
  flex-shrink: 0;
}

.browser-tab:hover {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
}

.browser-tab.active {
  background: var(--bg);
  color: var(--primary);
  font-weight: 700;
  border-color: var(--border);
  border-bottom: 1px solid var(--bg);
  box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.04);
}

.browser-tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 2.5px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s;
  width: 100%;
}

.nav-item:hover {
  background: var(--surface-2);
}

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

.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  line-height: 1.3;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 13px;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

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

.main-content {
  padding: clamp(10px, 1.4vw, 20px) clamp(12px, 1.5vw, 24px);
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Cards e componentes */
.card,
.kpi-card,
.demanda-card {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--btn-primary-text);
  box-shadow: var(--btn-glow);
}

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

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 8px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.textarea {
  min-height: 90px;
  resize: vertical;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.kpi-val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pill-primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.filters-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  width: 100%;
}

.filters-bar .input {
  flex: 2 1 240px;
  width: auto;
}

.filters-bar .select {
  flex: 1 1 150px;
  width: auto;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demanda-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.demanda-card:hover {
  border-color: var(--primary);
}

.demanda-card.resolvida {
  opacity: 0.72;
}

.demanda-card.importante {
  border-left: 4px solid var(--warn);
}

/* Kanban de Demandas */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.view-toggle button {
  border: none;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.view-toggle button.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 12px;
  width: 100%;
  min-height: calc(100dvh - 230px);
}

.kanban-col {
  flex: 1 0 280px;
  min-width: 270px;
  max-width: 360px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 230px);
}

.kanban-col.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.kanban-col-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.12s;
}

.kanban-card:hover {
  border-color: var(--primary);
}

.kanban-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.kanban-card.importante {
  border-left: 4px solid var(--warn);
}

.kanban-card.resolvida {
  opacity: 0.68;
}

.bar-row {
  margin-bottom: 10px;
}

.bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}

/* Chat layout — ocupa 100% do espaço restante da tela sem estourar */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  flex: 1;
  height: 100%;
  min-height: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-sidebar-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.chat-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.chat-conv-item:hover {
  background: var(--surface-2);
}

.chat-conv-item.active {
  background: var(--primary-soft);
}

.chat-conv-meta {
  flex: 1;
  min-width: 0;
}

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

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

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.chat-head {
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.chat-back-btn {
  display: none;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}

.msg-row.me {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.other {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 7px 11px;
  border-radius: 12px;
  background: var(--chat-other);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  word-break: break-word;
  position: relative;
}

.msg-text {
  white-space: pre-wrap;
}

.msg-row.me .msg-bubble {
  background: var(--chat-me);
  border-color: transparent;
}

.msg-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.msg-reply {
  border-left: 3px solid var(--primary);
  padding: 3px 7px;
  margin-bottom: 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  font-size: 11px;
}

.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  opacity: 0.65;
}

.msg-actions:hover {
  opacity: 1;
}

.msg-actions button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  padding: 1px 4px;
}

.msg-reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.reaction-chip {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
}

.msg-img {
  max-width: min(340px, 100%);
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  margin-top: 5px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.04);
}

/* Editor de enquadramento de foto (avatar circular nítido) */
.cropper-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cropper-stage {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  background: var(--surface-2);
  cursor: grab;
  touch-action: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.cropper-stage:active {
  cursor: grabbing;
}

.cropper-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chat-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.chat-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Figurinhas (Stickers) do Chat T.I */
.msg-bubble.is-sticker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 4px;
}

.msg-sticker {
  width: 146px;
  height: 146px;
  object-fit: contain;
  display: block;
  border-radius: 14px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
  cursor: pointer;
  transition: transform 0.14s;
}

.msg-sticker:hover {
  transform: scale(1.05);
}

.sticker-tray {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  max-height: 250px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.sticker-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s, border-color 0.12s;
}

.sticker-item:hover {
  transform: scale(1.06);
  border-color: var(--primary);
}

.sticker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.sticker-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.88);
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: none;
  place-items: center;
}

.sticker-item:hover .sticker-del {
  display: grid;
}

.sticker-maker-stage {
  width: 256px;
  height: 256px;
  border-radius: 22px;
  overflow: hidden;
  border: 2px dashed var(--primary);
  background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 20px 20px;
  cursor: grab;
  touch-action: none;
}

.sticker-maker-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chat-composer {
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  resize: none;
}

/* Notas pessoais — ocupa toda a tela restante automaticamente */
.notas-layout {
  display: grid;
  grid-template-columns: minmax(240px, 22vw) 1fr;
  gap: 14px;
  flex: 1;
  min-height: calc(100dvh - 180px);
  width: 100%;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

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

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Tabela simples */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 90;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-size: 13px;
}

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

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

/* Mobile */
@media (max-width: 860px) {
  .header-top {
    padding: 8px 12px 4px;
  }

  .brand-inline span,
  .user-nome-top {
    display: none;
  }

  .browser-tabs {
    padding: 4px 10px 0;
    gap: 2px;
  }

  .browser-tab {
    padding: 8px 11px;
    font-size: 13px;
  }

  .main-content {
    padding: 12px 12px 24px;
  }

  .grid-4,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .notas-layout {
    grid-template-columns: 1fr;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: 100%;
  }

  .chat-back-btn {
    display: inline-flex;
  }

  .msg-row {
    max-width: 88%;
  }

  .chat-layout.in-chat .chat-sidebar {
    display: none;
  }

  .chat-layout:not(.in-chat) .chat-main {
    display: none;
  }
}