/*
 * ─── DESENVOLVER+ · ADMINISTRAÇÃO v2 · FOLHA ÚNICA ───────────────────────────
 *
 * Sem framework. Tokens da landing (creme quente, menta como acento, carvão no
 * texto, Inter, cantos redondos), estrutura do proVytal (barra lateral com
 * grupos, barra superior, cartões planos separados por traço fino, mosaicos KPI).
 *
 * Tema claro por omissão. `html.dark` troca a rampa. Cores de sinal (azul,
 * âmbar, coral, lilás, rosa) são para estado e dados, nunca para a marca.
 */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg: #f5f1e4;
  --bg2: #ffffff;
  --bg3: #faf7ef;
  --card: #ffffff;
  --text: #1e1c1c;
  --muted: #6f675d;
  --faint: #9a9284;
  --border: rgba(30, 28, 28, 0.09);
  --border-strong: rgba(30, 28, 28, 0.32);

  --green: #94ccbe;
  --green-hover: #80baac;
  --green-deep: #6ba89a;
  --green-text: #3f8f7d;
  --green-soft: rgba(148, 204, 190, 0.22);
  --green-border: rgba(148, 204, 190, 0.6);
  --on-green: #1e1c1c;

  --tone-green: #3f8f7d;      --tone-green-soft: rgba(148, 204, 190, 0.24);   --tone-green-solid: #94ccbe;
  --tone-blue: #4d8496;       --tone-blue-soft: rgba(123, 168, 184, 0.24);    --tone-blue-solid: #7ba8b8;
  --tone-amber: #a67c1c;      --tone-amber-soft: rgba(232, 200, 124, 0.32);   --tone-amber-solid: #e8c87c;
  --tone-lilac: #8a62a3;      --tone-lilac-soft: rgba(180, 142, 198, 0.26);   --tone-lilac-solid: #b48ec6;
  --tone-coral: #c9553f;      --tone-coral-soft: rgba(232, 124, 106, 0.22);   --tone-coral-solid: #e87c6a;
  --tone-pink: #b05c72;       --tone-pink-soft: rgba(212, 136, 154, 0.26);    --tone-pink-solid: #d4889a;
  --tone-neutral: #6f675d;    --tone-neutral-soft: rgba(30, 28, 28, 0.07);    --tone-neutral-solid: #d5d0c2;

  --danger: #c9553f;
  --shadow-lg: 0 12px 32px rgba(30, 28, 28, 0.14);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 72px;
  color-scheme: light;
}

html.dark {
  --bg: #1e1c1c;
  --bg2: #292625;
  --bg3: #35312f;
  --card: #292625;
  --text: #f5f1e4;
  --muted: #b3aa9c;
  --faint: #8f877b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.3);
  --green-text: #a9d8cc;
  --green-soft: rgba(148, 204, 190, 0.14);
  --green-border: rgba(148, 204, 190, 0.4);
  --tone-green: #a9d8cc;   --tone-green-soft: rgba(148, 204, 190, 0.16);
  --tone-blue: #8fc0d0;    --tone-blue-soft: rgba(123, 168, 184, 0.18);
  --tone-amber: #e8c87c;   --tone-amber-soft: rgba(232, 200, 124, 0.16);
  --tone-lilac: #c9a9dc;   --tone-lilac-soft: rgba(180, 142, 198, 0.18);
  --tone-coral: #e87c6a;   --tone-coral-soft: rgba(232, 124, 106, 0.18);
  --tone-pink: #e0a2b3;    --tone-pink-soft: rgba(212, 136, 154, 0.18);
  --tone-neutral: #b3aa9c; --tone-neutral-soft: rgba(255, 255, 255, 0.07);
  --danger: #e87c6a;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
a { color: var(--green-text); text-decoration: none; }
a:hover { text-decoration: none; }
b, strong { font-weight: 600; }
small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
button { font: inherit; color: inherit; }
button, [role="button"], a[href], select, input[type="checkbox"], label[for] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
::selection { background: var(--green-soft); }
* { scrollbar-width: thin; scrollbar-color: rgba(120, 120, 110, 0.3) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(120, 120, 110, 0.25); border-radius: 3px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--card); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; overflow: visible; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }

/* Tons */
.tone-green { color: var(--tone-green); background: var(--tone-green-soft); }
.tone-blue { color: var(--tone-blue); background: var(--tone-blue-soft); }
.tone-amber { color: var(--tone-amber); background: var(--tone-amber-soft); }
.tone-lilac { color: var(--tone-lilac); background: var(--tone-lilac-soft); }
.tone-coral, .tone-danger { color: var(--tone-coral); background: var(--tone-coral-soft); }
.tone-pink { color: var(--tone-pink); background: var(--tone-pink-soft); }
.tone-neutral { color: var(--tone-neutral); background: var(--tone-neutral-soft); }

/* ── Marca ───────────────────────────────────────────────────────────────── */
.mark { display: inline-flex; width: 38px; height: 38px; flex: 0 0 38px; }
.mark-svg { width: 100%; height: 100%; display: block; }
.mark-sm { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.wordmark-svg { display: block; height: 17px; width: auto; color: var(--green-deep); }
html.dark .wordmark-svg { color: var(--green); }
.wordmark-text { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.wordmark-text b { color: var(--green-text); }
.brand-text small { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ── Shell ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  width: var(--sidebar-w); background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width 0.2s ease, transform 0.25s ease;
}
html.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); color: var(--text); }
html.sb-collapsed .brand { padding: 0; justify-content: center; }
html.sb-collapsed .brand-text { display: none; }
.sidebar-collapse {
  position: absolute; right: -13px; top: calc(var(--topbar-h) + 14px); z-index: 45;
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-collapse:hover { color: var(--text); border-color: var(--border-strong); }
.sidebar-collapse .icon { transition: transform 0.2s ease; }
html.sb-collapsed .sidebar-collapse .icon { transform: rotate(180deg); }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 8px; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-title { padding: 18px 14px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; overflow: hidden; }
.nav-title:first-child { padding-top: 6px; }
html.sb-collapsed .nav-title { height: 1px; padding: 0; margin: 12px 14px; background: var(--border); font-size: 0; }
.nav-item { position: relative; margin: 2px 0; }
.nav-link {
  display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px; border-radius: var(--radius);
  color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--bg3); }
.nav-link:hover .icon { color: var(--text); }
.nav-item.active > .nav-link { background: var(--bg3); font-weight: 600; }
.nav-item.active > .nav-link .icon { color: var(--green-text); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { color: var(--muted); transition: transform 0.2s ease; }
.nav-item.open > .nav-link .nav-caret { transform: rotate(90deg); }
.nav-children { display: none; padding: 2px 0 4px; }
.nav-item.open > .nav-children { display: block; }
.nav-children .nav-link { height: 40px; padding-left: 26px; font-size: 14px; color: var(--muted); }
.nav-children .nav-link .icon { width: 17px; height: 17px; }
.nav-children .nav-item.active > .nav-link, .nav-children .nav-link:hover { color: var(--text); }
html.sb-collapsed .nav { padding: 12px 10px; }
html.sb-collapsed .nav-link { justify-content: center; padding: 0; gap: 0; }
html.sb-collapsed .nav-label, html.sb-collapsed .nav-caret { display: none; }
html.sb-collapsed .nav-children { display: none !important; }
html.sb-collapsed .nav-item.has-children.active > .nav-link::after { content: ""; position: absolute; right: 10px; top: 50%; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: var(--green-text); }
html.sb-collapsed .nav-link[data-tip]:hover::before {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--bg3); color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px;
  font-size: 13px; white-space: nowrap; box-shadow: var(--shadow-lg); z-index: 60;
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--border); overflow: hidden; }
.user-card.plain { background: transparent; border: 0; padding: 10px 12px 12px; }
.avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--green-soft); color: var(--green-text); border: 2px solid var(--green-border); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.avatar-sm { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--green-text); }
.user-exit { color: var(--muted); display: inline-flex; padding: 6px; border-radius: 8px; }
.user-exit:hover { color: var(--danger); background: var(--tone-coral-soft); }
html.sb-collapsed .user-card { padding: 6px; justify-content: center; border: 0; background: transparent; }
html.sb-collapsed .user-meta, html.sb-collapsed .user-exit { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30; margin-left: var(--sidebar-w); height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--border); transition: margin-left 0.2s ease;
}
html.sb-collapsed .topbar { margin-left: var(--sidebar-w-collapsed); }
/* Três colunas: onde estou à esquerda, o dia ao centro, as ferramentas à
   direita. As laterais crescem por igual para o centro ficar mesmo ao centro. */
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: 1 1 0; justify-content: flex-end; }
.scope { display: flex; align-items: center; gap: 12px; color: var(--text); }
.scope-tile { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.scope-kicker { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); line-height: 1.2; }
.scope-name { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.iconbtn.menu-toggle { display: none; }
.theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-sun { display: block; }
html.dark .theme-toggle .icon-moon { display: none; }
.iconbtn.theme-float { position: fixed; top: 20px; right: 20px; z-index: 10; background: var(--bg2); border-color: var(--border); }

.iconbtn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; position: relative; padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.iconbtn:hover, .iconbtn.is-open { background: var(--bg3); border-color: var(--border); }
.iconbtn-sm { width: 32px; height: 32px; border-radius: 10px; }
.iconbtn .count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: var(--on-green); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.iconbtn .count:empty { display: none; }
.avatar-btn { width: auto; padding: 0 4px; }
.iconbtn.tone-neutral, .iconbtn.tone-danger, .iconbtn.tone-amber, .iconbtn.tone-green, .iconbtn.tone-blue, .iconbtn.tone-lilac { background: transparent; color: var(--muted); }
.iconbtn.tone-danger:hover { color: var(--tone-coral); background: var(--tone-coral-soft); border-color: transparent; }
.iconbtn.tone-amber:hover { color: var(--tone-amber); background: var(--tone-amber-soft); border-color: transparent; }
.iconbtn.tone-green:hover { color: var(--tone-green); background: var(--tone-green-soft); border-color: transparent; }
.iconbtn.tone-blue:hover { color: var(--tone-blue); background: var(--tone-blue-soft); border-color: transparent; }
.iconbtn.tone-lilac:hover { color: var(--tone-lilac); background: var(--tone-lilac-soft); border-color: transparent; }
.iconbtn.tone-neutral:hover { color: var(--text); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; animation: pop 0.15s ease-out;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu.wide { min-width: 340px; }

.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 14px; }
.dropdown-item:hover { background: var(--bg3); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--tone-coral-soft); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-foot { padding: 8px 12px 6px; text-align: right; font-size: 13px; }
.noti-list { max-height: 360px; overflow-y: auto; }
.noti { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.noti:hover { background: var(--bg3); }
.noti-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.noti-body { display: flex; flex-direction: column; min-width: 0; }
.noti-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.noti-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.content { margin-left: var(--sidebar-w); padding: 32px 40px 40px; min-height: calc(100vh - var(--topbar-h) - 52px); max-width: calc(var(--sidebar-w) + 1440px); transition: margin-left 0.2s ease; animation: fade 0.3s ease-out; }
.content.wide { max-width: none; }
html.sb-collapsed .content { margin-left: var(--sidebar-w-collapsed); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.footer { margin-left: var(--sidebar-w); padding: 16px 40px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; text-align: right; transition: margin-left 0.2s ease; }
html.sb-collapsed .footer { margin-left: var(--sidebar-w-collapsed); }
.overlay { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.5); display: none; }

/* ── Cabeçalho de página ─────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.page-subtitle { font-size: 15px; color: var(--muted); margin: 6px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 8px 0 12px; }
.section-title .icon { color: var(--green-text); }

/* ── Cartões ─────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 0; }
.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.card-body { padding: 24px; }
.card-head + .card-body { padding-top: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Grelhas */
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.grid > * { min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 1200px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.main-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; } }

/* ── Mosaicos KPI ────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; color: var(--text); transition: border-color 0.15s ease; min-width: 0; overflow: hidden; }
a.stat:hover { border-color: var(--border-strong); }
.stat-head { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; flex-wrap: wrap; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; }
.stat-value { font-size: 36px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.stat-value.small { font-size: 24px; line-height: 1.15; }
.stat-sub { font-size: 13px; color: var(--muted); }

.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--green-soft) 0%, var(--card) 60%); border: 1px solid var(--green-border); border-radius: var(--radius-lg); padding: 32px; margin-bottom: 20px; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 40px 40px; opacity: 0.35; mask-image: linear-gradient(90deg, transparent 20%, #000 100%); -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 100%); }
.hero > * { position: relative; z-index: 1; }
.hero-kicker { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 16px; margin-bottom: 6px; }
.hero-title { font-size: 44px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 8px; }
.hero-sub { color: var(--muted); font-size: 15px; font-style: italic; margin: 0; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 12px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; transition: border-color 0.15s ease, background 0.15s ease; }
.quick a:hover { border-color: var(--border-strong); background: var(--bg3); }
.quick .stat-icon { width: 48px; height: 48px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .noti-title { font-size: 14px; }
.list-meta { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }

/* ── Pílulas, vazio, toasts ──────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.4; background: var(--tone-neutral-soft); color: var(--tone-neutral); white-space: nowrap; }
.pill.green { background: var(--tone-green-soft); color: var(--tone-green); }
.pill.blue { background: var(--tone-blue-soft); color: var(--tone-blue); }
.pill.amber { background: var(--tone-amber-soft); color: var(--tone-amber); }
.pill.lilac { background: var(--tone-lilac-soft); color: var(--tone-lilac); }
.pill.coral { background: var(--tone-coral-soft); color: var(--tone-coral); }
.pill.pink { background: var(--tone-pink-soft); color: var(--tone-pink); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .icon { display: block; margin: 0 auto 10px; width: 28px; height: 28px; color: var(--faint); }
.empty.small { padding: 22px 12px; font-size: 13px; }
.empty.small .icon { width: 24px; height: 24px; margin-bottom: 8px; }
.empty p { margin: 0; }
.empty-action { margin-top: 14px; }

.toasts { position: fixed; top: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop 0.2s ease-out; }
.toast-icon { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--tone-green-soft); color: var(--tone-green); }
.toast.error .toast-icon { background: var(--tone-coral-soft); color: var(--tone-coral); }
.toast-body { flex: 1; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.toast-body strong { color: var(--text); font-size: 14px; }
.toast-close { border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 8px; display: inline-flex; }
.toast-close:hover { background: var(--bg3); color: var(--text); }
.toast.leaving { opacity: 0; transform: translateX(12px); transition: all 0.25s ease; }

/* ── Botões ──────────────────────────────────────────────────────────────── */
.btn { height: 42px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--green); color: var(--on-green); border-color: var(--green); }
.btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn-ghost { background: var(--bg2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg3); }
.btn-danger { background: var(--tone-coral-soft); color: var(--tone-coral); }
.btn-danger:hover { border-color: var(--tone-coral); }
.btn-soft { background: var(--green-soft); color: var(--green-text); }
.btn-soft:hover { border-color: var(--green-border); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }

/* ── Formulários ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; min-width: 0; }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.label .req { color: var(--tone-coral); }
.control { position: relative; }
.input, .select, .textarea { width: 100%; height: 42px; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; font: inherit; font-size: 14px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.textarea { height: auto; min-height: 120px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus, .richtext:focus-within { outline: 0; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly] { color: var(--muted); background: var(--bg2); }
.input:disabled, .select:disabled { opacity: 0.6; }
.input:user-invalid, .select:user-invalid, .textarea:user-invalid { border-color: var(--tone-coral); }
.input-sm, .select-sm { height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f675d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-sm { padding-right: 30px; background-position: right 8px center; }
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input {
  /* O Safari no iPhone centra o valor destes campos e só destes: ficavam
     desalinhados de tudo o resto no mesmo formulário. Mexe-se no alinhamento
     e mais nada — tirar-lhes a aparência levava o ícone do calendário atrás. */
  min-width: 0; text-align: left;
}
input[type="date"].input::-webkit-date-and-time-value,
input[type="time"].input::-webkit-date-and-time-value,
input[type="datetime-local"].input::-webkit-date-and-time-value { text-align: left; }
input[type="file"].input { padding: 8px 10px; height: auto; line-height: 1.4; }
input[type="file"].input::file-selector-button { border: 1px solid var(--border-strong); background: var(--bg2); color: var(--text); border-radius: 999px; padding: 5px 12px; margin-right: 12px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.field.has-suffix .input { padding-right: 168px; }
.suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; font-family: var(--font-mono); pointer-events: none; }
.field.has-reveal .input { padding-right: 46px; }
.reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.reveal:hover { background: var(--bg2); color: var(--text); }
.help { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-actions.left { justify-content: flex-start; }
.field-inline { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }

.toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; cursor: pointer; }
/* Altura mínima, não fixa: com a legenda a quebrar em quatro linhas — e quebra,
   num telemóvel — o texto saía por cima do rótulo e do botão de gravar. */
.toggle-track { align-self: center; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 44px; height: 26px; border-radius: 13px; background: var(--tone-neutral-solid); position: relative; transition: background 0.2s ease; flex: 0 0 44px; }
html.dark .toggle-track { background: #4a4441; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--green); outline-offset: 2px; }
.toggle-text { font-size: 13px; color: var(--muted); line-height: 1.45; padding: 4px 0; }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }

.richtext { border: 1px solid var(--border); border-radius: 12px; background: var(--bg3); overflow: hidden; }
.richtext-bar { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.richtext-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.richtext-area { padding: 12px 14px; outline: 0; font-size: 14px; line-height: 1.6; }
.richtext-area:empty::before { content: attr(data-placeholder); color: var(--faint); }
.richtext-area p { margin: 0 0 8px; }
.richtext-area ul, .richtext-area ol { margin: 0 0 8px; padding-left: 22px; }

.serie { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 16px 18px; background: var(--bg3); }
.serie .field:first-child { margin-bottom: 0; }
.serie-campos { display: grid; grid-template-columns: 200px 1fr; gap: 0 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.serie-campos .span-2 { grid-column: 1 / -1; margin: 0; }
.serie-campos .help { color: var(--green-text); font-weight: 500; }
@media (max-width: 760px) { .serie-campos { grid-template-columns: 1fr; } }

/* ── Tabela ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table th.right, .table td.right { text-align: right; }
.table th.sortable { cursor: pointer; user-select: none; padding-right: 22px; position: relative; }
.table th.sortable:hover { color: var(--text); }
.sort-caret { position: absolute; right: 8px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: 0.3; }
.table th[aria-sort="ascending"] .sort-caret { transform: rotate(-135deg); margin-top: -1px; opacity: 1; }
.table th[aria-sort="descending"] .sort-caret { opacity: 1; }
.table td { padding: 13px 14px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table td.mono, .table td[data-sort-value^="20"] { white-space: nowrap; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: var(--bg3); }
.table tfoot th { border-top: 1px solid var(--border); border-bottom: 0; color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; font-family: var(--font-mono); }
.table .dt-filters th { padding: 6px 8px 10px; }
.table td.actions, .table th.actions { width: 1%; white-space: nowrap; text-align: right; }
.table td .pill { vertical-align: middle; }
.table .thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--bg3); display: block; }
.table .clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }

.dt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dt-toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dt-range { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dt-range .input { width: 160px; }
.dt-info { font-size: 13px; color: var(--muted); }
.dt-search { position: relative; display: inline-flex; align-items: center; }
.dt-search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.dt-search .input { width: 260px; padding-left: 36px; }
.dt-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; color: var(--muted); }
.dt-empty .icon { width: 28px; height: 28px; color: var(--faint); }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--border); }
.dt-size { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dt-size .select { width: auto; }
.dt-pages { display: flex; gap: 4px; }
.dt-pages button, .dt-page { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; }
.dt-pages button:hover, a.dt-page:hover { background: var(--bg3); color: var(--text); }
.dt-pages button.current, .dt-page.current { background: var(--bg3); color: var(--text); border-color: var(--border); }
.dt-page.is-off { opacity: 0.4; }
.dt-server .seg a { display: contents; }
.dt-server .dt-toolbar { margin: 0; }
.table thead .sortable a { color: inherit; display: inline-flex; align-items: center; gap: 4px; padding-right: 14px; position: relative; }
.table thead .sortable a .sort-caret { right: 0; }
.dt-pages button:disabled { opacity: 0.4; cursor: default; }
.card-body.flush .dt-toolbar { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

.table th.pick, .table td.pick { width: 1%; padding-right: 0; }
.table input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--green); vertical-align: middle; }
.dt-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--green-soft); border-bottom: 1px solid var(--green-border); }
.dt-bulk-count { font-size: 13px; color: var(--text); }
.dt-bulk-count b { font-size: 15px; }
.dt-bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.select.pay { width: auto; min-width: 132px; height: 32px; padding: 4px 28px 4px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; background-position: right 8px center; }
.select.pay-pendente { background-color: var(--tone-amber-soft); color: var(--tone-amber); border-color: transparent; }
.select.pay-pago { background-color: var(--tone-green-soft); color: var(--tone-green); border-color: transparent; }

/* ── Diálogo ─────────────────────────────────────────────────────────────── */
.dialog { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.dialog.wide { max-width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(30, 28, 28, 0.5); backdrop-filter: blur(2px); }
.dialog-inner { margin: 0; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 18px; }
.dialog-body { padding: 20px 24px; }
.dialog-message { font-size: 15px; margin-bottom: 14px; }
.dialog-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.dialog-notes li { margin-bottom: 6px; }
.dialog-notes strong { color: var(--text); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }
.dialog .field:last-child { margin-bottom: 0; }

/* ── Perfil ──────────────────────────────────────────────────────────────── */
.profile-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.profile-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--green-soft); color: var(--green-text); border: 3px solid var(--green-border); display: inline-flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex: 0 0 84px; }
.profile-name { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.profile-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.kv dt { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.kv dd.empty-val { color: var(--faint); font-style: italic; }
.map { width: 100%; height: 380px; border: 0; border-radius: 14px; background: var(--bg3); display: block; }
.map.tall { height: 560px; }
.map-legend { display: flex; gap: 16px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ── Cartões de parceria / mensagens ─────────────────────────────────────── */
.msg-card .card-head { padding-top: 18px; }
.msg-from { display: flex; align-items: center; gap: 12px; }
.msg-from .avatar { width: 40px; height: 40px; flex-basis: 40px; }
.msg-name { font-weight: 600; }
.msg-email { font-size: 12px; color: var(--muted); }
.msg-date { font-size: 12px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.msg-text { font-size: 14px; line-height: 1.6; }
.prose { font-size: 14px; line-height: 1.65; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 22px; }

/* ── Bloco de notas ──────────────────────────────────────────────────────── */
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.notes li:last-child { border-bottom: 0; }
.notes label { flex: 1; cursor: pointer; font-size: 15px; display: flex; align-items: center; gap: 12px; }
.notes input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); flex: 0 0 18px; }
.notes li.done label { color: var(--muted); text-decoration: line-through; }
.notes-add { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 18px; }
.notes-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

/* ── Calendário ──────────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; text-transform: capitalize; min-width: 200px; text-align: center; }
.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal-dow { padding: 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: center; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg3); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; cursor: default; display: flex; flex-direction: column; gap: 4px; }
.cal-day.selectable { cursor: pointer; }
.cal-day.selectable:hover { background: var(--bg3); }
.cal-day.other { color: var(--faint); background: repeating-linear-gradient(135deg, transparent 0 8px, var(--tone-neutral-soft) 8px 9px); }
.cal-day.today { background: var(--green-soft); }
.cal-daynum { font-size: 13px; font-weight: 600; color: var(--muted); align-self: flex-end; padding: 2px 6px; }
.cal-day.today .cal-daynum { color: var(--on-green); background: var(--green); border-radius: 999px; }
.cal-day.other .cal-daynum { color: var(--faint); }
.cal-ev { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid currentColor; text-align: left; }
.cal-ev.clickable { cursor: pointer; }
.cal-ev.clickable:hover { filter: brightness(0.96); }
.cal-ev .cal-ev-time { font-family: var(--font-mono); font-weight: 500; opacity: 0.8; margin-right: 4px; }
.cal-more { font-size: 11px; color: var(--muted); padding: 2px 6px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.cal-week.one { grid-template-columns: 1fr; }
.cal-col { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 320px; display: flex; flex-direction: column; gap: 6px; }
.cal-col.today { border-color: var(--green-border); }
.cal-col.selectable { cursor: pointer; }
.cal-col-head { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.cal-col-head b { color: var(--text); font-size: 16px; letter-spacing: 0; }
.cal-col .cal-ev { white-space: normal; }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-legend .pill { padding: 6px 14px; font-size: 12px; }
.cal-empty { font-size: 12px; color: var(--faint); padding: 8px; }

/* ── Gráficos ────────────────────────────────────────────────────────────── */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-axis text { fill: var(--muted); font-size: 11px; font-family: var(--font-sans); }
.chart-grid line { stroke: var(--border); }
.chart-tip { position: absolute; pointer-events: none; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; z-index: 5; }
.chart-wrap { position: relative; }
.donut-center { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; fill: var(--text); }
.donut-center-sub { font-size: 11px; fill: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Documento (comprovativo) ────────────────────────────────────────────── */
.doc-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.doc { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 44px; max-width: 900px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 20px; border-bottom: 2px solid var(--text); margin-bottom: 24px; }
.doc-brand { display: flex; align-items: center; gap: 14px; }
.doc-brand .mark-svg { width: 46px; height: 46px; }
.doc-brand strong { display: block; font-size: 20px; letter-spacing: -0.02em; }
.doc-brand span { font-size: 12px; color: var(--muted); }
.doc-meta { text-align: right; font-size: 12px; color: var(--muted); line-height: 1.7; }
.doc-meta div:first-child { font-weight: 600; color: var(--text); font-size: 14px; }
.doc-party { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 28px; }
.doc-party > div { display: flex; flex-direction: column; gap: 2px; }
.doc-party strong { font-size: 15px; }
.doc-party span { font-size: 13px; color: var(--muted); }
.doc-label { font-size: 10px !important; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.doc-table { margin-bottom: 24px; }
.doc-table tfoot th { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); }
.doc-foot p { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 16px; }
.doc-sign { margin-top: 40px; text-align: right; font-size: 12px; color: var(--muted); }
.doc-line { width: 260px; border-bottom: 1px solid var(--text); margin: 32px 0 6px auto; }
@media (max-width: 760px) { .doc { padding: 24px 20px; } .doc-party { grid-template-columns: 1fr; gap: 16px; } }

/* ── Login ───────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { position: relative; overflow: hidden; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; }
.auth-side::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; opacity: 0.5; mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 70%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; background: var(--green); opacity: 0.12; filter: blur(80px); right: -140px; bottom: -140px; }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.auth-brand .mark { width: 44px; height: 44px; flex-basis: 44px; }
.auth-brand .wordmark-svg { height: 18px; }
.auth-quote { font-size: 44px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; max-width: 520px; }
.auth-quote em { color: var(--green-text); font-style: normal; }
.auth-foot { color: var(--muted); font-size: 13px; }
.auth-foot .pills { margin-top: 14px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 34px; letter-spacing: -0.02em; margin: 26px 0 6px; }
.auth-card .lead { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 22px; flex-wrap: wrap; }
.auth-esqueci { font-size: 13px; color: var(--muted); }
.auth-esqueci:hover { color: var(--text); }
.auth-card .btn-block { height: 46px; font-size: 15px; }
.alert { border-radius: 12px; border: 1px solid; padding: 14px 16px; font-size: 14px; margin-top: 20px; }
.alert.error { background: var(--tone-coral-soft); border-color: var(--tone-coral); }
.alert.success { background: var(--green-soft); border-color: var(--green-border); }

/* ── Pesquisa global ─────────────────────────────────────────────────────── */
.search-btn { display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg3); color: var(--muted); font-size: 13px; min-width: 220px; }
.search-btn:hover { border-color: var(--border-strong); color: var(--text); }
.search-btn span { flex: 1; text-align: left; }
kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--muted); }
.palette { max-width: min(640px, calc(100vw - 32px)); margin-top: 10vh; }
.palette .dialog-inner { padding: 0; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); }
.palette-input input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); outline: 0; }
.palette-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.palette-hint { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.palette-group { padding: 10px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); }
.palette-item:hover, .palette-item.active { background: var(--bg3); }
.palette-ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--tone-neutral-soft); color: var(--muted); }
.palette-text { display: flex; flex-direction: column; min-width: 0; }
.palette-text span { font-weight: 500; }
.palette-text small { color: var(--muted); }

/* ── Ilustrações ─────────────────────────────────────────────────────────── */
.empty.has-illustration { padding: 28px 20px; }
.empty-illustration { display: block; width: 160px; height: 140px; margin: 0 auto 12px; object-fit: contain; }
.hero-art { position: absolute; right: 24px; bottom: -14px; width: 220px; height: 200px; object-fit: contain; z-index: 1; pointer-events: none; }
.hero.with-art { padding-right: 260px; min-height: 200px; }
.auth-art { position: absolute; right: -20px; bottom: 60px; width: min(46%, 380px); z-index: 1; pointer-events: none; opacity: 0.95; }
.dt-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg-sm button { padding: 5px 11px; font-size: 12px; }
.dt-sum { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.dt-sum small { font-size: 11px; color: var(--muted); font-weight: 400; }
.sparkline { width: 100%; height: 56px; margin-top: 4px; }
.sparkline svg { width: 100%; height: 100%; display: block; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.delta.up { background: var(--tone-green-soft); color: var(--tone-green); }
.delta.down { background: var(--tone-coral-soft); color: var(--tone-coral); }
.delta.flat { background: var(--tone-neutral-soft); color: var(--tone-neutral); }
.stat-head .delta { margin-left: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.chip.active { border-color: var(--border-strong); color: var(--text); }
.chip .dot { margin: 0; }
.chip.off { opacity: 0.45; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.person { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; gap: 14px; align-items: center; color: var(--text); }
.person .avatar { width: 56px; height: 56px; flex-basis: 56px; font-size: 18px; }
.person-body { flex: 1; min-width: 0; }
.person-name { font-weight: 600; font-size: 15px; }
.person-sub { font-size: 12px; color: var(--muted); }
.person-kpis { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.person-kpis span { display: flex; flex-direction: column; }
.person-kpis b { font-size: 15px; color: var(--text); letter-spacing: -0.01em; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 18px 18px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--card); }
.timeline time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.year-nav { display: inline-flex; align-items: center; gap: 4px; }
.mini-table td, .mini-table th { padding: 10px 12px; }
.mini-table tbody tr:first-child td { border-top: 0; }

.seg a { display: contents; }
.btn.is-disabled { opacity: 0.5; }
.page-actions .seg { height: 42px; align-items: center; }

/* ── Utilitários ─────────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0 !important; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.flex { display: flex; gap: 8px; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ── Responsivo ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  body { overflow-x: hidden; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  html.sb-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  html.sb-open .overlay { display: block; }
  html.sb-collapsed .brand-text, html.sb-collapsed .nav-label, html.sb-collapsed .nav-caret, html.sb-collapsed .user-meta { display: flex; }
  html.sb-collapsed .nav-link { justify-content: flex-start; padding: 0 14px; gap: 14px; }
  html.sb-collapsed .nav-item.open > .nav-children { display: block !important; }
  html.sb-collapsed .nav-title { height: auto; margin: 0; background: transparent; font-size: 11px; padding: 18px 14px 6px; }
  .topbar, .content, .footer { margin-left: 0 !important; }
  .content { padding: 20px 16px 32px; }
  .footer { padding: 14px 16px; }
  .iconbtn.menu-toggle { display: inline-flex; }
  .search-btn { min-width: 0; width: 42px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .dt-toolbar, .dt-toolbar-left, .dt-toolbar-right { min-width: 0; max-width: 100%; }
  .dt-range .input { width: 140px; }
  .stats .stat { min-width: 0; }
  .card-body { overflow-x: auto; }
  .stat-value { font-size: 28px; }
  .sidebar-collapse { display: none; }
  .scope-kicker { display: none; }
  .topbar { padding: 0 12px; }
  .page-title { font-size: 26px; }
  .hero-title { font-size: 34px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .kv { grid-template-columns: 1fr; }
  .cal-day { min-height: 80px; }
  .cal-week { grid-template-columns: 1fr; }
  .dt-search .input { width: 100%; }
  .dt-search { width: 100%; }
}
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }
@media (max-width: 600px) { .card-body { padding: 16px; } .dt-toolbar, .dt-foot { padding: 12px 16px; } }

a.user-card { color: var(--text); }
a.user-card:hover { border-color: var(--border-strong); }
.print-only { display: none; }
.print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 16px; font-size: 12px; }

/* ── Impressão ───────────────────────────────────────────────────────────── */
/* ── Avisos em caixa ─────────────────────────────────────────────────────── */
.callout {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg2); font-size: 14px; line-height: 1.55;
}
.callout .icon { flex: none; margin-top: 2px; color: var(--muted); }
.callout b { display: block; }
.callout-info { border-left: 3px solid var(--tone-blue-solid); }
.callout-ok { border-left: 3px solid var(--green); }
.callout-erro { border-left: 3px solid var(--tone-coral); background: var(--tone-coral-soft); }
.callout-erro .icon { color: var(--tone-coral); }
.choques { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.choques li { line-height: 1.5; }
.callout-ok .icon { color: var(--green); }
.callout .help { margin: 8px 0 0; }

.copy-row { display: flex; gap: 8px; margin-top: 12px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 13px; }

/* ── Papéis e permissões ─────────────────────────────────────────────────── */
.papeis { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .papeis { grid-template-columns: 1fr; } }

.papel-lista { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 90px; }
.papel-item {
  display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.papel-item:hover { border-color: var(--border-strong); }
.papel-item.active { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--card)); }
.papel-nome { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.papel-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.papel-barra { display: block; height: 4px; margin-top: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.papel-barra i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.papel-novo { display: flex; align-items: center; gap: 10px; border-style: dashed; color: var(--muted); font-weight: 500; }
.papel-novo:hover { color: var(--text); }

.papel-cabecalho { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .papel-cabecalho { grid-template-columns: 1fr; } }
.papel-rodape {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
}
.papel-rodape .flex { display: flex; gap: 10px; }

.perm-lista { display: flex; flex-direction: column; gap: 22px; margin-top: 24px; }
.perm-grupo { border: 0; padding: 0; margin: 0; }
.perm-grupo legend {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.perm-grupo legend .muted { font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }
.perm-grupo legend button { margin-left: auto; text-transform: none; letter-spacing: 0; }

.perm {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start;
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
}
.perm:hover { background: var(--bg2); border-color: var(--border); }
.perm input { position: absolute; opacity: 0; width: 0; height: 0; }
.perm-marca {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; color: transparent; transition: all 0.15s ease;
}
.perm input:checked + .perm-marca { background: var(--green); border-color: var(--green); color: #1e1c1c; }
.perm input:focus-visible + .perm-marca { outline: 2px solid var(--green); outline-offset: 2px; }
.perm-texto { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.perm-texto .muted { font-size: 13px; }
.perm-texto code { font-size: 11px; color: var(--muted); opacity: 0.7; }

/* ── Registo por convite ─────────────────────────────────────────────────── */
.convite-resumo {
  display: grid; gap: 14px; margin: 20px 0 24px; padding: 16px 18px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg2);
}
.convite-resumo > div { display: flex; flex-direction: column; gap: 2px; }
.convite-resumo .muted { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.convite-resumo b { font-size: 15px; }
.convite-resumo b + .muted { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; }

/* ── Módulo do paciente ──────────────────────────────────────────────────── */
.com-tipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 20px; }
.com-tipo {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.com-tipo > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.com-tipo b { font-size: 14px; }
.com-tipo .muted { font-size: 13px; line-height: 1.45; }
.com-tipo-numeros { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.com-tipo-icone {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--tone-neutral-soft, var(--bg2)); color: var(--muted);
}
.com-tipo-icone.tone-green { background: var(--tone-green-soft); color: var(--tone-green); }
.com-tipo-icone.tone-amber { background: var(--tone-amber-soft); color: var(--tone-amber); }
.com-tipo-icone.tone-lilac { background: var(--tone-lilac-soft); color: var(--tone-lilac); }
.com-tipo-icone.tone-blue { background: var(--tone-blue-soft); color: var(--tone-blue); }
.block { display: block; }

/* ── Definições do centro ────────────────────────────────────────────────── */
.def-exemplo { margin-bottom: 20px; }
.def-exemplo > .muted { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.def-carta {
  display: flex; flex-direction: column; gap: 3px; padding: 18px 20px;
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--green);
  border-radius: var(--radius); font-size: 13px; color: var(--muted); line-height: 1.6;
}
.def-carta b { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.form-actions-end { justify-content: flex-end; }

.com-historico { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.com-historico li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.com-quando { color: var(--muted); flex: none; }
.com-que { flex: 1; min-width: 0; }

/* ── Perfil do colaborador ───────────────────────────────────────────────── */
.mes-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 20px; }
.mes-nav b { font-size: 15px; min-width: 180px; text-align: center; }
.esp-lista { display: flex; flex-direction: column; gap: 14px; }
.esp-linha > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.esp-barra { display: block; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.esp-barra i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }

.codigo {
  margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg2); border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  line-height: 1.6; overflow-x: auto; white-space: pre;
}

/* ── Relatório de testes ─────────────────────────────────────────────────── */
.testes .teste-grupo td {
  padding-top: 22px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); border-bottom: 0;
}
.testes .teste-falhou { background: var(--tone-coral-soft); }
.testes .teste-falhou .muted { color: var(--tone-coral); }

/* ── Registo de sessão ───────────────────────────────────────────────────── */
.registo-texto { font-size: 15px; line-height: 1.7; max-width: 68ch; }
.registo-texto p { margin: 0 0 14px; }
.registo-texto p:last-child { margin-bottom: 0; }
.registo-reservado {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px;
  border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--border);
}
.registo-reservado .icon { flex: none; margin-top: 2px; color: var(--muted); }
.registo-reservado > div { display: flex; flex-direction: column; gap: 4px; }
.registo-reservado .muted { font-size: 13px; line-height: 1.55; }
.registo-marca { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }

/* ── Cabeçalho: onde estou, e que dia é hoje ─────────────────────────────── */
.trilho { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 14px; }
.trilho-casa {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 9px; color: var(--muted);
}
.trilho-casa:hover { background: var(--bg2); color: var(--text); }
.trilho-sep { display: inline-grid; place-items: center; color: var(--faint); flex: none; }
.trilho-passo {
  padding: 4px 6px; border-radius: 8px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 26ch;
}
a.trilho-passo:hover { background: var(--bg2); color: var(--text); }
.trilho-passo.is-atual { color: var(--text); font-weight: 600; }

/* Num ecrã médio, só o passo atual: o caminho todo não cabe sem cortar nomes. */
@media (max-width: 900px) {
  .trilho-casa, .trilho-sep, .trilho-passo { display: none; }
  .trilho-passo:last-child { display: block; font-size: 15px; max-width: none; }
}

/*
 * No telemóvel, nem isso. O título da página está logo por baixo, em corpo
 * grande: repeti-lo cortado a meio ("Editar cons…") é pior do que não o pôr.
 */
@media (max-width: 640px) {
  .trilho { display: none; }
}

/* ── Fichas do cabeçalho da página ───────────────────────────────────────── */
.page-header-texto { min-width: 0; }
.page-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.page-meta-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.page-meta-item .icon { color: var(--faint); }
a.page-meta-item { color: var(--text); }
a.page-meta-item:hover { color: var(--green-text); }
a.page-meta-item:hover .icon { color: var(--green-text); }
.page-meta + .page-subtitle { margin-top: 10px; }

/* A data não parte ao meio: a pastilha cede primeiro. */
.dropdown-head { flex-wrap: wrap; gap: 6px 8px; }
.dropdown-head .pill { flex: none; }

/* ── O dia, no painel ────────────────────────────────────────────────────── */
/* O número do dia dentro do ícone de calendário: sabe-se em que dia se está sem
   ler nada, e o botão fica igual aos vizinhos em vez de ser uma peça à parte. */
.dia-btn { position: relative; }
.dia-num {
  position: absolute; left: 0; right: 0; top: 52%; transform: translateY(-40%);
  font-size: 9px; font-weight: 700; line-height: 1; text-align: center;
  color: var(--muted); pointer-events: none;
}
.dia-btn:hover .dia-num { color: var(--text); }
.count.verde { background: var(--green); color: var(--on-green); }

.dia-linha {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); color: var(--text);
}
.dia-linha:hover { background: var(--bg2); }
.dia-hora {
  flex: none; width: 52px; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.dia-hora.sem-hora { font-size: 11px; font-weight: 500; letter-spacing: 0.02em; }
.dia-corpo { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dia-nome { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dia-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dia-sala {
  display: inline-block; padding: 1px 6px; margin-right: 5px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  background: var(--tone-neutral-soft); color: var(--tone-neutral);
}
.dia-sala.tone-green { background: var(--tone-green-soft); color: var(--tone-green); }
.dia-sala.tone-blue { background: var(--tone-blue-soft); color: var(--tone-blue); }
.dia-sala.tone-lilac { background: var(--tone-lilac-soft); color: var(--tone-lilac); }
.dia-sala.tone-amber { background: var(--tone-amber-soft); color: var(--tone-amber); }
.dia-marca { flex: none; color: var(--tone-amber); display: grid; place-items: center; }

/* O que já passou continua à vista, mas não compete com o que falta. */
.dia-linha.passou { opacity: 0.5; }
.dia-linha.passou .dia-hora:not(.sem-hora) { text-decoration: line-through; }
.dia-linha.proxima { background: var(--green-soft); }
.dia-linha.proxima .dia-hora { color: var(--green-text); }

/*
 * Num telemóvel, um painel de 340px ancorado à direita de um botão que está
 * quase na margem sai pela esquerda fora. Passa a ser uma folha presa às duas
 * margens, com a largura que o ecrã tiver.
 */
@media (max-width: 560px) {
  .dropdown-menu, .dropdown-menu.wide {
    position: fixed; left: 8px; right: 8px; top: calc(var(--topbar-h) + 8px);
    min-width: 0; width: auto; max-width: none;
  }
  .dropdown-menu .noti-list { max-height: 60vh; }
}

/* ── Salas ───────────────────────────────────────────────────────────────── */
.salas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
.sala { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.sala-topo { display: flex; align-items: center; gap: 14px; }
.sala-marca { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--tone-neutral-soft); color: var(--tone-neutral); }
.sala-marca.tone-green { background: var(--tone-green-soft); color: var(--tone-green); }
.sala-marca.tone-blue { background: var(--tone-blue-soft); color: var(--tone-blue); }
.sala-marca.tone-lilac { background: var(--tone-lilac-soft); color: var(--tone-lilac); }
.sala-marca.tone-amber { background: var(--tone-amber-soft); color: var(--tone-amber); }
.sala-marca.tone-coral { background: var(--tone-coral-soft); color: var(--tone-coral); }
.sala-cabeca { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.sala-nome { font-size: 16px; font-weight: 600; padding: 4px 8px; background: transparent; border-color: transparent; }
.sala-nome:hover { border-color: var(--border); }
.sala-nome:focus { background: var(--bg2); border-color: var(--green-border); }
.sala-cabeca .muted { font-size: 12px; padding-left: 8px; }
.sala-barra { display: block; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.sala-barra i { display: block; height: 100%; border-radius: 999px; background: var(--tone-neutral-solid); }
.sala-barra i.tone-green { background: var(--tone-green-solid); }
.sala-barra i.tone-blue { background: var(--tone-blue-solid); }
.sala-barra i.tone-lilac { background: var(--tone-lilac-solid); }
.sala-barra i.tone-amber { background: var(--tone-amber-solid); }
.sala-barra i.tone-coral { background: var(--tone-coral-solid); }
.sala-campos { display: grid; gap: 12px; }
.sala-rodape { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }

/* Um destino não é uma pessoa: seta em vez de iniciais. */
/* A marca herda o tom do que representa: a especialidade de um processo, a cor
   de uma sala. Antes era tudo cinzento e a lista não se lia de relance. */
.palette-ico.tone-green { background: var(--tone-green-soft); color: var(--tone-green); }
.palette-ico.tone-blue { background: var(--tone-blue-soft); color: var(--tone-blue); }
.palette-ico.tone-lilac { background: var(--tone-lilac-soft); color: var(--tone-lilac); }
.palette-ico.tone-amber { background: var(--tone-amber-soft); color: var(--tone-amber); }
.palette-ico.tone-coral { background: var(--tone-coral-soft); color: var(--tone-coral); }
.palette-ico.is-destino { background: var(--bg2); color: var(--muted); }
.palette-item.active .palette-ico.is-destino { color: var(--green-text); }
.palette-rodape { border-top: 1px solid var(--border); margin-top: 6px; font-size: 12px; }

@media print {
  .print-only { display: flex !important; }
  .no-print { display: none !important; }
  .doc { border: 0; padding: 0; max-width: none; }
  .doc-head { border-bottom: 2px solid #000; }
  .doc-line { border-bottom: 1px solid #000; }
  .card { border: 1px solid #ddd !important; margin-bottom: 12px; }
  .card-head { padding: 12px 14px 0; }
  .card-body { padding: 12px 14px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; gap: 6px; }
  .stat-value { font-size: 20px; }
  .stat-icon { display: none; }
  .table th, .table td { padding: 5px 8px; font-size: 11px; }
  .avatar { display: none; }
  .grid.cols-2 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dt-toolbar, .dt-foot, .dt-bulk, .table th.pick, .table td.pick { display: none !important; }
  @page { margin: 12mm; size: A4; }
  .sidebar, .topbar, .footer, .toasts, .page-actions, .sidebar-collapse, .overlay, .cal-toolbar .seg, .cal-nav, .theme-float { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; max-width: none; }
  .card { border: 0; break-inside: avoid; }
  body { background: #fff; color: #000; }
  .cal-day { min-height: 90px; }
}
