:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef2f8;
  --text: #0f1629;
  --muted: #5d6b82;
  --muted-soft: #8a96a8;
  --line: #e6e9f0;
  --line-strong: #d2d8e4;
  --blue: #4f46e5;
  --blue-dark: #4338ca;
  --blue-soft: #eef0fe;
  --green: #0d9268;
  --green-soft: #e3f7ef;
  --red: #e23d3d;
  --red-soft: #fdeded;
  --amber: #b25e00;
  --amber-soft: #fff3dd;
  --violet: #7c3aed;
  --violet-soft: #f1ebfe;
  --ink: #0f1629;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 4px rgba(16, 24, 40, 0.04), 0 12px 28px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 8px 16px rgba(16, 24, 40, 0.07), 0 24px 48px rgba(16, 24, 40, 0.13);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  font-size: 14px;
}

h1, h2, h3, h4 {
  letter-spacing: -0.018em;
  font-family: var(--font);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(720px circle at 12% 8%, rgba(21, 94, 239, 0.10), transparent 60%),
    radial-gradient(640px circle at 88% 92%, rgba(105, 56, 239, 0.08), transparent 55%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  display: grid;
  gap: 18px;
}

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

.auth-brand h1 {
  font-size: 21px;
}

.auth-brand p {
  color: var(--muted);
}

.auth-form,
.admin-form {
  display: grid;
  gap: 14px;
}

.auth-message {
  min-height: 20px;
  color: var(--red);
  margin: 0;
  line-height: 1.45;
  font-size: 13.5px;
}

.success-message {
  color: var(--green);
}

.user-line {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: 13.5px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  justify-self: start;
  min-height: 30px;
  font-weight: 700;
  border-radius: 4px;
}

.link-button:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.is-operator .admin-only {
  display: none !important;
}

.client-only {
  display: none !important;
}

.is-client .client-only {
  display: block !important;
}

.is-client .operator-only {
  display: none !important;
}

.file-action {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width, 240px) minmax(0, 1fr);
}

.app-shell.sidebar-hidden {
  display: block;
}

.app-shell.sidebar-hidden .sidebar {
  display: none;
}

.sidebar {
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 1px 0 0 rgba(16, 24, 40, 0.02);
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}

.sidebar-resize-handle:hover {
  background: var(--blue-soft);
}

.sidebar.resizing .sidebar-resize-handle {
  background: var(--blue);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(155deg, var(--blue), var(--violet) 120%);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  letter-spacing: 0;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-heading h3,
.section-heading p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  font-weight: 800;
}

.brand p {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: background 120ms ease, color 120ms ease, transform 80ms ease;
  position: relative;
  display: block;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
}

.sidebar-journal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 14px;
  background: var(--surface-soft);
}

.sidebar-journal summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 0;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-journal summary::-webkit-details-marker {
  display: none;
}

.sidebar-journal summary::after {
  content: "\25BE";
  color: var(--muted);
  transition: transform 120ms ease;
}

.sidebar-journal[open] summary::after {
  transform: rotate(180deg);
}

.sidebar-journal select {
  width: 100%;
  margin-bottom: 10px;
}

.side-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
}

.help-buttons {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.help-buttons .secondary-button {
  text-align: center;
  text-decoration: none;
}

.side-panel strong {
  font-size: 32px;
  letter-spacing: -0.02em;
}

.panel-label,
.side-panel span:last-child {
  color: var(--muted);
  font-size: 12.5px;
}

.panel-label {
  font-weight: 700;
}

/* Linked-tools group: a rule above it so leaving the app reads as its own thing
   rather than as one more section of the dashboard. No margin-top:auto here —
   .side-panel above already takes the slack and pins this to the sidebar foot. */
.nav-linked {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  gap: 6px;
}

.main {
  padding: 28px 32px;
  display: grid;
  gap: 22px;
  max-width: 1280px;
}

.view-panel {
  display: grid;
  gap: 22px;
}

.section-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
  max-width: 480px;
}

.form-note {
  color: var(--muted-soft);
  font-size: 12px;
  margin: -4px 0 0;
}

.span-2 {
  grid-column: 1 / -1;
}

#submit-file-row,
#submit-drive-row {
  display: grid;
  gap: 6px;
}

#submit-file-row .form-note,
#submit-drive-row .form-note {
  margin: 0;
}

.topbar,
.section-heading,
.toolbar,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.topbar,
.section-heading,
.modal-head {
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  font-size: 25px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.eyebrow {
  color: var(--muted-soft);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button,
.primary-button,
.secondary-button,
.action-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 38px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

/* Links styled as buttons (downloads, proof files) — no underline, centered like real buttons */
a.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-button {
  min-width: 40px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  border-color: var(--blue);
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}

.primary-button:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.34);
}

.primary-button:active {
  transform: translateY(1px);
}

.secondary-button,
.action-button {
  padding: 0 13px;
  font-weight: 600;
}

.secondary-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.action-button:hover,
.icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.danger-button {
  color: var(--red);
  border-color: rgba(211, 64, 46, 0.35);
}

.danger-button:hover {
  background: var(--red-soft);
  border-color: var(--red);
}

.instructions-button {
  color: var(--amber);
  border-color: rgba(178, 94, 0, 0.35);
  background: var(--amber-soft);
}

.instructions-button:hover {
  border-color: var(--amber);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* Sidebar tree: each stage groups its Pending / Done children */
.metrics-tree { display: block; }
.metric-group { margin-bottom: 6px; }
.metric-group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; cursor: pointer; list-style: none;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--muted); border-radius: 6px; user-select: none;
}
.metric-group > summary::-webkit-details-marker { display: none; }
/* Explicit + / − box so the parent/child relationship is unmistakable */
.metric-group > summary::before {
  content: "+";
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; flex-shrink: 0;
  border: 1px solid currentColor; border-radius: 3px;
  font-size: 12px; font-weight: 700; line-height: 1; opacity: .8;
}
.metric-group[open] > summary::before { content: "\2212"; }
.metric-group > summary:hover { background: var(--line); color: inherit; }
.metric-group-total { margin-left: auto; font-weight: 600; opacity: .75; }

/* Children hang off a connector line, like a file tree */
.metrics-tree .metric-card {
  position: relative;
  padding: 6px 10px 6px 18px; margin: 0 0 0 15px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; border: none; border-top: none;
  border-left: 1px solid var(--line); border-radius: 0 6px 6px 0;
  background: transparent; box-shadow: none; font-size: 13px;
}
.metrics-tree .metric-card::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 10px; height: 1px; background: var(--line);
}
/* Last child: the vertical line stops at the tick instead of running past it */
.metrics-tree .metric-card:last-child { border-left-color: transparent; }
.metrics-tree .metric-card:last-child::after {
  content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 50%; background: var(--line);
}
.metrics-tree .metric-card:hover { transform: none; box-shadow: none; background: var(--line); }
.metrics-tree .metric-card strong { font-size: 13px; font-weight: 700; }
.metrics-tree .metric-card.active { background: var(--line); }
.metric-group-flat { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.metric-group-flat .metric-card { margin-left: 0; padding-left: 10px; border-left: none; }
.metric-group-flat .metric-card::before,
.metric-group-flat .metric-card::after { display: none; }
.metric-group.accent-blue > summary { color: var(--blue, #2563eb); }
.metric-group.accent-amber > summary { color: var(--amber, #b45309); }
.metric-group.accent-violet > summary { color: var(--violet, #7c3aed); }
.metric-group.accent-green > summary { color: var(--green, #15803d); }

.metric-card,
.section-block,
.operator-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px 20px;
  display: grid;
  gap: 8px;
  border-top: 3px solid var(--ink);
  cursor: pointer;
  transition: box-shadow 160ms ease, transform 120ms ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.metric-card:active {
  transform: translateY(0);
}

.metric-card.active {
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px var(--blue) inset;
}

.metric-card.active strong {
  color: var(--blue-dark);
}

.metric-card.accent-green.active {
  background: var(--green-soft);
  box-shadow: 0 0 0 2px var(--green) inset;
}

.metric-card.accent-green.active strong {
  color: var(--green);
}

.metric-card.accent-red.active {
  background: var(--red-soft);
  box-shadow: 0 0 0 2px var(--red) inset;
}

.metric-card.accent-red.active strong {
  color: var(--red);
}

.metric-card.accent-violet.active {
  background: rgba(105, 56, 239, 0.1);
  box-shadow: 0 0 0 2px var(--violet) inset;
}

.metric-card.accent-violet.active strong {
  color: var(--violet);
}

.metric-card strong {
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.metric-card small {
  color: var(--muted-soft);
  font-size: 12px;
}

.accent-blue {
  border-top-color: var(--blue);
}

.accent-green {
  border-top-color: var(--green);
}

.accent-red {
  border-top-color: var(--red);
}

.accent-violet {
  border-top-color: var(--violet);
}

.accent-amber {
  border-top-color: var(--amber);
}

.metric-card.accent-amber.active {
  background: var(--amber-soft);
  box-shadow: 0 0 0 2px var(--amber) inset;
}

.metric-card.accent-amber.active strong {
  color: var(--amber);
}

/* Tree-style metric rows nested under the Jobs nav item */
.nav-list .metrics {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px 14px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
  overflow-y: auto;
  min-height: 0;
}

.nav-list .metric-card {
  position: relative;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.nav-list .metric-card::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 8px;
  height: 2px;
  background: var(--line);
}

.nav-list .metric-card::after {
  content: "";
  flex: none;
  order: -1;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.nav-list .metric-card.accent-blue::after { background: var(--blue); }
.nav-list .metric-card.accent-green::after { background: var(--green); }
.nav-list .metric-card.accent-red::after { background: var(--red); }
.nav-list .metric-card.accent-violet::after { background: var(--violet); }
.nav-list .metric-card.accent-amber::after { background: var(--amber); }

.nav-list .metric-card:hover {
  background: var(--surface-soft);
  box-shadow: none;
  transform: none;
}

.nav-list .metric-card.active,
.nav-list .metric-card.accent-green.active,
.nav-list .metric-card.accent-red.active,
.nav-list .metric-card.accent-violet.active,
.nav-list .metric-card.accent-amber.active {
  background: var(--blue-soft);
  box-shadow: none;
}

.nav-list .metric-card span {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-list .metric-card strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.4;
}

.nav-list .metric-card.active strong {
  color: var(--blue-dark);
  background: #ffffff;
}

.nav-list .metric-card small {
  display: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.work-area {
  display: grid;
  gap: 18px;
}

.section-block,
.operator-panel {
  padding: 20px 22px;
}

.section-heading h3 {
  font-size: 18px;
  font-weight: 800;
}

.compact {
  margin-bottom: 14px;
}

.toolbar {
  margin: 18px 0;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Jobs is the primary working screen: keep controls and rows dense enough to
   scan several assignments without losing the visual hierarchy. */
#jobs {
  padding: 16px 18px;
}

#jobs .section-heading h3 {
  font-size: 17px;
}

#jobs .toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(130px, .7fr) minmax(140px, .8fr) minmax(220px, 1.35fr);
  align-items: end;
  margin: 12px 0;
  padding: 9px 10px;
  gap: 8px;
}

#jobs .toolbar label {
  gap: 4px;
}

#jobs .toolbar select,
#jobs .toolbar input {
  width: 100%;
  min-height: 34px;
}

#jobs .table-wrap {
  margin-bottom: 56px;
}

#jobs th,
#jobs td {
  padding: 9px 12px;
}

#jobs .file-title {
  gap: 1px;
}

#jobs .status-badge {
  min-width: 92px;
  padding: 5px 9px;
  font-size: 11px;
}

#jobs .row-actions {
  gap: 5px;
  flex-wrap: nowrap;
}

#jobs .action-button,
#jobs .icon-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.auto-assignment-note {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 8px 11px;
  border: 1px solid rgba(79, 70, 229, .22);
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
}

.auto-assignment-note strong {
  color: var(--blue-dark);
  font-size: 12px;
}

.auto-assignment-note span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--blue-dark);
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-width: calc(100vw - 32px);
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  pointer-events: none;
}

.bulk-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input,
textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
  padding: 9px 11px;
  resize: vertical;
  font-family: inherit;
}

select:hover,
input:hover,
textarea:hover {
  border-color: var(--line-strong);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.13);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
  font-style: italic;
  opacity: 1;
}

.search-field {
  min-width: min(280px, 100%);
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 70px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: #ffffff;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr {
  transition: background 100ms ease;
}

tbody tr:nth-child(even) {
  background: rgba(79, 70, 229, 0.015);
}

tbody tr:hover {
  background: var(--blue-soft);
}

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

th {
  color: var(--muted-soft);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fbfcfe;
}

.file-title {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.file-title strong {
  font-size: 13.5px;
  font-weight: 700;
}

.file-title span {
  color: var(--muted-soft);
  font-size: 12px;
}

.file-title .client-email {
  font-style: italic;
}

.file-title .meta-line {
  color: var(--muted-soft);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-width: 100px;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-soft);
  letter-spacing: 0.02em;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  flex: none;
}

.status-Received {
  color: #475467;
  background: var(--surface-strong);
}

.status-Assigned {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-In-Progress {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-Completed {
  color: var(--green);
  background: var(--green-soft);
}

.status-Uploaded {
  color: var(--violet);
  background: var(--violet-soft);
}


.progress-cell {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
  transition: width 150ms ease;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.upload-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

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

.actions-menu {
  position: relative;
  display: inline-flex;
}

.actions-menu-toggle {
  font-size: 18px;
  line-height: 1;
  padding: 0 8px;
  color: var(--muted);
}

.actions-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  flex-direction: column;
  gap: 4px;
  min-width: 170px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 8px;
}

.actions-menu.open .actions-menu-panel {
  display: flex;
}

.actions-menu-panel .action-button,
.actions-menu-panel .status-badge {
  width: 100%;
  justify-content: flex-start;
}

/* Client rows: every action inline on the row, no dropdown menu.
   Stacked in two tidy lines — proof downloads + Okay, then the rest. */
.client-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.row-actions.client-actions {
  justify-content: flex-end;
  row-gap: 6px;
}

/* Compact pill buttons keep the row light even with many proof files */
.client-actions .action-button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 999px;
}

.client-actions-secondary .action-button {
  color: var(--muted);
}

.client-actions-secondary .action-button:hover {
  color: var(--text);
}

/* Proof download links shown directly on the row (client view) */
.row-actions > a.action-button {
  border-color: rgba(79, 70, 229, 0.35);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.row-actions > a.action-button:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.row-actions .primary-action,
.row-actions .done-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.row-actions .primary-action:hover,
.row-actions .done-action:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.row-actions .done-action {
  border-color: var(--green);
  background: var(--green);
}

.row-actions .done-action:hover {
  background: #0c6345;
  border-color: #0c6345;
}

.sticky-note {
  display: inline-block;
  max-width: 340px;
  margin-top: 4px;
  padding: 5px 10px;
  background: #fff8c4;
  border: 1px solid #f0e199;
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  font-size: 12px;
  color: #6b5d1f;
  white-space: pre-wrap;
  word-break: break-word;
}

.proof-sent-note {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--violet);
  max-width: 360px;
  word-break: break-word;
}

.identifier-warning {
  display: inline-block;
  max-width: 340px;
  margin-top: 4px;
  padding: 4px 8px;
  background: #fdecea;
  border: 1px solid #f5c2bd;
  border-left: 4px solid var(--red, #d93025);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #a4231a;
}

.operator-login {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.work-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* #admin prefix outranks the compact Setup button rule */
#admin .admin-lists li .work-chip,
.work-chip {
  min-height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#admin .admin-lists li .work-chip.on,
.work-chip.on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.leave-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.client-file-note {
  display: inline-block;
  max-width: 340px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.client-file-note.file-mismatch {
  padding: 4px 8px;
  background: #fff4e5;
  border: 1px solid #f6d3a0;
  border-left: 4px solid #e8830c;
  border-radius: 6px;
  font-weight: 600;
  color: #8a4b06;
}

.approval-note {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.approval-note.approval-ok {
  color: var(--green);
}

.approval-note.approval-fix {
  color: var(--amber);
}

.row-actions .proof-action {
  border-color: var(--violet);
  background: var(--violet);
  color: #ffffff;
  font-weight: 700;
}

.row-actions .proof-action:hover {
  background: #5222c4;
  border-color: #5222c4;
}

.row-actions .send-upload-action {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
  font-weight: 700;
}

.row-actions .send-upload-action:hover {
  background: #0c6345;
  border-color: #0c6345;
}

.row-actions .stop-action {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
  font-weight: 700;
}

.row-actions .stop-action:hover {
  background: #ffe8bf;
  border-color: var(--amber);
}

.action-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 2px;
}

.journal-progress,
.operator-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
}

.journal-row,
.operator-card,
.admin-form,
.admin-lists > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #ffffff;
}

.journal-row-head,
.operator-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.journal-row strong,
.operator-head strong {
  font-size: 14.5px;
  font-weight: 700;
}

.operator-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}

.operator-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.operator-meta {
  color: var(--muted);
  font-size: 12.5px;
}
.time-spent {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.time-live {
  color: var(--blue);
}
.time-stale {
  color: var(--red, #dc2626) !important;
}
.time-waiting {
  color: var(--amber, #d97706);
}
.time-done {
  color: var(--green, #16a34a);
}
.time-none {
  color: var(--muted);
  font-weight: 400;
}
.live-timer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  color: var(--blue);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.live-timer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: live-timer-pulse 1.4s infinite;
}
@keyframes live-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.time-completed-date {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.priority-badge {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.priority-date {
  font-size: 11px;
  color: var(--muted);
}
.file-drop-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.file-drop-zone.drag-over { border-color: var(--blue); background: var(--blue-soft); }
#job-file { display: none !important; }
.file-drop-label { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.file-drop-label span:first-child { font-size: 14px; font-weight: 500; }
.file-drop-hint { font-size: 12px; color: var(--muted); }
.file-preview-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.file-preview-item { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.file-preview-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.file-preview-item .file-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.file-preview-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-size { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.upload-progress { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.upload-progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.upload-progress-bar > span { display: block; height: 100%; width: 0%; border-radius: 999px; background: var(--primary, #4f46e5); transition: width .15s ease; }
.upload-progress-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.assign-block { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.assign-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.assign-head strong { font-size: 13px; }
.assign-bulk { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; font-size: 12px; color: var(--muted); }
.assign-bulk select { font-size: 12px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: inherit; }
.assign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 210px; overflow-y: auto; }
.assign-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.assign-item > span { flex-shrink: 0; color: var(--muted); min-width: 66px; }
.assign-item select { flex: 1; min-width: 0; font-size: 12px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: inherit; }
.file-preview-article { flex-shrink: 0; max-width: 140px; font-size: 12px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: inherit; }
.file-preview-remove { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 4px; flex-shrink: 0; }
.file-preview-remove:hover { color: var(--red, #dc2626); }
.job-attached-file { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 4px 0; }
.job-attached-file a { color: var(--blue); text-decoration: none; }
.job-attached-file a:hover { text-decoration: underline; }
.file-delete-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.file-delete-btn:hover { color: var(--red, #dc2626); }
.report-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.report-filters select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13px; }
tr.report-row-warn { background: #fffbe6; }
tr.report-row-over { background: #fff1f0; }
.report-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend-ok::before, .report-legend-item.legend-ok::before { content: "●"; color: var(--green); margin-right: 4px; }
.legend-warn::before, .report-legend-item.legend-warn::before { content: "●"; color: #d97706; margin-right: 4px; }
.legend-over::before, .report-legend-item.legend-over::before { content: "●"; color: #dc2626; margin-right: 4px; }
.report-legend-item { font-size: 12px; color: var(--muted); }
tr.report-operator-divider td { background: var(--surface-alt, #f3f4f6); padding: 6px 12px; font-size: 13px; border-top: 2px solid var(--border); color: var(--text); }
.report-time-ok { color: var(--green); font-weight: 600; }
.report-time-warn { color: #d97706; font-weight: 600; }
.report-time-over { color: #dc2626; font-weight: 600; }
.operator-current-job {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mini-stats span {
  display: grid;
  gap: 1px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.mini-stats strong {
  color: var(--text);
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.admin-form h4,
.admin-lists h4 {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 800;
}

.admin-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.admin-lists ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.admin-lists li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--surface-soft);
  font-size: 13px;
}

.admin-lists li.inactive-row {
  opacity: 0.55;
  background: var(--surface);
}

/* Compact layout for the Setup page (#admin): tighter forms + denser lists */
#admin {
  padding: 16px 18px;
}

#admin .admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

#admin .admin-form {
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

#admin .admin-form label {
  gap: 3px;
}

#admin .admin-form label span {
  font-size: 11px;
}

#admin .admin-form select,
#admin .admin-form input {
  min-height: 30px;
  padding: 0 8px;
  font-size: 13px;
}

#admin .admin-form h4 {
  margin-bottom: 4px;
}

#admin .admin-form .primary-button {
  min-height: 30px;
  font-size: 12.5px;
  padding: 0 12px;
}

#admin .admin-lists {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

#admin .admin-lists h4 {
  margin-bottom: 6px;
  font-size: 13px;
}

#admin .admin-lists ul {
  gap: 6px;
}

#admin .admin-lists li {
  padding: 6px 8px;
  font-size: 12px;
  gap: 6px;
}

.setup-target-flash {
  animation: setup-flash 0.9s ease;
}

@keyframes setup-flash {
  0%, 100% { box-shadow: none; }
  25% { box-shadow: 0 0 0 3px var(--blue-soft); }
}

#admin .admin-lists li .icon-button,
#admin .admin-lists li .secondary-button,
#admin .admin-lists li .primary-button,
#admin .admin-lists li button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11.5px;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.check-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
}

.check-list span {
  color: var(--muted);
}

.check-ok strong {
  color: var(--green);
}

.check-bad strong {
  color: var(--red);
}

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(16, 22, 33, 0.5);
  backdrop-filter: blur(1px);
}

#job-form {
  padding: 22px;
}

.modal-head {
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.modal-actions {
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 22px 0 0;
}

.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transform: translateX(16px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.toast.visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-left-color: var(--green);
}

.toast-error {
  border-left-color: var(--red);
}

#confirm-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
}

#confirm-dialog::backdrop {
  background: rgba(16, 22, 33, 0.5);
  backdrop-filter: blur(1px);
}

.confirm-form {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.confirm-message {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-line;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  #sidebar-toggle {
    display: none;
  }

  #jobs .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .metrics,
  .form-grid,
  .admin-grid,
  .admin-lists,
  #admin .admin-grid,
  #admin .admin-lists {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    align-self: stretch;
    flex-wrap: wrap;
  }

  .topbar-actions > * {
    flex: 1;
  }

  #jobs {
    padding: 14px;
  }

  #jobs .toolbar {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Sept 2026 refresh — calmer surfaces, one clear Pending / Completed board,
   dialogs that can always be closed. Appended last so it wins by order.
   ========================================================================== */

.main {
  padding: 22px 28px;
  gap: 18px;
  max-width: 1600px;
}

.topbar h2 {
  font-size: 22px;
}

.section-block,
.operator-panel {
  box-shadow: var(--shadow-sm);
}

/* Flat, solid buttons: the gradient stays on the brand mark only */
.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.primary-button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  filter: none;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.action-button:focus-visible,
.link-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

#jobs .toolbar {
  background: var(--surface);
}

/* ---- Status board: Pending and Completed, one line each ---------------- */

.status-board {
  display: grid;
  gap: 8px;
  margin: 14px 0 2px;
}

.board-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.board-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.board-label::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.board-pending .board-label { color: var(--amber); }
.board-done .board-label { color: var(--green); }

.board-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.status-board .metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.status-board .metric-card span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.status-board .metric-card strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.status-board .metric-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.status-board .metric-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.status-board .metric-card.is-zero strong {
  color: var(--muted-soft);
}

.status-board .board-sum {
  background: transparent;
  border-style: dashed;
}

.status-board .board-sum span {
  color: var(--muted);
}

.board-pending .metric-card.active {
  background: var(--amber-soft);
  border: 1px solid var(--amber);
  box-shadow: none;
}

.board-done .metric-card.active {
  background: var(--green-soft);
  border: 1px solid var(--green);
  box-shadow: none;
}

.board-pending .metric-card.active span,
.board-pending .metric-card.active strong { color: var(--amber); }
.board-done .metric-card.active span,
.board-done .metric-card.active strong { color: var(--green); }

.board-showing {
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.board-showing strong {
  color: var(--text);
}

.board-showing .link-button {
  min-height: 0;
  font-size: 12.5px;
}

/* ---- Job table: a heading row opens Pending and Completed -------------- */

tbody tr:nth-child(even) {
  background: transparent;
}

#jobs tr.table-section td {
  padding: 8px 14px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

tbody tr.table-section:hover {
  background: transparent;
}

.table-section-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-section-pending .table-section-title { color: var(--amber); }
.table-section-done .table-section-title { color: var(--green); }

.table-section-count {
  display: inline-block;
  min-width: 24px;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

tbody tr.row-done {
  background: #fcfcfd;
}

tbody tr.row-done:hover {
  background: var(--blue-soft);
}

/* ---- Dialogs: close controls always reachable --------------------------- */

dialog {
  max-height: calc(100vh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}

dialog[open] {
  animation: dialog-in 140ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: none; }
}

#operator-dialog {
  width: min(440px, calc(100vw - 28px));
}

/* Big forms scroll; their title bar and buttons stay pinned in view */
#job-form,
#journal-edit-form {
  padding: 0 22px;
}

#job-form .modal-head,
#journal-edit-form .modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 14px;
  padding: 18px 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

#job-form .modal-actions,
#journal-edit-form .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 16px 0 0;
  padding: 12px 0 18px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.dialog-close {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
}

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

/* ---- Toasts: shown in the top layer, above any open dialog -------------- */

.toast-host[popover] {
  inset: 18px 18px auto auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}

.toast-host[popover]:not(:popover-open) {
  display: none;
}

.toast {
  cursor: pointer;
}

@media (max-width: 900px) {
  .board-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .board-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Journal cell: code for scanning, full title beneath */
.journal-code,
.journal-full,
td .priority-date {
  display: block;
}

.journal-full {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

/* A tick-box with its sentence beside it */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
}

.check-row span {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}

/* Toolbar gained "Sort by": five boxes for admin, four for operators */
@media (min-width: 1101px) {
  #jobs .toolbar {
    grid-template-columns: minmax(170px, 1.3fr) minmax(120px, .7fr) minmax(130px, .8fr) minmax(130px, .7fr) minmax(200px, 1.3fr);
  }

  .is-operator #jobs .toolbar {
    grid-template-columns: minmax(180px, 1.35fr) minmax(130px, .7fr) minmax(140px, .8fr) minmax(220px, 1.35fr);
  }
}

/* Work switch, third state: does the work, but only when an admin assigns it */
#admin .admin-lists li .work-chip.manual,
.work-chip.manual {
  border: 1px dashed var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

#admin .admin-lists li.chip-legend,
.admin-lists li.chip-legend {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  padding: 2px 4px;
}

/* ---- Issue-wise compact view (19 Nov 2026) ---- */
#jobs tr.issue-group td { background: var(--surface-strong); border-top: 2px solid var(--line); vertical-align: middle; }
#jobs tr.issue-group.is-open td { border-bottom: 1px dashed var(--line); }
#jobs tr.issue-member td:first-child { border-left: 3px solid var(--line); }
.issue-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.issue-chip { min-width: 24px; padding: 1px 6px; border-radius: 6px; font-size: 11.5px; font-weight: 700; text-align: center; background: #fdf1dc; color: #8a5a00; border: 1px solid #f0d49a; }
.issue-chip-In-Progress { background: #e6efff; color: #2849a8; border-color: #b8ccf5; }
.issue-chip-Completed, .issue-chip-Uploaded { background: #e3f6ea; color: #17733d; border-color: #a9dfbd; }
.issue-count { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; }
.issue-progress { width: 110px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 3px; }
.issue-progress span { display: block; height: 100%; background: #22a05a; }
.issue-progress-text { display: block; font-size: 12px; font-weight: 700; }
#jobs tr.issue-group .group-start { margin-right: 6px; }
/* 19 Nov b: done = green, pending = red */
.issue-chip-done { background: #dcf5e5; color: #13703a; border-color: #8fd6aa; }
.issue-chip-pending { background: #fde4e4; color: #b42318; border-color: #f3a9a4; }
.issue-chip-active { background: #e6efff; color: #2849a8; border-color: #b8ccf5; }
.issue-progress { display: flex; width: 130px; height: 9px; background: none; }
.issue-progress .seg-done { background: #22a05a; }
.issue-progress .seg-pending { background: #e5484d; }
.issue-progress-text { font-size: 12px; white-space: nowrap; }
.txt-done { color: #13703a; } .txt-pending { color: #b42318; }
