/* ============================================================
   ENSALAMENTO · ESTILOS
   Tema claro: bege suave + verde-água · Tema escuro: petróleo
   ============================================================ */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #efeae1;
  --bg-grad-1: rgba(95, 224, 207, .16);
  --bg-grad-2: rgba(210, 186, 146, .22);
  --surface: #f9f6f0;
  --surface-2: #f3efe7;
  --surface-3: #ebe5da;
  --field: #fcfaf6;
  --topbar: rgba(249, 246, 240, .88);
  --overlay: rgba(38, 36, 30, .38);

  --ink: #1f2c2a;
  --ink-2: #4f5d5a;
  --ink-3: #8a857a;
  --line: #e0d8ca;
  --line-2: #e9e3d7;

  --brand-50: #e3f1ec;
  --brand-100: #cde8df;
  --brand-200: #a6d9cb;
  --brand-300: #6fc9b8;
  --brand-400: #3cb8a6;
  --brand-500: #17a393;
  --brand-600: #0e877b;
  --brand-700: #0f6f66;
  --brand-800: #115953;

  --warn: #d97706; --warn-bg: #fbf0dc; --warn-line: #f0d9ad; --warn-ink: #8a4b08;
  --danger: #d9474c; --danger-bg: #f9e6e4; --danger-line: #efc4c1; --danger-ink: #a3262b;
  --ok-bg: #e2f1eb; --ok-line: #bde2d6; --ok-ink: #0f6f66;
  --violet-bg: #eee8f8; --violet-line: #dbd0f3; --violet-ink: #5b3fc4;
  --amber-bg: #faeedb; --amber-line: #f0d8b0; --amber-ink: #99560a;
  --off-bg: #ece8e0; --off-line: #ddd7cb; --off-ink: #857f73;
  --note-bg: #faf3e0; --note-line: #ecdfba;

  --grid-today: rgba(23, 163, 147, .06);
  --grid-drop: rgba(23, 163, 147, .11);
  --grid-nosala: rgba(210, 186, 146, .12);
  --stripe: rgba(138, 133, 122, .14);
  --tag-bg: rgba(255, 253, 249, .8);
  --switch-off: #d5cdbf;
  --radio-off: #c3baab;
  --scroll: #d3cab9;
  --chip-dark: #0f4945;
  --toast-bg: #1f2c2a; --toast-ink: #eefaf6; --toast-line: transparent;

  --shadow-sm: 0 1px 2px rgba(60, 50, 30, .05), 0 1px 3px rgba(60, 50, 30, .04);
  --shadow: 0 10px 24px -10px rgba(60, 50, 30, .18), 0 2px 6px -2px rgba(60, 50, 30, .07);
  --shadow-lg: 0 30px 70px -18px rgba(40, 34, 22, .35);

  --topbar-h: 64px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1413;
  --bg-grad-1: rgba(23, 168, 151, .16);
  --bg-grad-2: rgba(14, 138, 125, .08);
  --surface: #131e1d;
  --surface-2: #182524;
  --surface-3: #1f2f2e;
  --field: #0f1918;
  --topbar: rgba(19, 30, 29, .9);
  --overlay: rgba(0, 0, 0, .6);

  --ink: #e3edeb;
  --ink-2: #a7bab6;
  --ink-3: #758a86;
  --line: #263634;
  --line-2: #1e2c2b;

  --brand-50: rgba(60, 196, 178, .09);
  --brand-100: rgba(60, 196, 178, .16);
  --brand-200: rgba(60, 196, 178, .3);
  --brand-300: #37968a;
  --brand-400: #3cc4b2;
  --brand-500: #28b5a3;
  --brand-600: #4fd3c1;
  --brand-700: #6fdfcf;
  --brand-800: #9aebdf;

  --warn: #f5a524; --warn-bg: rgba(245, 165, 36, .1); --warn-line: rgba(245, 165, 36, .3); --warn-ink: #f7c46c;
  --danger: #f06a6e; --danger-bg: rgba(240, 106, 110, .1); --danger-line: rgba(240, 106, 110, .32); --danger-ink: #f59a9d;
  --ok-bg: rgba(60, 196, 178, .12); --ok-line: rgba(60, 196, 178, .3); --ok-ink: #7fe3d5;
  --violet-bg: rgba(139, 92, 246, .14); --violet-line: rgba(139, 92, 246, .35); --violet-ink: #c4b3ff;
  --amber-bg: rgba(245, 158, 11, .12); --amber-line: rgba(245, 158, 11, .32); --amber-ink: #f7c46c;
  --off-bg: rgba(255, 255, 255, .05); --off-line: rgba(255, 255, 255, .1); --off-ink: #8a9c99;
  --note-bg: rgba(245, 200, 100, .07); --note-line: rgba(245, 200, 100, .2);

  --grid-today: rgba(60, 196, 178, .06);
  --grid-drop: rgba(60, 196, 178, .12);
  --grid-nosala: rgba(245, 200, 100, .04);
  --stripe: rgba(255, 255, 255, .05);
  --tag-bg: rgba(0, 0, 0, .22);
  --switch-off: #2f403e;
  --radio-off: #3d504d;
  --scroll: #2c3d3b;
  --chip-dark: #3cc4b2;
  --toast-bg: #1f2f2e; --toast-ink: #e3edeb; --toast-line: #2f4341;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 12px 28px -12px rgba(0, 0, 0, .6), 0 2px 6px -2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 70px -18px rgba(0, 0, 0, .75);
}

/* cores por profissional (definidas inline pelo app) */
[style*="--cl:"] { --ci: var(--cl); --cs: var(--csl); }
:root[data-theme="dark"] [style*="--cl:"] { --ci: var(--cd); --cs: var(--csd); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  margin: 0;
  overflow-x: clip;               /* nada "escorrega" para os lados */
  overscroll-behavior-x: none;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1100px 380px at -5% -120px, var(--bg-grad-1), transparent 70%),
    radial-gradient(900px 380px at 105% -140px, var(--bg-grad-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: var(--brand-600); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
:focus-visible { outline: 3px solid rgba(23, 168, 151, .35); outline-offset: 2px; }
::selection { background: var(--brand-200); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.ic { width: 18px; height: 18px; flex: none; }
/* comandos da interface não selecionam texto ao segurar o dedo */
button, .topbar, .nav, .toolbar, .mtb, .day-tabs, .cal-head, .cal-times, .fab, .menu-item { -webkit-user-select: none; user-select: none; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
.txt-warn { color: var(--warn-ink); font-weight: 700; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes floaty { 50% { transform: translate(10px, -10px) rotate(3deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
@keyframes slideNext { from { opacity: .35; transform: translateX(28px); } }
@keyframes slidePrev { from { opacity: .35; transform: translateX(-28px); } }
.agenda-body.anim-next { animation: slideNext .22s ease-out; }
.agenda-body.anim-prev { animation: slidePrev .22s ease-out; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid transparent;
  font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .06s, color .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(180deg, #19ae9d, #0e8a7d); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 14px -6px rgba(14, 138, 125, .6);
}
.btn-primary:hover { background: linear-gradient(180deg, #15a192, #0c7c70); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }
.btn-ghost.is-off { color: var(--ink-3); background: var(--surface-2); }
.btn-ghost.is-current { color: var(--brand-700); border-color: var(--brand-200); background: var(--brand-50); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger { background: linear-gradient(180deg, #e8565b, #c93a3f); color: #fff; box-shadow: 0 6px 14px -6px rgba(201, 58, 63, .6); }
.btn-danger:hover { background: linear-gradient(180deg, #d94a4f, #b3262b); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.btn[disabled] { opacity: .7; pointer-events: none; }
.btn.is-loading .ic { display: none; }
.btn.is-loading::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite;
}

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2);
  cursor: pointer; transition: background .15s, color .15s; flex: none;
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn.is-danger:hover { background: var(--danger-bg); color: var(--danger); }
.badge-dot {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--brand-500); color: #fff; font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.link {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  color: var(--brand-600); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.link:hover { text-decoration: underline; }
.link-sm { font-size: 12px; align-self: flex-start; }
.link-sm .ic { width: 13px; height: 13px; }

/* ---------- avatares e badges ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: var(--c, var(--brand-500)); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.avatar-xs { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; border-radius: 15px; font-size: 16px; box-shadow: 0 8px 18px -8px var(--c); }
.avatar-neutral { background: var(--brand-100); color: var(--brand-800); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge .ic { width: 12px; height: 12px; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.badge-q { background: var(--violet-bg); color: var(--violet-ink); border-color: var(--violet-line); }
.badge-u { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.badge-exc { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.badge-off { background: var(--off-bg); color: var(--off-ink); border-color: var(--off-line); }

/* ============================================================
   LOGIN
   ============================================================ */
#login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-art {
  position: relative; overflow: hidden; display: flex; align-items: center; padding: 56px; color: #fff;
  background:
    radial-gradient(900px 520px at 0% 0%, #5fe0cf 0, transparent 62%),
    radial-gradient(700px 520px at 100% 100%, #0a6259 0, transparent 60%),
    linear-gradient(150deg, #17a897, #0e7b70);
}
:root[data-theme="dark"] .login-art {
  background:
    radial-gradient(900px 520px at 0% 0%, #1f8f82 0, transparent 62%),
    radial-gradient(700px 520px at 100% 100%, #062e2a 0, transparent 60%),
    linear-gradient(150deg, #0f6f66, #0a3f3a);
}
.login-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse at 30% 40%, #000 25%, transparent 75%);
}
.login-art-in { position: relative; max-width: 520px; animation: fadeUp .5s ease; }
.login-art h1 { font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; margin: 42px 0 14px; }
.login-art h1 em { font-style: normal; color: #c9fff6; }
.login-art p { font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, .86); max-width: 440px; }
.brand-lg .logo { width: 48px; height: 48px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .18)); }
.brand-lg strong { font-size: 20px; color: #fff; }
.brand-lg span { color: rgba(255, 255, 255, .78) !important; max-width: none !important; }

.mock {
  margin-top: 38px; max-width: 470px; padding: 14px; border-radius: 18px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35); transform: rotate(-1.5deg);
}
.mock-head, .mock-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mock-head { margin-bottom: 8px; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.mock-grid { height: 200px; }
.mock-col { position: relative; border-radius: 10px; border: 1px solid var(--line-2); background: repeating-linear-gradient(to bottom, var(--line-2) 0 1px, transparent 1px 33px); }
.mock-col i {
  position: absolute; left: 4px; right: 4px; padding: 3px 6px; overflow: hidden; border-radius: 8px;
  background: var(--surface) linear-gradient(var(--cs), var(--cs)); border: 1px solid var(--cm); border-left: 3px solid var(--c);
  font-style: normal; font-size: 11px; font-weight: 800; line-height: 1.25; color: var(--ci);
}
.mock-col i b { display: block; font-size: 10px; opacity: .75; }
.mock-drag { box-shadow: 0 14px 26px -8px rgba(0, 0, 0, .3); transform: translate(8px, -6px) rotate(3deg); animation: floaty 3.2s ease-in-out infinite; z-index: 2; }

.login-form-wrap { position: relative; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-tema { position: absolute; top: 16px; right: 16px; }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; animation: fadeUp .4s ease; }
.login-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-erro { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 11px; background: var(--danger-bg); color: var(--danger-ink); font-size: 13.5px; font-weight: 600; }
.login-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.login-foot .ic { width: 14px; height: 14px; }
.brand-mobile { display: none !important; margin-bottom: 10px; }

/* ============================================================
   TOPO
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 20px; padding: env(safe-area-inset-top) 22px 0;
  background: var(--topbar); -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 6px 10px rgba(14, 138, 125, .28)); }
.brand strong { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.brand span { display: block; max-width: 220px; overflow: hidden; font-size: 12px; color: var(--ink-3); white-space: nowrap; text-overflow: ellipsis; }

.nav { display: flex; gap: 4px; margin: 0 auto; padding: 4px; border-radius: 14px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.nav button {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px;
  background: none; color: var(--ink-2); font-size: 13.5px; font-weight: 700; cursor: pointer; transition: color .15s, background .15s;
}
.nav button:hover { color: var(--brand-700); }
.nav button.is-active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); }
.sync {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.sync:hover { border-color: var(--brand-200); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--brand-500); box-shadow: 0 0 0 3px rgba(23, 168, 151, .2); }
.sync.is-saving .sync-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); animation: pulse 1s infinite; }
.sync.is-error { color: var(--danger-ink); border-color: var(--danger-line); background: var(--danger-bg); }
.sync.is-error .sync-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(229, 72, 77, .2); }
.sync.is-demo .sync-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .22); }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 700; cursor: pointer;
}
.user-btn:hover { border-color: var(--brand-200); color: var(--brand-700); }
.user-btn .avatar { background: linear-gradient(135deg, #5fe0cf, #0e8a7d); }
.user-nome { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.demo-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 22px; font-size: 13px;
  color: var(--warn-ink); background: var(--warn-bg); border-bottom: 1px solid var(--warn-line);
}
.demo-bar .ic { color: var(--warn); }
.demo-bar .icon-btn { margin-left: auto; width: 30px; height: 30px; color: var(--warn-ink); }
.demo-bar code { padding: 1px 6px; border-radius: 6px; background: var(--field); border: 1px solid var(--warn-line); }

#main { padding: 20px 22px 40px; }
body.agenda-tela #main { padding-top: 16px; padding-bottom: 16px; }
.fab { display: none; }

/* ============================================================
   AGENDA · LAYOUT
   ============================================================ */
.agenda { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; align-items: start; }
.agenda-main { min-width: 0; }
.side-backdrop { display: none; }

.side {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column; gap: 14px;
  max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; padding: 0 2px 8px;
}
.side-top { display: none; }
.side-card { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.side-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.side-head h3 { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.side-head small { font-size: 11px; color: var(--ink-3); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; background: linear-gradient(160deg, var(--surface), var(--brand-50)); }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--field); border: 1px solid var(--line-2); }
.stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 11.5px; color: var(--ink-3); }
.stat.is-muted b { color: var(--ink-3); }
.stat.is-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.stat.is-warn b { color: var(--warn-ink); }

.plist { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.pitem {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 12px;
  border: 1px solid transparent; background: none; text-align: left; cursor: pointer; transition: background .15s, opacity .15s;
}
.pitem:hover { background: var(--surface-2); }
.pitem.is-sel { background: var(--cs); border-color: var(--cm); }
.pitem.is-off { opacity: .45; }
.pitem-tx { min-width: 0; flex: 1; }
.pitem-tx b { display: block; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.pitem-tx small { display: block; font-size: 11.5px; color: var(--ink-3); }
.pitem-ck { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); color: transparent; flex: none; }
.pitem-ck .ic { width: 13px; height: 13px; }
.pitem.is-sel .pitem-ck { background: var(--c); border-color: var(--c); color: #fff; }
.empty-mini { padding: 8px; font-size: 12.5px; color: var(--ink-3); }

.slist { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.sitem {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 11px;
  border: 1px solid transparent; background: none; text-align: left; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.sitem .ic { width: 16px; height: 16px; color: var(--brand-500); }
.sitem span { flex: 1; }
.sitem small { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sitem:hover { background: var(--surface-2); }
.sitem.is-sel { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }

.tip { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.5; color: var(--brand-800); background: linear-gradient(160deg, var(--brand-50), var(--surface)); }
.tip .ic { margin-top: 2px; color: var(--brand-500); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-right { margin-left: auto; }
.weeknav { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.weeknav .icon-btn { width: 32px; height: 32px; }
.weeknav .btn { height: 32px; border: 0; }
.week-label { min-width: 150px; }
.week-label strong { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.week-label span { font-size: 12px; color: var(--ink-3); }
.week-label em { font-style: normal; font-weight: 700; color: var(--brand-600); }
.week-pick-btn { border: 1px solid var(--line); background: var(--surface); }
.week-pick-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; border: 0; }

.seg-ctl { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.seg-ctl button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s;
}
.seg-ctl button .ic { width: 16px; height: 16px; }
.seg-ctl button:hover { color: var(--brand-700); }
.seg-ctl button.is-active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg-full { display: flex; }
.seg-full button { flex: 1; justify-content: center; padding: 9px 10px; }
.seg-sm button { padding: 6px 10px; font-size: 12.5px; }

.fchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; font-size: 12.5px; color: var(--ink-3); }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--cm, var(--brand-200)); background: var(--cs, var(--brand-50)); color: var(--ci, var(--brand-800));
  font-size: 12.5px; font-weight: 700;
}
.fchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fchip .ic { width: 13px; height: 13px; opacity: .7; }

/* ---------- abas de dia ---------- */
.day-tabs-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.day-tabs { display: flex; gap: 6px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 7px 10px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.day-tab span { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.day-tab b { font-size: 18px; font-weight: 800; line-height: 1.2; }
.day-tab small { font-size: 10.5px; color: var(--ink-3); }
.day-tab:hover { border-color: var(--brand-200); }
.day-tab.is-today { border-color: var(--brand-300); }
.day-tab.is-active { background: linear-gradient(160deg, #19ae9d, #0e8a7d); border-color: transparent; box-shadow: 0 8px 16px -8px rgba(14, 138, 125, .6); }
.day-tab.is-active span, .day-tab.is-active b, .day-tab.is-active small { color: #fff; }
.day-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.day-title { display: inline-block; margin-right: 4px; font-size: 15px; font-weight: 800; }
.day-title::first-letter { text-transform: uppercase; }

/* ============================================================
   GRADE (semana e mapa de salas)
   ============================================================ */
.cal-wrap { overflow: hidden; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); animation: fadeUp .25s ease; }
.cal-scroll { max-height: calc(100vh - 215px); min-height: 380px; overflow: auto; overscroll-behavior: contain; }
.cal-wrap.is-fit .cal-scroll { max-height: none; min-height: 0; }
.cal { --tcol: 60px; min-width: calc(var(--tcol) + var(--n) * 128px); }
.cal-sala { min-width: calc(var(--tcol) + var(--n) * 175px); }
.cal-head, .cal-body { display: grid; grid-template-columns: var(--tcol) repeat(var(--n), minmax(0, 1fr)); }
.cal-head { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: var(--surface); }
.cal-corner { position: sticky; left: 0; z-index: 11; display: grid; place-items: center; background: var(--surface); color: var(--brand-300); border-right: 1px solid var(--line-2); }
.cal-dh {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 7px;
  border: 0; border-left: 1px solid var(--line-2); background: none; color: var(--ink-2); cursor: pointer; transition: background .15s;
}
.cal-dh:first-of-type { border-left: 0; }
button.cal-dh:hover { background: var(--brand-50); }
.dh-dow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.dh-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-size: 19px; font-weight: 800; line-height: 1; color: var(--ink); }
.dh-meta { font-size: 11px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.cal-dh.is-today .dh-dow { color: var(--brand-600); }
.cal-dh.is-today .dh-num { background: linear-gradient(135deg, #3cc4b2, #0e8a7d); color: #fff; box-shadow: 0 6px 14px -6px rgba(14, 138, 125, .7); }
.cal-dh.is-past .dh-num { color: var(--ink-3); }
.cal-sh { align-items: flex-start; padding: 12px 12px 10px; cursor: default; }
.sh-name { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 800; color: var(--ink); }
.sh-name .ic { width: 17px; height: 17px; color: var(--brand-500); }
.cal-sh.is-nosala .sh-name .ic { color: var(--warn); }
/* cabeçalho da visão "Dia" (uma coluna larga) */
.cal-dayhead { flex-direction: row; justify-content: center; align-items: center; gap: 10px; padding: 9px 12px; cursor: default; }
.cal-dayhead .dh-dow { font-size: 12px; }
.card-func { margin-left: 6px; font-size: 11px; font-weight: 600; opacity: .75; }

/* ---------- barra superior da agenda no celular ---------- */
.mtb { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.mtb-row { display: flex; align-items: center; gap: 4px; }
.mtb-arrow, .mtb-more { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); }
.mtb-add {
  width: 36px; height: 36px; border-radius: 10px; color: #fff;
  background: linear-gradient(160deg, #19ae9d, #0e8a7d); box-shadow: 0 6px 14px -6px rgba(14, 138, 125, .65);
}
.mtb-add:hover { color: #fff; background: linear-gradient(160deg, #15a192, #0c7c70); }
.mtb-add .ic { width: 20px; height: 20px; }
.mtb-label { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 2px 6px; border: 0; background: none; text-align: left; cursor: pointer; }
.mtb-label strong { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.mtb-label span { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.mtb-label em { font-style: normal; font-weight: 700; color: var(--brand-600); }
.mtb-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; border: 0; }
.mtb-views button { gap: 5px; padding: 8px 4px; font-size: 12.5px; }
.mtb-views .ic { width: 15px; height: 15px; }

.install-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 6px 10px 10px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-50), var(--surface)); border: 1px solid var(--brand-100); box-shadow: var(--shadow-sm);
}
.install-ic { display: grid; }
.install-ic .logo { width: 36px; height: 36px; }
.install-tx { flex: 1; min-width: 0; }
.install-tx b { display: block; font-size: 13.5px; }
.install-tx small { display: block; font-size: 11.5px; line-height: 1.35; color: var(--ink-3); }

/* ---------- menu "⋯" (folha de opções) ---------- */
.menu-list { display: flex; flex-direction: column; gap: 2px; margin: -6px -8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 10px; border: 0; border-radius: 13px;
  background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:active { background: var(--surface-2); }
.menu-item > .ic, .menu-ic .ic { width: 20px; height: 20px; color: var(--brand-600); }
.menu-ic { display: grid; }
.menu-tx { flex: 1; min-width: 0; }
.menu-tx b { display: block; font-size: 14.5px; }
.menu-tx small { display: block; font-size: 12px; line-height: 1.35; color: var(--ink-3); }
.menu-item > .menu-chev { width: 16px; height: 16px; color: var(--ink-3); }
.menu-item.is-info { background: var(--brand-50); cursor: default; }
.menu-item .switch-lbl { flex: none; }

.cal-body { position: relative; padding: 10px 0 12px; }
.cal-times { position: sticky; left: 0; z-index: 6; height: var(--altura); background: var(--surface); border-right: 1px solid var(--line-2); }
.cal-time { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-col {
  position: relative; height: var(--altura); border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px), linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: 100% var(--hora), 100% calc(var(--hora) / 2);
  cursor: cell; transition: background-color .15s;
}
.cal-body > .cal-col:nth-child(2) { border-left: 0; }
.cal-col.is-today { background-color: var(--grid-today); }
.cal-col.is-nosala { background-color: var(--grid-nosala); }
.cal-col.is-drop { background-color: var(--grid-drop); }
.now-line { position: absolute; left: -1px; right: 0; z-index: 5; height: 2px; background: #ef6f5a; pointer-events: none; }
.now-line::before { content: ''; position: absolute; top: -4px; left: -5px; width: 10px; height: 10px; border-radius: 50%; background: #ef6f5a; box-shadow: 0 0 0 3px rgba(239, 111, 90, .2); }

.slot-hint {
  position: absolute; left: 3px; right: 3px; z-index: 1; display: flex; align-items: flex-start; gap: 4px; padding: 5px 8px;
  border-radius: 10px; border: 1.5px dashed var(--brand-300); background: var(--brand-50);
  color: var(--brand-700); font-size: 11.5px; font-weight: 800; pointer-events: none;
}
.slot-hint .ic { width: 14px; height: 14px; }
.hint-floating { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 12px 14px; border-radius: 13px; background: var(--brand-50); border: 1px dashed var(--brand-200); color: var(--brand-800); font-size: 13.5px; }

/* ---------- cartão de atendimento ---------- */
.card {
  position: absolute; z-index: 2; padding: 4px 8px 3px; border-radius: 10px;
  background: var(--surface) linear-gradient(var(--cs), var(--cs));
  border: 1px solid var(--cm); border-left: 4px solid var(--c); color: var(--ci);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .15s, transform .15s, opacity .15s;
}
.card:hover { z-index: 4; transform: translateY(-1px); box-shadow: 0 8px 18px -8px var(--cm), 0 2px 5px rgba(0, 0, 0, .08); }
.card:focus-visible { z-index: 4; outline: 3px solid var(--cm); }
.card-in { height: 100%; overflow: hidden; }
/* alturas fixas por linha: 14 + 16 + (2 + 16) = 48px de conteúdo — cabe num cartão de 1h */
.card-l1 { display: flex; align-items: center; gap: 4px; height: 14px; line-height: 14px; }
.card-time { flex: none; font-size: 11px; font-weight: 700; opacity: .85; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-warn { display: inline-grid; margin-left: auto; color: var(--warn); }
/* resumo (sala + quinzenal) na 1ª linha: só aparece em cartões baixos */
.card-mini {
  display: none; flex: 0 1000 auto; align-items: center; gap: 3px; min-width: 0; margin-left: auto; overflow: hidden;
  font-size: 10px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; text-overflow: ellipsis; opacity: .8;
}
.card-mini .ic { width: 11px; height: 11px; flex: none; }
.card-mini.is-exc { color: var(--danger-ink); opacity: 1; }
.card-mini + .card-warn { margin-left: 4px; }
.card.sz-sm .card-mini, .card.sz-xs .card-mini { display: inline-flex; }
.card-mini:empty, .card.is-split .card-mini:not(.is-exc) { display: none !important; }
.card-warn .ic { width: 14px; height: 14px; }
.card-name { overflow: hidden; font-size: 13px; font-weight: 800; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.card-l3 { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; height: 16px; margin-top: 2px; overflow: hidden; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: 999px; line-height: 14px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
  background: var(--tag-bg); border: 1px solid var(--cm);
}
.tag .ic { width: 10px; height: 10px; }
.tag-nosala { border-style: dashed; color: var(--ink-3); border-color: var(--off-line); }
.tag-q { background: var(--c); border-color: var(--c); color: #fff; }
.tag-u { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.tag-exc { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.card-desc { overflow: hidden; max-width: 100%; font-size: 11px; line-height: 16px; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }

.card.sz-sm .card-l3 { display: none; }
.card.sz-xs { padding: 2px 7px; }
.card.sz-xs .card-in { display: flex; align-items: center; gap: 6px; }
.card.sz-xs .card-l1 { display: contents; }
.card.sz-xs .card-l3 { display: none; }
.card.sz-xs .card-name { order: 1; min-width: 0; font-size: 12px; line-height: 14px; }
.card.sz-xs .card-mini { order: 2; }
.card.sz-xs .card-warn { order: 3; }
.card.is-narrow { padding-left: 6px; padding-right: 4px; }
.card.is-narrow .card-time { font-size: 10px; }
.card.is-narrow .card-name { font-size: 12px; }
.card.is-unica { border-style: dashed; border-left-style: solid; }
.card.has-conflict { outline: 2px solid #f59e0b; outline-offset: -1px; }
.card.is-cancel {
  cursor: pointer; color: var(--ink-3); border-color: var(--line); border-left-color: var(--off-line);
  background: var(--surface) repeating-linear-gradient(135deg, var(--stripe) 0 6px, transparent 6px 12px);
}
.card.is-cancel .card-name, .card.is-cancel .card-time { text-decoration: line-through; }

.card-resize { position: absolute; left: 0; right: 0; bottom: -2px; height: 9px; cursor: ns-resize; }
.card-resize::after {
  content: ''; position: absolute; left: 50%; bottom: 4px; width: 20px; height: 3px; margin-left: -10px;
  border-radius: 2px; background: var(--c); opacity: 0; transition: opacity .15s;
}
.card:hover .card-resize::after { opacity: .55; }
.card.sz-xs .card-resize::after { display: none; }

/* cartão compacto: semana inteira na tela do celular */
.card.is-compact { padding: 1px 3px 1px 4px; border-left-width: 3px; border-radius: 6px; }
.card.is-compact.is-split { padding: 1px 1px 1px 2px; border-left-width: 2px; text-align: center; }
.card.is-compact.is-split .card-name { font-size: 9.5px; letter-spacing: -.02em; }
.card.is-compact.is-split .card-time { font-size: 8.5px; }
.card.is-compact .card-l1 { height: 12px; line-height: 12px; }
.card.is-compact .card-time { font-size: 9.5px; letter-spacing: -.01em; }
.card.is-compact .card-name { font-size: 10.5px; line-height: 13px; letter-spacing: -.01em; text-overflow: clip; }
.card.is-compact .card-mini, .card.is-compact .card-warn, .card.is-compact .card-l3, .card.is-compact .card-resize { display: none !important; }
.card.is-compact.sz-xs .card-time { display: none; }
.card.is-compact:hover { transform: none; }

.card.is-origin { opacity: .3; transform: none; box-shadow: none; }
.card-ghost {
  z-index: 30; opacity: .97; pointer-events: none; transform: scale(1.02);
  box-shadow: 0 18px 36px -10px rgba(0, 0, 0, .4), 0 0 0 2px var(--c);
}
.ghost-label {
  position: absolute; top: -28px; left: 0; padding: 4px 9px; border-radius: 8px; white-space: nowrap;
  background: var(--chip-dark); color: var(--surface); font-size: 11.5px; font-weight: 800; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .4);
}
.ghost-label.below { top: auto; bottom: -30px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }
body.is-resizing, body.is-resizing * { cursor: ns-resize !important; user-select: none !important; }
body.is-dragging .card:not(.card-ghost):hover { transform: none; }

/* ============================================================
   LISTA / TABELAS / PAINÉIS
   ============================================================ */
.panel { overflow: hidden; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); animation: fadeUp .25s ease; }
.panel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.panel-bar .search { flex: 1; min-width: 200px; }
.panel-bar .search input { min-width: 0; }

.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; min-width: 240px; height: 38px; padding: 0 12px 0 36px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--field); font: inherit; font-size: 13.5px; color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(60, 196, 178, .18); }

.lday header { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 8px; }
.lday h3 { font-size: 15px; font-weight: 800; }
.lday h3 span { margin-left: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.lday header small { color: var(--ink-3); }
.lday.is-today h3 { color: var(--brand-700); }
.lday + .lday { border-top: 1px solid var(--line-2); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  padding: 8px 14px; text-align: left; white-space: nowrap; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line-2);
}
.tbl td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-click tbody tr { cursor: pointer; transition: background .12s; }
.tbl-click tbody tr:hover { background: var(--brand-50); }
.tbl tr.is-cancel td { color: var(--ink-3); }
.tbl tr.is-cancel .t-time b { text-decoration: line-through; }
.tbl tr.is-dim td { opacity: .6; }
.t-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-time small { display: block; font-size: 11.5px; color: var(--ink-3); }
.t-act { width: 1%; white-space: nowrap; text-align: right; }
.t-act .icon-btn { width: 32px; height: 32px; }
.t-act .icon-btn .ic { width: 16px; height: 16px; }
.t-det { min-width: 280px; color: var(--ink-2); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who b { font-weight: 700; }
.who small { display: block; font-size: 11.5px; color: var(--ink-3); }
.hist-acao { display: inline-flex; padding: 3px 9px; border-radius: 8px; white-space: nowrap; font-size: 12.5px; font-weight: 700; background: var(--brand-50); color: var(--brand-800); }
.hist-acao.is-red { background: var(--danger-bg); color: var(--danger-ink); }
.hist-acao.is-amber { background: var(--warn-bg); color: var(--warn-ink); }
.hist-acao.is-green { background: var(--ok-bg); color: var(--ok-ink); }

/* ---------- páginas (equipe, salas, histórico) ---------- */
.page { max-width: 1320px; margin: 0 auto; animation: fadeUp .25s ease; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }

.pcard, .scard {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 16px; overflow: hidden;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.pcard:hover, .scard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard.is-inativo, .scard.is-inativo { opacity: .65; filter: grayscale(.4); }
.pcard-band { position: absolute; inset: 0 0 auto 0; height: 70px; background: linear-gradient(135deg, var(--cs), transparent 85%); pointer-events: none; }
.pcard-head, .scard-head { position: relative; display: flex; align-items: center; gap: 12px; }
.pcard-id, .scard-id { flex: 1; min-width: 0; }
.pcard-id h3, .scard-id h3 { font-size: 16.5px; font-weight: 800; }
.pcard-id p, .scard-id p { overflow: hidden; font-size: 12.5px; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }
.pcard-week { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; height: 66px; }
.wk { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; overflow: hidden; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); }
.wk i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--cs); border-top: 2px solid var(--c); }
.wk b { position: relative; font-size: 13px; font-weight: 800; color: var(--ci); line-height: 1.1; }
.wk span { position: relative; font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.pcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pcard-stats b { display: block; font-size: 17px; font-weight: 800; }
.pcard-stats span { font-size: 11.5px; color: var(--ink-3); }
.pcard-salas { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.pcard-salas .ic { width: 15px; height: 15px; color: var(--brand-500); }
.pcard-contact { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-contact a {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; text-decoration: none;
  font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.pcard-contact a:hover { color: var(--brand-700); border-color: var(--brand-200); }
.pcard-contact .ic { width: 14px; height: 14px; }
.pcard-contact .muted { font-size: 12.5px; }
.pcard-obs { padding: 8px 10px; border-radius: 10px; font-size: 12.5px; color: var(--ink-2); background: var(--note-bg); border: 1px solid var(--note-line); }
.pcard-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; }

.room-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; flex: none; color: #fff; background: linear-gradient(135deg, #5fe0cf, #0e8a7d); box-shadow: 0 8px 18px -8px rgba(14, 138, 125, .6); }
.room-ic .ic { width: 22px; height: 22px; }
.scard.is-nosala { background: linear-gradient(160deg, var(--note-bg), var(--surface)); }
.scard.is-nosala .room-ic { background: linear-gradient(135deg, #fcd58b, #f59e0b); box-shadow: 0 8px 18px -8px rgba(245, 158, 11, .6); }
.occ-top { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.occ-top b { font-size: 20px; font-weight: 800; color: var(--ink); }
.bar { height: 10px; margin: 6px 0; overflow: hidden; border-radius: 999px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5fe0cf, #0e8a7d); }
.occ small { font-size: 12px; color: var(--ink-3); }
.timeline { display: flex; flex-direction: column; gap: 5px; }
.tl-row { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; }
.tl-row span { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.tl-track { position: relative; height: 14px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); }
.tl-track i { position: absolute; top: 2px; bottom: 2px; min-width: 3px; border-radius: 4px; background: var(--c); opacity: .85; }
.tl-axis { display: flex; justify-content: space-between; margin-left: 38px; font-size: 10.5px; color: var(--ink-3); }

/* ---------- vazio / carregando ---------- */
.empty { grid-column: 1 / -1; padding: 48px 20px; text-align: center; }
.empty-ic { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; color: var(--brand-600); background: linear-gradient(135deg, var(--brand-50), var(--brand-100)); }
.empty-ic .ic { width: 28px; height: 28px; }
.empty h3 { font-size: 17px; font-weight: 800; }
.empty p { max-width: 420px; margin: 6px auto 16px; font-size: 14px; color: var(--ink-3); }
.loading-box { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px; font-weight: 600; color: var(--ink-3); }
.loading-full { min-height: 50vh; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand-500); animation: spin .8s linear infinite; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid.inner { gap: 12px 14px; }
.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.field > span b { color: var(--brand-600); }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--field);
  font: inherit; font-size: 14px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder, .search input::placeholder { color: var(--ink-3); opacity: .8; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(60, 196, 178, .18); }
.field input[type="time"], .field input[type="date"] { font-variant-numeric: tabular-nums; }
.field select {
  padding-right: 34px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a9591' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
}

.daypick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.daypick button {
  height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font-weight: 700; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.daypick button:hover { border-color: var(--brand-300); color: var(--brand-700); }
.daypick button.is-active { background: linear-gradient(180deg, #19ae9d, #0e8a7d); border-color: transparent; color: #fff; box-shadow: 0 6px 12px -6px rgba(14, 138, 125, .6); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--field);
  font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.chips button:hover { border-color: var(--brand-300); }
.chips button.is-active { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }

.hint-box { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 11px; font-size: 12.5px; color: var(--brand-800); background: var(--brand-50); border: 1px dashed var(--brand-200); }
.hint-box:empty { display: none; }
.hint-box .ic { width: 16px; height: 16px; margin-top: 1px; color: var(--brand-500); }

.switch-lbl { position: relative; display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.switch-lbl input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-lbl small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.switch { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--switch-off); transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch-lbl input:checked + .switch { background: var(--brand-500); }
.switch-lbl input:checked + .switch::after { transform: translateX(18px); }
.switch-lbl input:focus-visible + .switch { outline: 3px solid rgba(23, 168, 151, .35); outline-offset: 2px; }
.switch-sm { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.ctx { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, var(--brand-50), var(--surface)); border: 1px solid var(--brand-100); }
.ctx-ic { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--field); border: 1px solid var(--brand-100); color: var(--brand-600); }
.ctx-tx { flex: 1; min-width: 0; }
.ctx-tx > b { display: block; font-size: 14px; }
.ctx-tx > b::first-letter { text-transform: uppercase; }
.ctx-tx small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.ctx.is-cancel { background: var(--surface-2) repeating-linear-gradient(135deg, var(--stripe) 0 8px, transparent 8px 16px); border-color: var(--line); }
.ctx.is-cancel .ctx-ic { color: var(--danger); }

.alert { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 13px; font-size: 13.5px; line-height: 1.45; }
.alert > .ic { margin-top: 1px; }
.alert ul { margin: 4px 0 0 16px; list-style: disc; }
.alert-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.alert-warn > .ic { color: var(--warn); }
.alert-erro { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-ink); }
.alert-info { margin: 0 0 14px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800); }

.prof-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line); }
.card.card-demo { position: relative; flex: none; width: 170px; height: 64px; cursor: default; }
.card.card-demo:hover { transform: none; }
.prof-prev-tx { display: flex; align-items: center; gap: 12px; }
.prof-prev-tx b { display: block; font-size: 15px; }
.prof-prev-tx small { color: var(--ink-3); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { position: relative; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 10px; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.is-active { box-shadow: 0 0 0 2px var(--ink); }
.sw.is-active::after { content: ''; width: 10px; height: 5px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.sw-custom { overflow: hidden; color: var(--ink-3); }
.sw-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sw-custom .ic { width: 14px; height: 14px; }
.sw-custom.is-active .ic { display: none; }

/* ============================================================
   MODAIS
   ============================================================ */
.modal-layer {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--overlay); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s;
}
.modal-layer.aberto { opacity: 1; }
.modal {
  display: flex; flex-direction: column; width: 100%; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98); transition: transform .2s ease;
}
.modal-layer.aberto .modal { transform: none; }
.modal-sm { max-width: 500px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-2); }
.modal-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--brand-50); color: var(--brand-600); }
.modal-tt { flex: 1; min-width: 0; }
.modal-tt h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.modal-tt p { margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); border-radius: 0 0 20px 20px; background: var(--surface-2); }
.modal-text { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.modal-text p + p, .modal-text p + .alert { margin-top: 8px; }
body.modal-aberto { overflow: hidden; }

.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--brand-200); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-dot { position: relative; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--radio-off); background: var(--field); }
.choice input:checked + .choice-dot { border-color: var(--brand-500); }
.choice input:checked + .choice-dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand-500); }
.choice input:focus-visible + .choice-dot { outline: 3px solid rgba(23, 168, 151, .35); outline-offset: 2px; }
.choice:has(input:checked) { border-color: var(--brand-400); background: var(--brand-50); }
.choice.is-danger input:checked + .choice-dot { border-color: var(--danger); }
.choice.is-danger input:checked + .choice-dot::after { background: var(--danger); }
.choice.is-danger:has(input:checked) { border-color: var(--danger-line); background: var(--danger-bg); }
.choice-tx b { display: block; font-size: 14px; color: var(--ink); }
.choice-tx small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.choice-extra { margin-top: 14px; }

.move-sum { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.ms-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ci); }
.ms-who i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.ms-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ms-box { display: flex; flex-direction: column; min-width: 128px; padding: 8px 12px; border-radius: 11px; background: var(--field); border: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.ms-box b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ms-box small { font-size: 11.5px; }
.ms-box.is-new { border-color: var(--brand-300); background: var(--brand-50); }
.ms-box.is-new b { color: var(--brand-700); }
.ms-arrow { color: var(--brand-500); }

.cfg-sec + .cfg-sec { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.cfg-sec h4 { margin-bottom: 12px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.cfg-sec .muted.small { margin-top: 8px; }
.conn { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 13px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.conn .sync-dot { margin-top: 6px; }
.conn b { display: block; }
.conn small { display: block; font-size: 12.5px; color: var(--ink-3); word-break: break-all; }
.conn.is-demo { background: var(--warn-bg); border-color: var(--warn-line); }
.conn.is-demo .sync-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .22); }
.cfg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.kbd-list { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-2); }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 7px;
  background: var(--field); border: 1px solid var(--line); border-bottom-width: 2px; font: inherit; font-size: 12px; font-weight: 800; color: var(--ink);
}

/* ============================================================
   TOASTS
   ============================================================ */
#toasts {
  position: fixed; left: 50%; bottom: 20px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 580px; padding: 9px 9px 9px 12px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-ink); border: 1px solid var(--toast-line); font-size: 13.5px; font-weight: 600;
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .45); pointer-events: auto; animation: toastIn .25s ease;
}
.toast.saindo { animation: toastOut .25s ease forwards; }
.toast-ic { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: rgba(95, 224, 207, .18); color: #5fe0cf; }
.toast-ic .ic { width: 15px; height: 15px; }
.toast-erro .toast-ic { background: rgba(229, 72, 77, .22); color: #ff9a9e; }
.toast-info .toast-ic { background: rgba(255, 255, 255, .1); color: #cfeee9; }
.toast-msg { min-width: 0; }
.toast-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #5fe0cf; font-size: 13px; font-weight: 800;
}
.toast-btn:hover { background: rgba(255, 255, 255, .14); }
.toast-btn .ic { width: 14px; height: 14px; }
.toast-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: rgba(255, 255, 255, .5); cursor: pointer; }
.toast-x:hover { color: #fff; }
.toast-x .ic { width: 14px; height: 14px; }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (min-width: 1181px) {
  .side-toggle { display: none; }
}
@media (max-width: 1180px) {
  .agenda { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 80; width: 310px; max-width: 88vw; max-height: none; padding: 16px;
    background: var(--bg); box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .25s ease;
  }
  .side-open .side { transform: none; }
  .side-top { display: flex; align-items: center; justify-content: space-between; }
  .side-top h2 { font-size: 18px; font-weight: 800; }
  .side-backdrop {
    display: block; position: fixed; inset: 0; z-index: 79; background: var(--overlay);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .side-open .side-backdrop { opacity: 1; pointer-events: auto; }
}
@media (max-width: 1060px) {
  .nav button span { display: none; }
  .nav button { padding: 0 12px; }
  .tb-right .btn:not(.tb-novo) span { display: none; }
}
@media (max-width: 900px) {
  #login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .brand-mobile { display: flex !important; }
  .brand-mobile strong { font-size: 18px; }
}
@media (max-width: 760px) {
  :root, :root[data-theme] { --topbar-h: 58px; }
  /* sem desfoque: o backdrop-filter prenderia a barra inferior (fixed) dentro do topo */
  .topbar { gap: 8px; padding: env(safe-area-inset-top) 12px 0; background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .brand span { max-width: 120px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; justify-content: space-around; margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); border-radius: 0;
    background: var(--surface); box-shadow: 0 -8px 24px -16px rgba(0, 0, 0, .25);
  }
  .nav button { flex: 1; flex-direction: column; gap: 3px; height: 52px; padding: 0 4px; font-size: 11px; }
  .nav button span { display: inline; }
  .nav button.is-active { background: var(--brand-50); box-shadow: none; }
  .sync { padding: 0 10px; }
  .sync-tx, .user-nome, .user-btn > .ic { display: none; }
  .user-btn { padding: 0 4px; }
  .theme-btn { width: 34px; height: 34px; }
  /* o fim da página sempre fica ACIMA da barra de navegação fixa (senão os últimos horários ficam escondidos) */
  #main, body.agenda-tela #main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .demo-bar { padding: 8px 12px; font-size: 12px; }
  #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }

  .toolbar { gap: 8px; }
  .tb-novo { display: none; }
  .tb-right .btn span { display: none; }
  .tb-right .btn { width: 36px; padding: 0; }
  .toolbar > .seg-ctl { order: 5; width: 100%; }
  .toolbar > .seg-ctl button { flex: 1; justify-content: center; }
  .week-label { min-width: 0; }
  .week-label strong { font-size: 16px; }
  .day-tabs-wrap { gap: 8px; margin-bottom: 10px; }
  .day-tabs { width: 100%; }
  .day-tab { flex: 1; min-width: 0; padding: 6px 2px; border-radius: 12px; }
  .day-tab b { font-size: 16px; }
  .day-tab small { font-size: 9.5px; }
  .day-actions { display: none; } /* no celular, "Fechar dia" fica no menu ⋯ */
  .card.sz-xs .t-fim { display: none; } /* cartão de uma linha: só o início, para caber o nome */

  /* grade: a própria página rola (sem rolagem dentro de rolagem) e o cabeçalho dos dias fica preso no topo */
  .cal-wrap { overflow: hidden; overflow: clip; border-radius: 16px; }
  .cal-scroll { max-height: none !important; min-height: 0; overflow: visible; }
  .cal-head { top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .cal { --tcol: 36px; min-width: 0; }
  .cal-sala { min-width: 0; }
  .cal-body { padding: 8px 0 10px; }
  .cal-time { right: 5px; font-size: 9.5px; }
  .cal-corner .ic { width: 15px; height: 15px; }
  .cal-semana .cal-dh { padding: 6px 0 5px; }
  .cal-semana .dh-dow { font-size: 9.5px; letter-spacing: .04em; }
  .cal-semana .dh-num { width: 26px; height: 26px; border-radius: 8px; font-size: 15px; }
  .cal-semana .dh-meta { font-size: 9px; }
  .cal-sh { padding: 8px 8px 7px; }
  .sh-name { font-size: 12.5px; }
  .cal-sh .dh-meta { font-size: 10px; white-space: normal; }
  .cal-dayhead { gap: 8px; padding: 8px; }
  .cal-dayhead .dh-num { width: 30px; height: 30px; font-size: 16px; }

  /* campos com 16px: o iPhone não dá zoom sozinho ao tocar */
  .field input, .field select, .field textarea, .search input { font-size: 16px; }

  /* tabelas viram cartões empilhados */
  .tbl-wrap { overflow: visible; }
  .tbl, .tbl tbody { display: block; }
  .tbl thead { display: none; }
  .tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { display: block; order: 2; padding: 0; border: 0; }
  .tbl td.t-vazio { display: none; }
  /* 1ª linha: horário + situação · abaixo: quem, sala, recorrência… */
  .tbl td.t-time { display: flex; flex: 1 0 58%; align-items: baseline; gap: 8px; order: 0; }
  .tbl td.t-time small { display: inline; }
  .tbl td.t-sit { order: 1; margin-left: auto; }
  .tbl .t-act { width: auto; margin-left: auto; order: 3; }
  .t-det { width: 100%; min-width: 0; }
  .side { padding-top: calc(16px + env(safe-area-inset-top)); }

  .page-head h1 { font-size: 22px; }
  .page-actions, .page-actions .search { width: 100%; }
  .page-actions .search { flex: 1; }
  .search input { min-width: 0; }
  .grid-cards { grid-template-columns: minmax(0, 1fr); }
  .panel-bar .seg-ctl { width: 100%; }
  .panel-bar .seg-ctl button { flex: 1; justify-content: center; }
}
@media (max-width: 640px) {
  .modal-layer { align-items: flex-end; padding: 0; }
  .modal { max-width: none !important; max-height: 94vh; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .modal::before { content: ''; display: block; flex: none; width: 38px; height: 4px; margin: 8px auto -6px; border-radius: 2px; background: var(--line); }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn span { display: none; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-2, .col-3, .col-4 { grid-column: span 2; }
  .ctx { flex-wrap: wrap; }
  .ctx .btn { width: 100%; }
}
@media (pointer: coarse) {
  .card-resize { height: 16px; bottom: -4px; }
  .card-resize::after { opacity: .45; }
}

/* ============================================================
   IMPRESSÃO (sempre em cores claras)
   ============================================================ */
#print-area { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  [style*="--cl:"] { --ci: var(--cl) !important; --cs: var(--csl) !important; }
  #print-area { display: block; font-family: var(--font); color: #1f2c2a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 3px solid #17a897; }
  .pr-brand { display: flex; align-items: center; gap: 10px; }
  .pr-brand .logo { width: 34px; height: 34px; filter: none; }
  .pr-brand h1 { font-size: 18px; font-weight: 800; }
  .pr-brand p { font-size: 11px; color: #5b6b68; }
  .pr-meta { display: flex; flex-direction: column; text-align: right; font-size: 10.5px; color: #5b6b68; }
  .pr-meta b { font-size: 13px; color: #1f2c2a; }
  .pr-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .pr-table th { padding: 6px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: #0f6f66; background: #e3f1ec; border: 1px solid #bfdcd3; }
  .pr-table th small { display: block; font-size: 10px; text-transform: none; color: #5b6b68; }
  .pr-table td { padding: 5px; vertical-align: top; border: 1px solid #d9e2df; }
  .pr-item { margin-bottom: 4px; padding: 3px 5px; border-radius: 4px; border-left: 3px solid var(--c); background: var(--cs); font-size: 10.5px; line-height: 1.25; break-inside: avoid; }
  .pr-item b { display: block; font-size: 10.5px; }
  .pr-item span { display: block; font-size: 11px; font-weight: 800; color: var(--ci); }
  .pr-item small { display: block; font-size: 9px; color: #5b6b68; }
  .pr-vazio { font-size: 10px; color: #9aa8a5; }
  .pr-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 10px; color: #4f5d5a; }
  .pr-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; background: var(--c); }
}
