/* ==========================================================================
   Dentora — design system
   Linguagem visual própria para software clínico:
   sidebar em gradiente roxo/magenta, conteúdo claro e denso, tabelas finas,
   cartões brancos com borda de 1px, tipografia Inter 12–13px.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple-950: #38094d;
  --purple-900: #4a0e66;
  --purple-800: #5c117f;
  --purple-700: #741f9d;
  --purple-600: #8b25b8;
  --purple-500: #a233d0;
  --magenta: #c030c4;

  --primary: #7b2fbf;
  --primary-hover: #6a23a8;
  --primary-soft: #f4ecfb;
  --primary-line: #e3d3f4;

  --ink: #23232f;
  --ink-2: #43435a;
  --ink-3: #5d5d72;
  --muted: #78788c;
  --faint: #9a9aae;

  --line: #e9e9f1;
  --line-soft: #f2f2f8;
  --line-strong: #dcdce8;
  --bg: #f5f5f9;
  --surface: #ffffff;
  --surface-2: #fafafd;

  --green: #199a55;
  --green-soft: #e6f7ed;
  --red: #cf4048;
  --red-soft: #fdecec;
  --amber: #ab6f16;
  --amber-soft: #fdf3e0;
  --blue: #2b6cb0;
  --blue-soft: #eaf2fb;
  --teal: #12807f;
  --teal-soft: #e4f5f4;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(26, 15, 46, 0.04);
  --shadow-pop: 0 24px 60px rgba(28, 14, 48, 0.22), 0 2px 8px rgba(28, 14, 48, 0.08);

  --sidebar-w: 212px;
  --sidebar-w-collapsed: 66px;
  --topbar-h: 50px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }
::selection { background: rgba(139, 37, 184, 0.18); }

/* scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: #cfcfe0 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #d3d3e2; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #bcbcd2; background-clip: padding-box; }

/* ---------- ícones (sprite) ---------- */
.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }

/* ==========================================================================
   Estrutura
   ========================================================================== */
.app { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  color: #fff;
  z-index: 60;
  background:
    radial-gradient(130% 55% at 8% -10%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 60%),
    radial-gradient(80% 40% at 100% 100%, rgba(255, 122, 235, 0.28), rgba(255, 255, 255, 0) 70%),
    linear-gradient(168deg, #471064 0%, #65178a 30%, #8320ae 62%, #a52cbc 88%, #bc39c4 100%);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.06);
  transition: width 0.18s ease, transform 0.18s ease;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.5;
}
.sidebar > * { position: relative; z-index: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 62px;
  padding: 0 16px;
  flex: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 8.5px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255, 255, 255, 0.62); }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0 12px; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 35px;
  margin: 1px 10px;
  padding: 0 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.93);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.002em;
  transition: background 0.12s ease, color 0.12s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.13); }
.nav-item.active {
  background: #fff;
  color: #6b1a94;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.nav-item.active .i { stroke-width: 1.9; }
.nav-item .chev { margin-left: auto; width: 13px; height: 13px; opacity: 0.72; transition: transform 0.16s ease; }
.nav-group.open > .nav-item .chev { transform: rotate(90deg); }
.nav-item .dot-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.nav-sub { display: none; padding: 2px 0 4px; }
.nav-group.open > .nav-sub { display: block; }
.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px 0 44px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.87);
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}
.sub-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sub-item.active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  border-left-color: rgba(255, 255, 255, 0.9);
  color: #fff;
  font-weight: 600;
}
.sub-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 3px 44px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.sub-label .chev { width: 12px; height: 12px; margin-left: auto; }

/* mini cartão do paciente na sidebar */
.side-patient {
  margin: 8px 10px 4px;
  padding: 9px 9px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(40, 10, 60, 0.16);
}
.side-patient-top { display: flex; gap: 8px; align-items: flex-start; }
.side-patient .avatar { width: 34px; height: 34px; border-radius: 50%; }
.side-patient-name { font-size: 11.5px; font-weight: 650; line-height: 1.2; color: var(--ink); display: flex; align-items: center; gap: 4px; }
.side-patient-meta { font-size: 9.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.side-patient-tools { display: flex; gap: 4px; margin-top: 7px; }
.side-patient-tools .tool {
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #6b6b80;
  background: #fff;
}
.side-patient-tools .tool:hover { border-color: #cbb7e2; color: var(--primary); }

.sidebar-foot { flex: none; padding: 8px 10px 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chat-btn:hover { background: rgba(255, 255, 255, 0.12); }
.chat-btn .count {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: #fff;
  color: #7b1fa8;
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- barra superior ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin 0.18s ease; }
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5c5c72;
  cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: #f2f2f8; color: var(--ink); }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: #e8453c; box-shadow: 0 0 0 1.5px #fff; }

.global-search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--faint);
  cursor: text;
  background: transparent;
}
.global-search:hover { background: #f6f6fb; border-color: var(--line); }
.global-search .ph { font-size: 12.5px; color: var(--faint); }
.kbd {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--faint);
  background: #fff;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.topbar-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8e2bbd, #c238c2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex: none;
}
.avatar-lg { width: 44px; height: 44px; font-size: 14px; }

/* ---------- página ---------- */
.page { flex: 1; padding: 16px 18px 34px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; min-height: 30px; }
.page-title { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; color: #1c1c28; }
.page-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); margin-bottom: 6px; }
.crumb a:hover { color: var(--primary); }

/* ==========================================================================
   Componentes
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 13px 15px 0; }
.card-head.with-border { padding-bottom: 11px; border-bottom: 1px solid var(--line-soft); }
.card-title { font-size: 12.5px; font-weight: 650; color: #262632; letter-spacing: -0.005em; }
.card-sub { font-size: 10.5px; color: var(--faint); margin-top: 1px; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-body { padding: 13px 15px; }
.card-body.tight { padding: 10px 15px; }
.card-body.flush { padding: 0; }
.divider { height: 1px; background: var(--line-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.002em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 1px rgba(60, 10, 90, 0.16); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: #3d3d52; }
.btn-outline:hover { border-color: #c3b0da; color: var(--primary); }
.btn-ghost { color: #565669; }
.btn-ghost:hover { background: #f2f2f8; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.btn-soft:hover { background: #ecdcf9; }
.btn-green { background: #ddf5e4; border-color: #c3ebd0; color: #126e37; }
.btn-green:hover { background: #cdeed8; }
.btn-danger-ghost { background: #fff; border-color: #f1d2d2; color: #c0392b; }
.btn-danger-ghost:hover { background: #fdf3f3; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; border-radius: 5px; }
.btn-lg { height: 34px; padding: 0 16px; font-size: 12.5px; }
.btn-icon { width: 28px; padding: 0; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 5px 0 0 5px; }
.btn-group .btn:last-child { border-radius: 0 5px 5px 0; }
.btn-group .btn + .btn { border-left-color: transparent; }

.link { color: var(--primary); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-muted { color: var(--muted); font-size: 11px; }
.link-muted:hover { color: var(--primary); }

/* chips / badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip-green { background: var(--green-soft); color: #12703c; }
.chip-amber { background: var(--amber-soft); color: #8f5d10; }
.chip-red { background: var(--red-soft); color: #b3363d; }
.chip-purple { background: #f3e9fb; color: #6f2398; }
.chip-gray { background: #f0f0f6; color: #64647a; }
.chip-blue { background: var(--blue-soft); color: #23618d; }
.chip-teal { background: var(--teal-soft); color: #0e6d6c; }
.chip-outline { background: #fff; border: 1px solid var(--line-strong); color: var(--ink-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* tabelas */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: #8d8da0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fff;
}
.table th.right, .table td.right { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table td { padding: 8px 10px; border-bottom: 1px solid #f2f2f8; color: var(--ink-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fbfbfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .strong { color: var(--ink); font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }
.table.compact td { padding: 6px 10px; }
.table .col-check { width: 26px; }
.table input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--primary); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.filterbar { display: grid; gap: 12px; margin-bottom: 12px; }
.filterbar.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.filterbar.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filterbar.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* formulários */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.label { font-size: 10px; font-weight: 500; color: #7b7b90; letter-spacing: 0.01em; line-height: 1.2; }
.label .req { color: #c0392b; }
.input, .select, .textarea {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #dedee9;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.textarea { height: auto; min-height: 64px; padding: 7px 9px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: #b4b4c4; }
.input:focus, .select:focus, .textarea:focus { border-color: #ad74d6; box-shadow: 0 0 0 3px rgba(139, 60, 190, 0.1); }
.input:disabled { background: #f7f7fb; color: var(--muted); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23898aa0' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.select-sm, .input-sm { height: 27px; font-size: 11.5px; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 14px; height: 14px; }
.input-icon .input { padding-left: 27px; }
.search-input { position: relative; min-width: 200px; max-width: 360px; }
.list-toolbar .search-input, .toolbar .search-input { flex: 0 1 300px; }
.search-input .i { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 13px; height: 13px; }
.search-input .input { padding-left: 26px; height: 28px; font-size: 11.5px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.form-section { margin-top: 18px; }
.form-section-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: #2b2b3a; margin-bottom: 9px; }
.form-section-title .i { width: 12px; height: 12px; color: #9a9aae; }
.form-hint { font-size: 10.5px; color: var(--faint); }
.radios { display: flex; align-items: center; gap: 16px; height: 30px; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); cursor: pointer; }
.radio input { accent-color: var(--primary); width: 13px; height: 13px; }
.switch { position: relative; width: 34px; height: 19px; border-radius: 10px; background: #e3e3ee; transition: background 0.16s ease; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.16s ease; }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(15px); }

/* abas */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: 8px 11px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6d6d82;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { color: #22222e; border-bottom-color: var(--primary); }
.tab .count { font-size: 9.5px; color: var(--faint); margin-left: 4px; }
.tabs .spacer { flex: 1; }

.segmented { display: inline-flex; padding: 2px; gap: 2px; background: #f2f2f8; border-radius: 6px; }
.segmented a, .segmented button {
  border: 0;
  background: transparent;
  padding: 0 9px;
  height: 22px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #66667c;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.segmented .on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 10, 40, 0.1); }

/* barras de progresso */
.progress { height: 6px; border-radius: 4px; background: #eeeef6; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }

/* estados vazios */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 20px;
  text-align: center;
  color: var(--faint);
}
.empty .i { width: 26px; height: 26px; color: #c9c9d9; margin-bottom: 2px; }
.empty-title { font-size: 11.5px; color: #8b8ba0; font-weight: 500; }
.empty-link { font-size: 10.5px; }

/* ==========================================================================
   Painel
   ========================================================================== */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 322px; gap: 14px; align-items: start; }
.dash-main { display: grid; gap: 14px; min-width: 0; }
.dash-rail { display: grid; gap: 14px; min-width: 0; }
.dash-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }

.legend { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f4f4fa; font-size: 11px; color: var(--ink-2); }
.legend-row:last-child { border-bottom: 0; }
.legend-row .pct { width: 30px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10.5px; }
.legend-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10.5px; }

.agenda-mini { display: flex; flex-direction: column; }
.agenda-mini-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f4f4fa; align-items: flex-start; }
.agenda-mini-row:last-child { border-bottom: 0; }
.agenda-mini-time { width: 38px; flex: none; font-size: 10.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda-mini-main { flex: 1; min-width: 0; }
.agenda-mini-name { font-size: 11px; font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-mini-meta { font-size: 9.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-mini-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 9px; margin-top: 4px; border-top: 1px solid var(--line-soft); font-size: 10.5px; color: var(--muted); }

.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini-stat { border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 9px; background: #fcfcfe; }
.mini-stat .v { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-stat .k { font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.mini-stat.accent .v { color: var(--primary); }

.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; }

/* ==========================================================================
   CRM
   ========================================================================== */
.crm { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.funnel { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 0; }
.funnel-band {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 2px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  transition: filter 0.12s ease;
}
.funnel-band:hover { filter: brightness(1.06); }
.funnel-band span { opacity: 0.86; font-weight: 500; margin-left: 5px; }
.crm-metrics { display: flex; gap: 24px; margin-bottom: 12px; }
.crm-metric .k { font-size: 10px; color: var(--muted); }
.crm-metric .v { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.crm-metric .s { font-size: 9.5px; color: var(--faint); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.kpi-icon { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-body { min-width: 0; }
.kpi-value { font-size: 14px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 10.5px; font-weight: 550; color: var(--ink-2); line-height: 1.25; margin-top: 1px; }
.kpi-opp { font-size: 10px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi-period { font-size: 9px; color: var(--faint); margin-top: 1px; }

/* ==========================================================================
   Agenda
   ========================================================================== */
.agenda-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.agenda-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.3fr); gap: 12px; margin-bottom: 10px; }
.agenda-filters .field { gap: 3px; }
.agenda-filters .label { font-size: 9.5px; }

.cal { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; box-shadow: var(--shadow-card); }
.cal-scroll { overflow: auto; max-height: calc(100vh - 240px); }
.cal-grid { display: grid; grid-template-columns: 54px repeat(var(--days, 7), minmax(118px, 1fr)); min-width: 860px; }
.cal-corner { position: sticky; top: 0; left: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-soft); }
.cal-day {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line-soft);
  padding: 6px 8px 7px;
  text-align: center;
}
.cal-day.today { background: #faf5fe; }
.cal-day .wd { font-size: 9.5px; font-weight: 600; color: #8d8da2; letter-spacing: 0.02em; }
.cal-day .dt { font-size: 12px; font-weight: 650; color: var(--ink); margin-top: 1px; font-variant-numeric: tabular-nums; }
.cal-day.today .dt { color: var(--primary); }
.cal-day .badge { display: inline-block; margin-top: 2px; font-size: 8.5px; font-weight: 600; color: #fff; background: var(--primary); border-radius: 3px; padding: 0 4px; }

.cal-times { position: sticky; left: 0; z-index: 4; background: #fff; border-right: 1px solid var(--line-soft); }
.cal-time-label { height: 28px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 0 6px; font-size: 9px; color: #9c9cb0; font-variant-numeric: tabular-nums; transform: translateY(-5px); }
.cal-col { position: relative; border-left: 1px solid #f4f4fa; }
.cal-col.today { background: #fdfaff; }
.cal-slot { height: 28px; border-bottom: 1px solid #f6f6fb; }
.cal-slot.half { border-bottom-style: dashed; border-bottom-color: #f7f7fc; }
.cal-closed { position: absolute; left: 0; right: 0; background: rgba(46, 168, 104, 0.1); border: 1px solid rgba(46, 168, 104, 0.22); border-radius: 3px; color: #1f7d50; font-size: 9.5px; padding: 2px 5px; overflow: hidden; }

.appt {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 3px;
  padding: 2px 5px 2px 6px;
  background: #fff;
  border: 1px solid #ececf5;
  border-left: 3px solid var(--c, #7b2fbf);
  font-size: 9.5px;
  line-height: 1.22;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(28, 14, 48, 0.07);
  z-index: 2;
}
.appt:hover { box-shadow: 0 3px 10px rgba(28, 14, 48, 0.14); z-index: 3; }
.appt-time { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 3px; }
.appt-name { color: #2c2c3a; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-time .appt-status { position: static; display: inline-block; margin-left: 3px; }
.appt-proc { color: #8b8ba0; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt.short .appt-proc { display: none; }
.appt-status { position: absolute; top: 2px; right: 3px; width: 5px; height: 5px; border-radius: 50%; }
.appt.done { opacity: 0.82; background: #f7fbf8; }
.appt.missed { background: #fdf6f6; border-color: #f3dddd; }
.appt.cancelled { background: #f8f8fb; opacity: 0.7; text-decoration: line-through; }

.view-tabs { display: inline-flex; gap: 2px; padding: 2px; background: #f2f2f8; border-radius: 6px; margin-left: 4px; }
.view-tabs a { padding: 0 9px; height: 22px; display: inline-flex; align-items: center; border-radius: 4px; font-size: 10px; font-weight: 600; color: #66667c; }
.view-tabs .on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 10, 40, 0.1); }

.week-nav { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; background: #fff; }
.week-nav a, .week-nav button { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #55556c; cursor: pointer; }
.week-nav a:hover, .week-nav button:hover { background: #f4f4fa; }
.week-nav .range { padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--ink); border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); height: 26px; display: flex; align-items: center; white-space: nowrap; }

/* ==========================================================================
   Pacientes
   ========================================================================== */
.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.list-toolbar .spacer { flex: 1 1 auto; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); cursor: pointer; }
.check-label input { accent-color: var(--primary); width: 13px; height: 13px; }

.patient-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.patient-cell .avatar { width: 24px; height: 24px; font-size: 9px; }
.patient-cell .nm { font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-cell .reg { font-size: 9.5px; color: var(--faint); }

.pagination { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.pagination .page-num { min-width: 23px; height: 23px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 10.5px; color: var(--ink-3); }
.pagination .page-num:hover { background: #f2f2f8; }
.pagination .page-num.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.pagination .info { margin-left: auto; font-size: 10px; color: var(--faint); }

/* workspace do paciente */
.patient-workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr) 286px; gap: 14px; align-items: start; }
.patient-side { display: grid; gap: 10px; }
.patient-identity { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 12px 12px; }
.patient-identity .avatar { width: 58px; height: 58px; font-size: 18px; margin-bottom: 8px; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); }
.patient-identity .name { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 5px; }
.patient-identity .reg { font-size: 9.5px; color: var(--faint); margin-top: 1px; }
.patient-identity .chip { margin-top: 6px; }
.patient-tools { display: flex; gap: 4px; margin-top: 10px; }
.patient-tools .tool { width: 28px; height: 26px; border: 1px solid var(--line); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #6b6b80; background: #fff; }
.patient-tools .tool:hover { border-color: #cbb7e2; color: var(--primary); }

.info-list { display: flex; flex-direction: column; }
.info-block { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.info-block:last-child { border-bottom: 0; }
.info-block .t { font-size: 10.5px; font-weight: 650; color: #2f2f3d; margin-bottom: 7px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: 10.5px; }
.info-row .k { color: var(--faint); flex: none; }
.info-row .v { color: var(--ink-2); text-align: right; overflow: hidden; text-overflow: ellipsis; }

.appointment-line { padding: 10px 13px; border-bottom: 1px solid var(--line-soft); }
.appointment-line:last-child { border-bottom: 0; }
.appointment-line .when { font-size: 11px; font-weight: 600; color: var(--ink); }
.appointment-line .who { font-size: 10px; color: var(--muted); margin-top: 1px; }
.appointment-line .row { display: flex; align-items: center; gap: 6px; margin-top: 5px; }

.ai-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  margin: 0 13px 10px;
  border: 1px solid var(--primary-line);
  border-radius: 6px;
  background: linear-gradient(90deg, #faf5fe, #fff);
  font-size: 10.5px;
  color: #5e2b80;
}
.ai-banner .i { color: var(--purple-500); }

.alert-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); }
.alert-tabs .tab { font-size: 10.5px; padding: 8px 6px; }

/* ==========================================================================
   Prontuário / modal de tratamento
   ========================================================================== */
.treatment-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.treatment-row:last-child { border-bottom: 0; }
.treatment-row:hover { background: #fcfcfe; }
.treatment-code { font-size: 11.5px; font-weight: 650; color: var(--ink); }
.treatment-meta { display: flex; gap: 16px; font-size: 10px; color: var(--muted); margin-top: 2px; }
.treatment-total { margin-left: auto; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 16, 42, 0.42);
  backdrop-filter: blur(1.5px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  width: min(1120px, 100%);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: modal-in 0.16s ease-out;
}
@keyframes modal-in { from { transform: translateY(6px) scale(0.994); } to { transform: none; } }
.modal-head { flex: none; padding: 14px 18px 0; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 13px; font-weight: 650; }
.modal-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-body { flex: 1; overflow: auto; padding: 14px 18px 18px; }
.modal-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); background: #fcfcfe; }

.trt-head { display: grid; grid-template-columns: 300px 1fr; gap: 10px 24px; margin-bottom: 12px; }
.trt-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 14px; }
.trt-fields .label { font-size: 9px; }
.trt-fields .input, .trt-fields .select { height: 27px; font-size: 11px; }
.trt-tabs { margin: 2px -18px 0; padding: 0 18px; }
.trt-tabs .tab { font-size: 11px; padding: 8px 10px; }

.dental-chart { display: flex; align-items: center; gap: 16px; }
.odontogram { width: 100%; max-width: 720px; height: auto; }
.odontogram .tooth { cursor: pointer; filter: drop-shadow(0 1px 1.2px rgba(120, 90, 60, 0.22)); }
.odontogram .tooth:hover rect { fill: #F4E7FC; }
.odontogram .num { font-size: 10px; fill: #6c6c82; font-weight: 600; }
.odontogram .quad-label { font-size: 9px; fill: #a0a0b4; }

/* ==========================================================================
   Financeiro
   ========================================================================== */
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 11px 13px; }
.stat .k { font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.stat .v { font-size: 18px; font-weight: 650; letter-spacing: -0.025em; margin-top: 3px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .d { font-size: 10px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.stat .up { color: var(--green); }
.stat .down { color: var(--red); }

.legend-inline { display: flex; align-items: center; gap: 14px; font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.legend-inline .key { display: inline-flex; align-items: center; gap: 4px; }
.legend-inline .swatch { width: 7px; height: 7px; border-radius: 2px; }

.account-summary { display: flex; gap: 28px; padding: 12px 15px; border-top: 1px solid var(--line-soft); background: #fcfcfe; font-size: 10.5px; color: var(--muted); }
.account-summary b { color: var(--ink); font-weight: 650; }

/* ==========================================================================
   Configurações / personalizar
   ========================================================================== */
.settings-grid { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-nav { padding: 6px; }
.settings-nav a { display: flex; align-items: center; gap: 8px; height: 31px; padding: 0 9px; border-radius: 5px; font-size: 11.5px; font-weight: 550; color: var(--ink-2); }
.settings-nav a:hover { background: #f6f6fb; }
.settings-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 650; }

/* Loja */
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; position: relative; }
.plan.current { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(123, 47, 191, 0.18); }
.plan .tag { position: absolute; top: -1px; right: 12px; background: var(--primary); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 0 0 4px 4px; letter-spacing: 0.02em; }
.plan-name { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.plan-price { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; margin-top: 2px; }
.plan-price small { font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-desc { font-size: 10px; color: var(--faint); margin: 3px 0 12px; min-height: 26px; }
.plan-features { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 5px; }
.plan-features li { display: flex; align-items: flex-start; gap: 6px; font-size: 10.5px; color: var(--ink-2); }
.plan-features .i { color: var(--purple-500); margin-top: 1px; }
.store-item { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; min-height: 92px; }
.store-item .i { color: var(--purple-500); }
.store-item .nm { font-size: 11.5px; font-weight: 650; }
.store-item .ds { font-size: 10px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.store-item .pr { font-size: 11.5px; font-weight: 650; margin-left: auto; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Overlays: busca global, chat, toast, modo foco
   ========================================================================== */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(26, 14, 40, 0.38); display: none; }
.overlay.on { display: block; }
.palette {
  width: min(600px, calc(100% - 32px));
  margin: 9vh auto 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.palette-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.palette-head input { flex: 1; border: 0; outline: 0; font-size: 13px; font-family: inherit; color: var(--ink); background: transparent; }
.palette-list { max-height: 52vh; overflow: auto; padding: 5px; }
.palette-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.palette-item:hover, .palette-item.sel { background: var(--primary-soft); }
.palette-item .avatar { width: 24px; height: 24px; font-size: 9px; }
.palette-item .nm { font-size: 11.5px; font-weight: 550; }
.palette-item .meta { font-size: 9.5px; color: var(--faint); }
.palette-foot { display: flex; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 9.5px; color: var(--faint); }
.palette-empty { padding: 18px; text-align: center; font-size: 11px; color: var(--faint); }

.chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 330px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(28, 14, 48, 0.12);
  transform: translateX(102%);
  transition: transform 0.2s ease;
  z-index: 110;
  display: flex;
  flex-direction: column;
}
.chat-drawer.open { transform: none; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-body { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; background: #fbfbfe; }
.msg { max-width: 84%; padding: 7px 9px; border-radius: 8px; font-size: 11px; line-height: 1.4; }
.msg .who { font-size: 9px; font-weight: 650; color: var(--faint); margin-bottom: 2px; }
.msg.them { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 2px; }
.msg.me { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.chat-foot { padding: 9px 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: #241733;
  color: #fff;
  font-size: 11.5px;
  font-weight: 550;
  padding: 9px 14px;
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(20, 10, 30, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 7px;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.focus-tab {
  position: fixed;
  right: 0;
  top: 46%;
  z-index: 50;
  writing-mode: vertical-rl;
  padding: 9px 5px;
  background: var(--primary);
  color: #fff;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  border: 0;
}
body.focus-mode .sidebar { transform: translateX(-100%); }
body.focus-mode .main { margin-left: 0; }
body.sidebar-collapsed:not(.focus-mode) .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed:not(.focus-mode) .main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand { padding: 0 18px; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-item .chev,
body.sidebar-collapsed .nav-sub,
body.sidebar-collapsed .side-patient,
body.sidebar-collapsed .chat-btn span { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-item .dot-badge { right: 6px; top: 6px; transform: none; }

/* dropdown simples (CSS + JS) */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 168px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 16px 40px rgba(28, 14, 48, 0.16);
  padding: 4px;
  display: none;
  z-index: 60;
}
.menu.open { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 0; background: transparent; border-radius: 5px; font-size: 11.5px; color: var(--ink-2); text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: #f5f5fb; color: var(--primary); }
.menu .i { width: 14px; height: 14px; color: #8a8aa0; }

/* utilitários */
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 10.5px; }
.xs { font-size: 9.5px; }
.strong { font-weight: 650; color: var(--ink); }
.nums { font-variant-numeric: tabular-nums; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; }
.hidden { display: none !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1400px) {
  .patient-workspace { grid-template-columns: 208px minmax(0, 1fr); }
  .patient-workspace .patient-alerts { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm { grid-template-columns: minmax(0, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 2; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 212px; }
  body.sidebar-mobile-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .patient-workspace { grid-template-columns: minmax(0, 1fr); }
  .dash-rail { grid-template-columns: minmax(0, 1fr); }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .agenda-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar.cols-5, .filterbar.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trt-head { grid-template-columns: minmax(0, 1fr); }
  .trt-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
