/* Lectromec brand tokens, matching lectromec.com. Fonts are self-hosted (OFL). */
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
:root {
  --navy: #101a28;
  --navy-2: #182437;
  --navy-hair: #2a3850;
  --paper: #f2f1ec;
  --card: #fbfaf7;
  --tint: #f7f5f0;
  --ink: #141c2a;
  --muted: #5b6575;
  --faint: #8a92a0;
  --hair: #d9d6cc;
  --hair-2: #e7e4dc;
  --green: #0c7c53;
  --green-dim: #0a5c3f;
  --green-tint: #e4f1ea;
  --green-bright: #17a56f;
  --red: #b03a3a;
  --red-tint: #f8e9e7;
  --amber: #a55a1e;
  --amber-tint: #f7ede2;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font: 14px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.12s,
    border-color 0.12s;
}
button:hover,
.button:hover {
  background: #fff;
  border-color: #b8b4a7;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.primary:hover {
  background: var(--green-dim);
  border-color: var(--green-dim);
  color: #fff;
}
button:disabled {
  background: var(--tint);
  border-color: var(--hair-2);
  color: var(--faint);
  cursor: not-allowed;
}
.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
button.icon {
  width: 36px;
  padding: 0;
  font-size: 18px;
}
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ---------- header ---------- */
header {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
  padding: 0 max(20px, 3vw);
  background: var(--navy);
  color: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}
.brand img {
  display: block;
  height: 22px;
  width: auto;
}
.brand span {
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #b9c4d6;
  border-left: 1px solid var(--navy-hair);
  padding-left: 16px;
}
header nav {
  display: flex;
  align-self: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}
header nav button {
  min-height: 0;
  height: 100%;
  padding: 0 14px;
  border: 0;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: #b9c4d6;
  font-weight: 400;
}
header nav button:hover {
  background: none;
  border-top-color: transparent;
  color: #fff;
}
header nav button:not([aria-current]):hover {
  border-bottom-color: transparent;
}
header nav button[aria-current] {
  color: #fff;
  border-bottom-color: var(--green-bright);
}
#identity {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #dce4f0;
  flex-shrink: 0;
}
.avatar {
  height: 30px;
  width: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--navy-2);
  border: 1px solid var(--navy-hair);
  font:
    600 11px var(--mono),
    monospace;
  color: #fff;
}
.identity-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
#identity small {
  font:
    10px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8195b0;
}
#identity button {
  min-height: 30px;
  background: none;
  border-color: var(--navy-hair);
  color: #dce4f0;
  font-size: 12px;
}
main {
  max-width: 1536px;
  margin: auto;
  padding: 24px max(20px, 3vw) 64px;
}
.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 8px 14px;
  border: 1px dashed var(--hair);
  font-size: 12px;
  color: var(--muted);
}
.demo-banner strong {
  color: var(--ink);
  font-weight: 600;
}
.demo-dot {
  height: 7px;
  width: 7px;
  border-radius: 50%;
  background: var(--amber);
}

/* ---------- type ---------- */
h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: 4px 0 6px;
  font-weight: 600;
}
h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}
p {
  color: var(--muted);
  line-height: 1.55;
  margin: 8px 0 0;
}
.eyebrow {
  margin: 0;
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
}
.heading p:not(.eyebrow) {
  font-size: 13px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.section-heading p {
  font-size: 12px;
  margin-top: 4px;
}

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--hair);
  padding: 16px 20px;
}
.stat-label,
.stat-meta {
  font:
    11px var(--mono),
    monospace;
  color: var(--muted);
}
.stat-label {
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.stat-value {
  font:
    600 28px var(--mono),
    monospace;
  margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font:
    400 12px var(--sans),
    sans-serif;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- week header ---------- */
.week-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-bottom: 18px;
}
.week-title h2 {
  font-size: 24px;
  letter-spacing: -0.3px;
  margin-top: 2px;
}
.week-title .eyebrow {
  color: var(--muted);
}
.week-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.week-picker input {
  width: 42px;
  padding: 0 10px;
  color: transparent;
  cursor: pointer;
}
.week-picker input::-webkit-datetime-edit {
  display: none;
}
.week-summary {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.save-status {
  font:
    12px var(--mono),
    monospace;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.save-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-bright);
}
.save-status.busy::before {
  background: var(--amber);
}
.save-status.error {
  color: var(--red);
}
.save-status.error::before {
  background: var(--red);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--hair);
  background: var(--card);
  color: var(--muted);
  font:
    500 10px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.active,
.badge.submitted {
  color: var(--green-dim);
  border-color: #b5d9c6;
  background: var(--green-tint);
}
.badge.planned,
.badge.edited {
  color: var(--amber);
  border-color: #e3c6a8;
  background: var(--amber-tint);
}
.week-total {
  text-align: right;
  line-height: 1.1;
}
.week-total strong {
  display: block;
  font:
    600 22px var(--mono),
    monospace;
  font-variant-numeric: tabular-nums;
}
.week-total span {
  font:
    10px var(--mono),
    monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- sheet ---------- */
.sheet {
  border: 1px solid var(--hair);
  background: var(--card);
}
.cell-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--hair);
}
.cell-label {
  min-width: 260px;
  font:
    500 12px var(--mono),
    monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-note {
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.cell-note input {
  min-height: 32px;
  padding: 0 10px;
  text-transform: none;
  letter-spacing: 0;
}
.cell-note input:disabled {
  background: transparent;
  border-color: transparent;
}
.cell-message {
  font:
    12px var(--mono),
    monospace;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell-message.error {
  color: var(--red);
  white-space: normal;
}
.cell-message button {
  min-height: 28px;
  padding: 0 10px;
  font:
    500 12px var(--sans),
    sans-serif;
}
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--hair);
}
.grid-wrap {
  border: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background: var(--tint);
  border-bottom: 1px solid var(--hair);
  color: var(--muted);
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 11px 14px;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hair-2);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.total {
  text-align: right;
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#grid {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1180px;
}
#grid th,
#grid td {
  background: var(--card);
}
#grid thead th {
  background: var(--tint);
}
#grid .col-client,
#grid .col-code,
#grid .col-task {
  position: sticky;
  z-index: 1;
}
#grid .col-client {
  left: 0;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}
#grid td.col-client {
  color: var(--muted);
  font-size: 13px;
}
#grid .col-code {
  left: 160px;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
}
#grid .col-task {
  left: 370px;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  border-right: 1px solid var(--hair);
}
#grid td.col-client,
#grid td.col-task {
  overflow: hidden;
  text-overflow: ellipsis;
}
.code {
  display: block;
  font:
    600 13px var(--mono),
    monospace;
}
.project-name {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#grid th.day-header {
  text-align: right;
  width: 76px;
}
.day-date {
  display: block;
  font:
    600 13px var(--mono),
    monospace;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
#grid th.today {
  box-shadow: inset 0 3px 0 var(--green);
  color: var(--green);
}
#grid th.today .day-date {
  color: var(--green);
}
#grid th.focus {
  background: #ebe9e1;
}
#grid .weekend {
  background: #f4f2ec;
}
#grid td.day {
  position: relative;
  padding: 0;
  height: 50px;
  border-left: 1px solid var(--hair-2);
}
#grid td.today {
  background: #f1f7f3;
}
#grid tr.focus td {
  background: #f5f3ed;
}
#grid tr.focus td.today {
  background: #e9f3ed;
}
.hours,
.day-hours {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: right;
  font:
    500 15px var(--mono),
    monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.hours {
  height: 49px;
  padding: 0 12px;
}
.hours:hover {
  background: rgba(16, 26, 40, 0.03);
}
.hours:focus {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  background: #fff;
}
.hours[aria-invalid],
.day-hours[aria-invalid],
.hours.conflict,
.day-hours.conflict {
  outline: 2px solid var(--red);
  outline-offset: -2px;
  background: var(--red-tint);
}
.note-mark {
  position: absolute;
  top: 0;
  right: 0;
  border-top: 8px solid var(--amber);
  border-left: 8px solid transparent;
  pointer-events: none;
}
#grid td.total {
  width: 84px;
  border-left: 1px solid var(--hair);
  font-size: 15px;
}
#grid td.actions {
  width: 44px;
  padding: 0 6px;
  text-align: center;
}
.remove {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--faint);
  font-size: 18px;
  font-weight: 400;
}
#grid .remove {
  opacity: 0;
}
#grid tr:hover .remove,
#grid .remove:focus-visible {
  opacity: 1;
}
.remove:hover {
  color: var(--red);
  background: var(--red-tint);
}
#grid tfoot td {
  background: var(--tint);
  border-top: 1px solid var(--hair);
  border-bottom: 0;
  font-size: 14px;
}
#grid tfoot .foot-label {
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
#grid tfoot .zero {
  color: var(--faint);
  font-weight: 400;
}
#grid tfoot .grand {
  font-size: 16px;
}
#grid .empty-row td {
  position: static;
}

/* phone: one day at a time */
.day-tabs,
.day-list {
  display: none;
}
.day-tabs {
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--hair);
}
.day-tabs button {
  flex-direction: column;
  gap: 0;
  min-height: 60px;
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
}
.day-tabs .dow {
  font:
    500 10px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.day-tabs .dom {
  font:
    600 15px var(--mono),
    monospace;
}
.day-tabs .dt {
  font:
    11px var(--mono),
    monospace;
  color: var(--muted);
}
.day-tabs [aria-selected="true"] {
  border-bottom-color: var(--green);
}
.day-tabs [aria-selected="true"] .dom,
.day-tabs .today .dow {
  color: var(--green);
}
.day-list {
  padding: 10px;
}
.day-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 10px 12px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--hair);
}
.day-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.day-meta strong {
  font-weight: 500;
  font-size: 15px;
}
.day-meta span:not(.code) {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-meta span.day-note {
  color: var(--amber);
}
.day-hours {
  flex: 0 0 76px;
  height: 48px;
  padding: 0 10px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--card);
  font-size: 18px;
  font-weight: 600;
}
.day-hours:focus {
  outline: 2px solid var(--green);
  outline-offset: -1px;
}

/* add row */
.add-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--hair);
}
.combo {
  position: relative;
  flex: 0 1 540px;
}
.combo::before {
  content: "+";
  position: absolute;
  left: 12px;
  top: 6px;
  font:
    500 18px var(--mono),
    monospace;
  color: var(--green);
  pointer-events: none;
}
.combo #row-search {
  padding-left: 34px;
  border-style: dashed;
  border-color: #b8b4a7;
}
.combo #row-search:focus {
  border-style: solid;
  border-color: var(--green);
  outline: 0;
  box-shadow: 0 0 0 3px var(--green-tint);
}
#row-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  max-height: 340px;
  overflow: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--hair);
  box-shadow: 0 14px 30px -12px rgba(16, 26, 40, 0.35);
}
.option-group {
  padding: 8px 12px 4px;
  font:
    500 10px var(--mono),
    monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
#row-options [role="option"] {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 7px 12px;
  cursor: pointer;
}
#row-options [aria-selected="true"] {
  background: var(--green-tint);
}
#row-options .taken {
  cursor: default;
  color: var(--faint);
}
.option-code {
  font:
    600 12px var(--mono),
    monospace;
}
.option-task small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.option-client {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
#row-options mark {
  background: none;
  color: var(--green);
  font-weight: 700;
}
.option-empty {
  padding: 10px 12px;
  color: var(--muted);
}
.add-bar #copy {
  margin-left: auto;
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.field-hint.warning {
  color: var(--amber);
}
.footer-note {
  font:
    12px var(--mono),
    monospace;
  margin-top: 12px;
}
.empty {
  text-align: center;
  padding: 36px 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.empty strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 16px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 12px 30px -10px rgba(16, 26, 40, 0.5);
}
.toast button {
  min-height: 28px;
  background: none;
  border-color: var(--navy-hair);
  color: #7fd6ae;
  font:
    500 12px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ---------- forms ---------- */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font:
    500 11px var(--mono),
    monospace;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
}
input:not(.hours):not(.day-hours),
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font:
    400 14px var(--sans),
    sans-serif;
  letter-spacing: 0;
  text-transform: none;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
select:disabled {
  background: var(--tint);
  color: var(--faint);
}
textarea {
  resize: vertical;
}
.form-row {
  display: flex;
  gap: 14px;
  margin: 14px 0;
}
.form-row > label {
  flex: 1;
}

/* ---------- reports ---------- */
.filter-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1.4fr auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--hair);
  background: var(--card);
  margin-bottom: 16px;
}
.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--hair);
  background: var(--card);
}
.preset-buttons button {
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--hair-2);
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.preset-buttons button:last-child {
  border-right: 0;
}
.preset-buttons [aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.report-filter-state {
  font:
    12px var(--mono),
    monospace;
  margin: 0 0 16px;
  min-height: 18px;
}
.panel {
  border: 1px solid var(--hair);
  padding: 20px;
  background: var(--card);
}
.report-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2.2fr);
  gap: 18px;
  align-items: start;
}
.report-layout > * {
  min-width: 0;
}
.compact-label {
  min-width: 110px;
  max-width: 220px;
}
.compact-label select,
.compact-label input:not(.hours) {
  min-height: 34px;
  font-size: 13px;
}
.breakdown-panel .section-heading {
  align-items: start;
}
.breakdown-item {
  padding: 14px 0;
  border-top: 1px solid var(--hair-2);
}
.breakdown-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 15px;
  font-size: 13px;
  font-weight: 600;
}
.breakdown-title strong {
  font-family: var(--mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.breakdown-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.bar-track {
  height: 6px;
  margin-top: 10px;
  background: var(--hair-2);
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--green);
}
.report-detail .section-heading {
  flex-wrap: wrap;
}
#report-export {
  margin-left: auto;
  align-self: end;
}
.report-detail .table-wrap {
  max-height: 640px;
}
.report-detail .table-wrap table {
  min-width: 650px;
}
.report-detail th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.report-detail td {
  font-size: 13px;
  padding: 10px 14px;
}
.report-detail tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--tint);
  font-weight: 600;
  border-top: 1px solid var(--hair);
}
.detail-person {
  font-weight: 500;
}
.detail-project {
  font-family: var(--mono);
}

/* ---------- management ---------- */
.management-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--hair);
  background: var(--card);
}
.segmented button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--hair-2);
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
}
.segmented button:last-child {
  border-right: 0;
}
.segmented [aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.management-filters {
  display: flex;
  gap: 12px;
}
.management-filters .compact-label:first-child {
  min-width: 220px;
}
.list-count {
  font:
    12px var(--mono),
    monospace;
  margin: 18px 0 10px;
}
.project-card {
  border: 1px solid var(--hair);
  margin-top: 8px;
  background: #fff;
}
.project-card summary {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 96px 70px;
  gap: 18px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.project-card summary .badge {
  justify-self: start;
}
.project-card summary::-webkit-details-marker {
  display: none;
}
.project-main {
  min-width: 0;
}
.code-pill {
  font:
    600 13px var(--mono),
    monospace;
  margin-right: 8px;
}
.project-main strong {
  font-weight: 500;
}
.project-main p {
  font-size: 12px;
  margin-top: 3px;
}
.project-card[open] {
  border-color: #b8b4a7;
}
.project-card[open] summary {
  background: var(--tint);
  border-bottom: 1px solid var(--hair);
}
.project-dates {
  font:
    12px var(--mono),
    monospace;
  color: var(--muted);
}
.project-dates span {
  display: block;
  margin-top: 3px;
}
.project-expand {
  color: var(--green);
  font:
    500 12px var(--mono),
    monospace;
}
.project-body {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
}
.project-body > div {
  flex: 1;
  min-width: 0;
}
.project-body p {
  margin-top: 0;
}
.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.task-chip {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--hair);
  background: var(--card);
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.project-body .toolbar-actions {
  flex-shrink: 0;
}
.client-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.client-card {
  border: 1px solid var(--hair);
  padding: 18px;
  background: #fff;
}
.client-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 10px 0 4px;
}
.client-card p {
  font-size: 12px;
}
.client-icon {
  height: 34px;
  width: 34px;
  display: grid;
  place-items: center;
  background: var(--tint);
  border: 1px solid var(--hair);
  font:
    600 12px var(--mono),
    monospace;
}
.people-table .avatar {
  background: var(--tint);
  border-color: var(--hair);
  color: var(--ink);
}
.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.person-cell strong {
  font-weight: 500;
}
.person-cell small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- change history ---------- */
.audit-filter {
  margin-bottom: 14px;
}
#audit-list {
  border: 1px solid var(--hair);
  background: var(--card);
}
.audit-event {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hair-2);
}
.audit-event:last-child {
  border-bottom: 0;
}
.audit-event time {
  font:
    12px var(--mono),
    monospace;
  color: var(--muted);
  padding-top: 1px;
}
.audit-sentence {
  margin: 0;
  color: var(--ink);
}
.audit-sentence b {
  font-weight: 600;
}
.diffs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 6px;
}
.diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font:
    13px var(--mono),
    monospace;
  max-width: 100%;
}
.diff-key {
  color: var(--muted);
}
.diff del {
  color: var(--red);
  background: var(--red-tint);
  padding: 0 4px;
  text-decoration-color: rgba(176, 58, 58, 0.5);
  overflow-wrap: anywhere;
}
.diff ins {
  color: var(--green-dim);
  background: var(--green-tint);
  padding: 0 4px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.audit-event details {
  margin-top: 6px;
}
.audit-event summary {
  cursor: pointer;
  font:
    12px var(--mono),
    monospace;
  color: var(--muted);
}
.audit-event details p {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.audit-event pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
  background: var(--tint);
  border: 1px solid var(--hair-2);
  padding: 10px;
  font:
    11px/1.5 var(--mono),
    monospace;
}
.audit-channel {
  align-self: start;
  padding: 2px 6px;
  border: 1px solid var(--hair);
  font:
    500 10px var(--mono),
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.audit-channel.people {
  color: var(--green-dim);
  border-color: #b5d9c6;
  background: var(--green-tint);
}
.audit-channel.agents {
  color: #5e3c85;
  border-color: #c9b8de;
  background: #f2ecf8;
}

/* ---------- dialogs and notices ---------- */
dialog {
  max-width: 540px;
  width: calc(100% - 32px);
  padding: 24px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(16, 26, 40, 0.5);
}
dialog::backdrop {
  background: rgba(16, 26, 40, 0.45);
}
dialog h2 {
  font-size: 20px;
}
dialog form > p {
  margin: 8px 0 18px;
  font-size: 13px;
}
dialog form > label {
  margin-top: 14px;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.dialog-heading button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 22px;
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
}
.dialog-error {
  border-left: 3px solid var(--red);
  background: var(--red-tint);
  color: var(--red);
  padding: 10px 12px;
  font-size: 13px;
  margin: 14px 0 0;
}
#notice {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 20;
  max-width: min(470px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid #e5bdba;
  border-left: 4px solid var(--red);
  background: #fff;
  box-shadow: 0 10px 30px -12px rgba(16, 26, 40, 0.35);
  font-size: 13px;
  overflow-wrap: anywhere;
}
#notice.success {
  border-color: #b5d9c6;
  border-left-color: var(--green);
}
#login {
  max-width: 600px;
  margin: 80px 0;
}
#login .button {
  margin-top: 24px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  .report-layout {
    grid-template-columns: 1fr;
  }
  .filter-panel {
    grid-template-columns: 1fr 1fr 1.5fr;
  }
  .project-card summary {
    grid-template-columns: minmax(0, 1fr) 110px 90px;
  }
  .project-expand {
    display: none;
  }
  .client-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .week-summary {
    margin-left: 0;
    width: 100%;
  }
  .week-total {
    margin-left: auto;
  }
  .cell-label {
    min-width: 0;
  }
}
@media (max-width: 860px) {
  header {
    flex-wrap: wrap;
    height: auto;
    gap: 0 16px;
    padding-top: 10px;
  }
  header nav {
    order: 3;
    width: 100%;
    height: 44px;
    margin: 6px -14px 0;
  }
  .brand span {
    display: none;
  }
  .identity-copy small {
    display: none !important;
  }
}
@media (max-width: 700px) {
  main {
    padding: 16px 14px 40px;
  }
  #identity .identity-copy,
  #identity button {
    display: none;
  }
  h1 {
    font-size: 24px;
  }
  .heading {
    flex-direction: column;
    align-items: start;
    gap: 14px;
  }
  .week-head {
    gap: 12px;
  }
  .week-controls {
    width: 100%;
  }
  .week-controls #today-week {
    flex: 1;
  }
  .week-summary {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
  .week-summary #submit {
    width: 100%;
  }
  .grid-wrap {
    display: none;
  }
  .day-tabs {
    display: grid;
  }
  .day-list {
    display: block;
  }
  .cell-bar {
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .cell-label {
    width: 100%;
  }
  .cell-message {
    white-space: normal;
  }
  .add-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .combo {
    flex: none;
  }
  .add-bar #copy {
    margin-left: 0;
  }
  #row-options [role="option"] {
    grid-template-columns: 74px 1fr;
  }
  .option-client {
    display: none;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-card:first-child {
    grid-column: span 2;
  }
  .stat-value {
    font-size: 24px;
  }
  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }
  .filter-panel button {
    grid-column: span 2;
  }
  .panel {
    padding: 16px;
  }
  .section-heading {
    flex-wrap: wrap;
  }
  .section-heading .compact-label {
    max-width: none;
    flex: 1;
  }
  .management-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .management-filters .compact-label:first-child {
    min-width: 0;
    flex: 1;
  }
  .segmented button {
    flex: 1;
  }
  .project-card summary {
    grid-template-columns: minmax(0, 1fr) 80px;
    gap: 10px;
  }
  .project-dates {
    display: none;
  }
  .project-body {
    flex-direction: column;
    gap: 14px;
  }
  .client-cards {
    grid-template-columns: 1fr;
  }
  .people-table {
    min-width: 600px;
  }
  .audit-event {
    grid-template-columns: 1fr auto;
  }
  .audit-event time {
    grid-column: 1 / -1;
  }
  .audit-event .audit-main {
    grid-column: 1;
  }
  #notice {
    top: 110px;
    right: 14px;
  }
}
