:root {
  --sea: #0d3b36;
  --sea-dark: #072a26;
  --sea-soft: #eef4f2;
  --foam: #ffffff;
  --sand: #ffd166;
  --ink: #14251f;
  --muted: #5c7168;
  --line: #d6e0da;
  --ok: #12694a;
  --ok-bg: #e3f6ec;
  --fee: #8a5a00;
  --fee-bg: #fff2d1;
  --free: #1d4e89;
  --free-bg: #e6effa;
  --bad: #a4262c;
  --bad-bg: #fbe9e9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(9, 40, 36, .08), 0 8px 24px rgba(9, 40, 36, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sea-soft);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 3.5rem;
}

.skip {
  position: absolute; left: -9999px; top: 0; background: #fff; padding: .6rem 1rem; z-index: 20;
}
.skip:focus { left: .5rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ cabeçalho */
.top {
  background: var(--sea); color: #fff; padding: .85rem max(4vw, 14px);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.brand span { letter-spacing: .14em; font-weight: 700; font-size: .95rem; display: block; }
.brand small { display: block; letter-spacing: .02em; font-weight: 500; font-size: .72rem; opacity: .8; }
.mark {
  width: 26px; height: 26px; border-radius: 8px; display: inline-block; flex: 0 0 auto;
  background: linear-gradient(160deg, var(--sand), #f7a13a);
  box-shadow: inset 0 -6px 10px rgba(13, 59, 54, .35);
}
.mark.big { width: 46px; height: 46px; border-radius: 13px; }
.who { display: flex; align-items: center; gap: .55rem; font-size: .8rem; text-align: right; }
.who-name { font-weight: 700; }
.who-role { background: rgba(255, 255, 255, .16); padding: .15rem .45rem; border-radius: 999px; }
.link-btn {
  background: none; border: 1px solid rgba(255, 255, 255, .4); color: #fff; border-radius: 8px;
  padding: .35rem .6rem; font: inherit; font-size: .8rem; cursor: pointer;
}
@media (max-width: 640px) {
  .who-role { display: none; }
}

.tabs {
  display: flex; gap: .25rem; overflow-x: auto; background: var(--sea-dark);
  padding: .3rem max(4vw, 14px); position: sticky; top: 3.35rem; z-index: 9;
  scrollbar-width: thin;
}
.tabs a {
  color: #cfe3dd; text-decoration: none; padding: .55rem .8rem; border-radius: 8px;
  font-size: .88rem; white-space: nowrap; font-weight: 600;
}
.tabs a.on { background: rgba(255, 255, 255, .16); color: #fff; }
.tabs a:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--sand); outline-offset: 1px;
}

main { max-width: 1000px; margin: 0 auto; padding: 1rem max(4vw, 14px) 2rem; }

h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: .4rem 0 1rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .7rem; letter-spacing: .01em; }
h3 { font-size: 1.05rem; margin: 0; }
h4 { margin: .2rem 0 .6rem; font-size: .95rem; }

/* ----------------------------------------------------------------------- blocos */
.card {
  background: var(--foam); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin: 0 0 1rem; box-shadow: var(--shadow);
}
.card > details > summary { font-size: 1rem; }
summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; gap: .6rem; align-items: baseline; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "＋"; color: var(--sea); font-weight: 700; }
details[open] > summary::before { content: "－"; }
.hint { font-weight: 500; color: var(--muted); font-size: .8rem; }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: .84rem; margin: .35rem 0 0; }
.page-help { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.rules { margin: 0; padding-left: 1.1rem; font-size: .92rem; }
.rules li { margin-bottom: .45rem; }

.flash {
  background: var(--ok-bg); border: 1px solid #b9e3cd; color: var(--ok);
  padding: .7rem .9rem; border-radius: 10px; margin: 0 0 1rem; font-weight: 600; font-size: .92rem;
}
.flash.warn, .dup { background: var(--fee-bg); border-color: #f0d9a8; color: var(--fee); }
.dup { padding: .8rem .9rem; border-radius: 10px; margin-top: .8rem; font-size: .9rem; }
.dup ul { margin: .4rem 0; padding-left: 1.2rem; }
.empty { color: var(--muted); text-align: center; padding: 1.4rem .5rem; margin: 0; }

/* ------------------------------------------------------------------------ forms */
label { display: block; font-size: .82rem; font-weight: 700; color: #264a41; margin: 0 0 .5rem; }
input, select, textarea {
  display: block; width: 100%; font: inherit; font-size: 16px; margin-top: .25rem;
  padding: .7rem .75rem; border: 1px solid #a9bdb5; border-radius: 9px; background: #fff; color: var(--ink);
}
input[type="checkbox"] { width: auto; display: inline; margin: 0 .4rem 0 0; transform: scale(1.25); }
label.check { font-weight: 600; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
label.check select { width: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 .9rem; }
.grow { grid-column: 1 / -1; }
.narrow { grid-column: span 1; }
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
code { background: #f0f4f2; padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }

.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer;
  background: var(--sea); color: #fff; border: 0; border-radius: 10px; padding: .7rem 1rem;
  min-height: 44px; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--sea-dark); }
.btn.primary { background: #0f7a4f; font-size: 1rem; }
.btn.primary:hover { background: #0b5f3d; }
.btn.money { background: #b07800; }
.btn.money:hover { background: #8a5a00; }
.btn.ghost { background: #fff; color: var(--sea); border: 1px solid var(--line); }
.btn.ghost.danger { color: var(--bad); border-color: #f0cccc; }
.btn.tiny { font-size: .78rem; padding: .4rem .6rem; min-height: 34px; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------------ listas */
.event-head .state { margin: .7rem 0 .2rem; }
.state { display: inline-flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-size: .88rem; }
.state b { padding: .2rem .55rem; border-radius: 999px; font-size: .8rem; }
.state-aberta b { background: var(--ok-bg); color: var(--ok); }
.state-aguardando b { background: var(--free-bg); color: var(--free); }
.state-encerrada b { background: #eceff1; color: #4a5b55; }
.stats { display: flex; gap: .4rem; flex-wrap: wrap; margin: .8rem 0 .2rem; }
.stats div {
  flex: 1 1 96px; background: #f6faf8; border: 1px solid var(--line); border-radius: 10px;
  padding: .45rem .55rem; text-align: center;
}
.stats b { display: block; font-size: 1.05rem; }
.stats span { font-size: .72rem; color: var(--muted); }

.search { display: flex; gap: .5rem; align-items: end; margin-bottom: .8rem; }
.search label { flex: 1; }
.search input { margin-top: 0; }
.search.big input { font-size: 1.15rem; padding: .95rem 1rem; }
.search.big .btn { min-width: 92px; }

.list { display: grid; gap: .5rem; }
.row {
  display: flex; gap: .8rem; align-items: flex-start; justify-content: space-between;
  padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  flex-wrap: wrap;
}
.row.done { border-color: #b9e3cd; background: #f4fbf7; }
.row-body { flex: 1 1 220px; min-width: 0; }
.row-body h3 { display: flex; gap: .45rem; align-items: baseline; word-break: break-word; }
.tick { color: var(--ok); font-size: .95rem; }
.in-time { font-size: .78rem; color: var(--ok); margin: .2rem 0 0; font-weight: 600; }
.row-actions { display: flex; flex-direction: column; gap: .35rem; align-items: stretch; flex: 0 1 auto; min-width: 160px; }
.row-actions form { margin: 0; width: 100%; }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag {
  font-size: .72rem; font-weight: 800; letter-spacing: .02em; padding: .2rem .5rem;
  border-radius: 999px; white-space: nowrap;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.fee { background: var(--fee-bg); color: var(--fee); }
.tag.free { background: var(--free-bg); color: var(--free); }
.tag.paid { background: #eceff1; color: #4a5b55; }
.paid-note { font-size: .76rem; color: var(--muted); }
.edit { width: 100%; }
.edit summary { font-size: .8rem; color: var(--sea); font-weight: 600; }
.edit form { margin-top: .6rem; background: #f8fbfa; border: 1px solid var(--line); border-radius: 10px; padding: .7rem; }
.door .row { padding: .9rem; }
.door .row-actions { min-width: 200px; }
.recent { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.recent li { display: flex; gap: .6rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.recent span { color: var(--muted); font-variant-numeric: tabular-nums; }
.recent small { color: var(--muted); margin-left: auto; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 460px; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td a { color: var(--sea); }
td details { min-width: 150px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 30;
  background: var(--sea-dark); color: #fff; padding: .75rem 1rem; border-radius: 12px;
  font-weight: 700; font-size: .9rem; max-width: 92vw; box-shadow: var(--shadow);
}
.toast.bad { background: var(--bad); }
.foot {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  gap: 1rem; padding: .5rem max(4vw, 14px); background: rgba(238, 244, 242, .92);
  border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); backdrop-filter: blur(4px);
}

/* ------------------------------------------------------------------- tela login */
.login-body { background: linear-gradient(170deg, var(--sea-dark), #125046 55%, #1a6b58); padding: 0; }
.login-card {
  max-width: 430px; margin: min(12vh, 5rem) auto 2rem; background: #fff; border-radius: 18px;
  padding: 1.4rem 1.4rem 1.6rem; box-shadow: 0 22px 50px rgba(4, 26, 23, .35);
}
.login-brand { text-align: center; margin-bottom: 1rem; }
.login-brand h1 { margin: .6rem 0 .2rem; letter-spacing: .18em; font-size: 1.15rem; }
.login-brand p { margin: 0; color: var(--muted); font-size: .85rem; }
.login-form .btn { margin-top: .4rem; }
.help { font-size: .78rem; color: var(--muted); margin: .9rem 0 0; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: pop .18s ease-out; }
  @keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } }
}
