/* ==========================================================================
   Base do app — substitui o adminlte.min.css (que embutia o Bootstrap 4).
   Cobre só as classes do Bootstrap que as páginas ainda usam (grid, modal,
   alertas, paginação, dropdown do combobox, input-group, utilitários), já
   no visual do modelo AK Gestor.html. O JS do Bootstrap continua carregado
   pra abrir modais e o dropdown do bootstrap-combobox.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; font-family: var(--f-display); font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; } h4 { font-size: 16px; } h5 { font-size: 15px; } h6 { font-size: 14px; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
b, strong { font-weight: 700; }
small { font-size: 85%; }
a { color: var(--blue); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--blue-ink); text-decoration: underline; }
img, svg, canvas { vertical-align: middle; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
table { border-collapse: collapse; }
label { display: inline-block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
[hidden] { display: none !important; }
ul, ol { margin-top: 0; }

/* Foco visível só pra teclado (sem anel em clique de mouse) */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.ctrl:focus-visible, .form-control:focus-visible { outline: none; }

/* ---------- Grid (.row / .col-*) ---------- */
.container-fluid { width: 100%; }
.row { display: flex; flex-wrap: wrap; margin-inline: -9px; }
.ak-page > .row { row-gap: 18px; }
.row > * { padding-inline: 9px; flex: 0 0 100%; max-width: 100%; min-width: 0; }
.row > .col { flex: 1 0 0%; }
@media (min-width: 576px) {
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
}
@media (min-width: 768px) {
  .col-md-2 { flex: 0 0 16.6667%; max-width: 16.6667%; } .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; } .col-md-5 { flex: 0 0 41.6667%; max-width: 41.6667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; } .col-md-8 { flex: 0 0 66.6667%; max-width: 66.6667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 992px) {
  .col-lg-2 { flex: 0 0 16.6667%; max-width: 16.6667%; } .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-4 { flex: 0 0 33.3333%; max-width: 33.3333%; } .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}
/* Cards lado a lado na mesma linha ficam com a mesma altura */
.row > [class*="col-"] > .card { height: 100%; }

/* ---------- Utilitários ---------- */
.d-flex { display: flex !important; } .d-block { display: block !important; } .d-none { display: none !important; }
.justify-content-center { justify-content: center !important; } .justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; } .align-items-center { align-items: center !important; }
.m-0 { margin: 0 !important; } .mt-2 { margin-top: 8px !important; } .mt-3 { margin-top: 16px !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 8px !important; } .mb-3 { margin-bottom: 16px !important; }
.ml-auto { margin-left: auto !important; } .py-1 { padding-block: 4px !important; } .py-2 { padding-block: 8px !important; }
.w-100 { width: 100% !important; } .float-right { float: right; }
.text-center { text-align: center !important; } .text-right { text-align: right !important; }
.text-muted { color: var(--muted) !important; } .text-danger { color: var(--red) !important; } .text-success { color: var(--green) !important; }
.text-white { color: #fff !important; } .text-dark { color: var(--ink) !important; } .font-weight-bold { font-weight: 700 !important; }
.bg-primary { background: var(--blue) !important; } .bg-success { background: var(--green) !important; }
.bg-warning { background: var(--amber) !important; } .bg-danger { background: var(--red) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px;
  padding: 9px 14px; font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none;
  background: var(--surface); color: var(--ink); user-select: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { filter: brightness(.95); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--blue); color: var(--on-accent); }
.btn-success { background: var(--green); color: var(--on-accent); }
.btn-danger { background: var(--red); color: var(--on-accent); }
.btn-warning { background: var(--amber); color: var(--on-accent); }
.btn-info { background: var(--blue-ink); color: var(--on-accent); }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn-secondary, .btn-default, .btn-light, .btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover, .btn-default:hover, .btn-light:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-outline-secondary { background: none; border-color: var(--line-2); color: var(--muted); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { display: flex; width: 100%; }
.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ---------- Formulários legados (.form-control / .form-group) ---------- */
.form-group { display: grid; gap: 6px; margin-bottom: 14px; }
.form-control, .ctrl {
  display: block; width: 100%; min-height: 40px; padding: 9px 11px; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.form-control:focus, .ctrl:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 20%, transparent); }
.form-control::placeholder, .ctrl::placeholder { color: var(--muted); opacity: .8; }
textarea.form-control { min-height: 84px; resize: vertical; }
select.form-control, select.ctrl {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6880' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form-text { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
label.error, .error:not(input):not(select):not(textarea) { color: var(--red); font-size: 12.5px; font-weight: 500; margin-top: 2px; display: block; }
input.error, select.error, textarea.error { border-color: var(--red) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 16px; height: 16px; vertical-align: -3px; cursor: pointer; }

/* Switch (custom-switch do Bootstrap) */
.custom-control { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 24px; }
.custom-control-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.custom-control-label { position: relative; padding-left: 46px; cursor: pointer; font-size: 14px; font-weight: 600; line-height: 22px; }
.custom-switch .custom-control-label::before {
  content: ""; position: absolute; left: 0; top: 1px; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2);
  transition: background-color var(--t-fast) var(--ease);
}
.custom-switch .custom-control-label::after {
  content: ""; position: absolute; left: 3px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--t-fast) var(--ease);
}
.custom-control-input:checked ~ .custom-control-label::before { background: var(--green); }
.custom-control-input:checked ~ .custom-control-label::after { transform: translateX(16px); }
.custom-control-input:focus-visible ~ .custom-control-label::before { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Input group ---------- */
.input-group { position: relative; display: flex; align-items: stretch; width: 100%; }
.input-group > .form-control, .input-group > .ctrl { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group > .form-control:not(:last-child), .input-group > .ctrl:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-prepend + .form-control, .input-group > .input-group-prepend + .ctrl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group-prepend, .input-group-append { display: flex; }
.input-group-text, .input-group-addon {
  display: flex; align-items: center; justify-content: center; min-width: 40px; padding: 0 11px; font-size: 14px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2);
}
.input-group-append .input-group-text, .input-group-append .btn { border-radius: 0 8px 8px 0; margin-left: -1px; }
.input-group-prepend .input-group-text, .input-group-prepend .btn { border-radius: 8px 0 0 8px; margin-right: -1px; }

/* bootstrap-combobox: seta do toggle (o Bootstrap desenhava via .dropdown-toggle::after) */
.combobox-container { flex: 1; min-width: 0; }
.combobox-container .dropdown-toggle { cursor: pointer; }
.combobox-container .dropdown-toggle::after {
  content: ""; width: 12px; height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6880' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.combobox-selected .dropdown-toggle::after { display: none; }
.combobox-container .input-group-text:hover { color: var(--ink); background: var(--line); }

/* ---------- Dropdown (lista do combobox) ---------- */
.dropdown-menu {
  position: absolute; z-index: 1000; display: none; min-width: 180px; max-height: 300px; overflow-y: auto;
  margin: 4px 0 0; padding: 6px; list-style: none; text-align: left; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.dropdown-menu.show { display: block; }
.dropdown-menu li { margin: 0; }
.dropdown-item, .dropdown-menu li > a {
  display: block; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--ink); white-space: nowrap; text-decoration: none;
  background: none; border: 0; text-align: left;
}
.dropdown-item:hover, .dropdown-menu li > a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.dropdown-menu li.active > a, .dropdown-item.active, .dropdown-item:active { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.dropdown-menu strong { color: var(--blue-ink); }

/* ---------- Card legado (card-default / card-header / card-body) ---------- */
.card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-header { padding: 12px 18px; border-bottom: 1px solid var(--line); font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.card-title { margin: 0; font-size: 15px; }
.card-body { padding: 18px; flex: 1 1 auto; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-heading { padding: 12px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.panel-body { padding: 18px; } .panel-footer { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-body > .card { box-shadow: none; }
.modal-body > .card + .card { margin-top: 14px; }

/* ---------- Alertas ---------- */
.alert { position: relative; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid transparent; font-size: 14px; }
.alert p { margin: 0; }
.alert-success { background: var(--green-soft); color: var(--green-ink); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-danger { background: var(--red-soft); color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-warning { background: var(--amber-soft); color: var(--amber-ink); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue-ink); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.alert-dismissible { padding-right: 44px; }
.alert-dismissible .close { position: absolute; top: 8px; right: 8px; }
.modal-body.loading > .alert, .modal-body[style*="padding:0"] > .alert { margin: 16px !important; }

/* ---------- Botão fechar (×) ---------- */
.close {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: -4px -6px -4px auto;
  font-size: 22px; line-height: 1; color: var(--muted); background: none; border: 0; border-radius: 8px; cursor: pointer; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.close:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

/* ---------- Modal ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 1050; display: none; overflow-x: hidden; overflow-y: auto; outline: 0; }
.modal-dialog { position: relative; width: auto; max-width: 520px; margin: 48px auto; padding-inline: 16px; pointer-events: none; }
.modal-sm { max-width: 400px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 880px; }
.modal-content {
  position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; text-align: left;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); outline: 0;
}
.modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-title { margin: 0; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-title .fa, .modal-title .fas { color: var(--muted); font-size: 15px; }
.modal-body { position: relative; flex: 1 1 auto; padding: 20px; }
.modal-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(8, 15, 28, .5); }
.fade { transition: opacity .18s linear; }
.fade:not(.show) { opacity: 0; }
.modal.fade .modal-dialog { transform: translateY(-12px) scale(.98); transition: transform .22s var(--ease); }
.modal.show .modal-dialog { transform: none; }
@media (max-width: 600px) { .modal-dialog { margin: 16px auto; padding-inline: 10px; } }

/* ---------- Paginação (twbsPagination) ---------- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; list-style: none; padding: 0; margin: 0 0 16px; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 14px; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.page-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.page-item.active .page-link { background: var(--blue); border-color: var(--blue); color: var(--on-accent); font-weight: 700; }
.page-item.disabled .page-link { opacity: .45; pointer-events: none; }

/* ---------- List group ---------- */
.list-group { display: flex; flex-direction: column; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.list-group-item { display: block; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }
.list-group-item:last-child { border-bottom: 0; }
.list-group-item-action { cursor: pointer; text-align: left; width: 100%; border-left: 0; border-right: 0; border-top: 0; }
.list-group-item-action:hover { background: var(--surface-2); text-decoration: none; }
.list-group-item.active { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }

/* ---------- Tabela legada ---------- */
.table { width: 100%; font-size: 14px; }
.table th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: left; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table-bordered th, .table-bordered td { border: 1px solid var(--line); }
.table-striped tbody tr:nth-of-type(odd) td { background: var(--surface-2); }
.table-hover tbody tr:hover td { background: var(--blue-soft); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; font-size: 12px; font-weight: 600; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* ---------- Páginas legadas (content-header / content) ---------- */
.content-header { padding: 0 0 16px; }
.content-header h1, .page-title, .page-header { font-size: 26px; font-weight: 600; margin: 0; }
.content + .content { margin-top: 18px; }

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
