:root {
  --ink: #172017;
  --muted: #61705f;
  --line: #d9ded3;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --brand: #243326;
  --accent: #b55f31;
  --sun: #d89a22;
  --ok: #2f6f48;
  --warn: #9c3d2e;
  --shadow: 0 12px 30px rgba(23, 32, 23, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px clamp(14px, 4vw, 32px);
  background: rgba(251, 250, 246, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  background: var(--brand);
  border-radius: 8px;
  font-size: 0.8rem;
}
.nav { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.nav a, .button, button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.nav a:hover, .button:hover, button:hover { border-color: var(--accent); }
.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.button--quiet {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
}
.button--quiet:hover,
.button--quiet:focus-visible {
  color: var(--ink);
}
.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}
.logout-form { margin: 0; }
.run-as-form {
  margin: 0;
}
.run-as-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}
.run-as-form select {
  width: auto;
  min-width: 118px;
  min-height: 40px;
  padding: 8px 32px 8px 10px;
  font-weight: 800;
  text-transform: none;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; letter-spacing: 0; }
h2 { margin-bottom: 10px; font-size: 1.1rem; }
.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}
.muted, small { color: var(--muted); }
.alert {
  padding: 12px;
  border: 1px solid #efb1a6;
  border-radius: 8px;
  background: #fff0ed;
  color: var(--warn);
}
.status-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #edf6ef;
  border: 1px solid #cce1d1;
  border-radius: 8px;
}
.current-shift {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin: -10px auto 20px;
  padding: 12px 14px;
  background: #edf6ef;
  border: 1px solid #cce1d1;
  border-radius: 8px;
}
.current-shift__summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.current-shift__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.current-shift__live {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #d8eddf;
  color: var(--ok);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.current-shift__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.current-shift__actions form {
  margin: 0;
}
.current-shift__actions .button,
.current-shift__actions button {
  width: 100%;
}
.current-shift__clock-out-form {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(160px, 200px);
  gap: 8px;
  align-items: end;
}
.current-shift__reason {
  min-width: 0;
}
.current-shift__reason select {
  min-height: 44px;
}
.queue-status,
.form-status {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}
.queue-status.is-visible,
.form-status.is-visible { display: block; }
.queue-status[data-state="waiting"],
.form-status[data-state="queued"],
.form-status[data-state="requesting"],
.form-status[data-state="submitting"] {
  border-color: #edd39a;
  background: #fff8e8;
  color: #76530d;
}
.queue-status[data-state="syncing"] {
  border-color: #bdd7ef;
  background: #eef7ff;
  color: #28577c;
}
.queue-status[data-state="synced"],
.form-status[data-state="captured"] {
  border-color: #cce1d1;
  background: #edf6ef;
  color: var(--ok);
}
.queue-status[data-state="failed"],
.form-status[data-state^="failed"],
.form-status[data-state="geolocation_unavailable"] {
  border-color: #efb1a6;
  background: #fff0ed;
  color: var(--warn);
}
.offline-queue-status {
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.quick-photo-form {
  display: grid;
}
.quick-photo-form .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
}
.action-detail {
  display: grid;
  gap: 10px;
}
.action-detail summary {
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}
.action-detail summary::-webkit-details-marker {
  display: none;
}
.action-detail__form {
  margin-top: 4px;
}
.photo-action-card {
  display: grid;
  gap: 12px;
}
.photo-action-card > p {
  margin: 0;
}
.photo-action-card__form .button {
  min-height: 56px;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.section-head h2 { margin-bottom: 0; }
.date-filter {
  display: flex;
  align-items: end;
  gap: 8px;
}
.date-filter label {
  min-width: 170px;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}
.auth-panel {
  width: min(430px, 100%);
  margin: 8vh auto;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.auth-footnote {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}
.auth-footnote a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.stack { display: grid; gap: 12px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}
input[type="file"] {
  max-width: 100%;
  min-width: 0;
  padding: 8px 10px;
  overflow: hidden;
}
textarea { resize: vertical; }
fieldset {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
legend { color: var(--muted); font-weight: 800; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.check input { width: auto; min-height: auto; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.project-card, .admin-card, .work-panel > div, .work-panel > form, .two-column > form, .feed article, .photo-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.project-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 16px;
  background: var(--panel);
  border-color: color-mix(in srgb, var(--company-bg, #eef1ea) 60%, var(--line));
  box-shadow: inset 0 4px 0 color-mix(in srgb, var(--company-bg, #eef1ea) 70%, white), var(--shadow);
}
.project-card h2 { font-size: 1.35rem; margin: 0; }
.pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f4ead6;
  color: #6d4714;
  font-size: 0.78rem;
  font-weight: 800;
}
.pill.live { background: #e2f2e6; color: var(--ok); }
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: auto 0 0;
}
.stats-row div { padding-top: 10px; border-top: 1px solid var(--line); }
dt { color: var(--muted); font-size: 0.74rem; font-weight: 800; text-transform: uppercase; }
dd { margin: 2px 0 0; font-weight: 900; }

.work-panel, .two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.work-panel > div, .work-panel > form, .two-column > form { padding: 16px; }
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 22px 0 14px;
  padding-bottom: 4px;
}
.tabs a {
  white-space: nowrap;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 800;
}
.admin-tabs {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1ea;
}
.admin-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}
.admin-tabs a:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.admin-tabs a.is-active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(23, 32, 23, 0.08);
}
.section { margin: 26px 0; }
.section[id] { scroll-margin-top: 92px; }
.admin-tab-panel.section { margin-top: 0; }
.admin-tab-panel[hidden] { display: none; }
.admin-settings-stack {
  gap: 18px;
}
.admin-settings-tabs {
  align-self: flex-start;
  margin-bottom: 0;
}
.admin-settings-tab-panel {
  display: grid;
  gap: 18px;
  outline: none;
}
.admin-settings-tab-panel .muted {
  overflow-wrap: anywhere;
}
.admin-settings-section-intro {
  padding: 24px;
  background: linear-gradient(135deg, rgba(244, 239, 228, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.admin-settings-section-intro h2 {
  margin-bottom: 8px;
}
.admin-settings-section-intro .muted {
  max-width: 760px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.photo-card { overflow: hidden; }
.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e5e1d8;
}
.card-body { display: grid; gap: 8px; padding: 12px; }
.feed { display: grid; gap: 10px; }
.feed article { padding: 14px; }
.activity-feed {
  display: grid;
  gap: 10px;
  max-width: 860px;
}
.admin-active-feed .activity-feed {
  max-width: none;
}
.admin-active-feed .activity-event-title a {
  color: inherit;
  text-decoration: none;
}
.admin-active-feed .activity-event-title a:hover,
.admin-active-feed .activity-event-title a:focus-visible {
  color: var(--brand);
  text-decoration: underline;
}
.activity-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.activity-feed .activity-item {
  padding: 16px 18px;
}
.activity-kind {
  justify-self: start;
  align-self: start;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef1ea;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.activity-card-head {
  display: grid;
  gap: 8px;
}
.activity-title-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}
.activity-title-row h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}
.activity-title-row time {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  white-space: nowrap;
}
.activity-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.activity-body {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.activity-body > * {
  min-width: 0;
}
.activity-event-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.2;
}
.activity-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.45;
}
.activity-note {
  margin: 0;
  overflow-wrap: break-word;
}
.activity-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 8px;
  margin: 0;
}
.activity-facts div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}
.activity-facts dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}
.activity-facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}
.captured-location {
  display: grid;
  gap: 3px;
}
.captured-location__label {
  display: block;
  font: inherit;
  color: inherit;
  overflow-wrap: break-word;
}
.captured-location a {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}
.captured-location a:hover,
.captured-location a:focus-visible {
  text-decoration: underline;
}
.activity-title {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0;
}
.activity-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.activity-item > .activity-meta {
  display: grid;
  gap: 6px;
  align-content: start;
}
.activity-photo {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.activity-photo-preview {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.activity-photo img,
.activity-photo-preview img {
  width: 112px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e1d8;
}
.activity-photo-preview img {
  width: 132px;
}
.activity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0;
}
.activity-actions .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--accent);
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }
.edit-row td { background: #f8f5ed; }
.inline-edit {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}
.link-button {
  min-height: 34px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
  color: var(--accent);
}
.time-overview {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.time-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.time-kpi {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.time-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}
.time-kpi strong {
  display: block;
  margin-top: 3px;
  font-size: 1.5rem;
  line-height: 1.1;
}
.time-days {
  display: none;
  gap: 14px;
}
.time-day {
  display: grid;
  gap: 10px;
}
.time-day__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.time-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.time-card__head,
.time-card__meta,
.time-card__stats,
.time-card__locations {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
}
.time-card__meta,
.time-card__stats,
.time-card__locations {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.time-card__locations {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.time-card__locations div {
  min-width: 0;
}
.time-card__locations dt {
  margin: 0 0 4px;
}
.time-card__locations dd {
  margin: 0;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.admin-card { padding: 16px; align-content: start; }
.admin-create-panel { margin-bottom: 28px; }
.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.payroll-period {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8f5ed;
}
.payroll-period legend {
  padding: 0 5px;
}
.payroll-period__controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 160px)) auto;
  gap: 10px;
  align-items: end;
}
.payroll-period__status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}
.payroll-period__status[data-state="warning"] {
  color: #76530d;
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.users-table td, .users-table th { white-space: nowrap; }
.users-table td:nth-child(2) { white-space: normal; min-width: 220px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.status-badge.ok { background: #e2f2e6; color: var(--ok); }
.status-badge.muted-badge { background: #eceae4; color: var(--muted); }
.status-badge.active,
.status-badge.status-active,
.status-badge.is-active { background: #e2f2e6; color: var(--ok); }
.status-badge.archived,
.status-badge.status-archived,
.status-badge.is-archived { background: #eceae4; color: var(--muted); }
.status-badge.pending,
.status-badge.status-pending,
.status-badge.draft,
.status-badge.status-draft { background: #fff8e8; color: #76530d; }
.status-badge.warning,
.status-badge.status-warning { background: #fff0ed; color: var(--warn); }
.company-heading,
.company-inline,
.company-pill,
.company-choice__body {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.company-heading {
  margin-bottom: 4px;
  padding: 4px 8px 4px 5px;
  border-radius: 8px;
  background: var(--company-bg, #eef1ea);
  color: var(--company-fg, var(--ink));
}
.company-heading .eyebrow {
  margin: 0;
  color: inherit;
}
.company-heading__mark,
.company-inline__mark,
.company-pill__mark,
.company-choice__mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}
.company-inline {
  max-width: 100%;
  min-height: 34px;
  padding: 4px 9px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--company-bg, #eef1ea) 70%, #172017);
  border-radius: 999px;
  background: var(--company-bg, #eef1ea);
  color: var(--company-fg, var(--ink));
  font-size: 0.78rem;
  font-weight: 900;
  overflow-wrap: break-word;
}
.company-pill {
  max-width: 100%;
  min-height: 34px;
  padding: 4px 9px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--company-bg, #eef1ea) 70%, #172017);
  border-radius: 999px;
  background: var(--company-bg, #eef1ea);
  color: var(--company-fg, var(--ink));
  font-size: 0.78rem;
  font-weight: 900;
  overflow-wrap: break-word;
}
.company-pill__mark {
  display: block;
}
.company-pill[data-company="sunray-windows"] {
  border-color: #000;
  background: #000;
  color: #fff;
}
.company-pill[data-company="sunray-windows"] .company-pill__mark,
.company-pill[data-company="chalmers-contracting"] .company-pill__mark {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.company-asset-fallback {
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  background: #eef1ea;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}
.company-picker {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
}
.company-picker legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.company-picker__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.form-grid .company-picker {
  grid-column: span 2;
}
.company-choice {
  position: relative;
  min-width: 0;
  color: var(--ink);
}
.company-choice input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}
.company-choice__body {
  width: 100%;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--company-bg, white);
  color: var(--company-fg, var(--ink));
  font-weight: 850;
  cursor: pointer;
}
.company-choice input:checked + .company-choice__body {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.company-choice input:focus-visible + .company-choice__body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.project-company-heading {
  align-items: center;
  width: fit-content;
}
.project-company-logo {
  width: auto;
  max-width: 190px;
  height: 42px;
  object-fit: contain;
  padding: 4px 8px;
  border-radius: 8px;
  background: white;
}
.project-detail-head {
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--company-bg, #eef1ea) 70%, #172017);
  border-radius: 8px;
  background: var(--company-bg, #eef1ea);
  color: var(--company-fg, var(--ink));
}
.project-detail-head p,
.project-detail-head .muted {
  color: inherit;
}
.project-detail-head .button {
  border-color: color-mix(in srgb, var(--company-bg, #eef1ea) 35%, white);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}
input[type="color"] {
  min-width: 72px;
  padding: 5px;
}
.user-edit-form {
  grid-template-columns: 1.2fr 1.4fr 1.2fr 0.8fr 0.7fr auto;
}
.admin-project-head {
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.admin-project-head h1 {
  font-size: clamp(2.35rem, 4.5vw, 3.15rem);
  line-height: 1;
}
.admin-project-head .eyebrow {
  margin-bottom: 4px;
}
.admin-project-head .project-action-group {
  justify-content: flex-end;
}
.admin-project-tabs {
  margin-bottom: 16px;
}
.admin-project-panel {
  display: grid;
  gap: 12px;
}
.admin-project-section-head {
  align-items: center;
  margin-bottom: 0;
}
.admin-project-section-head .eyebrow {
  margin-bottom: 4px;
}
.flash {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}
.flash.success,
.flash.ok,
.flash.is-success {
  border-color: #cce1d1;
  background: #edf6ef;
  color: var(--ok);
}
.flash.error,
.flash.warning,
.flash.is-error {
  border-color: #efb1a6;
  background: #fff0ed;
  color: var(--warn);
}
.admin-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.36fr) minmax(190px, 0.45fr) auto;
  gap: 10px;
  align-items: end;
  margin: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin-filter-form label {
  gap: 4px;
  font-size: 0.78rem;
}
.admin-filter-form input,
.admin-filter-form select {
  min-height: 38px;
  padding-block: 8px;
}
.admin-filter-form input[type="search"] {
  background: white;
}
.admin-filter-form .filter-actions,
.project-admin-actions,
.project-action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.project-admin-actions form,
.project-action-group form {
  margin: 0;
}
.admin-filter-form .filter-actions {
  justify-content: flex-end;
}
.admin-filter-form .button,
.admin-filter-form button,
.project-admin-actions .button,
.project-admin-actions button,
.project-action-group .button,
.project-action-group button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  text-align: center;
  white-space: nowrap;
}
.admin-filter-form .button,
.admin-filter-form button {
  min-height: 38px;
  padding-block: 8px;
}
.project-admin-list {
  display: grid;
  gap: 10px;
}
.project-admin-list.is-surface,
.project-admin-list.project-admin-surface {
  gap: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(23, 32, 23, 0.05);
}
.project-admin-list.is-surface .project-admin-item,
.project-admin-list.project-admin-surface .project-admin-item {
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}
.project-admin-list.is-surface .project-admin-item:last-child,
.project-admin-list.project-admin-surface .project-admin-item:last-child {
  border-bottom: 0;
}
.project-admin-item {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.project-admin-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(220px, 1fr) 90px minmax(210px, auto);
  gap: 10px 16px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
}
.project-admin-summary > * {
  min-width: 0;
}
.project-admin-summary h2,
.project-admin-summary h3,
.project-admin-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.22;
  overflow-wrap: break-word;
}
.project-admin-summary p,
.project-admin-summary address,
.project-admin-meta,
.project-admin-description {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 650;
  overflow-wrap: break-word;
}
.project-admin-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.project-admin-meta {
  display: flex;
  gap: 6px 10px;
  flex-wrap: wrap;
  align-items: center;
}
.project-admin-summary dl,
.project-admin-details {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin: 0;
}
.project-admin-summary dt,
.project-admin-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.project-admin-summary dd,
.project-admin-details dd {
  margin: 2px 0 0;
  font-weight: 900;
  overflow-wrap: break-word;
}
.project-admin-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.project-edit-panel {
  padding: 14px;
  background: #f8f5ed;
  border-top: 1px solid var(--line);
}
.project-edit-panel .inline-edit,
.project-edit-panel form {
  display: grid;
  grid-template-columns: 1fr minmax(250px, 1.3fr) 1fr minmax(180px, 1fr) minmax(120px, 0.55fr) auto;
  gap: 10px;
  align-items: end;
}
.project-edit-panel textarea {
  min-height: 42px;
}
.project-edit-panel button[type="submit"],
.project-edit-panel .primary {
  align-self: end;
}
.project-admin-table {
  min-width: 880px;
}
.project-admin-table td,
.project-admin-table th {
  vertical-align: middle;
}
.project-admin-table td:first-child {
  min-width: 240px;
  white-space: normal;
}
.project-admin-table .project-admin-actions {
  justify-content: flex-start;
}
.company-create-form {
  margin-bottom: 16px;
}
.company-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
  align-items: end;
}
.company-form-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
}
.company-edit-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
  align-items: end;
}
.company-form-grid > *,
.company-edit-form > * {
  min-width: 0;
}
.company-card-flash {
  grid-column: 1 / -1;
  margin: 0;
}
.company-form-grid label,
.company-edit-form label {
  min-width: 0;
}
.company-admin-list {
  display: grid;
  gap: 10px;
}
.company-admin-item {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background:
    linear-gradient(90deg, var(--company-bg, #eef1ea) 0 10px, var(--panel) 10px),
    var(--panel);
  border: 1px solid color-mix(in srgb, var(--company-bg, #eef1ea) 55%, var(--line));
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.company-admin-item,
.company-admin-preview,
.company-logo-box,
.company-mark-box {
  min-width: 0;
}
.company-admin-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 10px;
  align-items: stretch;
}
.company-logo-box,
.company-mark-box {
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--company-bg, #fbfaf6);
  color: var(--company-fg, var(--ink));
}
.company-logo-preview {
  width: 100%;
  max-height: 58px;
  object-fit: contain;
}
.company-mark-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
}
.company-logo-preview.company-asset-fallback {
  min-height: 44px;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}
.company-edit-flags,
.company-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.company-edit-actions {
  justify-content: flex-end;
  grid-column: 1 / -1;
}
.company-edit-form input[type="file"],
.company-form-grid input[type="file"] {
  font-size: 0.84rem;
}

@media (max-width: 1100px) {
  .company-admin-item,
  .company-admin-preview,
  .company-edit-form,
  .company-form-grid {
    grid-template-columns: 1fr;
  }
}
.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

dialog {
  width: min(1100px, calc(100% - 20px));
  max-height: calc(100dvh - 20px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
dialog::backdrop { background: rgba(23, 32, 23, 0.6); }
#markup-dialog {
  height: min(860px, calc(100dvh - 48px));
  background: var(--panel);
}
#markup-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.markup-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 66px;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.markup-close-form {
  margin: 0;
}
.markup-title {
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.markup-top-actions,
.markup-control-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.markup-icon-button,
.markup-save,
.markup-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  white-space: nowrap;
}
.markup-icon-button:disabled,
.markup-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}
.markup-icon-button {
  width: 48px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}
.markup-save {
  min-width: 64px;
  padding-inline: 14px;
}
.markup-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  background: #ece8de;
  overscroll-behavior: contain;
}
#markup-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #ece8de;
  box-shadow: 0 8px 26px rgba(23, 32, 23, 0.18);
  touch-action: none;
}
.markup-tools {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.markup-tool-tray {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.markup-tool-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.markup-tool-group button,
.markup-contrast-group button,
.markup-transform-group button,
.markup-delete {
  min-width: 48px;
  padding: 0 10px;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
}
.markup-tool-group button[aria-pressed="true"],
.markup-contrast-group button[aria-pressed="true"] {
  border-color: var(--brand);
  background: #edf6ef;
}
.markup-contrast-group,
.markup-transform-group {
  display: grid;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f2ec;
}
.markup-contrast-group {
  grid-template-columns: repeat(2, minmax(58px, 1fr));
}
.markup-transform-group {
  grid-template-columns: repeat(2, 48px);
}
.markup-contrast-group button {
  border-color: transparent;
  background: transparent;
}
.markup-transform-group button {
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 1.08rem;
}
.markup-delete {
  color: var(--warn);
}
.markup-label-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.markup-label-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.markup-label-field input {
  min-width: 0;
  min-height: 48px;
}

@media (max-width: 980px) {
  .admin-filter-form {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.45fr);
  }
  .admin-filter-form label:first-of-type {
    grid-column: 1 / -1;
  }
  .admin-filter-form .filter-actions {
    grid-column: 1 / -1;
  }
  .admin-filter-form .filter-actions {
    justify-content: flex-start;
  }
  .project-admin-summary {
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.8fr) auto;
  }
  .project-admin-actions {
    grid-column: 1 / -1;
  }
  .project-admin-actions {
    justify-content: flex-start;
  }
  .project-edit-panel .inline-edit,
  .project-edit-panel form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; }
  .brand span:last-child { display: none; }
  .nav { grid-column: 1 / -1; justify-content: start; order: 3; }
  .run-as-form {
    grid-column: 1 / -1;
    order: 4;
  }
  .run-as-form label {
    justify-content: space-between;
  }
  .run-as-form select {
    flex: 1 1 auto;
  }
  .page-head { align-items: stretch; flex-direction: column; }
  .section-head { align-items: stretch; flex-direction: column; }
  .work-panel, .two-column { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .report-filters { grid-template-columns: 1fr; }
  .admin-filter-form {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
    padding: 10px;
  }
  .admin-filter-form label:first-of-type,
  .admin-filter-form .filter-actions {
    grid-column: 1 / -1;
  }
  .admin-filter-form .filter-actions {
    display: flex;
    justify-content: stretch;
  }
  .admin-filter-form .button,
  .admin-filter-form button {
    width: auto;
  }
  .payroll-period__controls { grid-template-columns: 1fr; }
  .inline-edit { grid-template-columns: 1fr; }
  .project-admin-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }
  .project-admin-details,
  .project-admin-actions,
  .project-action-group {
    grid-column: 1 / -1;
  }
  .project-admin-actions,
  .project-action-group {
    display: flex;
    justify-content: stretch;
  }
  .project-admin-actions .button,
  .project-admin-actions button,
  .project-action-group .button,
  .project-action-group button {
    width: auto;
  }
  .project-edit-panel {
    padding: 12px;
  }
  .project-edit-panel .inline-edit,
  .project-edit-panel form {
    grid-template-columns: 1fr;
  }
  .current-shift {
    position: sticky;
    top: 72px;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 0;
    padding: 12px;
  }
  .current-shift__actions {
    grid-template-columns: 1fr;
  }
  .current-shift__actions .button { width: 100%; text-align: center; }
  .offline-queue-status {
    position: sticky;
    top: 148px;
    z-index: 8;
  }
  .activity-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .activity-feed .activity-item {
    padding: 14px;
  }
  .activity-event-title {
    font-size: 1.05rem;
  }
  .activity-title-row {
    gap: 6px;
  }
  .activity-title-row h3 {
    font-size: 1.08rem;
  }
  .activity-title-row time {
    width: 100%;
    white-space: normal;
  }
  .activity-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .activity-photo {
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .activity-photo-preview {
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .activity-photo img,
  .activity-photo-preview img { width: 88px; }
  .time-kpis { grid-template-columns: 1fr; }
  .time-days { display: grid; }
  .time-table { display: none; }
  .time-card__locations { grid-template-columns: 1fr; }
  h1 { font-size: 2.3rem; }
  dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
  #markup-dialog {
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .markup-topbar {
    min-height: 60px;
    grid-template-columns: auto minmax(42px, 1fr) auto;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }
  .markup-stage {
    height: auto;
    min-height: 0;
    padding: 8px;
  }
  .markup-tools {
    padding-top: 8px;
  }
  .markup-tool-tray {
    grid-template-columns: 1fr;
  }
  .markup-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    justify-content: stretch;
  }
  .markup-delete {
    min-width: 76px;
  }
}

@media (max-width: 560px) {
  .admin-project-head .project-action-group,
  .admin-filter-form,
  .admin-filter-form .filter-actions,
  .project-admin-actions,
  .project-action-group {
    display: grid;
    grid-template-columns: 1fr;
  }
  .admin-filter-form {
    grid-template-columns: 1fr;
  }
  .admin-filter-form .button,
  .admin-filter-form button,
  .project-admin-actions .button,
  .project-admin-actions button,
  .project-action-group .button,
  .project-action-group button {
    width: 100%;
  }
  .project-admin-summary {
    grid-template-columns: 1fr;
  }
  .form-grid .company-picker {
    grid-column: auto;
  }
  .company-picker__options {
    grid-template-columns: 1fr;
  }
  .company-form-grid,
  .company-edit-form,
  .company-admin-item,
  .company-admin-preview {
    grid-template-columns: 1fr;
  }
  .company-edit-actions {
    justify-content: stretch;
  }
  .company-edit-actions button {
    width: 100%;
  }
}

/* Employee and foreman welcome dashboard */
.welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 14px;
  align-items: stretch;
  margin: 0 0 18px;
}
.welcome-grid > * {
  min-width: 0;
}
.shift-card,
.quick-start-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.shift-card {
  border-color: #cce1d1;
}
.shift-card--open,
.project-card--current {
  border-color: #cce1d1;
}
.shift-card h2,
.shift-card h3,
.quick-start-card h2,
.quick-start-card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}
.shift-card p,
.quick-start-card p {
  margin: 0;
  min-width: 0;
  overflow-wrap: break-word;
}
.shift-card dl,
.quick-start-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.shift-card dt,
.quick-start-card dt,
.project-card__meta dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}
.shift-card dd,
.quick-start-card dd,
.project-card__meta dd {
  margin: 2px 0 0;
  min-width: 0;
  font-weight: 900;
  overflow-wrap: break-word;
}
.shift-card .stats-row,
.quick-start-card .stats-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.welcome-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
}
.welcome-actions form {
  margin: 0;
}
.welcome-actions .button,
.welcome-actions button,
.project-card__actions .button,
.project-card__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-align: center;
}
.recent-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.recent-item > * {
  min-width: 0;
}
.recent-item a,
a.recent-item {
  font-weight: 800;
}
.recent-item time,
.recent-item small,
.recent-item .muted {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.project-grid > .project-card {
  gap: 10px;
  min-width: 0;
  min-height: 220px;
  color: inherit;
}
.project-grid > .project-card > * {
  min-width: 0;
}
.project-grid > .project-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: break-word;
}
.project-grid > .project-card h2,
.project-card__primary,
.project-card__primary h2,
.project-card__primary h3 {
  min-width: 0;
  overflow-wrap: break-word;
}
.project-card__primary {
  display: grid;
  gap: 6px;
}
.project-card__primary h2,
.project-card__primary h3 {
  margin: 0;
  line-height: 1.18;
}
.project-card__meta {
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.project-grid > .project-card .project-card__meta--address {
  color: color-mix(in srgb, var(--company-fg, var(--ink)) 68%, var(--muted));
  font-size: 1.03rem;
  font-weight: 800;
}
.project-grid > .project-card .project-card__meta--subline {
  gap: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.project-grid > .project-card .project-card__meta--subline time {
  color: var(--ink);
  font-weight: 900;
  letter-spacing: normal;
  text-transform: none;
}
.project-card__meta > * {
  min-width: 0;
}
.project-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.project-card__actions form {
  flex: 1 1 130px;
  margin: 0;
}
.project-card__actions .button,
.project-card__actions button {
  flex: 1 1 130px;
}
.project-card__actions form .button,
.project-card__actions form button {
  width: 100%;
}
.project-grid .pill {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
}
.project-grid .stats-row {
  min-width: 0;
}
.project-grid .stats-row div,
.project-grid .stats-row dd {
  min-width: 0;
}
.project-grid .stats-row dd {
  overflow-wrap: break-word;
}

@media (max-width: 900px) {
  .welcome-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .welcome-grid {
    gap: 10px;
    margin-bottom: 14px;
  }
  .shift-card,
  .quick-start-card {
    padding: 14px;
  }
  .shift-card dl,
  .quick-start-card dl {
    grid-template-columns: 1fr;
  }
  .shift-card .stats-row,
  .quick-start-card .stats-row {
    grid-template-columns: 1fr;
  }
  .welcome-actions,
  .project-card__actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .welcome-actions .button,
  .welcome-actions button,
  .project-card__actions .button,
  .project-card__actions button {
    width: 100%;
  }
  .recent-item {
    grid-template-columns: 1fr;
  }
  .project-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .project-grid > .project-card {
    min-height: 0;
    padding: 14px;
  }
  .project-card__header {
    padding: 12px;
  }
  .project-card__actions form,
  .project-card__actions .button,
  .project-card__actions button {
    flex-basis: auto;
  }
}

@media (max-width: 420px) {
  .activity-facts {
    grid-template-columns: 1fr;
  }
  .project-grid .stats-row {
    grid-template-columns: 1fr;
  }
  .project-card__top {
    grid-template-columns: 1fr;
  }
  .favorite-button {
    justify-self: end;
  }
}

/* Action-first work landing refinements */
.welcome-head {
  align-items: center;
  margin-bottom: 14px;
}
.welcome-head h1 {
  font-size: clamp(2.2rem, 4vw, 3.25rem);
}
.welcome-head .muted {
  max-width: 720px;
  font-size: 1.05rem;
}
.shift-card,
.quick-start-card {
  gap: 14px;
}
.shift-card h2,
.quick-start-card h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}
.quick-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 2px;
}
.quick-actions .button,
.quick-actions button {
  width: 100%;
  min-height: 48px;
}
.quick-clock-form--primary button,
.photo-action-card__form .button,
.quick-photo-form .button {
  min-height: 54px;
  font-size: 1rem;
  font-weight: 900;
}
.welcome-grid--start {
  grid-template-columns: 1fr;
}
.welcome-grid--start .shift-card {
  width: min(760px, 100%);
}
.shift-card--start {
  gap: 16px;
}
.start-work-company {
  display: flex;
  align-items: center;
  margin-top: -2px;
}
.shift-card--start h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}
.start-work-form {
  display: grid;
  margin: 0;
}
.start-work-form button {
  width: 100%;
  min-height: 76px;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  font-weight: 900;
}
.start-work-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.start-work-links__change {
  color: var(--accent);
  font-weight: 900;
}
.start-work-links__details {
  min-height: 42px;
  padding-inline: 16px;
}
.quick-actions form {
  margin: 0;
}
.quick-clock-form {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(160px, 220px);
  gap: 8px;
  align-items: end;
}
.quick-clock-form label {
  min-width: 0;
}
.quick-clock-form .form-status {
  grid-column: 1 / -1;
}
.quick-actions--clock-out {
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.45fr) minmax(180px, 0.45fr);
}
.quick-actions--clock-out .quick-clock-form {
  grid-column: 1 / 2;
}
.project-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
}
.project-card__header {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--company-bg, #eef1ea) 45%, white);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--company-bg, #eef1ea) 16%, white) 0%, white 100%);
}
.project-card__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}
.project-card__identity {
  display: grid;
  gap: 8px;
}
.project-card__identity h2 {
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 0.98;
}
.project-card__top .pill {
  min-width: 0;
}
.project-card__header .company-pill,
.project-card__header .pill {
  box-shadow: 0 1px 0 rgba(23, 32, 23, 0.04);
}
.favorite-button {
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-color: color-mix(in srgb, #f5d98a 60%, #8c6714);
  border-radius: 12px;
  background: #fffaf0;
  color: #9a7215;
  box-shadow: 0 10px 24px rgba(23, 32, 23, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.favorite-button:hover,
.favorite-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(23, 32, 23, 0.12);
}
.favorite-button__icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.favorite-button[aria-pressed="true"] {
  border-color: #d6a73a;
  background: #fff2cf;
  color: #b07b06;
}
.project-card h2 a {
  text-decoration: none;
}
.project-card h2 a:focus-visible,
.project-card h2 a:hover {
  color: var(--accent);
}
.project-card[data-favorite="true"] {
  border-color: #e2c56f;
}
.project-card__actions {
  align-items: stretch;
}
.project-card__actions .button,
.project-card__actions button {
  min-height: 46px;
}
.project-card__actions .form-status {
  flex-basis: 100%;
}

body[data-view="projects"] .current-shift {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }
  .logout-form {
    justify-self: end;
  }
  .welcome-head {
    gap: 10px;
    margin-bottom: 12px;
  }
  .welcome-head h1 {
    font-size: 2rem;
  }
  .welcome-head .muted {
    font-size: 1rem;
  }
  .welcome-grid--start .shift-card {
    width: 100%;
  }
  .shift-card--start h2 {
    font-size: 2rem;
  }
  .start-work-form button {
    min-height: 66px;
  }
  .quick-actions,
  .quick-clock-form {
    grid-template-columns: 1fr;
  }
  .quick-actions--clock-out {
    grid-template-columns: 1fr;
  }
  .quick-actions--clock-out .quick-clock-form {
    grid-template-columns: 1fr;
  }
  .current-shift__clock-out-form {
    grid-template-columns: 1fr;
  }
  .project-card__top {
    align-items: center;
  }
  body[data-open-shift="1"] .project-card .favorite-button {
    display: none;
  }
  body[data-view="projects"] .current-shift {
    display: grid;
  }
}

/* Admin desktop redesign */
body.admin-body {
  background:
    radial-gradient(circle at top left, rgba(216, 154, 34, 0.08), transparent 26%),
    linear-gradient(180deg, #f5f0e6 0%, #f7f4ed 28%, #f2eee5 100%);
}

.admin-body {
  color: #19211a;
}

.admin-body .page {
  width: min(1520px, 100%);
  margin: 0;
  padding: 28px 32px 48px;
}

.page--admin {
  min-width: 0;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-rail {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  align-self: start;
  min-height: 100vh;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(36, 51, 38, 0.97) 0%, rgba(24, 35, 27, 0.99) 100%);
  color: #f5f1e7;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-brand {
  align-items: center;
  gap: 12px;
}

.admin-brand .brand-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f1e2b9 0%, #c5894e 100%);
  color: #243326;
  border-radius: 14px;
  font-weight: 900;
}

.admin-brand__copy {
  display: grid;
  gap: 2px;
}

.admin-brand__copy strong {
  font-size: 1rem;
}

.admin-brand__copy small,
.admin-rail__footer .muted {
  color: rgba(245, 241, 231, 0.7);
}

.admin-rail__nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.admin-rail__nav a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: rgba(245, 241, 231, 0.82);
  font-weight: 800;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.admin-rail__nav a:hover,
.admin-rail__nav a:focus-visible {
  color: white;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.admin-rail__nav a.is-active {
  color: #18231b;
  background: linear-gradient(135deg, #f2e6c2 0%, #e4c57a 100%);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.16);
}

.admin-rail__footer {
  display: grid;
  gap: 4px;
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-rail__footer .eyebrow {
  margin-bottom: 2px;
  color: rgba(245, 241, 231, 0.62);
}

.admin-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.admin-utility {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-width: 0;
  padding: 18px 32px;
  background: rgba(247, 244, 237, 0.85);
  border-bottom: 1px solid rgba(23, 32, 23, 0.08);
  backdrop-filter: blur(18px);
}

.admin-utility__title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-utility__title .eyebrow {
  margin-bottom: 0;
}

.admin-utility__title strong {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.admin-utility__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.run-as-form--admin label {
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
}

.run-as-form--admin select {
  min-height: 36px;
  border-radius: 10px;
  background: white;
}

.admin-user-pill {
  display: grid;
  gap: 2px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.admin-user-pill span {
  font-weight: 800;
}

.admin-user-pill small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.viewing-pill {
  display: inline-grid;
  gap: 2px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 14px;
  background: rgba(255, 248, 232, 0.9);
}

.viewing-pill span {
  color: #76530d;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.viewing-pill strong {
  font-size: 0.94rem;
}

.admin-body .icon-button {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.admin-page-head,
.admin-page-actions,
.admin-kpi-grid,
.admin-layout,
.admin-main-stack,
.admin-side-panel,
.admin-side-card,
.admin-settings-grid,
.admin-filter-panel__grid,
.admin-filter-panel__footer,
.project-ops-list,
.project-ops-row,
.project-ops-row__identity,
.project-ops-row__actions,
.project-ops-row__detail,
.admin-surface__head,
.admin-drawer__head,
.admin-drawer__footer {
  min-width: 0;
}

.admin-page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.admin-page-head h1 {
  margin-bottom: 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(3.15rem, 5vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.admin-page-head .muted {
  max-width: 760px;
  font-size: 1.04rem;
}

.admin-page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.admin-page-actions .button,
.admin-page-actions button {
  min-height: 46px;
  padding-inline: 16px;
  border-radius: 14px;
}

.admin-page-actions__create-shortcut {
  display: none;
}

.button-quiet {
  background: #f4efe4;
}

.button-destructive-quiet {
  background: #fff3ef;
  color: #8a3824;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-kpi-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 38px rgba(23, 32, 23, 0.08);
}

.admin-kpi-card span,
.admin-kpi-card small {
  color: var(--muted);
}

.admin-kpi-card span {
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-kpi-card strong {
  font-size: clamp(1.7rem, 2.5vw, 2.45rem);
  line-height: 1;
}

.admin-kpi-card small {
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.admin-layout--report {
  grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.65fr);
}

.admin-layout--projects {
  grid-template-columns: minmax(0, 1.95fr) minmax(280px, 0.72fr);
}

.admin-layout--projects .admin-side-panel {
  margin-top: 64px;
  top: 164px;
}

.admin-layout--projects .admin-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.45fr) minmax(140px, 0.45fr) auto;
}

.admin-layout--projects .admin-toolbar__intro {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.admin-main-stack {
  display: grid;
  gap: 16px;
}

.admin-side-panel {
  position: sticky;
  top: 100px;
}

.admin-side-panel--wide {
  top: 100px;
}

.admin-card,
.admin-surface,
.admin-side-card {
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 46px rgba(23, 32, 23, 0.08);
}

.admin-card,
.admin-side-card,
.admin-surface {
  padding: 22px;
}

.admin-surface--flush {
  padding: 0;
  overflow: hidden;
}

.admin-surface__head,
.admin-side-card__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.admin-page-head > div,
.admin-surface__head > div,
.admin-side-card__head > div,
.admin-drawer__head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.admin-surface--flush .admin-surface__head {
  padding: 22px 22px 0;
}

.admin-surface__head h2,
.admin-side-card__head h2,
.admin-drawer__head h2,
.project-ops-row h3 {
  margin-bottom: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(240px, 1.25fr) repeat(2, minmax(160px, 0.5fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 34px rgba(23, 32, 23, 0.06);
  backdrop-filter: blur(14px);
}

.admin-toolbar--sticky {
  position: sticky;
  top: 98px;
  z-index: 8;
}

.admin-toolbar__intro {
  display: grid;
  gap: 2px;
}

.admin-toolbar__intro strong {
  font-size: 1.15rem;
}

.admin-toolbar__intro small {
  color: var(--muted);
  font-weight: 700;
}

.admin-toolbar label {
  gap: 4px;
  font-size: 0.79rem;
}

.admin-toolbar input,
.admin-toolbar select {
  min-height: 44px;
  border-radius: 14px;
}

.admin-toolbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.admin-toolbar__actions .button,
.admin-toolbar__actions button {
  min-height: 44px;
}

.admin-filter-deck {
  display: grid;
  gap: 18px;
}

.admin-filter-deck--sticky {
  position: sticky;
  top: 98px;
  z-index: 8;
}

.admin-filter-deck__section {
  display: grid;
  gap: 10px;
}

.admin-filter-deck__head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.admin-filter-deck__head .eyebrow {
  margin: 0;
}

.admin-filter-deck__head strong {
  font-size: 1rem;
}

.filter-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(23, 32, 23, 0.05);
}

.filter-chip strong {
  font-size: 0.78rem;
  color: var(--muted);
}

.filter-chip__label--short,
.admin-mobile-search {
  display: none;
}

.filter-chip.is-active {
  border-color: rgba(23, 32, 23, 0.18);
  background: #243326;
  color: #fff;
}

.filter-chip.is-active strong {
  color: rgba(255, 255, 255, 0.76);
}

.filter-chip--company {
  min-width: 0;
}

.filter-chip__mark {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 6px;
  background: white;
}

.admin-toolbar--compact {
  position: static;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.admin-toolbar--compact label {
  gap: 6px;
}

.admin-toolbar--compact input {
  min-height: 48px;
}

.project-ops-list {
  display: grid;
}

.project-ops-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(170px, 0.8fr) minmax(120px, 0.55fr) minmax(100px, 0.38fr) minmax(230px, 0.82fr);
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  border-top: 1px solid rgba(23, 32, 23, 0.08);
}

.project-ops-row--project {
  position: relative;
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.95fr) auto;
}

.project-ops-row--project::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 4px;
  border-radius: 999px;
  background: var(--company-bg, #eef1ea);
  opacity: 0.9;
}

.project-ops-list .project-ops-row:first-child {
  border-top: 0;
}

.project-ops-row--user {
  grid-template-columns: minmax(0, 1.25fr) minmax(120px, 0.45fr) minmax(130px, 0.45fr) minmax(100px, 0.35fr) minmax(120px, 0.35fr);
}

.project-ops-row__identity {
  display: grid;
  gap: 10px;
}

.project-ops-row__company {
  width: fit-content;
  max-width: 100%;
}

.project-ops-row__identity .muted {
  margin-bottom: 0;
  max-width: 44ch;
}

.project-ops-row__detail {
  display: grid;
  gap: 4px;
}

.project-ops-row__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.project-ops-row__detail span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-ops-row__detail strong {
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.project-ops-row__status {
  justify-self: start;
}

.project-ops-row__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.project-ops-row__actions form {
  margin: 0;
}

.project-ops-row__actions .button,
.project-ops-row__actions button {
  min-height: 40px;
}

.project-ops-row__actions .primary {
  min-width: 88px;
}

.admin-filter-panel {
  gap: 18px;
}

.admin-filter-panel__grid {
  display: grid;
  gap: 12px;
}

.admin-filter-panel__grid label {
  gap: 5px;
}

.admin-filter-panel__grid input,
.admin-filter-panel__grid select {
  min-height: 44px;
  border-radius: 14px;
}

.admin-filter-panel__footer {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-filter-panel__footer small {
  color: var(--muted);
  font-weight: 700;
}

.payroll-period--feature {
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f6f0e1 0%, #fbf8f1 100%);
  border-color: rgba(181, 95, 49, 0.18);
}

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

.table-wrap--dense {
  border-radius: 18px;
  box-shadow: none;
}

.table-wrap--dense table {
  min-width: 720px;
}

.table-wrap--dense th,
.table-wrap--dense td {
  padding: 13px 14px;
}

.table-wrap--dense td strong {
  display: block;
}

.table-wrap--dense td small {
  display: block;
  margin-top: 4px;
}

.admin-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.admin-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 26, 20, 0.38);
  cursor: pointer;
}

.admin-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(540px, 100vw);
  height: 100vh;
  padding: 28px;
  overflow-y: auto;
  background: #fbf8f2;
  border-left: 1px solid rgba(23, 32, 23, 0.08);
  box-shadow: -24px 0 60px rgba(12, 18, 14, 0.18);
}

.admin-modal .admin-drawer__panel {
  inset: 50% auto auto 50%;
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  height: auto;
  padding: 28px;
  border: 1px solid rgba(23, 32, 23, 0.08);
  border-radius: 24px;
  transform: translate(-50%, -50%);
  box-shadow: 0 28px 70px rgba(12, 18, 14, 0.22);
}

.admin-drawer__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.admin-drawer__close {
  width: 44px;
  min-height: 44px;
  font-size: 1.5rem;
  line-height: 1;
}

.admin-drawer__form {
  gap: 14px;
}

.admin-drawer__footer {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 6px;
}

.admin-drawer__footer .button,
.admin-drawer__footer button {
  min-height: 44px;
}

body.has-admin-drawer {
  overflow: hidden;
}

.admin-body .flash {
  margin-bottom: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.admin-body .count-pill {
  min-height: 36px;
  padding-inline: 12px;
  border-radius: 999px;
}

.admin-body .company-admin-list {
  gap: 14px;
}

.admin-body .company-admin-item {
  border-radius: 22px;
  box-shadow: 0 18px 36px rgba(23, 32, 23, 0.08);
}

@media (max-width: 1280px) {
  .admin-shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .admin-body .page,
  .admin-utility {
    padding-left: 24px;
    padding-right: 24px;
  }

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

  .admin-layout,
  .admin-layout--report {
    grid-template-columns: 1fr;
  }

  .admin-side-panel,
  .admin-side-panel--wide,
  .admin-toolbar--sticky {
    position: static;
  }

  .admin-settings-grid {
    grid-template-columns: 1fr;
  }

  .admin-page-actions__create-shortcut {
    display: inline-flex;
  }

  .admin-filter-deck--sticky {
    position: static;
  }
}

@media (max-width: 1100px) {
  .project-ops-row,
  .project-ops-row--user,
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .project-ops-row__meta {
    grid-template-columns: 1fr;
  }

  .project-ops-row__actions {
    justify-content: flex-start;
  }
}

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

  .admin-rail {
    position: static;
    min-height: 0;
    padding-bottom: 18px;
  }

  .admin-rail__nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-body .page,
  .admin-utility {
    padding: 18px 16px 26px;
  }

  .admin-utility,
  .admin-page-head,
  .admin-page-actions,
  .admin-filter-deck__head,
  .admin-surface__head,
  .admin-side-card__head,
  .admin-drawer__footer {
    grid-template-columns: 1fr;
    display: grid;
    justify-content: stretch;
  }

  .admin-page-actions,
  .filter-chip-row,
  .admin-toolbar__actions,
  .project-ops-row__actions,
  .admin-filter-panel__footer {
    justify-content: stretch;
  }

  .admin-page-actions .button,
  .admin-page-actions button,
  .filter-chip,
  .admin-toolbar__actions .button,
  .admin-toolbar__actions button,
  .project-ops-row__actions .button,
  .project-ops-row__actions button,
  .project-ops-row__actions form,
  .project-ops-row__actions form button,
  .admin-filter-panel__footer .button,
  .admin-filter-panel__footer button {
    width: 100%;
  }

  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }

  .admin-card,
  .admin-surface,
  .admin-side-card,
  .admin-toolbar,
  .admin-body .flash {
    border-radius: 18px;
  }

  .admin-drawer__panel {
    width: 100vw;
    padding: 22px 18px;
  }

  .admin-modal .admin-drawer__panel {
    inset: auto 0 0 0;
    width: 100vw;
    max-height: min(88vh, 760px);
    padding: 22px 18px;
    border-radius: 20px 20px 0 0;
    transform: none;
  }

  .admin-toolbar--compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body[data-view="admin_projects"].admin-body .admin-utility {
    position: static;
  }

  body[data-view="admin_projects"] .admin-main-stack {
    gap: 12px;
  }

  body[data-view="admin_projects"] .admin-filter-deck--sticky {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 18;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 8px;
    margin: 0 -8px 8px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(251, 250, 246, 0.96);
    box-shadow: 0 14px 30px rgba(23, 32, 23, 0.14);
    backdrop-filter: blur(18px);
  }

  body[data-view="admin_projects"] .admin-filter-deck__head,
  body[data-view="admin_projects"] .admin-search-form--desktop {
    display: none;
  }

  body[data-view="admin_projects"] .admin-filter-deck__section {
    min-width: 0;
    gap: 0;
  }

  body[data-view="admin_projects"] .admin-filter-deck__section:first-of-type {
    grid-column: 1 / -1;
  }

  body[data-view="admin_projects"] .admin-filter-deck__section:nth-of-type(2) {
    grid-column: 1;
    grid-row: 2;
  }

  body[data-view="admin_projects"] .filter-chip-row {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    padding: 1px 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body[data-view="admin_projects"] .filter-chip-row::-webkit-scrollbar {
    display: none;
  }

  body[data-view="admin_projects"] .filter-chip {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.78rem;
    box-shadow: none;
  }

  body[data-view="admin_projects"] .filter-chip strong {
    font-size: 0.72rem;
  }

  body[data-view="admin_projects"] .filter-chip--company {
    min-width: 36px;
    justify-content: center;
    padding-inline: 8px;
  }

  body[data-view="admin_projects"] .filter-chip--company .filter-chip__mark {
    width: 24px;
    height: 24px;
    border-radius: 999px;
  }

  body[data-view="admin_projects"] .filter-chip--company .filter-chip__label--full,
  body[data-view="admin_projects"] .filter-chip--company strong {
    display: none;
  }

  body[data-view="admin_projects"] .filter-chip--company .filter-chip__label--short {
    display: inline;
  }

  body[data-view="admin_projects"] .admin-mobile-search {
    position: relative;
    display: block;
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  body[data-view="admin_projects"] .admin-mobile-search summary {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(23, 32, 23, 0.14);
    border-radius: 999px;
    background: white;
    color: var(--brand);
    cursor: pointer;
    list-style: none;
  }

  body[data-view="admin_projects"] .admin-mobile-search summary::-webkit-details-marker {
    display: none;
  }

  body[data-view="admin_projects"] .admin-mobile-search svg {
    width: 18px;
    height: 18px;
  }

  body[data-view="admin_projects"] .admin-mobile-search[open] summary,
  body[data-view="admin_projects"] .admin-mobile-search.has-query summary {
    border-color: var(--brand);
    background: var(--brand);
    color: white;
  }

  body[data-view="admin_projects"] .admin-mobile-search.has-query summary::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border: 1px solid white;
    border-radius: 999px;
    background: var(--sun);
  }

  body[data-view="admin_projects"] .admin-mobile-search__form {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 19;
    display: grid;
    gap: 8px;
    width: min(326px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid rgba(23, 32, 23, 0.12);
    border-radius: 16px;
    background: white;
    box-shadow: 0 20px 42px rgba(23, 32, 23, 0.2);
  }

  body[data-view="admin_projects"] .admin-mobile-search__form label {
    gap: 6px;
    font-size: 0.78rem;
  }

  body[data-view="admin_projects"] .admin-mobile-search__form input {
    min-height: 42px;
    border-radius: 12px;
  }

  body[data-view="admin_projects"] .admin-mobile-search__actions {
    display: flex;
    gap: 8px;
  }

  body[data-view="admin_projects"] .admin-mobile-search__actions .button,
  body[data-view="admin_projects"] .admin-mobile-search__actions button {
    flex: 1 1 0;
    min-height: 40px;
    border-radius: 12px;
  }
}
