/* ============================================================
   Reskin moderno em cima do AdminLTE 3 / Bootstrap 4.
   Mantém a estrutura (sidebar, navbar, cards) mas troca tipografia,
   cores, sombras e espaçamento por um visual atual de dashboard SaaS.
   ============================================================ */

:root {
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-600: #475569;
  --ink-400: #94a3b8;

  --surface: #ffffff;
  --page-bg: #f3f5fb;
  --line: #e6e9f2;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 20px -4px rgba(15, 23, 42, .10), 0 2px 6px -2px rgba(15, 23, 42, .06);
}

html { font-size: 14px; }

* { -webkit-font-smoothing: antialiased; }

body, .content-wrapper {
  background: var(--page-bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink-800);
  font-size: .95rem;
}

h1, h2, h3, h4, h5, h6, .card-title, .brand-text {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink-900);
}

a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }

/* ---------- Top navbar ---------- */

.main-header.navbar {
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.main-header .nav-link { color: var(--ink-600) !important; }
.main-header .nav-link:hover { color: var(--ink-900) !important; }

.navbar-page-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-900);
  margin-left: .25rem;
}

.user-chip {
  display: flex;
  align-items: center;
  padding: .35rem .6rem !important;
  border-radius: 999px;
  transition: background .15s ease;
}
.user-chip:hover { background: var(--brand-50); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  margin-right: .5rem;
  text-transform: uppercase;
}

.user-name { font-weight: 600; font-size: .88rem; color: var(--ink-800); }

.user-menu .dropdown-menu {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .4rem;
  margin-top: .4rem;
  min-width: 180px;
}
.user-menu .dropdown-item {
  border-radius: 6px;
  font-size: .88rem;
  padding: .5rem .7rem;
}
.user-menu .dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }
.user-chip.dropdown-toggle::after { display: none; }

/* ---------- Sidebar ---------- */

.main-sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #131c31 100%) !important;
  box-shadow: none;
}

.brand-link {
  border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
  display: flex;
  align-items: center;
  padding: 1rem 1.1rem !important;
  gap: .65rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .95rem;
  flex-shrink: 0;
}

.brand-text {
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.nav-sidebar { padding: .75rem .65rem; }

.nav-sidebar > .nav-item { margin-bottom: .2rem; }

.nav-sidebar .nav-link {
  display: flex !important;
  align-items: center;
  color: #b7c0d4 !important;
  border-radius: var(--radius-sm);
  padding: .62rem .8rem;
  font-size: .89rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background .15s ease, color .15s ease;
}

.nav-sidebar .nav-link p {
  margin: 0;
  line-height: 1.2;
}

.nav-sidebar .nav-link .nav-icon {
  color: #8592ab;
  margin-right: .65rem;
  font-size: .95rem;
  width: 1.15rem;
  text-align: center;
  transition: color .15s ease;
  flex-shrink: 0;
}

.nav-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff !important;
}
.nav-sidebar .nav-link:hover .nav-icon { color: #fff; }

.nav-sidebar .nav-link.active {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500)) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px -2px rgba(79, 70, 229, .5);
}
.nav-sidebar .nav-link.active .nav-icon { color: #fff !important; }

/* ---------- Content header ---------- */

/* .content do AdminLTE tem padding:0 .5rem — repete aqui os mesmos
   .5rem horizontais pra título e card ficarem na mesma linha vertical. */
.content-header { padding: 1.1rem .5rem .5rem; background: transparent; }
.content-header h1 { font-size: 1.3rem; font-weight: 800; }
.page-actions .btn { margin-left: .4rem; }

.content > .container-fluid { padding-bottom: 1.5rem; }

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1rem 1.25rem;
}

.card-header .card-title { font-size: .95rem; font-weight: 700; }

.card-body { padding: 1.1rem; }

/* ---------- Stat cards (dashboard) ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-bottom: .85rem; }
@media (max-width: 991.98px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .7rem;
}

.stat-card .stat-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-600);
  line-height: 1.2;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.15;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.stat-icon.i-amber   { background: #fef3c7; color: #b45309; }
.stat-icon.i-blue    { background: #dbeafe; color: #1d4ed8; }
.stat-icon.i-green   { background: #d1fae5; color: #047857; }
.stat-icon.i-indigo  { background: var(--brand-100); color: var(--brand-700); }
.stat-icon.i-red     { background: #fee2e2; color: #b91c1c; }
.stat-icon.i-slate   { background: #e2e8f0; color: #334155; }

/* ---------- Tables ---------- */

.table { color: var(--ink-800); }

.table thead th {
  border-top: none;
  border-bottom: 1px solid var(--line);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-400);
  padding: .7rem 1rem;
  white-space: nowrap;
}

.table td { padding: .6rem .9rem; border-top: 1px solid var(--line); vertical-align: middle; }

.table-hover tbody tr:hover { background: var(--brand-50); }

.font-weight-semibold { font-weight: 600; }

/* Colunas curtas (documento, telefone, status) não devem quebrar linha
   e bagunçar a altura da linha da tabela. */
.text-nowrap-cell { white-space: nowrap; }

/* Botões de ação da linha (editar/inativar/excluir) sempre lado a lado. */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  flex-wrap: nowrap;
}
.action-buttons form { display: inline-flex; margin: 0; }
.action-buttons .btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; }

/* ---------- Badges ---------- */

.badge { font-weight: 600; font-size: .74rem; padding: .38em .65em; border-radius: 999px; }
.badge-success { background: #d1fae5; color: #047857; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: #e2e8f0; color: #334155; }
.badge-primary { background: var(--brand-100); color: var(--brand-700); }
.badge-light { background: #f1f5f9; color: var(--ink-600); }

/* ---------- Buttons ---------- */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  padding: .5rem 1rem;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn-sm { padding: .3rem .65rem; border-radius: 8px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  border: none;
  box-shadow: 0 4px 12px -3px rgba(79, 70, 229, .55);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -3px rgba(79, 70, 229, .6); }
.btn-primary:active, .btn-primary:focus { background: var(--brand-700); }

.btn-outline-primary { color: var(--brand-600); border-color: var(--brand-500); }
.btn-outline-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }

.btn-outline-secondary { color: var(--ink-600); border-color: var(--line); }
.btn-outline-secondary:hover { background: var(--ink-800); border-color: var(--ink-800); }

.btn-success { background: #059669; border-color: #059669; }
.btn-outline-danger { color: #dc2626; border-color: #fca5a5; }
.btn-outline-danger:hover { background: #dc2626; border-color: #dc2626; }

/* ---------- Forms ---------- */

label { font-weight: 600; font-size: .82rem; color: var(--ink-800); margin-bottom: .35rem; }

.form-control {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-size: .9rem;
  color: var(--ink-800);
  background: var(--surface);
}
.form-control:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.input-group-text { background: #f8fafc; border-color: var(--line); color: var(--ink-400); }

.custom-file-label { border-radius: var(--radius-sm); border-color: var(--line); }

/* ---------- Alerts ---------- */

.alert {
  border: none;
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .89rem;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border-left-color: #dc2626; }
.alert-success { background: #f0fdf4; color: #166534; border-left-color: #16a34a; }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: #d97706; }
.alert-info    { background: var(--brand-50); color: var(--brand-700); border-left-color: var(--brand-500); }
.alert-secondary { background: #f8fafc; color: var(--ink-600); border-left-color: var(--ink-400); }

/* ---------- Tabs ---------- */

.nav-tabs { border-bottom: 1px solid var(--line); }
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-600);
  font-weight: 600;
  font-size: .88rem;
  padding: .6rem .9rem;
  border-radius: 0;
}
.nav-tabs .nav-link:hover { color: var(--brand-700); border-color: var(--brand-100); }
.nav-tabs .nav-link.active {
  color: var(--brand-700);
  background: transparent;
  border-color: var(--brand-600);
}

/* ---------- Pagination ---------- */

.pagination .page-link {
  border: none;
  border-radius: 999px;
  margin: 0 .15rem;
  color: var(--ink-600);
  font-weight: 600;
  font-size: .85rem;
}
.pagination .page-item.active .page-link {
  background: var(--brand-600);
  color: #fff;
}

/* ---------- Login page ---------- */

.login-page {
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, .25) 0%, transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(79, 70, 229, .2) 0%, transparent 40%),
    radial-gradient(circle at 20% 20%, #1e293b 0%, #0f172a 55%, #0b1120 100%);
  background-size: cover;
  background-attachment: fixed;
  font-family: "Inter", sans-serif;
  padding: 1rem;
}

.login-box { width: 100%; max-width: 380px; }

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.login-logo-img {
  display: block;
  max-width: 180px;
  max-height: 85px;
  width: auto;
  height: auto;
}

.login-card-body {
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .45);
  padding: 2.2rem 2rem !important;
}

.login-box-msg { color: var(--ink-600); font-size: .88rem; }

.login-card-body .btn-primary { padding: .65rem 1rem; font-size: .92rem; }

.login-version {
  text-align: center;
  color: rgba(255, 255, 255, .5);
  font-size: .75rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

/* ---------- Misc ---------- */

.table-responsive-card { overflow-x: auto; }
.list-group-item { border-color: var(--line); font-size: .9rem; }
dl dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-400); font-weight: 700; margin-top: .6rem; }
dl dd { font-size: .92rem; color: var(--ink-800); margin-bottom: 0; }

@media (max-width: 575.98px) {
  .content-header h1 { font-size: 1.15rem; }
  .card-body { padding: .9rem; }
  .page-actions { margin-top: .5rem; text-align: left !important; }
  .page-actions .btn { margin-left: 0; margin-right: .4rem; }
  .stat-value { font-size: 1.3rem; }
}

@media (max-width: 991.98px) {
  .content-wrapper, .main-header, .main-footer { margin-left: 0 !important; }
}

/* ---------- Combobox de busca (cliente/produto/vendedor) ---------- */

.search-select-dropdown {
  position: fixed;
  z-index: 1080;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.search-select-dropdown.open { display: block; }
.search-select-option { padding: .5rem .75rem; font-size: .88rem; cursor: pointer; }
.search-select-option:hover, .search-select-option.active { background: var(--brand-50); }
.search-select-empty { padding: .5rem .75rem; font-size: .85rem; color: var(--ink-400); }
.form-control.input-invalid { border-color: #dc3545; }

/* ---------- Itens do pedido (form Novo Pedido) ---------- */

.order-items-scroll { max-height: 420px; overflow-y: auto; padding-right: 2px; }
.order-item-row {
  display: grid;
  grid-template-columns: 2fr 1.1fr .7fr .9fr .9fr .9fr auto;
  gap: .6rem;
  align-items: end;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: .6rem;
  background: var(--page-bg);
}
.order-item-row label { font-size: .74rem; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-400); font-weight: 700; margin-bottom: .25rem; }
.order-item-row .item-subtotal, .order-item-row .item-comissao { display: block; font-weight: 600; padding: .375rem 0; }
.btn-remove-item { border: none; background: transparent; color: #dc3545; padding: .375rem .5rem; }
.btn-remove-item:hover { color: #a71d2a; }
.order-total-bar {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  padding: .6rem .75rem;
  background: var(--brand-50);
  border-radius: var(--radius-sm);
  margin-top: .5rem;
}
.parcelas-preview { margin-top: .75rem; }
.parcelas-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--line);
}
.parcelas-preview-row .parcela-date-input { max-width: 170px; }

@media (max-width: 991.98px) {
  .order-item-row { grid-template-columns: 1fr 1fr; }
}
