/* =========================================================================
   Clínica 360 — Shell, menu expansível, agenda, ficha, comunicação e galeria (v0.3)
   ========================================================================= */

/* ---------- Fundo externo + shell flutuante (painel Netflow) ---------- */
html { min-height: 100%; }
body.has-shell {
  min-height: 100vh; background: var(--backdrop); background-attachment: fixed;
  background-image: var(--backdrop-image), var(--backdrop); background-size: cover; background-position: center;
}
.shell-wrap { padding: clamp(10px, 2.2vw, 36px) clamp(10px, 3.2vw, 56px); }
.app {
  --side-w: 264px; --side-w-min: 84px;
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start;
  min-height: calc(100vh - 2 * clamp(10px, 2.2vw, 36px) - 40px);
  background: var(--shell-bg); border-radius: var(--r-shell);
  border: 7px solid var(--shell-border); box-shadow: 0 0 0 1px var(--shell-ring), var(--shell-shadow);
  transition: grid-template-columns var(--dur-menu) var(--ease-inout), background-color var(--dur-theme) var(--ease);
  background-clip: padding-box;
}
.app[data-menu="recolhido"] { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }
.app__main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Menu lateral (referência 02) ---------- */
.app__side {
  position: sticky; top: calc(clamp(10px, 2.2vw, 36px) + 12px); margin: 12px 0 12px 12px;
  height: calc(100vh - 2 * clamp(10px, 2.2vw, 36px) - 38px); min-height: 22rem;
  background: var(--nav-surface); border-radius: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px var(--c-border);
  display: flex; flex-direction: column; z-index: 20;
  transition: background-color var(--dur-theme) var(--ease);
}
.side__scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 12px 12px; display: flex; flex-direction: column; scrollbar-width: thin; }
.side__profile { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--nav-profile-bg); min-height: 64px; color: var(--c-text); text-decoration: none;
  transition: background-color var(--dur-theme) var(--ease), padding var(--dur-menu) var(--ease-inout); }
.side__avatar { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm);
  background: linear-gradient(135deg, #2f3542, #151820); color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.7) inset; }
.side__who { min-width: 0; flex: 1; display: grid; line-height: 1.25; }
.side__who strong { font-size: var(--fs-md); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__who small { font-size: var(--fs-xs); color: var(--c-text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__chev { color: var(--c-text-muted); flex: none; }
.side__toggle {
  position: absolute; top: 34px; right: -13px; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--nav-vivid); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(29,119,255,.35); z-index: 3;
}
.side__toggle .icon { width: 14px; height: 14px; stroke-width: 2.6; transition: transform var(--dur-menu) var(--ease-inout); }
[data-menu="expandido"] .side__toggle .icon { transform: rotate(180deg); }
.side__toggle:focus-visible { box-shadow: var(--focus-ring); border-radius: 50%; }
.side__sep { height: 1px; background: var(--nav-divider); margin: 14px 8px; flex: none; }
.side__nav { display: grid; gap: 4px; }
.side__group { margin: 6px 12px 2px; font-size: 0.75rem; font-weight: var(--fw-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--c-text-subtle); white-space: nowrap;
  transition: opacity var(--dur-menu) var(--ease-inout); }
.side__item {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 12px; border-radius: 14px;
  color: var(--nav-text); text-decoration: none; font-size: 0.9375rem; font-weight: var(--fw-medium); background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
  transition: background-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease);
}
.side__item:hover { background: var(--c-surface-sunken); color: var(--c-text); }
.side__item .ico { width: 26px; height: 26px; flex: none; display: grid; place-items: center; position: relative; color: var(--nav-icon); }
.side__item .ico .icon { width: 24px; height: 24px; fill: color-mix(in srgb, currentColor 22%, transparent); stroke-width: 1.7; }
.side__item[aria-current="page"] { background: var(--nav-soft); color: var(--nav-soft-text); font-weight: var(--fw-semibold); }
.side__item[aria-current="page"] .ico { color: var(--nav-vivid); }
.side__item[aria-current="page"] .ico .icon { fill: color-mix(in srgb, currentColor 30%, transparent); }
.side__item[aria-current="page"] .ico::after { content: ""; position: absolute; top: -1px; right: -1px; width: 6px; height: 6px; border-radius: 50%; background: #6aa7ff; box-shadow: 0 0 0 2px var(--nav-soft); }
.side__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--dur-menu) var(--ease-inout); }
.side__item .c-count { flex: none; }
.side__item .tag { font-size: 0.6875rem; color: var(--c-text-subtle); font-weight: var(--fw-medium); white-space: nowrap; transition: opacity var(--dur-menu) var(--ease-inout); }
.side__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 12px; color: var(--nav-text); font-size: 0.9375rem; font-weight: var(--fw-medium); }
.side__foot { margin-top: auto; padding-top: 12px; display: grid; gap: 4px; }
.side__demo { font-size: 0.75rem; color: var(--c-text-subtle); padding: 4px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Recolhido: ícones centralizados, rótulos ocultos (mantidos acessíveis por aria-label + tooltip) */
[data-menu="recolhido"] .side__scroll { padding-left: 10px; padding-right: 10px; }
[data-menu="recolhido"] .side__profile { background: transparent; padding: 10px 6px; justify-content: center; }
[data-menu="recolhido"] .side__who, [data-menu="recolhido"] .side__chev,
[data-menu="recolhido"] .side__label, [data-menu="recolhido"] .side__item .tag,
[data-menu="recolhido"] .side__group, [data-menu="recolhido"] .side__row > span,
[data-menu="recolhido"] .side__demo { opacity: 0; width: 0; flex: 0 0 0; overflow: hidden; pointer-events: none; }
[data-menu="recolhido"] .side__group { height: 0; margin: 0; }
[data-menu="recolhido"] .side__item { justify-content: center; padding: 0; gap: 0; }
[data-menu="recolhido"] .side__row { justify-content: center; padding: 0; gap: 0; }
[data-menu="recolhido"] .side__item .c-count { position: absolute; top: 6px; left: calc(50% + 4px); min-width: 1.1rem; height: 1.1rem; font-size: 0.6875rem; padding: 0 4px; box-shadow: 0 0 0 2px var(--nav-surface); }
[data-menu="recolhido"] .side__sep { margin-left: 6px; margin-right: 6px; }

/* ---------- Barra superior (referência 01) ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px 24px; min-height: 4.5rem; position: relative; z-index: 15; }
.topbar__menu { display: none; }
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: var(--fw-bold); font-size: var(--fs-md); white-space: nowrap; color: var(--c-text); text-decoration: none; flex: none; }
.brand__logo { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent-vivid); color: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.brand__logo .icon { width: 1.15rem; height: 1.15rem; stroke-width: 2.2; }
.brand__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.topbar__nav { display: flex; gap: 2px; padding: 5px; background: var(--c-surface); border-radius: var(--r-pill); border: 1px solid var(--c-border); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar__nav a, .topbar__nav button { flex: none; padding: 8px 16px; border-radius: var(--r-pill); color: var(--c-text-muted); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-medium); border: 0; background: none; cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease); }
.topbar__nav a:hover { color: var(--c-text); background: var(--c-surface-sunken); }
.topbar__nav a[aria-current="page"] { color: var(--c-text); background: var(--c-surface-sunken); font-weight: var(--fw-semibold); }
.topbar__spacer { flex: 1; }
.topbar__group { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--c-surface); border-radius: var(--r-pill); border: 1px solid var(--c-border); flex: none; }
.topbar__group .c-btn--icon { width: 2.25rem; min-height: 2.25rem; border: 0; }
.topbar .c-select { border-radius: var(--r-pill); min-height: 2.5rem; border-color: var(--c-border); background-color: var(--c-surface); font-size: var(--fs-sm); }
.topbar__search { position: relative; width: clamp(11rem, 18vw, 17rem); flex: 0 1 auto; }
.topbar__search .c-input { border-radius: var(--r-pill); border-color: var(--c-border); min-height: 2.5rem; font-size: var(--fs-sm); }
.unit-select { max-width: 13rem; }
.role-switch { display: flex; align-items: center; gap: 6px; }
.role-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.badge-dot { position: relative; }
.badge-dot::after { content: attr(data-count); position: absolute; top: 0; right: 0; min-width: 1.05rem; height: 1.05rem; padding: 0 4px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 0.65rem; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--c-surface); }
.badge-dot[data-count="0"]::after { display: none; }
.account { display: flex; align-items: center; gap: 6px; padding-right: 6px; }
.account .c-avatar { width: 2.25rem; height: 2.25rem; background: var(--accent-vivid); color: #fff; }

/* ---------- Página ---------- */
.page { padding: 10px 28px 32px 24px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page__title { font-size: var(--fs-hero); font-weight: var(--fw-semibold); letter-spacing: -0.02em; }
.page__sub { color: var(--c-text-muted); font-size: var(--fs-sm); margin-top: 4px; }
.crumbs { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-sm); color: var(--c-text-muted); flex-wrap: wrap; }
.crumbs a { color: var(--c-text-muted); }

/* Faixa de comunicado (banner do painel) */
.announce { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.announce__ico { width: 2rem; height: 2rem; border-radius: 10px; background: var(--accent-gradient); color: #fff; display: grid; place-items: center; flex: none; }
.announce__ico .icon { width: 1.1rem; height: 1.1rem; }
.announce__txt { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--c-text-muted); }
.announce__txt strong { color: var(--c-text); }

/* Cartões de resumo (linha de “arquivos” do painel) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); min-width: 0; color: inherit; text-decoration: none;
  transition: box-shadow var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease); }
a.tile:hover, button.tile:hover { box-shadow: var(--e-2); }
.tile__ico { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid var(--c-border); display: grid; place-items: center; flex: none; color: var(--c-text); }
.tile__ico .icon { width: 1.1rem; height: 1.1rem; }
.tile__txt { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.tile__txt strong { font-size: var(--fs-md); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.tile__txt small { font-size: var(--fs-xs); color: var(--c-text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.tile { font: inherit; text-align: left; cursor: pointer; }

.toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--c-border); }
.toolbar-row .grow { flex: 1; }

/* Quadro por situação (Meu dia) */
.board { display: grid; grid-template-columns: repeat(4, minmax(15rem, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.board__col { display: grid; gap: 12px; align-content: start; min-width: 0; }
.board__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.bcard { display: grid; gap: 10px; padding: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%;
  transition: box-shadow var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease), transform var(--dur-hover) var(--ease); }
.bcard:hover { box-shadow: var(--e-2); }
.bcard__title { font-weight: var(--fw-semibold); font-size: var(--fs-md); }
.bcard__sub { font-size: var(--fs-sm); color: var(--c-text-muted); margin-top: -6px; }
.bcard__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); color: var(--c-text-muted); }
.bcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--c-text-muted); font-size: var(--fs-sm); }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); justify-self: start; }
.flag .icon { width: 0.85rem; height: 0.85rem; }
.flag--green { background: var(--c-success-bg); color: var(--c-success); }
.flag--orange { background: var(--accent-soft); color: var(--accent-soft-text); }
.flag--red { background: var(--c-danger-bg); color: var(--c-danger); }
.flag--blue { background: var(--c-info-bg); color: var(--c-info); }
.flag--gray { background: var(--c-neutral-bg); color: var(--c-neutral); }

.role-switch { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); }

/* ---------- Agenda ---------- */
.ag-toolbar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.ag-toolbar .grow { flex: 1; }
.ag-date { display: flex; align-items: center; gap: var(--s-1); }
.ag-date__label { font-weight: var(--fw-semibold); min-width: 13rem; text-align: center; }
.ag-filters { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: end; }
.ag-filters .c-field { min-width: 11rem; }
.ag-summary { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.ag-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-5); align-items: start; }
.ag-layout--noqueue { grid-template-columns: minmax(0, 1fr); }

.ag-grid-wrap { position: relative; overflow: auto; max-height: calc(100vh - 15rem); min-height: 28rem;
  border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
.ag-grid { --ppm: 1.6px; --col-w: 176px; display: grid; position: relative; }
.ag-head { position: sticky; top: 0; z-index: 12; display: grid; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.ag-head__cell { padding: var(--s-2) var(--s-3); border-left: 1px solid var(--c-border); display: flex; gap: var(--s-2); align-items: center; min-width: 0; }
.ag-head__cell:first-child { position: sticky; left: 0; z-index: 2; background: var(--c-surface); border-left: 0; }
.ag-head__name { display: block; font-weight: var(--fw-semibold); font-size: var(--fs-sm); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-head__meta { display: block; font-size: var(--fs-xs); color: var(--c-text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-body { display: grid; position: relative; }
.ag-times { position: sticky; left: 0; z-index: 10; background: var(--c-surface); border-right: 1px solid var(--c-border); }
.ag-time { height: calc(60 * var(--ppm)); font-size: var(--fs-xs); color: var(--c-text-subtle); padding: 2px var(--s-2) 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.ag-col { position: relative; border-left: 1px solid var(--c-border);
  background-image: linear-gradient(to bottom, var(--c-border) 1px, transparent 1px), linear-gradient(to bottom, var(--n-100) 1px, transparent 1px);
  background-size: 100% calc(60 * var(--ppm)), 100% calc(15 * var(--ppm)); }
.ag-col:first-of-type { border-left: 0; }
.ag-slot { position: absolute; left: 0; right: 0; height: calc(15 * var(--ppm)); border: 0; background: transparent; cursor: pointer; padding: 0; }
.ag-slot:hover { background: rgba(127, 127, 127, .08); }
.ag-slot:focus-visible { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--c-focus); border-radius: 0; }
.ag-slot .sr-only { pointer-events: none; }
.ag-block { position: absolute; left: 0; right: 0; background: var(--block-bg); border-top: 1px solid var(--c-border-strong); border-bottom: 1px solid var(--c-border-strong);
  display: flex; align-items: flex-start; padding: 4px var(--s-2); font-size: var(--fs-xs); color: var(--c-text-muted); font-weight: var(--fw-semibold); gap: 4px; pointer-events: none; }
.ag-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--c-danger); z-index: 9; pointer-events: none; }
.ag-now::before { content: ""; position: absolute; left: -5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-danger); }
.ag-now-label { position: absolute; right: 4px; height: 20px; padding: 0 5px; border-radius: 4px; background: var(--c-danger); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 20px; font-variant-numeric: tabular-nums; }

.appt {
  position: absolute; left: 4px; right: 4px; z-index: 5; border-radius: var(--r-md); overflow: hidden;
  background: var(--_bg, #fff); border: 1px solid var(--c-border); border-left: 4px solid var(--_bar, #8b95a7);
  box-shadow: var(--e-1); padding: 4px var(--s-2); text-align: left; cursor: pointer; display: grid; align-content: start; gap: 1px;
  font-size: var(--fs-sm); line-height: 1.25; color: var(--c-text); touch-action: none; user-select: none;
}
.appt:hover { box-shadow: var(--e-2); }
.appt:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-md); z-index: 7; }
.appt__row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.appt__time { font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.appt__name { font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt__proc { color: var(--c-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.appt__icons { margin-left: auto; display: inline-flex; gap: 2px; color: var(--c-text-muted); }
.appt__icons .icon { width: 0.875rem; height: 0.875rem; }
.appt__wait { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--c-warning); display: inline-flex; gap: 2px; align-items: center; }
.appt--compact { padding-top: 2px; padding-bottom: 2px; }
.appt--compact .appt__proc { display: none; }
.appt--locked { cursor: pointer; }
.appt--cancelado .appt__name, .appt--falta .appt__name { text-decoration: line-through; }
.appt__resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.appt__resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 24px; height: 3px; margin-left: -12px; border-radius: 3px; background: var(--c-border-strong); }
.appt.is-dragging { opacity: .35; }
.appt-ghost { position: absolute; z-index: 20; border-radius: var(--r-md); border: 2px dashed var(--nav-vivid); background: color-mix(in srgb, var(--nav-soft) 90%, transparent); pointer-events: none; padding: 4px var(--s-2); font-size: var(--fs-xs); font-weight: 700; color: var(--nav-soft-text); }
.appt-ghost.invalid { border-color: var(--c-danger); background: rgba(253, 236, 234, .9); color: var(--c-danger); }

/* Cores por situação do atendimento (sempre acompanhadas de texto/ícone) */
.st-agendado  { --_bg: var(--st-agendado-bg);  --_bar: var(--st-agendado-bar); }
.st-chegou    { --_bg: var(--st-chegou-bg);    --_bar: var(--st-chegou-bar); }
.st-atendimento { --_bg: var(--st-atend-bg);   --_bar: var(--st-atend-bar); }
.st-encerrado { --_bg: var(--st-encerrado-bg); --_bar: var(--st-encerrado-bar); }
.st-saida     { --_bg: var(--st-saida-bg);     --_bar: var(--st-saida-bar); }
.st-falta     { --_bg: var(--st-falta-bg);     --_bar: var(--st-falta-bar); }
.st-cancelado { --_bg: var(--st-cancelado-bg); --_bar: var(--st-cancelado-bar); }

/* Lista (celular e modo lista) */
.ag-list { display: grid; gap: var(--s-2); }
.ag-list__group { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-text-muted); padding: var(--s-3) 0 var(--s-1); }
.ag-item { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr) auto; gap: var(--s-3); align-items: center;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-left: 4px solid var(--_bar); border-radius: var(--r-md); background: var(--c-surface); }
.ag-item__time { font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.ag-item__time small { display: block; font-weight: var(--fw-regular); color: var(--c-text-subtle); font-size: var(--fs-xs); }
.ag-item__main { min-width: 0; display: grid; gap: 2px; }
.ag-item__name { font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.ag-item__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }

/* Semana */
.ag-week { display: grid; grid-template-columns: repeat(6, minmax(9.5rem, 1fr)); gap: var(--s-3); overflow-x: auto; }
.ag-week__day { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); min-width: 0; display: flex; flex-direction: column; }
.ag-week__day[aria-current="date"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ag-week__head { padding: var(--s-3); border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }
.ag-week__list { list-style: none; margin: 0; padding: var(--s-2); display: grid; gap: 4px; }
.ag-week__list li { font-size: var(--fs-xs); padding: 4px 6px; border-radius: 6px; border-left: 3px solid var(--_bar); background: var(--_bg); display: flex; gap: 6px; min-width: 0; }
.ag-week__list li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fila */
.queue { position: sticky; top: 5rem; }
.queue__list { list-style: none; margin: 0; padding: 0; }
.queue__item { padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--c-border); display: grid; gap: var(--s-2); }
.queue__item:last-child { border-bottom: 0; }
.queue__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2); }
.queue__name { font-weight: var(--fw-semibold); }
.queue__wait { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); white-space: nowrap; }
.queue__wait.is-long { color: var(--c-danger); }

/* Legenda */
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-sm); color: var(--c-text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border-left: 4px solid var(--_bar); background: var(--_bg); outline: 1px solid var(--c-border); }

/* ---------- Ficha do paciente ---------- */
.pt-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: start; padding: var(--s-5); }
.pt-head__name { font-size: var(--fs-xl); overflow-wrap: anywhere; }
.pt-head__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }
.pt-flags { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--s-4); }
.ctx-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .04em; text-transform: uppercase; }
.ctx-label--adm { color: var(--c-text-muted); }
.ctx-label--clin { color: var(--c-info); }

/* Odontograma */
.odo { display: grid; gap: var(--s-4); }
.odo__arch { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; gap: var(--s-3) var(--s-6); overflow-x: auto; padding-bottom: var(--s-2); }
.odo__quad { display: flex; gap: 4px; }
.odo__quad--right { flex-direction: row; }
.tooth { width: 2.6rem; display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); cursor: pointer; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--c-text-muted); position: relative; }
.tooth svg { width: 1.75rem; height: 1.75rem; }
.tooth svg path { fill: var(--tooth-fill); stroke: var(--c-text-subtle); stroke-width: 1.4; }
.tooth[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-soft-text); box-shadow: 0 0 0 1px var(--brand); }
.tooth .mk { position: absolute; top: -6px; right: -6px; min-width: 1.1rem; height: 1.1rem; border-radius: 50%; font-size: 0.6875rem; display: grid; place-items: center; color: #fff; border: 2px solid var(--c-surface); }
.tooth .mk--obs { background: var(--c-warning); }
.tooth .mk--plan { background: var(--c-info); }
.tooth .mk--done { background: var(--c-success); }
.tooth.has-obs svg path { fill: var(--c-warning-bg); }
.tooth.has-plan svg path { fill: var(--c-info-bg); }
.tooth.has-done svg path { fill: var(--c-success-bg); }
.odo__legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-sm); }
.odo__legend span { display: inline-flex; align-items: center; gap: 6px; }
.odo__legend b { min-width: 1.1rem; height: 1.1rem; border-radius: 50%; color: #fff; font-size: 0.6875rem; display: grid; place-items: center; }

/* Upload */
.upl-drop { border: 2px dashed var(--c-border-strong); border-radius: var(--r-lg); padding: var(--s-6); text-align: center; display: grid; gap: var(--s-2); justify-items: center; background: var(--c-surface-2); }
.upl-drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.upl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.upl-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.upl-item__name { font-weight: var(--fw-semibold); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* Status de salvamento do rascunho */
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--c-text-muted); }
.save-state--ok { color: var(--c-success); }
.save-state--err { color: var(--c-danger); }

/* ---------- Galeria ---------- */
.gal { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.gal__toc { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--s-5) var(--s-3); background: var(--c-surface); border-right: 1px solid var(--c-border); }
.gal__toc a { display: block; padding: 6px var(--s-3); border-radius: var(--r-sm); text-decoration: none; color: var(--c-text-muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.gal__toc a:hover { background: var(--c-surface-sunken); color: var(--c-text); }
.gal__main { padding: var(--s-6) var(--s-8) var(--s-12); display: grid; gap: var(--s-10); min-width: 0; max-width: 1180px; }
.gal-sec { display: grid; gap: var(--s-4); scroll-margin-top: var(--s-4); }
.gal-sec > h2 { font-size: var(--fs-xl); }
.gal-sec > p.lead { color: var(--c-text-muted); max-width: 75ch; }
.gal-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--s-4); }
.swatch { border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; background: var(--c-surface); font-size: var(--fs-sm); }
.swatch__c { height: 4rem; display: flex; align-items: flex-end; padding: var(--s-2); font-weight: 700; }
.swatch__m { padding: var(--s-2) var(--s-3); display: grid; gap: 2px; }
.swatch__m code { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--c-text-muted); }
.usage { border-left: 3px solid var(--brand); padding: var(--s-2) var(--s-4); background: var(--c-surface); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: var(--fs-sm); color: var(--c-text-muted); }
.usage strong { color: var(--c-text); }
.demo-box { border: 1px dashed var(--c-border-strong); border-radius: var(--r-lg); padding: var(--s-5); background: var(--c-surface); display: grid; gap: var(--s-4); }
code.inline { font-family: var(--font-mono); font-size: 0.875em; background: var(--c-surface-sunken); padding: 1px 5px; border-radius: 4px; }

/* ---------- Página inicial da demo ---------- */
.home { max-width: 960px; margin: 0 auto; padding: var(--s-10) var(--s-5); display: grid; gap: var(--s-6); }
.home__hero { background: var(--brand-gradient); color: var(--brand-contrast); border-radius: var(--r-xl); padding: var(--s-8); display: grid; gap: var(--s-3); }
.home__hero h1 { font-size: 2rem; }
.home__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s-4); }
.home__card { display: grid; gap: var(--s-2); padding: var(--s-5); text-decoration: none; color: inherit; }
.home__card:hover { border-color: var(--brand); }


/* ---------- Comunicação (comunicados + conversas) ---------- */
.comm { display: grid; grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr); gap: 14px; align-items: start; min-height: 30rem; }
.comm__list { display: grid; gap: 8px; align-content: start; }
.comm__filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ann-item { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%;
  transition: border-color var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease), background-color var(--dur-hover) var(--ease); }
.ann-item:hover { box-shadow: var(--e-2); }
.ann-item[aria-current="true"] { border-color: var(--c-text); box-shadow: 0 0 0 1px var(--c-text); }
.ann-item__top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ann-item__title { font-weight: var(--fw-semibold); }
.ann-item.is-unread .ann-item__title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--nav-vivid); margin-right: 8px; vertical-align: 2px; }
.ann-detail { padding: 22px 24px; display: grid; gap: 16px; }
.ann-detail__body { font-size: var(--fs-md); line-height: 1.6; max-width: 70ch; }
.ann-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.recip { display: grid; gap: 4px; max-height: 14rem; overflow: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 8px; }
.recip li { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); padding: 4px 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 8px; }
.check-grid label { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 10px 12px; background: var(--c-surface); }

.chat { display: grid; grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; min-height: min(70vh, 44rem); }
.chat__side { border-right: 1px solid var(--c-border); display: flex; flex-direction: column; min-width: 0; }
.chat__side-head { padding: 14px; display: grid; gap: 10px; border-bottom: 1px solid var(--c-border); }
.chat__convs { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--r-md); width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease); }
.conv:hover { background: var(--c-surface-sunken); }
.conv[aria-current="true"] { background: var(--nav-soft); }
.conv__txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.conv__name { font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv__last { font-size: var(--fs-sm); color: var(--c-text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv__meta { display: grid; justify-items: end; gap: 4px; font-size: var(--fs-xs); color: var(--c-text-subtle); }
.chat__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--c-border); }
.chat__head-txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.chat__head-txt small { color: var(--c-text-subtle); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--c-surface-2); min-height: 16rem; max-height: 56vh; }
.chat__day { align-self: center; font-size: var(--fs-xs); color: var(--c-text-subtle); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-pill); padding: 2px 10px; }
.chat__notice { align-self: center; font-size: var(--fs-xs); color: var(--c-text-subtle); text-align: center; max-width: 40ch; }
.msg { max-width: min(78%, 34rem); display: grid; gap: 4px; padding: 8px 12px; border-radius: 16px 16px 16px 6px; background: var(--c-surface); border: 1px solid var(--c-border); align-self: flex-start; animation: route-in var(--dur-toast) var(--ease); }
.msg--me { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: var(--nav-soft); border-color: transparent; }
.msg__author { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--nav-soft-text); }
.msg__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg__meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 0.75rem; color: var(--c-text-subtle); }
.msg__meta .icon { width: 0.85rem; height: 0.85rem; }
.msg--failed { border-color: var(--c-danger-border); background: var(--c-danger-bg); }
.msg audio { width: min(16rem, 100%); height: 2.25rem; }
.msg__file { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--r-md); background: var(--c-surface-sunken); font-size: var(--fs-sm); }
.chat__compose { border-top: 1px solid var(--c-border); padding: 10px 12px; display: grid; gap: 8px; }
.chat__compose-row { display: flex; gap: 8px; align-items: flex-end; }
.chat__compose textarea { min-height: 2.75rem; max-height: 9rem; resize: none; border-radius: 20px; padding: 10px 14px; }
.rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--r-md); background: var(--c-surface-sunken); font-size: var(--fs-sm); }
.rec__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-danger); }
.chat__back { display: none; }
.quickchat .chat { grid-template-columns: 1fr; min-height: 0; border: 0; border-radius: 0; }
.quickchat .chat__side { border-right: 0; }

@media (max-width: 1100px) {
  .comm { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .chat { grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - 14rem); }
  .chat[data-open="conv"] .chat__side { display: none; }
  .chat:not([data-open="conv"]) .chat__main { display: none; }
  .chat__back { display: inline-flex; }
  .chat__msgs { max-height: none; }
  .msg { max-width: 88%; }
  .ann-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .ag-layout { grid-template-columns: minmax(0, 1fr); }
  .queue { position: static; }
}
@media (max-width: 1023px) {
  .gal { grid-template-columns: minmax(0, 1fr); }
  .gal__toc { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 2px; border-right: 0; border-bottom: 1px solid var(--c-border); }
  .gal__main { padding: var(--s-5) var(--s-4) var(--s-10); }
}
@media (max-width: 767px) {
  .ag-date { flex: 1 1 100%; flex-wrap: wrap; }
  .ag-date__label { order: -1; flex-basis: 100%; min-width: 0; text-align: left; font-size: var(--fs-md); }
  .ag-date input[type="date"] { flex: 1 1 8rem; min-width: 0; width: auto; }
  .ag-toolbar .grow, .ag-toolbar [data-group-ctl] { display: none; }
  .ag-toolbar .c-segmented { flex: 1 1 auto; }
  .ag-toolbar .c-segmented button { flex: 1; }
  .ag-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-filters .c-field { min-width: 0; }
  .ag-filters > .c-btn { grid-column: 1 / -1; }
  .ag-item { grid-template-columns: 3.75rem minmax(0, 1fr); }
  .ag-item__actions { grid-column: 1 / -1; justify-content: flex-start; }
  .ag-item__actions .c-btn { flex: 1 1 auto; }
  .pt-head { grid-template-columns: auto minmax(0, 1fr); padding: var(--s-4); }
  .pt-head__actions { grid-column: 1 / -1; justify-content: flex-start; }
  .c-drawer__foot .c-btn { flex: 1 1 auto; }
  .c-dl { grid-template-columns: 1fr; gap: 2px var(--s-2); }
  .c-dl dd { margin-bottom: var(--s-2); }
  .home__hero { padding: var(--s-6); }
  .home__hero h1 { font-size: 1.5rem; }
  .c-diff { grid-template-columns: 1fr; }
  .c-diff > .h { display: none; }
  .c-diff > .k { background: var(--c-surface-2); }
  .c-diff > *:not(.k) { border-bottom: 0; padding-top: 2px; }
  .c-diff > [data-l]::before { content: attr(data-l) ": "; color: var(--c-text-subtle); font-weight: 400; }
  .page__head > .c-btn-group { width: 100%; }
}
@media (pointer: coarse) {
  .appt__resize { height: 14px; }
}

/* Itens de grade não podem forçar largura maior que a tela */
.page > *, .pt-grid > *, .c-tabpanel > * { min-width: 0; }
/* Títulos recebem foco programático ao trocar de tela; não exibem anel */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { box-shadow: none; }

/* ---------- Shell responsivo ---------- */
@media (max-width: 1360px) {
  .topbar__brand > span:not(.brand__logo) { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .topbar__nav { order: 10; flex-basis: 100%; }
}
/* Menu vira drawer abaixo de 1024px */
@media (max-width: 1023px) {
  .shell-wrap { padding: 0; }
  .app, .app[data-menu="recolhido"] { grid-template-columns: minmax(0, 1fr); border-radius: 0; border-width: 0; min-height: 100vh; box-shadow: none; }
  .app__side { position: fixed; z-index: 96; left: 0; top: 0; bottom: 0; height: auto; margin: 0; width: min(300px, 86vw); border-radius: 0 24px 24px 0;
    transform: translateX(-105%); visibility: hidden; transition: transform var(--dur-drawer) var(--ease), visibility 0s linear var(--dur-drawer); box-shadow: var(--e-3); }
  .app__side.is-open { transform: none; visibility: visible; transition: transform var(--dur-drawer) var(--ease), visibility 0s; }
  .side__toggle { display: none; }
  /* no drawer o menu é sempre expandido */
  .app[data-menu="recolhido"] .app__side .side__who, .app[data-menu="recolhido"] .app__side .side__chev, .app[data-menu="recolhido"] .app__side .side__label,
  .app[data-menu="recolhido"] .app__side .side__item .tag, .app[data-menu="recolhido"] .app__side .side__group, .app[data-menu="recolhido"] .app__side .side__row > span,
  .app[data-menu="recolhido"] .app__side .side__demo { opacity: 1; width: auto; flex: 1 1 auto; pointer-events: auto; }
  .app[data-menu="recolhido"] .side__group { height: auto; margin: 6px 12px 2px; }
  .app[data-menu="recolhido"] .side__item { justify-content: flex-start; padding: 0 12px; gap: 14px; }
  .app[data-menu="recolhido"] .side__row { justify-content: space-between; padding: 0 12px; }
  .app[data-menu="recolhido"] .side__item .c-count { position: static; box-shadow: none; }
  .app[data-menu="recolhido"] .side__profile { background: var(--nav-profile-bg); justify-content: flex-start; }
  .topbar__menu { display: inline-flex; }
  .topbar { padding: 12px 16px 4px; gap: 8px; }
  .page { padding: 8px 16px 28px; }
  .board { grid-template-columns: repeat(4, minmax(15rem, 78vw)); }
}
@media (max-width: 767px) {
  .topbar__search { order: 11; flex: 1 1 100%; width: auto; }
  .topbar .hide-sm { display: none; }
  .unit-select { max-width: 9.5rem; }
  .page__title { font-size: var(--fs-xl); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .announce { flex-wrap: wrap; }
}
@media (max-height: 640px) and (min-width: 1024px) {
  .side__item, .side__row { min-height: 42px; }
  .side__sep { margin: 8px; }
}

/* ---------- Movimento de arraste e ajustes de tema escuro ---------- */
.appt { transition: box-shadow var(--dur-hover) var(--ease), opacity var(--dur-hover) var(--ease); }
.appt.is-dragging { opacity: .4; outline: 2px dashed var(--c-border-strong); outline-offset: -2px; box-shadow: none; }
.appt-ghost { box-shadow: var(--e-lift); transition: top 90ms var(--ease), height 90ms var(--ease); border-radius: var(--r-md); }
.appt-ghost.invalid { border-color: var(--c-danger); }
.appt.just-moved { animation: settle 420ms var(--ease); }
@keyframes settle { from { box-shadow: 0 0 0 3px var(--nav-vivid); } to { box-shadow: var(--e-1); } }
@media (prefers-reduced-motion: reduce) { .appt-ghost { transition: none; } .appt.just-moved { animation: none; outline: 2px solid var(--nav-vivid); } }
:root[data-motion="reduzido"] .appt-ghost { transition: none; }
:root[data-theme="dark"] .ag-now-label, :root[data-theme="dark"] .tooth .mk, :root[data-theme="dark"] .odo__legend b { color: #111; }
:root[data-theme="dark"] .c-btn--danger { --_fg: #111; }
:root[data-theme="dark"] .side__avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.18) inset; }
:root[data-theme="dark"] .topbar .c-select { color-scheme: dark; }
.demo-banner { position: relative; z-index: 2; }

/* Ajustes v0.3 */
.icon { display: inline-block; vertical-align: -0.2em; }
.ann-item { text-decoration: none; }
.ann-item[aria-current="true"] { border-color: var(--nav-vivid); box-shadow: 0 0 0 1px var(--nav-vivid); }
.bcard__row span { white-space: nowrap; }
.topbar__add-txt { display: inline; }
.demo-banner__role { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.demo-select { font: inherit; font-size: var(--fs-sm); background: #3a2a12; color: #fff; border: 1px solid #806030; border-radius: 999px; padding: 2px 10px; }
.demo-banner label { color: #ffe7b3; }
@media (max-width: 1500px) { .topbar__brand > span:not(.brand__logo) { display: none; } .topbar__search { width: 11rem; } }
@media (max-width: 1360px) { .topbar__add-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .topbar__add { width: var(--control-h); padding: 0; } .unit-select { max-width: 10rem; } }
.account { text-decoration: none; color: var(--c-text); }
@media (max-width: 767px) {
  .banner-long { display: none; }
  .demo-banner { padding: 6px 12px; font-size: 0.8125rem; }
  .demo-banner > .icon { display: none; }
  .demo-banner__role { margin-left: 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px; gap: 8px; }
  .tile__ico { width: 1.9rem; height: 1.9rem; }
  .announce__txt { flex-basis: calc(100% - 3rem); }
  .unit-select { max-width: 8.5rem; }
  .topbar__group { margin-left: auto; }
}

/* Réplicas do menu na galeria */
.menu-demo { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; padding: 28px; border-radius: var(--r-xl); background: linear-gradient(160deg, #e3eaf6, #d4dfef); }
.menu-demo[data-theme="dark"] { background: linear-gradient(160deg, #283042, #1c2333); }
.menu-demo .app__side { position: relative; top: 0; height: 560px; min-height: 0; margin: 0; }
.menu-demo [data-menu="expandido"] .app__side { width: 264px; }
.menu-demo [data-menu="recolhido"] .app__side { width: 84px; }
.shell-demo { padding: 22px; border-radius: var(--r-xl); background: var(--backdrop); }
.shell-demo .app { min-height: 0; }
.account .c-avatar { background: var(--accent); color: var(--accent-contrast); }
.c-chip__n { background: var(--c-surface); color: inherit; }
/* Ajustes após comparação com a referência (01-netflow-painel) */
.topbar__brand { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-pill); padding: 4px 14px 4px 4px; }
@media (max-width: 1500px) { .topbar__brand { padding: 4px; } }
@media (min-width: 1440px) { .page__title { font-size: 2.375rem; } }
@media (max-width: 767px) { .topbar__brand { display: none; } .unit-select { max-width: 10.5rem; } }

/* =========================================================================
   v0.4 — Pedido de Rafael (01/10/2026): sem fundo externo; o sistema ocupa
   toda a tela e se expande com o monitor. Agenda em layout "Limpo".
   ========================================================================= */
body.has-shell { background: var(--shell-bg); background-image: none; }
.shell-wrap { padding: 0; }
.app, .app[data-menu="recolhido"] { border: 0; border-radius: 0; box-shadow: none; min-height: calc(100vh - 36px); background: var(--shell-bg); }
@media (min-width: 1024px) { .app__side { top: 12px; height: calc(100vh - 24px - 36px); } }
@media (max-width: 767px) { .app, .app[data-menu="recolhido"] { min-height: calc(100vh - 56px); } }

/* Agenda — layout limpo */
.ag-grid-wrap--clean { border-color: var(--c-border); }
.ag-grid-wrap--clean .ag-grid { --col-w: 120px; }
.ag-grid-wrap--clean .ag-head { border-bottom-color: var(--c-border); }
.ag-head__cell--clean { justify-content: center; padding: 10px 4px; border-left-color: transparent; }
.ag-grid-wrap--clean .ag-head__cell:first-child { background: var(--c-surface); }
.ag-prof { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; line-height: 0;
  transition: transform var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease); }
.ag-prof .prof-av { border-radius: 50%; box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 3px var(--c-border); }
.ag-prof:hover .prof-av { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 3px var(--nav-vivid); }
.ag-prof[aria-pressed="true"] .prof-av { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--nav-vivid); }
.ag-prof:focus-visible { box-shadow: var(--focus-ring); }
.ag-prof__n { position: absolute; right: -6px; bottom: -4px; min-width: 1.2rem; height: 1.2rem; padding: 0 4px; border-radius: 999px; background: var(--c-surface); color: var(--c-text-muted);
  border: 1px solid var(--c-border); font-size: 0.6875rem; font-weight: 600; line-height: calc(1.2rem - 2px); }
.ag-chair { display: inline-flex; gap: 4px; align-items: center; font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-muted); }
.ag-grid-wrap--clean .ag-col { border-left-color: var(--c-border); background-image: linear-gradient(to bottom, var(--c-border) 1px, transparent 1px); background-size: 100% calc(60 * var(--ppm)); }
.ag-grid-wrap--clean .ag-times { border-right-color: transparent; }
.ag-grid-wrap--clean .ag-time { color: var(--c-text-subtle); font-weight: 500; transform: translateY(-8px); }
.ag-grid-wrap--clean .ag-block { background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--c-border) 70%, transparent) 7px 8px); border: 0; color: var(--c-text-subtle); font-weight: 500; }
.ag-grid-wrap--clean .ag-now { border-top-width: 1.5px; }
.appt--clean { left: 3px; right: 3px; border: 0; border-left: 0; border-radius: 10px; box-shadow: none; padding: 5px 8px; gap: 0;
  background: color-mix(in srgb, var(--_bar) 13%, var(--c-surface)); }
.appt--clean::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--_bar); }
.appt--clean:hover { box-shadow: var(--e-2); background: color-mix(in srgb, var(--_bar) 18%, var(--c-surface)); }
.appt--clean .appt__time { font-weight: 600; color: var(--c-text-muted); font-size: 0.75rem; }
.appt--clean .appt__name { font-weight: 600; font-size: var(--fs-sm); }
.appt--clean.appt--tiny { padding-top: 2px; padding-bottom: 2px; }
.appt--tiny .appt__row { gap: 6px; }
.appt--tiny .appt__name { flex: 1; min-width: 0; font-size: 0.8125rem; }
.appt--clean .appt__icons { gap: 4px; }
.appt--clean .appt__wait { font-size: 0.75rem; color: var(--c-info); }
.appt__dot { display: inline-grid; place-items: center; color: var(--_bar); }
.appt__dot .icon { width: 0.8rem; height: 0.8rem; }
.appt--clean.st-cancelado, .appt--clean.st-falta { opacity: .7; }
.appt--clean.st-agendado { background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); }
.appt--clean.is-dragging { opacity: .35; }

/* Popover de pré-visualização */
.c-pop { position: fixed; z-index: 110; width: min(320px, calc(100vw - 16px)); background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); box-shadow: var(--e-3); padding: 14px; animation: pop-in var(--dur-dialog) var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: scale(var(--scale-dialog)); } }
.c-pop__close { position: absolute; top: 8px; right: 8px; }
.pv { display: grid; gap: 10px; }
.pv__head { display: flex; gap: 10px; align-items: center; padding-right: 28px; }
.pv__head .c-hint { display: block; }
.pv__name { display: block; font-size: var(--fs-md); line-height: 1.25; }
.pv__time { display: flex; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--c-text-muted); }
.pv__time strong { color: var(--c-text); }
.pv__who { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); color: var(--c-text-muted); }
.pv__badges { display: flex; gap: 6px; flex-wrap: wrap; }
.pv__flag { font-size: var(--fs-sm); color: var(--c-warning); display: flex; gap: 6px; align-items: center; }
.pv__flag--clin { color: var(--c-danger); }
.pv__actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--c-border); }
.c-tooltip--card { border-radius: 12px; display: grid; gap: 2px; padding: 8px 12px; text-align: center; }
.c-tooltip--card span { font-size: 0.75rem; opacity: .9; }
.pt-preview-btn { margin-left: 6px; }
.appt--clean .appt__resize::after { opacity: 0; transition: opacity var(--dur-hover) var(--ease); }
.appt--clean:hover .appt__resize::after, .appt--clean:focus-visible .appt__resize::after { opacity: 1; }
.appt--clean.st-agendado::before { background: var(--c-border-strong); opacity: .55; }
.pt-preview-btn { margin-left: 10px; }
[data-pv] { display: inline-block; min-height: 24px; padding: 2px 0; }

/* v0.5 — cartões da agenda "Limpo" sem traço lateral; situação por círculo (cor + forma) — pedido de Rafael */
.appt--clean, .appt--clean.st-agendado { background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); padding: 5px 8px; }
.appt--clean::before { display: none; }
.appt--clean:hover, .appt--clean.st-agendado:hover { background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border-strong), var(--e-2); }
.appt--clean .appt__row { gap: 6px; }
.appt--clean .sdot, .legend--dots .sdot { flex: none; display: inline-block; }
.appt--clean .appt__time { color: var(--c-text-muted); }
.appt--clean.st-saida .appt__name, .appt--clean.st-encerrado .appt__name { color: var(--c-text-muted); font-weight: 500; }
.appt--clean.st-falta .appt__name, .appt--clean.st-cancelado .appt__name { color: var(--c-text-subtle); font-weight: 500; text-decoration: line-through; }
.appt--clean.st-falta, .appt--clean.st-cancelado { opacity: 1; background: var(--c-surface-2); }
.appt--clean.st-atendimento { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-atend-bar) 45%, var(--c-border)); }
.appt--clean.st-chegou { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-chegou-bar) 40%, var(--c-border)); }
.appt--clean:not(.appt--tiny) .appt__name { padding-left: 18px; }
.legend--dots span { gap: 6px; }
.appt--clean .appt__wait { white-space: nowrap; }
.ag-prof { display: inline-block; cursor: default; }

/* v0.6 — resumo discreto expansível e controles de filtro em cápsula (pedido de Rafael) */
.ag-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ag-sum { display: inline-flex; align-items: center; gap: 8px; min-height: 2rem; padding: 0 12px; border-radius: 999px; border: 1px solid var(--c-border); background: var(--c-surface);
  font: inherit; font-size: var(--fs-sm); color: var(--c-text-muted); cursor: pointer; transition: border-color var(--dur-hover) var(--ease), background-color var(--dur-hover) var(--ease); }
.ag-sum strong { color: var(--c-text); }
.ag-sum:hover { border-color: var(--c-border-strong); }
.ag-sum__dots { display: inline-flex; gap: 3px; }
.ag-sum__chev { transition: transform var(--dur-menu) var(--ease-inout); }
.ag-sum[aria-expanded="true"] .ag-sum__chev { transform: rotate(180deg); }
.ag-sum__detail { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; animation: route-in var(--dur-route) var(--ease); }
.ag-sum__detail[hidden] { display: none; }
.ag-sum__item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--c-text-muted); }
.ag-sum__item strong { color: var(--c-text); }

/* Selects e data dos filtros iguais ao seletor de unidade / botão Hoje */
.ag-filters .c-select, .ag-toolbar input[type="date"], .ag-filters .c-input, .c-select--pill, .c-input--pill {
  border-radius: 999px; border-color: var(--c-border); background-color: var(--c-surface); min-height: 2.5rem; font-size: var(--fs-sm); }
.ag-filters .c-select { padding-left: 16px; }
.ag-toolbar input[type="date"] { padding: 0 14px; font-weight: var(--fw-medium); color: var(--c-text); }
.ag-filters .c-select:hover, .ag-toolbar input[type="date"]:hover, .c-select--pill:hover { border-color: var(--c-border-strong); }
.ag-filters .c-select:focus-visible, .ag-toolbar input[type="date"]:focus-visible { border-radius: 999px; }
