/* ============================================================
   Leis Municipais — Design System
   Inspirado no design com fundo off-white, DM Sans, cards limpos
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
  --bg:            #FFFCFC;
  --bg-2:          #F5F1EB;
  --surface:       #FFFFFF;
  --accent:        #2B4BFF;
  --accent-bg:     #EAF0FF;
  --accent-hover:  #1a38e8;
  --text:          #1A1A1A;
  --text-2:        #5A5650;
  --border:        #D6D0C8;
  --border-light:  #E8E3DB;
  --footer-bg:     #1A1A1A;

  /* Law type colors */
  --lei-bg:        #EAF0FF; --lei-color:     #2B4BFF;
  --comp-bg:       #F0FFF4; --comp-color:    #16A34A;
  --dec-bg:        #FFF7ED; --dec-color:     #C2530A;
  --res-bg:        #FDF4FF; --res-color:     #9333EA;
  --port-bg:       #F0F9FF; --port-color:    #0369A1;

  /* Semantic */
  --success:       #16A34A;
  --success-bg:    #F0FFF4;
  --warning:       #C2530A;
  --warning-bg:    #FFF7ED;
  --danger:        #DC2626;
  --danger-bg:     #FEF2F2;
  --info-bg:       #EAF0FF;

  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-pill: 999px;

  --shadow-hover: 0 4px 20px rgba(0,0,0,0.08);

  --sidebar-w:  240px;
  --navbar-h:   64px;
  --font:       'DM Sans', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
input,textarea,select,button { font-family: var(--font); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Skeleton ───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #E8E3DB 25%, #F0EDE8 50%, #E8E3DB 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--navbar-h);
  background: #1e3d72;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand:hover { color: #ffffff; opacity: 0.85; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.navbar-links a {
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s;
}
.navbar-links a:hover { border-bottom-color: rgba(255,255,255,0.6); color: #ffffff; }

.btn-nav {
  border: 1.5px solid #ffffff !important;
  background: transparent;
  color: #ffffff !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-nav:hover { background: #ffffff !important; color: #1e3d72 !important; }

.btn-nav-logout {
  font-size: 14px;
  color: rgba(255,255,255,0.75) !important;
  font-weight: 500;
  cursor: pointer;
}
.btn-nav-logout:hover { color: #ffffff !important; }

/* ── Hero (substitui banner) ─────────────────────────── */
.hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  padding: 56px 48px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-badge {
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-badge-img {
  display: block;
  width: 150px;
  max-width: 100%;
  margin-bottom: 20px;
  mix-blend-mode: multiply;
}


.hero-subtitle {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 32px;
}

/* ── Search (hero) ──────────────────────────────────── */
.search-section {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-wrapper {
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-2); }

.search-filters {
  display: flex;
  gap: 12px;
}

.filter-select-wrap {
  position: relative;
  flex: 1;
}

.filter-select-wrap select {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text-2);
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select-wrap select:focus { border-color: var(--accent); }
.filter-select-wrap select.has-value { color: var(--text); }

.filter-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  pointer-events: none;
}

/* ── Container ──────────────────────────────────────── */
.container {
  max-width: 1296px;
  margin: 0 auto;
  padding: 48px 48px 0;
  flex: 1;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.results-count {
  font-size: 14px;
  color: var(--text-2);
}

.clear-filters-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
}
.clear-filters-btn:hover { text-decoration: underline; }

/* ── Law Cards Grid ─────────────────────────────────── */
.leis-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 0;
}

.lei-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: default;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.lei-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Partes internas do card — não usadas no layout row, mantidas para compatibilidade */
.lei-card-left  { display: contents; }
.lei-card-body  { display: contents; }

/* Type badge */
.lei-tipo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  margin-bottom: 12px;
  align-self: flex-start;
  white-space: nowrap;
}
.tipo-lei-ordinaria    { background: var(--lei-bg);    color: var(--lei-color); }
.tipo-lei-complementar { background: var(--comp-bg);   color: var(--comp-color); }
.tipo-decreto          { background: var(--dec-bg);    color: var(--dec-color); }
.tipo-resolucao        { background: var(--res-bg);    color: var(--res-color); }
.tipo-portaria         { background: var(--port-bg);   color: var(--port-color); }
.tipo-default          { background: var(--accent-bg); color: var(--accent); }

.lei-numero {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.lei-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.lei-descricao {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lei-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.lei-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: 12px;
}

.btn-download {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-download:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Auth Pages ─────────────────────────────────────── */
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.auth-logo {
  color: var(--accent);
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-logo svg { width: 36px; height: 36px; }

.auth-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-footer-text {
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  margin-top: 18px;
}
.auth-footer-text a { color: var(--accent); font-weight: 600; }
.auth-footer-text a:hover { text-decoration: underline; }

/* ── Admin Shell ────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-h));
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  position: sticky;
  top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 16px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover { background: var(--bg-2); color: var(--text); }
.sidebar-link.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.sidebar-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 8px 16px;
}

.sidebar-link-logout:hover { color: var(--danger); background: var(--danger-bg); }

/* Admin main */
.admin-main {
  flex: 1;
  background: var(--bg);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: var(--navbar-h);
  z-index: 50;
}

.admin-page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.admin-user {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

.admin-content {
  padding: 24px 28px;
  flex: 1;
}

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-blue   .stat-icon { background: var(--accent-bg); }
.stat-green  .stat-icon { background: var(--success-bg); }
.stat-orange .stat-icon { background: var(--warning-bg); }
.stat-purple .stat-icon { background: var(--res-bg); }

.stat-info { display: flex; flex-direction: column; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 4px;
}

/* ── Admin Card ─────────────────────────────────────── */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.admin-card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Table ──────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.table thead th {
  padding: 10px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: #FFFCFC; }

.table tbody td {
  padding: 12px 20px;
  vertical-align: middle;
  color: var(--text-2);
}

.table code {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Forms ──────────────────────────────────────────── */
.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus { border-color: var(--accent); }

input::placeholder, textarea::placeholder { color: var(--text-2); }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

input[type="file"] {
  font-size: 14px;
  color: var(--text-2);
  background: var(--bg);
  padding: 10px 14px;
  cursor: pointer;
}

.required { color: var(--danger); margin-left: 2px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }

.btn-sm {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
}

.btn-block { width: 100%; }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-bg); border-color: #bbf7d0; color: #166534; }
.alert-error   { background: var(--danger-bg);  border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-bg); border-color: #fed7aa; color: #9a3412; }
.alert-info    { background: var(--info-bg);    border-color: #bfdbfe; color: #1e40af; }
.alert a { font-weight: 700; text-decoration: underline; color: inherit; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-blue   { background: var(--accent-bg);  color: var(--accent); }
.badge-green  { background: var(--success-bg);  color: var(--success); }
.badge-orange { background: var(--warning-bg);  color: var(--warning); }
.badge-red    { background: var(--danger-bg);   color: var(--danger); }
.badge-gray   { background: #F5F1EB;            color: var(--text-2); }
.badge-purple { background: var(--res-bg);      color: var(--res-color); }

/* ── Pagination ─────────────────────────────────────── */
.paginacao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 0 20px;
  flex-wrap: wrap;
}
.paginacao-admin { justify-content: flex-start; padding: 14px 20px; }

.pag-link {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 500;
}
.pag-link:hover { border-color: var(--accent); color: var(--accent); }
.pag-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  padding: 80px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.empty-icon { font-size: 64px; line-height: 1; }
.empty-state h2 { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-state p { font-size: 14px; color: var(--text-2); max-width: 300px; line-height: 1.6; }

/* ── File Upload ─────────────────────────────────────── */
.file-upload-wrapper {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg);
  transition: border-color 0.15s;
}
.file-upload-wrapper:hover { border-color: var(--accent); }

.file-hint { font-size: 12px; color: var(--text-2); margin-top: 8px; }

.file-atual {
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  margin-bottom: 10px;
}

/* ── Inline Form ─────────────────────────────────────── */
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-sm {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.input-sm:focus { border-color: var(--accent); background: var(--surface); }

.select-sm {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}
.select-sm:focus { border-color: var(--accent); }

/* ── Link Download ───────────────────────────────────── */
.link-download {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.link-download:hover { text-decoration: underline; color: var(--accent-hover); }

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  margin-top: 48px;
}

.site-footer p {
  font-size: 13px;
  color: #AAAAAA;
}

/* ── Utilities ───────────────────────────────────────── */
.text-muted { color: var(--text-2) !important; }
.text-sm    { font-size: 13px; }
.p-4        { padding: 16px; }
.mb-1       { margin-bottom: 4px; }
.mb-2       { margin-bottom: 8px; }
.mb-3       { margin-bottom: 12px; }
.mb-4       { margin-bottom: 16px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .leis-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { padding: 0 24px; }
  .hero { padding: 48px 24px 40px; }
  .container { padding: 32px 24px 0; }
  .site-footer { padding: 0 24px; }
}

@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }

  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }

  .sidebar-brand { display: none; }
  .sidebar-section-label { display: none; }
  .sidebar-nav { flex-direction: row; gap: 2px; padding: 0; }
  .sidebar-link { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .sidebar-icon { width: 20px; height: 20px; font-size: 14px; }
  .sidebar-divider { display: none; }
}

@media (max-width: 640px) {
  :root { --navbar-h: 56px; }

  .navbar { padding: 0 16px; }
  .navbar-links { gap: 0; }
  .navbar-links a:not(.btn-nav):not(.btn-nav-logout) { display: none; }

  .hero { padding: 40px 16px 32px; }
  .hero-title { font-size: 28px; }
  .search-filters { flex-direction: column; }

  .leis-grid { grid-template-columns: 1fr; gap: 10px; }
  .stats-grid { grid-template-columns: 1fr; }

  .container { padding: 24px 16px 0; }
  .results-bar { flex-direction: column; align-items: flex-start; gap: 8px; }

  .site-footer { padding: 0 16px; margin-top: 32px; }

  .auth-card { padding: 28px 20px; }

  .admin-content { padding: 16px; }
  .admin-topbar { padding: 0 16px; }
  .form-vertical { padding: 16px; }
  .form-actions { flex-direction: column; }
  .btn-block { width: 100%; }

  .table { font-size: 13px; }
  .table thead th, .table tbody td { padding: 10px 14px; }

  .paginacao { padding: 24px 0 16px; gap: 4px; }
}

/* ── Status Badges ─────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: .02em;
  white-space: nowrap;
}
.status-vigente  { background: #F0FFF4; color: #16A34A; border: 1px solid #bbf7d0; }
.status-alterada { background: #FFF7ED; color: #C2530A; border: 1px solid #fed7aa; }
.status-revogada { background: #F5F1EB; color: #6B6560; border: 1px solid #D6D0C8; text-decoration: line-through; }

/* ── Vínculos Legislativos ─────────────────────────── */
.vinculos-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.vinculo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg);
  font-size: .875rem;
}
.vinculo-saida  { border-left: 3px solid var(--warning); }
.vinculo-entrada { border-left: 3px solid var(--accent); }

.vinculo-dir {
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.vinculo-saida  .vinculo-dir { color: var(--warning); }
.vinculo-entrada .vinculo-dir { color: var(--accent); }

.vinculo-corpo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.vinculo-tipo {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.vinculo-lei {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.vinculo-lei:hover { text-decoration: underline; }
.vinculo-obs {
  width: 100%;
  font-size: .8rem;
  color: var(--text-2);
  font-style: italic;
  margin-top: 2px;
}

.vinculos-grupo { margin-bottom: 20px; }
.vinculos-subtitulo {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

/* ── Página de Detalhe da Lei ──────────────────────── */
.detalhe-header {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.detalhe-badges { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.detalhe-numero { font-size: .9rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.detalhe-titulo { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: 0 0 10px; line-height: 1.25; }
.detalhe-descricao { font-size: 1rem; color: var(--text-2); margin: 0 0 16px; line-height: 1.6; }
.detalhe-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.detalhe-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  color: var(--text-2);
}

.detalhe-section { margin-bottom: 28px; }
.detalhe-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.texto-integral {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  font-size: .93rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  font-family: 'Georgia', serif;
}

/* ── Histórico table tweaks ────────────────────────── */
.hist-anterior { color: var(--danger); font-size: .85rem; max-width: 220px; }
.hist-novo     { color: var(--success); font-size: .85rem; max-width: 220px; }

.btn-detalhe {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  transition: background .15s, color .15s;
}
.btn-detalhe:hover { background: var(--accent); color: #fff; }
