/* =============================================
   Sistema de Gestão de Projetos — Material Shadcn
   ============================================= */

/* ---- Design Tokens (Light Theme) ---- */
:root {
  --background: hsl(0, 0%, 97%);
  --foreground: hsl(20, 14.3%, 4.1%);
  --primary: hsl(0, 0%, 0%);
  --primary-fg: hsl(0, 0%, 100%);
  --secondary: hsl(60, 4.8%, 95.9%);
  --secondary-fg: hsl(20, 14.3%, 4.1%);
  --accent: hsl(60, 4.8%, 95.9%);
  --accent-fg: hsl(20, 14.3%, 4.1%);
  --muted: hsl(60, 4.8%, 95.9%);
  --muted-fg: hsl(25, 5.3%, 44.7%);
  --border: hsl(214, 32%, 91%);
  --input: hsl(214, 32%, 91%);
  --ring: hsl(20, 14.3%, 4.1%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-fg: hsl(0, 0%, 100%);
  --card: hsl(0, 0%, 100%);
  --card-fg: hsl(20, 14.3%, 4.1%);

  /* Extended palette */
  --blue-500: #3b82f6;
  --green-500: #22c55e;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
  --cyan-500: #06b6d4;
  --pink-500: #ec4899;
  --indigo-500: #6366f1;
  --violet-500: #8b5cf6;
  --orange-500: #f97316;

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --header-h: 0px;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-sm: 0.5rem;

  /* Transitions */
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
}
body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--muted-fg);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--foreground);
}

/* ---- Typography ---- */
h1 {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
}
h4 {
  font-size: 1rem;
  font-weight: 600;
}
a {
  color: var(--foreground);
  text-decoration: none;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  position: fixed;
  top: 8px;
  left: 8px;
  bottom: 8px;
  width: var(--sidebar-w);
  background: var(--secondary);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-toggle svg {
  display: none;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
}
.sidebar.collapsed .sidebar-toggle {
  display: none;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.125rem;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--foreground);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-fg);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.sidebar-toggle:hover {
  background: var(--border);
}

/* Nav Items */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  color: var(--muted-fg);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--border);
  color: var(--foreground);
}
.nav-item.active {
  background: var(--primary);
  color: var(--primary-fg);
}
.nav-item.active .nav-icon svg {
  fill: var(--primary-fg);
}
.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.75rem 0.5rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  margin-bottom: 0.25rem;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-name {
  font-weight: 600;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.6875rem;
  color: var(--muted-fg);
}
.nav-logout:hover {
  color: var(--destructive);
}

/* =============================================
   MAIN LAYOUT
   ============================================= */
.layout {
  display: flex;
  min-height: 100vh;
}
.main-content {
  margin-left: calc(var(--sidebar-w) + 16px);
  flex: 1;
  padding: 2rem;
  transition: margin-left var(--transition);
}
body.sidebar-collapsed .main-content {
  margin-left: calc(var(--sidebar-w-collapsed) + 16px);
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 {
  margin: 0;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body {
  padding: 1.5rem;
}
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Stat Cards (Dashboard) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 20px;
  height: 20px;
}
.stat-icon.blue {
  background: #dbeafe;
  color: var(--blue-500);
}
.stat-icon.green {
  background: #dcfce7;
  color: var(--green-500);
}
.stat-icon.amber {
  background: #fef3c7;
  color: var(--amber-500);
}
.stat-icon.red {
  background: #fee2e2;
  color: var(--red-500);
}
.stat-icon.violet {
  background: #ede9fe;
  color: var(--violet-500);
}
.stat-icon.cyan {
  background: #cffafe;
  color: var(--cyan-500);
}
.stat-info {
  flex: 1;
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--muted-fg);
  font-weight: 500;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.125rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn-primary {
  background: linear-gradient(to bottom, hsl(20, 6%, 32%), hsl(20, 6%, 22%));
  color: var(--primary-fg);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.12);
}
.btn-primary:hover {
  background: linear-gradient(to bottom, hsl(20, 6%, 38%), hsl(20, 6%, 28%));
}
.btn-secondary {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--secondary);
}
.btn-danger {
  background: var(--destructive);
  color: var(--destructive-fg);
}
.btn-danger:hover {
  opacity: 0.9;
}
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}
.btn-icon {
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted-fg);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.btn-icon.btn-edit {
  color: var(--blue-500);
}
.btn-icon.btn-delete {
  color: var(--pink-500);
}
.btn-icon.btn-edit:hover {
  background: #dbeafe;
}
.btn-icon.btn-delete:hover {
  background: #fdf2f8;
}
.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* =============================================
   FORMS
   ============================================= */
.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--foreground);
}
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  background: var(--card);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}
.form-control::placeholder {
  color: var(--muted-fg);
}
select.form-control {
  cursor: pointer;
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-check label {
  cursor: pointer;
  font-size: 0.875rem;
}

/* =============================================
   TABLE (DataTable-like)
   ============================================= */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.table-search {
  position: relative;
  max-width: 280px;
}
.table-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-fg);
  display: flex;
  pointer-events: none;
}
.table-search .search-icon svg {
  width: 14px;
  height: 14px;
}
.table-search input {
  padding-left: 2.25rem;
}
.data-table-wrapper {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.data-table thead th:hover {
  color: var(--foreground);
}
.data-table thead th.sort-asc::after {
  content: " ↑";
}
.data-table thead th.sort-desc::after {
  content: " ↓";
}
.data-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: hsl(60, 4.8%, 97%);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.td-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Table Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--muted-fg);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pagination-buttons {
  display: flex;
  gap: 4px;
}
.pagination-buttons button {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--foreground);
  transition: all var(--transition);
}
.pagination-buttons button:hover {
  background: var(--secondary);
}
.pagination-buttons button.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.pagination-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  padding: 1rem;
}
.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.16);
  animation: slideUp 0.2s ease-out;
}
.modal.modal-lg {
  max-width: 720px;
}
.modal.modal-xl {
  max-width: 1100px;
  max-height: 90vh;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  margin: 0;
}
.modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-fg);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
}
.modal-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.modal-close svg {
  width: 18px;
  height: 18px;
}
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
}

/* Alert/Confirm modal */
.modal-alert .modal-footer {
  justify-content: flex-end;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =============================================
   STATUS BADGES
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-planejado {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-andamento {
  background: #fef3c7;
  color: #b45309;
}
.badge-concluido {
  background: #dcfce7;
  color: #15803d;
}
.badge-cancelado {
  background: #fee2e2;
  color: #b91c1c;
}
.badge-pausado {
  background: #e0e7ff;
  color: #4338ca;
}
.badge-pendente {
  background: #f3f4f6;
  color: #6b7280;
}

/* =============================================
   GANTT CHART
   ============================================= */
.gantt-container {
  overflow-x: auto;
  padding: 1rem 0;
}
.gantt-chart {
  min-width: 800px;
  position: relative;
}
.gantt-header {
  display: flex;
  border-bottom: 2px solid var(--border);
  height: 40px;
}
.gantt-header-cell {
  flex: 1;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-fg);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  min-width: 40px;
}
.gantt-header-cell:last-child {
  border-right: none;
}
.gantt-body {
  position: relative;
}
.gantt-row {
  display: flex;
  align-items: center;
  height: 40px;
  border-bottom: 1px solid hsl(214, 32%, 94%);
  position: relative;
}
.gantt-row-label {
  width: 200px;
  min-width: 200px;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--border);
}
.gantt-row-bars {
  flex: 1;
  position: relative;
  height: 100%;
}
.gantt-bar {
  position: absolute;
  top: 8px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.6875rem;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--transition);
}
.gantt-bar.atual {
  background: var(--blue-500);
}
.gantt-bar.base {
  background: var(--amber-500);
  opacity: 0.6;
  top: 20px;
  height: 12px;
  font-size: 0;
}
.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red-500);
  z-index: 1;
}

/* =============================================
   SWITCH / TOGGLE
   ============================================= */
.switch-container {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.switch {
  position: relative;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}
.switch-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--card);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .switch-slider {
  background: var(--primary);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* =============================================
   DOCUMENTS / LINKS LIST
   ============================================= */
.doc-list {
  list-style: none;
  padding: 0;
}
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}
.doc-item:last-child {
  border-bottom: none;
}
.doc-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.doc-item-info svg {
  color: var(--muted-fg);
}
.doc-item-info a {
  color: var(--blue-500);
  font-weight: 500;
}
.doc-item-info a:hover {
  text-decoration: underline;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--background);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.login-card .logo-block {
  text-align: center;
  margin-bottom: 2rem;
}
.login-card .logo-block .logo-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.75rem;
  font-size: 1.5rem;
}
.login-card .logo-block h2 {
  margin-bottom: 0.25rem;
}
.login-card .logo-block p {
  color: var(--muted-fg);
  font-size: 0.875rem;
}
.login-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

/* =============================================
   PROJECT DETAIL TABS
   ============================================= */
.detail-section {
  margin-bottom: 1.5rem;
}
.detail-section h3 {
  margin-bottom: 0.75rem;
}
.project-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.meta-item {
  display: flex;
  flex-direction: column;
}
.meta-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.meta-value {
  font-size: 0.9375rem;
  font-weight: 500;
}

/* =============================================
   UTILITIES
   ============================================= */
.text-muted {
  color: var(--muted-fg);
}
.text-danger {
  color: var(--destructive);
}
.text-sm {
  font-size: 0.8125rem;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.mt-1 {
  margin-top: 0.5rem;
}
.mt-2 {
  margin-top: 1rem;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.gap-1 {
  gap: 0.5rem;
}
.gap-2 {
  gap: 1rem;
}

/* =============================================
   AUDITORIA / CHECKLIST
   ============================================= */
.page-header-wrap {
  flex-wrap: wrap;
  gap: 0.5rem;
}
.page-header .back-link {
  font-size: 0.875rem;
  color: var(--muted-fg);
  margin-bottom: 0.25rem;
  display: block;
}
.page-header .subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted-fg);
}
.card-body-tight-top {
  padding-bottom: 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.section-header h3 {
  margin: 0;
}
.checklist-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Capítulos retráteis */
.capitulo-block {
  background: var(--secondary);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  overflow: hidden;
}
.capitulo-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.capitulo-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}
.capitulo-toggle .chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
  color: var(--muted-fg);
}
.capitulo-block.collapsed .chevron {
  transform: rotate(-90deg);
}
.capitulo-header {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  flex: 1;
}
.capitulo-header input {
  flex: 1;
  min-width: 80px;
}
.capitulo-header input:first-of-type {
  max-width: 60px;
}
.capitulo-content {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
}
.capitulo-block.collapsed .capitulo-content {
  display: none;
}

/* Requisitos */
.req-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
.req-item .req-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: flex-start;
}
.req-item .req-row:last-child {
  margin-bottom: 0;
}
.req-item textarea.req-texto {
  flex: 1;
  min-height: 60px;
  resize: vertical;
  overflow: visible;
}
.req-item .req-desc {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  cursor: help;
  min-height: 60px;
  white-space: pre-wrap;
  overflow: visible;
}
.req-item.modo-avaliacao .req-desc {
  display: block !important;
}
.req-item.modo-avaliacao .req-texto {
  display: none !important;
}
.req-item:not(.modo-avaliacao) .req-desc {
  display: none !important;
}
.req-item:not(.modo-avaliacao) .req-texto {
  display: block !important;
}
.req-avaliacao {
  min-width: 90px;
  max-width: 90px;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: center;
}
.req-item.modo-avaliacao input.req-edit,
.req-item.modo-avaliacao textarea.req-edit,
.req-item.modo-avaliacao .req-row.req-edit,
.req-item.modo-avaliacao .btn-remove-req,
.capitulo-block.modo-avaliacao .capitulo-header input,
.capitulo-block.modo-avaliacao .capitulo-header .btn-remove-cap,
.capitulo-block.modo-avaliacao .btn-add-req {
  display: none !important;
}
.capitulo-block.modo-avaliacao .capitulo-header .cap-display {
  display: inline-block !important;
}
.capitulo-block:not(.modo-avaliacao) .capitulo-header .cap-display {
  display: none !important;
}
.req-item.modo-avaliacao .req-num {
  display: inline-block !important;
  min-width: 45px;
  font-weight: 600;
  color: var(--muted-fg);
}
.req-item:not(.modo-avaliacao) .req-num {
  display: none !important;
}

/* Modal Resumo da Auditoria */
.resumo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.resumo-table th,
.resumo-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.resumo-table th {
  font-weight: 600;
  color: var(--muted-fg);
}
.resumo-table .resumo-pontuacao {
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  min-width: 4rem;
  text-align: center;
  border: 2px solid transparent;
  color: var(--foreground);
}

/* Níveis de pontuação (altere aqui para testar outros visuais) */
  .resumo-pontuacao.nivel-0 { background-color: 2px solid oklch(59.1% 0.293 322.896); color:white }
.resumo-global-card.nivel-0 { border-left-color: oklch(59.1% 0.293 322.896); color:white }

.resumo-pontuacao.nivel-1 { background-color: oklch(57.7% 0.245 27.325); color:white }
.resumo-global-card.nivel-1 { border-left-color: oklch(57.7% 0.245 27.325); color:white }

.resumo-pontuacao.nivel-2 { background-color: oklch(70.5% 0.213 47.604); color:white }
.resumo-global-card.nivel-2 { border-left-color: oklch(70.5% 0.213 47.604); color:white }

.resumo-pontuacao.nivel-3 { background-color: oklch(59.6% 0.145 163.225); color:white }
.resumo-global-card.nivel-3 { border-left-color: oklch(59.6% 0.145 163.225); color:white }

.resumo-pontuacao.nivel-4 { background-color: oklch(51.1% 0.096 186.391); color:white }
.resumo-global-card.nivel-4 { border-left-color: oklch(51.1% 0.096 186.391); color:white }
/* Card da Pontuação Global (acima da tabela) */
.resumo-global-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.resumo-global-card .resumo-global-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}
.resumo-global-card .resumo-pontuacao-lg {
  font-size: 1.25rem;
  padding: 0.375rem 0.75rem;
  min-width: 4.5rem;
  border-radius: var(--radius-sm);
}

/* Layout 2 colunas do resumo (tabela | radar) */
.resumo-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.resumo-layout.resumo-layout-single {
  grid-template-columns: 1fr;
}
.resumo-col-tabela {
  overflow-x: auto;
}
.resumo-col-radar {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .resumo-layout {
    grid-template-columns: 1fr;
  }
}

/* Gráfico radar do resumo */
.resumo-radar-wrap {
  margin-bottom: 0;
  padding: 1rem;
  overflow: visible;
}
.resumo-radar-wrap #resumoRadarChart {
  min-height: 300px;
  display: flex;
  justify-content: center;
}
.resumo-radar-wrap .resumo-radar-svg {
  max-width: 100%;
  height: auto;
}

/* Modal de confirmação (tamanho reduzido) */
.modal.modal-sm {
  max-width: 420px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
