/* gdj dashboard. One accent (blue) for links and the main action, one red kept for
   destructive actions, neutral greys for everything else. The system font, because this
   is a local Mac tool and the Mac's own face reads best at small sizes. */

:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #1a1c1e;
  --muted: #565c64;
  --line: #d5d9de;
  --line-strong: #8a9099;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --accent-soft: #e6eef8;
  --danger: #b42318;
  --danger-ink: #ffffff;
  --ok: #1d6b38;
  --warn: #8a5100;
  --bad: #9b2c2c;
  --radius: 6px;
  --gap: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618;
    --surface: #1d2023;
    --text: #e8eaed;
    --muted: #a6acb3;
    --line: #353a40;
    --line-strong: #7d848c;
    --accent: #7ab6f5;
    --accent-ink: #0b1623;
    --accent-soft: #1d2a3a;
    --danger: #ff8f84;
    --danger-ink: #1f0b09;
    --ok: #7fd49c;
    --warn: #f0b860;
    --bad: #ff9b9b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 8px;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.2rem;
  margin-top: 28px;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 8px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 8px;
  top: -60px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus {
  top: 8px;
}

/* Header and navigation */

.top {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
}

.nav a:hover {
  background: var(--surface);
}

.nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.banner {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}

.banner-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

.banner-inner p {
  margin: 0;
  flex: 1 1 280px;
  overflow-wrap: anywhere;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

main:focus,
h1[tabindex="-1"]:focus {
  outline: none;
}

.notice h2,
.panel h2 {
  margin-top: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 12px;
}

.page-head h1 {
  margin: 0;
}

.notice.setup {
  padding: 10px 14px;
}

.toolbar .search {
  max-width: 320px;
}

.toolbar .search-count {
  margin: 0;
}

.lede {
  color: var(--muted);
  max-width: 70ch;
  margin-bottom: 20px;
}

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

.small {
  font-size: 0.9rem;
}

/* Controls */

button,
.button {
  font: inherit;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--surface);
}

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

button.primary:hover:not(:disabled) {
  background: var(--accent);
  filter: brightness(1.08);
}

button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

button.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-ink);
  font-weight: 600;
}

button.link {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 8px 4px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button[aria-busy="true"] {
  cursor: progress;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="password"],
select,
textarea {
  font: inherit;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
}

textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

label {
  font-weight: 600;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 16px;
}

.search {
  width: 100%;
  max-width: 420px;
}

.search input {
  width: 100%;
}

.search-count {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Toggle chips: these switch a filter, so they get the capsule shape. */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  border-radius: 999px;
  min-height: 44px;
  padding: 6px 14px;
}

.chip[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

/* Switches */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0;
  font-weight: 600;
  text-align: left;
}

.switch:hover:not(:disabled) {
  background: none;
}

.switch-track {
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  position: relative;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line-strong);
}

.switch[aria-checked="true"] .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch[aria-checked="true"] .switch-track::after {
  left: 22px;
  background: var(--accent-ink);
}


/* Tabs */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  border-bottom: 1px solid var(--line);
  margin: 16px 0 20px;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--text);
}

.tabs a:hover {
  box-shadow: inset 0 -3px 0 var(--line);
}

.tabs a[aria-current="page"] {
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--text);
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.settings-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.settings-rail a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}

.settings-rail a:hover {
  background: var(--surface);
}

.settings-rail a[aria-current="page"] {
  background: var(--surface);
  font-weight: 700;
}

@media (min-width: 768px) {
  .settings-layout {
    grid-template-columns: 210px 1fr;
    gap: 32px;
  }

  .settings-rail {
    flex-direction: column;
    flex-wrap: nowrap;
  }
}

.field {
  margin: 0 0 22px;
  max-width: 640px;
}

.field label,
.field .label {
  display: block;
  margin-bottom: 6px;
}

.field input:not([type="checkbox"]),
.field select {
  width: 100%;
  max-width: 420px;
}

.field .hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.field-status {
  min-height: 1.5em;
  font-size: 0.9rem;
  margin-top: 4px;
}

.field-status.error,
.error-text {
  color: var(--bad);
  font-weight: 600;
}

.field-status.ok {
  color: var(--ok);
}

.key-current {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Panels and notices */

.panel {
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

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

.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
}

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

.notice.bad {
  border-color: var(--bad);
}

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

.setup-title {
  font-weight: 600;
  margin: 0 0 4px;
}

.setup-list {
  margin: 0;
  padding-left: 20px;
}

.setup-list li {
  margin: 4px 0;
}

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 12px 0 8px;
  padding: 0;
  list-style: none;
}

.figures li {
  display: flex;
  flex-direction: column;
}

.figures strong {
  font-size: 1.4rem;
}

.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* States: a symbol and a word, never colour alone. */

.state {
  font-weight: 700;
}

.state-approved {
  color: var(--ok);
}

.state-needs_review,
.state-unavailable {
  color: var(--warn);
}

.state-rejected {
  color: var(--bad);
}

/* Job entries */

.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}

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

.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 24px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.entry:focus {
  outline: 3px solid var(--accent);
  outline-offset: -1px;
}

.entry-title {
  font-size: 1.05rem;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}

.entry-title .num {
  color: var(--muted);
  font-weight: 400;
}

.entry-company {
  font-weight: 600;
  margin: 0;
}

.entry-meta {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.entry-state {
  margin: 4px 0 0;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

.entry-actions select {
  min-width: 140px;
}

.entry details {
  grid-column: 1 / -1;
}

.entry summary {
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--accent);
}

.evidence {
  margin: 4px 0 8px;
  padding-left: 20px;
}

.evidence li {
  margin: 2px 0;
  overflow-wrap: anywhere;
}

.description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.92rem;
  max-height: 280px;
  overflow: auto;
}

button.icon {
  min-width: 44px;
  padding: 8px 10px;
  font-size: 1.1rem;
}

.field.compact {
  margin: 0;
}

.field.compact input {
  width: 100%;
}

@media (min-width: 900px) {
  .entry {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .entry.source {
    grid-template-columns: minmax(0, 1fr) 280px 120px;
    align-items: start;
  }

  .entry-actions {
    justify-content: flex-end;
  }
}

/* Tables: fixed columns; on a phone each row stacks with its labels. */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.w-8 {
  width: 8%;
}

.w-10 {
  width: 10%;
}

.w-11 {
  width: 11%;
}

.w-12 {
  width: 12%;
}

.w-14 {
  width: 14%;
}

.w-16 {
  width: 16%;
}

.w-18 {
  width: 18%;
}

.w-19 {
  width: 19%;
}

.w-20 {
  width: 20%;
}

.w-22 {
  width: 22%;
}

.w-24 {
  width: 24%;
}

.w-25 {
  width: 25%;
}

.w-26 {
  width: 26%;
}

.w-28 {
  width: 28%;
}

.w-30 {
  width: 30%;
}

.w-32 {
  width: 32%;
}

.w-34 {
  width: 34%;
}

.w-35 {
  width: 35%;
}

td.number,
th.number {
  text-align: right;
}

/* Table text lines up with the page's left and right edges, with more room after a figure. */
@media (min-width: 701px) {
  th:first-child,
  td:first-child {
    padding-left: 0;
  }

  th:last-child,
  td:last-child {
    padding-right: 0;
  }

  th.number + th:not(.number),
  td.number + td:not(.number) {
    padding-left: 28px;
  }
}

.after-table {
  margin-top: 12px;
}

@media (max-width: 700px) {
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  table.stack tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  table.stack td {
    border: 0;
    padding: 3px 0 3px 9.5em;
    position: relative;
    min-height: 1.9em;
  }

  table.stack td.number {
    text-align: left;
  }

  table.stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 9em;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.65;
  }
}

/* Dialog and toast */

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  max-width: min(520px, calc(100% - 32px));
  background: var(--bg);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

dialog h2 {
  margin-top: 0;
}

dialog .row {
  justify-content: flex-end;
  margin-top: 16px;
}

.toast-area {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 20;
}

.toast {
  pointer-events: auto;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.toast p {
  margin: 0;
  flex: 1 1 240px;
}

.toast.bad {
  background: var(--bad);
  color: var(--bg);
}

.toast button {
  background: transparent;
  color: inherit;
  border-color: currentColor;
  min-height: 40px;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9rem;
}

.keys {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}

.keys dt {
  white-space: nowrap;
}

.keys dd {
  margin: 0;
}

.empty {
  padding: 24px 0;
  color: var(--muted);
}

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

/* Sign-in page and sign-out, on the deployed dashboard. */

.sign-out {
  margin-left: auto;
}

.login {
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 0 16px;
}

.login form {
  display: grid;
  gap: 12px;
}

.login input {
  min-height: 44px;
}

.login-error {
  color: var(--bad);
  margin: 0;
}

.login-note {
  margin: 0 0 16px;
}

.login label {
  font-weight: 600;
}

.stack-form {
  display: grid;
  gap: 4px;
  max-width: 420px;
}

.stack-form button {
  justify-self: start;
}
