/* Hard Rock hours. Built for a small phone in bright sun: big text, thick borders, strong contrast. */
:root {
  --ink: #0b0b0b;
  --paper: #ffffff;
  --soft: #eef1f5;
  --line: #1c1c1c;
  --accent: #0a3a7a;
  --accent-ink: #ffffff;
  --bad: #9b1c1c;
  --bad-soft: #fde8e8;
  --ok: #14532d;
  --ok-soft: #dcfce7;
  --warn: #7c2d12;
  --warn-soft: #ffedd5;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}

main { max-width: 34rem; margin: 0 auto; padding: 0.75rem 0.75rem 6.5rem; }
main.plain { padding-bottom: 2rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 1rem 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 1rem 0 0.5rem; }
p { margin: 0.5rem 0; }
.muted { color: #333; font-size: 0.9rem; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.topbar .who { font-weight: 700; font-size: 1.1rem; flex: 1 1 6rem; min-width: 0; }
.topbar button { white-space: nowrap; }
.topbar form { margin: 0; }
.topbar .actions { display: flex; gap: 0.5rem; }

.biglink { display: inline-block; margin: 0.5rem 0; padding: 0.6rem 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }

button, .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.5rem 1.1rem;
  border: 3px solid var(--accent);
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.quiet { background: var(--paper); color: var(--accent); min-height: 2.75rem; padding: 0.25rem 0.8rem; }
button.wide { width: 100%; }

:focus-visible { outline: 4px solid #f59e0b; outline-offset: 2px; }

label { display: block; font-weight: 700; margin: 1rem 0 0.25rem; }

input[type=text], input[type=tel], input[type=password], input[type=time], textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.5rem 0.75rem;
  border: 3px solid var(--line);
  border-radius: 0.6rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
}
input[type=time] { font-size: 1rem; padding-left: 0.5rem; padding-right: 0.4rem; appearance: none; -webkit-appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input:disabled { background: var(--soft); color: #333; border-color: #777; }
input[aria-invalid=true] { border-color: var(--bad); background: var(--bad-soft); }
textarea { min-height: 5rem; resize: vertical; font-size: 1rem; }
.pin { letter-spacing: 0.3em; text-align: center; font-size: 1.6rem; }

.notice { border: 3px solid var(--line); border-radius: 0.6rem; padding: 0.6rem 0.8rem; margin: 0.75rem 0; background: var(--soft); }
.notice.error { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.notice.error ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.notice.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.notice strong { display: block; }

.weeks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; margin: 0.75rem 0; padding: 0; list-style: none; }
.weeks a {
  display: block;
  height: 100%;
  padding: 0.45rem 0.4rem;
  border: 3px solid var(--line);
  border-radius: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.25;
}
.weeks a[aria-current=page] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.weeks strong { display: block; font-size: 0.95rem; }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border: 2px solid currentColor; border-radius: 1rem; font-size: 0.8rem; font-weight: 700; }
/* In the narrow week tabs a long word like "alterações" must wrap between words, never inside one. */
.weeks .badge { overflow-wrap: normal; word-break: normal; hyphens: manual; font-size: 0.75rem; padding: 0.05rem 0.4rem; }
.badge.pending { color: var(--warn); }
.badge.accepted { color: var(--ok); }
.badge.returned, .badge.rejected { color: var(--bad); }

/* ---- The week page, laid out like the paper time sheet ---- */
.sheet-top { margin: 0.75rem 0 0.5rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { display: block; width: 4rem; height: 4rem; flex: none; }
.brand .co { display: flex; flex-direction: column; line-height: 1.15; font-weight: 800; letter-spacing: 0.04em; }
.brand .co strong { font-size: 1.4rem; }
.brand .co span { font-size: 0.8rem; font-weight: 700; }
.sheet-top h1 {
  margin: 0.9rem 0 0.75rem;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.25em;
}
.fill { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.5rem 0; }
.fill .k { font-weight: 800; white-space: nowrap; }
.fill .v { flex: 1; min-width: 0; min-height: 1.6em; padding: 0 0.25rem; border-bottom: 2px solid var(--line); }

/* One bordered sheet; each day is a ruled row of it. */
.sheet { border: 3px solid var(--line); margin: 0.75rem 0; }
.sheet-head { display: none; }
.day { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 0.4rem 0.6rem; padding: 0.5rem 0.6rem 0.7rem; }
.day + .day { border-top: 3px solid var(--line); }
.day.off { background: var(--soft); }
/* A day that has not happened yet is just its heading and "Not yet". */
.day.off > :not(.dayhead):not(.total) { display: none; }
.dayhead { grid-column: 1 / -1; grid-row: 1; margin: 0; font-size: 1.1rem; line-height: 1.2; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.dayhead .date { white-space: nowrap; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.day .total { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; font-weight: 700; white-space: nowrap; }
.lbl { margin: 0; font-size: 0.75rem; font-weight: 800; line-height: 1.2; letter-spacing: 0.03em; text-transform: uppercase; overflow-wrap: normal; word-break: normal; }
.colhead, .line { display: contents; }
.day input { margin: 0; }
.day .time { display: flex; flex-direction: column; gap: 0.2rem; }
.clear { grid-column: 1 / -1; justify-self: start; min-height: 2.75rem; padding: 0.25rem 0.9rem; background: var(--paper); color: var(--accent); }
/* "Not sure which job?": folded away until it is needed; open when it holds something. */
.unsure { grid-column: 1 / -1; }
.unsure summary { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--accent); font-weight: 700; cursor: pointer; }
.unsure label { margin-top: 0.4rem; }
.unsure input { margin: 0.2rem 0; }
.unsure input.hrs { max-width: 10rem; }
.more { grid-column: 1 / -1; justify-self: start; min-height: 2.75rem; padding: 0.25rem 0.9rem; background: var(--paper); color: var(--accent); }
.hint { color: #333; font-size: 0.9rem; }

/* The accepted week: the same table, read-only. */
.paper { width: 100%; table-layout: fixed; border-collapse: collapse; border: 3px solid var(--line); margin: 0.75rem 0 0; }
.paper th, .paper td { padding: 0.3rem 0.2rem; border: 2px solid var(--line); text-align: center; vertical-align: middle; font-size: 0.85rem; line-height: 1.25; overflow-wrap: normal; }
.paper thead th:nth-child(1) { width: 17%; }
.paper thead th:nth-child(2) { width: 22%; }
.paper thead th:nth-child(3), .paper thead th:nth-child(4) { width: 17%; }
.paper thead th:nth-child(5) { width: 27%; }
.paper thead th { padding: 0.35rem 0.1rem; border-bottom: 3px solid var(--line); background: var(--soft); font-size: 0.6rem; letter-spacing: 0; }
.paper tbody th { text-align: left; padding-left: 0.35rem; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; }
.paper .date { display: block; font-weight: 400; font-size: 0.75rem; text-transform: none; }
.dow .short { display: none; }
.paper .dow .short { display: inline; }
/* The full weekday stays for screen readers; only the three letters show on a phone. */
.paper .dow .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.paper-total { margin: 0.6rem 0; text-align: right; font-size: 1.15rem; font-weight: 800; }

@media (min-width: 640px) {
  main:not(.plain) { max-width: 56rem; }
  .bar .inner { max-width: 56rem; }
  .sheet-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; column-gap: 1rem; }
  .brand { flex-direction: column; align-items: flex-start; gap: 0.2rem; grid-row: 1; }
  .sheet-top h1 { grid-column: 2; grid-row: 1; align-self: center; margin: 0; font-size: 1.6rem; }
  .fill { grid-column: 1 / -1; }

  .sheet-head, .day { grid-template-columns: 11rem minmax(0, 1fr) 8.5rem 8.5rem minmax(0, 1fr); column-gap: 0.75rem; }
  .sheet-head { display: grid; padding: 0.5rem 0.6rem; border-bottom: 3px solid var(--line); background: var(--soft); text-align: center; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.03em; }
  .day { grid-template-rows: repeat(5, auto); align-items: start; row-gap: 0; }
  .dayhead { grid-column: 1; grid-row: 1; padding-top: 0.6rem; }
  .day .total { grid-column: 1; grid-row: 2; justify-self: start; }
  .day.off .total { grid-column: 2; grid-row: 1; padding-top: 0.6rem; }
  .colhead { display: none; }
  .line .job { grid-column: 2; }
  .line .hrs { grid-column: 5; }
  .line input { margin: 0.25rem 0; }
  .clear { grid-column: 3 / span 2; grid-row: 2; justify-self: start; }
  .more { grid-column: 2 / span 2; justify-self: start; white-space: nowrap; margin: 0.25rem 0; }
  .unsure { grid-column: 2 / -1; }
  .time { grid-row: 1; margin: 0.25rem 0; }
  .time.start { grid-column: 3; }
  .time.finish { grid-column: 4; }
  /* The column headings above say what each box is; the labels stay for screen readers. */
  .time .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  .paper .dow .long { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
  .paper .dow .short { display: none; }
  .paper th, .paper td { padding: 0.5rem; font-size: 1.05rem; }
  .paper thead th { font-size: 0.8rem; }
  .paper thead th:nth-child(1) { width: 23%; }
  .paper thead th:nth-child(2) { width: 20%; }
  .paper thead th:nth-child(3), .paper thead th:nth-child(4) { width: 16%; }
  .paper thead th:nth-child(5) { width: 25%; }
  .paper .date { display: inline; font-size: 0.95rem; }
}

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper);
  border-top: 3px solid var(--line);
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
}
.bar .inner { max-width: 34rem; margin: 0 auto; display: flex; align-items: center; gap: 0.75rem; }
.bar .sum { flex: 0 0 auto; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.bar .sum small { display: block; font-weight: 400; }
.bar .sum .unsent { display: block; color: var(--warn); font-size: 0.85rem; }
.bar button { flex: 1 1 auto; min-width: 0; padding-left: 0.6rem; padding-right: 0.6rem; line-height: 1.2; }

[hidden] { display: none !important; }
.weeks a[aria-current=page] .badge { color: var(--accent-ink); }

/* The printed WEEKLY TIME SHEET on its own: edge to edge, the paper's proportions, never taller than the screen. */
body.paper-page { background: #ffffff; }
body.paper-page main { max-width: none; margin: 0; padding: 0; }
.paper-sheet { display: block; width: 100%; height: auto; max-height: 100vh; max-height: 100dvh; }

/* /sheet: the half-hour time list that opens over the sheet. Big rows for thumbs, nothing to type. */
.sheet-hit { cursor: pointer; }
.sheet-hit:focus { outline: none; }
body.picker-open { overflow: hidden; }
.picker { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 1rem; }
.picker[hidden] { display: none; }
.picker-panel { width: 100%; max-width: 22rem; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; background: #ffffff; border: 3px solid #1c1c1c; border-radius: 0.75rem; overflow: hidden; }
.picker-title { margin: 0; padding: 0.85rem 1rem; font-weight: 800; font-size: 1.15rem; text-align: center; border-bottom: 3px solid #1c1c1c; }
.picker-list { position: relative; overflow-y: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: y proximity; max-height: 60vh; max-height: 60dvh; }
.picker-time { display: block; width: 100%; min-height: 3.4rem; margin: 0; border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid #d4d4d4; background: #ffffff; color: #1c1c1c; font: 800 1.45rem/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; scroll-snap-align: center; cursor: pointer; }
.picker-time.is-current { background: #1f3c88; color: #ffffff; }
.picker-time:focus { outline: none; }
.picker-time:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; }
.picker-buttons { display: flex; border-top: 3px solid #1c1c1c; }
.picker-buttons button { flex: 1; min-height: 3.4rem; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: #eef1f5; color: #1c1c1c; font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.picker-buttons button + button { border-left: 3px solid #1c1c1c; }

/* /sheet: the JOB #'S pop-up. Same frame as the time list; big buttons, nothing small to hit. */
.picker[hidden], .job-view[hidden], .picker-buttons[hidden], .job-need[hidden], .job-total[hidden], .job-rows[hidden], .job-add[hidden], .job-option[hidden], .job-group[hidden], .job-none[hidden] { display: none; }
.job-view { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.8rem; overflow-y: auto; max-height: 65vh; max-height: 65dvh; }
.job-total { margin: 0; text-align: center; font-weight: 800; font-size: 1.2rem; }
.job-total.is-waiting { font-size: 1rem; color: #555555; }
.job-need p { margin: 0 0 0.6rem; text-align: center; font-weight: 800; font-size: 1.1rem; }
.job-need-buttons { display: flex; gap: 0.6rem; }
.job-need-buttons button { flex: 1; min-height: 3.2rem; margin: 0; border: 3px solid #1c1c1c; border-radius: 0.5rem; background: #ffffff; color: #1c1c1c; font-weight: 800; font-size: 1.05rem; box-shadow: none; }
.job-rows { display: flex; flex-direction: column; gap: 0.6rem; }
.job-row { border: 3px solid #1c1c1c; border-radius: 0.5rem; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.job-row-head { display: flex; align-items: stretch; gap: 0.5rem; }
.job-choose { flex: 1; min-width: 0; margin: 0; min-height: 3.2rem; border: 2px solid #1f3c88; border-radius: 0.4rem; background: #ffffff; color: #1f3c88; font-weight: 800; font-size: 1.1rem; text-align: left; padding: 0.4rem 0.6rem; box-shadow: none; }
.job-choose.is-empty { border-style: dashed; color: #555555; }
.job-hours { display: flex; align-items: center; justify-content: center; gap: 0.8rem; }
.job-step { margin: 0; width: 3.2rem; height: 3.2rem; border: 3px solid #1c1c1c; border-radius: 50%; background: #eef1f5; color: #1c1c1c; font-weight: 800; font-size: 1.6rem; line-height: 1; padding: 0; box-shadow: none; }
.job-hours-value { min-width: 4.5rem; text-align: center; font-weight: 800; font-size: 1.5rem; color: #1f3c88; }
.job-hours-note { font-weight: 700; color: #555555; }
.job-remove { flex: 0 0 3.2rem; margin: 0; min-height: 3.2rem; border: 2px solid #9b1c1c; border-radius: 0.4rem; background: #fde8e8; color: #9b1c1c; font-weight: 800; font-size: 1.2rem; padding: 0; box-shadow: none; }
.job-add { margin: 0; min-height: 3.2rem; border: 3px dashed #1f3c88; border-radius: 0.5rem; background: #ffffff; color: #1f3c88; font-weight: 800; font-size: 1.1rem; box-shadow: none; }
.job-search { width: 100%; min-height: 3.2rem; border: 3px solid #1c1c1c; border-radius: 0.5rem; padding: 0 0.7rem; font-size: 1.1rem; font-weight: 700; }
.job-list { display: block; overflow-y: auto; max-height: 50vh; max-height: 50dvh; border: 2px solid #d4d4d4; border-radius: 0.5rem; }
.job-group { margin: 0; padding: 0.45rem 0.7rem; background: #eef1f5; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.04em; }
.job-option { margin: 0; width: 100%; height: auto; line-height: 1.25; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; min-height: 3.4rem; padding: 0.45rem 0.7rem; border: 0; border-bottom: 1px solid #d4d4d4; border-radius: 0; background: #ffffff; color: #1c1c1c; text-align: left; box-shadow: none; }
.job-group { display: block; }
.job-option strong { line-height: 1.2; font-size: 1.3rem; color: #1f3c88; }
.job-option span { font-weight: 700; font-size: 0.95rem; color: #333333; }
.job-none { margin: 0; padding: 0.8rem; font-weight: 700; text-align: center; }
.picker-done { background: #1f3c88 !important; color: #ffffff !important; }
