/* ── ADMIN LAYOUT ────────────────────────────────────────── */
.admin-body { display: flex; min-height: 100vh; background: #f1f5f9; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: #1e2d45;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Mobile: sidebar hidden off-screen by default */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
}

/* Desktop: always visible, main shifts right */
@media (min-width: 768px) {
  .admin-main { margin-left: 220px; }
}

/* Overlay behind sidebar on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.sidebar-overlay.is-open { display: block; }

/* ── SIDEBAR BRAND / LOGO ────────────────────────────────── */
.sidebar-logo-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 14px 12px;
}
.sidebar-logo-wrap img {
  height: 26px;
  width: auto;
}

/* ── SIDEBAR NAV ─────────────────────────────────────────── */
.sidebar-nav { padding: 8px 10px; flex: 1; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 16px 6px 4px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.65);
  transition: all .15s;
  margin-bottom: 2px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-link span { font-size: 15px; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link--active { background: var(--primary, #1a56a0); color: #fff !important; }
.sidebar-link--tenant { font-size: 12px; color: #94a3b8 !important; }
.sidebar-link--tenant:hover { background: rgba(255,255,255,.06); }
.sidebar-ext { margin-left: auto; font-size: 10px; opacity: .5; }

/* ── SIDEBAR USER ────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,.45); }
.sidebar-logout {
  color: rgba(255,255,255,.4);
  font-size: 16px;
  cursor: pointer;
  transition: color .15s;
  flex-shrink: 0;
  text-decoration: none;
  padding: 4px;
}
.sidebar-logout:hover { color: #f87171; }

/* ── ADMIN MAIN ──────────────────────────────────────────── */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.admin-topbar {
  background: var(--white, #fff);
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

/* Hamburger button — mobile only */
.topbar-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) { .topbar-hamburger { display: none; } }

.admin-topbar-context { font-size: 12px; color: #94a3b8; font-weight: 500; display: none; }
@media (min-width: 480px) { .admin-topbar-context { display: block; } }
.admin-topbar-tenant { font-size: 13px; font-weight: 700; color: #1e293b; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
@media (min-width: 640px) { .admin-topbar-tenant { max-width: 340px; } }

/* ── ADMIN CONTENT ───────────────────────────────────────── */
.admin-content { padding: 20px 16px; flex: 1; }
@media (min-width: 640px) { .admin-content { padding: 24px; } }
@media (min-width: 1024px) { .admin-content { padding: 28px 32px; } }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 800; color: #1e293b; }
@media (min-width: 640px) { .page-title { font-size: 24px; } }
.page-sub { font-size: 13px; color: #64748b; margin-top: 2px; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.table th { background: #f8fafc; padding: 11px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; border-bottom: 1px solid #e2e8f0; white-space: nowrap; text-align: left; }
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ── SEARCH BAR (admin normas) ───────────────────────────── */
.search-bar-admin { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar-admin .form-control { flex: 1; min-width: 160px; }

/* ── ACTION BUTTONS in table ─────────────────────────────── */
.actions { display: flex; gap: 4px; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; background: #f8fafc; border: 1px solid #e2e8f0; font-size: 14px; cursor: pointer; transition: all .15s; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.action-btn:hover { background: #eff6ff; border-color: #1a56a0; }
.action-btn--danger:hover { background: #fff1f2; border-color: #fecdd3; }

/* ── STATS GRID (dashboard) ──────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 16px; }
.stat-card-n { font-size: 28px; font-weight: 900; color: var(--primary, #1a56a0); line-height: 1; }
.stat-card-l { font-size: 11px; color: #64748b; margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ── FORM CARD ───────────────────────────────────────────── */
.form-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 1px 6px rgba(0,0,0,.06); overflow: hidden; max-width: 800px; }
.form-card-head { padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.form-card-body { padding: 20px; }
@media (min-width: 640px) { .form-card-body { padding: 24px; } }
.form-card-title { font-size: 15px; font-weight: 700; color: #1e293b; }

/* ── ADMIN LOGIN ─────────────────────────────────────────── */
.login-body { background: #f1f5f9; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,.12); border: 1px solid #e2e8f0; width: 100%; max-width: 380px; padding: 28px 22px; text-align: center; }
@media (min-width: 480px) { .login-card { padding: 36px; } }
.login-title { font-size: 18px; font-weight: 800; color: #1e293b; }
.login-sub { font-size: 13px; color: #64748b; margin-top: 4px; margin-bottom: 20px; }
.login-form { text-align: left; }

/* ── FILTER PANEL (admin normas) ─────────────────────────── */
.filter-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
@media (min-width: 640px) { .filter-panel { padding: 16px 20px; } }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-group label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.filter-group .form-control { font-size: 13px; height: 38px; padding: 0 10px; }
@media (max-width: 480px) {
  .filter-group .form-control { font-size: 16px; } /* prevent iOS zoom */
}
.filter-group--grow { flex: 1; min-width: 200px; }
.search-input-wrap { position: relative; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-input-wrap input { padding-left: 34px !important; }
.chips-row { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips-row::-webkit-scrollbar { display: none; }
.chip { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; text-decoration: none; border: 1px solid #e2e8f0; color: #64748b; background: #fff; transition: all .15s; white-space: nowrap; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.chip:hover { border-color: #1a56a0; color: #1a56a0; }
.chip--active { background: #1a56a0; color: #fff; border-color: #1a56a0; }

/* ── RESPONSIVE ADJUSTMENTS ──────────────────────────────── */
@media (max-width: 480px) {
  .page-header { gap: 8px; }
  .page-header .btn { font-size: 12px; padding: 8px 12px; }
  .table th, .table td { padding: 10px 10px; font-size: 12px; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card-n { font-size: 22px; }
}

/* ── ALERTS ──────────────────────────────────────────────── */
.alert { padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 6px; }
.form-control { width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: #1e293b; background: #fff; transition: border-color .15s; -webkit-appearance: none; appearance: none; }
.form-control:focus { outline: none; border-color: var(--primary, #1a56a0); box-shadow: 0 0 0 3px rgba(26,86,160,.12); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 540px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-hint { font-size: 11px; color: #64748b; margin-top: 4px; }
.form-hint-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #1d4ed8; margin-bottom: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; flex-wrap: wrap; }

/* ── BADGE ───────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; border: 1px solid; white-space: nowrap; }
.badge-type--lei              { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-type--lei_complementar { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.badge-type--lei_organica     { background: #eff6ff; color: #1e40af; border-color: #93c5fd; }
.badge-type--emenda_lo        { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.badge-type--decreto          { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-type--portaria         { background: #f0fdf4; color: #065f46; border-color: #a7f3d0; }
.badge-type--resolucao        { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-type--instrucao        { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.badge-success  { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-error    { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-info     { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-secondary{ background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.badge-pdf      { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-role--superadmin { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.badge-role--master     { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-role--editor     { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; flex-wrap: wrap; }
.pag-btn { font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid #e2e8f0; color: #64748b; background: #fff; cursor: pointer; transition: all .15s; min-width: 40px; min-height: 40px; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.pag-btn:hover:not(.pag-btn--disabled):not(.pag-btn--active) { border-color: var(--primary, #1a56a0); color: var(--primary, #1a56a0); }
.pag-btn--active { background: var(--primary, #1a56a0); color: #fff; border-color: var(--primary, #1a56a0); }
.pag-btn--disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.pag-ellipsis { color: #94a3b8; font-size: 13px; padding: 0 4px; }

/* ── BUTTON ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; border: none; transition: all .15s; text-decoration: none; min-height: 40px; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--primary, #1a56a0); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-outline { background: #fff; color: #1e293b; border: 1px solid #e2e8f0; }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; min-height: 32px; }
.btn-block { width: 100%; }

/* ── TEXT UTIL ───────────────────────────────────────────── */
.text-muted { color: #64748b; font-size: 12px; }
