@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #f3f7fa;
  --surface: #ffffff;
  --ink: #16324a;
  --muted: #4a6277;
  --line: #b9c9d6;
  --control: #6d869b;
  --accent: #2a6f97;
  --accent-strong: #1f5878;
  --warn: #b15d3a;
  --warn-text: #9a4a2c;
  --busy: #e1e9f0;
  --radius: 3px;
  --font: "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 var(--font); }
.wrap { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.top { background: var(--surface); border-bottom: 2px solid var(--ink); }
.top-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 0.8rem; flex-wrap: wrap; }
.brand { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.hours { margin: 0; font: 400 0.875rem var(--mono); color: var(--muted); }

h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); line-height: 1.2; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.0625rem; margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.services { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1.25rem; }
.services legend { float: left; margin-right: 0.75rem; padding: 0; font-weight: 700; line-height: 2.75rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; pointer-events: none; }
.chip label {
  display: flex; align-items: baseline; gap: 0.6rem; min-height: 2.75rem; padding: 0.5rem 0.9rem; cursor: pointer;
  background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius);
}
.chip .meta { font: 400 0.8125rem var(--mono); color: var(--muted); white-space: nowrap; }
.chip input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:checked + label .meta { color: #d3e0ea; }
.chip input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

.week-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.week-bar h2 { min-width: 11rem; text-align: center; font-variant-numeric: tabular-nums; }
.nav { min-width: 2.75rem; min-height: 2.75rem; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 700 1.125rem var(--font); cursor: pointer; }
.nav:hover:not(:disabled) { background: var(--ink); color: #fff; }
.nav:disabled { color: #8397a8; border-color: var(--line); cursor: not-allowed; }
.legend { list-style: none; display: flex; gap: 1rem; margin: 0 0 0 auto; padding: 0; font-size: 0.875rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.swatch { width: 1rem; height: 1rem; border: 1px solid var(--control); background: var(--surface); }
.swatch.busy { background: var(--busy) repeating-linear-gradient(135deg, transparent 0 3px, #b9c9d6 3px 4px); border-color: var(--line); }

.grid-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { display: grid; grid-template-columns: 3rem repeat(var(--cols), minmax(0, 1fr)); }
.grid > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.col-head { position: sticky; top: 0; background: var(--surface); padding: 0.5rem 0.25rem; text-align: center; line-height: 1.2; border-bottom: 2px solid var(--ink); }
.col-head .dow { display: block; font: 500 0.75rem var(--mono); text-transform: uppercase; color: var(--muted); }
.col-head .dom { font-size: 1.25rem; font-weight: 700; }
.col-head.today .dom { box-shadow: inset 0 -3px 0 var(--warn); }
.time { display: grid; place-items: center; font: 400 0.8125rem var(--mono); color: var(--muted); background: var(--bg); }
.cell { display: block; width: 100%; min-height: 2.75rem; margin: 0; padding: 0; border: 0; border-radius: 0; font: 500 0.8125rem var(--mono); background: var(--surface); color: var(--accent-strong); cursor: pointer; }
.cell.free:hover { background: var(--accent); color: #fff; }
.cell.free.picked { background: var(--accent); color: #fff; }
.cell.busy { background: var(--busy) repeating-linear-gradient(135deg, transparent 0 4px, #cbd8e3 4px 5px); cursor: not-allowed; }
.cell:disabled { color: transparent; }
.cell.free:focus-visible { outline-offset: -3px; }
.grid.loading { opacity: 0.55; }

.note, .status { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9375rem; }
.status { min-height: 1.5rem; }
.status.ok { color: #1d5a3a; }
.status.bad { color: var(--warn-text); }

.mine { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.mine h2 { margin-bottom: 0.75rem; }
.mine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.mine li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; }
.mine li.cancelled { color: var(--muted); }
.mine li.cancelled .what { text-decoration: line-through; }
.mine .tag { font: 500 0.8125rem var(--mono); }
.secondary { min-height: 2.75rem; padding: 0 1rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 700 1rem var(--font); cursor: pointer; }
.secondary:hover { background: var(--ink); color: #fff; }

.foot { padding-block: 1.5rem 2.5rem; margin-top: 2rem; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); }
.foot p { margin: 0; max-width: 42rem; }
.foot .made { margin-top: 0.5rem; }
.foot a { color: var(--ink); text-underline-offset: 3px; }

/* Gaveta: sobe do rodapé da janela no eixo Y. */
.scrim { position: fixed; inset: 0; background: rgba(22, 50, 74, 0.45); }
.drawer {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-top: 3px solid var(--accent); padding: 1.25rem 1rem 1.5rem;
}
.drawer[hidden], .scrim[hidden] { display: none; }
.drawer > * { max-width: 28rem; margin-inline: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.sum { margin: 0 0 1rem; display: grid; gap: 0.4rem; }
.sum div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; }
.sum dt { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.sum dd { margin: 0; font-weight: 700; text-align: right; }
.sum dd.mono { font-weight: 500; }
form { display: grid; gap: 0.9rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.25rem; }
input { width: 100%; min-height: 2.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
input[aria-invalid="true"] { border-color: var(--warn); border-width: 2px; }
.err { color: var(--warn-text); margin: 0.25rem 0 0; font-size: 0.875rem; }
.primary { width: 100%; min-height: 3rem; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: 700 1rem var(--font); cursor: pointer; }
.primary:hover:not(:disabled) { background: var(--accent-strong); }
.primary:disabled { background: #c9d6e0; color: #3d5266; cursor: not-allowed; }

@media (max-width: 51.99rem) {
  .services { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.5rem; }
  .services legend { float: none; }
  .chip { flex: none; }
  .legend { margin-left: 0; }
  .time { font-size: 0.75rem; }
  .cell { font-size: 0.75rem; }
}
@media (min-width: 52rem) {
  .drawer { left: auto; right: 1.5rem; bottom: 1.5rem; width: 26rem; border: 1px solid var(--line); border-top: 3px solid var(--accent); }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: rise 160ms ease-out; }
  @keyframes rise { from { transform: translateY(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
}
