:root {
  --gi-sidebar-width: 250px;
  --gi-primary: #7c3aed;        /* roxo: acento de marca (sidebar, foco) */
  --gi-primary-dark: #6d28d9;
  --gi-primary-darker: #5b21b6;
  --gi-accent: #a78bfa;
  --gi-wine: #7c2d12;
  --gi-dark: #2e1065;
  --gi-muted: #64748b;
  /* ações */
  --gi-action: #2563eb;         /* azul: ações primárias (Salvar/Editar) */
  --gi-action-dark: #1d4ed8;
  --gi-action-darker: #1e40af;
  --gi-create: #16a34a;         /* verde: inclusão (Novo) */
  --gi-create-dark: #15803d;
  --gi-create-darker: #166534;
  /* recolore links/utilitários do Bootstrap */
  --bs-link-color-rgb: 109, 40, 217;
  --bs-link-hover-color-rgb: 91, 33, 182;
}

body {
  background-color: #f1f5f9;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Sidebar ---------- */
.gi-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--gi-sidebar-width);
  background: linear-gradient(180deg, #2e1065 0%, #4c1d95 60%, #7c2d12 100%);
  color: #ddd6fe;
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
}

.gi-sidebar .gi-brand {
  padding: 1.25rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.gi-sidebar .gi-brand i { color: var(--gi-accent); }

.gi-nav {
  list-style: none;
  padding: .75rem 0;
  margin: 0;
  flex: 1;
}

.gi-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  font-size: .95rem;
  transition: background .15s, color .15s;
}

.gi-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.gi-nav a.active {
  background: rgba(167, 139, 250, .20);
  color: #fff;
  border-left: 3px solid var(--gi-accent);
  padding-left: calc(1.25rem - 3px);
}

.gi-nav i { width: 20px; text-align: center; }

.gi-nav-section {
  padding: 1rem 1.25rem .35rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #64748b;
}

/* Campos de detalhe (modais de consulta): rótulo em cima, valor embaixo */
.gi-field { margin-bottom: .7rem; }
.gi-field-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  margin-bottom: .1rem;
}
.gi-field > span:last-child { display: block; }

.gi-sidebar .gi-foot {
  padding: 1rem 1.25rem;
  font-size: .75rem;
  color: #64748b;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ---------- Barra superior (topo direito) ---------- */
.gi-header {
  position: fixed;
  top: 0;
  left: var(--gi-sidebar-width);
  right: 0;
  height: 58px;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: 0 1.75rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}
.gi-header-theme {
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: .5rem;
  color: #475569;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.gi-header-theme:hover { background: #e2e8f0; }
.gi-header-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: none;
  padding: .3rem .5rem;
  border-radius: .5rem;
  color: inherit;
  transition: background .15s;
}
.gi-header-user:hover { background: #f1f5f9; }
.gi-header-user > .bi-person-circle { font-size: 1.7rem; color: #475569; }
.gi-header-user-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.gi-header-user-text strong { font-size: .88rem; }
.gi-header-user-text small { color: var(--gi-muted); font-size: .73rem; }
.gi-header-caret { font-size: .7rem; color: var(--gi-muted); }

/* ---------- Main ---------- */
.gi-main {
  margin-left: var(--gi-sidebar-width);
  padding: calc(58px + 1.5rem) 2rem 1.5rem;
  min-height: 100vh;
}

.gi-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.gi-topbar h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--gi-dark);
}

/* ---------- Cards de indicadores ---------- */
.gi-stat-card {
  border: none;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.gi-stat-card .gi-icon {
  width: 52px;
  height: 52px;
  border-radius: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.gi-stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.gi-stat-label { color: var(--gi-muted); font-size: .85rem; }

.bg-soft-primary { background: #ede9fe; color: #7c3aed; }
.bg-soft-success { background: #dcfce7; color: #16a34a; }
.bg-soft-warning { background: #fef3c7; color: #d97706; }
.bg-soft-info    { background: #e0e7ff; color: #4f46e5; }

/* ---------- Tabela / miniaturas ---------- */
.gi-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: .4rem;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
}

.gi-thumb-lg {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: .5rem;
  border: 1px solid #e2e8f0;
  background: #e2e8f0;
}

.card {
  border: none;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

/* ---------- Tags ---------- */
.gi-tag {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-size: .75rem;
  padding: .15rem .55rem;
  border-radius: 1rem;
  margin: .1rem .15rem .1rem 0;
}

/* tag input */
.gi-tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .4rem .5rem;
  border: 1px solid #ced4da;
  border-radius: .375rem;
  background: #fff;
  min-height: 42px;
}
.gi-tag-input-wrap:focus-within { border-color: var(--gi-accent); box-shadow: 0 0 0 .25rem rgba(124,58,237,.25); }
.gi-tag-input-wrap input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 120px;
  font-size: .95rem;
}
.gi-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #e0e7ff;
  color: #4338ca;
  font-size: .8rem;
  padding: .2rem .55rem;
  border-radius: 1rem;
}
.gi-tag-pill .btn-close { font-size: .55rem; }

/* ---------- Upload / dropzone ---------- */
.gi-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: .75rem;
  padding: 2rem;
  text-align: center;
  color: var(--gi-muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.gi-dropzone:hover, .gi-dropzone.dragover {
  border-color: var(--gi-primary);
  background: #f5f3ff;
}
.gi-dropzone i { font-size: 2.5rem; color: #94a3b8; }

.gi-preview-box {
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  padding: 1rem;
  text-align: center;
  background: #fff;
}
.gi-preview-box img {
  max-width: 100%;
  max-height: 320px;
  border-radius: .5rem;
}

.gi-meta-list dt { color: var(--gi-muted); font-weight: 500; font-size: .8rem; }
.gi-meta-list dd { font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }

@media (max-width: 768px) {
  .gi-sidebar { width: 70px; }
  .gi-sidebar .gi-brand span, .gi-nav a span, .gi-nav-section, .gi-sidebar .gi-foot { display: none; }
  .gi-header { left: 70px; padding: 0 1rem; }
  .gi-header-user-text { display: none; }
  .gi-main { margin-left: 70px; padding: calc(58px + 1rem) 1rem 1rem; }
}

/* ---------- Tema (overrides Bootstrap → paleta do login) ---------- */
/* Botão primário = AZUL (ações: Salvar, Editar, Entrar) */
.btn-primary {
  --bs-btn-bg: var(--gi-action);
  --bs-btn-border-color: var(--gi-action);
  --bs-btn-hover-bg: var(--gi-action-dark);
  --bs-btn-hover-border-color: var(--gi-action-dark);
  --bs-btn-active-bg: var(--gi-action-darker);
  --bs-btn-active-border-color: var(--gi-action-darker);
  --bs-btn-disabled-bg: var(--gi-action);
  --bs-btn-disabled-border-color: var(--gi-action);
}
.btn-outline-primary {
  --bs-btn-color: var(--gi-action);
  --bs-btn-border-color: var(--gi-action);
  --bs-btn-hover-bg: var(--gi-action);
  --bs-btn-hover-border-color: var(--gi-action);
  --bs-btn-active-bg: var(--gi-action);
  --bs-btn-active-border-color: var(--gi-action);
}
/* Botão de inclusão = VERDE (Novo) */
.btn-success {
  --bs-btn-bg: var(--gi-create);
  --bs-btn-border-color: var(--gi-create);
  --bs-btn-hover-bg: var(--gi-create-dark);
  --bs-btn-hover-border-color: var(--gi-create-dark);
  --bs-btn-active-bg: var(--gi-create-darker);
  --bs-btn-active-border-color: var(--gi-create-darker);
  --bs-btn-disabled-bg: var(--gi-create);
  --bs-btn-disabled-border-color: var(--gi-create);
}
.text-bg-primary { background-color: var(--gi-action) !important; }
.bg-primary { background-color: var(--gi-action) !important; }
.progress-bar { background-color: var(--gi-primary); }   /* barra de tags = acento roxo */

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--gi-accent);
  box-shadow: 0 0 0 .25rem rgba(124, 58, 237, .25);
}
.form-check-input:checked {
  background-color: var(--gi-primary);
  border-color: var(--gi-primary);
}

/* ---------- Modo escuro (componentes customizados) ---------- */
[data-bs-theme="dark"] {
  --gi-muted: #94a3b8;
}
[data-bs-theme="dark"] body { background-color: #15121f; }
[data-bs-theme="dark"] .gi-topbar h1 { color: #ede9fe; }
[data-bs-theme="dark"] .gi-header {
  background: #1b1729;
  border-bottom-color: rgba(255, 255, 255, .08);
}
[data-bs-theme="dark"] .gi-header-theme { background: #2a2440; border-color: #3a3357; color: #cbd5e1; }
[data-bs-theme="dark"] .gi-header-theme:hover { background: #3a3357; }
[data-bs-theme="dark"] .gi-header-user:hover { background: rgba(255, 255, 255, .06); }
[data-bs-theme="dark"] .gi-header-user > .bi-person-circle { color: #cbd5e1; }
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .gi-stat-card { box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
/* cabeçalhos/rodapés de card que usam bg-white fixo */
[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .card-footer.bg-white {
  background-color: transparent !important;
  color: var(--bs-body-color);
}
/* cabeçalho de tabela que usa table-light fixo */
[data-bs-theme="dark"] .table-light {
  --bs-table-color: var(--bs-body-color);
  --bs-table-bg: #211b33;
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-striped-color: var(--bs-body-color);
  --bs-table-hover-color: var(--bs-body-color);
  color: var(--bs-body-color);
}
/* links de título dentro de tabelas → cor do texto (claro e escuro) */
.table a { color: var(--bs-body-color); }
.table a:hover { color: var(--gi-primary); }
[data-bs-theme="dark"] .gi-preview-box {
  background: var(--bs-card-bg);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .gi-tag-input-wrap {
  background: var(--bs-body-bg);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .gi-tag-input-wrap input { color: var(--bs-body-color); background: transparent; }
[data-bs-theme="dark"] .gi-thumb,
[data-bs-theme="dark"] .gi-thumb-lg { background: #2a2440; border-color: #3a3357; }
[data-bs-theme="dark"] .gi-tag { background: #3a2f5e; color: #ddd6fe; }
[data-bs-theme="dark"] .gi-tag-pill { background: #3a2f5e; color: #ddd6fe; }
/* fundos pastel dos cards de indicadores no escuro */
[data-bs-theme="dark"] .bg-soft-primary { background: #2e2350; color: #c4b5fd; }
[data-bs-theme="dark"] .bg-soft-success { background: #14331f; color: #86efac; }
[data-bs-theme="dark"] .bg-soft-warning { background: #3a2c0e; color: #fcd34d; }
[data-bs-theme="dark"] .bg-soft-info    { background: #1e1f47; color: #a5b4fc; }
