/* Сменный рапорт: one stylesheet, no framework.
   Strict business look: neutral greys, one dark-blue accent, thin 1px borders,
   2-4px corners, no shadows or gradients. Mobile first; desktop from 768px.
   CSP forbids inline styles: everything visual lives here. */

/* ---------------------------------------------------------------- Tokens */

:root {
  --c-text: #1a1a1a;
  --c-muted: #4a5059;          /* 8:1 on white */
  --c-faint: #6b7280;          /* placeholders and minor labels, 4.8:1 */
  --c-page: #f2f3f5;
  --c-surface: #ffffff;
  --c-subtle: #f7f8f9;         /* table headers, zebra, inset blocks */
  --c-border: #cfd4da;
  --c-border-strong: #9aa3ad;

  --c-accent: #1f3a5f;
  --c-accent-hover: #162c48;
  --c-accent-soft: #e8edf3;
  --c-focus: #1f3a5f;

  --c-danger: #a3221b;
  --c-danger-soft: #fbeceb;
  --c-danger-border: #e3b4b0;
  --c-success: #1e5c30;
  --c-success-soft: #e6f2e9;
  --c-success-border: #a8cfb2;
  --c-warning: #6a4a00;
  --c-warning-soft: #fdf4dc;
  --c-warning-border: #e2cb85;
  --c-info: #1f3a5f;
  --c-info-soft: #edf1f6;
  --c-info-border: #b9c6d6;

  --radius: 3px;
  --tap: 48px;                 /* minimum touch target */
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "DejaVu Sans", Arial, sans-serif;
  --container: 1280px;
}

/* ------------------------------------------------------------------ Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-page);
  color: var(--c-text);
  font: 16px/1.5 var(--font);
}

a {
  color: var(--c-accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--c-accent-hover);
}

h1,
h2,
h3 {
  line-height: 1.25;
  font-weight: 600;
}

h1 {
  font-size: 1.375rem;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.125rem;
  margin: 24px 0 8px;
}

h3 {
  font-size: 1rem;
  margin: 16px 0 6px;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

li + li {
  margin-top: 4px;
}

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

.muted {
  color: var(--c-muted);
}

.small {
  font-size: 0.9375rem;
}

.nowrap {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Header */

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--container);
  min-height: 52px;
  margin: 0 auto;
  padding: 0 var(--gap);
}

.brand {
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--c-text);
}

.brand-company {
  min-width: 0;
  overflow: hidden;
  padding-left: 12px;
  border-left: 1px solid var(--c-border);
  color: var(--c-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topbar-end a,
.topbar-end .btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
}

/* Cabinet navigation. Desktop: a row under the header, left-aligned, active item
   underlined. Phone: a bottom bar with the main sections plus a "Ещё" menu in the header. */

.cabinet-nav {
  display: none;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.cabinet-nav ul {
  display: flex;
  gap: 4px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 calc(var(--gap) - 10px);
  list-style: none;
}

.cabinet-nav li + li {
  margin-top: 0;
}

.cabinet-nav a {
  display: block;
  padding: 10px 10px 9px;
  border-bottom: 3px solid transparent;
  color: var(--c-text);
  text-decoration: none;
}

.cabinet-nav a:hover {
  border-bottom-color: var(--c-border-strong);
}

.cabinet-nav a[aria-current="page"] {
  border-bottom-color: var(--c-accent);
  font-weight: 600;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}

.tabbar li {
  flex: 1;
  margin: 0;
}

.tabbar a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 2px;
  border-top: 3px solid transparent;
  color: var(--c-text);
  font-size: 0.8125rem;
  text-align: center;
  text-decoration: none;
}

.tabbar a[aria-current="page"] {
  border-top-color: var(--c-accent);
  font-weight: 600;
}

.has-tabbar {
  padding-bottom: 56px;
}

/* "Ещё" menu (phones): a <details>, works without JavaScript. */

.menu {
  position: relative;
}

.menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu[open] summary {
  border-color: var(--c-border-strong);
}

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 200px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.menu-list li {
  margin: 0;
}

.menu-list a,
.menu-list button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--c-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-list a:hover,
.menu-list button:hover {
  background: var(--c-subtle);
}

.menu-list form {
  margin: 0;
  border-top: 1px solid var(--c-border);
}

.topbar .only-desktop {
  display: none;
}

/* ---------------------------------------------------------------- Layout */

.container {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px var(--gap) 32px;
}

.narrow {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.readable {
  max-width: 760px;
}

.footer {
  padding: 12px 0;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 0.8125rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.footer a {
  color: var(--c-muted);
}

/* Page head: breadcrumbs, title, the page's main action on the right. */

.crumbs {
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--c-muted);
}

.crumbs li {
  margin: 0;
}

.crumbs li + li::before {
  content: "/";
  margin-right: 4px;
  color: var(--c-border-strong);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
}

.page-head .lead {
  flex-basis: 100%;
  margin: 0;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lead {
  color: var(--c-muted);
}

/* Panels: a white block with a thin border. Used for groups, not for decoration. */

.panel {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.0625rem;
}

.panel > h2:first-child {
  margin: 0 0 10px;
  font-size: 1.0625rem;
}

.panel-head + * {
  margin-top: 0;
}

.panel-flush {
  padding: 0;
}

.panel-flush > .panel-head {
  padding: 14px 16px 0;
}

.panel-danger {
  border-color: var(--c-danger-border);
}

.section-title {
  margin: 24px 0 8px;
  font-size: 1.0625rem;
}

.grid-2 {
  display: grid;
  gap: 0 16px;
}

/* --------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--c-subtle);
  color: var(--c-text);
}

.btn-primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  color: #fff;
}

.btn-danger {
  border-color: var(--c-danger);
  color: var(--c-danger);
}

.btn-danger:hover {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9375rem;
}

.btn-block {
  width: 100%;
}

.btn-large {
  min-height: 56px;
  font-size: 1.125rem;
}

.btn-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Phones: action buttons are full-width, one per line, primary first. */
@media (max-width: 639px) {
  .actions > .inline-form,
  .actions > form {
    display: block;
  }

  .actions .btn {
    width: 100%;
  }
}

.consequence {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--c-muted);
}

/* ----------------------------------------------------------------- Forms */

.form-section {
  min-width: 0;
  margin: 0 0 16px;
  padding: 14px 16px 2px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.form-section > legend {
  float: left;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.form-section > legend + * {
  clear: both;
}

.form-note {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: var(--c-muted);
}

.field {
  margin-bottom: 16px;
}

.field > label,
.field-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.req {
  margin-left: 2px;
  color: var(--c-danger);
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: inherit;
  font: inherit;               /* 16px: iOS does not zoom on focus */
}

input::placeholder,
textarea::placeholder {
  color: var(--c-faint);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 0;
  border-color: var(--c-focus);
}

textarea {
  resize: vertical;
}

input[readonly],
textarea[readonly] {
  background: var(--c-subtle);
}

.field-hint {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--c-muted);
}

.field-error {
  margin: 4px 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-danger);
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-color: var(--c-danger);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--c-accent);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.form-actions {
  margin: 4px 0 16px;
}

.form-actions .btn {
  width: 100%;
}

/* ---------------------------------------------------------------- Alerts */

.alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--c-info-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--c-info-soft);
  color: var(--c-text);
}

.alert > :last-child {
  margin-bottom: 0;
}

.alert-error {
  border-color: var(--c-danger-border);
  border-left-color: var(--c-danger);
  background: var(--c-danger-soft);
}

.alert-success {
  border-color: var(--c-success-border);
  border-left-color: var(--c-success);
  background: var(--c-success-soft);
}

.alert-warning {
  border-color: var(--c-warning-border);
  border-left-color: #b88a00;
  background: var(--c-warning-soft);
}

.alert-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.alert ul {
  margin: 4px 0 0;
}

/* ---------------------------------------------------------------- Status */

.status {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-subtle);
  color: var(--c-text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.status-draft { background: #eef0f2; border-color: #c4cad1; color: #3b414a; }
.status-sent { background: var(--c-warning-soft); border-color: var(--c-warning-border); color: var(--c-warning); }
.status-confirmed { background: var(--c-success-soft); border-color: var(--c-success-border); color: var(--c-success); }
.status-disputed { background: var(--c-danger-soft); border-color: var(--c-danger-border); color: var(--c-danger); }

.tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.tag-ok {
  border-color: var(--c-success-border);
  color: var(--c-success);
}

.status-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--c-subtle);
}

.status-note > :last-child {
  margin-bottom: 0;
}

.status-note-draft { border-left-color: #8a939e; }
.status-note-sent { border-left-color: #b88a00; background: var(--c-warning-soft); border-color: var(--c-warning-border); border-left-color: #b88a00; }
.status-note-confirmed { border-left-color: var(--c-success); background: var(--c-success-soft); border-color: var(--c-success-border); border-left-color: var(--c-success); }
.status-note-disputed { border-left-color: var(--c-danger); background: var(--c-danger-soft); border-color: var(--c-danger-border); border-left-color: var(--c-danger); }

/* --------------------------------------------------------- Facts, totals */

.facts {
  display: grid;
  grid-template-columns: minmax(110px, max-content) 1fr;
  gap: 6px 16px;
  margin: 0 0 14px;
}

.facts dt {
  color: var(--c-muted);
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.facts .total-row {
  padding-top: 6px;
  border-top: 1px solid var(--c-border);
  font-weight: 600;
}

.facts .total-row .muted {
  font-weight: 400;
}

.totals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 16px;
  margin: 0;
  padding: 12px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.totals dt {
  color: var(--c-muted);
}

.totals dd {
  margin: 0 0 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Month summary on the dashboard: four counters in one bordered strip. */

.counters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.counters li {
  margin: 0;
  border-bottom: 1px solid var(--c-border);
}

.counters li:nth-child(odd) {
  border-right: 1px solid var(--c-border);
}

.counters li:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.counters a {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  color: var(--c-text);
  text-decoration: none;
}

.counters a:hover {
  background: var(--c-subtle);
}

.counter-value {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.counter-label {
  color: var(--c-muted);
  font-size: 0.9375rem;
}

/* -------------------------------------------------------- Lists, tables */

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}

.rows > li:last-child {
  border-bottom: 0;
}

.panel-flush .rows > li {
  padding-left: 16px;
  padding-right: 16px;
}

.row-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-title {
  font-weight: 600;
}

.row-meta {
  color: var(--c-muted);
  font-size: 0.9375rem;
}

.row-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.day-title {
  margin: 14px 0 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-muted);
}

.day-title:first-child {
  margin-top: 0;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  background: var(--c-subtle);
  color: var(--c-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  border-bottom-color: var(--c-border-strong);
}

.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th {
  border-bottom: 0;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table .sub {
  display: block;
  color: var(--c-muted);
  font-size: 0.875rem;
}

/* Generic list tables: on phones every row becomes a compact block of "label: value"
   lines; the first cell is the row title. Cells carry data-label. */
@media (max-width: 767px) {
  .table-scroll:has(.stack) {
    overflow: visible;
  }

  .stack thead {
    display: none;
  }

  .stack tr {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
  }

  .stack tbody tr:last-child {
    border-bottom: 0;
  }

  .stack td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 1px 0;
    border: 0;
    text-align: right;
  }

  .stack td::before {
    content: attr(data-label);
    color: var(--c-muted);
    text-align: left;
  }

  .stack td:first-child {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
    text-align: left;
  }

  .stack td:first-child::before,
  .stack td.cell-actions::before {
    content: none;
  }

  .stack td.cell-actions {
    justify-content: flex-start;
    padding-top: 6px;
  }
}

/* Shift list: compact cards on phones (no table header, four tight lines). */
@media (max-width: 767px) {
  .shift-table {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
  }

  .shift-table thead {
    display: none;
  }

  .shift-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "when status"
      "what what"
      "where where"
      "hours amount";
    gap: 2px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
  }

  .shift-table tbody tr:last-child {
    border-bottom: 0;
  }

  .shift-table td {
    padding: 0;
    border: 0;
  }

  .shift-table .c-when { grid-area: when; }
  .shift-table .c-status { grid-area: status; text-align: right; }
  .shift-table .c-what { grid-area: what; }
  .shift-table .c-where { grid-area: where; }
  .shift-table .c-hours { grid-area: hours; text-align: left; }
  .shift-table .c-amount { grid-area: amount; }

  .shift-table .c-when .sub,
  .shift-table .c-what .sub,
  .shift-table .c-where .sub {
    display: inline;
  }

  .shift-table .c-when .sub::before,
  .shift-table .c-what .sub::before,
  .shift-table .c-where .sub::before {
    content: " · ";
  }

  .page-head > .btn,
  .page-head > .page-actions,
  .page-head > .page-actions .btn {
    width: 100%;
  }

  .shift-table .c-hours::before {
    content: "К оплате: ";
    color: var(--c-muted);
  }
}

.rate-table input {
  min-width: 110px;
}

.rate-cell form {
  display: flex;
  gap: 6px;
}

.rate-cell .btn {
  min-height: var(--tap);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

/* ------------------------------------------------- Dashboard: first steps */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 2px 12px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  counter-increment: step;
}

.steps > li:last-child {
  border-bottom: 0;
}

.steps > li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--c-border-strong);
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
}

.steps > li.is-done::before {
  content: "\2713";
  border-color: var(--c-success);
  background: var(--c-success);
  color: #fff;
}

.step-body {
  min-width: 0;
}

.step-title {
  display: block;
  font-weight: 600;
}

.is-done .step-title {
  color: var(--c-muted);
  font-weight: 400;
}

.step-hint {
  display: block;
  color: var(--c-muted);
  font-size: 0.875rem;
}

.step-action {
  margin-top: 6px;
}

.progress-line {
  margin: 0 0 8px;
  color: var(--c-muted);
  font-size: 0.875rem;
}

/* Numbered instructions (help pages, first visit, "what next"). */

.howto {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  counter-reset: howto;
}

.howto > li {
  position: relative;
  margin: 0;
  padding: 0 0 12px 40px;
  counter-increment: howto;
}

.howto > li::before {
  content: counter(howto);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
}

.howto-title {
  display: block;
}

/* Directory overview: one row per section with a summary and actions. */

.dir-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dir-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

.dir-list > li:last-child {
  border-bottom: 0;
}

.dir-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
}

.dir-summary {
  display: block;
  color: var(--c-muted);
  font-size: 0.9375rem;
}

/* Tabs inside a section (active / archive). */

.subtabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--c-border);
}

.subtabs li {
  margin: 0;
}

.subtabs a {
  display: block;
  padding: 8px 12px 7px;
  border-bottom: 3px solid transparent;
  color: var(--c-text);
  text-decoration: none;
}

.subtabs a[aria-current="page"] {
  border-bottom-color: var(--c-accent);
  font-weight: 600;
}

/* Filters */

.filters {
  margin-bottom: 16px;
  padding: 12px 16px 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.presets .btn[aria-current="true"] {
  background: var(--c-accent-soft);
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.filter-grid .field {
  margin-bottom: 12px;
}

.more-filters {
  margin: 0 0 12px;
}

.more-filters > summary {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.filters .check {
  margin-bottom: 12px;
}

/* -------------------------------------------- Shift form (machinist first) */

.downtime-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0 12px;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--c-border);
}

.downtime-row .field-reason {
  grid-column: 1 / -1;
}

.downtime-row .field {
  margin-bottom: 10px;
}

.calc-total {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
}

.calc-total:empty {
  display: none;
}

.calc-total p {
  margin: 0;
}

.calc-total .calc-main {
  font-size: 1.125rem;
  font-weight: 600;
}

.calc-total .calc-detail {
  color: var(--c-muted);
  font-size: 0.9375rem;
}

/* Photos */

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.photo-list li {
  margin: 0;
}

.photo-list img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 4px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.photo-pick {
  position: relative;
  overflow: hidden;
}

.photo-pick input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

progress {
  width: 100%;
  height: 10px;
  accent-color: var(--c-accent);
}

/* Selecting drafts for one link (machinist home). */

.pick {
  flex: none;
  width: 26px;
  height: 26px;
  accent-color: var(--c-accent);
}

.shift-row {
  justify-content: flex-start;
}

.shift-row .row-main {
  flex: 1;
}

.batch-send {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

/* Verdicts and the foreman page */

.verdict {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--radius);
}

.verdict p {
  margin: 0;
}

.verdict p + p {
  margin-top: 4px;
}

.verdict-ok {
  border-color: var(--c-success-border);
  border-left-color: var(--c-success);
  background: var(--c-success-soft);
}

.verdict-bad {
  border-color: var(--c-danger-border);
  border-left-color: var(--c-danger);
  background: var(--c-danger-soft);
}

.decision {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}

.decision h3 {
  margin-top: 0;
}

.dispute {
  margin-top: 16px;
}

.dispute > summary {
  list-style: none;
}

.dispute > summary::-webkit-details-marker {
  display: none;
}

.dispute[open] > summary {
  margin-bottom: 12px;
}

.about {
  margin: 0 0 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.about > summary {
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.about[open] > summary {
  border-bottom: 1px solid var(--c-border);
}

.about-body {
  padding: 12px 16px 4px;
}

/* One-time links */

.link-field {
  margin-bottom: 12px;
}

.link-field textarea,
.link-field input {
  font-size: 0.9375rem;
}

/* History / journal */

.history {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.9375rem;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-head time {
  margin-right: 8px;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}

.history-meta {
  color: var(--c-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.history-details {
  margin: 6px 0 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}

.history summary {
  color: var(--c-accent);
  font-size: 0.875rem;
  cursor: pointer;
}

.chain a {
  font-weight: 600;
}

/* Help pages */

.help-link {
  font-size: 0.875rem;
  font-weight: 400;
  white-space: nowrap;
}

.toc {
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.toc h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.toc ol {
  margin: 0;
}

.help-section {
  scroll-margin-top: 12px;
  margin: 0 0 16px;
  padding: 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.help-section > h2:first-child {
  margin-top: 0;
}

.help-section > :last-child {
  margin-bottom: 0;
}

.help-table {
  width: 100%;
  margin: 0 0 12px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.help-table th,
.help-table td {
  padding: 6px 8px;
  border: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}

.help-table th {
  background: var(--c-subtle);
}

.example {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--c-subtle);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

/* Machinist area: larger text, everything reachable with a thumb. */

.area-m .container {
  max-width: 640px;
}

.area-m h1 {
  font-size: 1.5rem;
}

.area-m .btn-large.btn-block {
  margin-bottom: 20px;
}

@media (max-width: 479px) {
  .area-m .brand-company {
    display: none;
  }
}

.area-m .howto > li {
  font-size: 1.0625rem;
}

.big-help .howto > li {
  padding-bottom: 16px;
  font-size: 1.125rem;
}

.big-help h2 {
  font-size: 1.25rem;
}

.status-legend {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.status-legend li {
  margin: 0 0 8px;
}

/* Landing */

.landing {
  max-width: 760px;
}

.landing h1 {
  font-size: 1.5rem;
}

/* Errors and simple message pages */

.message-page {
  max-width: 520px;
  margin: 24px auto;
}

.error-code {
  margin: 0 0 4px;
  color: var(--c-muted);
  font-size: 0.875rem;
}

/* Registration consent */

.consent {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--c-subtle);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.consent h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.consent-text {
  max-height: 12em;
  overflow-y: auto;
  font-size: 0.875rem;
}

.prose h2 {
  margin-top: 20px;
}

/* --------------------------------------------------------------- Desktop */

@media (min-width: 640px) {
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .form-actions .btn {
    width: auto;
    min-width: 220px;
  }

  .totals {
    grid-template-columns: max-content 1fr;
  }

  .totals dd {
    margin-bottom: 0;
  }

  .counters {
    grid-template-columns: repeat(4, 1fr);
  }

  .counters li {
    border-bottom: 0;
    border-right: 1px solid var(--c-border);
  }

  .counters li:last-child {
    border-right: 0;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  h1 {
    font-size: 1.625rem;
  }

  .panel {
    padding: 16px 20px;
  }

  .cabinet-nav {
    display: block;
  }

  .tabbar,
  .menu {
    display: none;
  }

  .topbar .only-desktop {
    display: inline-flex;
  }

  .data-table .unit {
    display: none;
  }

  .has-tabbar {
    padding-bottom: 0;
  }

  .container {
    padding-top: 20px;
  }

  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .data-table tbody tr:nth-child(even) {
    background: #fafbfc;
  }

  .help-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
  }

  .help-layout .toc {
    position: sticky;
    top: 12px;
  }
}

/* ----------------------------------------------------------------- Print */

@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .topbar,
  .cabinet-nav,
  .tabbar,
  .footer,
  .no-print {
    display: none !important;
  }

  .panel,
  .help-section,
  .toc {
    border: 0;
    padding: 0;
  }

  .has-tabbar {
    padding-bottom: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
