:root {
  --bg: #f8f6f8;
  --paper: #ffffff;
  --ink: #161b22;
  --muted: #65707d;
  --line: #e6dfdf;
  --plum: #a97733;
  --plum-dark: #8c5e20;
  --green: #2d8a56;
  --red: #c93b3b;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Base Utility Classes & Reset */
.hidden { display: none !important; }
.role-hidden { display: none !important; }

/* Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: #191f26;
  color: #f0f4f8;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.2s ease, padding 0.2s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--plum);
  color: #fff;
  font-weight: 900;
}

.sidebar-caption {
  margin: 24px 0 10px 10px;
  color: #8c9ba5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: #a0aec0;
  font: 700 13px inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover, .nav-item.active {
  background: #28323e;
  color: #ffffff;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.nav-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 99px;
  background: #c93b3b;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #28323e;
}

.sidebar-bottom p {
  margin: 10px 0 0 10px;
  color: #718096;
  font-size: 11px;
  line-height: 1.4;
}

.workspace {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.topbar h1 {
  margin: 2px 0 0;
  font-size: 26px;
  letter-spacing: -0.8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clinic-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 700 13px inherit;
  cursor: pointer;
}

.clinic-monogram {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--plum);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

/* Botões Globais */
.primary-button, .soft-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 12px;
  padding: 10px 18px;
  font: 800 13px inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  border: 0;
}

.primary-button {
  background: var(--plum);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(169, 119, 51, 0.22);
}

.primary-button:hover {
  background: var(--plum-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: #edf2f7;
  color: #2d3748;
}

.secondary-button:hover {
  background: #e2e8f0;
}

.soft-button {
  background: #fff;
  color: #5b3d18;
}

.compact {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 12px;
}

/* Views & Headers */
.view { display: none; }
.view.active { display: block; }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: -0.6px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Hero & Dashboard */
.hero-card {
  position: relative;
  min-height: 240px;
  border-radius: 24px;
  background: linear-gradient(115deg, #182126 0%, #2b3336 55%, #9e6a28 150%);
  color: #fff;
  padding: 32px 38px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0,0,0,0.12);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
  padding-right: 210px;
}

.hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-note {
  position: absolute;
  top: 32px;
  right: 38px;
  display: grid;
  gap: 3px;
  width: 154px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  background: rgba(10, 16, 19, 0.28);
  backdrop-filter: blur(6px);
}

.hero-note small { font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.hero-note strong { font-size: 14px; line-height: 1.2; }
.hero-note span { color: rgba(255,255,255,.76); font-size: 11px; }

.hero-copy h2 {
  font-size: 30px;
  line-height: 1.1;
  margin: 14px 0 10px;
}

.hero-copy h2 i { color: #efc26e; font-style: normal; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.02);
}

.metric-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.metric-card strong {
  display: block;
  font-size: 26px;
  margin-top: 6px;
  letter-spacing: -0.5px;
}

.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

/* Painel Geral */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.025);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading h2 { margin: 0; font-size: 18px; }

/* Grid de Clientes, Serviços e Equipe */
.patient-grid, .team-grid, .service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.patient-card, .team-card, .service-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.patient-card:hover, .team-card:hover, .service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.patient-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f0e6ee;
  color: var(--plum);
  display: grid;
  place-items: center;
  font-weight: 900;
  margin-bottom: 12px;
}

/* TUTORIAL BANNER ATENDIMENTO */
.attendance-tutorial {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffdfa 0%, #fbf5eb 100%);
  border: 1px solid #f3e2c7;
  box-shadow: 0 4px 16px rgba(169, 119, 51, 0.06);
  transition: opacity 0.2s ease;
}

.tutorial-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tutorial-item span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--plum);
  color: #fff;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  font-size: 13px;
}

.tutorial-item b {
  display: block;
  font-size: 13px;
  color: #3d2a14;
}

.tutorial-item small {
  display: block;
  color: #7c6242;
  font-size: 11px;
}

.tutorial-dismiss-btn {
  border: 0;
  background: transparent;
  color: #926f42;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.tutorial-dismiss-btn:hover {
  background: rgba(169, 119, 51, 0.12);
  color: #5d411f;
}

/* WORKSPACE DE ATENDIMENTO */
.attendance-workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.03);
}

.attendance-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #fcfcfd;
}

.attendance-accounts {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.attendance-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  font: 12px inherit;
}

.attendance-account.active {
  border-color: var(--plum);
  background: #fbf6eb;
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.account-dot.online { background: #22c55e; }

.attendance-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.attendance-list-head b { display: block; font-size: 13px; }
.attendance-list-head small { color: var(--muted); font-size: 11px; }

.icon-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}

.conversation:hover, .conversation.active {
  background: #f8f6eb;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--plum);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  flex: 0 0 40px;
}

.conversation-copy {
  flex: 1;
  min-width: 0;
}

.conversation-copy b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-copy small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.conversation-meta time {
  color: #94a3b8;
  font-size: 10px;
}

.conv-stage-badge {
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
}

.conv-stage-badge.ready { background: #dcfce7; color: #15803d; }
.conv-stage-badge.service { background: #fef3c7; color: #92400e; }
.conv-stage-badge.progress { background: #e0e7ff; color: #3730a3; }

/* MAIN CHAT AREA */
.attendance-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}

.chat-empty {
  margin: auto;
  text-align: center;
  max-width: 320px;
  padding: 40px 20px;
}

.chat-empty-mark {
  font-size: 42px;
  display: block;
  margin-bottom: 12px;
}

.chat-empty h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.chat-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  min-height: 64px;
}

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

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-user-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-user-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.account-tag {
  padding: 2px 8px;
  border-radius: 99px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.chat-user-phone {
  color: var(--muted);
  font-size: 11px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  font: 800 12px inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.header-action-btn:hover, .header-action-btn.active {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.header-action-btn.primary-action {
  background: var(--plum);
  color: #fff;
  border-color: var(--plum);
}

.header-action-btn.primary-action:hover {
  background: var(--plum-dark);
}

/* PAINEL DE CONTEXTO DO CHAT */
.chat-context-panel {
  background: #faf8f5;
  border-bottom: 1px solid #ebdccb;
  padding: 14px 20px;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.context-item small {
  display: block;
  color: #8c6f4b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.context-item b {
  display: block;
  font-size: 13px;
  color: #2b1f11;
}

.intake-stage-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.stage-service { background: #fef3c7; color: #92400e; }
.stage-time { background: #dbeafe; color: #1e40af; }
.stage-barber { background: #f3e8ff; color: #6b21a8; }
.stage-ready { background: #dcfce7; color: #166534; }

.context-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e5d2bc;
}

/* QUICK REPLIES TRAY */
.quick-tray {
  padding: 12px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.quick-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quick-manage {
  border: 0;
  background: transparent;
  color: var(--plum);
  font: 800 11px inherit;
  cursor: pointer;
}

.quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.quick-chip {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font: 700 11px inherit;
  cursor: pointer;
  white-space: nowrap;
}

.quick-chip:hover {
  border-color: var(--plum);
  color: var(--plum);
}

/* CARD DE PRÉ-ATENDIMENTO NO STREAM */
.booking-intake-card {
  margin: 14px 20px 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fffdfa;
  border: 1px solid #f3e2c7;
}

.booking-intake-card.ready {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.intake-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.intake-pill {
  font-size: 11px;
  font-weight: 800;
  color: var(--plum-dark);
}

.schedule-intake-btn {
  border: 0;
  background: var(--plum);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font: 800 11px inherit;
  cursor: pointer;
}

.intake-card-text {
  margin: 0;
  font-size: 12px;
  color: #524231;
}

/* MESSAGE STREAM & BUBBLES */
.message-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.message-bubble {
  max-width: 76%;
  padding: 10px 14px;
  border-radius: 16px;
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.message-bubble.out {
  align-self: flex-end;
  background: #fbf5eb;
  color: #2c1e0e;
  border: 1px solid #f3e2c7;
  border-bottom-right-radius: 4px;
}

.message-bubble.in {
  align-self: flex-start;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.message-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.message-link {
  color: #2563eb;
  text-decoration: underline;
}

.message-time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #94a3b8;
  text-align: right;
}

/* CARDS DE MÍDIA */
.media-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
}

.media-img-thumb {
  max-width: 240px;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
}

.media-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.media-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
  font: 800 11px inherit;
  margin-top: 4px;
}

.media-unavailable {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.audio-element {
  max-width: 220px;
  height: 36px;
}

.video-element {
  width: min(100%, 360px);
  max-height: 240px;
  border-radius: 8px;
  background: #0f172a;
}

.interactive-card {
  padding: 10px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #ffedd5;
}

.interactive-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  color: #c2410c;
  margin-bottom: 4px;
}

/* CHAT COMPOSER FIXED */
.chat-composer {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

#message-composer {
  flex: 1;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  outline: none;
  font: 13px inherit;
}

#message-composer:focus {
  border-color: var(--plum);
}

.composer-send-btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: var(--plum);
  color: #fff;
  font: 800 13px inherit;
  cursor: pointer;
}

.composer-send-btn:hover {
  background: var(--plum-dark);
}

/* MODAIS & FORMULÁRIOS */
dialog {
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  max-width: 520px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

#modal-form, .connection-card {
  padding: 24px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-head h2 { margin: 2px 0 0; font-size: 22px; }

.close-button, .modal-x {
  border: 0;
  background: transparent;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font: 13px inherit;
  outline: none;
}

.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--plum);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form-error {
  color: var(--red);
  font-size: 12px;
  margin: 6px 0 0;
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 12px;
  background: #1e293b;
  color: #fff;
  font: 700 13px inherit;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  z-index: 9999;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* BOTTOM NAV (MOBILE) */
.bottom-nav {
  display: none;
}

/* RESPONSIVIDADE NOTEBOOK / MEDIO (769px - 1100px) */
@media (max-width: 1100px) {
  .sidebar {
    width: 174px;
    flex: 0 0 174px;
    padding: 20px 10px;
  }
  .nav-item {
    gap: 9px;
    padding: 10px;
  }
  .workspace {
    padding: 20px;
  }
  .attendance-workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .chat-header {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .chat-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .header-action-btn {
    padding: 7px 9px;
    font-size: 11px;
  }
  .hero-copy {
    max-width: 100%;
  }
  .hero-note {
    top: 24px;
    right: 24px;
  }
}

/* RESPONSIVIDADE MOBILE (<= 768px) */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
    padding-bottom: 60px;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    padding: 16px;
  }
  .topbar {
    margin-bottom: 12px;
  }
  .topbar h1 { font-size: 20px; }

  .hero-card {
    min-height: 278px;
    padding: 24px 20px;
  }
  .hero-copy {
    max-width: 100%;
    padding-right: 0;
    padding-bottom: 74px;
  }
  .hero-copy h2 { font-size: 26px; }
  .hero-note {
    top: auto;
    right: 20px;
    bottom: 18px;
    width: auto;
    min-width: 174px;
    padding: 10px 12px;
  }

  .attendance-tutorial {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .attendance-workspace {
    display: block;
    height: auto;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .attendance-list {
    border-right: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
  }

  /* Single Screen Toggle on Mobile */
  .attendance-view.has-chat-open .attendance-list {
    display: none;
  }

  .attendance-view.has-chat-open .attendance-chat {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 1000;
    height: calc(100vh - 60px);
    width: 100vw;
  }

  .chat-back-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    font: 800 12px inherit;
    border: 0;
    margin-right: 8px;
  }

  .chat-header {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }

  .chat-user-info {
    flex: 1;
  }

  .chat-user-title {
    min-width: 0;
  }

  .chat-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .header-action-btn {
    min-width: 0;
    min-height: 46px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 5px 3px;
    font-size: 15px;
  }

  .header-action-btn .btn-text {
    display: block;
    overflow: hidden;
    max-width: 100%;
    color: inherit;
    font-size: 9px;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .context-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #191f26;
    border-top: 1px solid #28323e;
    z-index: 999;
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav button {
    background: transparent;
    border: 0;
    color: #94a3b8;
    font: 700 11px inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .bottom-nav button.active {
    color: #fff;
  }

  .chat-composer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .media-card {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .media-img-thumb, .video-element {
    width: 100%;
    max-width: none;
    max-height: 210px;
  }
  .audio-element {
    width: min(100%, 250px);
    max-width: 100%;
  }
}
