/* Page layout for the web app. Colors, spacing and type come from tokens.css; nothing here invents a value. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
h1,
h2,
p {
  margin: 0;
}
.muted {
  color: var(--ink-muted);
}
.mono {
  font-family: var(--font-mono);
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Sign-in pages: one centered card (400px; full width with space-4 margins on a phone). */
.signin {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.signin-card {
  width: 400px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-100);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-8);
}
.signin-card img {
  height: 64px;
  width: auto;
  align-self: flex-start;
}
.signin-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.n-btn.wide {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  text-align: center;
  text-decoration: none;
}
.signin-card strong {
  color: var(--ink);
}

/* Signed-in frame: the top bar and the page area. */
.app-header {
  position: sticky;
  top: 0;
}
.app-header .logo {
  display: flex;
}
.n-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.person {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}
.person form {
  margin: 0;
}
.person .n-btn {
  min-height: 44px;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--bg-200);
  border: 1px solid var(--control-border);
  font: 600 12px/16px var(--font-sans);
}
.app-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-8);
}

@media (max-width: 767px) {
  .n-header.app-header {
    height: auto;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }
  .app-header .logo img {
    height: 36px;
  }
  .app-header .n-divider {
    display: none;
  }
  .person .body-strong {
    display: none;
  }
  .app-main {
    padding: var(--space-4);
  }
}

/* The status page. */
a.n-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.status-banner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  background: var(--bg-100);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.status-banner.warn {
  background: var(--orange-soft);
  border-color: var(--orange);
}
.status-banner.bad {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.status-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-6);
  margin: 0;
}
.facts dt {
  color: var(--ink-muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.facts .caption {
  display: block;
}
ul.plain {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  list-style: none;
}

@media (max-width: 767px) {
  .facts {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .facts dd {
    margin-bottom: var(--space-2);
  }
  /* Tables become stacked cards: each row a card, each cell labeled by its column. */
  .n-table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .n-table.stack,
  .n-table.stack tbody,
  .n-table.stack tr,
  .n-table.stack td {
    display: block;
  }
  .n-table.stack tr {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--line);
  }
  .n-table.stack tr:last-child {
    border-bottom: 0;
  }
  .n-table.stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1) var(--space-3);
    border: 0;
  }
  .n-table.stack td::before {
    content: attr(data-label);
    color: var(--ink-muted);
    font: 600 12px/16px var(--font-sans);
  }
}

/* The in/out board. */
.board-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.board-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--space-6);
  align-items: start;
}
.board-main {
  min-width: 0;
}
.board-confirmed p {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}
.board-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.summary-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.board-table th.c-name {
  text-align: left;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.app-main a:not(.n-btn) {
  color: var(--blue);
}
.board-table td {
  vertical-align: middle;
}
.warn-text {
  color: var(--orange);
}
.error-text {
  color: var(--danger);
}

/* The status control: In | On site | Out, one tap saves. Three real buttons in a form, so it works without script. */
.segments {
  display: inline-flex;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg {
  min-height: 44px;
  min-width: 76px;
  padding: 0 var(--space-3);
  background: var(--bg-200);
  color: var(--ink);
  border: 0;
  border-right: 1px solid var(--control-border);
  cursor: pointer;
}
.seg:last-child {
  border-right: 0;
}
.seg:hover {
  background: var(--line);
}
.seg[aria-pressed="true"] {
  color: var(--ink-on-accent);
}
/* Selected is a fill and a check mark, so it never relies on color alone. */
.seg[aria-pressed="true"]::before {
  content: "✓ ";
}
.seg-in[aria-pressed="true"] {
  background: var(--green);
}
.seg-onsite[aria-pressed="true"] {
  background: var(--blue);
}
.seg-out[aria-pressed="true"] {
  background: var(--ink-muted);
}
.seg:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.more summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  color: var(--ink-muted);
}
.more label {
  display: block;
  margin-top: var(--space-2);
  color: var(--ink-muted);
}
.more input {
  display: block;
  width: 100%;
  max-width: 260px;
  min-height: 44px;
  margin-top: var(--space-1);
}

@media (max-width: 767px) {
  .board-layout {
    grid-template-columns: 1fr;
  }
  /* One card per engineer: the name with the detail on the right, the control at full width, then the last change. */
  .board-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .board-table,
  .board-table tbody,
  .board-table th,
  .board-table td {
    display: block;
  }
  .board-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name details"
      "today today"
      "last last";
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--line);
  }
  .board-table tr:last-child {
    border-bottom: 0;
  }
  .board-table th,
  .board-table td {
    padding: 0;
    border: 0;
  }
  .c-name {
    grid-area: name;
  }
  .c-details {
    grid-area: details;
    text-align: right;
  }
  .c-today {
    grid-area: today;
  }
  .c-last {
    grid-area: last;
  }
  .segments {
    display: flex;
    width: 100%;
  }
  .seg {
    flex: 1;
  }
  .more input {
    max-width: none;
  }
}
