/* ==========================================================================
   FM Projetos — Design System
   Tokens em CSS custom properties + componentes reutilizaveis.
   Tailwind (CDN) cuida de layout/espaco; aqui ficam as pecas de UI.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --bg-grid: rgba(15, 23, 42, 0.04);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-fg: #ffffff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --sidebar-bg: #0b1120;
  --sidebar-bg-2: #111b31;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.1), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, 0.24);
  --radius: 14px;
  --radius-sm: 10px;
}

html[data-theme='dark'] {
  --bg: #070b16;
  --bg-grid: rgba(148, 163, 184, 0.07);
  --surface: #0f172a;
  --surface-2: #131d33;
  --surface-3: #1b2740;
  --border: #1f2b45;
  --border-strong: #2d3b58;
  --text: #e9eef8;
  --text-soft: #cbd5e1;
  --muted: #8595ad;
  --primary: #6366f1;
  --primary-hover: #7c7ff4;
  --primary-soft: #1c2545;
  --success: #34d399;
  --success-soft: #10281f;
  --warning: #fbbf24;
  --warning-soft: #2b2113;
  --danger: #f87171;
  --danger-soft: #2c1618;
  --info: #38bdf8;
  --info-soft: #0d2233;
  --sidebar-bg: #060a14;
  --sidebar-bg-2: #0d1524;
  --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-grid) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--primary);
  color: #fff;
}

/* ------------------------------ Scrollbars ------------------------------ */
.scroll-thin {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.scroll-thin::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.scroll-thin::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.scroll-thin::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------- Sidebar -------------------------------- */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #fff;
}
.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  opacity: 0.9;
}
.nav-link.is-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.28), rgba(99, 102, 241, 0.06));
  color: var(--sidebar-text-active);
}
.nav-link.is-active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: #818cf8;
}
.nav-link.is-danger:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.nav-section {
  padding: 0 0.75rem;
  margin: 1.25rem 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.65);
}

/* -------------------------------- Topbar -------------------------------- */
.topbar {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

/* Barra de filtros congelada abaixo da topbar ao rolar a lista. */
.toolbar-sticky {
  position: sticky;
  top: 4rem; /* altura da topbar (h-16) */
  z-index: 15;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

/* -------------------------------- Cards --------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-hover {
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}
.card-subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
}
.card-body {
  padding: 1.25rem;
}

/* --------------------------------- KPIs --------------------------------- */
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

/* -------------------------------- Buttons ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.375rem;
  padding: 0 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.94);
}
.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}
.btn-danger-soft:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}
.btn-sm {
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
}
.btn-icon {
  width: 2.375rem;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 2rem;
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -------------------------------- Forms --------------------------------- */
.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.375rem;
}
.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.375rem;
}
.input,
.select,
.textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0 0.75rem;
  height: 2.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.textarea {
  height: auto;
  padding: 0.625rem 0.75rem;
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.17l3.71-3.94a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 18px;
  padding-right: 2.25rem;
}

/* Select com checkboxes (filtro multi-situação). */
.multi-select {
  position: relative;
  min-width: 0;
}
.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.multi-select-trigger .multi-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multi-select-menu {
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.5rem;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}
.multi-select-option:hover {
  background: var(--surface-2);
}
.multi-select-option input {
  flex: none;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}
.field-error {
  display: none;
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.375rem;
  font-weight: 500;
}
.field-error.is-visible {
  display: block;
}
.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.input-group .input-icon ~ .input {
  padding-left: 2.5rem;
}
.input-group .input-action {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
}
.input-group .input-action:hover {
  background: var(--surface-3);
  color: var(--text);
}
.input-group .input-action svg {
  width: 18px;
  height: 18px;
}

.checkbox {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  appearance: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 0 1 0 1.4l-7.5 7.5a1 1 0 0 1-1.4 0L4.3 10.7a1 1 0 1 1 1.4-1.4l2.8 2.79 6.8-6.79a1 1 0 0 1 1.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: 15px;
  background-position: center;
  background-repeat: no-repeat;
}
.checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

/* -------------------------------- Badges -------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}
.badge-neutral {
  background: var(--surface-3);
  color: var(--text-soft);
  border-color: var(--border);
}
.badge-primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 25%, transparent);
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
.badge-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

/* -------------------------------- Tables -------------------------------- */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 0.8125rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr {
  transition: background-color 0.12s ease;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table .cell-strong {
  color: var(--text);
  font-weight: 600;
}
.th-sortable {
  cursor: pointer;
  user-select: none;
}
.th-sortable:hover {
  color: var(--text);
}

/* ------------------------------- Avatares ------------------------------- */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex: none;
  border: 2px solid var(--surface);
  letter-spacing: 0.02em;
}
.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 0.625rem;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.25rem;
}
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 1.75rem;
}
.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar + .avatar {
  margin-left: -9px;
}

/* ------------------------------- Progresso ------------------------------ */
.progress {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.4s ease;
}

/* -------------------------------- Modais -------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.modal-backdrop.is-open {
  display: flex;
  /* flex-start + margin:auto no painel evita o "pulo" ao focar inputs ocultos. */
  align-items: flex-start;
  justify-content: center;
}
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  margin: auto;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  animation: modal-in 0.18s ease-out;
}
/* Formularios envolvem header/body/footer e precisam repassar o flex ao painel. */
.modal-panel > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.modal-body {
  padding: 1.375rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.modal-body::-webkit-scrollbar {
  width: 9px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 18px 18px;
  flex: none;
}

/* -------------------------------- Toasts -------------------------------- */
.toast-stack {
  position: fixed;
  z-index: 90;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  color: var(--text);
  animation: toast-in 0.2s ease-out;
}
.toast svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
}
.toast.is-out {
  animation: toast-out 0.2s ease-in forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}

/* ------------------------------ Tabs / chips ---------------------------- */
.tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-3);
  border-radius: 12px;
}
.tab {
  padding: 0.375rem 0.75rem;
  border-radius: 9px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tab:hover {
  color: var(--text);
}
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* -------------------------------- Kanban -------------------------------- */
.kanban-col {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  min-height: 140px;
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* --------------------------------- Gantt -------------------------------- */
.gantt-grid {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.gantt-row {
  position: relative;
  height: 34px;
  border-bottom: 1px solid var(--border);
}
.gantt-row:last-child {
  border-bottom: 0;
}
.gantt-weekend {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  pointer-events: none;
}
.gantt-bar {
  position: absolute;
  top: 7px;
  height: 20px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 0.4rem;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  cursor: default;
}
.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  z-index: 2;
}

/* ---------------------------- Barras/graficos --------------------------- */
.bar-track {
  background: var(--surface-3);
  border-radius: 8px;
  overflow: hidden;
  height: 10px;
}
.bar-fill {
  height: 100%;
  border-radius: 8px;
}
.chart-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
}
.chart-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 55%, transparent));
  transition: height 0.5s ease;
  min-height: 4px;
}

/* -------------------------------- Diversos ------------------------------ */
.divider {
  height: 1px;
  background: var(--border);
}
.empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
  color: var(--muted);
}
.empty-state .empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.875rem;
  background: var(--surface-3);
  color: var(--muted);
}
.link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
}
.text-muted {
  color: var(--muted);
}
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  z-index: 40;
  display: none;
}
.dropdown.is-open {
  display: block;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: 9px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  background: transparent;
  border: 0;
  text-align: left;
}
.dropdown-item:hover {
  background: var(--surface-3);
  color: var(--text);
}
.dropdown-item svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex: none;
}
.dropdown-item.is-danger {
  color: var(--danger);
}
.dropdown-item.is-danger svg {
  color: var(--danger);
}

/* ------------------------------- Login ---------------------------------- */
.auth-hero {
  background: radial-gradient(circle at 15% 15%, #4338ca 0%, transparent 55%),
    radial-gradient(circle at 85% 80%, #0ea5e9 0%, transparent 50%), #0b1120;
}
.auth-hero-pattern {
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
}
.glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

/* ------------------------------ Utilitarios ----------------------------- */
.fade-in {
  animation: fade-in 0.25s ease-out;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: 8px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}
.app-loading.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.app-loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  padding: 22px 28px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.app-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: app-loading-spin 0.75s linear infinite;
}
.app-loading-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}
@keyframes app-loading-spin {
  to {
    transform: rotate(360deg);
  }
}
body.is-loading {
  overflow: hidden;
}

@media print {
  .no-print,
  .sidebar,
  .topbar {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .print-full {
    margin: 0 !important;
    padding: 0 !important;
  }
  .card {
    box-shadow: none;
    border-color: #d4d4d8;
    break-inside: avoid;
  }
}

/* --------------------------- Comentários rich text --------------------------- */
.comment-editor {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.comment-editor.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.comment-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0.4rem 0.5rem;
}
.comment-editor .ql-container.ql-snow {
  border: 0;
  font-family: inherit;
  font-size: 0.875rem;
}
.comment-editor .ql-editor {
  min-height: 96px;
  line-height: 1.55;
  color: var(--text);
}
.comment-editor .ql-editor.ql-blank::before {
  color: var(--muted);
  font-style: normal;
}
html[data-theme='dark'] .comment-editor .ql-snow .ql-stroke {
  stroke: var(--text-soft);
}
html[data-theme='dark'] .comment-editor .ql-snow .ql-fill,
html[data-theme='dark'] .comment-editor .ql-snow .ql-stroke.ql-fill {
  fill: var(--text-soft);
}
html[data-theme='dark'] .comment-editor .ql-snow .ql-picker,
html[data-theme='dark'] .comment-editor .ql-snow .ql-picker-label {
  color: var(--text-soft);
}
html[data-theme='dark'] .ql-snow .ql-picker-options {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
html[data-theme='dark'] .ql-snow .ql-tooltip {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
html[data-theme='dark'] .ql-snow .ql-tooltip input[type='text'] {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.choice-row {
  border-radius: 0.5rem;
}
.choice-row:hover {
  background: var(--surface-3);
}

.comment-file-chips {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.comment-file-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.75rem;
}
.comment-file-chip > span:first-child {
  flex: 1;
  min-width: 0;
}

.comment-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.comment-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  text-decoration: none;
}
.comment-attachment-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.comment-attachment-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}
.image-viewer[hidden] {
  display: none;
}
.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
}
.image-viewer-frame {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 1.5rem);
}
.image-viewer-frame img {
  display: block;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  width: auto;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
}
.image-viewer-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #fff;
}
.comment-attachment-row .comment-attachment-link {
  flex: 1;
  min-width: 0;
}

/* Input de arquivo sobre o botão — evita scrollIntoView do sr-only no modal. */
.comment-file-picker {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  cursor: pointer;
}
.comment-file-picker .comment-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
  border: 0;
}

.comment-body-html p {
  margin: 0;
}
.comment-body-html ul,
.comment-body-html ol {
  margin: 0.35em 0 0.5em;
  padding-left: 1.25rem;
}
.comment-body-html a {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-word;
}
.comment-body-html strong {
  font-weight: 700;
}
.comment-body-html em {
  font-style: italic;
}
.comment-body-html u {
  text-decoration: underline;
}
