/* Painel Premium - novo design (tema azul) */
:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --line: #e8ecf3;
  --text: #0f172a;
  --muted: #7c879b;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --accent-2: #1d4ed8;
  --accent-soft: #eaf1ff;
  --ink: #0b1220;
  --danger: #ef4444;
  --success: #16a34a;
  --warn: #d97706;
  --sidebar: 252px;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); text-decoration: none; }

.premium-shell { display: flex; min-height: 100vh; width: 100%; }

/* ---------- Sidebar ---------- */
.premium-sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 1030;
  transition: width .2s, flex-basis .2s;
}
.premium-brand {
  padding: 16px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.premium-brand-title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--text);
}
.premium-brand-logo {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  color: #fff; display: grid; place-items: center; font-size: 15px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, .35);
}
.premium-collapse {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; font-size: 12px; padding: 0;
}
.premium-collapse:hover { color: var(--accent); border-color: var(--accent); }

.premium-menu-search { padding: 10px 14px 4px; }
.premium-menu-search input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: 12.5px; outline: none;
}
.premium-menu-search input:focus { border-color: var(--accent); background: #fff; }

.premium-nav-scroll { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.premium-nav-scroll::-webkit-scrollbar { width: 6px; }
.premium-nav-scroll::-webkit-scrollbar-thumb { background: #dbe2ee; border-radius: 6px; }

.premium-menu-section {
  padding: 16px 20px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em;
  color: #8a94a8; text-transform: uppercase;
}
.premium-nav { list-style: none; margin: 0; padding: 0 10px; }
.premium-nav-item {
  display: flex; align-items: center;
  border-radius: 16px; margin-bottom: 4px;
  transition: background .15s, box-shadow .15s;
}
.premium-nav-item:hover { background: var(--surface-2); }
.premium-nav-item.active {
  background: var(--ink);
  box-shadow: 0 10px 22px rgba(11, 18, 32, .25);
}
.premium-nav-link {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 7px 10px; color: #2b3548;
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.premium-nav-link i {
  width: 32px; height: 32px; border-radius: 11px; flex: 0 0 32px;
  display: grid; place-items: center;
  background: var(--surface-2); color: #55617a; font-size: 14px;
}
.premium-nav-item.active .premium-nav-link { color: #fff; font-weight: 600; }
.premium-nav-item.active .premium-nav-link i { background: rgba(255,255,255,.14); color: #fff; }
.premium-fav-btn {
  background: transparent; border: 0; color: #cbd5e1;
  padding: 6px 10px; cursor: pointer; font-size: 12px; opacity: 0; transition: opacity .15s;
}
.premium-nav-item:hover .premium-fav-btn,
.premium-fav-btn.is-fav { opacity: 1; }
.premium-fav-btn.is-fav { color: #f59e0b; }

.premium-sidebar-footer { padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.premium-user-card {
  border: 1px solid var(--line); border-radius: 18px; padding: 10px;
  background: #fff; box-shadow: 0 4px 14px rgba(15,23,42,.05);
}
.premium-user-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
.premium-user-card-top .info { min-width: 0; }
.premium-user-card-top strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.premium-user-card-top small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.premium-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.premium-avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
.premium-user-card-actions { display: flex; gap: 8px; }
.premium-btn-sair {
  flex: 1; background: #ef5a5f; color: #fff !important; border-radius: 12px;
  font-weight: 600; text-align: center; padding: 8px; font-size: 13px;
  box-shadow: 0 6px 14px rgba(239, 90, 95, .3);
}
.premium-btn-sair:hover { background: #e04449; }
.premium-copy { text-align: center; font-size: 11px; color: #9aa4b6; margin-top: 8px; }

/* ---------- Main / Topbar ---------- */
.premium-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.premium-topbar {
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  position: sticky; top: 0; z-index: 1020;
}
.premium-topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: #44506a;
  display: inline-grid; place-items: center; cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn .dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.topbar-search {
  flex: 1; max-width: 480px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 0 8px 0 14px; height: 38px;
}
.topbar-search i { color: #9aa4b6; }
.topbar-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 13px; min-width: 0; }
.topbar-search kbd {
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; font-size: 11px; padding: 2px 8px; box-shadow: none;
}
.premium-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.code-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; padding: 6px 8px 6px 14px; font-size: 12px; font-weight: 500;
}
.code-pill b {
  background: #fff; border-radius: 999px; padding: 3px 10px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text);
}
.premium-user-pill {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line);
  padding: 4px 14px 4px 5px; border-radius: 999px; font-size: 13px; color: var(--text); font-weight: 500;
  max-width: 230px;
}
.premium-user-pill span.n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Page header ---------- */
.premium-pagehead {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 22px 32px 18px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.premium-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #8a94a8; margin-bottom: 4px; }
.premium-page-title { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -.02em; color: var(--text); }
.premium-page-title span { color: #9aa4b8; font-weight: 600; }
.premium-page-subtitle { font-size: 13px; color: var(--muted); margin: 6px 0 0; max-width: 620px; }
.premium-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.chip-warn { background: #fff7e6; color: #b45309; border-color: #fde7b0; }
.chip-info { background: var(--accent-soft); color: var(--accent-dark); border-color: #cfe0ff; }

.premium-content { padding: 26px 32px 48px; flex: 1; }

/* ---------- Cards ---------- */
.p-card {
  background: var(--surface); border: 1px solid #eef1f6;
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.p-card-title {
  font-size: 17px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text);
}
.p-eyebrow { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: #8a94a8; font-weight: 500; }

/* Hero azul */
.hero-card {
  position: relative; overflow: hidden; color: #fff;
  border-radius: 28px; padding: 30px 34px; margin-bottom: 22px;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
  box-shadow: 0 24px 50px rgba(37, 99, 235, .28);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px;
}
.hero-card::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: 13px; opacity: .85; }
.hero-value { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 10px; }
.hero-text { font-size: 14px; opacity: .85; max-width: 440px; }
.hero-mini { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-mini .m {
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 10px 16px; min-width: 110px;
}
.hero-mini .m small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.hero-mini .m b { font-size: 15px; }
.hero-side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: relative; z-index: 1; align-content: start; }
.hero-box { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 16px 18px; }
.hero-box small { display: block; font-size: 13px; opacity: .85; }
.hero-box b { font-size: 30px; font-weight: 600; }
.hero-box.wide { grid-column: 1 / -1; }
.hero-box.wide b { font-size: 19px; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi-card {
  background: var(--surface); border: 1px solid #eef1f6; border-radius: 22px;
  padding: 18px 20px; box-shadow: var(--shadow);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 14px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-size: 17px;
}
.kpi-tag { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; background: var(--surface-2); color: #7c879b; border-radius: 999px; padding: 4px 12px; }
.kpi-label { font-size: 13px; color: #3b475e; margin-bottom: 2px; }
.kpi-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Forms */
.form-control, .custom-select {
  background-color: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 14px; min-height: 40px;
}
.form-control:focus, .custom-select:focus {
  background-color: #fff; border-color: var(--accent); color: var(--text);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}
.form-control[readonly] { background-color: #f1f4f9; color: var(--muted); }
label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #6b768b; font-weight: 500; }

/* File inputs styling */
.form-control-file,
input[type="file"] {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  background-color: var(--surface-2);
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  cursor: pointer;
  transition: all .2s ease;
}
.form-control-file:hover,
input[type="file"]:hover {
  border-color: var(--accent);
  background-color: #fff;
}
.form-control-file::file-selector-button,
input[type="file"]::file-selector-button {
  padding: 6px 14px;
  margin-right: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease;
}
.form-control-file::file-selector-button:hover,
input[type="file"]::file-selector-button:hover {
  background: var(--accent-2);
}
.form-control-file::-webkit-file-upload-button,
input[type="file"]::-webkit-file-upload-button {
  padding: 6px 14px;
  margin-right: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease;
}
.form-control-file::-webkit-file-upload-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--accent-2);
}

/* Tables */
.table-dark-premium { color: var(--text); background: transparent; }
.table-dark-premium th {
  border-top: 0; border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em; font-weight: 500;
  color: #6b768b; background: #fff; padding: 14px 12px;
}
.table-dark-premium td { border-top: 1px solid #f0f3f8; vertical-align: middle; padding: 14px 12px; }
.table-dark-premium tbody tr:hover { background: #fafbfe; }

/* Buttons */
.btn { border-radius: 14px; font-weight: 500; }
.btn-sm { border-radius: 12px; }
.btn-accent, .btn-primary {
  background: var(--accent); color: #fff; font-weight: 600; border: 0; border-radius: 14px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}
.btn-accent:hover, .btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-primary:focus { box-shadow: 0 0 0 .2rem rgba(37,99,235,.25); }
.btn-gold { background: var(--accent-dark); color: #fff; font-weight: 600; border: 0; border-radius: 14px; }
.btn-outline-light, .btn-light {
  background: #ffffff !important; color: #334155 !important; border: 1px solid var(--line) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.btn-outline-light:hover, .btn-light:hover {
  background: var(--accent-soft) !important; color: var(--accent-dark) !important; border-color: #cfe0ff !important;
}
.btn-outline-light.active, .btn-light.active,
.btn-outline-light:not(:disabled):not(.disabled):active,
.btn-outline-light:not(:disabled):not(.disabled).active {
  background: var(--accent) !important; color: #ffffff !important; border-color: var(--accent) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25) !important;
}
.btn-outline-secondary { color: #55617a; border-color: var(--line); }
.btn-outline-secondary:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: #cfe0ff; }
.btn-outline-warning { color: #b45309; border-color: #fde7b0; background: #fffaf0; }
.btn-outline-warning:hover { background: #fde7b0; color: #92400e; border-color: #fde7b0; }
.btn-outline-danger { color: #dc2626; border-color: #fbd0d0; background: #fff5f5; }
.btn-outline-danger:hover { background: #ef4444; border-color: #ef4444; }
.btn-outline-success { color: #15803d; border-color: #c4ecd2; background: #f3fbf6; }
.btn-outline-success:hover { background: #16a34a; border-color: #16a34a; }
.btn-outline-primary { color: var(--accent); border-color: #cfe0ff; }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-success { background: #16a34a; border: 0; }

/* Filter & Segmented Button Groups */
.btn-group {
  gap: 6px;
  display: inline-flex;
  flex-wrap: wrap;
}
.btn-group > .btn {
  border-radius: 12px !important;
  margin-left: 0 !important;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease-in-out;
}
.btn-group-sm > .btn {
  border-radius: 10px !important;
  font-size: 12px;
  padding: 6px 14px;
}

/* Dropdowns */
.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
  padding: 6px;
  min-width: 150px;
  z-index: 1060;
}
.dropdown-item {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  padding: 8px 12px;
  transition: all .15s ease;
  background: transparent;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--surface-2);
  color: var(--accent);
}
.dropdown-item.text-danger:hover {
  background-color: #fff5f5;
  color: #dc2626 !important;
}
.dropdown-divider {
  border-top: 1px solid var(--line);
}
.table-responsive {
  min-height: 220px;
}

/* Modal */
.modal-content { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 24px; box-shadow: 0 30px 70px rgba(15,23,42,.2); }
.modal-header, .modal-footer { border-color: var(--line); }

/* Badges */
.badge { border-radius: 999px; padding: 5px 10px; font-weight: 600; }
.badge-ativo { background: #e6f7ec; color: #15803d; border: 1px solid #c4ecd2; }
.badge-bloqueado { background: #fdecec; color: #dc2626; border: 1px solid #fbd0d0; }
.badge-success { background: #e6f7ec; color: #15803d; }
.badge-danger { background: #ef4444; }
.badge-warning { background: #fff1d6; color: #b45309; }
.badge-secondary { background: #eef1f6; color: #55617a; }
.badge-primary, .badge-info { background: var(--accent-soft); color: var(--accent-dark); }

.alert { border-radius: 16px; border: 0; }
.text-warning { color: var(--accent) !important; }
.text-info { color: #0284c7 !important; }

.card, .list-group-item { border-radius: 18px; border-color: var(--line); }
.nav-tabs .nav-link.active { color: var(--accent); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); }
.page-link { color: var(--accent); border-radius: 10px; margin: 0 2px; }

/* Sidebar recolhida */
body.sidebar-collapsed { --sidebar: 78px; }
body.sidebar-collapsed .premium-nav-link span,
body.sidebar-collapsed .premium-menu-section,
body.sidebar-collapsed .premium-menu-search,
body.sidebar-collapsed .premium-fav-btn,
body.sidebar-collapsed .premium-brand-title .t,
body.sidebar-collapsed .premium-user-card-top .info,
body.sidebar-collapsed .premium-btn-sair span,
body.sidebar-collapsed .premium-copy { display: none; }
body.sidebar-collapsed .premium-brand { padding: 16px 8px; flex-direction: column; gap: 10px; }
body.sidebar-collapsed .premium-nav-link { justify-content: center; padding: 7px; }

@media (max-width: 1199.98px) {
  .code-pill, .topbar-search kbd { display: none; }
}
@media (max-width: 991.98px) {
  .premium-sidebar { position: fixed; left: -280px; width: 260px; transition: left .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .premium-sidebar.open { left: 0; }
  .premium-content { padding: 18px 16px 40px; }
  .premium-pagehead { padding: 18px 16px; }
  .hero-card { grid-template-columns: 1fr; padding: 24px; }
  .hero-value { font-size: 40px; }
  .topbar-search { display: none; }
  .premium-user-pill span.n { display: none; }
}
