/* ============================================================
   AGENDA — Sistema visual
   Tipografia: Schibsted Grotesk (display) + Hanken Grotesk (UI)
   ============================================================ */

:root {
  --font-display: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-sans: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* radii */
  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  /* spacing rhythm */
  --gap: 16px;

  /* light theme (default) */
  --bg: #f4f6fa;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, #eef1fb 0%, transparent 60%);
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef1f7;
  --border: #e7eaf1;
  --border-strong: #d7dce6;
  --text: #161a23;
  --text-2: #5a6276;
  --text-3: #949bad;

  --primary: #3a5bd9;
  --primary-hover: #2f49b8;
  --primary-soft: #eaeefc;
  --primary-soft-2: #dde4fb;
  --on-primary: #ffffff;

  --success: #0f9d6b;
  --success-soft: #e2f6ee;
  --warning: #c9821a;
  --warning-soft: #fbf0dd;
  --danger: #d83a45;
  --danger-soft: #fbe7e8;
  --info: #2f6fd8;
  --info-soft: #e6effb;

  --shadow-xs: 0 1px 2px rgba(20, 27, 48, 0.08);
  --shadow-sm: 0 2px 8px rgba(20, 27, 48, 0.10), 0 1px 2px rgba(20,27,48,0.06);
  --shadow-md: 0 8px 24px rgba(20, 27, 48, 0.10), 0 2px 6px rgba(20,27,48,0.05);
  --shadow-lg: 0 24px 60px rgba(20, 27, 48, 0.18), 0 8px 24px rgba(20,27,48,0.08);

  /* event palette (soft) */
  --ev-blue: #3a5bd9;   --ev-blue-bg: #e9eefc;
  --ev-teal: #0e9d8f;   --ev-teal-bg: #e0f5f2;
  --ev-cyan: #06b6d4; --ev-cyan-bg: #ecfeff;
  --ev-amber: #c9821a;  --ev-amber-bg: #fbf0db;
  --ev-rose: #d4476a;   --ev-rose-bg: #fbe6ec;
  --ev-green: #4a9b3e;  --ev-green-bg: #ebf5e6;
  --ev-violet: #7c3aed; --ev-violet-bg: #f0e9ff;
  --ev-gray: #d1d5db;   --ev-gray-bg: #f3f4f6;
}

[data-theme="dark"] {
  --bg: #0d0f15;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, #161b2c 0%, transparent 60%);
  --surface: #161a24;
  --surface-2: #1b2029;
  --surface-3: #222834;
  --border: #262c39;
  --border-strong: #333b4c;
  --text: #eceef4;
  --text-2: #a2a9bb;
  --text-3: #6a7283;

  --primary: #5b73f0;
  --primary-hover: #6f84f4;
  --primary-soft: #1b2138;
  --primary-soft-2: #232c4a;
  --on-primary: #ffffff;

  --success: #2bbd83;
  --success-soft: #122a22;
  --warning: #e0a13c;
  --warning-soft: #2c2415;
  --danger: #f06a72;
  --danger-soft: #2c1719;
  --info: #5b93ef;
  --info-soft: #14223a;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.6);

  --ev-blue: #7c93ff;   --ev-blue-bg: #1a2342;
  --ev-teal: #36c2b2;   --ev-teal-bg: #0f2c2a;
  --ev-cyan: #22d3ee; --ev-cyan-bg: #164e63;
  --ev-amber: #e0a13c;  --ev-amber-bg: #2c2415;
  --ev-rose: #ef7396;   --ev-rose-bg: #2e1822;
  --ev-green: #6fc25f;  --ev-green-bg: #162913;
  --ev-violet: #a78bfa; --ev-violet-bg: #2a2140;
  --ev-gray: #8b95a7;   --ev-gray-bg: #242a35;
}

/* ============ TEMAS (cor de destaque — data-accent) ============
   "indigo" é o padrão (:root). Cada tema redefine a cor primária
   nas duas variantes, claro e escuro. */
[data-accent="esmeralda"] {
  --primary: #0f9d77; --primary-hover: #0c8262;
  --primary-soft: #e2f5ee; --primary-soft-2: #cdeee0;
}
[data-accent="vinho"] {
  --primary: #c23a5e; --primary-hover: #a52e4e;
  --primary-soft: #fae8ee; --primary-soft-2: #f5d8e2;
}
[data-accent="ambar"] {
  --primary: #c97a16; --primary-hover: #a86412;
  --primary-soft: #fbf0dd; --primary-soft-2: #f7e5c8;
}
[data-theme="dark"][data-accent="esmeralda"] {
  --primary: #2bbd93; --primary-hover: #43cba4;
  --primary-soft: #122a23; --primary-soft-2: #173a30;
}
[data-theme="dark"][data-accent="vinho"] {
  --primary: #ef6d92; --primary-hover: #f284a3;
  --primary-soft: #2e1822; --primary-soft-2: #41202f;
}
[data-theme="dark"][data-accent="ambar"] {
  --primary: #e0a13c; --primary-hover: #e7b35e;
  --primary-soft: #2c2415; --primary-soft-2: #3d3118;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
}
#root { height: 100%; }
body:has(#root > .app) { overflow: hidden; }
::selection { background: var(--primary-soft-2); }

button { font-family: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; }
h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; font-weight: 600; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w, 248px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  background-image: var(--bg-grad);
  transition: grid-template-columns .26s cubic-bezier(.4,0,.2,1);
}
.app.collapsed { --sb-w: 76px; }
.nav-backdrop { display: none; }

/* sidebar */
.sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
  position: relative;
  z-index: 20;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 14px;
  min-height: 64px;
}
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #fff;
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--primary) 45%, transparent);
  overflow: hidden;
}
.sb-logo img { width: 32px; height: 32px; object-fit: contain; display: block; }
.sb-brand .name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.sb-brand .name small { display:block; font-family: var(--font-sans); font-weight: 500; font-size: 11px; color: var(--text-3); letter-spacing: 0; margin-top: -1px; }

.sb-switch {
  margin: 0 12px 8px; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; gap: 9px; cursor: pointer; width: calc(100% - 24px);
  transition: border-color .15s, background .15s;
}
.sb-switch:hover { border-color: var(--border-strong); }
.sb-switch .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.sb-switch .lbl { min-width: 0; flex: 1; text-align: left; }
.sb-switch .lbl b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-switch .lbl span { display: block; font-size: 10.5px; color: var(--text-3); }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.sb-section { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-2); border: none; background: none; width: 100%; text-align: left;
  font-size: 13.5px; font-weight: 500; position: relative; transition: background .14s, color .14s;
  white-space: nowrap;
}
.nav-item .ico { flex: none; color: currentColor; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .ico { opacity: 1; }
.nav-item .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 99px; background: var(--danger); color: #fff; display: grid; place-items: center;
}
.nav-item.active .badge-count { background: var(--primary); }

.collapsed .sb-brand .name, .collapsed .sb-switch .lbl, .collapsed .sb-switch .chev,
.collapsed .sb-section, .collapsed .nav-item span.t, .collapsed .nav-item .badge-count,
.collapsed .sb-foot .meta { display: none; }
.collapsed .nav-item { justify-content: center; padding: 10px; }
.collapsed .sb-switch { justify-content: center; padding: 9px; }
.collapsed .sb-switch .ic { margin: 0; }
.collapsed .sb-brand { justify-content: center; padding: 18px 0 14px; }

.sb-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.sb-user:hover { background: var(--surface-2); }
.sb-user:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sb-user .meta { min-width: 0; flex: 1; }
.sb-user .meta b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .meta span { display: block; font-size: 11px; color: var(--text-3); }
.sb-user .logout-icon { flex: none; }

/* ============ MAIN ============ */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 24px; min-height: 64px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 15;
}
.topbar .page-h { min-width: 0; }
.topbar .page-h h1 { font-size: 19px; line-height: 1.15; }
.topbar .page-h p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.topbar .spacer { flex: 1; }
.calendar-topbar { gap: 10px; }
.calendar-topbar-host { flex: 1; min-width: 0; }
.calendar-new-action-host { display: flex; flex: none; }
.calendar-topbar-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; min-width: 0; padding: 8px 0; }
.calendar-topbar-date, .calendar-topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.calendar-topbar-date { flex: none; }
.calendar-topbar-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.calendar-filter-select { height: 34px; max-width: 210px; display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); }
.calendar-filter-select select { min-width: 0; max-width: 170px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.calendar-topbar-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; text-transform: capitalize; }

@media (max-width: 1400px) {
  .topbar.calendar-topbar { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .calendar-topbar > .iconbtn:first-child { margin-right: auto; }
  .calendar-topbar .calendar-topbar-host { order: 4; flex: 1 0 100%; }
  .calendar-topbar-controls { justify-content: flex-start; padding: 0; }
  .calendar-topbar-actions { margin-left: auto; }
}

@media (max-width: 760px) {
  .calendar-topbar-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
  .calendar-topbar-title { max-width: min(190px, calc(100vw - 200px)); }
}

.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; min-width: 220px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-3);
}
.search input { border: none; background: none; outline: none; color: var(--text); font-size: 13px; width: 100%; }
.search kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 5px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); }

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; scroll-behavior: smooth; }
.content-inner { max-width: 1320px; margin: 0 auto; }
.calendar-content-inner { width: 100%; max-width: none; }

/* ============ PRIMITIVES ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: all .15s; color: var(--text);
  background: var(--surface-2);
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--primary) 60%, transparent); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.outline { background: transparent; border-color: var(--border-strong); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

.iconbtn {
  width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--text-2); transition: all .15s; position: relative;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn.bordered { border-color: var(--border); }
.quick-add-btn {
  flex: 0 0 38px; background: var(--primary-soft); color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
}
.quick-add-btn:hover { background: var(--primary-soft-2); color: var(--primary-hover); }
.notification-bell { overflow: visible; }
.notification-count {
  position: absolute; top: -7px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 10px; background: var(--danger); color: #fff;
  border: 2px solid var(--surface); font-size: 10px; line-height: 1; font-weight: 800;
}
.notification-strip {
  flex: none; min-height: 54px; padding: 8px 24px; display: flex; align-items: center; gap: 11px;
  background: var(--warning-soft); border-bottom: 1px solid color-mix(in srgb, var(--warning) 32%, var(--border));
  color: var(--text);
}
.notification-strip-icon {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--warning); color: #fff;
}
.notification-strip-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.notification-strip-copy b { font-size: 12.5px; }
.notification-strip-copy span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.cyan { background: var(--ev-cyan-bg); color: var(--ev-cyan); }
.badge.plain { background: var(--surface-3); color: var(--text-2); }

.avatar {
  border-radius: 99px; display: grid; place-items: center; font-weight: 600; color: #fff;
  flex: none; font-family: var(--font-sans); overflow: hidden; background: var(--primary);
}
.avatar.ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--border-strong); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all .14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.seg button { border: none; background: none; height: 30px; padding: 0 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all .14s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .opt { font-weight: 500; color: var(--text-3); }
.input, .textarea, .selectbox {
  height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; outline: none; transition: border-color .14s, box-shadow .14s; width: 100%;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; line-height: 1.5; }
.input:focus, .textarea:focus, .selectbox:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.selectbox { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23949bad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; cursor: pointer; }
.input-icon { position: relative; }
.input-icon .input { padding-left: 36px; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.finance-filters { align-items: center; }
.finance-search { flex: 1 0 420px; min-width: 360px; max-width: 100%; }
.finance-clear { flex: 0 0 auto; display: inline-flex; }
.client-combo { position: relative; }
.client-combo-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.client-combo-selected {
  margin-top: 8px; display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); font-size: 12.5px;
}
.client-combo-selected span { color: var(--text); font-weight: 600; }
.client-combo-selected small { margin-left: auto; color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-combo-panel {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.client-combo-list { max-height: 210px; overflow-y: auto; padding: 6px; }
.client-combo-option {
  width: 100%; border: 0; background: transparent; color: var(--text); border-radius: var(--r-sm);
  padding: 9px 10px; text-align: left; display: flex; flex-direction: column; gap: 2px;
}
.client-combo-option:hover { background: var(--surface-2); }
.client-combo-option span { font-size: 13px; font-weight: 600; }
.client-combo-option small, .client-combo-empty { font-size: 11.5px; color: var(--text-3); }
.client-combo-empty { padding: 12px 10px; }
.client-combo-create { border-top: 1px solid var(--border); padding: 10px; background: var(--surface-2); }
.client-combo-form { display: grid; grid-template-columns: 1fr 150px; gap: 8px; }
.client-combo-form .input:first-child, .client-combo-form .field-hint, .client-combo-form .row { grid-column: 1 / -1; }

/* ícone do seletor de data/hora — visível em ambos os temas */
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: .55; cursor: pointer; transition: opacity .14s;
}
.input[type="date"]::-webkit-calendar-picker-indicator:hover,
.input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.5); opacity: .6;
}
[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] .input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* validação inline de campo */
.input.invalid { border-color: var(--danger); }
.input.invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.field-hint { font-size: 11.5px; display: flex; align-items: center; gap: 5px; }
.field-hint.ok { color: var(--success); }
.field-hint.err { color: var(--danger); }

/* toggle */
.switch { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); border: none; position: relative; transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 99px; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(17px); }

/* table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.kpi { padding: 16px 17px; position: relative; overflow: hidden; }
.kpi .top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.kpi .val { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.kpi .delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; margin-top: 9px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }
.kpi .delta .since { color: var(--text-3); font-weight: 500; }

/* spark */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark i { flex: 1; background: var(--primary-soft-2); border-radius: 3px 3px 0 0; transition: height .3s; }
.spark i.hot { background: var(--primary); }

/* layout helpers */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-3); }
.t2 { color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.divider { height: 1px; background: var(--border); margin: 0; border: none; }

/* ============ MODAL / DRAWER ============ */
.overlay { position: fixed; inset: 0; background: rgba(15, 18, 30, .5); backdrop-filter: blur(3px); z-index: 100; display: flex; opacity: 0; animation: fade .2s forwards; }
[data-theme="dark"] .overlay { background: rgba(0,0,0,.62); }
@keyframes fade { to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; margin: auto; max-height: 90vh; display: flex; flex-direction: column;
  transform: translateY(8px) scale(.99); animation: pop .24s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes pop { to { transform: none; } }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 600; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

.drawer-wrap { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end; }
.drawer {
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  width: 440px; max-width: 92vw; height: 100%; display: flex; flex-direction: column;
  transform: translateX(20px); opacity: 0; animation: slidein .26s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes slidein { to { transform: none; opacity: 1; } }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.appt-drawer .drawer-foot {
  display: flex;
}
.appt-drawer .drawer-foot > .btn { flex: 1 1 0; width: auto; min-width: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.settings-calendar-grid { grid-template-columns: repeat(5, minmax(110px, 1fr)); }
.appt-time-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; }
.appt-repeat-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.appt-repeat-grid.two { grid-template-columns: repeat(2, 1fr); }

/* empty */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-3); }
.empty h4 { font-size: 15px; color: var(--text-2); margin-bottom: 4px; }

/* ============ CALENDAR ============ */
.cal-wrap { display: flex; flex-direction: column; height: calc(100vh - 64px - 48px); min-height: 540px; }
/* A grade INTEIRA rola verticalmente (cal-grid é o único scroller), então a
   coluna de horários e as colunas de dias rolam juntas e sempre alinhadas. */
.cal-grid { flex: 1; display: grid; grid-template-columns: 58px 1fr; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.cal-times { border-right: 1px solid var(--border); position: sticky; left: 0; z-index: 12; background: var(--surface); }
.cal-time-cell { height: 64px; position: relative; }
.cal-time-cell span { position: absolute; top: 7px; right: 8px; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
/* espaçador da coluna de horários: mesma altura do cabeçalho dos dias e fixo no topo */
.cal-times-head { height: 53px; box-sizing: border-box; position: sticky; top: 0; z-index: 13; background: var(--surface); border-bottom: 1px solid var(--border); }
.cal-cols { display: grid; position: relative; }
/* z-index 10 fica acima dos eventos (.ev = 6, :hover = 9) para o cabeçalho nunca ser coberto ao rolar */
.cal-day-head { height: 53px; box-sizing: border-box; position: sticky; top: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); z-index: 10; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0; gap: 1px; border-right: 1px solid var(--border); }
.cal-day-head .dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.cal-day-head .dnum { font-family: var(--font-display); font-size: 18px; font-weight: 600; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 99px; }
.cal-day-head.today .dnum { background: var(--primary); color: #fff; }
.cal-day-head.today .dow { color: var(--primary); }
.cal-week-day { min-width: 0; position: relative; }
.cal-week-day::after {
  content: ""; position: absolute; inset: 0; z-index: 9; pointer-events: none; border-radius: 5px;
  border: 1.5px solid transparent; transition: border-color .14s ease, box-shadow .14s ease;
}
.cal-week-day:hover::after {
  border-color: color-mix(in srgb, var(--primary) 48%, transparent);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--primary) 5%, transparent);
}
.cal-week-day:hover .cal-day-head {
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
  box-shadow: inset 1.5px 0 color-mix(in srgb, var(--primary) 48%, transparent), inset -1.5px 0 color-mix(in srgb, var(--primary) 48%, transparent), inset 0 1.5px color-mix(in srgb, var(--primary) 48%, transparent);
}
.cal-col { border-right: 1px solid var(--border); position: relative; }
.cal-hour { height: 64px; border-bottom: 1px solid var(--border); transition: background .1s, box-shadow .1s; }
.cal-hour:hover { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 55%, transparent); cursor: pointer; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 8; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 99px; background: var(--danger); }

.ev {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px; overflow: hidden;
  border-left: 3px solid var(--c); background: var(--cbg); color: var(--c); cursor: pointer; z-index: 6;
  transition: transform .12s, box-shadow .12s; font-size: 12px;
}
.ev:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); z-index: 9; }
.ev-add {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border: 1px solid var(--border);
  border-radius: 8px; display: grid; place-items: center; background: var(--surface); color: var(--primary);
  box-shadow: var(--shadow-sm); opacity: 0; transform: translateY(-2px); transition: opacity .12s, transform .12s, background .12s;
}
.ev:hover .ev-add, .ev:focus-within .ev-add { opacity: 1; transform: none; }
.ev-add:hover { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.ev[draggable="true"], .mpill[draggable="true"] { cursor: grab; }
.ev.dragging, .mpill.dragging { opacity: .45 !important; cursor: grabbing; }
.ev b { display: block; font-weight: 600; font-size: 12px; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 24px; }
.ev-main { display: flex; align-items: center; gap: 5px; min-width: 0; padding-right: 24px; }
.ev-main b { flex: 1; min-width: 0; padding-right: 0; }
.ev-main-compact { flex-wrap: wrap; align-content: flex-start; row-gap: 2px; }
.ev-main-compact b { flex: 1 1 auto; }
.ev-confirm { flex: none; max-width: 92px; padding: 2px 5px; border-radius: 999px; font-size: 9px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-confirm-group { max-width: 100%; border-radius: 7px; white-space: normal; overflow: visible; text-overflow: clip; }
.ev-confirm.green { background: var(--success-soft); color: var(--success); }
.ev-confirm.amber { background: var(--warning-soft); color: var(--warning); }
.ev-confirm.red { background: var(--danger-soft); color: var(--danger); }
.ev-confirm.blue { background: var(--info-soft); color: var(--info); }
.ev-confirm.plain { background: var(--surface-3); color: var(--text-2); }
.ev .t { font-size: 11px; opacity: .9; font-family: var(--font-mono); }
.ev .who { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.ev-group {
  border-left-width: 4px; background: color-mix(in srgb, var(--cbg) 78%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent), var(--shadow-xs);
  padding-top: 8px;
}
.ev-group-colors { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--group-colors, var(--c)); }
.ev-group-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ev-group-head b { flex: 1; min-width: 0; }
.ev-group-pros { margin-top: 2px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-group-list { display: flex; flex-direction: column; gap: 8px; }
.calendar-group-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
}
.calendar-group-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.calendar-group-row .ic {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
}
.free-slots-list { display: flex; flex-direction: column; gap: 10px; }
.free-slots-pro { padding: 13px; }
.free-slots-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.free-slots-grid .chip { background: var(--surface-2); }
.free-slots-grid .chip:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.team-availability { display: flex; flex-direction: column; gap: 7px; }
.team-availability-head {
  display: grid; grid-template-columns: 72px repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 9px;
  color: var(--text-3); font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.team-availability-row {
  display: grid; grid-template-columns: 72px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center;
  padding: 9px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
}
.team-availability-row.off { opacity: .62; background: var(--surface-2); }
.team-availability-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.ev.ev-done { opacity: .55; border-left-style: dashed; }
.ev.ev-done b { color: var(--text-3); }
.ev.ev-done .who { color: var(--text-3); }

/* month grid */
.month { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.month-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.month-dow div { padding: 9px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); text-align: center; }
.month-body { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; height: calc(100vh - 64px - 48px - 120px); min-height: 480px; }
.mcell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 8px; overflow: hidden; cursor: pointer; transition: background .12s, box-shadow .12s; display: flex; flex-direction: column; gap: 4px; }
.mcell.out { background: var(--surface-2); }
.mcell.out .mnum { color: var(--text-3); }
/* hover precisa vir depois de .out para também destacar os dias fora do mês */
.mcell:hover, .mcell.out:hover { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 55%, transparent); }
.mcell .mnum { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; }
.mcell.today .mnum { background: var(--primary); color: #fff; }
.mpill { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--cbg); color: var(--text); border-left: 2px solid var(--c); white-space: nowrap; overflow: hidden; font-weight: 500; }
.mpill-state { flex: none; padding: 1px 4px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.mpill-state.green { background: var(--success-soft); color: var(--success); }
.mpill-state.amber { background: var(--warning-soft); color: var(--warning); }
.mpill-state.red { background: var(--danger-soft); color: var(--danger); }
.mpill-state.blue { background: var(--info-soft); color: var(--info); }
.mpill-state.plain { background: var(--surface-3); color: var(--text-2); }
.mpill-copy { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mmore { font-size: 10.5px; color: var(--text-3); font-weight: 600; }
.mpill.mpill-done { opacity: .55; border-left-style: dashed; color: var(--text-3); }

/* agenda timeline (dashboard) */
.tl-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; }
.tl-time { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); padding-top: 11px; }
.tl-time small { display: block; color: var(--text-3); font-size: 10.5px; }
.tl-card { border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--r-sm); padding: 11px 13px; background: var(--surface); display: flex; align-items: center; gap: 11px; transition: box-shadow .14s, transform .12s; cursor: pointer; }
.tl-card:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }
.tl-line { width: 1px; background: var(--border); margin: 0 auto; }

/* progress bar */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

/* list rows */
.lrow { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.lrow:last-child { border-bottom: none; }

/* checkbox */
.cbx { width: 19px; height: 19px; border-radius: 6px; border: 1.6px solid var(--border-strong); display: grid; place-items: center; flex: none; cursor: pointer; transition: all .14s; color: transparent; background: var(--surface); }
.cbx.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* tooltip-ish menu */
.menu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; z-index: 200; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text); text-align: left; transition: background .12s; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu .mlabel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 7px 10px 4px; }

/* avatar stack */
.astack { display: flex; }
.astack > * { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.astack > *:first-child { margin-left: 0; }

/* toast */
.toast-wrap {
  position: fixed; top: 82px; right: 24px; z-index: 340; width: min(460px, calc(100vw - 48px));
  display: flex; flex-direction: column; gap: 10px; align-items: stretch; pointer-events: none;
}
.toast {
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 11px;
  background: var(--surface); color: var(--text); padding: 14px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); border-left: 4px solid var(--warning);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; line-height: 1.35;
  animation: toastin .26s cubic-bezier(.2,.8,.2,1); pointer-events: auto;
}
.toast .ic {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  background: var(--warning-soft); color: var(--warning);
}
.toast-msg { min-width: 0; padding-top: 4px; }
.toast-close {
  width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 8px; background: transparent; color: var(--text-2);
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } }

/* notificações recebidas enquanto o sistema está aberto */
.floating-notification-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 290; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 9px;
}
.floating-notification {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px;
  background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--primary);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); cursor: pointer;
  animation: floatingNotifIn .24s cubic-bezier(.2,.8,.2,1);
}
.floating-notification:hover { background: var(--surface-2); }
.floating-notification-icon {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary);
}
.floating-notification-copy { flex: 1; min-width: 0; padding-top: 1px; }
.floating-notification-copy b { display: block; font-size: 13px; margin-bottom: 3px; }
.floating-notification-copy span {
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  color: var(--text-2); font-size: 12px; line-height: 1.4;
}
.floating-notification .iconbtn { width: 28px; height: 28px; flex: none; }
@keyframes floatingNotifIn { from { transform: translateX(18px); opacity: 0; } }

/* fade-in util */
.fadein { animation: fadeUp .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* responsive */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ====== MOBILE / TABLET (≤ 820px): sidebar vira gaveta deslizante ====== */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }

  /* sidebar sai do fluxo e desliza da esquerda (gaveta) */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 274px; max-width: 84vw;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    z-index: 60; box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: none; }

  /* fundo escuro atrás da gaveta */
  .nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,18,30,.5); z-index: 55; animation: fade .2s forwards; }
  .app.nav-open .nav-backdrop { display: block; }

  /* no mobile a gaveta é sempre completa — anula o modo "recolhido" do desktop */
  .app.collapsed .sb-brand .name, .app.collapsed .sb-switch .lbl,
  .app.collapsed .sb-section, .app.collapsed .nav-item span.t,
  .app.collapsed .sb-foot .meta { display: block; }
  .app.collapsed .nav-item .badge-count { display: grid; }
  .app.collapsed .sb-switch .chev { display: block; }
  .app.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .app.collapsed .sb-switch { justify-content: flex-start; padding: 9px 11px; }
  .app.collapsed .sb-brand { justify-content: flex-start; padding: 18px 18px 14px; }

  /* topbar compacta */
  .topbar { padding: 0 14px; gap: 8px; min-height: 56px; }
  .topbar .spacer { display: none; }
  .search { display: none; }
  .topbar .page-h { flex: 1; min-width: 0; }
  .topbar .page-h h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .page-h p { display: none; }

  .notification-strip { padding: 8px 14px; min-height: 52px; }
  .notification-strip-copy b { font-size: 12px; }
  .notification-strip-copy span { font-size: 11.5px; }
  .notification-strip .btn { padding: 0 10px; }

  .content { padding: 14px; overflow-x: hidden; }

  /* modais viram folha inferior (bottom sheet); drawer ocupa a tela toda */
  .overlay { align-items: flex-end; }
  .modal, .modal.wide { max-width: 100%; margin: 0; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .drawer { width: 100%; max-width: 100%; border-left: none; }

  /* tudo em coluna única + sem estouro horizontal */
  .form-grid { grid-template-columns: 1fr; }
  .appt-time-grid { grid-template-columns: 1fr; }
  .appt-repeat-grid, .appt-repeat-grid.two { grid-template-columns: 1fr; }
  .team-availability-row { grid-template-columns: 1fr 1fr; }
  .team-availability-row label { grid-column: 1 / -1; }
  .team-availability-head { display: none; }
  .menu { max-width: calc(100vw - 24px); }
  .input-icon, .selectbox { min-width: 0 !important; }
  .finance-search { flex: 1 1 100%; min-width: 0; }
  .finance-clear { flex-basis: 100%; justify-content: flex-start; }
  .tbl th, .tbl td { padding: 10px 10px; }

  /* calendário: coluna de horas mais estreita */
  .cal-grid { grid-template-columns: 46px 1fr; }
  .cal-time-cell span { font-size: 10px; right: 5px; }
}

@media (max-width: 700px) {
  .commission-pro-row { grid-template-columns: 1fr !important; }
  .calendar-filter-select { max-width: min(230px, 100%); }
}

/* ====== celulares estreitos (≤ 460px) ====== */
@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 13px; }
  .kpi .val { font-size: 21px; }
  .card-pad { padding: 14px; }
  .toast-wrap { top: 12px; left: 12px; right: 12px; width: auto; }
  .toast { width: 100%; }
  .floating-notification-stack { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

/* ============ boot / carregamento (app real) ============ */
.boot { height: 100vh; display: grid; place-items: center; background: var(--bg); }
.boot-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; color: var(--text-2); font-size: 13.5px; max-width: 360px; padding: 28px; }
.boot-card h3 { color: var(--text); font-family: var(--font-display); }
.spinner { width: 34px; height: 34px; border-radius: 99px; border: 3px solid var(--border); border-top-color: var(--primary); animation: ag-spin .8s linear infinite; margin-bottom: 10px; }
.btn-spinner { width: 14px; height: 14px; border-radius: 99px; border: 2px solid currentColor; border-top-color: transparent; display: inline-block; animation: ag-spin .8s linear infinite; }
@keyframes ag-spin { to { transform: rotate(360deg); } }

/* ============ login (acesso da empresa) ============ */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--bg); padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md, 0 10px 40px rgba(0,0,0,.08)); padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary); color: #fff; margin: 0 auto 2px; }
.login-logo.brand { background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.login-logo.brand img { width: 44px; height: 44px; object-fit: contain; display: block; }
.trial-badge {
  align-self: center; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 11px; border-radius: var(--r-full); background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700; margin: -2px 0 2px;
}
.login-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; text-align: center; margin: 0; letter-spacing: -.02em; }
.login-sub { text-align: center; color: var(--text-2); font-size: 13px; margin: -8px 0 6px; }
.login-card .field label { font-size: 12.5px; }
.login-card .btn { margin-top: 4px; }
.login-err { display: flex; align-items: center; gap: 8px; background: var(--danger-soft, rgba(220,53,69,.1)); color: var(--danger, #dc3545); border: 1px solid var(--danger, #dc3545); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; }
.login-foot { font-size: 12px; }
.login-remember {
  display: flex; align-items: flex-start; gap: 9px; color: var(--text-2);
  font-size: 12.5px; line-height: 1.4; margin-top: -2px; cursor: pointer;
}
.login-remember input {
  width: 16px; height: 16px; flex: none; margin-top: 1px; accent-color: var(--primary);
}
.login-remember span { display: flex; flex-direction: column; gap: 2px; }
.login-remember small { color: var(--text-3); font-size: 11.5px; }
.trial-terms {
  display: flex; align-items: flex-start; gap: 9px; color: var(--text-2);
  font-size: 12.5px; line-height: 1.45; margin-top: -1px;
}
.trial-terms input {
  width: 16px; height: 16px; flex: none; margin-top: 2px; accent-color: var(--primary);
}
.terms-link {
  border: 0; background: transparent; color: var(--primary); padding: 0;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.terms-link:hover { color: var(--primary-strong, var(--primary)); }
.trial-modal { display: flex; flex-direction: column; gap: 16px; }
.trial-modal-brand {
  display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface-2);
}
.trial-modal-brand img {
  width: 64px; height: 64px; object-fit: contain; flex: none; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.trial-modal-brand b { display: block; font-size: 15px; margin-bottom: 4px; }
.trial-modal-brand span { display: block; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.trial-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trial-feature {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface);
}
.trial-feature-icon {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary);
}
.trial-feature b { display: block; font-size: 13px; margin-bottom: 3px; }
.trial-feature span { display: block; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.trial-note {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px;
  border-radius: var(--r-sm); background: var(--success-soft); color: var(--success); font-size: 12.5px; line-height: 1.45;
}
.trial-note svg { flex: none; margin-top: 1px; }
.trial-terms-modal { gap: 14px; }
.trial-terms-list { display: flex; flex-direction: column; gap: 9px; }
.trial-terms-list section {
  padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface);
}
.trial-terms-list b { display: block; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.trial-terms-list span { display: block; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }

@media (max-width: 620px) {
  .trial-feature-grid { grid-template-columns: 1fr; }
  .trial-modal-brand { align-items: flex-start; }
}
