/* ==========================================================
   Marketing · Obra Pavoniana — Calendário colaborativo
   style.css
   ========================================================== */

/* ---------- Tokens de design ---------- */
:root {
  --ink: #15204a;          /* azul-marinho institucional */
  --primary: #2f5bea;      /* cobalto vibrante */
  --primary-2: #5b3df5;    /* violeta */
  --sun: #ffb020;          /* girassol (destaques) */
  --coral: #ff5a5f;

  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f5f7fc;
  --surface-3: #e8ecf6;
  --border: #dfe4f0;
  --text: #121a36;
  --muted: #5d6789;
  --sidebar-bg: #15204a;
  --sidebar-text: #c9d2f2;

  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(21, 32, 74, .06), 0 1px 1px rgba(21, 32, 74, .04);
  --shadow-2: 0 8px 24px -8px rgba(21, 32, 74, .22);
  --shadow-3: 0 24px 60px -12px rgba(21, 32, 74, .35);

  --font-head: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;

  --topbar-h: 68px;
  --sidebar-w: 248px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c1230;
  --surface: #141c40;
  --surface-2: #1a2350;
  --surface-3: #222c5e;
  --border: #29346a;
  --text: #e8ecfb;
  --muted: #9aa5cf;
  --sidebar-bg: #0a0f28;
  --sidebar-text: #aab4e0;
  --primary: #5b7cff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 10px 28px -10px rgba(0, 0, 0, .6);
  --shadow-3: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--primary) 85%, transparent); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #0ea371; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-outline-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-ghost.danger { color: var(--danger); }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); text-decoration: none; }
.btn-light:hover { background: rgba(255,255,255,.24); }
.btn-sun { background: var(--sun); color: #2a1a00; }
.link-btn { background: none; border: 0; padding: .3rem 0; color: var(--primary); font-weight: 600; font-size: .85rem; display: inline-flex; gap: .4rem; align-items: center; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 11px;
  display: inline-grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--coral); color: #fff; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.ring { animation: ring .7s ease; }
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }

/* ---------- Avatar ---------- */
.avatar {
  --av: var(--primary);
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--av); color: #fff; font-weight: 700; font-size: .78rem;
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar.sm { width: 26px; height: 26px; font-size: .66rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

/* ---------- Cabeçalho ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 1.25rem 0;
  display: flex; align-items: center; gap: 1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.logo-slot {
  width: 48px; height: 48px; flex: none; border-radius: 14px; padding: 0;
  border: 2px dashed color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--surface-2); overflow: hidden; display: grid; place-items: center;
  transition: border-color .15s, transform .15s;
}
.logo-slot:hover { border-color: var(--primary); transform: scale(1.04); }
.logo-slot.has-logo { border-style: solid; border-color: var(--border); background: #fff; }
.logo-slot img { width: 100%; height: 100%; object-fit: contain; }
.logo-placeholder { display: grid; place-items: center; gap: 1px; color: var(--muted); }
.logo-placeholder i { font-size: 1rem; }
.logo-placeholder small { font-size: .55rem; font-weight: 700; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--font-head); font-size: 1.02rem; color: var(--text); }
.brand-text span { font-size: .78rem; color: var(--muted); }

.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; }
.search input {
  width: 100%; height: 42px; padding: 0 1rem 0 2.5rem;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-3); padding: .4rem; max-height: 60vh; overflow: auto;
}
.search-item { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border: 0; background: none; border-radius: 10px; text-align: left; }
.search-item:hover, .search-item.focus { background: var(--surface-2); }
.search-item .si-main { flex: 1; min-width: 0; }
.search-item strong { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item small { color: var(--muted); }
.search-empty { padding: .9rem; color: var(--muted); text-align: center; font-size: .9rem; }

.top-actions { display: flex; align-items: center; gap: .55rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; padding: .25rem .6rem .25rem .25rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.user-btn:hover { background: var(--surface-3); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.user-meta strong { font-size: .85rem; }
.user-meta small { font-size: .72rem; color: var(--muted); }
.user-btn > i { font-size: .7rem; color: var(--muted); }

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
  width: min(380px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-3); overflow: hidden;
  animation: pop .16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.panel-head strong { font-family: var(--font-head); }
.panel-list { max-height: 420px; overflow: auto; padding: .35rem; }
.notif { width: 100%; display: flex; gap: .75rem; padding: .7rem; border: 0; background: none; text-align: left; border-radius: 12px; position: relative; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.notif.unread::after { content: ""; position: absolute; right: 12px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; background: var(--primary); }
.notif-icon.upload { background: var(--warn); }
.notif-icon.approved { background: var(--ok); }
.notif-icon.changes { background: var(--danger); }
.notif-icon.comment, .notif-icon.mention { background: #8b5cf6; }
.notif-icon.published { background: #0ea5e9; }
.notif-text { font-size: .88rem; padding-right: 14px; }
.notif-text small { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.user-panel .panel-list { max-height: none; }
.user-option { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 12px; border: 0; background: none; text-align: left; }
.user-option:hover { background: var(--surface-2); }
.user-option.current { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.user-option span:nth-child(2) { flex: 1; }
.user-option small { display: block; color: var(--muted); font-size: .76rem; }
.user-option .fa-check { color: var(--primary); }
.panel-foot { padding: .7rem 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .2rem; }
.panel-foot p { margin: 0 0 .3rem; font-size: .78rem; color: var(--muted); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 1.1rem .85rem; display: flex; flex-direction: column; gap: 1.2rem; overflow: auto;
}
.nav { display: flex; flex-direction: column; gap: .25rem; }
.nav-item {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem;
  border: 0; border-radius: 12px; background: none; color: var(--sidebar-text);
  font-weight: 600; text-align: left; transition: background-color .15s, color .15s;
}
.nav-item i { width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 8px 20px -10px rgba(91, 61, 245, .9); }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--sun); color: #2a1a00; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }

.sidebar-card { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 1rem; }
.sidebar-card h4 { color: #fff; font-size: .88rem; margin-bottom: .8rem; }
.mini-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-flow li { position: relative; display: flex; align-items: center; gap: .6rem; font-size: .8rem; padding: .28rem 0 .28rem .1rem; }
.mini-flow li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); flex: none; }
.mini-flow li:not(:last-child)::after { content: ""; position: absolute; left: 5.5px; top: 22px; width: 1px; height: 14px; background: rgba(255,255,255,.18); }
.mini-flow li span.count { margin-left: auto; color: #fff; font-weight: 700; }
.sidebar-foot { margin-top: auto; }
.sidebar-foot .link-btn { color: var(--sidebar-text); font-weight: 500; }

.main { padding: 1.5rem 1.75rem 3rem; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.65rem; font-weight: 800; }
.page-head p { margin: .25rem 0 0; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg button { border: 0; background: none; padding: .45rem .85rem; border-radius: 9px; font-weight: 600; font-size: .86rem; color: var(--muted); display: inline-flex; align-items: center; gap: .45rem; }
.seg button.active { background: var(--ink); color: #fff; }
[data-theme="dark"] .seg button.active { background: var(--primary); }

/* ---------- Filtros ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  padding: .85rem 1rem; margin-bottom: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
}
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 150px; flex: 1 1 150px; }
.field label { font-size: .76rem; font-weight: 600; color: var(--muted); display: flex; gap: .35rem; align-items: center; }
select, input[type="text"], input[type="date"], input[type="time"], input:not([type]), textarea, .member-form input {
  width: 100%; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { resize: vertical; min-height: 80px; }
.range-inputs { display: flex; gap: .4rem; }
.filters-end { display: flex; align-items: center; gap: .6rem; margin-left: auto; padding-bottom: .2rem; }
.filter-count { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---------- Views ---------- */
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-1); min-width: 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; }
.panel-title h3 { font-size: 1rem; display: flex; gap: .5rem; align-items: center; }
.panel-title h3 i { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.1rem; margin-bottom: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.chart-box { position: relative; height: 260px; }
.empty { padding: 1.4rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--border); border-radius: 12px; }
.empty i { display: block; font-size: 1.4rem; margin-bottom: .4rem; color: color-mix(in srgb, var(--muted) 70%, transparent); }

/* Hero do dashboard — o elemento de destaque da página */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 1.6rem 1.8rem; margin-bottom: 1.1rem;
  color: #fff; background: var(--ink);
  display: grid; grid-template-columns: 1fr auto; gap: 1.2rem; align-items: center;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(420px 220px at 92% 10%, rgba(255,176,32,.55), transparent 70%),
    radial-gradient(520px 260px at 70% 120%, rgba(91,61,245,.75), transparent 70%),
    radial-gradient(380px 200px at 0% 0%, rgba(47,91,234,.6), transparent 70%);
}
.hero > * { position: relative; }
.hero h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; }
.hero p { margin: .35rem 0 0; color: rgba(255,255,255,.82); }
.hero-flow { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.hero-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); font-size: .84rem; font-weight: 600; color: #fff; }
.hero-pill b { font-family: var(--font-head); }
button.hero-pill:hover { background: rgba(255,255,255,.2); }
.hero-actions { display: flex; flex-direction: column; gap: .5rem; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: .9rem; margin-bottom: 1.1rem; }
.kpi {
  --c: var(--primary);
  text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 16px;
  padding: 1rem; display: flex; flex-direction: column; gap: .55rem; position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--c) 45%, var(--border)); }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.kpi strong { font-family: var(--font-head); font-size: 1.85rem; line-height: 1; }
.kpi span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.kpi small { font-size: .74rem; color: var(--muted); }

/* Listas de linhas */
.list { display: flex; flex-direction: column; gap: .35rem; }
.row { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .6rem .65rem; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); text-align: left; transition: border-color .15s, background-color .15s; }
.row:hover { border-color: var(--border); background: var(--surface-3); }
.row-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--muted); font-size: .78rem; }
.row-main small.overdue { color: var(--danger); font-weight: 700; }
.row-thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-3); }

.timeline { display: flex; flex-direction: column; gap: .15rem; max-height: 330px; overflow: auto; }
.tl-item { display: flex; gap: .7rem; padding: .5rem .2rem; border: 0; background: none; text-align: left; width: 100%; border-radius: 10px; }
button.tl-item:hover { background: var(--surface-2); }
.tl-item .tl-text { font-size: .86rem; flex: 1; }
.tl-item .tl-text small { display: block; color: var(--muted); font-size: .75rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem;
  border-radius: 999px; font-size: .75rem; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); white-space: nowrap;
}
.chip.ghost { --c: var(--muted); }
.chip.solid { background: var(--c); color: #fff; border-color: transparent; }

/* ---------- Calendário ---------- */
.cal-layout { display: grid; grid-template-columns: 1fr 290px; gap: 1.1rem; align-items: start; }
.cal-panel { padding: 1rem; }
.backlog-panel { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - 2rem); overflow: auto; }
.backlog-group { margin-top: 1rem; }
.backlog-group h4 { font-size: .82rem; color: var(--muted); margin-bottom: .45rem; display: flex; justify-content: space-between; font-family: var(--font-body); font-weight: 700; }
.backlog-item {
  --c: var(--primary);
  display: flex; gap: .55rem; align-items: center; padding: .55rem .6rem; margin-bottom: .4rem;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--c);
  cursor: grab; font-size: .85rem; user-select: none;
}
.backlog-item:hover { box-shadow: var(--shadow-2); }
.backlog-item .bi-main { flex: 1; min-width: 0; }
.backlog-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.backlog-item small { color: var(--muted); font-size: .74rem; }
.backlog-item small.overdue { color: var(--danger); font-weight: 700; }

#calendar {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-today-bg-color: color-mix(in srgb, var(--sun) 14%, transparent);
  --fc-button-bg-color: var(--surface-2);
  --fc-button-border-color: var(--border);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--surface-3);
  --fc-button-hover-border-color: var(--border);
  --fc-button-active-bg-color: var(--ink);
  --fc-button-active-border-color: var(--ink);
  --fc-now-indicator-color: var(--coral);
  --fc-event-border-color: transparent;
}
[data-theme="dark"] #calendar { --fc-button-active-bg-color: var(--primary); --fc-button-active-border-color: var(--primary); }
#calendar .fc-toolbar-title { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; text-transform: capitalize; }
#calendar .fc-button { border-radius: 9px !important; font-weight: 600; font-size: .84rem; padding: .4rem .75rem; box-shadow: none !important; text-transform: capitalize; }
#calendar .fc-button-primary:not(:disabled).fc-button-active, #calendar .fc-button-primary:not(:disabled):active { color: #fff; }
#calendar .fc-button-group { gap: 4px; }
#calendar .fc-col-header-cell-cushion { font-weight: 700; font-size: .8rem; color: var(--muted); text-transform: capitalize; padding: .5rem; text-decoration: none; }
#calendar .fc-daygrid-day-number { font-weight: 600; font-size: .82rem; color: var(--text); text-decoration: none; padding: .35rem .5rem; }
#calendar .fc-day-today .fc-daygrid-day-number { background: var(--sun); color: #2a1a00; border-radius: 8px; margin: 3px; padding: .15rem .45rem; }
#calendar .fc-daygrid-day-frame { min-height: 108px; cursor: copy; }
#calendar .fc-daygrid-day:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
#calendar .fc-event { border-radius: 7px; padding: 1px 2px; cursor: pointer; box-shadow: var(--shadow-1); transition: transform .12s; }
#calendar .fc-event:hover { transform: translateY(-1px); }
#calendar .fc-list-event-title a, #calendar .fc-list-day-text, #calendar .fc-list-day-side-text { color: var(--text); text-decoration: none; }
#calendar .fc-list .fc-task { color: var(--text); }
#calendar .fc-more-link { color: var(--primary); font-weight: 700; font-size: .78rem; }
#calendar .fc-popover { background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-3); }
#calendar .fc-popover-header { background: var(--surface-2); color: var(--text); }
#calendar .fc-timegrid-slot-label-cushion, #calendar .fc-timegrid-axis-cushion { font-size: .75rem; color: var(--muted); }
.fc-task { display: flex; align-items: center; gap: 5px; overflow: hidden; font-size: .78rem; font-weight: 600; color: #fff; padding: 1px 3px; }
.fc-task .pdot { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
.fc-task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-task b { font-weight: 800; }
.fc-ver { margin-left: auto; font-size: .66rem; background: rgba(0,0,0,.18); padding: 0 5px; border-radius: 6px; }
.fc-list .fc-task .pdot { box-shadow: none; }

/* ---------- Kanban ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr);
  gap: .9rem; overflow-x: auto; padding-bottom: 1rem; align-items: start;
  scroll-snap-type: x proximity;
}
.column {
  --c: var(--primary);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; max-height: calc(100vh - 250px); scroll-snap-align: start;
  border-top: 4px solid var(--c);
}
[data-theme="dark"] .column { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.column-head { display: flex; align-items: center; gap: .55rem; padding: .8rem .9rem .6rem; }
.column-head h3 { font-size: .9rem; flex: 1; }
.column-head .count { font-size: .76rem; font-weight: 800; padding: .1rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.column-head i { color: var(--c); }
.column-body { flex: 1; overflow-y: auto; padding: .2rem .6rem .6rem; display: flex; flex-direction: column; gap: .6rem; min-height: 90px; }
.column-body:empty::before {
  content: "Arraste cartões para cá"; display: grid; place-items: center; height: 80px;
  border: 1.5px dashed var(--border); border-radius: 12px; font-size: .8rem; color: var(--muted);
}
.add-card { margin: 0 .6rem .7rem; padding: .5rem; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; font-size: .85rem; text-align: left; }
.add-card:hover { background: var(--surface-3); color: var(--text); }

.card {
  --p: var(--primary);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: .75rem .8rem; box-shadow: var(--shadow-1); cursor: grab; position: relative;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--p) 40%, var(--border)); }
.card::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--p); }
.card-top { display: flex; justify-content: space-between; gap: .4rem; margin-bottom: .5rem; }
.tag { font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.prio { --c: var(--p); font-size: .7rem; font-weight: 800; color: var(--c); display: inline-flex; align-items: center; gap: .3rem; }
.prio::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.card-cover { width: 100%; height: 118px; object-fit: cover; border-radius: 8px; margin-bottom: .55rem; display: block; background: var(--surface-3); }
.card h4 { font-family: var(--font-body); font-size: .93rem; font-weight: 700; margin-bottom: .55rem; line-height: 1.3; }
.card h4 i { color: var(--primary); font-size: .85em; }
.card-meta { display: flex; align-items: center; gap: .65rem; font-size: .76rem; color: var(--muted); flex-wrap: wrap; }
.card-meta span { display: inline-flex; gap: .3rem; align-items: center; }
.card-meta .avatar { margin-left: auto; }
.due.overdue { color: var(--danger); font-weight: 700; }
.due.today { color: #b45309; font-weight: 700; }
[data-theme="dark"] .due.today { color: var(--sun); }
.card-ghost { opacity: .35; }
.card-chosen { box-shadow: var(--shadow-3); }
.card-drag { transform: rotate(2.5deg); }

/* ---------- Aprovações ---------- */
.approval-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.approval-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-1); display: flex; flex-direction: column; }
.ac-cover { height: 190px; background: var(--surface-3); display: grid; place-items: center; position: relative; overflow: hidden; border: 0; padding: 0; width: 100%; }
.ac-cover img { width: 100%; height: 100%; object-fit: cover; }
.ac-cover > i { font-size: 2.4rem; color: var(--muted); }
.ac-cover .chip { position: absolute; top: 10px; left: 10px; }
.ac-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.ac-body h4 { font-size: 1rem; }
.ac-body p { margin: 0; font-size: .85rem; color: var(--muted); }
.ac-note { font-size: .84rem; background: var(--surface-2); padding: .5rem .65rem; border-radius: 10px; border-left: 3px solid var(--warn); }
.ac-actions { display: flex; gap: .5rem; margin-top: auto; flex-wrap: wrap; }
.ac-actions .btn { flex: 1; }

.history-table { overflow-x: auto; }
.history-table table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 720px; }
.history-table th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 700; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.history-table td { padding: .65rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table tbody tr { cursor: pointer; }
.history-table tbody tr:hover td { background: var(--surface-2); }
.history-table .fb { color: var(--muted); max-width: 340px; }

/* ---------- Equipe ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.member-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.1rem; display: flex; flex-direction: column; gap: .8rem; box-shadow: var(--shadow-1); }
.member-head { display: flex; gap: .8rem; align-items: center; }
.member-head strong { display: block; font-family: var(--font-head); font-size: .98rem; }
.member-head small { color: var(--muted); }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.member-stats div { background: var(--surface-2); border-radius: 10px; padding: .45rem; text-align: center; }
.member-stats b { display: block; font-family: var(--font-head); font-size: 1.1rem; }
.member-stats span { font-size: .7rem; color: var(--muted); }
.member-form { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: .8rem; align-items: end; }
.member-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.5rem;
  background: rgba(8, 12, 32, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .2s ease;
}
.modal-backdrop.open { opacity: 1; }
.dialog-backdrop { z-index: 120; }
.modal {
  width: min(880px, 100%); max-height: calc(100vh - 3rem); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-3); overflow: hidden;
  transform: translateY(14px) scale(.98); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.modal-backdrop.open .modal { transform: none; }
.modal-sm { width: min(460px, 100%); padding: 1.4rem; gap: .9rem; }
.modal-sm h3 { font-size: 1.15rem; }
.modal-sm p { margin: 0; }

.tm-head { --c: var(--primary); padding: 1.2rem 1.4rem 1rem; display: flex; gap: 1rem; align-items: flex-start; border-top: 5px solid var(--c); }
.tm-title { flex: 1; min-width: 0; }
.tm-title h2 { font-size: 1.35rem; margin: .5rem 0 .25rem; font-weight: 700; }
.tm-title p { margin: 0; }

/* Trilho do fluxo (stepper) */
.stepper { display: flex; padding: .2rem 1.4rem .9rem; gap: 0; overflow-x: auto; }
.step { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; font-size: .7rem; font-weight: 700; color: var(--muted); text-align: center; }
.step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step .bubble { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); z-index: 1; font-size: .72rem; border: 3px solid var(--surface); }
.step.done .bubble { background: var(--ok); color: #fff; }
.step.done::before, .step.current::before { background: var(--ok); }
.step.current .bubble { background: var(--c); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.step.current { color: var(--text); }
.step.error .bubble { background: var(--danger); }

.action-bar { margin: 0 1.4rem .9rem; padding: .7rem .8rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.action-bar .ab-text { flex: 1; min-width: 200px; font-size: .88rem; display: flex; gap: .55rem; align-items: center; }
.action-bar .ab-text i { color: var(--primary); }

.tabs { display: flex; gap: .2rem; padding: 0 1.2rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { border: 0; background: none; padding: .7rem .8rem; font-weight: 600; font-size: .88rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: .45rem; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab .tcount { font-size: .7rem; background: var(--surface-3); color: var(--muted); padding: 0 .45rem; border-radius: 999px; }
.tm-body { padding: 1.2rem 1.4rem 1.4rem; overflow-y: auto; flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input[name="title"] { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.form-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.prio-picker { display: flex; gap: .4rem; flex-wrap: wrap; }
.prio-picker label { flex-direction: row; cursor: pointer; }
.prio-picker input { position: absolute; opacity: 0; pointer-events: none; }
.prio-picker span { --c: var(--primary); padding: .45rem .8rem; border-radius: 10px; border: 1.5px solid var(--border); font-weight: 700; color: var(--muted); font-size: .82rem; display: inline-flex; align-items: center; gap: .4rem; transition: all .15s; }
.prio-picker span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.prio-picker input:checked + span { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.prio-picker input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); }

.section-title { font-size: .95rem; margin: 1.3rem 0 .7rem; display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.section-title:first-child { margin-top: 0; }

.upload-box, .review-box { border: 1px solid var(--border); border-radius: 16px; padding: 1rem; background: var(--surface-2); display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.upload-box h3, .review-box h3 { font-size: 1rem; display: flex; gap: .5rem; align-items: center; }
.review-box { border: 2px solid color-mix(in srgb, var(--warn) 55%, var(--border)); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.review-box h3 i { color: var(--warn); }
.review-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.review-actions .btn { flex: 1; min-width: 170px; }
.dropzone {
  border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: 14px; padding: 1.3rem;
  display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; cursor: pointer;
  background: var(--surface); transition: background-color .15s, border-color .15s;
}
.dropzone i { font-size: 1.7rem; color: var(--primary); }
.dropzone span { font-size: .8rem; color: var(--muted); }
.dropzone.over { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-color: var(--primary); }
.pending-files { display: flex; flex-wrap: wrap; gap: .5rem; }
.pending-file { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .5rem .35rem .65rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; }
.pending-file button { border: 0; background: none; color: var(--muted); padding: 2px 4px; }
.pending-file button:hover { color: var(--danger); }

.feedback-callout { display: flex; gap: .7rem; padding: .75rem .85rem; border-radius: 12px; background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); font-size: .88rem; }
.feedback-callout i { color: var(--danger); margin-top: 3px; }
.feedback-callout p { margin: .15rem 0 0; }
.approved-callout { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.approved-callout i { color: var(--ok); }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
.files-grid.big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.file-thumb { position: relative; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: .45rem; display: flex; flex-direction: column; gap: .3rem; text-align: left; transition: box-shadow .15s, transform .15s; }
.file-thumb:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.file-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.files-grid.big .file-thumb img { aspect-ratio: 4 / 5; object-fit: contain; }
.file-icon { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 2rem; color: var(--primary); }
.file-name { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .7rem; color: var(--muted); }
.file-del { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.file-wrap { position: relative; }
.file-wrap:hover .file-del, .file-del:focus-visible { opacity: 1; }

.versions { display: flex; flex-direction: column; gap: .8rem; }
.version { border: 1px solid var(--border); border-radius: 14px; padding: .9rem; background: var(--surface); }
.version-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.version-num { font-family: var(--font-head); font-weight: 800; font-size: .95rem; }
.version-head small { color: var(--muted); }
.version-head .chip { margin-left: auto; }
.version .note { font-size: .86rem; margin: .6rem 0 0; color: var(--text); }
.version .feedback-callout { margin-top: .6rem; }

/* Comentários */
.comments { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1rem; }
.comment { display: flex; gap: .7rem; }
.comment-bubble { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: .6rem .8rem; }
.comment.mine .comment-bubble { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.comment.feedback .comment-bubble { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.comment.approval .comment-bubble { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.comment-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .2rem; }
.comment-head strong { font-size: .86rem; }
.comment-head small { color: var(--muted); font-size: .74rem; }
.comment-text { font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.mention { color: var(--primary); font-weight: 700; }
.comment-form { display: flex; gap: .6rem; align-items: flex-start; position: sticky; bottom: -1.4rem; background: var(--surface); padding: .6rem 0 0; }
.comment-form textarea { min-height: 52px; flex: 1; }
.comment-form .btn { height: 44px; }

.history-list { display: flex; flex-direction: column; position: relative; padding-left: .4rem; }
.history-list::before { content: ""; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.h-item { display: flex; gap: .8rem; padding: .45rem 0; position: relative; }
.h-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border); color: var(--primary); font-size: .8rem; flex: none; z-index: 1; }
.h-item div { font-size: .88rem; padding-top: .35rem; }
.h-item small { display: block; color: var(--muted); font-size: .75rem; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 140; background: rgba(5, 8, 22, .92); display: flex; flex-direction: column; animation: fadeIn .2s ease; }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: calc(.8rem + env(safe-area-inset-top, 0px)) 1.2rem .8rem; color: #fff; }
.lb-bar span { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar > div { display: flex; gap: .5rem; flex: none; }
.lb-content { flex: 1; display: grid; place-items: center; padding: 0 1.2rem calc(1.2rem + env(safe-area-inset-bottom, 0px)); min-height: 0; }
.lb-content img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lb-content iframe { width: min(960px, 100%); height: 100%; border: 0; border-radius: 10px; background: #fff; }
.lb-content pre { width: min(820px, 100%); max-height: 100%; overflow: auto; background: #fff; color: #111; padding: 1.4rem; border-radius: 10px; white-space: pre-wrap; font-family: var(--font-body); }
.lb-file { text-align: center; color: #fff; }
.lb-file i { font-size: 4rem; margin-bottom: 1rem; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 1.2rem; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); z-index: 200; display: flex; flex-direction: column; gap: .55rem; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: .7rem; align-items: center; max-width: 380px;
  padding: .8rem 1rem; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-3);
  font-size: .88rem; animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
}
[data-theme="dark"] .toast { background: #26326b; }
.toast i { font-size: 1.05rem; }
.toast.success i { color: #34d399; }
.toast.error i { color: #fb7185; }
.toast.warning i { color: var(--sun); }
.toast.info i { color: #93c5fd; }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

.shake { animation: shake .35s; border-color: var(--danger) !important; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* Confete ao aprovar */
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 300; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .8; } }

/* ---------- Mobile ---------- */
.only-mobile, .bottom-nav, .fab, .scrim { display: none; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child { grid-column: 1 / -1; }
  .cal-layout { grid-template-columns: 1fr; }
  .backlog-panel { position: static; max-height: none; }
  #backlog { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 .8rem; }
  .backlog-group { margin-top: .6rem; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 62px; }
  .only-mobile { display: inline-grid; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 90; width: 280px; height: 100%;
    padding-top: calc(1.2rem + env(safe-area-inset-top, 0px));
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-3); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(5, 8, 22, .5); }
  .scrim[hidden] { display: none; }
  .brand-text { display: none; }
  .main { padding: 1.1rem 1rem calc(6rem + env(safe-area-inset-bottom, 0px)); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 1.3rem; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav button { position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 600; color: var(--muted); padding: .35rem; border-radius: 10px; }
  .bottom-nav button i { font-size: 1.1rem; }
  .bottom-nav button.active { color: var(--primary); }
  .bottom-nav .nav-badge { position: absolute; top: 0; right: calc(50% - 22px); margin: 0; min-width: 18px; height: 18px; font-size: .62rem; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 1rem; bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); z-index: 55;
    width: 56px; height: 56px; border-radius: 18px; border: 0; color: #fff; font-size: 1.3rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 12px 28px -8px rgba(47, 91, 234, .8);
  }
  .toasts { bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); left: 1rem; right: 1rem; align-items: stretch; }
  .toast { max-width: none; }
  .member-form { grid-template-columns: 1fr 1fr; }
  .member-form .btn { grid-column: 1 / -1; }
  .column { max-height: none; }
  .board { grid-auto-columns: minmax(82vw, 1fr); scroll-snap-type: x mandatory; }
  #calendar .fc-toolbar { flex-wrap: wrap; gap: .5rem; }
  #calendar .fc-toolbar-chunk:nth-child(2) { order: -1; width: 100%; text-align: center; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .topbar { gap: .55rem; padding-left: .75rem; padding-right: .75rem; }
  .logo-slot { width: 42px; height: 42px; }
  .search input { height: 40px; font-size: 16px; }
  .icon-btn { width: 38px; height: 38px; }
  .user-btn { padding: 2px; }
  .page-head h1 { font-size: 1.35rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .kpi strong { font-size: 1.5rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .filters { padding: .75rem; gap: .55rem; }
  .field { min-width: calc(50% - .3rem); flex: 1 1 calc(50% - .3rem); }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; }
  .modal-sm { border-radius: 22px 22px 0 0; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
  .tm-head, .tm-body { padding-left: 1rem; padding-right: 1rem; }
  .tm-body { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
  .action-bar { margin-left: 1rem; margin-right: 1rem; }
  .stepper { padding-left: 1rem; padding-right: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .member-form { grid-template-columns: 1fr; }
  #calendar .fc-button { padding: .35rem .55rem; font-size: .78rem; }
  #calendar .fc-toolbar-title { font-size: 1.05rem; }
  #calendar .fc-daygrid-day-frame { min-height: 74px; }
  .fc-task { font-size: .68rem; }
  .fc-task .pdot, .fc-ver { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================
   SISTEMA COMPARTILHADO — login, acessos, links do Drive
   ========================================================== */

/* Visibilidade por sessão e permissão */
body.signed-out .app-only { display: none !important; }
body:not(.signed-out) .auth-screen { display: none; }
body:not(.is-admin) .admin-only { display: none !important; }
.logo-slot { cursor: default; }
.logo-slot:hover { transform: none; }

/* Tela de acesso */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
  background:
    radial-gradient(600px 300px at 85% 0%, rgba(255,176,32,.35), transparent 70%),
    radial-gradient(700px 360px at 0% 100%, rgba(91,61,245,.45), transparent 70%),
    var(--ink);
}
.auth-card {
  width: min(440px, 100%); background: var(--surface); border-radius: 24px; padding: 2rem 1.8rem;
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; gap: 1rem; animation: pop .25s ease;
}
.auth-brand { display: flex; align-items: center; gap: .8rem; }
.auth-brand .logo-slot { width: 54px; height: 54px; }
.auth-card h1 { font-size: 1.45rem; font-weight: 800; }
.auth-card p { margin: 0; }
.auth-card form { display: flex; flex-direction: column; gap: .85rem; }
.auth-card label { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.auth-card input { font-size: 1rem; padding: .7rem .8rem; }
.auth-card .btn { padding: .75rem 1rem; font-size: 1rem; }
.auth-error { display: flex; gap: .6rem; padding: .7rem .8rem; border-radius: 12px; font-size: .88rem;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.auth-error i { color: var(--danger); margin-top: 3px; }
.auth-info { display: flex; gap: .6rem; padding: .7rem .8rem; border-radius: 12px; font-size: .88rem;
  background: color-mix(in srgb, var(--primary) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent); }
.auth-info i { color: var(--primary); margin-top: 3px; }
.auth-loading { text-align: center; color: var(--muted); padding: 1rem; }
.pw-rules { margin: 0; padding-left: 1.1rem; font-size: .8rem; color: var(--muted); }
.pw-field { position: relative; }
.pw-field input { padding-right: 2.6rem; width: 100%; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: .4rem; }

/* Estado de sincronização */
.sync-state { font-size: .76rem; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.sync-state.saving { color: var(--primary); font-weight: 700; }
.sync-state.error { color: var(--danger); font-weight: 700; }
.sidebar-note { font-size: .74rem; margin: 0; color: var(--sidebar-text); opacity: .75; }
@media (max-width: 1100px) { .sync-state { display: none; } }

/* Botão ocupado */
.btn.is-busy, .icon-btn.is-busy { pointer-events: none; opacity: .7; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card.is-saving { opacity: .55; pointer-events: none; }

/* Aviso de versão desatualizada dentro do modal */
.stale-banner { margin: 0 1.4rem .9rem; padding: .7rem .85rem; border-radius: 12px; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: .88rem; }
.stale-banner i { color: var(--warn); }
.stale-banner span { flex: 1; min-width: 200px; }

/* Detalhes somente leitura (integrantes) */
.readonly-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1.2rem; }
.readonly-grid .full { grid-column: 1 / -1; }
.ro-label { font-size: .76rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: .2rem; }
.ro-value { font-size: .95rem; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 640px) { .readonly-grid { grid-template-columns: 1fr; } }

/* Links do Drive */
.link-rows { display: flex; flex-direction: column; gap: .5rem; }
.link-row { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: .5rem; align-items: center; }
.link-row input.invalid { border-color: var(--danger); }
@media (max-width: 640px) { .link-row { grid-template-columns: 1fr auto; } .link-row input[data-field="label"] { grid-column: 1; } }
.drive-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.drive-link { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.drive-link .dl-icon { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 1.1rem; color: #fff; background: #1a73e8; }
.drive-link .dl-icon.doc { background: #4285f4; } .drive-link .dl-icon.sheet { background: #0f9d58; }
.drive-link .dl-icon.slide { background: #f4b400; } .drive-link .dl-icon.folder { background: #5f6368; }
.drive-link .dl-main { flex: 1; min-width: 0; }
.drive-link strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-link small { color: var(--muted); font-size: .74rem; }
.drive-link .dl-actions { display: flex; gap: .3rem; }
.drive-link .icon-btn { width: 32px; height: 32px; border-radius: 9px; font-size: .8rem; text-decoration: none; }
.ref-form { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: .5rem; margin-bottom: .8rem; }
@media (max-width: 640px) { .ref-form { grid-template-columns: 1fr; } }
.lb-content iframe.drive-frame { width: min(1100px, 100%); height: 100%; background: #fff; }
.lb-hint { color: rgba(255,255,255,.75); font-size: .8rem; text-align: center; padding: 0 1rem .6rem; }

/* Equipe e acessos */
.team-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.team-table th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 700; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.team-table td { padding: .7rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.team-table tr:last-child td { border-bottom: 0; }
.team-table tr.inactive td { opacity: .62; }
.team-person { display: flex; gap: .7rem; align-items: center; min-width: 200px; }
.team-person strong { display: block; }
.team-person small { color: var(--muted); }
.team-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.team-wrap { overflow-x: auto; }
.team-wrap table { min-width: 760px; }
.team-foot { margin: .9rem .2rem 0; display: flex; gap: .5rem; align-items: baseline; }
.secret-box { display: flex; gap: .5rem; align-items: center; padding: .8rem .9rem; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); }
.secret-box code { flex: 1; font-size: 1.35rem; font-weight: 700; letter-spacing: .06em; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; word-break: break-all; }
.dialog-fields { display: flex; flex-direction: column; gap: .7rem; }
.dialog-fields label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.dialog-error { color: var(--danger); font-size: .85rem; margin: 0; }
