:root {
      --primary: #1a3a5c; --accent: #2563eb; --accent2: #dc2626;
      --bg: #f4f6f9; --card: #ffffff; --border: #e2e8f0;
      --text: #1e293b; --muted: #64748b; --radius: 10px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: var( --font-base ); background: var(--bg); color: var(--text); }

    /* ── Header ── */
    header {
      background: linear-gradient(135deg, var(--primary) 0%, #0f2744 100%);
      color: var( --color-white ); padding: 0 2rem;
      display: flex; align-items: center; justify-content: space-between;
      height: 64px; position: sticky; top: 0; z-index: 100;
      box-shadow: 0 2px 8px rgba(0,0,0,.3);
    }
    .logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; }
    .logo-text { font-family: var( --font-brand ); font-weight: 800; font-size: 1rem; line-height: 1.2; }
    .logo-text small { font-weight: 400; font-size: .72rem; opacity: .8; display: block; }
    .header-nav { display: flex; align-items: center; gap: 1.25rem; }
    .header-nav a { color: rgba(255,255,255,.92); text-decoration: none; font-size: .88rem; font-weight: 600; transition: color .15s; }
    .header-nav a:hover { color: #fff; }
    .btn-login { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
      border-radius: 6px; padding: .38rem .9rem; font-size: .84rem; color: var( --surface ) !important;
      transition: background .15s; }
    .btn-login:hover { background: rgba(255,255,255,.25) !important; }

    /* ── Hero ── */
    .hero {
      background: linear-gradient(135deg, var(--primary) 0%, #0f2744 100%);
      color: var( --color-white ); padding: 4rem 2rem 5rem; text-align: center;
    }
    .hero h1 { font-family: var( --font-brand ); font-size: 2.2rem; font-weight: 800;
      margin-bottom: .75rem; letter-spacing: -.02em; }
    .hero p { font-size: 1.05rem; opacity: .85; max-width: 520px; margin: 0 auto 2rem; line-height: 1.6; }
    .search-box {
      display: flex; max-width: 580px; margin: 0 auto;
      background: var( --surface ); border-radius: 10px; overflow: hidden;
      box-shadow: 0 4px 20px rgba(0,0,0,.3);
    }
    /* min-width:0 porque item de flex não encolhe abaixo da largura natural do
       campo (~20 caracteres): no celular ele empurrava o "Pesquisar" para fora
       da caixa, e o botão aparecia cortado em "Pesq". */
    .search-box input {
      flex: 1; min-width: 0; border: none; padding: .85rem 1.25rem; font-size: 1rem;
      outline: none; color: var(--text);
    }
    .search-box button {
      background: var(--accent); color: var( --surface ); border: none; padding: .85rem 1.5rem;
      font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .15s;
    }
    .search-box button:hover { background: #1d4ed8; }

    /* ── Stats ── */
    .stats-bar {
      background: var(--card); border-bottom: 1px solid var(--border);
      padding: 1.25rem 2rem;
      display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap;
    }
    .stat { text-align: center; }
    .stat-value { font-family: var( --font-brand ); font-size: 1.6rem; font-weight: 800;
      color: var(--primary); }
    .stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase;
      letter-spacing: .06em; margin-top: .15rem; }

    /* ── Main grid ── */
    .main { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; display: grid;
      grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
    @media (max-width: 860px) { .main { grid-template-columns: 1fr; } }

    /* ── Section headers ── */
    .section-title {
      font-family: var( --font-brand ); font-size: .95rem; font-weight: 700;
      color: var(--primary); text-transform: uppercase; letter-spacing: .06em;
      margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
    }
    .section-title::after { content:''; flex:1; height:1px; background:var(--border); }

    /* ── Edições recentes ── */
    .edicao-card {
      background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 1.1rem 1.25rem; margin-bottom: .75rem; display: flex;
      align-items: center; justify-content: space-between; gap: 1rem;
      cursor: pointer; transition: box-shadow .15s, border-color .15s;
    }
    .edicao-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.08); border-color: var(--accent); }
    /* Viraram <a href>: o runHandler nunca soube executar a atribuicao de
       window.location que estava no data-onclick, entao o cartao nao clicava. */
    .edicao-card { text-decoration: none; color: inherit; }
    .edicao-card:focus-visible,
    .tipo-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
    .edicao-num { font-family: var( --font-brand ); font-size: 1.1rem; font-weight: 700; color: var(--primary); }
    .edicao-info { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
    .badge-tipo { font-size: .7rem; font-weight: 600; padding: .2rem .55rem; border-radius: 20px;
      background: #dbeafe; color: #1e40af; }
    .badge-tipo.extra { background: #fef3c7; color: #92400e; }
    .badge-tipo.supl { background: #f3e8ff; color: #6b21a8; }
    .edicao-count { text-align: right; }
    .edicao-count strong { font-size: 1.2rem; color: var(--text); }
    .edicao-count small { display: block; font-size: .72rem; color: var(--muted); }

    /* ── Sidebar ── */
    .sidebar-card { background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
    .link-list a { display: flex; align-items: center; gap: .6rem; padding: .65rem 0;
      border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
      font-size: .88rem; transition: color .15s; }
    .link-list a:last-child { border-bottom: none; }
    .link-list a:hover { color: var(--accent); }
    .link-list .icon { font-size: 1.1rem; width: 22px; text-align: center; }

    /* ── Tipos de atos ── */
    .tipo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
    .tipo-item { background: var(--bg); border-radius: 8px; padding: .65rem .75rem;
      cursor: pointer; transition: background .15s; }
    .tipo-item:hover { background: #dbeafe; }
    .tipo-item { display: block; text-decoration: none; color: inherit; }
    .tipo-sigla { font-family: var( --font-brand ); font-weight: 700; font-size: .85rem; color: var(--primary); }
    .tipo-desc { font-size: .72rem; color: var(--muted); margin-top: .15rem;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* ── Footer ── */
    footer { background: var(--primary); color: rgba(255,255,255,.7);
      text-align: center; padding: 1.5rem; font-size: .82rem; margin-top: 3rem; }
    footer a { color: rgba(255,255,255,.5); text-decoration: none; }

    .spinner { display:inline-block; width:18px; height:18px; border:2px solid rgba(0,0,0,.1);
      border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle; }
    @keyframes spin { to { transform:rotate(360deg); } }

    .index-empty-text { color: var(--muted); font-size: .9rem; }

    /* ── Celular ── o topo ocupava a primeira tela inteira, e os quatro números
       quebravam desalinhados (dois e dois, com vãos diferentes). */
    @media (max-width: 600px) {
      .hero { padding: 2rem 1rem 2.5rem; }
      .hero h1 { font-size: 1.75rem; }
      .hero p { font-size: .95rem; margin-bottom: 1.25rem; }
      .search-box input { padding: .85rem 1rem; }
      .search-box button { padding: .85rem 1rem; }
      .stats-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem .5rem; padding: 1rem; }
      .main { margin: 1.5rem auto; padding: 0 1rem; }
    }
