@font-face { font-family: Roboto; font-weight: 400; font-display: swap; src: url(/fonts/roboto-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Roboto; font-weight: 500; font-display: swap; src: url(/fonts/roboto-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Roboto; font-weight: 700; font-display: swap; src: url(/fonts/roboto-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }

:root {
  --bg: #f5f6fa;
  --card: #fff;
  --ink: #33383f;
  --ink-strong: #23272e;
  --muted: #737b86;
  --line: #e3e6ec;
  --field: #c9ced6;
  --indigo: #2f3b8f;
  --indigo-dark: #232d75;
  --indigo-soft: #d7dbfb;
  --cyan: #12b3c7;
  --circle: #eef0f4;
  --soft: #e9ebef;

  --st-agendada: #5a58b5;
  --st-realizada: #1590a5;
  --st-falta: #b5344c;
  --st-desmarcada: #79848f;
  --tint-agendada: #e8e8f7;
  --tint-realizada: #d9eff3;
  --tint-falta: #f8e1e5;
  --tint-desmarcada: #ebeef0;

  --green: #1e8449;
  --olive: #7c7a10;
  --red: #c9201f;
  --blue: #1c7ed6;
  --pending-bg: #fbf0d3;
  --pending-ink: #6f4e05;
  --radius: 14px;

  --ink-2: #474d57;
  --ink-3: #565d68;
  --primary: #2f3b8f;
  --primary-hover: #232d75;
  --red-fill: #c9201f;
  --tip-bg: #23272e;
  --on-agendada: #3d3b8e;
  --on-realizada: #0c5563;
  --on-falta: #8c2238;
  --on-desmarcada: #4a5560;
  --tint-green: #d8f5e2;
  --tint-blue: #e1eefb;
  --soft-hover: #dde0e6;
  --pill-off: #dfe1e6;
  --today-col: #fafaff;
  --now-bg: #c9f3f7;
  --now-ink: #0b6f7c;
  --other-day: #9aa1ab;
  --disabled-bg: #eceef1;
  --placeholder: #9299a3;
  --bar-dim: #a9b0e0;
  --wa-ink: #1e9c55;
  --field-bg: #fff;
  color-scheme: light;
}

/* Fundo cinza-azulado, não preto puro: reduz o contraste excessivo em leituras longas. */
:root[data-theme="dark"] {
  --bg: #14171f;
  --card: #1d212b;
  --ink: #dfe3ea;
  --ink-strong: #f0f2f6;
  --ink-2: #c2c8d2;
  --ink-3: #b3bac6;
  --muted: #a0a8b5;
  --line: #323846;
  --field: #4a5161;
  --indigo: #aeb7ff;
  --indigo-dark: #8f99f0;
  --indigo-soft: #2e3666;
  --primary: #4453c4;
  --primary-hover: #3643a8;
  --cyan: #38c6d9;
  --circle: #2a2f3b;
  --soft: #2c3240;
  --soft-hover: #373e4e;

  --st-agendada: #8d8be0;
  --st-realizada: #2aa3bb;
  --st-falta: #c23a5e;
  --st-desmarcada: #8b96a3;
  --tint-agendada: #2c2c52;
  --tint-realizada: #173a44;
  --tint-falta: #4a2130;
  --tint-desmarcada: #2c3240;

  --green: #5fd08f;
  --olive: #cfcc62;
  --red: #ff8a85;
  --blue: #7cb8f5;
  --pending-bg: #3b3115;
  --pending-ink: #f0cf7a;

  --red-fill: #c9201f;
  --tip-bg: #0d0f14;
  --on-agendada: #cfcdfb;
  --on-realizada: #a8e6f2;
  --on-falta: #ffc2cf;
  --on-desmarcada: #c8cfd8;
  --tint-green: #1a3d2a;
  --tint-blue: #1c3148;
  --pill-off: #3a4150;
  --today-col: #20253a;
  --now-bg: #174a53;
  --now-ink: #a8e6f2;
  --other-day: #8f97a5;
  --disabled-bg: #2a2f3b;
  --placeholder: #8a92a0;
  --bar-dim: #4e5a9e;
  --wa-ink: #4cc97f;
  --field-bg: #171b24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.45 Roboto, 'Segoe UI', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; color: var(--ink-strong); font-weight: 500; }
h1 { font-size: 21px; }
h2 { font-size: 15.5px; }
p { margin: 0 0 8px; }
a { color: var(--indigo); }
ul, ol { list-style: none; margin: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 8px 0; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.green { color: var(--green); }
.red { color: var(--red); }
.blue { color: var(--blue); }
.olive { color: var(--olive); }
.grey { color: var(--muted); }
.small-text { font-size: 12px; }

/* Menu lateral */

.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: none;
  width: 200px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.collapse-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--indigo-soft);
  color: var(--indigo);
  cursor: pointer;
}
.nav-item { position: relative; padding: 4px 0; }
.nav-item > a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.nav-circle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--circle);
  color: var(--ink-2);
  font-size: 16px;
}
.nav-item.active > a { color: var(--indigo); font-weight: 700; }
.nav-item.active .nav-circle, .nav-item:hover .nav-circle { background: var(--indigo-soft); color: var(--indigo); }
.rail-end { margin-top: auto; }

.flyout {
  position: absolute;
  left: 100%;
  top: 0;
  display: none;
  min-width: 190px;
  padding: 8px 0;
  background: var(--card);
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(30, 40, 90, .18);
}
.nav-item:hover .flyout { display: block; }
.flyout a { display: block; padding: 7px 16px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.flyout a:hover { background: var(--bg); color: var(--indigo); }

body.rail-collapsed .rail, body.has-subnav .rail { width: 66px; }
body.rail-collapsed .nav-label, body.has-subnav .nav-label { display: none; }
body.has-subnav .collapse-btn { visibility: hidden; }

/* Menu interno */

.subnav {
  position: sticky;
  top: 0;
  flex: none;
  width: 200px;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 12px;
  background: var(--card);
  border-left: 1px solid var(--line);
}
.section-side h3 { font-size: 12px; font-weight: 700; margin: 4px 4px 8px; }
.section-side a { display: block; padding: 7px 14px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.section-side a:hover { color: var(--indigo); }
.section-side a.active, .profile-side nav a.active { background: var(--indigo-soft); color: var(--indigo); font-weight: 500; }

.profile-side { display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-side h2 { margin: 12px 0 18px; font-size: 16px; font-weight: 700; line-height: 1.35; }
.profile-side nav { align-self: stretch; text-align: left; }
.profile-side nav a { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.profile-side nav a:hover { color: var(--indigo); }
.avatar-big { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%; background: #c6cbd2; color: #fff; font-size: 56px; margin-bottom: 18px; }

/* Barra superior */

.page { flex: 1; min-width: 0; padding: 18px 20px 40px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
  margin-bottom: 18px;
  padding: 0 16px 0 24px;
  background: var(--card);
  border-radius: var(--radius);
}
.brand { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--cyan); text-decoration: none; }
.brand span { color: var(--indigo); }
.global-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 170px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}
.global-search input { border: 0; padding: 0; outline: none; background: none; }
.search-results {
  position: absolute;
  left: 0;
  top: 38px;
  z-index: 40;
  width: 280px;
  padding: 6px;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(30, 40, 90, .18);
}
.search-results a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.search-results a:hover { background: var(--bg); }
.search-results .muted { display: block; padding: 6px 8px; }
.top-circle {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--circle);
  color: var(--ink-2);
  font-size: 15px;
}
.top-circle i {
  position: absolute;
  right: -4px;
  top: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red-fill);
  color: #fff;
  font: 700 11px/17px Roboto, sans-serif;
  text-align: center;
}
.top-circle.theme-btn { border: 0; }
.top-user { text-decoration: none; }

/* Botões */

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }

.primary, .soft, .ghost, .ghost-strong, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  padding: 7px 18px;
  background: none;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-hover); }
.primary.danger { background: var(--red-fill); }
a.button.primary { color: #fff; }
.soft { background: var(--soft); color: var(--ink-3); }
.soft:hover { background: var(--soft-hover); color: var(--ink); }
.ghost-strong { border: 1px solid var(--indigo); color: var(--indigo); background: var(--card); }
.ghost-strong:hover { background: var(--indigo-soft); }
.ghost { color: var(--muted); }
.ghost:hover { color: var(--ink); background: var(--soft); }
.small { padding: 3px 10px; font-size: 13px; }
.icon-btn { width: 30px; height: 28px; padding: 0; font-size: 14px; list-style: none; cursor: pointer; }
summary.icon-btn::-webkit-details-marker { display: none; }
.danger-text { color: var(--red); }
.link-strong { font-weight: 500; text-decoration: none; white-space: nowrap; }
.link-strong:hover { text-decoration: underline; }
button.close { padding: 2px 9px; font-weight: 400; }

/* Cartões e títulos */

.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
a.card { color: inherit; text-decoration: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-sub { font-weight: 500; font-size: 13.5px; color: var(--ink-strong); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 12px; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.report-title { display: flex; align-items: center; gap: 10px; margin: 8px 0 18px; font-size: 19px; color: var(--ink-2); }
.report-title h1 { font-weight: 400; }

.under-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.under-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 15.5px;
}
.under-tabs button.active { color: var(--indigo); font-weight: 700; border-bottom-color: var(--indigo); }

.avatar {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.avatar.sm { width: 25px; height: 25px; font-size: 10.5px; }
.avatar.big { width: 96px; height: 96px; font-size: 34px; }
.avatar.muted-avatar { width: 36px; height: 36px; background: #65717e !important; }
.name-link { font-weight: 500; color: var(--indigo); text-underline-offset: 2px; }
.name-cell { display: inline-flex; align-items: center; gap: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 12.5px; font-weight: 500; }
.badge.ativo { background: var(--tint-green); color: var(--green); }
.badge.pausado { background: var(--pending-bg); color: var(--pending-ink); }
.badge.alta { background: var(--tint-blue); color: var(--blue); }

.pay, .state { display: inline-block; padding: 1px 8px; border-radius: 5px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pay.pago { background: var(--tint-green); color: var(--green); }
.pay.pendente, .pay.parcial { background: var(--pending-bg); color: var(--pending-ink); }
.pay.pacote { background: var(--tint-agendada); color: var(--on-agendada); }
.state.agendada { background: var(--tint-agendada); color: var(--on-agendada); }
.state.realizada { background: var(--tint-realizada); color: var(--on-realizada); }
.state.falta { background: var(--tint-falta); color: var(--on-falta); }
.state.desmarcada { background: var(--tint-desmarcada); color: var(--on-desmarcada); }

/* Painel */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; }
.sessions-card, .dash-grid > section { min-height: 330px; }
.nav-mini { display: flex; align-items: center; gap: 6px; }
.pill-btn { border: 0; border-radius: 8px; padding: 3px 10px; background: var(--pill-off); color: #fff; font-size: 13px; font-weight: 500; }
.pill-btn:not(:disabled) { background: var(--primary); }
.date-line { font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.period { font-weight: 500; }

.s-list { display: flex; flex-direction: column; gap: 4px; }
.s-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; flex-wrap: wrap; }
.time-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.time-pill .icon { font-size: 12px; }
.s-state { display: inline-flex; gap: 6px; }
.s-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.wa { color: var(--wa-ink); }

.menu { position: relative; }
.menu-list {
  position: absolute;
  right: 0;
  top: 32px;
  z-index: 20;
  min-width: 160px;
  padding: 6px;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(30, 40, 90, .2);
}
.menu-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu-list button:hover { background: var(--bg); color: var(--indigo); }

.count-badge { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--red-fill); color: #fff; font-size: 10.5px; font-weight: 700; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.filter-pills button { border: 1px solid var(--field); border-radius: 6px; padding: 3px 9px; background: none; color: var(--muted); font-size: 13.5px; }
.filter-pills button.active { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); }
.pend-line { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.pend-line > span:nth-child(2) { flex: 1; }
.pend-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo); font-size: 11px; }

.dash-lower { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; }
.mini-stack { display: flex; flex-direction: column; gap: 16px; }
.mini { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-height: 86px; }
.mini b { flex: 1; font-weight: 500; color: var(--ink-2); }
.mini p { width: 100%; margin: 0; font-size: 12.5px; }
.mini-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; }

.line-input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px 0; background: none; }
.line-input:focus { outline: none; border-bottom-color: var(--indigo); }
.task-empty { display: flex; flex-direction: column; gap: 4px; padding: 32px 0; text-align: center; }
.task-list { margin-top: 8px; }
.task-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; }
.task-list li.done span { color: var(--muted); text-decoration: line-through; }

.money-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.money-card { display: flex; flex-direction: column; gap: 2px; padding: 18px 16px; }
.money-card b { font-weight: 500; font-size: 14.5px; }
.money-card span { font-size: 13px; }
.receivable { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px; }
.receivable b { font-size: 17px; color: var(--ink-strong); }
.receivable p { margin: 0; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 12px; text-align: center; }
.empty-state b { font-weight: 500; color: var(--ink-strong); }
.side-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* Agenda */

.toolbar-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; padding: 16px 20px; }
.range-title { font-size: 18px; font-weight: 500; }
.segment { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--soft); }
.segment button { border: 0; border-radius: 6px; padding: 5px 16px; background: none; color: var(--ink-3); }
.segment button.active { background: var(--card); color: var(--ink-strong); font-weight: 700; }
.toolbar-card select { width: 156px; }

.calendar { background: var(--card); border: 1px solid var(--field); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: 80px repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--field); padding-right: 12px; }
.cal-day { padding: 12px 0; text-align: center; font-weight: 700; color: var(--ink-2); }
.cal-day.today { color: var(--indigo); }
.cal-body { max-height: calc(100vh - 262px); min-height: 360px; overflow-y: auto; scrollbar-gutter: stable; }
.cal-hours div { height: var(--slot); padding: 8px 0 0 8px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.cal-col {
  position: relative;
  border-left: 1px solid var(--field);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--slot) - 1px), var(--line) calc(var(--slot) - 1px) var(--slot));
  cursor: copy;
}
.cal-col.today { background-color: var(--today-col); }
.cal-col.drop { background-color: var(--indigo-soft); }

.event {
  position: absolute;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2px 7px;
  border: 0;
  border-left: 4px solid;
  border-radius: 4px;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
}
.event strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event span { white-space: nowrap; opacity: .85; }
.event.agendada { background: var(--tint-agendada); border-color: var(--st-agendada); color: var(--on-agendada); }
.event.realizada { background: var(--tint-realizada); border-color: var(--st-realizada); color: var(--on-realizada); }
.event.falta { background: var(--tint-falta); border-color: var(--st-falta); color: var(--on-falta); }
.event.desmarcada { background: var(--tint-desmarcada); border-color: var(--st-desmarcada); color: var(--on-desmarcada); opacity: .8; }
.event.desmarcada strong { text-decoration: line-through; }
.event.unmarked { background: var(--pending-bg); border-color: #e0ad3a; color: var(--pending-ink); }
.pay-flag { color: var(--pending-ink); }

.now-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--ink-2); pointer-events: none; }
.now-line span { position: absolute; left: 2px; top: -8px; padding: 0 4px; border-radius: 4px; background: var(--now-bg); color: var(--now-ink); font-size: 10px; font-weight: 700; }

.month-view { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--field); border-radius: var(--radius); overflow: hidden; }
.month-name { padding: 10px 0; text-align: center; font-weight: 700; color: var(--ink-2); border-bottom: 1px solid var(--field); }
.month-cell { min-height: 92px; padding: 5px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.month-cell.other { background: var(--bg); color: var(--muted); }
.month-num { font-size: 13px; font-weight: 500; }
.month-cell.today .month-num { color: var(--indigo); font-weight: 700; }
.month-event { border: 0; border-radius: 4px; padding: 1px 5px; text-align: left; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-event.agendada { background: var(--tint-agendada); color: var(--on-agendada); }
.month-event.realizada { background: var(--tint-realizada); color: var(--on-realizada); }
.month-event.falta { background: var(--tint-falta); color: var(--on-falta); }
.month-event.desmarcada { background: var(--tint-desmarcada); color: var(--on-desmarcada); }

.day-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.day-head h2 { font-size: 16px; }
.per-day { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 16px; align-items: start; }
.list-head { display: flex; justify-content: space-between; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--ink-2); }
.mini-cal-head { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 10px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px 0; }
.mini-name { padding: 5px 0; background: var(--bg); text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.mini-grid button { position: relative; aspect-ratio: 1; border: 0; border-radius: 50%; background: none; }
.mini-grid button:hover { background: var(--bg); }
.mini-grid button.other { color: var(--other-day); }
.mini-grid button.today { color: var(--indigo); font-weight: 700; }
.mini-grid button.selected { background: var(--primary); color: #fff; font-weight: 700; }
.mini-grid button i { position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.500px; border-radius: 50%; background: #8c98e8; }
.mini-legend { margin: 10px 0 0; text-align: right; font-size: 12.5px; color: var(--muted); }
.mini-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8c98e8; }

/* Clientes */

.list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.inline-field { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.inline-field select { width: 320px; }
.search-card { margin-bottom: 18px; padding: 16px; }
.search-box { position: relative; display: inline-flex; align-items: center; color: var(--muted); }
.search-box input { width: 280px; padding-right: 30px; }
.search-box .icon { position: absolute; right: 9px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-strong); padding: 13px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 11px 14px; font-size: 13.5px; }
tbody tr + tr td { border-top: 1px solid var(--line); }
.num { text-align: right; white-space: nowrap; }
.actions { white-space: nowrap; }
.actions .icon-btn, .actions .small { margin-right: 4px; }
.empty-cell { text-align: center; padding: 30px; color: var(--muted); }
.wa-link { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); text-underline-offset: 2px; white-space: nowrap; }
.wa-link .icon { color: var(--wa-ink); }
.wa-square { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 4px; border-radius: 5px; background: #1e8449; color: #fff; font-size: 13px; vertical-align: middle; }

/* Ficha */

.profile-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-left, .profile-right { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.info-card h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 400; margin-bottom: 14px; }
.info-card dl { margin: 0; }
.info-card dt { font-size: 13px; color: var(--muted); }
.info-card dd { margin: 2px 0 12px; font-weight: 500; }
.info-card dd:last-child { margin-bottom: 0; }
.info-card dd.strong { font-size: 16.5px; font-weight: 700; }
.stat-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; }
.next-card { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; text-align: center; font-size: 12.5px; color: var(--muted); }
.next-card b { font-size: 16.5px; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 13px; color: var(--muted); }
.stat b { font-size: 19px; font-weight: 700; }
.plan-card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; padding: 18px 12px; }
.plan-card span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.plan-card b { font-size: 15px; font-weight: 500; }

.ribbon { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; vertical-align: middle; }
.mark { display: inline-block; width: 6px; height: 22px; border-radius: 2px; background: currentColor; }
.mark.realizada { color: var(--st-realizada); }
.mark.falta { color: var(--st-falta); height: 12px; }
.mark.desmarcada { color: var(--st-desmarcada); height: 6px; }
.mark.agendada { color: var(--st-agendada); }
.ribbon.large { height: 44px; gap: 4px; }
.ribbon.large .mark { width: 10px; height: 44px; border-radius: 3px; }
.ribbon.large .mark.falta { height: 22px; }
.ribbon.large .mark.desmarcada { height: 10px; }
.ribbon-empty { color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 13px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mark { width: 10px; height: 10px; }

.records + .records { margin-top: 12px; }
.record { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.record:hover { background: var(--bg); }
.record-date strong { display: block; font-size: 15px; font-weight: 500; }
.record-date span { color: var(--muted); font-size: 13px; }
.record-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.record-main p { margin: 6px 0 0; white-space: pre-wrap; max-width: 75ch; overflow-wrap: anywhere; }
section.card + section.card { margin-top: 0; }
#view > section.card { margin-bottom: 16px; }

.lines li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.lines li > :first-child { flex: 1; min-width: 0; }
.package-meter { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.package-meter i { width: 8px; height: 14px; border-radius: 2px; background: var(--line); }
.package-meter i.used { background: var(--indigo); }
.debt-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.debt-list p { margin: 0; font-size: 13px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.narrow { max-width: 780px; }

/* Formulários */

input, select, textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--field-bg);
  border: 1px solid var(--field);
  border-radius: 4px;
  padding: 6px 12px;
}
select { background: var(--field-bg); color: var(--muted); }
input:disabled { background: var(--disabled-bg); color: var(--muted); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--indigo); }
::placeholder { color: var(--placeholder); }

.field { display: block; margin-bottom: 14px; color: var(--ink-strong); font-size: 14.5px; }
.field em { color: var(--red); font-style: normal; }
.field input, .field select, .field textarea { margin-top: 4px; }
.grid-2, .grid-3 { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; }
.check.in-grid { padding-top: 26px; }
.phone-box { display: flex; align-items: stretch; margin-top: 4px; }
.phone-box > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--field); border-right: 0; border-radius: 4px 0 0 4px; color: var(--muted); }
.phone-box input { margin-top: 0; border-radius: 0 4px 4px 0; }

.switch-line { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 18px; font-size: 15.5px; }
.switch-line .icon { color: var(--cyan); }
.switch { appearance: none; position: relative; width: 44px !important; height: 16px; padding: 0; border: 1px solid var(--field); border-radius: 10px; background: var(--field-bg); cursor: pointer; }
.switch::before { content: ''; position: absolute; left: -2px; top: -5px; width: 24px; height: 24px; border-radius: 50%; background: #8d98a3; transition: left .15s; }
.switch:checked::before { left: 20px; background: var(--indigo); }
#patient-form.quick .full-only { display: none; }

.accordion { margin-bottom: 14px; }
.accordion summary {
  padding: 11px 18px;
  background: var(--card);
  border-radius: 6px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-strong);
  text-transform: uppercase;
  cursor: pointer;
}
.form-center { max-width: 880px; margin: 0 auto; padding: 24px 12px 12px; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.form-actions.end { justify-content: flex-end; }
.narrow .section-title, #settings-form .section-title { font-size: 16px; margin: 22px 0 10px; }
#settings-form .section-title:first-child { margin-top: 0; }
.more { margin: 12px 0; }
.more summary { cursor: pointer; font-weight: 500; color: var(--indigo); margin-bottom: 10px; }

/* Financeiro e relatórios */

.period-nav { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 18px; padding: 2px 6px; background: var(--card); border: 1px solid var(--field); border-radius: 7px; color: var(--ink-3); }
.section-head .period-nav { margin-bottom: 0; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 26px; }
.kpi { display: flex; gap: 14px; padding: 16px 12px; }
.kpi > div { flex: 1; min-width: 0; }
.kpi p { margin: 0 0 6px; }
.kpi > div > b { font-size: 24px; font-weight: 500; }
.kpi dl { margin: 6px 0 0; font-size: 13px; }
.kpi dl div { display: flex; justify-content: space-between; }
.kpi dt { color: var(--ink-2); }
.kpi dd { margin: 0; }
.kpi-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 8px; background: var(--soft); color: var(--ink-2); }
.green-bg { background: var(--tint-green); color: var(--green); }
.red-bg { background: var(--tint-falta); color: var(--red); }
.flush { padding: 0; }
.band-title { display: flex; align-items: center; gap: 10px; padding: 18px 24px; border-bottom: 1px solid var(--line); font-size: 16.5px; }
.round { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); }
.band-body { padding: 14px 24px; min-height: 180px; }

.count-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; margin-bottom: 26px; }
.count { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 12px; text-align: center; font-weight: 500; color: var(--muted); }
.count b { font-size: 19px; font-weight: 700; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.charts.one { grid-template-columns: minmax(0, 760px); }
figure { margin: 0; }
figcaption { font-size: 15.5px; font-weight: 500; color: var(--ink-strong); margin-bottom: 8px; }
figure svg { display: block; width: 100%; height: auto; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 11px; }
.axis.mid { text-anchor: middle; font-size: 12px; }
.axis.strong { fill: var(--ink); font-weight: 700; }
.bar-received { fill: var(--indigo); }
.bar-received.dim { fill: var(--bar-dim); }
.hit:hover .bar-received { fill: var(--indigo-dark); }
.seg.realizada { fill: var(--st-realizada); }
.seg.falta { fill: var(--st-falta); }
.seg.desmarcada { fill: var(--st-desmarcada); }
.hbars li { display: grid; grid-template-columns: 170px minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.hbars i { display: block; height: 14px; border-radius: 3px; background: var(--bg); }
.hbars u { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--indigo); }
.hbars b { text-align: right; }
.chart-tip { position: fixed; z-index: 20; max-width: 290px; padding: 6px 10px; border-radius: 6px; background: var(--tip-bg); color: #fff; font-size: 13px; pointer-events: none; }

/* Diálogos */

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(30, 40, 90, .3);
}
dialog.wide { width: min(700px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(35, 40, 70, .42); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
dialog h2 { font-size: 18px; }
.dialog-body { padding: 8px 20px; overflow-y: auto; }
dialog footer { display: flex; align-items: center; gap: 8px; padding: 12px 20px 16px; }
.footer-extra { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.ghost-link { color: var(--indigo); font-weight: 500; text-decoration: none; white-space: nowrap; }
.form-error { margin: 0 20px; padding: 7px 10px; border-radius: 6px; background: var(--tint-falta); color: var(--on-falta); }
.session-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-bottom: 12px; color: var(--muted); }
.session-head a { font-weight: 500; margin-left: auto; }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 10px; padding: 0; border: 1px solid var(--field); border-radius: 6px; overflow: hidden; }
.segmented label { cursor: pointer; }
.segmented label + label span { border-left: 1px solid var(--field); }
.segmented input { position: absolute; opacity: 0; width: 0; }
.segmented span { display: block; padding: 7px 4px; text-align: center; font-weight: 500; background: var(--field-bg); }
.segmented input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: -2px; }
.segmented .agendada input:checked + span { background: #5a58b5; color: #fff; }
.segmented .realizada input:checked + span { background: #0f6f80; color: #fff; }
.segmented .falta input:checked + span { background: #b5344c; color: #fff; }
.segmented .desmarcada input:checked + span { background: #5f6b77; color: #fff; }
.charged-box { margin-bottom: 12px; }
.choice-row { display: flex; gap: 8px; margin-top: 14px; }
.charge-list { max-height: 220px; overflow-y: auto; margin-bottom: 14px; }
.charge-list .check { padding: 6px 2px; border-bottom: 1px solid var(--line); }
.charge-list span { flex: 1; }

.form-actions.wrap { flex-wrap: wrap; justify-content: flex-start; }

/* Versão na nuvem */

.boot { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow-y: auto; padding: max(20px, env(safe-area-inset-top)) 16px 20px; background: var(--bg); }
.boot-card { width: min(420px, 100%); padding: 26px 22px; background: var(--card); border-radius: var(--radius); box-shadow: 0 6px 22px rgba(30, 40, 90, .08); }
.boot-card .brand { display: block; margin-bottom: 14px; font-size: 25px; }
.boot-card h1 { margin-bottom: 8px; font-size: 19px; }
.boot-card .primary, .boot-card .ghost-strong { width: 100%; min-height: 46px; margin-top: 8px; }
.boot-card .check { align-items: flex-start; margin: 10px 0; }
.boot-card .check input { margin-top: 4px; }
.boot-error { padding: 7px 10px; border-radius: 6px; background: var(--tint-falta); color: var(--on-falta); }
.warning-box { padding: 10px 12px; border-radius: 8px; background: var(--pending-bg); color: var(--pending-ink); font-size: 14px; }
.sync-bar {
  position: fixed;
  left: 50%;
  top: max(8px, env(safe-area-inset-top));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 6px 12px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: var(--primary-hover);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(30, 40, 90, .3);
}
.sync-bar.warn { background: #8c2238; }
.sync-bar button { flex: none; border: 0; border-radius: 6px; padding: 5px 10px; background: #fff; color: #232d75; font-size: 13px; font-weight: 700; }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 380px; padding: 9px 14px; border-radius: 6px; background: var(--primary-hover); color: #fff; box-shadow: 0 6px 20px rgba(30, 40, 90, .3); animation: rise .18s ease-out; overflow-wrap: anywhere; }
.toast.error { background: #8c2238; }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }

@media (max-width: 1180px) {
  .dash-grid, .per-day, .profile-grid, .split, .charts { grid-template-columns: minmax(0, 1fr); }
  .kpi-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 760px) {
  body { flex-direction: column; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; }

  /* O menu vira barra inferior, ao alcance do polegar. */
  .rail {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    align-items: stretch;
    width: 100% !important;
    height: auto;
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -2px 14px rgba(30, 40, 90, .1);
  }
  .rail hr, .collapse-btn, .flyout { display: none !important; }
  .rail-end { margin: 0; display: contents; }
  .nav-item { flex: 1; min-width: 0; padding: 0; }
  .nav-item > a { flex-direction: column; gap: 1px; font-size: 10px; }
  .nav-label { display: block !important; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-circle, .nav-item.active .nav-circle, .nav-item:hover .nav-circle { width: 28px; height: 26px; background: none; font-size: 18px; }
  .nav-item.active .nav-circle { background: var(--indigo-soft); border-radius: 12px; width: 46px; }

  body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: env(safe-area-inset-top); background: var(--bg); }
  body.has-subnav::before { background: var(--card); }
  body.has-subnav .topbar { display: none; }
  .profile-right { order: -1; }
  .subnav { position: static; width: 100%; height: auto; padding: max(10px, env(safe-area-inset-top)) 12px 8px; border-left: 0; overflow: visible; }
  .section-side { display: flex; gap: 6px; overflow-x: auto; }
  .section-side h3 { display: none; }
  .section-side a { flex: none; }
  .profile-side { flex-direction: row; flex-wrap: wrap; text-align: left; gap: 0 10px; }
  .profile-side .avatar.big, .profile-side .avatar-big { width: 34px; height: 34px; margin: 0; font-size: 13px; }
  .profile-side h2 { flex: 1; margin: 0; font-size: 16px; align-self: center; }
  .profile-side nav { width: 100%; display: flex; gap: 2px; margin-top: 8px; overflow-x: auto; }
  .profile-side nav a { flex: none; gap: 6px; padding: 7px 10px; }

  .page { padding: max(10px, env(safe-area-inset-top)) 12px 24px; }
  .topbar { gap: 10px; height: 46px; margin-bottom: 12px; padding: 0 12px; }
  .global-search { display: none; }
  .grid-2, .grid-3, .dash-lower, .money-row, .stat-row { grid-template-columns: minmax(0, 1fr); }
  .stats, .plan-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-field { flex-wrap: wrap; white-space: normal; width: 100%; }
  .inline-field select, .search-box, .search-box input { width: 100%; }
  .list-toolbar { gap: 8px; }
  .list-toolbar .primary, .day-head .primary { width: 100%; }
  .day-head { flex-wrap: wrap; }
  .patients-table th:nth-child(n+2):nth-child(-n+5), .patients-table td:nth-child(n+2):nth-child(-n+5) { display: none; }
  .calendar:not(.single) { overflow-x: auto; }
  .calendar:not(.single) .cal-head, .calendar:not(.single) .cal-body { min-width: 680px; }
  .cal-head, .cal-body { grid-template-columns: 58px repeat(var(--cols), minmax(0, 1fr)); }
  .cal-body { max-height: none; }
  .toolbar-card { padding: 12px; gap: 8px; }
  .toolbar-card .spacer { display: none; }
  .toolbar-card .primary, .toolbar-card select { flex: 1; width: auto; }
  .month-cell { min-height: 58px; padding: 3px; }
  .month-event { font-size: 10.5px; padding: 0 3px; }
  .s-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .s-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .icon-btn { width: 38px; height: 34px; }
  .kpi-row, .count-row { gap: 12px; }
  .band-title { padding: 14px 16px; }
  .band-body { padding: 12px 16px; }
  .hbars li { grid-template-columns: 130px minmax(0, 1fr) 24px; }
  .form-center { padding: 14px 4px 6px; }
  .accordion summary { padding: 10px 12px; font-size: 14px; }
  dialog form { max-height: calc(100vh - 32px - env(safe-area-inset-top)); }
  .footer-extra { flex-wrap: wrap; }
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .switch::before { transition: none; }
}
