/* ============================================================
   OSCE 2026-1 — Sistema de design (clínico refinado)
   Tipografia: Bricolage Grotesque (display) · Hanken Grotesk (UI) · JetBrains Mono (dados)
   ============================================================ */

:root {
  /* paleta */
  --paper:        #eef3f2;
  --paper-2:      #e7efed;
  --surface:      #ffffff;
  --surface-2:    #f6faf9;
  --ink:          #11211f;
  --ink-2:        #44595a;
  --muted:        #6b7e7d;
  --line:         #d9e5e2;
  --line-2:       #e8efed;

  --brand:        #0d6e78;
  --brand-700:    #0a525a;
  --brand-600:    #0c626b;
  --brand-50:     #e1f0f1;
  --brand-ink:    #063b40;

  --accent:       #ec6446;   /* coral — destaques/IA */
  --accent-700:   #c94d33;
  --accent-50:    #fdeae4;

  --ok:           #12925d;
  --ok-50:        #e1f5ea;
  --warn:         #bd7d10;
  --warn-50:      #fbf1da;
  --danger:       #d4374a;
  --danger-50:    #fbe6e9;

  /* tipografia */
  --f-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --f-ui: 'Hanken Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* forma */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --sh-1: 0 1px 2px rgba(11, 40, 38, .04), 0 4px 14px rgba(11, 40, 38, .06);
  --sh-2: 0 8px 30px rgba(11, 40, 38, .12);
  --sh-brand: 0 8px 22px rgba(13, 110, 120, .28);
  --ring: 0 0 0 4px rgba(13, 110, 120, .16);

  /* aliases de compatibilidade (nomes antigos usados em JS/HTML inline) */
  --azul: var(--brand);
  --azul-escuro: var(--brand-700);
  --azul-claro: var(--brand-50);
  --verde: var(--ok);
  --verde-claro: var(--ok-50);
  --vermelho: var(--danger);
  --linha: var(--line);
  --cinza: var(--muted);
  --cinza-claro: var(--surface-2);
  --tinta: var(--ink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(13,110,120,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(236,100,70,.05), transparent 55%),
    var(--paper);
  background-attachment: fixed;
  line-height: 1.5;
  font-size: 16px;
  letter-spacing: -.01em;
}
h1, h2, h3 { font-family: var(--f-display); margin: 0 0 .4em; line-height: 1.12; letter-spacing: -.02em; font-weight: 700; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand-50); }

/* ---------- Topbar ---------- */
.topo {
  position: sticky; top: 0; z-index: 40; color: #eafaf8;
  background:
    radial-gradient(700px 200px at 12% -40%, rgba(255,255,255,.16), transparent 70%),
    linear-gradient(120deg, var(--brand-700), var(--brand) 70%);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 6px 22px rgba(6, 59, 64, .22);
}
.topo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1.4px);
  background-size: 18px 18px; mask: linear-gradient(90deg, #000, transparent 65%);
}
.topo .linha { position: relative; display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 15px 18px; max-width: 1160px; margin: 0 auto; }
.topo h1 { font-size: 1.12rem; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.topo h1::before {
  content: ""; width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(236,100,70,.28);
  animation: pulso 2.2s ease-in-out infinite;
}
.topo .sub { font-size: .78rem; opacity: .82; margin-top: 3px; letter-spacing: 0; }
@keyframes pulso { 0%,100% { box-shadow: 0 0 0 3px rgba(236,100,70,.30); } 50% { box-shadow: 0 0 0 7px rgba(236,100,70,.05); } }

/* ---------- Layout ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; animation: surge .4s ease both; }
.wrap.amplo { max-width: 1160px; }
@keyframes surge { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); padding: 20px; margin-bottom: 16px;
  animation: surge .35s ease both;
}
.card h2 { font-size: 1.18rem; }
.muted { color: var(--muted); font-size: .9rem; }
code { font-family: var(--f-mono); font-size: .82em; background: var(--surface-2); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Formulários ---------- */
label.campo { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .01em; text-transform: uppercase; color: var(--ink-2); margin: 16px 0 7px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 13px 14px; font-size: 1rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #9fb0ae; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type=file] { width: 100%; font-size: .9rem; padding: 9px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
input[type=file]::file-selector-button { font-family: inherit; font-weight: 700; border: none; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; margin-right: 12px; cursor: pointer; }
textarea { min-height: 130px; resize: vertical; font-family: var(--f-mono); font-size: .85rem; line-height: 1.55; }

/* ---------- Botões ---------- */
.btn {
  --bg: var(--brand); --bg2: var(--brand-600); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 14px 18px; width: 100%;
  font-size: 1rem; font-weight: 700; color: var(--fg); letter-spacing: -.01em;
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px rgba(13,110,120,.22);
  transition: transform .06s ease, filter .15s, box-shadow .15s; position: relative;
}
.btn:hover { filter: brightness(1.05); box-shadow: var(--sh-brand); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.2); }
.btn.secundario { background: var(--surface); color: var(--brand); border: 1.5px solid var(--brand); box-shadow: var(--sh-1); }
.btn.secundario:hover { background: var(--brand-50); }
.btn.verde   { --bg:#13a268; --bg2:#0f8a58; box-shadow: 0 6px 16px rgba(18,146,93,.22); }
.btn.cinza   { --bg:#5b6f70; --bg2:#4a5c5d; box-shadow: 0 6px 16px rgba(70,90,90,.18); }
.btn.perigo  { --bg:#e0485a; --bg2:#c93444; box-shadow: 0 6px 16px rgba(212,55,74,.20); }
.btn.pequeno { width: auto; padding: 9px 14px; font-size: .86rem; border-radius: 10px; }

/* ---------- Seletores de circuito/tema ---------- */
.opcoes { display: flex; gap: 10px; flex-wrap: wrap; }
.opcao {
  flex: 1 1 auto; min-width: 84px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 13px;
  padding: 14px 12px; font-weight: 800; color: var(--ink); transition: all .14s ease;
  box-shadow: var(--sh-1);
}
.opcao:hover { border-color: var(--brand); transform: translateY(-1px); }
.opcao .pequeno { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); margin-top: 4px; letter-spacing: 0; text-transform: none; }
.opcao.ativa { border-color: var(--brand); background: var(--brand-50); color: var(--brand-ink); box-shadow: inset 0 0 0 1.5px var(--brand), var(--sh-1); }

/* ---------- Lista de alunos ---------- */
.busca { position: relative; }
.lista { margin-top: 8px; }
.aluno {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 15px; margin-bottom: 9px; transition: background .12s, transform .08s, border-color .12s;
}
.aluno:hover { background: var(--brand-50); border-color: var(--brand); transform: translateX(2px); }
.aluno:active { transform: scale(.99); }
.aluno .nome { font-weight: 700; flex: 1; }
.aluno .mat { font-size: .76rem; color: var(--muted); font-family: var(--f-mono); }
.aluno .selo { font-size: .72rem; font-weight: 800; padding: 5px 10px; border-radius: 20px; background: var(--ok-50); color: var(--ok); white-space: nowrap; font-family: var(--f-mono); }
.aluno .selo.pendente { background: var(--warn-50); color: var(--warn); }

/* ---------- Checklist ---------- */
.item {
  display: flex; align-items: flex-start; gap: 14px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 15px; margin-bottom: 11px;
  background: var(--surface); transition: border-color .14s, background .14s, transform .08s; box-shadow: var(--sh-1);
}
.item:hover { border-color: var(--brand); }
.item:active { transform: scale(.995); }
.item.marcado { border-color: var(--ok); background: var(--ok-50); }
.item .check {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; margin-top: 1px;
  border: 2px solid var(--line); display: grid; place-items: center; font-size: 1rem; color: #fff; background: var(--surface);
  transition: all .15s;
}
.item.marcado .check { background: var(--ok); border-color: var(--ok); transform: scale(1.05); }
.item .texto { flex: 1; }
.item .desc { font-size: .97rem; line-height: 1.4; }
.item .peso { font-size: .78rem; font-weight: 800; color: var(--brand); margin-top: 4px; font-family: var(--f-mono); }

.total-barra {
  position: sticky; bottom: 0; z-index: 30; background: var(--surface);
  border-top: 1px solid var(--line); padding: 14px 16px;
  box-shadow: 0 -8px 26px rgba(11,40,38,.10);
}
.total-barra .valor { font-size: 1.7rem; font-weight: 800; color: var(--brand-700); font-family: var(--f-mono); letter-spacing: -.03em; }
.total-barra .max { font-size: .9rem; color: var(--muted); font-weight: 700; font-family: var(--f-mono); }

/* ---------- Badges de status ---------- */
.badge { font-size: .72rem; font-weight: 800; padding: 5px 11px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; letter-spacing: -.01em; }
.badge.online  { background: rgba(255,255,255,.16); color: #d9fff5; }
.badge.offline { background: var(--warn-50); color: var(--warn); }
.badge.fila    { background: rgba(255,255,255,.14); color: #eafaf8; border: 1px solid rgba(255,255,255,.25); }
.ponto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; box-shadow: 0 0 0 0 currentColor; animation: piscar 1.8s infinite; }
@keyframes piscar { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(24px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 13px;
  font-weight: 700; box-shadow: var(--sh-2); opacity: 0; pointer-events: none;
  transition: all .28s cubic-bezier(.2,.9,.3,1.2); z-index: 60; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { background: linear-gradient(180deg, #e0485a, #c93444); }
#toast.ok   { background: linear-gradient(180deg, #13a268, #0f8a58); }

/* ---------- Utilitários ---------- */
.oculto { display: none !important; }
.centro { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.entre { justify-content: space-between; }
.mt { margin-top: 14px; }

/* ---------- Tabela (admin) ---------- */
.tabela-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--sh-1); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; background: var(--surface); }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-2); position: sticky; top: 0; cursor: pointer; user-select: none; }
th:hover { color: var(--brand); }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--brand-50); }
td.num, th.num { text-align: center; font-family: var(--f-mono); }
.nota { font-weight: 800; color: var(--brand-700); font-family: var(--f-mono); }
.faltando { color: var(--warn); font-weight: 700; }
.completo { color: var(--ok); font-weight: 800; }

/* ---------- Cards de estação (andamento) ---------- */
.cards-estac { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.estac-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); box-shadow: var(--sh-1); animation: surge .3s ease both; }
.estac-card .t { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.estac-card .n { font-weight: 800; margin-top: 2px; line-height: 1.2; }
.estac-card .barra { height: 7px; background: var(--line-2); border-radius: 5px; margin-top: 10px; overflow: hidden; }
.estac-card .barra > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--ok)); border-radius: 5px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; background: var(--surface); padding: 6px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--sh-1); }
.tab { padding: 10px 16px; border-radius: 10px; border: none; background: transparent; font-weight: 700; color: var(--muted); font-size: .92rem; transition: all .14s; }
.tab:hover { color: var(--brand); background: var(--brand-50); }
.tab.ativa { background: linear-gradient(180deg, var(--brand), var(--brand-600)); color: #fff; box-shadow: var(--sh-brand); }

/* editor de temas — linha de item */
.item-tema input[data-peso] { text-align: center; font-family: var(--f-mono); font-weight: 700; }

/* skeleton de carregamento */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line-2) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: brilho 1.3s ease infinite; border-radius: 8px; height: 14px; }
@keyframes brilho { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* spinner inline */
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: girar .7s linear infinite; vertical-align: -2px; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .topo h1 { font-size: 1rem; }
  .topo .linha { padding: 12px 14px; }
  .wrap { padding: 16px 13px 60px; }
  .card { padding: 16px; border-radius: var(--r); }
  .tabs { position: sticky; top: 60px; z-index: 20; overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
  .cards-estac { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .btn.pequeno { padding: 10px 13px; }
}
@media (min-width: 720px) {
  .item .check { width: 28px; height: 28px; flex-basis: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
