* {
  box-sizing: border-box;
}

:root {
  --bg: #edf2f6;
  --surface: #ffffff;
  --surface-2: #f8fbfd;

  --sidebar-top: #0f618d;
  --sidebar-mid: #08416f;
  --sidebar-bottom: #032553;

  --text: #18324a;
  --text-soft: #5f7390;
  --title: #123b63;

  --green: #22c55e;
  --green-dark: #16803c;
  --green-soft: #dcfce7;

  --teal: #14b8a6;
  --teal-soft: #ccfbf1;

  --border: #d4e0ea;
  --border-soft: #e8eff5;

  --danger: #f24843;
  --danger-dark: #d93732;

  --shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --sidebar-width: 250px;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  min-height: 100vh;
}

/* =========================
   SIDEBAR PREMIUM
========================= */

.sidebar {
  width: 250px;
  min-width: 250px;
  background: linear-gradient(180deg, #0e5d87 0%, #08416f 38%, #032553 100%);
  color: #fff;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 18px 0;
  z-index: 1000;
  box-shadow: 10px 0 30px rgba(2, 12, 32, 0.14);
  overflow-x: hidden;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 14px 18px;
}

.brand-logo {
  width: 23px;
  height: 23px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-box h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
  margin: 0 14px 14px 14px;
}

.sidebar-group,
.menu-section,
#adminMenu {
  margin: 0 0 10px 0;
  padding: 0;
}

.sidebar-label,
.menu-section h4,
#adminMenu h4 {
  display: block;
  margin: 0 0 8px 0;
  padding: 0 22px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.60);
  font-weight: 700;
}

/* links padrão */
.sidebar a,
.sidebar .nav-item,
.sidebar .menu-link,
#adminMenu a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 10px;
  padding: 12px 14px;
  width: calc(100% - 20px);
  max-width: calc(100% - 20px);
  min-width: 0;
  box-sizing: border-box;

  border-radius: 8px;
  text-decoration: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar a span:first-child,
.sidebar .nav-item span:first-child,
.sidebar .menu-link span:first-child,
#adminMenu a span:first-child {
  width: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.sidebar a span:last-child,
.sidebar .nav-item span:last-child,
.sidebar .menu-link span:last-child,
#adminMenu a span:last-child {
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* hover */
.sidebar a:hover,
.sidebar .nav-item:hover,
.sidebar .menu-link:hover,
#adminMenu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

/* active premium */
.sidebar a.active,
.sidebar .nav-item.active,
.sidebar .menu-link.active,
#adminMenu a.active {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
  border-radius: 8px;
}

/* barrinha lateral do active */
.sidebar a.active::before,
.sidebar .nav-item.active::before,
.sidebar .menu-link.active::before,
#adminMenu a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 4px;
  border-radius: 3px;
  background: #2bbf6a;
}

/* texto do active */
.sidebar a.active span,
.sidebar .nav-item.active span,
.sidebar .menu-link.active span,
#adminMenu a.active span {
  color: #ffffff !important;
}

/* logout */
.logout-item {
  margin-top: 8px;
}

/* SETOR BLOQUEADO */
.setor-bloqueado {
  border: 2px dashed #bfcbd6 !important; /* pontilhado */
  background: #f4f6f8; /* leve cinza */
  opacity: 0.85;
  cursor: not-allowed;
  position: relative;
}

/* tira a borda verde lateral quando bloqueado */
.setor-bloqueado::before {
  display: none;
}

/* texto mais suave */
.setor-bloqueado h3 {
  color: #6b7c8f;
}

.setor-bloqueado p {
  color: #8a9aad;
}

.setor-bloqueado::after {
  content: "🔒";
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 16px;
  opacity: 0.6;
}

/* =========================================
   EDITOR QUILL - BLOCO ÚNICO FINAL
========================================= */

.editor-group {
  margin-bottom: 24px;
}

.editor-shell {
  position: relative;
  border: 1px solid #c8d5e2;
  border-radius: 16px;
  background: #f8fbfd;
  overflow: visible;
}

/* toolbar */
#editorToolbar {
  position: relative;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #f8fbfd;
  border-bottom: 1px solid #dbe5ee;
  border-radius: 16px 16px 0 0;
}

#editorToolbar .ql-formats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

/* botões */
#editorToolbar button {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 8px;
  background: transparent !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

#editorToolbar button:hover {
  background: #e9f0f6 !important;
}

#editorToolbar button.ql-active {
  background: #d7e4ef !important;
  box-shadow: inset 0 0 0 1px #b8cddd;
}

#editorToolbar button svg {
  width: 16px !important;
  height: 16px !important;
}

/* pickers */
#editorToolbar .ql-picker {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  min-width: unset !important;
  height: 34px !important;
}

#editorToolbar .ql-picker-label {
  height: 34px !important;
  min-width: 84px;
  padding: 0 10px !important;
  border: none !important;
  border-radius: 8px;
  background: transparent !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

#editorToolbar .ql-picker-label:hover {
  background: #e9f0f6 !important;
}

#editorToolbar .ql-picker.ql-expanded .ql-picker-label,
#editorToolbar .ql-picker-label.ql-active {
  background: #d7e4ef !important;
  box-shadow: inset 0 0 0 1px #b8cddd;
}

#editorToolbar .ql-picker-label::after {
  display: none !important;
}

/* dropdown */
#editorToolbar .ql-picker-options {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  z-index: 99999 !important;
  background: #ffffff !important;
  border: 1px solid #d6e0e8 !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12) !important;
  max-height: 180px;
  overflow-y: auto;
}

/* align e color menores */
#editorToolbar .ql-align .ql-picker-label,
#editorToolbar .ql-color .ql-picker-label {
  width: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  justify-content: center !important;
}

#editorToolbar .ql-stroke {
  stroke: #42576b !important;
}

#editorToolbar .ql-fill {
  fill: #42576b !important;
}

#editorToolbar .ql-picker svg {
  width: 16px !important;
  height: 16px !important;
}

/* área do editor */
.quill-editor {
  position: relative;
  z-index: 1;
  min-height: 260px;
  background: #ffffff;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.ql-toolbar.ql-snow {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

.ql-container.ql-snow {
  border: none !important;
  background: #ffffff;
  font-size: 15px;
  color: #18324a;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

.ql-editor {
  min-height: 220px;
  padding: 20px 24px;
  background: #ffffff;
  border-top: 1px solid #edf2f7;
  line-height: 1.75;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}

.ql-editor p,
.ql-editor li,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor span,
.ql-editor div {
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
}

.ql-editor.ql-blank::before {
  left: 24px !important;
  right: 24px !important;
  color: #8ca0b3 !important;
  font-style: normal !important;
}

.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
  color: #123b63;
  margin: 12px 0 8px;
}

.ql-editor p {
  margin: 0 0 10px;
}

.ql-editor ul,
.ql-editor ol {
  padding-left: 24px;
  margin: 10px 0;
}

/* containers acima do editor não podem cortar dropdown */
.content,
.page-card,
.tutorial-form-grid,
.form-group,
.editor-group,
.editor-shell {
  overflow: visible !important;
}

.page-card {
  position: relative;
  z-index: 1;
}

/* botão salvar */
.form-actions-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}

.btn-success.full {
  width: 100%;
}


/* ========================================
   LINHA VERDE EMBAIXO DOS TÍTULOS
======================================== */
.page-card h1,
.page-title h1,
.card h1,
.admin-box h1,
.welcome-hero h1,
.section-box h1,
.content-box h1,
.block-box h1,
.panel-box h1,
.topic-box h1,
.upload-box h1,
.tutorial-section-box h1,
.page-card h2,
.page-title h2,
.card h2,
.admin-box h2,
.section-box h2,
.content-box h2,
.block-box h2,
.panel-box h2,
.topic-box h2,
.upload-box h2,
.tutorial-section-box h2 {
  position: relative;
  padding-bottom: 14px;
}

.page-card h1::after,
.page-title h1::after,
.card h1::after,
.admin-box h1::after,
.welcome-hero h1::after,
.section-box h1::after,
.content-box h1::after,
.block-box h1::after,
.panel-box h1::after,
.topic-box h1::after,
.upload-box h1::after,
.tutorial-section-box h1::after,
.page-card h2::after,
.page-title h2::after,
.card h2::after,
.admin-box h2::after,
.section-box h2::after,
.content-box h2::after,
.block-box h2::after,
.panel-box h2::after,
.topic-box h2::after,
.upload-box h2::after,
.tutorial-section-box h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.48),
    rgba(34, 197, 94, 0.10)
  );
}

.page-card > hr:first-of-type,
.admin-box > hr:first-of-type,
.tutorial-section-box > hr:first-of-type,
.topic-box > hr:first-of-type,
.upload-box > hr:first-of-type,
.page-card > .form-divider:first-of-type,
.admin-box > .form-divider:first-of-type,
.tutorial-section-box > .form-divider:first-of-type,
.topic-box > .form-divider:first-of-type,
.upload-box > .form-divider:first-of-type {
  display: none;
}

/* =========================
   CONTEÚDO
========================= */

.content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 18px 26px 26px 26px;
  min-height: 100vh;
}

.page-shell,
.main-content,
.page-content {
  width: 100%;
}

/* =========================
   BOXES PRINCIPAIS
========================= */

.page-card,
.page-title,
.card,
.admin-box,
.section-box,
.content-box,
.block-box,
.panel-box,
.topic-box,
.upload-box,
.tutorial-section-box,
.welcome-hero,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.page-card h1,
.page-title h1,
.card h1,
.admin-box h1,
.welcome-hero h1,
.header-box h1,
.title-box h1,
.hero-box h1,
.intro-box h1 {
  margin: 0 0 12px 0;
  font-size: 30px;
  color: var(--title);
  font-weight: 700;
}

.page-card h2,
.page-title h2,
.card h2,
.admin-box h2,
.section-box h2,
.content-box h2,
.block-box h2,
.panel-box h2,
.topic-box h2,
.upload-box h2,
.tutorial-section-box h2,
.header-box h2,
.title-box h2,
.hero-box h2,
.intro-box h2 {
  margin: 0 0 12px 0;
  font-size: 24px;
  color: var(--title);
  font-weight: 700;
}

.page-card p,
.page-title p,
.card p,
.admin-box p,
.section-box p,
.content-box p,
.block-box p,
.panel-box p,
.topic-box p,
.upload-box p,
.tutorial-section-box p,
.welcome-hero p,
.empty-state p,
.header-box p,
.title-box p,
.hero-box p,
.intro-box p {
  color: var(--text-soft);
  line-height: 1.6;
}

.page-title-line,
.section-title {
  margin: 0 0 14px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #c7ead2;
  color: var(--title);
  font-weight: 700;
}

.page-title-line {
  font-size: 30px;
}

.section-title {
  font-size: 22px;
}

/* =========================
   BOTÕES
========================= */

button,
.btn-primary,
.save-btn,
.back-btn,
.secondary-btn,
.inline-action-btn,
.action-btn,
.refresh-btn,
.update-btn,
.tutorial-edit-btn,
.tutorial-file-btn,
.tutorial-delete-btn,
.delete-topic-btn,
.file-delete-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover,
.btn-primary:hover,
.save-btn:hover,
.back-btn:hover,
.secondary-btn:hover,
.inline-action-btn:hover,
.action-btn:hover,
.refresh-btn:hover,
.update-btn:hover,
.tutorial-edit-btn:hover,
.tutorial-file-btn:hover,
.tutorial-delete-btn:hover,
.delete-topic-btn:hover,
.file-delete-btn:hover {
  transform: translateY(-1px);
}

.btn-primary,
.save-btn,
.back-btn,
.inline-action-btn,
.tutorial-file-btn {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
}

button:not(.ql-bold):not(.ql-italic):not(.ql-underline):not(.ql-link):not(.ql-clean):not(.ql-list):not(.ql-align):not(.edit-btn):not(.delete-btn):not(.tutorial-delete-btn):not(.delete-topic-btn):not(.file-delete-btn) {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
}

.secondary-btn,
.refresh-btn,
.update-btn,
.edit-btn {
  background: #e8eef4;
  color: var(--title);
  border: 1px solid #d5dfeb;
}

.secondary-btn:hover,
.refresh-btn:hover,
.update-btn:hover,
.edit-btn:hover {
  background: #dfe8f1;
}

.delete-btn,
.tutorial-delete-btn,
.delete-topic-btn,
.file-delete-btn {
  background: var(--danger);
  color: #fff;
}

.delete-btn:hover,
.tutorial-delete-btn:hover,
.delete-topic-btn:hover,
.file-delete-btn:hover {
  background: var(--danger-dark);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

/* =========================
   FORMULÁRIOS
========================= */

label,
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #25384f;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d5e2;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8a99ac;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7acb97;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.form-grid,
.users-form,
.top-users-form {
  display: grid;
  gap: 12px;
  align-items: end;
}

.users-form,
.top-users-form {
  grid-template-columns: 1fr 1fr 1fr 1fr 0.9fr 1.1fr auto;
}

.top-row-form {
  display: grid;
  grid-template-columns: 1fr 1.6fr auto;
  gap: 12px;
  align-items: center;
}

.tutorial-form-vertical {
  display: grid;
  gap: 14px;
}

.inline-form,
.sector-form-row,
.setor-form-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: end;
}

.checkbox-inline,
.form-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  font-weight: 700;
  color: #31455d;
  white-space: nowrap;
}

.checkbox-inline input,
.form-check-inline input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.form-divider {
  height: 1px;
  background: #e6edf4;
  margin: 24px 0 18px;
}

/* =========================
   TABELAS
========================= */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 18px;
}

th,
td {
  padding: 14px 12px;
  border-right: 1px solid #d8e3ee;
  border-bottom: 1px solid #d8e3ee;
  text-align: left;
  vertical-align: middle;
}

th:last-child,
td:last-child {
  border-right: none;
}

th {
  background: #04275f;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

tr td {
  background: #fff;
}

tr:nth-child(even) td {
  background: #fbfdff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   HOME / DASHBOARD
========================= */

.cards-grid,
.dashboard-grid,
.home-grid,
.action-grid,
.feature-grid,
.permissions-grid,
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.info-card,
.dashboard-card,
.feature-card,
.profile-card,
.action-card,
.permission-card,
.role-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.info-card h3,
.dashboard-card h3,
.feature-card h3,
.profile-card h3,
.action-card h3,
.permission-card h3,
.role-card h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--title);
}

.info-card p,
.dashboard-card p,
.feature-card p,
.profile-card p,
.action-card p,
.permission-card p,
.role-card p {
  margin: 0;
  color: var(--text-soft);
}

.role-badge,
.card-badge,
.access-badge,
.info-badge,
.status-badge,
.badge,
.setor-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid #bfe7cc;
  font-size: 12px;
  font-weight: 700;
}

.badge-soft,
.badge-gray {
  background: #eef2f7;
  color: #516274;
  border: 1px solid #dde5ee;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.feature-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #d7e3eb;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
  border-color: #cfe3d7;
}

.feature-card h3 {
  margin: 0 0 12px;
  color: #123b63;
  font-size: 18px;
  font-weight: 800;
}

.feature-card p {
  margin: 0;
  color: #5f7390;
  line-height: 1.6;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #edf9f0;
  color: #16803c;
  border: 1px solid #ccefd7;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1200px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   SETORES VISUALIZAR
========================= */

.setores-grid,
.setores,
#setoresContainer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.setor-card,
.sector-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
  cursor: pointer;
}

.setor-card:hover,
.sector-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
}

.setor-card h3,
.sector-card h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--title);
}

.setor-card p,
.sector-card p {
  margin: 0;
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.6;
}

.setor-bloqueado {
  opacity: 0.82;
}

.setor-padrao,
.setor-financeiro,
.setor-suporte,
.setor-comercial,
.setor-ti,
.setor-backoffice {
  border-left: 4px solid #7ed6a6;
}

.setor-apps {
  border-left: 4px solid #63d8cd;
}

/* =========================
   GERENCIAR SETORES
========================= */

.rules-box,
.info-box,
.warning-box,
.admin-note {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fbfd;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 18px;
}

.sectors-list,
#sectorsList,
#setoresList,
#sectorList,
.sector-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.sector-item,
.setor-item,
.sector-row,
.setor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.sector-info,
.setor-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sector-info h3,
.setor-info h3,
.sector-item h3,
.setor-item h3 {
  margin: 0;
  color: var(--title);
  font-size: 18px;
}

.sector-meta,
.setor-meta,
.inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* topo da área de setores */
.sectors-header,
.setores-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sectors-header h2,
.setores-header h2 {
  margin: 0;
  flex: 1;
}

/* =========================
   TOPICS / TUTORIAIS
========================= */

.topic-section,
.tutorial-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  padding: 20px;
  margin-bottom: 18px;
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e6edf4;
}

.topic-header h2 {
  margin: 0 0 6px 0;
  color: var(--title);
  font-size: 22px;
}

.topic-header p {
  margin: 0;
  color: var(--text-soft);
}

.topic-actions,
.tutorial-admin-actions,
.view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.view-actions,
.btn-salvar-tutorial {
  margin-top: 20px;
}

.topic-grid,
.tutorial-links-grid {
  display: grid;
  gap: 12px;
}

.topic-link-card,
.tutorial-link-box {
  background: #f8fcf9;
  border: 1px solid #d7efe0;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
}

.tutorial-link-title {
  margin: 0 0 6px 0;
  color: var(--title);
  font-size: 18px;
}

.tutorial-link-desc {
  color: var(--text-soft);
}

.tutorial-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tutorial-list-header h3,
.tutorial-card h3 {
  margin: 0;
  color: var(--title);
}

.tutorial-content {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #000000;
}

#tutorialContent * {
  color: inherit;
}

#tutorialContent {
  color: #000;
}

.tutorial-meta-box {
  margin: 16px 0 20px 0;
  padding: 16px;
  border: 1px solid #d7efe0;
  background: #f8fcf9;
  border-radius: 14px;
}

.tutorial-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.tutorial-meta-grid strong {
  color: var(--title);
}

/* =========================
   ANEXOS
========================= */

.attachments-box,
.anexos {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.attachments-title,
.anexos h3 {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: #587089;
}

.file-list,
#anexosList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid #e5edf4;
  flex-wrap: wrap;
}

.file-item:first-child {
  border-top: none;
  padding-top: 0;
}

.file-link {
  color: #0d537f;
  text-decoration: none;
  font-weight: 700;
}

.file-link:hover {
  text-decoration: underline;
}


/* =========================
   MULTI SELECT
========================= */

.multi-select {
  position: relative;
  width: 100%;
  z-index: 20;
}

.multi-select-trigger {
  background: #ffffff !important;
  border: 1px solid #c8d5e2 !important;
  color: #34485e !important;
  box-shadow: none !important;
}

.multi-select-trigger span {
  color: #34485e !important;
}

.multi-select-placeholder {
  color: rgba(255, 255, 255, 0.88);
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #c8d5e2;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  padding: 10px;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  z-index: 999999 !important;
}

.multi-select.open .multi-select-menu {
  display: block;
}

.multi-select-option {
  background: #ffffff;
  color: #34485e;
}

.multi-select-option:hover {
  background: #f3f8fc;
}

.multi-select-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #e0e0e0;
}

.users-form,
.top-users-form,
.page-card,
.admin-box,
.section-box,
.content-box,
.block-box,
.panel-box,
.table-wrapper {
  overflow: visible !important;
}

/* card do formulário precisa ficar acima da tabela */
.page-card:has(.multi-select),
.admin-box:has(.multi-select),
.section-box:has(.multi-select) {
  position: relative;
  z-index: 50;
}

/* tabela fica abaixo quando o dropdown abrir */
.table-wrapper,
table,
th,
td {
  position: relative;
  z-index: 1;
}

/* dropdown sempre por cima */
.multi-select {
  position: relative;
  z-index: 200;
}

.multi-select.open {
  z-index: 99999;
}

.multi-select-menu {
  z-index: 999999 !important;
}

/* =========================
   SWEET ALERT
========================= */

.swal-form-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.swal-form-grid-1 {
  grid-template-columns: 1fr;
}

.swal-form-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.swal-form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.swal2-popup {
  border-radius: 22px;
}

.swal2-popup .swal2-input,
.swal2-popup .swal2-textarea,
.swal2-popup select.swal2-input {
  width: calc(100% - 4em);
  max-width: calc(100% - 4em);
  margin: 1em auto;
  box-sizing: border-box;
}

/* =========================
   LOGIN
========================= */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.10), transparent 30%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.10), transparent 30%),
    linear-gradient(180deg, #02142f 0%, #03204e 100%);
}

.login-card {
  width: 100%;
  max-width: 470px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(216, 225, 239, 0.9);
  border-radius: 26px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(2, 12, 32, 0.25);
}

.login-title {
  margin: 0 0 12px 0;
  font-size: 36px;
  color: var(--green);
  font-weight: 700;
}

.login-description {
  margin: 0 0 22px 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-label {
  display: block;
  font-weight: 700;
  color: var(--title);
  margin-bottom: 8px;
}

/* =========================================
   AJUSTE REAL DE ESPAÇAMENTO - TUTORIAIS
========================================= */

/* card de gerenciar tutoriais */
#tutorialFormCard,
.page-card:has(#topicSelect),
.page-card:has(#tutorialEditor) {
  padding: 26px 28px !important;
}

/* título da seção */
#tutorialFormCard h2,
.page-card:has(#topicSelect) h2,
.page-card:has(#tutorialEditor) h2 {
  margin-bottom: 18px !important;
}

/* cada bloco do formulário */
#tutorialFormCard .form-group,
.page-card:has(#topicSelect) .form-group,
.page-card:has(#tutorialEditor) .form-group {
  margin-bottom: 18px !important;
}

/* labels */
#tutorialFormCard .form-group label,
.page-card:has(#topicSelect) .form-group label,
.page-card:has(#tutorialEditor) .form-group label {
  display: block;
  margin-bottom: 8px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

/* campos */
#tutorialFormCard input,
#tutorialFormCard select,
#tutorialFormCard textarea,
.page-card:has(#topicSelect) input,
.page-card:has(#topicSelect) select,
.page-card:has(#topicSelect) textarea,
.page-card:has(#tutorialEditor) input,
.page-card:has(#tutorialEditor) select,
.page-card:has(#tutorialEditor) textarea {
  margin: 0 !important;
}

/* bloco do editor */
#tutorialFormCard .editor-group,
.page-card:has(#tutorialEditor) .editor-group {
  margin-top: 8px !important;
  margin-bottom: 20px !important;
}

/* botão salvar */
#tutorialFormCard .form-actions-row,
.page-card:has(#tutorialEditor) .form-actions-row {
  margin-top: 18px !important;
}



/* ========================================
   AJUSTE FINO - LOGIN MAIS BONITO
======================================== */

/* ===== LOGIN AJUSTADO ===== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.08), transparent 24%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.08), transparent 24%),
    linear-gradient(135deg, #02142f 0%, #032553 50%, #05396c 100%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(215, 227, 235, 0.95);
  border-radius: 30px;
  padding: 30px 28px 26px;
  box-shadow:
    0 28px 70px rgba(2, 12, 32, 0.28),
    0 10px 24px rgba(15, 23, 42, 0.10);
  position: relative;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 26px;
  right: 26px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #14b8a6);
}

.login-brand-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.login-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  margin: 0;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #123b63;
  line-height: 1.1;
}

.login-brand-subtitle {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  line-height: 1.2;
}

.login-divider {
  width: 100%;
  height: 1px;
  margin: 18px 0 20px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(34, 197, 94, 0.28),
    transparent
  );
}

.login-title {
  margin: 0 0 18px;
  text-align: left;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  color: #22c55e;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-label {
  font-size: 14px;
  font-weight: 700;
  color: #163a5d;
  margin-bottom: 8px;
}

.login-form input {
  width: 100%;
  height: 50px;
  border: 1px solid #c8d5e2;
  border-radius: 14px;
  background: #fdfefe;
  padding: 0 16px;
  font-size: 15px;
}

.login-form button,
.login-btn {
  width: 100%;
  height: 50px;
  margin-top: 4px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #169a46);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

/* ========================================
   AJUSTE FINO - HOME MAIS BONITA
======================================== */

.home-grid,
.cards-grid,
.dashboard-grid,
.action-grid,
.permissions-grid,
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.info-card,
.dashboard-card,
.feature-card,
.action-card,
.permission-card,
.role-card,
.profile-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #d7e3eb;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
}

.info-card:hover,
.dashboard-card:hover,
.feature-card:hover,
.action-card:hover,
.permission-card:hover,
.role-card:hover,
.profile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
  border-color: #cfe3d7;
}

.info-card h3,
.dashboard-card h3,
.feature-card h3,
.action-card h3,
.permission-card h3,
.role-card h3,
.profile-card h3 {
  margin: 0 0 12px;
  color: #123b63;
  font-size: 18px;
  font-weight: 800;
}

.info-card p,
.dashboard-card p,
.feature-card p,
.action-card p,
.permission-card p,
.role-card p,
.profile-card p {
  margin: 0;
  color: #5f7390;
  line-height: 1.6;
}

.role-badge,
.card-badge,
.access-badge,
.info-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #edf9f0;
  color: #16803c;
  border: 1px solid #ccefd7;
  font-size: 12px;
  font-weight: 800;
}

/* faz a home realmente virar cards mesmo quando o HTML estiver simples */
.page-card .cards-grid,
.page-card .home-grid,
.page-card .dashboard-grid,
.page-card .action-grid,
.page-card .permissions-grid,
.page-card .roles-grid {
  margin-top: 18px;
}

/* ========================================
   TAG "PERSONALIZÁVEL" E BADGES DE SETOR
======================================== */

.sector-meta,
.setor-meta,
.inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge,
.setor-badge,
.badge-soft,
.badge-gray,
.sector-tag,
.setor-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.badge,
.setor-badge {
  background: #dcfce7;
  color: #16803c;
  border: 1px solid #b7ebc7;
}

.badge-soft,
.badge-gray,
.sector-tag,
.setor-tag {
  background: #eef2f7;
  color: #516274;
  border: 1px solid #dde5ee;
}

/* garante respiro entre nome do setor e tags */
.sector-info h3,
.setor-info h3 {
  margin: 0 0 8px;
}


/* =========================
   UTIL
========================= */

.hidden {
  display: none;
}

.text-muted {
  color: var(--text-soft);
}

.text-center {
  text-align: center;
}

/* ===== AJUSTE DE ESPAÇAMENTO - topic.html ===== */

.topic-page-header,
.topic-header-box {
  margin-bottom: 22px;
}

.topic-page-header h1,
.topic-header-box h1 {
  margin-bottom: 14px;
}

.topic-page-header p,
.topic-header-box p {
  margin-top: 0;
  margin-bottom: 0;
}

/* caixa principal do tópico */
.topic-section,
.tutorial-card,
.topic-card {
  padding: 26px 24px;
  margin-bottom: 22px;
  border-radius: 20px;
}

/* título do tutorial dentro do tópico */
.topic-section h2,
.topic-section h3,
.tutorial-card h2,
.tutorial-card h3,
.topic-card h2,
.topic-card h3 {
  margin: 0 0 18px 0;
  font-size: 20px;
  color: #123b63;
}

/* ações do card */
.topic-actions,
.tutorial-admin-actions,
.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5edf4;
}

/* botões com mais respiro */
.topic-actions button,
.tutorial-admin-actions button,
.view-actions button,
.topic-actions .action-btn,
.tutorial-admin-actions .action-btn,
.view-actions .action-btn {
  min-width: 140px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
}

/* espaço abaixo do botão voltar */
.back-btn {
  margin-bottom: 18px;
}

/* conteúdo da página com mais respiro */
.content {
  padding-top: 26px;
}

/* se houver lista de tutoriais/cards */
.topic-grid,
.tutorial-links-grid,
.topic-list {
  display: grid;
  gap: 18px;
}

/* descrição mais leve */
.topic-muted,
.topic-description,
.tutorial-description {
  color: #5f7390;
  line-height: 1.6;
  margin-top: 6px;
}

/* remove linha duplicada dentro dos cards de setor/tópico */
.topic-section hr,
.topic-card hr,
.tutorial-card hr,
.sector-card hr,
.setor-card hr {
  display: none;
}

/* mantém só uma separação antes das ações */
.topic-actions,
.tutorial-admin-actions,
.view-actions {
  border-top: 1px solid #e5edf4;
  margin-top: 14px;
  padding-top: 14px;
}

/* evita linha extra criada por containers internos */
.topic-section .form-divider,
.topic-card .form-divider,
.tutorial-card .form-divider,
.sector-card .form-divider,
.setor-card .form-divider {
  display: none;
}

/* se houver parágrafo com borda embaixo, remove */
.topic-section p,
.topic-card p,
.tutorial-card p {
  border-bottom: none;
}

/* =========================================
   CORREÇÃO DOS BOTÕES DE EXCLUIR
========================================= */

/* garante vermelho em todos os botões de exclusão */
.delete-btn,
.tutorial-delete-btn,
.delete-topic-btn,
.file-delete-btn,
button.delete-btn,
button.tutorial-delete-btn,
button.delete-topic-btn,
button.file-delete-btn,
.actions .delete-btn,
.actions .tutorial-delete-btn,
.actions .delete-topic-btn,
.actions .file-delete-btn {
  background: #f24843 !important;
  color: #ffffff !important;
  border: none !important;
}

.delete-btn:hover,
.tutorial-delete-btn:hover,
.delete-topic-btn:hover,
.file-delete-btn:hover,
button.delete-btn:hover,
button.tutorial-delete-btn:hover,
button.delete-topic-btn:hover,
button.file-delete-btn:hover,
.actions .delete-btn:hover,
.actions .tutorial-delete-btn:hover,
.actions .delete-topic-btn:hover,
.actions .file-delete-btn:hover {
  background: #d93732 !important;
  color: #ffffff !important;
}

/* mantém editar cinza */
.edit-btn,
button.edit-btn,
.actions .edit-btn {
  background: #e8eef4 !important;
  color: #123b63 !important;
  border: 1px solid #d5dfeb !important;
}

.edit-btn:hover,
button.edit-btn:hover,
.actions .edit-btn:hover {
  background: #dfe8f1 !important;
}

/* =========================================
   MAIS ESPAÇAMENTO EM GERENCIAR TUTORIAIS
========================================= */

.tutorial-form-grid {
  gap: 22px !important;
}

.tutorial-form-grid .form-group {
  gap: 12px !important;
}

.tutorial-form-grid .form-group label {
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 700;
  color: #163a5d;
}

.tutorial-form-grid .form-control,
.tutorial-form-grid input,
.tutorial-form-grid select,
.tutorial-form-grid textarea {
  margin-top: 0;
}

.tutorial-form-grid .editor-group {
  margin-top: 4px;
}

.tutorial-form-grid .form-actions-row {
  margin-top: 26px !important;
}

/* mais respiro entre blocos do card */
.page-card h2 {
  margin-bottom: 16px;
}

.page-card .section-title,
.page-card h2 + .tutorial-form-grid,
.page-card h2 + .form-grid,
.page-card h2 + .form-group {
  margin-top: 6px;
}

/* =========================
   DARK MODE
========================= */

body.dark {
  background: linear-gradient(135deg, #081225 0%, #0b1730 45%, #0a1a38 100%);
  color: #e5edf7;
}

/* conteúdo principal */
body.dark .content {
  background: transparent;
}

/* caixas principais */
body.dark .page-card,
body.dark .page-title,
body.dark .card,
body.dark .admin-box,
body.dark .section-box,
body.dark .content-box,
body.dark .block-box,
body.dark .panel-box,
body.dark .topic-box,
body.dark .upload-box,
body.dark .tutorial-section-box,
body.dark .welcome-hero,
body.dark .empty-state,
body.dark .info-card,
body.dark .dashboard-card,
body.dark .feature-card,
body.dark .profile-card,
body.dark .action-card,
body.dark .permission-card,
body.dark .role-card,
body.dark .topic-section,
body.dark .tutorial-card,
body.dark .topic-card,
body.dark .sector-card,
body.dark .setor-card {
  background: #1a2740 !important;
  border-color: #2d3d5c !important;
  color: #e5edf7 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

/* títulos */
body.dark h1,
body.dark h2,
body.dark h3,
body.dark .page-title-line,
body.dark .section-title,
body.dark .login-title,
body.dark .login-brand-title,
body.dark .topic-header h2,
body.dark .tutorial-link-title {
  color: #f8fbff !important;
}

/* textos */
body.dark p,
body.dark label,
body.dark li,
body.dark .text-muted,
body.dark .login-description,
body.dark .login-brand-subtitle,
body.dark .page-card p,
body.dark .card p,
body.dark .admin-box p,
body.dark .section-box p,
body.dark .content-box p,
body.dark .block-box p,
body.dark .panel-box p,
body.dark .topic-box p,
body.dark .upload-box p,
body.dark .tutorial-section-box p,
body.dark .welcome-hero p,
body.dark .empty-state p,
body.dark .info-card p,
body.dark .dashboard-card p,
body.dark .feature-card p,
body.dark .profile-card p,
body.dark .action-card p,
body.dark .permission-card p,
body.dark .role-card p,
body.dark .topic-description,
body.dark .tutorial-description,
body.dark .tutorial-link-desc {
  color: #c7d4e6 !important;
}

/* badges */
body.dark .role-badge,
body.dark .card-badge,
body.dark .access-badge,
body.dark .info-badge,
body.dark .status-badge,
body.dark .badge,
body.dark .setor-badge {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #86efac !important;
  border-color: rgba(134, 239, 172, 0.25) !important;
}

/* inputs */
body.dark input,
body.dark select,
body.dark textarea {
  background: #0f1b31 !important;
  border-color: #30415f !important;
  color: #eef4fb !important;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: #8fa3be !important;
}

body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus {
  border-color: #4d86ff !important;
  box-shadow: 0 0 0 4px rgba(77, 134, 255, 0.14) !important;
}

/* tabela */
body.dark table {
  background: #16243b !important;
}

body.dark th {
  background: #0d1a31 !important;
  color: #f8fbff !important;
  border-color: #2d3d5c !important;
}

body.dark td {
  background: #16243b !important;
  color: #e5edf7 !important;
  border-color: #2d3d5c !important;
}

body.dark tr:nth-child(even) td {
  background: #1b2a44 !important;
}

/* multiselect */
body.dark .multi-select-trigger {
  background: #0f1b31 !important;
  border-color: #30415f !important;
  color: #eef4fb !important;
}

body.dark .multi-select-trigger span {
  color: #eef4fb !important;
}

body.dark .multi-select-menu {
  background: #16243b !important;
  border-color: #30415f !important;
}

body.dark .multi-select-option {
  background: transparent !important;
  color: #e5edf7 !important;
}

body.dark .multi-select-option:hover {
  background: #22324f !important;
}

/* sidebar toggle */
body.dark .theme-switch {
  color: #ffffff !important;
}

body.login-page.dark,
body.login-page.dark .login-page,
body.login-page.dark .login-card {
  background: unset !important;
  color: unset !important;
}

/* Editor no modo escuro */
body.dark .ql-toolbar {
  background: #16243b;
  border-color: #30415f;
}

body.dark .ql-container {
  background: #1a2740;
  border-color: #30415f;
}

body.dark .ql-editor {
  color: #e5edf7 !important;
}

body.dark .ql-editor p,
body.dark .ql-editor li {
  color: inherit !important;
}

/* MUITO IMPORTANTE: não sobrescrever a cor aplicada pelo editor */
body.dark .ql-editor span[style],
body.dark .ql-editor *[style*="color"] {
  color: inherit;
}

body.dark .ql-snow .ql-stroke {
  stroke: #dbe7f5;
}

body.dark .ql-snow .ql-fill {
  fill: #dbe7f5;
}

body.dark .ql-snow .ql-picker,
body.dark .ql-snow .ql-picker-label,
body.dark .ql-snow .ql-picker-item {
  color: #dbe7f5;
}

body.dark .ql-editor,
body.dark .ql-editor * {
  color: unset;
}

body.dark .ql-editor {
  color: #e5edf7;
}

/* =========================
   BOTÃO DE TEMA - SIDEBAR
========================= */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 10px;
  padding: 10px 14px;
  width: calc(100% - 20px);
  border-radius: 10px;
  cursor: pointer;
  color: #ffffff;
  user-select: none;
  transition: background 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.theme-icon {
  width: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.theme-label {
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
}

.theme-switch {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: left 0.2s ease;
}

.theme-switch.active {
  background: #22c55e;
}

.theme-switch.active .theme-switch-thumb {
  left: 21px;
}

/* =========================
   CORREÇÕES DARK MODE (VIPWIKI)
========================= */

/* CARDS DE SETORES */
body.dark .sector-card,
body.dark .setor-card,
body.dark .sector-item,
body.dark .setor-item {
  background: #1a2740 !important;
  border: 1px solid #2d3d5c !important;
  color: #e5edf7 !important;
}

/* TÍTULO DOS SETORES */
body.dark .sector-card h3,
body.dark .setor-card h3,
body.dark .sector-item h3 {
  color: #f8fbff !important;
}

/* BADGES */
body.dark .badge,
body.dark .tag,
body.dark .status-tag {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #86efac !important;
  border: 1px solid rgba(134, 239, 172, 0.2) !important;
}

/* INPUT FILE */
body.dark input[type="file"] {
  color: #e5edf7 !important;
}

/* BOTÃO FILE (Escolher arquivos) */
body.dark input[type="file"]::file-selector-button {
  background: #22324f;
  color: #e5edf7;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
}

/* =========================
   EDITOR QUILL - DARK MODE CORRIGIDO
========================= */

/* container geral */
body.dark .ql-container {
  background: #0f1b31 !important;
  border: 1px solid #2d3d5c !important;
}

/* área onde digita (ESSA É A QUE ESTÁ BRANCA) */
body.dark .ql-editor {
  background: #0f1b31 !important;
  color: #eef4fb !important;
}

/* placeholder */
body.dark .ql-editor.ql-blank::before {
  color: #8fa3be !important;
}

/* toolbar */
body.dark .ql-toolbar {
  background: #16243b !important;
  border: 1px solid #2d3d5c !important;
}

/* botões */
body.dark .ql-toolbar button,
body.dark .ql-toolbar .ql-picker {
  color: #e5edf7 !important;
}

/* ícones */
body.dark .ql-toolbar button svg {
  filter: invert(1) brightness(1.8);
}

/* dropdown */
body.dark .ql-picker-options {
  background: #1a2740 !important;
  color: #eef4fb !important;
  border: 1px solid #2d3d5c !important;
}

/* edição de tutoriais */
body.dark #swal-editor-wrapper {
  border: 1px solid #30415f !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

body.dark #swal-editor-toolbar {
  background: #16243b !important;
}

body.dark #swal-editor .ql-container {
  background: #0f1b31 !important;
}

body.dark #swal-editor .ql-editor {
  background: #0f1b31 !important;
  color: #eef4fb !important;
}

body.dark #swal-editor .ql-editor.ql-blank::before {
  color: #8fa3be !important;
}

/* =========================
   AJUSTE GERENCIAR SETORES - DARK + FORM
========================= */

/* cards/lista de setores no dark */
body.dark .sector-row,
body.dark .setor-row,
body.dark .sector-item,
body.dark .setor-item,
body.dark .sector-list > div,
body.dark #sectorList > div,
body.dark #sectorsList > div,
body.dark #setoresList > div {
  background: #1a2740 !important;
  border: 1px solid #2d3d5c !important;
  color: #e5edf7 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18) !important;
}

body.dark .sector-row h3,
body.dark .setor-row h3,
body.dark .sector-item h3,
body.dark .setor-item h3,
body.dark .sector-info h3,
body.dark .setor-info h3 {
  color: #f8fbff !important;
}

body.dark .sector-row p,
body.dark .setor-row p,
body.dark .sector-item p,
body.dark .setor-item p,
body.dark .sector-info p,
body.dark .setor-info p {
  color: #c7d4e6 !important;
}

body.dark .sector-tag,
body.dark .setor-tag,
body.dark .badge-soft,
body.dark .badge-gray {
  background: #22324f !important;
  color: #dbe7f5 !important;
  border-color: #30415f !important;
}

/* bloco de regras no dark */
body.dark .rules-box,
body.dark .info-box,
body.dark .warning-box,
body.dark .admin-note {
  background: #16243b !important;
  border-color: #2d3d5c !important;
  color: #dbe7f5 !important;
}

/* formulário do cadastro de setor */
.sector-form-row,
.setor-form-row,
.inline-form {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 14px !important;
}

.sector-form-row input,
.setor-form-row input,
.inline-form input {
  min-width: 0;
}

.checkbox-inline,
.form-check-inline {
  white-space: nowrap;
  margin: 0;
  align-self: center;
}

/* evita o checkbox “Liberar...” sair do card */
.page-card,
.admin-box,
.section-box {
  overflow: visible !important;
}

@media (max-width: 900px) {
  .sector-form-row,
  .setor-form-row,
  .inline-form {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  .checkbox-inline,
  .form-check-inline {
    white-space: normal;
  }
}

/* =========================
   SWEETALERT NO MODO ESCURO
========================= */

body.dark .swal2-popup {
  background: #1a2740 !important;
  color: #e5edf7 !important;
  border: 1px solid #2d3d5c !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28) !important;
}

body.dark .swal2-title {
  color: #f8fbff !important;
}

body.dark .swal2-html-container,
body.dark .swal2-content {
  color: #d7e4f3 !important;
}

body.dark .swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(134, 239, 172, 0.25) !important;
}

body.dark .swal2-icon.swal2-success [class^="swal2-success-line"] {
  background-color: #86efac !important;
}

body.dark .swal2-confirm {
  background: linear-gradient(135deg, #22c55e, #16803c) !important;
  color: #ffffff !important;
  border: none !important;
}

body.dark .swal2-cancel {
  background: #334155 !important;
  color: #ffffff !important;
  border: none !important;
}

body.dark .swal2-input,
body.dark .swal2-textarea,
body.dark .swal2-select {
  background: #0f1b31 !important;
  color: #eef4fb !important;
  border: 1px solid #30415f !important;
}

body.dark .swal2-input::placeholder,
body.dark .swal2-textarea::placeholder {
  color: #8fa3be !important;
}

/* =========================
   TUTORIAL VIEW - META BOX NO DARK
========================= */

body.dark .tutorial-meta-box {
  background: #16243b !important;
  border: 1px solid #2d3d5c !important;
  color: #e5edf7 !important;
}

body.dark .tutorial-meta-grid,
body.dark .tutorial-meta-grid div,
body.dark .tutorial-meta-box span,
body.dark .tutorial-meta-box p {
  color: #d7e4f3 !important;
}

body.dark .tutorial-meta-grid strong {
  color: #f8fbff !important;
}

body.dark .attachments-title,
body.dark .anexos h3 {
  color: #dbe7f5 !important;
}

body.dark .file-link {
  color: #8ec5ff !important;
}

body.dark .file-link:hover {
  color: #b9dcff !important;
}

/* ========================= */
/* FIX EDITOR SWAL (QUILL)   */
/* ========================= */

#swal-editor-wrapper {
  border: 1px solid #30415f;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1b31;
}

/* toolbar */
#swal-editor-toolbar {
  background: #16243b;
  border-bottom: 1px solid #30415f;
  padding: 8px;
}

/* AREA DO EDITOR (ESSENCIAL) */
#swal-editor {
  height: 300px !important;
}

/* container do quill */
#swal-editor.ql-container {
  height: 300px !important;
  border: none !important;
  background: #0f1b31;
}

/* area de texto */
#swal-editor .ql-editor {
  min-height: 300px !important;
  color: #eef4fb !important;
  background: #0f1b31 !important;
  padding: 15px;
  font-size: 14px;
}

/* placeholder */
#swal-editor .ql-editor.ql-blank::before {
  color: #8fa3be;
}

.tutorial-content a,
#tutorialContent a {
  color: #60a5fa !important;
  font-weight: 700;
  text-decoration: underline;
}

.tutorial-content a:hover,
#tutorialContent a:hover {
  color: #93c5fd !important;
}

/* MODAL EDITOR - MODO CLARO */
#swal-editor-wrapper {
  border: 1px solid #d4e0ea !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

#swal-editor-toolbar {
  background: #f8fbfd !important;
  border-bottom: 1px solid #dbe5ee !important;
  padding: 10px 12px !important;
}

#swal-editor-toolbar button,
#swal-editor-toolbar .ql-picker-label {
  background: transparent !important;
  color: #42576b !important;
  border: none !important;
  box-shadow: none !important;
}

#swal-editor-toolbar button:hover,
#swal-editor-toolbar .ql-picker-label:hover {
  background: #e9f0f6 !important;
}

#swal-editor-toolbar .ql-stroke {
  stroke: #42576b !important;
}

#swal-editor-toolbar .ql-fill {
  fill: #42576b !important;
}

#swal-editor.ql-container {
  height: 340px !important;
  background: #ffffff !important;
  border: none !important;
}

#swal-editor .ql-editor {
  min-height: 340px !important;
  background: #ffffff !important;
  color: #18324a !important;
  padding: 18px 20px !important;
  font-size: 15px !important;
  line-height: 1.7 !important;
}

#swal-editor .ql-editor h1,
#swal-editor .ql-editor h2,
#swal-editor .ql-editor h3 {
  color: #123b63 !important;
}

/* MODAL EDITOR - MODO ESCURO */
body.dark #swal-editor-wrapper {
  border-color: #30415f !important;
  background: #0f1b31 !important;
}

body.dark #swal-editor-toolbar {
  background: #16243b !important;
  border-bottom-color: #30415f !important;
}

body.dark #swal-editor-toolbar button,
body.dark #swal-editor-toolbar .ql-picker-label {
  color: #e5edf7 !important;
}

body.dark #swal-editor-toolbar button:hover,
body.dark #swal-editor-toolbar .ql-picker-label:hover {
  background: #22324f !important;
}

body.dark #swal-editor-toolbar .ql-stroke {
  stroke: #dbe7f5 !important;
}

body.dark #swal-editor-toolbar .ql-fill {
  fill: #dbe7f5 !important;
}

body.dark #swal-editor.ql-container {
  background: #0f1b31 !important;
}

body.dark #swal-editor .ql-editor {
  background: #0f1b31 !important;
  color: #eef4fb !important;
}

body.dark #swal-editor .ql-editor h1,
body.dark #swal-editor .ql-editor h2,
body.dark #swal-editor .ql-editor h3 {
  color: #f8fbff !important;
}

#tutorialContent a,
.ql-editor a {
  color: #0d6efd !important;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

#tutorialContent a:hover,
.ql-editor a:hover {
  color: #084298 !important;
}

body.dark #tutorialContent a,
body.dark .ql-editor a {
  color: #7dd3fc !important;
}

body.dark #tutorialContent a:hover,
body.dark .ql-editor a:hover {
  color: #bae6fd !important;
}

/* Corrige ícones do Quill */
.ql-toolbar button {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  transform: none !important;
}

.ql-toolbar button svg {
  width: 18px !important;
  height: 18px !important;
}

.ql-toolbar .ql-picker {
  height: 32px !important;
  font-size: 14px !important;
}

.ql-toolbar .ql-picker-label {
  height: 32px !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
}

/* Modo claro */
.ql-toolbar .ql-stroke {
  stroke: #42576b !important;
}

.ql-toolbar .ql-fill {
  fill: #42576b !important;
}

.ql-toolbar button:hover,
.ql-toolbar .ql-picker-label:hover {
  background: #e9f0f6 !important;
}

/* Modo escuro */
body.dark .ql-toolbar .ql-stroke {
  stroke: #e5edf7 !important;
}

body.dark .ql-toolbar .ql-fill {
  fill: #e5edf7 !important;
}

body.dark .ql-toolbar button:hover,
body.dark .ql-toolbar .ql-picker-label:hover {
  background: #22324f !important;
}

/* FIX FINAL - ícones Quill visíveis no modo escuro */
body.dark .ql-toolbar button,
body.dark #swal-editor-toolbar button {
  color: #ffffff !important;
  opacity: 1 !important;
}

body.dark .ql-toolbar button svg,
body.dark #swal-editor-toolbar button svg {
  filter: none !important;
  opacity: 1 !important;
}

body.dark .ql-toolbar .ql-stroke,
body.dark #swal-editor-toolbar .ql-stroke {
  stroke: #ffffff !important;
  opacity: 1 !important;
}

body.dark .ql-toolbar .ql-fill,
body.dark #swal-editor-toolbar .ql-fill {
  fill: #ffffff !important;
  opacity: 1 !important;
}

body.dark .ql-toolbar .ql-picker,
body.dark .ql-toolbar .ql-picker-label,
body.dark #swal-editor-toolbar .ql-picker,
body.dark #swal-editor-toolbar .ql-picker-label {
  color: #ffffff !important;
  opacity: 1 !important;
}

body.dark .ql-toolbar button:hover,
body.dark #swal-editor-toolbar button:hover,
body.dark .ql-toolbar .ql-picker-label:hover,
body.dark #swal-editor-toolbar .ql-picker-label:hover {
  background: #2a3d5f !important;
}

/* Linha acima de "Arquivos anexados" */
.attachments-title {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 20px;
  padding-top: 15px;
}

/* modo claro */
.attachments-title {
  border-top: 1px solid rgba(0,0,0,0.1);
}

/* modo escuro */
body.dark .attachments-title {
  border-top: 1px solid rgba(255,255,255,0.15);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.note-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid rgba(15, 97, 141, 0.15);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.note-card-header h3 {
  margin: 0;
  font-size: 18px;
}

.note-card-header span {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 97, 141, 0.12);
}

.note-text {
  white-space: pre-wrap;
  margin: 10px 0;
}

.note-info p {
  margin: 6px 0;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.note-actions button,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.primary-btn {
  background: #0f618d;
  color: #fff;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

.note-actions button {
  background: #0f618d;
  color: #fff;
}

.danger-btn {
  background: #dc2626 !important;
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.small-modal {
  max-width: 420px;
}

.modal-card h2 {
  margin-top: 0;
}

.modal-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
}

.modal-card textarea {
  min-height: 120px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.revealed-password-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f3f4f6;
}

.password-result {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
  word-break: break-all;
}

.empty-state {
  padding: 24px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
}.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.note-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid rgba(15, 97, 141, 0.15);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.note-card-header h3 {
  margin: 0;
  font-size: 18px;
}

.note-card-header span {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 97, 141, 0.12);
}

.note-text {
  white-space: pre-wrap;
  margin: 10px 0;
}

.note-info p {
  margin: 6px 0;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.note-actions button,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.primary-btn {
  background: #0f618d;
  color: #fff;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

.note-actions button {
  background: #0f618d;
  color: #fff;
}

.danger-btn {
  background: #dc2626 !important;
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.small-modal {
  max-width: 420px;
}

.modal-card h2 {
  margin-top: 0;
}

.modal-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
}

.modal-card textarea {
  min-height: 120px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.revealed-password-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f3f4f6;
}

.password-result {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
  word-break: break-all;
}

.empty-state {
  padding: 24px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
}

.section-title {
  margin: 28px 0 14px;
  font-size: 22px;
  color: #ffffff;
  border-bottom: 2px solid #19c37d;
  padding-bottom: 8px;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.password-result {
  flex: 1;
  background: #e5e7eb;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  word-break: break-all;
}

.copy-password-btn {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.copied-msg {
  margin-top: 8px;
  color: #16a34a;
  font-weight: 700;
  font-size: 13px;
}

.danger-btn {
  background: #dc2626 !important;
  color: #fff !important;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.secondary-green-btn {
  background: #15803d;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.small-modal p {
  font-size: 15px;
  color: #334155;
  margin: 12px 0 20px;
}

.modal-actions .danger-btn {
  background: #dc2626 !important;
  color: #fff !important;
}

.modal-actions .secondary-btn {
  background: #e5e7eb !important;
  color: #111827 !important;
}

/* ===== DARK MODE MODAL ===== */
body.dark-mode .modal-card,
body.dark .modal-card {
  background: #1e293b !important;
  color: #f8fafc !important;
}

body.dark-mode .modal-card h2,
body.dark .modal-card h2,
body.dark-mode .modal-card label,
body.dark .modal-card label,
body.dark-mode .modal-card p,
body.dark .modal-card p {
  color: #f8fafc !important;
}

body.dark-mode .modal-card input,
body.dark .modal-card input,
body.dark-mode .modal-card textarea,
body.dark .modal-card textarea {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
}

body.dark-mode .modal-card input::placeholder,
body.dark .modal-card input::placeholder,
body.dark-mode .modal-card textarea::placeholder,
body.dark .modal-card textarea::placeholder {
  color: #94a3b8 !important;
}

.content {
  margin-left: 250px !important;
  width: calc(100% - 250px) !important;
  min-height: 100vh;
  overflow-y: auto;
}

.page-shell {
  width: 100%;
  max-width: none !important;
  padding: 28px !important;
}

body.dark-mode .note-card,
body.dark .note-card {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

body.dark-mode .note-card h3,
body.dark .note-card h3 {
  color: #f8fafc !important;
}

body.dark-mode .note-card span,
body.dark .note-card span {
  background: #1e293b !important;
  color: #f8fafc !important;
}

body.dark-mode .empty-state,
body.dark .empty-state {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

body.dark-mode .empty-state h3,
body.dark .empty-state h3,
body.dark-mode .empty-state p,
body.dark .empty-state p {
  color: #f8fafc !important;
}

body.dark-mode .revealed-password-box,
body.dark .revealed-password-box {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

body.dark-mode .revealed-password-box strong,
body.dark .revealed-password-box strong {
  color: #f8fafc !important;
}

body.dark-mode .password-result,
body.dark .password-result {
  background: #1e293b !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
}

body.dark-mode .copy-password-btn,
body.dark .copy-password-btn {
  background: #16a34a !important;
  color: #ffffff !important;
}

.view-note-box {
  background: rgba(15, 97, 141, 0.08);
  border: 1px solid rgba(15, 97, 141, 0.18);
  border-radius: 16px;
  padding: 18px;
  margin-top: 12px;
}

.view-note-box h3 {
  margin: 0 0 12px;
  font-size: 22px;
  color: #0f172a;
}

.view-note-box p {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #334155;
}

body.dark-mode .view-note-box,
body.dark .view-note-box {
  background: #0f172a !important;
  border-color: #334155 !important;
}

body.dark-mode .view-note-box h3,
body.dark .view-note-box h3,
body.dark-mode .view-note-box p,
body.dark .view-note-box p {
  color: #f8fafc !important;
}

/* =====================================================
   RESPONSIVIDADE FINAL - VIPWIKI
   Colar no FINAL do layout.css
===================================================== */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.content {
  min-width: 0;
}

.page-shell,
.page-card,
.card,
.admin-box,
.section-box,
.content-box,
.block-box,
.panel-box {
  max-width: 100%;
}

/* telas médias */
@media (max-width: 1100px) {
  .content {
    margin-left: 220px !important;
    width: calc(100% - 220px) !important;
    padding: 18px !important;
  }

  .sidebar {
    width: 220px !important;
    min-width: 220px !important;
  }

  .notes-grid,
  .cards-grid,
  .dashboard-grid,
  .home-grid,
  .action-grid,
  .feature-grid,
  .permissions-grid,
  .roles-grid,
  .setores-grid,
  .setores,
  #setoresContainer {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .users-form,
  .top-users-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* tablet / celular grande */
@media (max-width: 820px) {
  body {
    display: block !important;
  }

  .sidebar {
    position: relative !important;
    width: 100% !important;
    min-width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    padding: 14px 0 !important;
  }

  .content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 16px !important;
  }

  .page-shell {
    padding: 0 !important;
  }

  .page-card,
  .card,
  .admin-box,
  .section-box,
  .content-box,
  .block-box,
  .panel-box,
  .topic-box,
  .upload-box,
  .tutorial-section-box,
  .welcome-hero {
    padding: 18px !important;
    border-radius: 18px !important;
  }

  .notes-grid,
  .cards-grid,
  .dashboard-grid,
  .home-grid,
  .action-grid,
  .feature-grid,
  .permissions-grid,
  .roles-grid,
  .setores-grid,
  .setores,
  #setoresContainer {
    grid-template-columns: 1fr !important;
  }

  .users-form,
  .top-users-form,
  .top-row-form,
  .inline-form,
  .sector-form-row,
  .setor-form-row,
  .tutorial-meta-grid,
  .swal-form-grid-2,
  .swal-form-grid-3 {
    grid-template-columns: 1fr !important;
  }

  .sector-item,
  .setor-item,
  .sector-row,
  .setor-row,
  .topic-header,
  .tutorial-list-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .table-wrapper {
    overflow-x: auto !important;
  }

  table {
    min-width: 760px;
  }
}

/* celular */
@media (max-width: 560px) {
  .brand-box {
    padding: 0 14px 12px !important;
  }

  .sidebar a,
  .sidebar .nav-item,
  .sidebar .menu-link,
  #adminMenu a {
    margin: 4px 8px !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    padding: 11px 12px !important;
    font-size: 14px !important;
  }

  .content {
    padding: 12px !important;
  }

  .page-card h1,
  .page-title h1,
  .card h1,
  .admin-box h1,
  .welcome-hero h1 {
    font-size: 24px !important;
  }

  .page-card h2,
  .page-title h2,
  .card h2,
  .admin-box h2,
  .section-box h2,
  .content-box h2,
  .block-box h2,
  .panel-box h2,
  .topic-box h2,
  .upload-box h2,
  .tutorial-section-box h2,
  .section-title {
    font-size: 20px !important;
  }

  .top-actions,
  .modal-actions,
  .note-actions,
  .clean-actions,
  .actions,
  .topic-actions,
  .tutorial-admin-actions,
  .view-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .top-actions button,
  .modal-actions button,
  .note-actions button,
  .clean-actions button,
  .actions button,
  .topic-actions button,
  .tutorial-admin-actions button,
  .view-actions button,
  .primary-btn,
  .secondary-btn,
  .secondary-green-btn,
  .danger-btn,
  .copy-password-btn {
    width: 100% !important;
  }

  .icon-btn {
    width: 100% !important;
    height: 42px !important;
  }

  .note-card {
    max-width: 100% !important;
  }

  .note-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .modal-overlay {
    align-items: flex-start !important;
    padding: 12px !important;
    overflow-y: auto !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 20px 0 !important;
    padding: 18px !important;
    border-radius: 18px !important;
  }

  .password-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .password-result {
    width: 100% !important;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}