:root {
  --bg: #ffffff;
  --surface: #f3f5f8;
  --line: #d5dae1;
  /* Edges of buttons and fields: at least 3:1 against the page and panels. */
  --control: #6b7480;
  --text: #1a1c1f;
  --muted: #545d69;
  --accent: #0058cc;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --warn: #8a4b00;
  --today: #e8f0fc;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f;
    --surface: #1e242d;
    --line: #3a434f;
    --control: #7d8794;
    --text: #eef1f5;
    --muted: #b0b9c4;
    --accent: #7ab0ff;
    --accent-text: #0b1420;
    --danger: #ff8a80;
    --warn: #ffc069;
    --today: #1b2a40;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

#app {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 1rem 0 0.75rem;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

p {
  margin: 0 0 0.6rem;
}

h1:focus {
  outline: none;
}


/* Headings take focus only so screen readers announce a new screen. */
h1[tabindex]:focus-visible {
  outline: none;
}

/* Browsers that know :focus-visible hide the ring after a tap or click. */
:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: var(--accent);
}

/* Plain :focus first for browsers without :focus-visible. */
a:focus,
button:focus,
input:focus,
select:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Buttons and fields: at least 44 px to touch. */
.btn,
.tab,
input,
select {
  font: inherit;
  min-height: 44px;
  border-radius: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--control);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.btn.danger {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.btn.small {
  padding: 0.4rem 0.75rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

input,
select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--control);
  background: var(--bg);
  color: var(--text);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.field {
  margin: 0 0 1rem;
}

.hint,
.none,
.foot {
  color: var(--muted);
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.warn {
  color: var(--warn);
}

.flash:empty {
  display: none;
}

.flash {
  margin-top: 1rem;
  font-weight: 600;
}

.notice {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
}

.notice h3,
.notice h4 {
  font-size: 0.95rem;
  margin: 0.8rem 0 0.25rem;
}

.notice ul {
  margin: 0 0 0.6rem;
  padding-left: 1.2rem;
}

.notice li {
  margin-bottom: 0.25rem;
}

.notice details {
  margin-top: 0.4rem;
}

.notice summary {
  /* A list item keeps the browser's open and closed marker; the padding makes it 44 px to touch. */
  display: list-item;
  padding: 0.7rem 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.notice p:last-child {
  margin-bottom: 0;
}

form input {
  margin-bottom: 0.5rem;
}

.simple {
  padding-top: 1.5rem;
}

.simple .btn {
  margin-top: 0.5rem;
}

.quiet {
  margin-top: 1.5rem;
}

.quiet .btn {
  font-size: 0.95rem;
}

.quiet .hint {
  margin-top: 0.4rem;
}

/* Header with the workplace name and the three sections. */
.top {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0 0;
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.place {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: var(--muted);
}

nav {
  display: flex;
  flex-wrap: wrap;
}

.tab {
  /* Four in a row when they fit; two by two when the text is large. */
  flex: 1 1 auto;
  min-width: 4.5em;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.tab[aria-current='page'] {
  border-bottom-color: var(--accent);
  font-weight: 700;
  color: var(--accent);
}

.weekbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.weekbar h2 {
  margin: 0 0.5rem 0.5rem 0;
}

.weeknav {
  display: flex;
  flex-wrap: wrap;
}

.weeknav .btn,
.row .btn {
  margin: 0 0.5rem 0.5rem 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
}

.panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
}

.panel p:last-child {
  margin-bottom: 0;
}

.note h3 {
  margin-bottom: 0.2rem;
}

.empty {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
}

.day {
  margin: 0 0 1.1rem;
}

.day.today h3 {
  color: var(--accent);
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--today);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.shifts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shift {
  background: var(--surface);
  border-left: 6px solid var(--muted);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  margin: 0 0 0.5rem;
}

.shift p {
  margin: 0 0 0.15rem;
}

.shift p:last-child {
  margin-bottom: 0;
}

.shift.open {
  border-style: dashed;
  border-left-style: solid;
  border-width: 1px 1px 1px 6px;
  border-color: var(--line);
  background: transparent;
}

.shift.me {
  background: var(--today);
}

.who {
  font-weight: 700;
}

.time {
  font-weight: 600;
}

.next {
  display: inline-block;
  margin-left: 0.5rem;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--warn);
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.sep {
  padding: 0 0.3em;
}

.dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  margin-right: 0.35em;
  background: var(--muted);
  vertical-align: baseline;
}

.snote {
  font-style: italic;
}

.statusline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.updated {
  margin: 0 0.5rem 0.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.foot {
  font-size: 0.9rem;
  margin-top: 1rem;
}

.loading {
  color: var(--muted);
}

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

.segmented {
  display: flex;
  margin: 0.75rem 0;
  border: 1px solid var(--control);
  border-radius: 8px;
  overflow: hidden;
}

.seg {
  flex: 1 1 0;
  min-height: 44px;
  font: inherit;
  border: 0;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.seg + .seg {
  border-left: 1px solid var(--control);
}

.seg[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.tab .count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 0.3em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--danger);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
}

.btn.banner {
  display: flex;
  width: 100%;
  margin: 0.75rem 0 0;
  justify-content: flex-start;
  font-weight: 700;
  border-color: var(--accent);
  color: var(--accent);
}

.actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.actions .btn,
.req .btn {
  margin: 0.25rem 0.5rem 0 0;
}

.state {
  font-weight: 600;
}

.group {
  margin-top: 1.25rem;
}

.reqs,
.posts,
.blocks {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.req,
.post {
  background: var(--surface);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin: 0 0 0.6rem;
}

.req h3 {
  margin-bottom: 0.2rem;
}

.req p {
  margin: 0 0 0.2rem;
}

.req.needs {
  border: 2px solid var(--accent);
}

.status-approved {
  color: var(--accent);
}

.status-denied,
.status-expired,
.status-superseded,
.status-declined {
  color: var(--warn);
}

.post h2 {
  margin: 0;
  font-size: 1rem;
}

.post-title {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.post.unread {
  border-left: 4px solid var(--accent);
}

.post .badge {
  margin: 0 0.5rem 0 0;
}

.post-body {
  white-space: pre-wrap;
  margin-top: 0.4rem;
}

.blocks li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 1rem;
  padding: 0.5rem 0.85rem;
}

legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

.choice {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.choice input {
  width: 1.4rem;
  height: 1.4rem;
  min-height: 0;
  margin: 0 0.6rem 0 0;
  flex: none;
}

.choice label {
  margin: 0;
  font-weight: 400;
}

fieldset select {
  margin: 0.25rem 0 0.5rem;
}

.btn.back {
  margin-top: 0.75rem;
}

/* Time clock. */
.clock {
  margin-top: 0.75rem;
  border: 2px solid var(--accent);
}

.clock h2 {
  margin-bottom: 0.4rem;
}

/* The same room in every state, so nothing below moves when the clock changes. */
.clock .state {
  min-height: 2.9em;
}

.clock .row {
  min-height: calc(56px + 0.75rem);
}

.btn.big {
  min-height: 56px;
  padding: 0.6rem 1.25rem;
  font-size: 1.1rem;
  margin: 0.25rem 0.5rem 0.5rem 0;
}

.clock .btn {
  margin: 0.25rem 0.5rem 0.25rem 0;
}

.clock .btn.small {
  display: flex;
  margin-top: 0.75rem;
}

.clock input {
  max-width: 10rem;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  margin-bottom: 0.5rem;
}

.edits {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}

/* Keep the sections in view while scrolling, when there is room for it. */
@media (min-height: 40em) {
  .top {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
