/* Ritmo — base, tokens e estrutura */
@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f3f0e8;
  --paper-deep: #ece7db;
  --surface: #fffdf8;
  --surface-2: #f7f4ec;
  --surface-3: #efeade;
  --ink: #171613;
  --ink-2: #3b3831;
  --muted: #777166;
  --faint: #9d978b;
  --line: #e4ded1;
  --line-strong: #d3ccbd;
  --accent: #f26a2e;
  --accent-deep: #d5531a;
  --accent-text: #b8490f;
  --accent-soft: #fdeade;
  --accent-soft-2: #fbddc9;
  --accent-ink: #1c0d05;
  --purple: #7a4bff;
  --purple-soft: #eee8ff;
  --green: #0e8f62;
  --green-soft: #ddf2e7;
  --blue: #0a66c2;
  --blue-soft: #e2eefb;
  --red: #d84545;
  --red-soft: #fbe5e5;
  --yellow: #b3820a;
  --yellow-soft: #fbf1d0;
  --tone-orange-bg: #fde8d8;
  --tone-orange-fg: #97400f;
  --tone-green-bg: #ddf2e7;
  --tone-green-fg: #146443;
  --tone-purple-bg: #eee8ff;
  --tone-purple-fg: #5733b8;
  --tone-blue-bg: #e2eefb;
  --tone-blue-fg: #114c88;
  --tone-gray-bg: #eeebe3;
  --tone-gray-fg: #676257;
  --tone-yellow-bg: #fbf1d0;
  --tone-yellow-fg: #755706;
  --nav-bg: rgba(243, 240, 232, 0.86);
  --shadow-xs: 0 1px 0 rgba(23, 22, 19, 0.03);
  --shadow-sm: 0 1px 2px rgba(23, 22, 19, 0.04), 0 8px 24px -18px rgba(23, 22, 19, 0.28);
  --shadow-md: 0 2px 4px rgba(23, 22, 19, 0.04), 0 24px 48px -28px rgba(23, 22, 19, 0.35);
  --shadow-lg: 0 32px 80px -32px rgba(23, 22, 19, 0.42);
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

[data-theme="dark"] {
  --paper: #121210;
  --paper-deep: #0d0d0b;
  --surface: #1a1a17;
  --surface-2: #22221e;
  --surface-3: #2a2a25;
  --ink: #f5f1e7;
  --ink-2: #ded9cd;
  --muted: #a09a8d;
  --faint: #817b6f;
  --line: #2d2c27;
  --line-strong: #3e3c35;
  --accent: #ff7a3f;
  --accent-deep: #ff8d58;
  --accent-text: #ff996b;
  --accent-soft: #2e1d13;
  --accent-soft-2: #3a2417;
  --accent-ink: #1b0d05;
  --purple: #a98bff;
  --purple-soft: #251f3d;
  --green: #46d39a;
  --green-soft: #122c22;
  --blue: #6bb6ff;
  --blue-soft: #122436;
  --red: #ff7d7d;
  --red-soft: #331a1a;
  --yellow: #e8bd57;
  --yellow-soft: #2d2614;
  --tone-orange-bg: #352114;
  --tone-orange-fg: #ffb088;
  --tone-green-bg: #152e24;
  --tone-green-fg: #7ee2b5;
  --tone-purple-bg: #261f3e;
  --tone-purple-fg: #c3adff;
  --tone-blue-bg: #142636;
  --tone-blue-fg: #9bd0ff;
  --tone-gray-bg: #292822;
  --tone-gray-fg: #c0baad;
  --tone-yellow-bg: #2d2613;
  --tone-yellow-fg: #ecc668;
  --nav-bg: rgba(18, 18, 16, 0.86);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -18px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.2), 0 24px 48px -28px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 32px 80px -24px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "ss01" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.is-locked { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }
kbd {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
}
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { opacity: 0.05; }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  font-weight: 700;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

.i { width: 1.25em; height: 1.25em; flex: none; }
.brand-i { width: 58%; height: 58%; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.serif-i { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.015em; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.16s, box-shadow 0.16s;
}
.btn .i { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 22px -16px rgba(242, 106, 46, 0.9); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--ink-2); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-soft:hover { background: var(--accent-soft-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 9px; gap: 6px; }
.btn-sm .i { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 14px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn-sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn-sm .i { width: 16px; height: 16px; }
.link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 800; color: var(--accent-text);
  border-radius: 6px; transition: gap 0.16s, color 0.16s;
}
.link .i { width: 14px; height: 14px; }
.link:hover { gap: 8px; color: var(--accent-deep); }
.link-quiet { color: var(--muted); font-weight: 700; }
.link-quiet:hover { color: var(--ink); }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.01em;
}
.field-hint { font-size: 11px; line-height: 1.45; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 12px;
  padding: 0 12px;
  height: 42px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.textarea { height: auto; min-height: 104px; padding: 11px 12px; line-height: 1.55; resize: vertical; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23777166' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
[data-theme="dark"] .select { color-scheme: dark; }
.input[type="date"], .input[type="time"] { color-scheme: light; }
[data-theme="dark"] .input[type="date"], [data-theme="dark"] .input[type="time"] { color-scheme: dark; }
.input.is-error, .textarea.is-error { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field-error { font-size: 11px; font-weight: 700; color: var(--red); }

.switch { position: relative; display: inline-flex; align-items: center; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.18s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.chip .i { width: 13px; height: 13px; }
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-active .i { color: var(--accent); }
.chip-count {
  min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--surface-2);
  font-size: 9.5px; font-weight: 800; color: var(--muted);
}
.chip.is-active .chip-count { background: color-mix(in srgb, var(--paper) 22%, transparent); color: var(--paper); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 8px;
  border-radius: 999px;
  font-size: 10px; font-weight: 800;
  white-space: nowrap;
}
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-orange { background: var(--tone-orange-bg); color: var(--tone-orange-fg); }
.status-green { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.status-purple { background: var(--tone-purple-bg); color: var(--tone-purple-fg); }
.status-blue { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.status-gray { background: var(--tone-gray-bg); color: var(--tone-gray-fg); }
.status-yellow { background: var(--tone-yellow-bg); color: var(--tone-yellow-fg); }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 800;
  white-space: nowrap;
}
.delta .i { width: 12px; height: 12px; }
.delta.is-up { color: var(--tone-green-fg); }
.delta.is-down { color: var(--tone-orange-fg); }

/* ---------- avatares / plataformas ---------- */
.avatar {
  width: var(--av-size, 32px); height: var(--av-size, 32px);
  border-radius: 50%;
  background: var(--av-bg, var(--ink));
  color: var(--av-fg, var(--paper));
  display: inline-grid; place-items: center;
  font-size: calc(var(--av-size, 32px) * 0.36);
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: none;
  border: 2px solid var(--surface);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.client-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.client-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--muted);
}
.client-pill .client-dot { width: 6px; height: 6px; }
.plat {
  width: var(--plat-size, 28px); height: var(--plat-size, 28px);
  border-radius: calc(var(--plat-size, 28px) * 0.3);
  display: inline-grid; place-items: center;
  color: #fff;
  flex: none;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.plat-instagram { background: linear-gradient(145deg, #f7c948 0%, #ee2a7b 52%, #7b2ce0 100%); }
.plat-facebook { background: linear-gradient(145deg, #4c9aff 0%, #1877f2 60%, #0b5fd0 100%); }
.plat-tiktok { background: #111; }
.plat-linkedin { background: linear-gradient(145deg, #2e8ce6 0%, #0a66c2 65%, #064a8f 100%); }
.plat-youtube { background: linear-gradient(145deg, #ff5c5c 0%, #ff0033 60%, #c9002a 100%); }
.plat-x { background: #131313; }
.plat .brand-i { width: 56%; height: 56%; }
.channels { display: inline-flex; align-items: center; }
.channels .plat + .plat { margin-left: -5px; box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.channels-more {
  margin-left: 5px; font-size: 10px; font-weight: 800; color: var(--muted);
  background: var(--surface-2); border-radius: 6px; padding: 2px 5px;
}

.thumb {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-3);
  flex: none;
  width: 54px; height: 54px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-art {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 5px 4px;
  font-size: 6px; line-height: 1.2; font-weight: 800;
  color: #fff;
  background: linear-gradient(transparent, rgba(8, 10, 20, 0.82));
  text-align: center;
}
.thumb-badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(17, 17, 15, 0.8); color: #fff;
  font-size: 8px; font-weight: 800;
  border-radius: 4px; padding: 2px 4px;
  backdrop-filter: blur(6px);
}

/* ---------- estrutura ---------- */
.app { display: flex; min-height: 100dvh; }
.workspace { margin-left: 84px; flex: 1; min-width: 0; }
.rail {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 84px; z-index: 40;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 0 18px;
  gap: 26px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(18px);
}
.brand { width: 44px; height: 44px; color: var(--ink); border-radius: 14px; }
.brand-mark { width: 44px; height: 44px; display: block; }
.rail-nav { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.rail-link {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 15px;
  color: var(--muted);
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.rail-ico { display: grid; place-items: center; }
.rail-ico .i { width: 21px; height: 21px; }
.rail-link:hover { background: var(--surface-2); color: var(--ink); }
.rail-link.is-active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 14px 22px -16px rgba(23, 22, 19, 0.8);
}
.rail-link.is-active .rail-ico { color: var(--accent); }
.rail-tip {
  position: absolute; left: 58px; top: 50%;
  transform: translate(-4px, -50%);
  background: var(--ink); color: var(--paper);
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
  padding: 6px 9px; border-radius: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  z-index: 5;
}
.rail-link:hover .rail-tip, .rail-link:focus-visible .rail-tip { opacity: 1; transform: translate(0, -50%); }
.rail-badge {
  position: absolute; top: 10px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
.rail-link.is-active .rail-badge { box-shadow: 0 0 0 2px var(--ink); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rail-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.rail-avatar:hover { filter: brightness(0.96); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 78px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 30px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-grow { flex: 1; }
.client-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 11px 5px 5px;
  border-radius: 15px;
  border: 1px solid transparent;
  text-align: left;
  transition: background 0.16s, border-color 0.16s;
}
.client-switch:hover { background: var(--surface-2); border-color: var(--line); }
.client-switch-avatar {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: -0.02em;
  flex: none;
}
.client-switch-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.client-switch-eyebrow { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.client-switch-name { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.client-switch-chevron { color: var(--muted); display: grid; place-items: center; }
.client-switch-chevron .i { width: 15px; height: 15px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  height: 42px; width: 292px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color 0.16s, background 0.16s;
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.search-trigger > span[data-icon] { display: grid; place-items: center; }
.search-trigger .i { width: 17px; height: 17px; }
.search-trigger-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell-btn { position: relative; }
.bell-btn .notif-dot {
  position: absolute; top: 10px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--paper);
}
.topbar-new { height: 42px; }
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800;
  margin-left: 2px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.topbar-avatar:hover { filter: brightness(0.96); }

.view {
  max-width: 1460px;
  margin: 0 auto;
  padding: 26px 30px 90px;
  animation: viewIn 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- página / cartões ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 22px; margin-bottom: 24px;
}
.page-head-copy { min-width: 0; }
.page-head h1 {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.page-head h1 .serif-i { font-size: 1.06em; color: var(--ink); }
.page-head .lede { margin-top: 8px; font-size: 13px; color: var(--muted); max-width: 62ch; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-size: 16px; font-weight: 800; letter-spacing: -0.025em; }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.card-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

.seg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.seg-btn {
  height: 28px; padding: 0 10px;
  border-radius: 8px;
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-btn .i { width: 14px; height: 14px; }

.empty {
  text-align: center; padding: 34px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; margin-bottom: 4px;
}
.empty-icon .i { width: 21px; height: 21px; }
.empty h3 { font-size: 14px; font-weight: 800; }
.empty p { font-size: 12px; color: var(--muted); max-width: 34ch; line-height: 1.5; }
.empty .btn { margin-top: 8px; }

/* ---------- popover ---------- */
.popover {
  position: fixed; z-index: 120;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 7px;
  opacity: 0; transform: translateY(-4px) scale(0.985);
  transition: opacity 0.14s, transform 0.14s;
  max-height: min(70dvh, 460px);
  overflow: auto;
  overscroll-behavior: contain;
}
.popover.is-open { opacity: 1; transform: none; }
.popover-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px 8px; gap: 8px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.pop-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: background 0.13s, color 0.13s;
}
.pop-item:hover { background: var(--surface-2); color: var(--ink); }
.pop-item .i { width: 16px; height: 16px; color: var(--muted); }
.pop-item.is-active { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.pop-item.is-danger { color: var(--red); }
.pop-item.is-danger .i { color: var(--red); }
.pop-item small { margin-left: auto; color: var(--faint); font-size: 10px; font-weight: 700; }
.pop-sep { height: 1px; background: var(--line); margin: 5px 8px; }
.pop-note { padding: 7px 10px; font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.pop-avatar { display: grid; place-items: center; }
.pop-client-copy { display: flex; flex-direction: column; gap: 0; line-height: 1.25; }
.pop-client-copy strong { font-size: 12px; font-weight: 800; }
.pop-client-copy span { font-size: 10px; color: var(--faint); font-weight: 600; }
.pop-check { margin-left: auto; color: var(--accent); }
.pop-check .i { width: 15px; height: 15px; color: var(--accent); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 90; display: flex; }
.scrim {
  position: absolute; inset: 0;
  background: rgba(15, 14, 12, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s;
}
.overlay.is-open .scrim { opacity: 1; }
.overlay-panel {
  position: relative;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  max-height: min(92dvh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(14px) scale(0.99);
  transition: opacity 0.2s, transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  width: min(560px, calc(100% - 32px));
}
.overlay.is-open .overlay-panel { opacity: 1; transform: none; }
.overlay-panel.drawer {
  width: min(500px, 100%);
  height: 100dvh; max-height: none;
  margin: 0 0 0 auto;
  border-radius: 24px 0 0 24px;
  border-right: 0;
  transform: translateX(40px);
  display: flex; flex-direction: column;
}
.overlay.is-open .overlay-panel.drawer { transform: none; }
.overlay-panel.sheet {
  width: 100%;
  margin: auto 0 0;
  border-radius: 24px 24px 0 0;
  max-height: 88dvh;
  transform: translateY(100%);
}
.overlay.is-open .overlay-panel.sheet { transform: none; }
.overlay-panel.wide { width: min(760px, calc(100% - 32px)); }
.confirm-modal { width: min(430px, calc(100% - 32px)); }

.panel-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.panel-head .eyebrow { margin-bottom: 2px; }
.panel-body { padding: 20px; }
.panel-foot {
  margin-top: auto;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; align-items: center;
  background: var(--surface);
  position: sticky; bottom: 0;
}

.confirm-card { padding: 26px; display: flex; flex-direction: column; gap: 6px; }
.confirm-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink);
  margin-bottom: 8px;
}
.confirm-icon.is-danger { background: var(--red-soft); color: var(--red); }
.confirm-icon .i { width: 21px; height: 21px; }
.confirm-card h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.025em; }
.confirm-card p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(460px, calc(100% - 28px));
  pointer-events: none;
}
.toast {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 11px 11px 11px 14px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0; transform: translateY(14px) scale(0.98);
  transition: opacity 0.2s, transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: auto;
}
.toast.is-in { opacity: 1; transform: none; }
.toast-ico { color: var(--accent); display: grid; place-items: center; }
.toast-ico .i { width: 19px; height: 19px; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-action {
  color: var(--accent); font-size: 11.5px; font-weight: 800;
  padding: 6px 8px; border-radius: 8px; white-space: nowrap;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.08); }
.toast-close { color: color-mix(in srgb, var(--paper) 55%, transparent); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.toast-close:hover { background: rgba(255, 255, 255, 0.09); color: var(--paper); }
.toast-close .i { width: 15px; height: 15px; }

/* ---------- navegação móvel ---------- */
.mobilenav { display: none; }

@media (max-width: 1100px) {
  .rail { width: 72px; }
  .workspace { margin-left: 72px; }
  .rail-link { width: 44px; height: 44px; border-radius: 13px; }
  .brand, .brand-mark { width: 40px; height: 40px; }
  .topbar { padding: 0 20px; }
  .search-trigger { width: 240px; }
  .view { padding: 22px 20px 80px; }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .workspace { margin-left: 0; }
  .topbar { height: 64px; padding: 0 14px; gap: 4px; }
  .client-switch { padding: 4px 8px 4px 4px; gap: 8px; border-radius: 13px; }
  .client-switch-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 11px; }
  .client-switch-eyebrow { display: none; }
  .client-switch-name { font-size: 12px; max-width: 150px; }
  .client-switch-chevron { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger-label, .search-trigger kbd { display: none; }
  .search-trigger .i { width: 20px; height: 20px; }
  .topbar-new { display: none; }
  .topbar-avatar { width: 34px; height: 34px; font-size: 10.5px; }
  .icon-btn { width: 40px; height: 40px; }
  .view { padding: 16px 14px 110px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .page-head-actions { justify-content: flex-start; width: 100%; }
  .page-head h1 { font-size: 30px; }
  .page-head .lede { font-size: 12px; max-width: 44ch; }
  .card { border-radius: 18px; padding: 18px; }
  .mobilenav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(20px) saturate(1.2);
    border-top: 1px solid var(--line);
  }
  .mobilenav-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 9px; font-weight: 800; color: var(--muted);
    border-radius: 12px; position: relative;
  }
  .mobilenav-link .i { width: 21px; height: 21px; }
  .mobilenav-link.is-active { color: var(--ink); }
  .mobilenav-link.is-active::before {
    content: ""; position: absolute; top: -6px; width: 18px; height: 3px; border-radius: 0 0 3px 3px;
    background: var(--accent);
  }
  .mobilenav-fab {
    align-self: start;
    justify-self: center;
    width: 52px; height: 52px; margin-top: -22px;
    border-radius: 18px;
    background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center;
    box-shadow: 0 12px 24px -12px rgba(242, 106, 46, 0.8), 0 0 0 4px var(--paper);
    transition: transform 0.16s;
  }
  .mobilenav-fab:active { transform: scale(0.95); }
  .mobilenav-fab .i { width: 24px; height: 24px; }
  .toasts { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .overlay-panel.drawer { width: 100%; border-radius: 0; border: 0; }
  .overlay-panel { border-radius: 20px; }
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 16px; }
  .panel-foot { padding-left: 16px; padding-right: 16px; }
  .popover { max-height: 60dvh; }
}
@media (max-width: 520px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 0 10px; }
  .client-switch-name { max-width: 128px; }
  .bell-btn { display: none; }
  .card { padding: 16px; }
  .page-head h1 { font-size: 27px; }
  .seg-btn { padding: 0 8px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Aviso persistente: modo local ou servidor indisponível */
.cloud-alert {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(680px, calc(100vw - 28px));
  padding: 11px 16px;
  border-radius: 14px;
  background: #1c1b18;
  color: #f3f0e9;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 18px 40px rgba(20, 18, 14, 0.28);
}
.cloud-alert[hidden] { display: none; }
.cloud-alert strong { font-weight: 700; }
.cloud-alert-link {
  flex: none;
  color: #f7c948;
  font-weight: 700;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .cloud-alert { bottom: 84px; flex-direction: column; align-items: flex-start; gap: 6px; }
}
.cloud-alert { align-items: flex-start; flex-wrap: wrap; }
.cloud-alert span { flex: 1 1 260px; }
.cloud-alert-link { align-self: center; }
