@font-face {
  font-family: "Libre Franklin";
  src: url("fonts/libre-franklin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Franklin";
  src: url("fonts/libre-franklin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #14324f;
  --paper: #f4f7fa;
  --water: #1f6f8b;
  --ink: #14324f;
  --deep: #0e4e63;
  --low: #c4372f;
  --foam: #e5f1f6;
  --line: #c5d5e2;
  --white: #ffffff;
  --on-navy: #e7f1f8;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Libre Franklin", "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.45;
}
::selection { background: var(--navy); color: var(--paper); }
input, textarea { caret-color: var(--navy); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
button:focus-visible, a:focus-visible { outline-offset: 3px; }
nav { scrollbar-color: var(--water) var(--navy); }
* { scrollbar-color: var(--water) var(--paper); }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--paper);
  color: var(--navy);
  padding: 8px 12px;
  z-index: 2;
}
.skip:focus { top: 12px; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}
nav {
  background: var(--navy);
  color: var(--on-navy);
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}
nav a.brand {
  display: block;
  background: transparent;
  padding: 18px 20px 14px;
  margin: 0 0 12px;
  border-radius: 0;
}
nav a.brand:hover { background: transparent; }
.brand img {
  display: block;
  width: 100%;
  height: 112px;
  object-fit: contain;
  object-position: center;
}
nav a {
  color: var(--on-navy);
  text-decoration: none;
  font-size: 20px;
  padding: 8px 14px;
  margin: 2px 10px;
  border-radius: 8px;
}
nav a:hover { background: #1a4468; }
nav a.on { background: var(--water); color: var(--paper); }
nav form.sair { margin-top: auto; padding: 18px 16px 8px; }
nav form.sair button {
  background: transparent;
  color: var(--on-navy);
  border: 0;
  padding: 0;
  font: 500 16px/1.3 "Libre Franklin", sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

main { padding: 32px 36px 64px; min-width: 0; }
body.solo {
  min-height: 100vh;
  background: var(--paper);
}
body.solo .skip { color: var(--paper); }
.solo-main {
  min-height: 100vh;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: block;
}
.gate {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  min-height: 100vh;
}
.gate-brand {
  background: var(--navy);
  color: var(--paper);
  padding: 56px 48px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 32px;
}
.gate-mark {
  display: block;
  width: min(240px, 72%);
  height: auto;
}
.gate-note {
  margin: 0;
  text-align: center;
  color: var(--on-navy);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
  max-width: 18ch;
}
.gate-panel {
  padding: 56px clamp(28px, 6vw, 72px);
  display: grid;
  align-content: center;
  justify-items: stretch;
  max-width: 520px;
  width: 100%;
  box-sizing: border-box;
}
.gate-panel .lede { margin-bottom: 22px; }
.gate-panel form.stack { max-width: none; width: 100%; }
.gate-panel button { width: 100%; }
.solo-plain {
  min-height: 100vh;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 48px 20px;
  display: grid;
  align-content: center;
  justify-items: start;
}
h1 {
  margin: 0 0 8px;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
  max-width: 22ch;
}
h2 {
  margin: 36px 0 10px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.lede { margin: 0 0 18px; max-width: 68ch; font-size: 20px; }
a { color: var(--deep); text-underline-offset: 3px; }
p { max-width: 68ch; }

.status {
  margin: 0 0 16px;
  max-width: 68ch;
  color: var(--deep);
  font-weight: 700;
}
.alert {
  background: var(--white);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
  max-width: 68ch;
}
.alert p, .alert li { color: var(--low); }
.alert ul { margin: 8px 0 0; padding-left: 18px; }

.scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 18px;
}
.tide th, .tide td { white-space: nowrap; }
th { color: var(--deep); font-weight: 700; font-size: 16px; }
tbody tr:hover td { background: var(--foam); }
tr.now td { background: var(--foam); }

.tide td.hollow input::placeholder,
.tide .dash { color: var(--water); opacity: 1; }
.tide td input {
  width: 6.2rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 0;
}
.tide td.filled,
.tide td.miss { color: var(--paper); }
.tide td.filled { background: var(--navy); }
.tide td.miss { background: var(--low); }
.tide tr:hover td.filled,
.tide tr.now td.filled { background: var(--navy); }
.tide tr:hover td.miss,
.tide tr.now td.miss { background: var(--low); }

@media (prefers-reduced-motion: no-preference) {
  .is-fresh td.filled,
  .is-fresh td.miss {
    animation: tide-fill 520ms cubic-bezier(.16, 1, .3, 1);
  }
}
@keyframes tide-fill {
  from { background-color: var(--foam); color: var(--ink); }
  to { background-color: var(--fill, var(--navy)); color: var(--paper); }
}
td.filled { --fill: #14324f; }
td.miss { --fill: #c4372f; }

.work { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.work li {
  background: var(--white);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}
.work a { color: var(--ink); font-size: 18px; }
.state { color: var(--water); font-weight: 700; white-space: nowrap; }
.state.bloqueado, .state.atrasado { color: var(--low); }
.state.feito, .state.cumprido { color: var(--navy); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
button, .btn {
  appearance: none;
  background: var(--navy);
  color: var(--paper);
  border: 2px solid var(--navy);
  border-radius: 8px;
  font: 700 16px/1.2 "Libre Franklin", sans-serif;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}
button.quiet, a.quiet {
  background: transparent;
  color: var(--navy);
}
button:hover, .btn:hover { background: var(--deep); border-color: var(--deep); color: var(--paper); }
button.quiet:hover, a.quiet:hover { background: var(--foam); color: var(--navy); }

form.filters, form.stack { display: grid; gap: 14px; max-width: 720px; }
form.filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  max-width: none;
  margin-bottom: 16px;
}
label { display: grid; gap: 6px; font-weight: 700; }
.hint { font-weight: 500; color: var(--deep); }
input:not([type]), input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="email"], select, textarea {
  font: 500 18px/1.4 "Libre Franklin", sans-serif;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  accent-color: var(--navy);
}
textarea { min-height: 110px; resize: vertical; }
.check { grid-template-columns: 1.2rem 1fr; align-items: center; font-weight: 500; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--navy); }
.perms { display: grid; gap: 8px; }
.perm {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  background: var(--white);
  border-radius: 8px;
  padding: 8px 12px;
}

.empty {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  max-width: 68ch;
}
.dash { color: var(--deep); font-weight: 700; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  nav {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 0;
    z-index: 1;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 0;
  }
  .brand { margin: 0; padding: 6px 8px; flex: 0 0 auto; }
  .brand img { width: 56px; height: 64px; }
  nav a { white-space: nowrap; font-size: 18px; }
  nav form.sair { margin-top: 0; padding: 8px 12px; flex: 0 0 auto; }
  main { padding: 22px 16px 48px; }
  h1 { font-size: 32px; }
  form.filters { grid-template-columns: 1fr; }
  .work li { flex-direction: column; align-items: flex-start; }
  table.tide { width: max-content; min-width: 100%; table-layout: auto; }
  .tide th, .tide td { white-space: nowrap; font-size: 15px; padding: 10px 8px; }
  .tide td input { width: 4.2rem; }
  .gate { grid-template-columns: 1fr; min-height: 0; }
  .gate-brand {
    min-height: 220px;
    padding: 36px 24px 28px;
    gap: 16px;
  }
  .gate-mark { width: min(148px, 46%); }
  .gate-note { font-size: 15px; }
  .gate-panel { padding: 32px 20px 48px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
