:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel-2: #1f2c33;
  --panel-3: #2a3942;
  --line: #2a3942;
  --line-soft: #1d2a32;
  --ink: #e9edef;
  --ink-soft: #d1d7db;
  --muted: #8696a0;
  --accent: #25d366;
  --accent-ink: #0b141a;
  --blue: #53bdeb;
  --blue-ink: #0b141a;
  --danger: #f15c6d;
  --warning: #f3a72c;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-soft: 0 2px 6px rgba(0, 0, 0, .25);
}

body.theme-dark {
  color-scheme: dark;
}

body.theme-light {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-2: #f5f9fc;
  --panel-3: #e4edf5;
  --line: #d4e0ea;
  --line-soft: #e7eef5;
  --ink: #122031;
  --ink-soft: #314656;
  --muted: #6a7b8c;
  --accent: #1f9f70;
  --accent-ink: #f7fbff;
  --blue: #53bdeb;
  --blue-ink: #08202f;
  --danger: #d95a63;
  --warning: #b7821d;
  --shadow: 0 10px 28px rgba(18, 32, 49, .12);
  --shadow-soft: 0 4px 10px rgba(18, 32, 49, .08);
}

body.theme-light .auth-body {
  background: radial-gradient(1100px 700px at 20% 10%, #f8fbff 0%, #eaf2f8 58%, #dfe8f1 100%);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Manrope, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1100px 700px at 20% 10%, #122130 0%, #0b141a 60%, #07090c 100%);
  color: var(--ink);
}
.auth-shell {
  width: min(980px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
}
.auth-hero, .auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-logo { width: 96px; height: 96px; object-fit: contain; }
.badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.auth-hero h1, .auth-card h2 {
  font-family: Sora, Manrope, sans-serif;
  margin: 16px 0 10px;
  color: var(--ink);
}
.auth-hero p, .muted { color: var(--muted); }
.auth-hero ul { padding-left: 18px; line-height: 1.85; color: var(--ink-soft); }
.form-stack { display: grid; gap: 10px; }
.form-stack label { color: var(--muted); font-size: 12px; font-weight: 800; }
.input-inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.help-card {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink-soft);
}
.help-card summary { cursor: pointer; color: var(--muted); font-weight: 800; }

.ops-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.app-area { display: flex; flex-direction: column; min-width: 0; }

.side-nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.side-brand img { width: 36px; height: 36px; object-fit: contain; }
.side-brand strong { display: block; font-size: 15px; }
.side-brand small { color: var(--muted); font-size: 11px; }
.side-clinic {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.side-clinic small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.side-clinic h2 {
  margin: 4px 0 0;
  font-family: Sora, Manrope, sans-serif;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
}
.side-clinic select {
  width: 100%;
  margin-top: 10px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}
.side-nav nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.side-nav .nav-group { display: flex; flex-direction: column; margin-bottom: 14px; }
.side-nav .group-title {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
}
.side-nav button[data-page] {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.side-nav button[data-page] svg { flex-shrink: 0; opacity: .85; }
.side-nav button[data-page]:hover { background: var(--panel-2); color: var(--ink); }
.side-nav button[data-page].active {
  background: var(--panel-2);
  border-left-color: var(--accent);
  color: var(--ink);
}
.side-nav button[data-page].active svg { opacity: 1; color: var(--accent); }
.side-theme {
  padding: 12px 14px 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.side-theme small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
}
.side-theme-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.side-theme-actions .btn {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
}
.side-foot { padding: 14px 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }

.side-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  align-items: center;
  justify-content: center;
}

.top-bar {
  display: flex;
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-search {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink-soft);
}
.top-search svg { color: var(--muted); flex-shrink: 0; }
.top-search input {
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--ink);
}
.top-search input::placeholder { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-actions select {
  min-width: 180px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  padding: 0 10px;
}
.top-actions .icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  position: relative;
}
.top-actions .icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.bell-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink-soft);
}
.user-chip .avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  font-family: Sora, Manrope, sans-serif;
}
.user-chip strong { font-size: 13px; color: var(--ink); }
.user-chip small { font-size: 11px; color: var(--muted); }

.icon-btn, .btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
}
.icon-btn { width: 36px; padding: 0; display: grid; place-items: center; }
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-blue {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--blue-ink);
}
.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.btn-soft { background: var(--panel-3); color: var(--ink); }
.btn-ghost { background: transparent; }
.btn.mode-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.ops-main {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 26px 36px;
}
.screen { display: grid; gap: 16px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.page-header h1 {
  margin: 0;
  font-family: Sora, Manrope, sans-serif;
  font-size: 24px;
  letter-spacing: 0;
  color: var(--ink);
}
.page-header .subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.page-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.panel-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.panel-head h2, .panel-head h3, .panel-head h4 {
  margin: 0;
  font-family: Sora, Manrope, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  color: var(--ink);
}
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.embedded-panel { margin-top: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metrics.metrics-compact { grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric, .kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  min-height: 86px;
}
.metric .kpi-icon, .kpi .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.metric .kpi-text, .kpi .kpi-text { display: flex; flex-direction: column; min-width: 0; }
.metric span, .kpi span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong, .kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-family: Sora, Manrope, sans-serif;
  color: var(--ink);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 8px 12px;
  color: var(--ink);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 98px; resize: vertical; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  color: var(--ink);
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
td { color: var(--ink); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status.ok, .status.confirmado, .status.pago, .status.assinado { background: rgba(37, 211, 102, .18); color: var(--accent); }
.status.warn, .status.aberto, .status.pendente, .status.scheduled, .status.agendado { background: rgba(243, 167, 44, .18); color: var(--warning); }
.status.bad, .status.cancelado, .status.canceled, .status.erro { background: rgba(241, 92, 109, .18); color: var(--danger); }

.agenda-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}
.segmented button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 0 14px;
  font-weight: 800;
  color: var(--ink-soft);
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent); color: var(--accent-ink); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.chip:hover { background: var(--panel-3); color: var(--ink); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.calendar-wrap { overflow-x: auto; }
.calendar {
  min-width: 980px;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.calendar th, .calendar td { border: 1px solid var(--line); }
.calendar th { background: var(--panel-2); text-align: center; color: var(--ink-soft); }
.calendar .hour {
  width: 80px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.calendar .slot {
  height: 56px;
  background: var(--panel);
  position: relative;
}
.calendar .slot.free::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  background: rgba(134, 150, 160, .08);
}
.calendar .slot.confirmed { box-shadow: inset 4px 0 0 var(--accent); }
.calendar .slot.canceled { box-shadow: inset 4px 0 0 var(--danger); }
.calendar .weekend { background: var(--panel-2); }
.calendar .holiday { background: rgba(243, 167, 44, .08); }
.event-card {
  display: block;
  width: calc(100% - 6px);
  text-align: left;
  margin: 3px;
  padding: 6px 8px;
  border: 0;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: rgba(83, 189, 235, .14);
  color: var(--ink);
  font-size: 11.5px;
  position: relative;
  z-index: 1;
}
.event-card.confirmed { border-left-color: var(--accent); background: rgba(37, 211, 102, .16); }
.event-card.canceled { border-left-color: var(--danger); background: rgba(241, 92, 109, .14); color: var(--ink-soft); }
.event-card strong { display: block; }
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}
.month-cell {
  min-height: 116px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: var(--panel);
}
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell.weekend { background: var(--panel-2); }
.month-cell.holiday { background: rgba(243, 167, 44, .08); }
.month-day { font-weight: 900; color: var(--ink); }

.patient-shell { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.patient-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-3);
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
  font-family: Sora, Manrope, sans-serif;
}
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.sub-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
}
.sub-tabs button {
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sub-tabs button.active { color: var(--accent); border-color: var(--accent); }

.patient-list { display: flex; flex-direction: column; gap: 0; }
.patient-list .panel-body { padding: 0; }
.patient-list-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.patient-list-search input { background: var(--panel-2); }
.patient-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.patient-rows { max-height: calc(100vh - 320px); overflow-y: auto; }
.patient-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.patient-row:hover { background: var(--panel-2); }
.patient-row.active { background: var(--panel-2); }
.patient-row strong { display: block; }
.patient-row small { color: var(--muted); font-size: 11.5px; }

.attendance-shell {
  min-height: calc(100vh - 138px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}
.attendance-list,
.attendance-chat,
.attendance-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.attendance-list-head,
.attendance-chat-head,
.attendance-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.attendance-list-head h2, .attendance-chat-head h2, .attendance-side-head h3 {
  margin: 0;
  font-size: 15px;
  font-family: Sora, Manrope, sans-serif;
  color: var(--ink);
}
.attendance-list-head span, .attendance-chat-head span { color: var(--muted); font-size: 12px; }
.attendance-search { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.attendance-search input { background: var(--panel-2); }
.conversation-list { overflow-y: auto; flex: 1; min-height: 0; }
.conversation-item {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.conversation-item:hover { background: var(--panel-2); }
.conversation-item.active { background: var(--panel-2); }
.conversation-item .avatar { width: 40px; height: 40px; font-size: 14px; }
.conversation-text { min-width: 0; }
.conversation-text strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-text small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conversation-meta em { font-style: normal; font-size: 11px; color: var(--muted); }
.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.message-history {
  flex: 1 1 auto;
  height: 360px;
  max-height: 50vh;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px;
  background: var(--bg);
  scrollbar-width: thin;
}
.message-history::-webkit-scrollbar { width: 8px; }
.message-history::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; }
.message-history::-webkit-scrollbar-track { background: transparent; }
.message-bubble {
  max-width: min(640px, 80%);
  border-radius: 14px;
  padding: 10px 14px 8px;
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.message-bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.message-bubble.in { align-self: flex-start; }
.message-bubble p { margin: 0 0 6px; white-space: pre-wrap; }
.message-bubble span {
  display: block;
  font-size: 11px;
  text-align: right;
  color: var(--muted);
}
.message-bubble.out span { color: rgba(11, 20, 26, .65); }
.attendance-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.attendance-compose textarea { background: var(--panel-2); }
.attendance-side-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.attendance-side-body .info-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.attendance-side-body .info-line span { color: var(--muted); font-size: 12px; }
.attendance-patient-list {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}
.attendance-patient-row {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  text-align: left;
  color: var(--ink);
}
.attendance-patient-row.active {
  border-color: rgba(77, 159, 255, .28);
  background: rgba(77, 159, 255, .12);
}
.attendance-patient-row span {
  color: var(--muted);
  font-size: 12px;
}

.tooth {
  width: 24px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 45% 45% 35% 35%;
  background: linear-gradient(var(--panel-2), var(--panel));
  color: var(--muted);
  font-size: 10px;
  display: grid;
  place-items: end center;
  padding-bottom: 2px;
}
.tooth.active { border-color: var(--accent); background: rgba(37, 211, 102, .16); color: var(--ink); }

.treatment-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.treatment-card {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  display: grid;
  gap: 8px;
}
.treatment-card strong { color: var(--ink); }
.treatment-card span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.budget-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.budget-editor-panel {
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.patient-treatment-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.patient-treatment-layout > .grid-2 {
  grid-column: 1 / -1;
  gap: 16px;
}
.patient-treatment-layout > .embedded-panel,
.patient-budget-layout > .embedded-panel {
  margin-top: 0;
}
.patient-treatment-layout > .budget-selector-panel,
.patient-treatment-layout > .panel.embedded-panel:last-child {
  grid-column: 1 / 2;
}
.patient-care-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.patient-care-form .wide { grid-column: span 2; }
.patient-care-form .full { grid-column: 1 / -1; }
.budget-editor-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}
.budget-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.budget-editor-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-family: Sora, Manrope, sans-serif;
}
.budget-editor-grid {
  display: grid;
  gap: 14px;
}
.budget-editor-grid-main {
  grid-template-columns: 2fr 1fr 180px;
}
.budget-editor-grid-treatment {
  grid-template-columns: 1fr 1.5fr 140px 1.2fr;
}
.budget-editor-section-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  font-family: Sora, Manrope, sans-serif;
}
.budget-selector-panel .panel-body {
  display: grid;
  gap: 16px;
}
.budget-chip-box {
  display: grid;
  gap: 8px;
}
.budget-chip-box > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.budget-chip-list {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.budget-chip,
.budget-chip-placeholder {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.budget-chip.active {
  border-color: rgba(77, 159, 255, .18);
  background: var(--blue);
  color: #fff;
}
.budget-chip.scope {
  background: var(--ink);
  border-color: var(--ink);
}
.budget-chip-placeholder {
  background: transparent;
  border-style: dashed;
}
.budget-chart-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
}
.budget-chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.budget-chart-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}
.budget-chart-tabs button,
.budget-scope-row button,
.budget-hof-toolbar button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.budget-chart-tabs button {
  padding: 0 16px;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
}
.budget-chart-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
}
.budget-chart-body {
  display: grid;
  gap: 18px;
  justify-items: center;
  width: 100%;
  padding: 14px;
  background: var(--panel);
  overflow: auto;
}
.budget-tooth-btn {
  position: relative;
  width: 22px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
}
.budget-tooth-btn svg {
  width: 22px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .08));
}
.budget-tooth-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.budget-tooth-code {
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
}
.budget-tooth-btn svg path:first-child { fill: #f7f4ec; stroke: #cfd8df; stroke-width: 2; }
.budget-tooth-btn svg path:last-child { fill: none; stroke: #8796a0; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.budget-tooth-btn.active {
  transform: translateY(-1px);
}
.budget-tooth-btn.active svg path:first-child { fill: rgba(77, 159, 255, .22); stroke: var(--blue); }
.budget-tooth-btn.active svg path:last-child { stroke: var(--blue); }
.budget-odontogram {
  display: grid;
  gap: 14px;
  width: min(100%, 720px);
  max-width: 100%;
  margin: 0 auto;
  overflow: auto;
}
.budget-odontogram-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
}
.budget-odontogram-quadrant {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
}
.budget-odontogram-quadrant.top-left {
  border-right: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}
.budget-odontogram-quadrant.top-right {
  border-bottom: 1px dashed var(--line);
}
.budget-odontogram-quadrant.bottom-left {
  border-right: 1px dashed var(--line);
}
.budget-scope-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.budget-scope-row button,
.budget-hof-toolbar button {
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.budget-scope-row button.active,
.budget-hof-toolbar button.active {
  border-color: var(--blue);
  background: rgba(77, 159, 255, .12);
  color: var(--blue);
}
.budget-face-stage {
  display: grid;
  gap: 14px;
  width: min(100%, 760px);
}
.budget-face {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(220px, 1fr);
  gap: 18px;
  align-items: center;
}
.budget-face-image {
  min-height: 460px;
  height: 460px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
}
.budget-face-map {
  width: 100%;
}
.budget-face-svg {
  width: 100%;
  height: 428px;
  display: block;
}
.budget-face-svg polygon {
  fill: rgba(77, 159, 255, .04);
  stroke: rgba(255, 255, 255, .94);
  stroke-width: 6;
  stroke-dasharray: 10 6;
  cursor: pointer;
  transition: fill .18s ease, stroke .18s ease, filter .18s ease;
}
.budget-face-svg polygon.active {
  fill: rgba(77, 159, 255, .34);
  stroke: var(--blue);
  filter: drop-shadow(0 0 8px rgba(77, 159, 255, .28));
}
.budget-face-image img {
  width: 100%;
  max-width: 320px;
  max-height: 428px;
  object-fit: contain;
  object-position: center;
  display: block;
}
.budget-face-regions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.budget-face-regions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-soft);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}
.budget-face-regions button.active {
  border-color: var(--blue);
  background: rgba(77, 159, 255, .12);
  color: var(--blue);
}
.budget-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.budget-summary-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.budget-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.budget-summary-grid strong {
  color: var(--ink);
  font-family: Sora, Manrope, sans-serif;
}
.patient-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.patient-image-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
}
.patient-image-card img,
.patient-file-preview {
  width: 100%;
  height: 200px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--panel-3);
}
.patient-file-preview {
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 900;
  color: var(--blue);
}
.patient-image-copy {
  display: grid;
  gap: 4px;
}
.patient-image-copy span {
  color: var(--muted);
  font-size: 12px;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink-soft);
  font-size: 13px;
}
.checkbox-inline input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}
.budget-add-actions {
  justify-content: center;
}
.budget-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.patient-evolution-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}
.patient-evolution-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.patient-evolution-item strong { color: var(--ink); }
.patient-evolution-item span,
.patient-evolution-item small { color: var(--muted); }
.budget-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.budget-total-line strong {
  color: var(--accent);
  font-size: 18px;
}

.model-list .row, .setting-list .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 14px;
}
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.doc-tile {
  min-height: 170px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.doc-icon {
  width: 48px;
  height: 58px;
  border: 5px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
}
.doc-tile[data-doc="contract"] .doc-icon { border-color: var(--accent); }
.doc-tile[data-doc="lgpd"] .doc-icon { border-color: var(--warning); }
.doc-tile[data-doc="attestation"] .doc-icon { border-color: var(--blue); }
.signature-pad {
  width: 100%;
  height: 132px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  touch-action: none;
}
.preview-box {
  min-height: 128px;
  white-space: pre-wrap;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--ink-soft);
}

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 100px; gap: 10px; align-items: center; }
.bar-row strong { font-weight: 700; color: var(--ink); }
.bar-row span { text-align: right; color: var(--muted); font-weight: 800; }
.bar-track { height: 10px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

.chart-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.chart-card h3 { margin: 0 0 12px; font-family: Sora, Manrope, sans-serif; font-size: 15px; color: var(--ink); }
.chart-svg { width: 100%; height: 200px; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .area { fill: rgba(37, 211, 102, .18); }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart-svg .label { fill: var(--muted); font-size: 11px; }
.chart-svg .point { fill: var(--accent); }

.settings-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.settings-tabs button {
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.settings-tabs button.active { color: var(--accent); border-color: var(--accent); }

.weekday-picker {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
}
.weekday-picker label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink-soft);
  font-size: 12px;
  width: auto;
  white-space: nowrap;
}
.weekday-picker label input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

.notif-panel {
  position: fixed;
  top: 64px;
  right: 24px;
  z-index: 95;
  width: min(380px, calc(100vw - 32px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: toast-in .18s ease-out both;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.notif-head strong { font-family: Sora, Manrope, sans-serif; font-size: 15px; color: var(--ink); }
.notif-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid var(--blue);
}
.notif-item.ok { border-left-color: var(--accent); }
.notif-item.error { border-left-color: var(--danger); }
.notif-item span { color: var(--ink); font-size: 13px; }
.notif-item small { color: var(--muted); font-size: 11px; }

.toast-host {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
}
.toast {
  width: min(380px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: toast-in .22s ease-out both;
}
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(0, 0, 0, .55);
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-host.open { display: flex; }
.modal {
  width: min(860px, 100%);
  max-height: min(88vh, 920px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s ease-out both;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-family: Sora, Manrope, sans-serif; font-size: 17px; color: var(--ink); }
.modal-body {
  padding: 18px;
  overflow: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

.required-mark {
  color: var(--danger);
  font-weight: 900;
  margin-left: 2px;
}
.field input.invalid,
.field textarea.invalid,
.field select.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(241, 92, 109, .18);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}
.empty.small {
  min-height: 72px;
  font-size: 12px;
}
.hide { display: none !important; }
.error-text { color: var(--danger); }

.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 50%, var(--panel-2) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.2s linear infinite;
  border-radius: 8px;
  min-height: 14px;
}
.skeleton.row { height: 18px; margin: 6px 0; }
.skeleton.tall { height: 96px; }
.skeleton.circle { border-radius: 50%; width: 40px; height: 40px; }
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 1280px) {
  .attendance-shell { grid-template-columns: 300px minmax(0, 1fr); }
  .attendance-side { display: none; }
  .metrics, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .ops-body { grid-template-columns: 1fr; }
  .side-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  .side-nav.is-open { transform: translateX(0); }
  .side-toggle { display: grid; }
  .top-bar { padding-left: 64px; }
  .ops-main { padding: 18px 16px 28px; }
  .grid-2, .grid-3, .grid-4, .metrics, .patient-shell, .doc-grid, .patient-treatment-layout {
    grid-template-columns: 1fr;
  }
  .budget-layout, .budget-face, .budget-summary-grid, .budget-editor-grid-main, .budget-editor-grid-treatment {
    grid-template-columns: 1fr;
  }
  .budget-face-svg {
    height: 320px;
  }
  .budget-odontogram-grid {
    grid-template-columns: 1fr;
  }
  .budget-odontogram-quadrant {
    justify-content: center;
    flex-wrap: wrap;
  }
  .budget-odontogram-quadrant.top-left,
  .budget-odontogram-quadrant.bottom-left {
    border-right: 0;
  }
  .budget-odontogram-quadrant.top-right,
  .budget-odontogram-quadrant.top-left {
    border-bottom: 0;
  }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .form-grid .full { grid-column: auto; }
  .patient-care-form { grid-template-columns: 1fr; }
  .patient-care-form .wide, .patient-care-form .full { grid-column: auto; }
  .attendance-shell { grid-template-columns: 1fr; min-height: auto; }
}

/* =========================================================================
   V63 - Camada de identidade visual PREMIUM (aditiva, nao remove regras)
   Eleva todos os menus (Visao Geral, Atendimento, Agenda, Pacientes,
   Clinicas, Usuarios, Profissionais, Financeiro, Nota Fiscal,
   Indicadores, Automacoes, Configuracoes/Sistema) via cascata.
   ========================================================================= */

:root {
  --premium-ring: 0 0 0 3px rgba(37, 211, 102, .22);
  --premium-shadow-lg: 0 18px 48px rgba(0, 0, 0, .42);
  --premium-shadow-md: 0 10px 26px rgba(0, 0, 0, .30);
  --premium-shadow-sm: 0 3px 10px rgba(0, 0, 0, .22);
  --premium-accent-grad: linear-gradient(135deg, #2bdd75 0%, #1fb866 100%);
  --premium-blue-grad: linear-gradient(135deg, #6fccf2 0%, #3fa9e0 100%);
  --premium-surface-grad: linear-gradient(180deg, rgba(255, 255, 255, .03) 0%, rgba(255, 255, 255, 0) 100%);
  --premium-transition: .18s cubic-bezier(.4, 0, .2, 1);
}

body.theme-light {
  --premium-ring: 0 0 0 3px rgba(31, 159, 112, .18);
  --premium-shadow-lg: 0 20px 44px rgba(18, 32, 49, .14);
  --premium-shadow-md: 0 12px 28px rgba(18, 32, 49, .10);
  --premium-shadow-sm: 0 4px 12px rgba(18, 32, 49, .08);
  --premium-accent-grad: linear-gradient(135deg, #26b07d 0%, #1f9f70 100%);
  --premium-surface-grad: linear-gradient(180deg, rgba(18, 32, 49, .015) 0%, rgba(18, 32, 49, 0) 100%);
}

body { letter-spacing: .002em; }

/* Sidebar premium */
.side-nav {
  background:
    radial-gradient(640px 220px at -10% -5%, rgba(37, 211, 102, .10), transparent 70%),
    var(--panel);
  box-shadow: var(--premium-shadow-md);
}
.side-brand strong {
  background: var(--premium-accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .01em;
}
.side-nav button[data-page] { transition: background var(--premium-transition), color var(--premium-transition), border-color var(--premium-transition), transform var(--premium-transition); }
.side-nav button[data-page]:hover { transform: translateX(2px); }
.side-nav button[data-page].active {
  background:
    linear-gradient(90deg, rgba(37, 211, 102, .14), rgba(37, 211, 102, 0) 70%),
    var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

/* Top bar premium */
.top-bar {
  background: var(--panel);
  backdrop-filter: saturate(1.15) blur(2px);
  box-shadow: 0 1px 0 var(--line), 0 6px 20px rgba(0, 0, 0, .14);
}
.user-chip { transition: border-color var(--premium-transition), background var(--premium-transition); }
.user-chip:hover { border-color: var(--accent); }

/* Titulos premium */
.page-header h1 { letter-spacing: -.01em; }
.page-header h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--premium-accent-grad);
  opacity: .9;
}

/* Panels premium */
.panel {
  background-image: var(--premium-surface-grad);
  box-shadow: var(--premium-shadow-sm);
  transition: box-shadow var(--premium-transition), transform var(--premium-transition);
}
.panel:hover { box-shadow: var(--premium-shadow-md); }
.panel-head {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0));
}

/* KPIs premium (Visao Geral / Financeiro / Indicadores) */
.metric, .kpi {
  position: relative;
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0) 60%);
  box-shadow: var(--premium-shadow-sm);
  transition: transform var(--premium-transition), box-shadow var(--premium-transition), border-color var(--premium-transition);
  overflow: hidden;
}
.metric::before, .kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--premium-accent-grad);
  opacity: .85;
}
.metric:hover, .kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--premium-shadow-md);
  border-color: rgba(37, 211, 102, .35);
}
.metric .kpi-icon, .kpi .kpi-icon {
  background: var(--premium-accent-grad);
  color: var(--accent-ink);
  box-shadow: 0 6px 14px rgba(37, 211, 102, .28);
}

/* Botoes premium */
.btn, .icon-btn { transition: filter var(--premium-transition), transform var(--premium-transition), box-shadow var(--premium-transition), background var(--premium-transition), border-color var(--premium-transition); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary, .btn.mode-active {
  background-image: var(--premium-accent-grad);
  box-shadow: 0 8px 18px rgba(37, 211, 102, .26);
}
.btn-blue { background-image: var(--premium-blue-grad); }
.btn-primary:hover, .btn-blue:hover { filter: brightness(1.04); box-shadow: var(--premium-shadow-md); }

/* Foco acessivel premium */
input:focus, select:focus, textarea:focus { box-shadow: var(--premium-ring); }

/* Tabelas premium */
tbody tr { transition: background var(--premium-transition); }
tbody tr:hover td { background: var(--panel-2); }
.status { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04); }

/* Atendimento premium */
.attendance-list, .attendance-chat, .attendance-side { box-shadow: var(--premium-shadow-sm); }
.conversation-item { transition: background var(--premium-transition), box-shadow var(--premium-transition); }
.conversation-item.active {
  background:
    linear-gradient(90deg, rgba(37, 211, 102, .12), rgba(37, 211, 102, 0) 75%),
    var(--panel-2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.message-bubble { box-shadow: var(--premium-shadow-sm); }
.message-bubble.out { background-image: var(--premium-accent-grad); }
.unread-badge { box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }

/* Agenda premium */
.segmented button { transition: background var(--premium-transition), color var(--premium-transition); }
.segmented button.active { background-image: var(--premium-accent-grad); }
.event-card { transition: transform var(--premium-transition), box-shadow var(--premium-transition); }
.event-card:hover { transform: translateY(-1px); box-shadow: var(--premium-shadow-sm); }

/* Chips / sub-tabs / settings-tabs premium */
.chip, .sub-tabs button, .settings-tabs button { transition: color var(--premium-transition), background var(--premium-transition), border-color var(--premium-transition); }
.chip.active { background-image: var(--premium-accent-grad); }

/* Login premium */
.auth-hero, .auth-card { box-shadow: var(--premium-shadow-lg); background-image: var(--premium-surface-grad); }
.auth-hero h1 { letter-spacing: -.01em; }

/* Modal / notificacoes / toasts premium */
.modal { box-shadow: var(--premium-shadow-lg); }
.notif-panel { box-shadow: var(--premium-shadow-lg); }
.toast { box-shadow: var(--premium-shadow-md); }

/* Scrollbars premium */
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Avatares premium */
.avatar, .avatar.sm, .avatar.lg { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), var(--premium-shadow-sm); }

@media (prefers-reduced-motion: reduce) {
  .btn, .icon-btn, .panel, .metric, .kpi, .conversation-item, .event-card, .side-nav button[data-page], tbody tr, .chip, .sub-tabs button, .settings-tabs button { transition: none !important; }
  .btn:hover, .metric:hover, .kpi:hover, .event-card:hover, .side-nav button[data-page]:hover { transform: none !important; }
}

.message-attachment { margin-bottom: 8px; max-width: 100%; }
.message-attachment a { color: inherit; text-decoration: none; }
.message-attachment-image img,
.message-attachment-video video {
  display: block;
  width: min(280px, 100%);
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.message-attachment-audio audio { width: min(280px, 100%); display: block; }
.message-attachment-video a,
.message-attachment-audio a {
  display: inline-flex;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.message-attachment-file .btn {
  min-height: 34px;
  border-radius: 10px;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

