/* Label Review Tracker styles (AB#1202, restyled in the UI polish pass).
   Plain CSS, no build step. Colours are tokens so light and dark share one stylesheet. */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --text: #1a1f2e;
  --muted: #566074;
  --border: #dfe3ee;
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --on-primary: #ffffff;
  --focus: #1d4ed8;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --radius: 12px;

  --s-submitted-bg: #e0ecff;
  --s-submitted-fg: #1e3a8a;
  --s-review-bg: #fff1d6;
  --s-review-fg: #7a4a00;
  --s-approved-bg: #d9f5e3;
  --s-approved-fg: #0b5d2a;
  --s-rejected-bg: #fde1e1;
  --s-rejected-fg: #8f1d1d;
  --s-changes-bg: #efe3fb;
  --s-changes-fg: #5b2a86;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1320;
    --surface: #181d2e;
    --surface-2: #20263b;
    --text: #e8ebf5;
    --muted: #a3adc4;
    --border: #2d3550;
    --primary: #8b93ff;
    --primary-hover: #a5abff;
    --on-primary: #101426;
    --focus: #93b4ff;
    --danger: #ff9b92;
    --danger-bg: #3a1c1c;
    --shadow: none;

    --s-submitted-bg: #1f3563;
    --s-submitted-fg: #bcd2ff;
    --s-review-bg: #4a3510;
    --s-review-fg: #ffd68a;
    --s-approved-bg: #14412a;
    --s-approved-fg: #a6efc3;
    --s-rejected-bg: #4d1f1f;
    --s-rejected-fg: #ffb4b4;
    --s-changes-bg: #3b2859;
    --s-changes-fg: #dcc4ff;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}

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

a:hover {
  color: var(--primary-hover);
}

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

/* Skip link: hidden until focused. */
.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.42rem;
  width: 0.85rem;
  height: 0.45rem;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg);
}

.topbar nav {
  flex: 1 1 auto;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  padding: 0.3rem 0.4rem 0.3rem 0.9rem;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 0.9rem;
}

.user-chip h2 {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.2;
}

.user-chip p {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

.user-chip a {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- Page ---------- */

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

main section,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.25rem;
}

main section > :last-child,
.card > :last-child {
  margin-bottom: 0;
}

.lede {
  color: var(--muted);
  margin: -0.5rem 0 1.5rem;
}

/* ---------- Home ---------- */

.home-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.home-links a {
  display: block;
  height: 100%;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 700;
  text-decoration: none;
}

.home-links a:hover {
  border-color: var(--primary);
}

/* ---------- Forms ---------- */

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

form > div {
  margin-bottom: 1rem;
}

input[type="text"],
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 36rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

textarea {
  max-width: 44rem;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

button {
  padding: 0.55rem 1.1rem;
  margin-right: 0.4rem;
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--primary-hover);
}

/* Secondary decision buttons. */
button[value="reject"] {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

button[value="reject"]:hover {
  background: var(--danger-bg);
}

button[value="request_changes"] {
  background: transparent;
  color: var(--primary);
}

button[value="request_changes"]:hover {
  background: var(--surface-2);
}

.field-error,
[role="alert"] {
  color: var(--danger);
  font-weight: 600;
  margin: 0 0 0.4rem;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  color: var(--muted);
  padding-bottom: 0.6rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Status badges ---------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.s-submitted {
  background: var(--s-submitted-bg);
  color: var(--s-submitted-fg);
}

.s-in-review {
  background: var(--s-review-bg);
  color: var(--s-review-fg);
}

.s-approved {
  background: var(--s-approved-bg);
  color: var(--s-approved-fg);
}

.s-rejected {
  background: var(--s-rejected-bg);
  color: var(--s-rejected-fg);
}

.s-changes-requested {
  background: var(--s-changes-bg);
  color: var(--s-changes-fg);
}

/* ---------- Request detail ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.page-head h1 {
  margin: 0;
}

.jump {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

dl {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr;
  gap: 0.7rem 1.25rem;
  margin: 0;
}

dt {
  padding-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

dd {
  margin: 0;
}

#artwork-list {
  margin: 0;
  padding-left: 1.25rem;
}

#comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#comment-list li {
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
  background: var(--surface-2);
  border-radius: 10px;
}

#comment-list p {
  margin: 0;
}

#comment-list p:first-child {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ---------- Queue filters: one row ---------- */

form[action="/queue"] {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

form[action="/queue"] > div {
  margin: 0;
}

form[action="/queue"] select {
  min-width: 15rem;
}

/* ---------- Dashboard ---------- */

#overdue-count {
  font-size: 2.6rem;
  line-height: 1;
  color: var(--danger);
}

@media (max-width: 40rem) {
  .user-chip {
    margin-left: 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
