/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a56a0;
  --accent:  #e8a020;
  --text:    #1e293b;
  --muted:   #64748b;
  --border:  #e2e8f0;
  --bg:      #f8fafc;
  --white:   #ffffff;
  --radius:  12px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 860px; }

/* ── TOP BAR ─────────────────────────────────────────────── */
#topbar { background: #0f1628; position: sticky; top: 0; z-index: 1000; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 12px; height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.topbar-links { display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.topbar-links::-webkit-scrollbar { display: none; }
.topbar-link { display: flex; align-items: center; gap: 4px; font-size: 10px; color: rgba(255,255,255,.55); padding: 0 8px; border-right: 1px solid rgba(255,255,255,.1); white-space: nowrap; transition: color .15s; font-weight: 500; }
.topbar-link:hover { color: #fff; }
.topbar-link:last-child { border-right: none; }
.topbar-link svg { flex-shrink: 0; }
.topbar-a11y { display: flex; align-items: center; gap: 3px; border-left: 1px solid rgba(255,255,255,.1); padding-left: 8px; flex-shrink: 0; }
.a11y-label { font-size: 10px; color: rgba(255,255,255,.25); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-right: 4px; display: none; }
@media (min-width: 768px) { .a11y-label { display: inline; } }
.a11y-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 4px; font-size: 10px; font-weight: 700; padding: 2px 6px; cursor: pointer; transition: all .15s; line-height: 1.4; }
.a11y-btn:hover { background: rgba(255,255,255,.18); }
.a11y-btn--on { background: #fde047; color: #1a1a1a; border-color: #fbbf24; }

/* ── NAVBAR ──────────────────────────────────────────────── */
.navbar { background: var(--white); border-bottom: 1px solid var(--border); box-shadow: 0 1px 8px rgba(0,0,0,.06); }
.navbar-inner { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; max-width: 1200px; margin: 0 auto; }
.navbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.navbar-coat { height: 40px; width: 40px; object-fit: contain; flex-shrink: 0; }
.navbar-initials { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.navbar-title { display: none; min-width: 0; }
@media (min-width: 480px) { .navbar-title { display: block; } }
.navbar-subtitle { display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.navbar-name { display: block; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
@media (min-width: 768px) { .navbar-name { max-width: 340px; font-size: 14px; } }

/* ── HERO ────────────────────────────────────────────────── */
.hero { color: #fff; padding: 36px 0 32px; }
@media (min-width: 640px) { .hero { padding: 56px 0 48px; } }
.hero-inner { text-align: center; padding: 0 16px; }
.hero-coat { height: 64px; width: 64px; object-fit: contain; margin: 0 auto 14px; filter: drop-shadow(0 4px 16px rgba(0,0,0,.3)); }
@media (min-width: 640px) { .hero-coat { height: 80px; width: 80px; } }
.hero-initials { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.15); border: 2px solid rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; margin: 0 auto 14px; }
@media (min-width: 640px) { .hero-initials { width: 80px; height: 80px; font-size: 28px; } }
.hero-sub { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .2em; opacity: .5; margin-bottom: 6px; }
.hero-title { font-size: clamp(18px, 5vw, 36px); font-weight: 900; margin-bottom: 8px; line-height: 1.2; }
.hero-desc { opacity: .6; font-size: 13px; margin-bottom: 24px; }
@media (min-width: 640px) { .hero-desc { font-size: 14px; margin-bottom: 32px; } }
.hero-stats { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
@media (min-width: 640px) { .hero-stats { gap: 32px; margin-top: 32px; } }
.hero-stat-n { display: block; font-size: 22px; font-weight: 900; }
@media (min-width: 640px) { .hero-stat-n { font-size: 28px; } }
.hero-stat-l { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; opacity: .45; margin-top: 2px; }
.hero-stat-sep { color: rgba(255,255,255,.3); font-size: 20px; line-height: 1; }
.hero-stat--small .hero-stat-n { font-size: 13px; font-weight: 600; }

/* ── SEARCH ──────────────────────────────────────────────── */
.search-form { display: flex; justify-content: center; }
.search-wrap { position: relative; display: flex; align-items: center; max-width: 680px; width: 100%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.2); border-radius: 14px; padding: 4px; }
.search-icon { position: absolute; left: 12px; color: rgba(255,255,255,.6); pointer-events: none; flex-shrink: 0; }
.search-input { flex: 1; background: transparent; border: none; outline: none; color: #fff; font-size: 14px; padding: 10px 10px 10px 38px; min-width: 0; }
@media (min-width: 640px) { .search-input { font-size: 15px; padding: 10px 12px 10px 44px; } }
.search-input::placeholder { color: rgba(255,255,255,.5); }

/* ── SECTION ─────────────────────────────────────────────── */
.section { padding: 24px 0 48px; }
@media (min-width: 640px) { .section { padding: 32px 0 64px; } }

/* ── FILTERS ─────────────────────────────────────────────── */
.filters-bar { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-types { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; width: 100%; }
.filters-types::-webkit-scrollbar { display: none; }
.filters-selects { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); background: var(--white); cursor: pointer; transition: all .15s; white-space: nowrap; flex-shrink: 0; }
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip--active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-select { font-size: 12px; font-weight: 600; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--white); color: var(--text); cursor: pointer; }
.results-count { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

/* ── NORM CARDS GRID ─────────────────────────────────────── */
.norms-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 540px) { .norms-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .norms-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.norm-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: block; transition: all .2s; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.norm-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,.1); }
@media (hover: none) { .norm-card:hover { transform: none; } }
.norm-card:active { transform: scale(.98); }
.norm-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.norm-date { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.norm-card-number { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.4; margin-bottom: 6px; }
.norm-card-ementa { font-size: 12px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.norm-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.norm-card-more { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ── BADGES ──────────────────────────────────────────────── */
.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-danger   { 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-purple   { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-secondary{ background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.badge-pdf      { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-html     { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.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: 32px; flex-wrap: wrap; }
.pag-btn { font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); color: var(--muted); background: var(--white); cursor: pointer; transition: all .15s; min-width: 40px; text-align: center; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.pag-btn:hover:not(.pag-btn--disabled):not(.pag-btn--active) { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.pag-btn--active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pag-btn--disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.pag-ellipsis { color: var(--muted); font-size: 13px; padding: 0 4px; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-weight: 700; font-size: 16px; color: var(--text); }
.empty-sub   { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── NORM DETAIL PAGE ────────────────────────────────────── */
.norm-detail { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.norm-detail-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 16px 0; }
@media (min-width: 640px) { .norm-detail-header { padding: 20px 24px 0; } }
.norm-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.norm-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.norm-detail-title { font-size: clamp(16px, 3.5vw, 22px); font-weight: 800; color: var(--text); padding: 12px 16px 4px; }
@media (min-width: 640px) { .norm-detail-title { padding: 16px 24px 4px; } }
.norm-detail-subtitle { font-size: 13px; color: var(--muted); padding: 0 16px 16px; }
@media (min-width: 640px) { .norm-detail-subtitle { font-size: 14px; padding: 0 24px 20px; } }
.norm-detail-meta { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--border); }
@media (min-width: 640px) { .norm-detail-meta { grid-template-columns: repeat(4, 1fr); } }
.norm-meta-item { padding: 12px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
@media (min-width: 640px) { .norm-meta-item { padding: 16px; border-bottom: none; } }
.norm-meta-item:last-child { border-right: none; }
.norm-meta-item:nth-child(even) { border-right: none; }
@media (min-width: 640px) { .norm-meta-item:nth-child(even) { border-right: 1px solid var(--border); } }
.norm-meta-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 2px; }
.norm-meta-value { font-size: 13px; font-weight: 700; color: var(--text); }
@media (min-width: 640px) { .norm-meta-value { font-size: 14px; } }
.norm-ementa-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.norm-ementa-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 6px; }
.norm-ementa-text { font-size: 13px; color: var(--text); line-height: 1.7; font-style: italic; }
@media (min-width: 640px) { .norm-ementa-text { font-size: 14px; } }
.norm-published { font-size: 12px; color: var(--muted); margin-top: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 20px; transition: color .15s; padding: 6px 0; }
.back-link:hover { color: var(--primary); }

/* ── CARDS ───────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.card-accent { height: 4px; background: var(--primary); }
.card-body { padding: 16px; }
@media (min-width: 640px) { .card-body { padding: 24px; } }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
@media (min-width: 640px) { .card-head { padding: 16px 20px; } }
.card-title { font-weight: 700; font-size: 14px; color: var(--text); }

/* ── FOOTER ──────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); background: var(--white); margin-top: 48px; }
@media (min-width: 640px) { .footer { margin-top: 64px; } }
.footer-inner { max-width: 800px; margin: 0 auto; padding: 32px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.footer-logo { height: 32px; width: auto; margin: 0 auto 16px; }
@media (min-width: 640px) { .footer-logo { height: 36px; margin-bottom: 20px; } }
.footer-desc { font-size: 12px; color: var(--muted); line-height: 1.7; max-width: 480px; margin-bottom: 20px; }
@media (min-width: 640px) { .footer-desc { font-size: 13px; max-width: 560px; margin-bottom: 24px; } }
.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.footer-copy { border-top: 1px solid var(--border); width: 100%; padding-top: 16px; }
.footer-copy p { font-size: 11px; color: #94a3b8; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.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; -webkit-tap-highlight-color: transparent; min-height: 40px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: .88; }
.btn-outline { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #f8fafc; }
.btn-secondary { background: #334155; color: #fff; }
.btn-secondary:hover { opacity: .88; }
.btn-whatsapp { background: #25D366; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; min-height: 32px; }
.btn-block { width: 100%; }
.btn--disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ── 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 var(--border); border-radius: 10px; padding: 11px 14px; font-size: 16px; /* 16px prevents iOS zoom */ color: var(--text); background: var(--white); transition: border-color .15s; -webkit-appearance: none; appearance: none; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,160,.12); }
.form-control--mono { font-family: 'Courier New', Courier, monospace; font-size: 12px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
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: var(--muted); 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; }

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

/* ── CONTACT PAGE ────────────────────────────────────────── */
.contact-channels { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px; }
@media (min-width: 480px) { .contact-channels { grid-template-columns: 1fr 1fr; } }
.contact-channel { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; transition: all .15s; }
.contact-channel:hover { border-color: var(--primary); background: #f0f7ff; }
.channel-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; flex-shrink: 0; }
.contact-form { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.text-muted { color: var(--muted); font-size: 12px; }

/* ── LOGIN ───────────────────────────────────────────────── */
.login-body { background: #f1f5f9; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--white); border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,.12); border: 1px solid var(--border); width: 100%; max-width: 380px; padding: 28px 24px; text-align: center; }
@media (min-width: 480px) { .login-card { padding: 36px; } }
.login-coat { height: 52px; width: 52px; object-fit: contain; margin: 0 auto 14px; }
.login-initials { width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; margin: 0 auto 14px; }
.login-title { font-size: 18px; font-weight: 800; color: var(--text); }
.login-sub { font-size: 13px; color: var(--muted); margin-top: 4px; margin-bottom: 20px; }
.login-form { text-align: left; }
.section-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.section-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.file-existing { display: flex; align-items: center; gap: 12px; padding: 10px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; flex-wrap: wrap; }

/* ── HERO STATS ──────────────────────────────────────────── */
.hero-stat-sep { color: rgba(255,255,255,.3); font-size: 20px; line-height: 1; }
.hero-stat--small .hero-stat-n { font-size: 13px; font-weight: 600; }
.hero-stat-n--sm { font-size: 13px !important; font-weight: 600 !important; }

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

/* ── UTILITY ─────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
