/* =====================================================================
   DESKSET, Componentes
   Estética: dark, sem bordas, cantos suaves, elevação por superfície.
   ===================================================================== */

/* ---------- BOTÕES ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-2); background: var(--surface-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); color: var(--text-1); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--brand); color: var(--text-on-brand); box-shadow: var(--glow-brand); }
.btn--primary:hover { background: var(--brand-strong); color: var(--text-on-brand); }

.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--surface-2); }

.btn--gradient { background: var(--gradient); color: #fff; box-shadow: var(--glow-brand); }
.btn--icon { width: 40px; padding: 0; justify-content: center; }
.btn--sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn--block { width: 100%; height: 46px; justify-content: center; }

/* ---------- CAMPOS ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-medium); }
.input {
  height: 46px; width: 100%; padding: 0 var(--sp-4);
  background: var(--surface-2); border-radius: var(--r-md);
  color: var(--text-1); font-size: var(--fs-base);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; background: var(--surface-3); box-shadow: 0 0 0 2px var(--brand-soft); }
textarea.input { height: auto; min-height: 96px; padding: var(--sp-3) var(--sp-4); resize: vertical; line-height: var(--lh-base); }

.input-icon { position: relative; }
.input-icon > [data-icon] {
  position: absolute; left: var(--sp-4); top: 50%; z-index: 1;
  transform: translateY(-50%); width: 18px; height: 18px;
  color: var(--text-3); pointer-events: none;
}
.input-icon > [data-icon] > svg { width: 18px; height: 18px; }
.input-icon > .input { padding-left: calc(var(--sp-4) * 2 + 18px); }

/* ---------- PILLS / BADGES / STATUS ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--surface-3); color: var(--text-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pill--brand  { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 78%, white); }
.pill--warn   { background: var(--warn-soft); color: var(--warn); }
.pill--ok     { background: var(--ok-soft); color: var(--ok); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
.pill--yellow { background: color-mix(in srgb, var(--c-yellow) 18%, transparent); color: var(--c-yellow); }

/* Status do ciclo (solicitado→em produção→entregue→em revisão→aprovado) */
.status { display:inline-flex; align-items:center; gap:6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.status .dot { width:8px; height:8px; border-radius:50%; }
.status[data-status="solicitado"]   { color: var(--text-3); }
.status[data-status="solicitado"] .dot   { background: var(--text-3); }
.status[data-status="em_producao"]  { color: var(--c-orange); }
.status[data-status="em_producao"] .dot  { background: var(--c-orange); }
.status[data-status="entregue"]     { color: #4FA3FF; }
.status[data-status="entregue"] .dot     { background: #4FA3FF; }
.status[data-status="em_revisao"]   { color: var(--c-yellow); }
.status[data-status="em_revisao"] .dot   { background: var(--c-yellow); }
.status[data-status="aprovado"]     { color: var(--ok); }
.status[data-status="aprovado"] .dot     { background: var(--ok); }

/* ---------- AVATAR ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  background: var(--gradient); color: #fff;
  display: grid; place-items: center;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  flex: none; overflow: hidden; position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar--lg { width: 52px; height: 52px; font-size: var(--fs-md); }
.avatar .presence { position:absolute; right:-1px; bottom:-1px; width:11px; height:11px; border-radius:50%; background: var(--ok); box-shadow: 0 0 0 3px var(--surface-1); }

/* ---------- CARTÃO ---------- */
.card {
  background: var(--surface-1);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  box-shadow: var(--shadow-1);
}
.card--flat { box-shadow: none; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.card__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-1); }
.card__sub { font-size: var(--fs-sm); color: var(--text-3); }

/* =====================================================================
   LAYOUT / SHELL
   ===================================================================== */
.shell { display: grid; grid-template-columns: 76px minmax(0,1fr); min-height: 100vh; transition:grid-template-columns var(--dur-slow) var(--ease); }
.shell:has(.sidebar:hover), .shell:has(.sidebar :focus-visible) { grid-template-columns:var(--sidebar-w) minmax(0,1fr); }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--surface-1);
  width: 76px; padding: var(--sp-6) 12px;
  display: flex; flex-direction: column; gap: var(--sp-6);
  position: sticky; top: 0; height: 100vh; z-index: calc(var(--z-sticky) + 2);
  overflow: hidden; white-space: nowrap;
  transition: width var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease), padding var(--dur-slow) var(--ease);
}
.sidebar:hover, .sidebar:has(:focus-visible) { width:var(--sidebar-w); padding-left:var(--sp-4); padding-right:var(--sp-4); box-shadow:inset -1px 0 0 var(--line); }
.brand { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2); }
.brand__mark { width: 34px; height: 34px; flex:none; border-radius: 10px; background: var(--gradient); display:grid; place-items:center; color:#fff; font-weight: var(--fw-bold); }
.brand__name { display:none; font-size: var(--fs-md); font-weight: var(--fw-semibold); letter-spacing: -0.02em; opacity:0; transform:translateX(-6px); transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease); }
.sidebar:hover .brand__name, .sidebar:has(:focus-visible) .brand__name { display:block; opacity:1; transform:none; }
.brand__name span { color: var(--text-3); font-weight: var(--fw-regular); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label { height:34px; overflow:hidden; font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; padding: var(--sp-3) var(--sp-3) var(--sp-2); opacity:0; transition:opacity var(--dur) var(--ease); }
.sidebar:hover .nav__label, .sidebar:has(:focus-visible) .nav__label { opacity:1; }
.nav__item {
  display: flex; align-items: center; gap: var(--sp-3);
  height: 44px; padding: 0 var(--sp-3); border-radius: var(--r-md);
  color: var(--text-2); font-size: var(--fs-base); font-weight: var(--fw-medium);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  font-size:0;
}
.nav__item svg { width: 20px; height: 20px; min-width:20px; }
.sidebar:hover .nav__item, .sidebar:has(:focus-visible) .nav__item { font-size:var(--fs-base); }
.nav__item:hover { background: var(--surface-2); color: var(--text-1); }
.nav__item.is-active { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 82%, white); }
.nav__item .count { margin-left: auto; font-size: var(--fs-xs); background: var(--surface-3); color: var(--text-2); min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); display: none; place-items: center; }
.sidebar:hover .nav__item .count, .sidebar:has(:focus-visible) .nav__item .count { display:grid; }

.sidebar__foot { margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2); border-radius: var(--r-md); transition: background var(--dur) var(--ease); }
.user-chip:hover { background: var(--surface-2); }
.user-chip__meta { min-width: 0; opacity:0; transform:translateX(-6px); transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease); }
.sidebar:hover .user-chip__meta, .sidebar:has(:focus-visible) .user-chip__meta { opacity:1; transform:none; }
.user-chip__name { font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__role { font-size: var(--fs-xs); color: var(--text-3); }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-8);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
}
.topbar__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.topbar__spacer { flex: 1; }
.searchbar { width: min(360px, 40vw); }

.content { padding: var(--sp-8); width: 100%; min-width:0; display: flex; flex-direction: column; gap: var(--sp-6); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { color: var(--text-3); font-size: var(--fs-sm); margin-top: 4px; }

.grid { display: grid; gap: var(--sp-6); }
.grid--2 { grid-template-columns: 1.6fr 1fr; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---- Stat card ---- */
.stat { background: var(--surface-1); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-1); display:flex; flex-direction:column; gap: var(--sp-3); }
.stat__ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); display:grid; place-items:center; color: var(--text-2); }
.stat__ico svg { width: 20px; height: 20px; }
.stat__num { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: -0.02em; }
.stat__lbl { font-size: var(--fs-sm); color: var(--text-3); }
.stat--brand .stat__ico { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 82%, white); }

/* ---- Lista de trabalhos ---- */
.tasklist { display: flex; flex-direction: column; }
.task {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border-radius: var(--r-lg);
  transition: background var(--dur) var(--ease);
}
.task:hover { background: var(--surface-2); }
.task + .task { margin-top: 2px; }
.task__type { width: 40px; height: 40px; border-radius: 12px; display:grid; place-items:center; background: var(--surface-3); color: var(--text-2); }
.task__type svg { width: 19px; height: 19px; }
.task__type[data-type="arte"]  { background: color-mix(in srgb, var(--c-purple) 20%, transparent); color: #b79bff; }
.task__type[data-type="aula"]  { background: color-mix(in srgb, #4FA3FF 20%, transparent); color: #8fc2ff; }
.task__type[data-type="live"]  { background: color-mix(in srgb, var(--c-orange) 20%, transparent); color: #ffbd85; }
.task__type[data-type="acao"]  { background: color-mix(in srgb, var(--c-green) 18%, transparent); color: #7fe6bf; }
.task__type[data-type="curso"] { background: color-mix(in srgb, var(--c-yellow) 18%, transparent); color: #ffe98a; }
.task__body { min-width: 0; }
.task__title { font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task__meta { font-size: var(--fs-xs); color: var(--text-3); display:flex; gap: var(--sp-3); margin-top: 3px; flex-wrap: wrap; }
.task__right { display: flex; align-items: center; gap: var(--sp-4); }

/* ---- Evento card (compacto, com progresso) ---- */
.event { background: var(--surface-1); border-radius: var(--r-xl); padding: var(--sp-5); box-shadow: var(--shadow-1); display:flex; flex-direction:column; gap: var(--sp-4); cursor: pointer; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.event:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.event__top { display:flex; align-items:flex-start; justify-content:space-between; gap: var(--sp-3); }
.event__name { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.25; }
.event__top .pill { flex: none; }
.event__progress { display:flex; flex-direction:column; gap: 8px; }
.event__bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.event__bar span { display:block; height:100%; border-radius: var(--r-pill); background: var(--gradient); }
.event__pl { display:flex; justify-content:space-between; font-size: var(--fs-xs); color: var(--text-3); }
.event__foot { display:flex; align-items:center; justify-content: space-between; }
.event__date { display:flex; align-items:center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); }
.event__date svg { width: 15px; height: 15px; }
.event-briefing { background: var(--surface-2); border-radius: var(--r-lg); padding: var(--sp-4); }
.event-briefing p { margin-top: var(--sp-2); color: var(--text-2); white-space: pre-wrap; }
.event-briefing__head { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3); }
.event-briefing__actions { display:flex; justify-content:flex-end; gap:var(--sp-2); margin-top:var(--sp-3); }
.event-briefing textarea { min-height:130px; margin-top:var(--sp-3); }
.event-action { border-radius: var(--r-lg); background: var(--surface-2); overflow: hidden; }
.event-action > .task { background: transparent; }
.event-action__tools { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0 var(--sp-3) var(--sp-3); }
.event-management { display:flex; justify-content:flex-end; margin-top:var(--sp-4); }
.btn--danger { background:color-mix(in srgb,#ef4444 14%,transparent); color:#ff8d8d; }
.btn--danger:hover { background:color-mix(in srgb,#ef4444 24%,transparent); }
.row-actions { display:flex; align-items:center; gap:var(--sp-2); }
.icon-danger { width:32px; height:32px; flex:none; display:grid; place-items:center; border-radius:var(--r-md); color:var(--text-3); opacity:.55; }
.icon-danger:hover { color:#ff7f7f; background:color-mix(in srgb,#ef4444 13%,transparent); opacity:1; }
.icon-danger svg { width:17px; height:17px; }
.recipe-choice .x-btn { flex: none; width: 30px; height: 30px; }
.draft-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.draft-row { display: grid; grid-template-columns: 120px minmax(220px,1fr) 32px; gap: var(--sp-2); align-items: center; }
.draft-row > .select:nth-child(1) { grid-column: 1; grid-row: 1; }
.draft-row [data-draft-tema] { grid-column: 2; grid-row: 1; }
.draft-row [data-draft-data] { grid-column: 1; grid-row: 2; }
.draft-row > .select:nth-child(4) { grid-column: 2; grid-row: 2; }
.draft-row [data-remove-draft] { grid-column: 3; grid-row: 1; }
.draft-row .input, .draft-row .select select { height: 38px; font-size: var(--fs-sm); }
.event-create { width:100%; }
.wizard-steps { display:grid; grid-template-columns:repeat(3,1fr); gap:var(--sp-3); margin-bottom:var(--sp-6); }
.wizard-step { display:flex; align-items:center; justify-content:center; gap:var(--sp-3); min-height:52px; border-radius:var(--r-lg); background:var(--surface-1); color:var(--text-3); }
.wizard-step b { width:26px; height:26px; display:grid; place-items:center; border-radius:50%; background:var(--surface-3); }
.wizard-step.is-active { color:var(--text-1); box-shadow:inset 0 0 0 1px var(--brand); }
.wizard-step.is-active b { background:var(--brand); color:white; }
.wizard-panel[hidden] { display:none; }
.section-title { margin-bottom:var(--sp-6); }
.section-title h2 { font-size:var(--fs-lg); }
.section-title p { color:var(--text-3); margin-top:4px; }
.form-grid--roomy { gap:var(--sp-5); }
.textarea--brief { min-height:150px; resize:vertical; }
.draft-section + .draft-section { margin-top:var(--sp-5); }
.draft-section .card__head { margin-bottom:var(--sp-4); }
.draft-empty { padding:var(--sp-6); text-align:center; color:var(--text-3); border:1px dashed var(--line); border-radius:var(--r-lg); }
.draft-row--wide { grid-template-columns:110px minmax(260px,1fr) 180px 210px 36px; padding:var(--sp-3); background:var(--surface-2); border-radius:var(--r-lg); }
.draft-row--wide .pill { justify-self:start; }
.wizard-actions { position:sticky; bottom:var(--sp-4); display:grid; grid-template-columns:auto 1fr auto auto; gap:var(--sp-3); padding:var(--sp-4); margin-top:var(--sp-5); border-radius:var(--r-xl); background:color-mix(in srgb,var(--surface-1) 92%,transparent); backdrop-filter:blur(12px); box-shadow:var(--shadow-2); z-index:2; }
.review-summary { margin-top:var(--sp-6); padding:var(--sp-5); border-radius:var(--r-lg); background:var(--brand-soft); }
.review-summary div { display:flex; justify-content:space-between; gap:var(--sp-4); }
.review-summary span { color:var(--text-2); }
.preview-banner { display:flex; align-items:center; gap:var(--sp-3); padding:var(--sp-4); margin-bottom:var(--sp-5); border-radius:var(--r-lg); background:var(--brand-soft); color:var(--text-2); }
.preview-banner svg { width:18px; color:var(--brand); }.preview-banner .btn { margin-left:auto; }
.view-toolbar { display:flex; justify-content:flex-end; margin-bottom:var(--sp-4); }
.event-calendar { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:var(--sp-4); }
.calendar-day { min-height:160px; padding:var(--sp-4); border-radius:var(--r-xl); background:var(--surface-1); }
.calendar-day__date { font-weight:var(--fw-semibold); margin-bottom:var(--sp-3); }
.calendar-day__items { display:flex; flex-direction:column; gap:var(--sp-2); }
.calendar-event { display:flex; flex-direction:column; align-items:flex-start; gap:3px; padding:var(--sp-3); text-align:left; border-radius:var(--r-md); background:var(--surface-2); }
.calendar-event span { font-size:var(--fs-xs); color:var(--text-3); }
@media (max-width: 900px) { .draft-row--wide { grid-template-columns:110px 1fr 1fr 36px; }.draft-row--wide [data-draft-tema]{grid-column:2/4}.draft-row--wide [data-draft-data]{grid-column:1/2}.draft-row--wide .select:nth-last-of-type(1){grid-column:2/4} }
@media (max-width: 640px) {
  .draft-row { grid-template-columns: 1fr 1fr 32px; }
  .draft-row [data-draft-tema] { grid-column: 1 / 3; grid-row: 1; }
  .draft-row > .select:nth-child(1) { grid-column: 1; grid-row: 2; }
  .draft-row [data-draft-data] { grid-column: 2; grid-row: 2; }
  .draft-row > .select:nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
  .wizard-step span { display:none; }
  .draft-row--wide { display:grid; grid-template-columns:1fr 36px; }
  .draft-row--wide > * { grid-column:1; }
  .draft-row--wide [data-remove-draft] { grid-column:2; grid-row:1; }
  .review-summary div { flex-direction:column; }
}
.avatar-stack { display:flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 3px var(--surface-1); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---- Agenda (mini calendário/lista por dia) ---- */
.agenda { display:flex; flex-direction: column; gap: var(--sp-4); }
.agenda__day { display:flex; gap: var(--sp-4); }
.agenda__date { text-align:center; flex:none; width: 44px; }
.agenda__date .d { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.agenda__date .m { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; }
.agenda__items { flex:1; display:flex; flex-direction:column; gap: var(--sp-2); }
.agenda__item { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); display:flex; align-items:center; gap: var(--sp-3); }
.agenda__item .time { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.agenda__item .t { font-size: var(--fs-sm); font-weight: var(--fw-medium); }

/* ---- Divisória sutil ---- */
.hr { height: 1px; background: var(--line); border: 0; margin: var(--sp-2) 0; }

/* =====================================================================
   LOGIN
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__aside { position: relative; overflow: hidden; background: var(--surface-1); display:flex; flex-direction:column; justify-content: space-between; padding: var(--sp-12); }
.auth__aside::before { content:""; position:absolute; inset:-40% -20% auto auto; width: 520px; height: 520px; background: var(--gradient); filter: blur(90px); opacity: .55; border-radius: 50%; }
.auth__aside > * { position: relative; }
.auth__pitch h2 { font-size: var(--fs-2xl); line-height: 1.05; letter-spacing: -0.03em; max-width: 12ch; }
.auth__pitch p { color: var(--text-2); margin-top: var(--sp-4); max-width: 40ch; }
.auth__mini { display:flex; gap: var(--sp-3); align-items:center; color: var(--text-3); font-size: var(--fs-sm); }

.auth__main { display:grid; place-items:center; padding: var(--sp-8); }
.auth__card { width: min(400px, 100%); display:flex; flex-direction:column; gap: var(--sp-5); }
.auth__card h1 { font-size: var(--fs-xl); }
.auth__card .sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: -8px; }
.auth__row { display:flex; align-items:center; justify-content: space-between; font-size: var(--fs-sm); }
.auth__row a { color: color-mix(in srgb, var(--brand) 82%, white); }
.check { display:flex; align-items:center; gap: var(--sp-2); color: var(--text-2); }

/* =====================================================================
   RESPONSIVO
   ===================================================================== */
@media (max-width: 1080px) {
  .grid--2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .shell:has(.sidebar:hover), .shell:has(.sidebar :focus-visible) { grid-template-columns:1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: var(--z-overlay); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease); width: var(--sidebar-w); }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-3); }
  .sidebar.is-open .brand__name { display:block; }
  .sidebar.is-open .brand__name, .sidebar.is-open .nav__label, .sidebar.is-open .user-chip__meta { opacity:1; transform:none; }
  .sidebar.is-open .nav__item { font-size:var(--fs-base); }
  .sidebar.is-open .nav__item .count { display:grid; }
  .topbar { padding: 0 var(--sp-5); }
  .content { padding: var(--sp-5); }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}
@media (min-width: 1600px) {
  .content { padding:var(--sp-10); }
  .grid--stats { grid-template-columns:repeat(4,minmax(220px,1fr)); }
}
.menu-toggle { display: none; }
@media (max-width: 860px) { .menu-toggle { display: inline-flex; } }

/* =====================================================================
   OVERLAY / MODAL / DRAWER
   ===================================================================== */
/* Overlay = container flex que centraliza o modal. Se o modal for mais alto
   que a tela, o próprio overlay rola (nada fica cortado ou fora do centro). */
.overlay {
  --overlay-pad-y: clamp(16px, 5vh, 48px);
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(6,6,8,.62); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--overlay-pad-y) var(--sp-4); overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.modal {
  width: min(560px, 94vw); margin: auto;
  max-height: calc(100dvh - var(--overlay-pad-y) - var(--overlay-pad-y)); overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface-1); border-radius: var(--r-2xl); padding: var(--sp-8);
  box-shadow: var(--shadow-3);
  transform: translateY(12px) scale(.98); transition: transform var(--dur) var(--ease);
}
.overlay.is-open .modal { transform: none; }
.modal__head, .modal__foot, .modal > .form-grid { flex: none; }
.modal > .card { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* Drawer fica preso à direita, ocupando a altura toda (posição fixa própria). */
.drawer {
  position: fixed; top: 0; right: 0;
  width: min(520px, 96vw); height: 100vh; overflow: auto;
  background: var(--surface-1); box-shadow: var(--shadow-3); padding: var(--sp-8);
  transform: translateX(24px); transition: transform var(--dur-slow) var(--ease);
}
.overlay.is-open .drawer { transform: translateX(0); }

.modal__head, .drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.x-btn { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-3); background: var(--surface-2); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.x-btn:hover { background: var(--surface-3); color: var(--text-1); }
.x-btn svg { width: 18px; height: 18px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid .col-2 { grid-column: 1 / -1; }
.modal__foot, .drawer__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-6); }

@media (max-width: 640px) {
  .overlay { --overlay-pad-y: var(--sp-3); padding: var(--overlay-pad-y) var(--sp-3); }
  .modal { width: 100%; padding: var(--sp-5); border-radius: var(--r-xl); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2 { grid-column: auto; }
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 140px; }
}

.select { position: relative; }
.select select { appearance: none; height: 46px; width: 100%; padding: 0 var(--sp-4); background: var(--surface-2); border-radius: var(--r-md); color: var(--text-1); }
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-md); width: fit-content; }
.tab { height: 34px; padding: 0 var(--sp-4); border-radius: 10px; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-3); }
.tab.is-active { background: var(--surface-1); color: var(--text-1); box-shadow: var(--shadow-1); }

/* ---- Toggle ---- */
.switch { position: relative; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--surface-3); transition: background var(--dur) var(--ease); flex: none; }
.switch.on { background: var(--brand); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--dur) var(--ease); }
.switch.on::after { transform: translateX(18px); }

/* ---- Tabela ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: var(--fw-medium); padding: 0 var(--sp-4) var(--sp-3); }
.table td { padding: var(--sp-4); font-size: var(--fs-sm); }
.table tbody tr { transition: background var(--dur) var(--ease); cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr + tr td { box-shadow: inset 0 1px 0 var(--line); }
.cell-strong { color: var(--text-1); font-weight: var(--fw-medium); }
.cell-with-ico { display: flex; align-items: center; gap: var(--sp-3); }

/* ---- Detalhe do trabalho ---- */
.detail-type { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.detail-type svg { width: 22px; height: 22px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: var(--sp-3) var(--sp-4); align-items: center; }
.kv dt { color: var(--text-3); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.kv dt svg { width: 16px; height: 16px; }
.kv dd { font-size: var(--fs-sm); color: var(--text-1); }

/* Stepper de status */
.stepper { display:grid; grid-template-columns:repeat(5,minmax(68px,1fr)); align-items:start; gap:6px; margin:var(--sp-3) 0 var(--sp-5); overflow-x:auto; padding-bottom:4px; }
.step { position:relative; display:flex; flex-direction:column; align-items:center; gap:7px; min-width:68px; text-align:center; line-height:1.25; font-size:var(--fs-xs); color:var(--text-3); }
.step .bullet { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.step .bullet svg { width: 13px; height: 13px; }
.step.done .bullet { background: var(--ok); color: #06281d; }
.step.current .bullet { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.step.current { color: var(--text-1); font-weight: var(--fw-medium); }
.stepper > .line { display:none; }
.step .line { width: 26px; height: 2px; background: var(--surface-3); margin: 0 6px; }
.step.done .line { background: var(--ok); }

/* Upload / preview */
.dropzone { border-radius: var(--r-lg); background: var(--surface-2); padding: var(--sp-6); text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); cursor: pointer; transition: background var(--dur) var(--ease); }
.dropzone:hover { background: var(--surface-3); }
.dropzone svg { width: 26px; height: 26px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.preview { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .ver { position: absolute; left: 6px; bottom: 6px; font-size: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px; border-radius: 6px; }

/* Comentários / histórico */
.thread { display: flex; flex-direction: column; gap: var(--sp-4); }
.comment { display: flex; gap: var(--sp-3); }
.comment__body { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); flex: 1; }
.comment__meta { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 4px; }
.comment__meta b { color: var(--text-2); font-weight: var(--fw-medium); }
.event-log { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 8px; padding-left: 4px; }
.event-log .tick { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }

/* Toast */
.toast-wrap { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-2); }
.toast { background: var(--surface-3); color: var(--text-1); padding: var(--sp-3) var(--sp-5); border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: var(--sp-2); animation: toast-in var(--dur) var(--ease); }
.toast svg { width: 16px; height: 16px; color: var(--ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.empty { display: grid; place-items: center; min-height: 260px; text-align: center; gap: 12px; }

@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }
