:root {
  --ink: #0b2a55;
  --ink-2: #071d3d;
  --ink-3: #16396b;
  --accent: #1550a3;
  --accent-dark: #0e3f85;
  --accent-light: #e3edf9;
  --muted: #a9bedb;
  --bg: #f3f6fa;
}
* { box-sizing: border-box; }
body { background: var(--bg); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: #1f2937; }
a { color: var(--accent-dark); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--accent-dark) !important; border-color: var(--accent-dark) !important; }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
.text-accent { color: var(--accent) !important; }
.badge-accent { background: var(--accent-light); color: var(--accent-dark); }
.form-control:focus { border-color: #7aa7e0; box-shadow: 0 0 0 .2rem rgba(21,80,163,.18); }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: var(--ink); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s; }
.sidebar .brand { background: var(--ink-2); height: 60px; padding: 0 18px; display: flex; align-items: center; gap: 10px; border-bottom: 2px solid var(--accent); }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--ink); border: 2px solid #9cc3f0; font-weight: 800; display: grid; place-items: center; font-size: 1.1rem; }
.brand-text { color: #fff; font-weight: 700; font-size: .92rem; }
.brand-sub { color: #9cc3f0; font-size: .68rem; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 0 14px; }
.nav-section { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.3px; color: #7f9cc4; padding: 16px 20px 5px; font-weight: 600; }
.sidebar .nav-link { color: var(--muted); padding: 8px 16px 8px 20px; font-size: .86rem; display: flex; align-items: center; gap: 9px; border-left: 3px solid transparent; }
.sidebar .nav-link:hover { color: #fff; background: rgba(21,80,163,.12); text-decoration: none; }
.sidebar .nav-link.active { color: #fff; background: rgba(21,80,163,.22); border-left-color: var(--accent); font-weight: 600; }
.sidebar-footer { border-top: 1px solid var(--ink-3); padding: 8px 0; }
.sidebar-backdrop { display: none; }

.main-content { margin-left: 240px; min-height: 100vh; }
.topbar { background: #fff; height: 60px; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 1000; }
.topbar-title { font-weight: 700; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.page { padding: 24px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030; }
  .main-content { margin-left: 0; }
  .page { padding: 16px; }
}

.card { border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eef0f4; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: #64748b; border-top: 0; }
.table td { vertical-align: middle; }
.stat { padding: 18px; }
.stat .valor { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat .rotulo { color: #64748b; font-size: .8rem; margin-top: 4px; }
.progress { height: 8px; border-radius: 8px; background: #eef0f4; }
.progress-bar { background: var(--accent); }
.progress-bar.completo { background: #16a34a; }
.posicao { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; background: #eef0f4; }
.posicao.p1 { background: #fde68a; color: #92400e; }
.posicao.p2 { background: #e5e7eb; color: #374151; }
.posicao.p3 { background: #fed7aa; color: #9a3412; }

/* Login */
.tela-login { min-height: 100vh; display: flex !important; flex-direction: column; justify-content: center; align-items: center; background: radial-gradient(1200px 600px at 10% -10%, #1a4f96 0%, var(--ink-2) 55%); display: grid; place-items: center; padding: 20px; }
.tela-login .card { width: 100%; max-width: 400px; border: 0; border-radius: 16px; }
.tela-login .icone { width: 54px; height: 54px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.5rem; margin: 0 auto 12px; }

/* Área do jurado (mobile-first) */
.jurado-topo { background: var(--ink); color: #fff; padding: 14px 16px; position: sticky; top: 0; z-index: 100; display: flex; justify-content: space-between; align-items: center; }
.jurado-topo a { color: #9cc3f0; }
.jurado-pagina { max-width: 720px; margin: 0 auto; padding: 16px 14px 90px; }
.item-card { display: flex; gap: 12px; align-items: center; padding: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 10px; color: inherit; }
.item-card:hover { text-decoration: none; border-color: #9cc3f0; color: inherit; }
.item-card .icone { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-light); color: var(--accent-dark); display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.item-card.feito .icone { background: #dcfce7; color: #15803d; }
.criterio { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.criterio.faltando { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.15); }
.notas { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.notas input { position: absolute; opacity: 0; pointer-events: none; }
.notas label { margin: 0; padding: 12px 0; text-align: center; border: 1.5px solid #d1d5db; border-radius: 10px; font-weight: 700; font-size: 1.05rem; cursor: pointer; user-select: none; background: #fff; }
.notas input:checked + label { background: var(--accent); border-color: var(--accent); color: #fff; }
.notas input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 576px) { .notas { grid-template-columns: repeat(10, 1fr); } }
.video { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.barra-enviar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid #e5e7eb; padding: 10px 14px; z-index: 100; }
.barra-enviar .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }

/* Marca Expo Gênesis */
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; }
.jurado-topo .brand-logo { width: 34px; height: 34px; }
.logo-login { display: block; width: 140px; max-width: 40vw; margin: 0 auto 22px; }
.logo-login img { width: 100%; height: auto; }

/* Responsividade */
.col-progresso { min-width: 160px; }
.col-posicao { width: 56px; }
.topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar > div:first-child { min-width: 0; }
.tela-login, .capa { min-height: 100dvh; }
.main-content { min-height: 100dvh; }
@media (max-width: 575.98px) {
  .col-progresso { min-width: 100px; }
  .col-posicao { width: 44px; }
  .page { padding: 12px; }
  .topbar { padding: 0 12px; }
  .table td, .table th { padding-left: .5rem; padding-right: .5rem; }
  .nav-pills .nav-link { padding: .4rem .7rem; font-size: .9rem; }
  /* iOS dá zoom em campos com fonte < 16px */
  input.form-control, select.form-control, textarea.form-control { font-size: 16px; }
}

/* Áreas seguras (iPhone com notch, app instalado em tela cheia) */
.jurado-topo { padding-top: calc(14px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
.jurado-pagina { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.barra-enviar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.topbar { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
.sidebar .brand { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
.sidebar-footer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }

/* Aviso de instalação do app (PWA) */
.pwa-instalar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 1060; max-width: 440px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(7,29,61,.35); }
.pwa-instalar img { width: 40px; height: 40px; flex-shrink: 0; }
.pwa-instalar .texto { flex: 1; font-size: .88rem; line-height: 1.3; }
.pwa-instalar .texto small { color: #9cc3f0; display: block; }
.pwa-instalar .btn-instalar { background: #f5b82e; color: var(--ink); font-weight: 700; border: 0; }
.pwa-instalar .fechar { background: none; border: 0; color: #9cc3f0; font-size: 1.3rem; line-height: 1; padding: 0 2px; }
body.tem-barra-enviar .pwa-instalar { bottom: calc(76px + env(safe-area-inset-bottom)); }
.offline-aviso { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; background: #b91c1c; color: #fff; text-align: center; font-size: .85rem; padding: calc(4px + env(safe-area-inset-top)) 8px 4px; }
@media print { .pwa-instalar, .offline-aviso { display: none !important; } }

/* Avaliação por rubrica (jurado) */
.rub-status { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.rub-mapa { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 12px; }
.rub-mapa button { border: 1.5px solid #d1d5db; background: #fff; border-radius: 8px; padding: 7px 0; font-weight: 700; font-size: .85rem; color: #475569; }
.rub-mapa button.feito { background: var(--accent-light); border-color: #9cc3f0; color: var(--accent-dark); }
.rub-mapa button.atual { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(21,80,163,.25); color: var(--ink); }
.rub-mapa .rub-mapa-revisao { color: var(--accent); }
.rub-criterio { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.rub-criterio.faltando { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.15); }
.rub-js .rub-criterio { display: none; }
.rub-js .rub-criterio.ativo { display: block; }
.rub-pergunta { font-size: 1.02rem; margin-bottom: 8px; }
.rub-ajuda, .rub-obs { font-size: .9rem; margin-bottom: 10px; }
.rub-ajuda summary, .rub-obs summary { color: var(--accent-dark); cursor: pointer; padding: 4px 0; }
.rub-ajuda[open] { background: #f8fafc; border-radius: 8px; padding: 4px 10px 10px; }
.rub-opcoes { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.rub-opcoes input { position: absolute; opacity: 0; pointer-events: none; }
.rub-opcao { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px; border: 1.5px solid #d1d5db; border-radius: 10px; cursor: pointer; background: #fff; min-height: 48px; }
.rub-opcao .rub-num { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: #eef2f7; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.rub-opcao .rub-txt { display: flex; flex-direction: column; font-size: .92rem; line-height: 1.35; }
.rub-opcao .rub-txt span { color: #475569; margin-top: 2px; }
.rub-opcoes input:checked + .rub-opcao { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 1px var(--accent); }
.rub-opcoes input:checked + .rub-opcao .rub-num { background: var(--accent); color: #fff; }
.rub-opcoes input:focus-visible + .rub-opcao { outline: 2px solid var(--accent); outline-offset: 2px; }
.rub-somente-leitura .rub-opcao { cursor: default; }
.rub-somente-leitura .rub-opcoes input:not(:checked) + .rub-opcao { opacity: .55; }
.rub-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.rub-nav .btn { flex: 1; padding: 10px; }
.rub-lista li button { width: 100%; display: flex; gap: 10px; align-items: baseline; text-align: left; background: none; border: 0; border-bottom: 1px solid #eef0f4; padding: 9px 2px; color: inherit; }
.rub-lista .codigo { font-weight: 800; color: var(--accent-dark); width: 36px; flex-shrink: 0; }
.rub-lista .nome { flex: 1; }
.rub-lista .valor { font-weight: 600; font-size: .88rem; text-align: right; }
.rub-lista button.falta .valor { color: #dc2626; }
.rub-acoes { display: flex; flex-wrap: wrap; gap: 10px; }
.rub-acoes .btn-lg { flex: 1; }
.escala { height: 10px; background: #eef0f4; border-radius: 5px; overflow: hidden; margin: 4px 0 2px; }
.escala > div { height: 100%; background: var(--accent); border-radius: 5px; }
@media print { .escala > div { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
