/* =========================================================
   IBG Portal do Cliente — CSS Premium
   ========================================================= */

/* ---------- Reset & Variáveis ---------- */
:root {
  --ibg-900: #041e3a;
  --ibg-800: #073b73;
  --ibg-700: #0d5fa6;
  --ibg-600: #1a77c9;
  --ibg-400: #4da3e8;
  --ibg-100: #dbeafe;
  --bg: #f0f4fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e2e8f2;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --sidebar-w: 260px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 4px 16px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md: 0 8px 32px rgba(15,23,42,.10), 0 2px 8px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 60px rgba(15,23,42,.14), 0 4px 16px rgba(15,23,42,.08);
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout Shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--ibg-900) 0%, #061f3a 60%, #041527 100%);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 240px;
  background: radial-gradient(ellipse at 30% 0%, rgba(13,95,166,.4) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: relative;
}

.sidebar-brand .brand-logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--ibg-600), var(--ibg-400));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(13,95,166,.4);
}

.sidebar-brand .brand-name {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px 22px;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.25);
  padding: 0 10px;
  margin: 16px 0 8px;
}

.nav-section-title:first-child { margin-top: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255,255,255,.60);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.sidebar-nav a i {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(29,119,201,.5), rgba(13,95,166,.3));
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--ibg-400);
  border-radius: 0 3px 3px 0;
  left: -14px;
}

.sidebar-footer {
  padding: 16px 14px 24px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  margin-bottom: 8px;
}

.sidebar-user .user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--ibg-600), var(--ibg-400));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.sidebar-user .user-info { min-width: 0; }

.sidebar-user .user-email {
  font-size: 11px;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* ---------- Content ---------- */
.content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  background: var(--ibg-100);
  color: var(--ibg-700);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.empresa-select {
  background: var(--ibg-50, #f0f4ff);
  border: 1.5px solid var(--ibg-200, #c7d4f5);
  border-radius: 8px;
  color: var(--ibg-700);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  max-width: 280px;
  transition: border-color .15s;
}
.empresa-select:hover,
.empresa-select:focus {
  border-color: var(--ibg-500, #4b6fcf);
}
.empresa-select option {
  font-weight: 400;
  color: var(--text-primary);
  background: #fff;
}

/* ---------- Page Body ---------- */
.page-body {
  flex: 1;
  padding: 28px;
}

/* ---------- Page Title ---------- */
.page-title {
  margin-bottom: 24px;
}

.page-title h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ---------- KPI Cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ibg-700), var(--ibg-400));
  opacity: 0;
  transition: opacity var(--transition);
}

.kpi:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--ibg-100);
}

.kpi:hover::before { opacity: 1; }

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.orange { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.purple { background: #ede9fe; color: #7c3aed; }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-top: 6px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Cards ---------- */
.card-soft {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-soft .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-soft .card-head h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- Filter Card ---------- */
.filter-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

/* ---------- Tables ---------- */
.table-premium {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table-premium thead th {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-premium thead th:first-child { border-radius: 10px 0 0 0; }
.table-premium thead th:last-child { border-radius: 0 10px 0 0; }

.table-premium tbody tr {
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.table-premium tbody tr:last-child td { border-bottom: none; }

.table-premium tbody tr:hover { background: var(--surface-2); }

.table-premium td {
  padding: 13px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-premium td.text-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* ---------- Badges ---------- */
.badge-premium {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-premium.success { background: var(--success-bg); color: #065f46; }
.badge-premium.danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-premium.warning { background: var(--warning-bg); color: #92400e; }
.badge-premium.info    { background: var(--info-bg);    color: #1e40af; }
.badge-premium.muted   { background: #f1f5f9;           color: #475569; }

/* ---------- Buttons ---------- */
.btn-ibg {
  background: linear-gradient(135deg, var(--ibg-700), var(--ibg-600));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-ibg:hover {
  background: linear-gradient(135deg, var(--ibg-800), var(--ibg-700));
  color: #fff;
  box-shadow: 0 4px 12px rgba(7,59,115,.3);
  transform: translateY(-1px);
}

.btn-ibg:active { transform: translateY(0); }

.btn-outline-ibg {
  background: transparent;
  color: var(--ibg-700);
  border: 1px solid var(--ibg-400);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.btn-outline-ibg:hover {
  background: var(--ibg-100);
  border-color: var(--ibg-700);
  color: var(--ibg-800);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); border-color: #c8d3e0; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--ibg-600);
  box-shadow: 0 0 0 3px rgba(13,95,166,.12);
  outline: none;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-info    { background: var(--info-bg);    color: #1e40af; }
.alert-success { background: var(--success-bg); color: #065f46; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; }
.alert-warning { background: var(--warning-bg); color: #92400e; }

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ibg-900) 0%, #0a2d52 40%, #041a30 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,95,166,.25) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77,163,232,.12) 0%, transparent 70%);
  bottom: -80px; right: 50px;
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  max-width: 420px;
  width: 94%;
  padding: 44px 40px;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1);
  position: relative;
  z-index: 1;
  animation: slideUp .4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 62px; height: 62px;
  background: linear-gradient(135deg, var(--ibg-800), var(--ibg-600));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px; color: #fff;
  box-shadow: 0 8px 24px rgba(7,59,115,.35);
  margin-bottom: 16px;
}

.login-card h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: -0.3px;
}

.login-card .login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 6px;
  line-height: 1.5;
}

.login-card .form-control {
  font-size: 15px;
  padding: 13px 16px;
  border-radius: 12px;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--ibg-700), var(--ibg-600));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--ibg-800), var(--ibg-700));
  box-shadow: 0 6px 20px rgba(7,59,115,.4);
  transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }

.code-input {
  font-size: 30px;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 14px;
  border-radius: 12px;
}

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-top: 16px;
  transition: color var(--transition);
}

.login-back:hover { color: var(--ibg-700); }

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: block;
}

.empty-state h5 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- Copy Button ---------- */
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  transition: all var(--transition);
  font-size: 14px;
}

.copy-btn:hover { background: var(--surface-2); color: var(--ibg-700); }

/* ---------- Boleto Cards (Accordion) ---------- */
.boleto-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.boleto-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }

.boleto-card-header {
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  background: var(--surface-1);
  transition: background var(--transition);
}
.boleto-card-header:hover { background: var(--surface-2); }

.boleto-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.boleto-banco { flex: 0 0 auto; }

.boleto-titulo-info {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.boleto-num  { font-family: monospace; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.boleto-parc { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

.boleto-nf-info {
  flex: 1 1 120px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.boleto-nf-num   { font-size: 13px; font-weight: 600; color: var(--ibg-700); font-family: monospace; }
.boleto-nf-serie { font-size: 10px; color: var(--text-muted); }

.boleto-venc {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}
.boleto-venc-val { font-size: 13px; font-weight: 600; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.boleto-valores {
  flex: 0 0 auto;
  text-align: right;
}

.boleto-status-col { flex: 0 0 auto; }

.boleto-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--text-muted);
  transition: transform .22s ease;
  font-size: 14px;
}

/* ── Corpo expansível ── */
.boleto-card-body {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 18px;
}

.boleto-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.boleto-detail-block {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.boleto-detail-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.boleto-detail-value {
  font-weight: 700;
  color: var(--text-primary);
}

.mt-2 { margin-top: 8px; }

/* Botão copiar dentro do card */
.copy-btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ibg-700);
  cursor: pointer;
  transition: all var(--transition);
  align-self: flex-start;
}
.copy-btn-detail:hover { background: var(--ibg-100); border-color: var(--ibg-400); }

/* Badge BB */
.badge-bb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFE100;
  color: #003399;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: .5px;
}
.badge-bb-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #003399;
  color: #FFE100;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Botão 2ª via BB (grande, dentro do card) */
.btn-bb-via-lg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #003399 0%, #0044cc 100%);
  color: #FFE100;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-bb-via-lg:hover {
  background: linear-gradient(135deg, #002277 0%, #003399 100%);
  color: #FFE100;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,51,153,.3);
}

/* Botão 2ª via BB (pequeno, na tabela antiga — mantido como fallback) */
.btn-bb-via {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFE100;
  color: #003399;
  border: 1px solid #e6cb00;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-bb-via:hover {
  background: #ffd600;
  color: #002277;
  border-color: #ccb400;
  text-decoration: none;
}

/* ---------- Loading / Skeleton ---------- */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  height: 18px;
}

/* ---------- Pagination ---------- */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-wrap .page-info {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.page-link-btn {
  min-width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--surface);
  transition: all var(--transition);
  padding: 0 10px;
}

.page-link-btn:hover { background: var(--ibg-100); border-color: var(--ibg-400); color: var(--ibg-700); }
.page-link-btn.active { background: var(--ibg-700); border-color: var(--ibg-700); color: #fff; }
.page-link-btn.disabled { opacity: .4; pointer-events: none; }

/* ---------- Tooltip copied ---------- */
.copied-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1e293b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.copied-toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Modal de envio de e-mail ---------- */
.email-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.email-modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.email-modal-box {
  background: var(--surface-1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  transform: translateY(16px) scale(.97);
  transition: transform .22s ease;
}
.email-modal-overlay.show .email-modal-box {
  transform: translateY(0) scale(1);
}
.email-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.email-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.email-modal-close:hover { background: var(--surface-2); color: var(--text-primary); }

.email-modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.email-modal-footer {
  padding: 14px 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.form-group-email { display: flex; flex-direction: column; gap: 5px; }
.email-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; }
.email-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.email-input:focus { border-color: var(--ibg-500); box-shadow: 0 0 0 3px rgba(13,90,173,.12); }

.email-anexo-badge {
  background: var(--surface-2);
  border: 1px dashed var(--ibg-400);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ibg-700);
  font-weight: 600;
}

.email-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Error Page ---------- */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.error-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 56px 48px;
  text-align: center;
  max-width: 480px;
  width: 94%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.error-card .error-icon {
  font-size: 56px;
  margin-bottom: 20px;
  color: var(--text-muted);
}

.error-card h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.error-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---------- Session warning ---------- */
.session-warning {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--warning);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 10px;
  z-index: 9999;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 14px;
    gap: 6px;
  }

  .sidebar-brand { padding: 8px 14px; border-bottom: none; }
  .sidebar-nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0; flex: 1; }
  .sidebar-nav a { padding: 7px 12px; margin-bottom: 0; }
  .sidebar-footer { display: none; }
  .nav-section-title { display: none; }
  .app-shell { flex-direction: column; }
  .content { margin-left: 0; width: 100%; }
  .page-body { padding: 18px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 500px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px 14px; }
  .kpi-value { font-size: 24px; }
  .login-card { padding: 32px 24px; }
  .page-body { padding: 14px; }
}

/* ---------- Bootstrap overrides ---------- */
.btn-primary { background: var(--ibg-700); border-color: var(--ibg-700); font-weight: 600; border-radius: var(--radius-sm); }
.btn-primary:hover { background: var(--ibg-800); border-color: var(--ibg-800); }
.btn-sm { font-size: 11.5px; padding: 5px 12px; }

/* Atendimento / solicitações */
.support-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.support-header h2 {
  margin: 12px 0 2px;
  font-size: 26px;
  font-weight: 850;
  color: var(--text-primary);
}
.support-header p { margin: 0; color: var(--text-secondary); }
.support-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.support-summary div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}
.support-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.support-summary strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-aberto { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.status-em-analise { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.status-aguardando-cliente { color: #6d28d9; background: #ede9fe; border-color: #ddd6fe; }
.status-respondido { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.status-encerrado { color: #475569; background: #e2e8f0; border-color: #cbd5e1; }
.status-cancelado { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid transparent;
}
.priority-baixa { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }
.priority-media { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.priority-alta { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.priority-critica { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.support-timeline {
  display: grid;
  gap: 14px;
  position: relative;
}
.timeline-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.timeline-item.from-client { border-left: 4px solid var(--info); background: #f8fbff; }
.timeline-item.from-internal { border-left: 4px solid var(--success); background: #f8fffb; }
.timeline-item.from-system { border-left: 4px solid var(--text-muted); background: #f8fafc; }
.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.timeline-meta span { color: var(--text-muted); font-size: 12px; }
.timeline-body { white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; margin-bottom: 10px; }
.status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.status-actions form, .status-actions button { width: 100%; }
.support-log {
  font-size: 12px;
  border-bottom: 1px solid #eef2f7;
  padding: 9px 0;
}
.support-log span { color: var(--text-muted); }
.support-filter { margin-bottom: 16px; }
.support-filter-actions { display: flex; gap: 8px; justify-content: flex-end; }
.support-table th, .support-table td { vertical-align: middle; }
.empty-state.compact { padding: 18px 10px; }
@media (max-width: 992px) {
  .support-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-filter-actions { justify-content: flex-start; }
}
@media (max-width: 576px) {
  .support-summary { grid-template-columns: 1fr; }
  .status-actions { grid-template-columns: 1fr; }
  .support-header h2 { font-size: 22px; }
}
