@font-face {
  font-family: "Saira Condensed";
  src: url("/fonts/saira-condensed-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --mh-sky-700: #0f59a1;
  --mh-sky-500: #3585c8;
  --mh-dune-600: #c24a12;
  --mh-dune-500: #df5515;
  --mh-river-500: #676642;
  --mh-navy-900: #0d2b3e;
  --mh-navy-800: #143c56;
  --mh-ink-900: #1d1e1b;
  --mh-ink-600: #4a4c47;
  --mh-paper-50: #f7f3ea;
  --mh-paper-100: #f0e9da;
  --mh-paper-200: #e4dac5;
  --mh-white: #ffffff;
  --risk-low: #43b05c;
  --risk-medium: #f2c230;
  --risk-high: #e0742b;
  --risk-extreme: #b3401e;
  --status-ok: #43b05c;
  --status-warn: #e0742b;
  --status-fail: #b3401e;
  --shadow-card: 0 1px 2px rgba(29, 30, 27, 0.06), 0 4px 14px rgba(29, 30, 27, 0.07);
  --wrap-max: 1180px;
  --wrap-pad: clamp(18px, 4vw, 48px);
  --bottom-space: calc(100px + env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--mh-paper-50);
  color: var(--mh-ink-600);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(20, 60, 86, 0.04), rgba(20, 60, 86, 0) 220px),
    var(--mh-paper-50);
}

a {
  color: var(--mh-sky-700);
}

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

button {
  touch-action: manipulation;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px var(--wrap-pad);
  border-bottom: 1px solid rgba(228, 218, 197, 0.9);
  background: rgba(247, 243, 234, 0.96);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--mh-ink-900);
  text-decoration: none;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 22%;
  box-shadow: var(--shadow-card);
}

.brand-text {
  display: grid;
  gap: 0;
  margin-left: 14px;
  color: var(--mh-ink-900);
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 0.92;
}

.status-pill,
.doc-count,
.eyebrow,
.summary-label,
.login-form label,
.search-field span,
.field-label > span,
.choice-group legend,
.record-type,
.record-stamp,
.sync-badge,
.card-sub {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 999px;
  background: var(--mh-white);
  color: var(--mh-ink-600);
  font-size: 12px;
}

.status-pill.is-online {
  border-color: rgba(67, 176, 92, 0.35);
  color: #245f32;
}

.status-pill.is-offline {
  border-color: rgba(179, 64, 30, 0.35);
  color: var(--status-fail);
}

.app-main {
  width: min(var(--wrap-max), 100%);
  margin: 0 auto;
  padding: 32px var(--wrap-pad) var(--bottom-space);
}

.auth-panel,
.shell,
.screen-root,
.field-form {
  display: grid;
  gap: 24px;
}

.auth-panel {
  max-width: 560px;
  min-height: calc(100vh - 180px);
  align-content: center;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 28px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  box-shadow: var(--shadow-card);
}

.compact-hero {
  align-items: start;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mh-navy-800);
  font-size: 12px;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--mh-ink-900);
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  line-height: 0.98;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(40px, 7vw, 68px);
}

h2 {
  font-size: clamp(26px, 4vw, 38px);
}

h3 {
  font-size: 22px;
}

p {
  line-height: 1.55;
}

.lede {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--mh-ink-600);
  font-size: 19px;
  line-height: 1.55;
}

.login-form,
.toolbar {
  display: grid;
  gap: 14px;
  max-width: 560px;
}

.login-form label,
.search-field span,
.field-label > span,
.choice-group legend {
  display: block;
  color: var(--mh-ink-900);
  font-size: 12px;
}

.login-form input,
.search-field input,
.field-label input,
.field-label select,
.field-label textarea,
.app-table input,
.app-table textarea {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  color: var(--mh-ink-900);
  font-size: 16px;
}

textarea,
.field-label textarea,
.app-table textarea {
  min-height: 92px;
  resize: vertical;
}

.login-form input:focus,
.search-field input:focus,
.field-label input:focus,
.field-label select:focus,
.field-label textarea:focus,
.app-table input:focus,
.app-table textarea:focus,
.btn:focus-visible,
.doc-link:focus-visible,
.action-card:focus-visible,
.choice input:focus-visible,
.table-check input:focus-visible {
  outline: 3px solid rgba(53, 133, 200, 0.45);
  outline-offset: 2px;
}

.btn,
.doc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--mh-dune-500);
  color: var(--mh-white);
}

.btn-primary:hover {
  background: var(--mh-dune-600);
}

.btn-secondary,
.doc-link {
  border-color: var(--mh-paper-200);
  background: var(--mh-white);
  color: var(--mh-navy-800);
}

.btn-secondary:hover,
.doc-link:hover {
  border-color: rgba(53, 133, 200, 0.45);
}

.form-message,
.notice {
  margin: 0;
  color: var(--mh-ink-600);
  line-height: 1.5;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(224, 116, 43, 0.35);
  border-radius: 8px;
  background: #fff7ef;
  color: var(--mh-ink-900);
}

.notice-undo {
  border-color: rgba(67, 176, 92, 0.35);
  background: #f0fbf3;
}

.library-summary,
.record-stamp {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 130px;
  color: var(--mh-ink-600);
  font-size: 12px;
}

.summary-number {
  color: var(--mh-sky-700);
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-size: 64px;
  font-weight: 700;
  line-height: 0.9;
}

.summary-label {
  color: var(--mh-ink-600);
  font-size: 12px;
}

.toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  max-width: none;
}

.document-library {
  display: grid;
  gap: 22px;
}

.doc-group {
  display: grid;
  gap: 10px;
}

.doc-group-header,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--mh-ink-900);
}

.doc-count {
  color: var(--mh-ink-600);
  font-size: 12px;
}

.doc-list,
.records-list {
  display: grid;
  gap: 8px;
}

.doc-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  box-shadow: var(--shadow-card);
}

.doc-id {
  color: var(--mh-navy-800);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.doc-title {
  min-width: 0;
  color: var(--mh-ink-900);
  font-weight: 600;
}

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

.action-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 20px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  color: var(--mh-ink-900);
  text-align: left;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.action-card-primary {
  border-color: rgba(223, 85, 21, 0.45);
}

.action-card:hover {
  border-color: rgba(53, 133, 200, 0.5);
}

.action-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-kicker,
.record-type,
.sync-badge {
  color: var(--mh-ink-600);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.action-title {
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 0.98;
  text-transform: uppercase;
}

.action-copy {
  color: var(--mh-ink-600);
  line-height: 1.45;
}

.records-panel,
.form-section {
  display: grid;
  gap: 16px;
}

.photo-panel-head,
.photo-actions,
.photo-detail-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.photo-panel-head {
  justify-content: space-between;
}

.photo-actions {
  align-items: stretch;
}

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

.photo-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  box-shadow: var(--shadow-card);
}

.photo-card.is-archived {
  opacity: 0.68;
}

.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--mh-navy-900);
  cursor: pointer;
}

.photo-thumb img,
.photo-viewer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.photo-card-body h3,
.photo-card-body p {
  margin: 0;
}

.photo-card-body p {
  color: var(--mh-ink-600);
  font-size: 14px;
}

.photo-viewer img {
  height: auto;
  max-height: min(72vh, 900px);
  object-fit: contain;
  border-radius: 8px;
  background: var(--mh-navy-900);
}

.photo-detail-grid {
  align-items: flex-start;
  color: var(--mh-ink-600);
  font-size: 14px;
}

.photo-detail-grid span {
  min-width: min(100%, 240px);
}

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  box-shadow: var(--shadow-card);
}

.record-main {
  display: grid;
  gap: 4px;
}

.record-main p {
  margin: 0;
  color: var(--mh-ink-600);
}

.record-meta,
.record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge,
.sync-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
}

.status-draft {
  border-color: rgba(242, 194, 48, 0.65);
  background: #fff8da;
  color: #5f4a00;
}

.status-complete {
  border-color: rgba(67, 176, 92, 0.45);
  background: #edf9f0;
  color: #245f32;
}

.status-archived {
  border-color: #c9c9c9;
  background: #eeeeee;
  color: #555555;
}

.sync-badge {
  border-color: var(--mh-paper-200);
  background: var(--mh-white);
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--mh-paper-200);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.form-section {
  padding: 22px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-white);
  box-shadow: var(--shadow-card);
}

.form-section p,
.form-section ul {
  margin-top: 0;
}

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

.field-label-wide {
  grid-column: 1 / -1;
}

.hint {
  color: var(--mh-ink-600);
  font-size: 15px;
}

.choice-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.standalone-choice {
  display: grid;
  gap: 8px;
}

.choice-heading {
  margin: 0;
  color: var(--mh-ink-900);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.choice-list.stacked {
  display: grid;
}

.choice {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--mh-paper-200);
  border-radius: 8px;
  background: var(--mh-paper-50);
  color: var(--mh-ink-900);
  line-height: 1.35;
  cursor: pointer;
}

.choice input,
.table-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin: 0;
  border: 2px solid var(--mh-ink-900);
  background: var(--mh-white);
  cursor: pointer;
}

.choice input[type="radio"],
.table-check input[type="radio"] {
  border-radius: 50%;
}

.choice input[type="checkbox"],
.table-check input[type="checkbox"] {
  border-radius: 5px;
}

.choice input:checked,
.table-check input:checked {
  border-color: var(--mh-sky-700);
  background: var(--mh-sky-700);
  box-shadow: inset 0 0 0 5px var(--mh-white);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-table,
.risk-matrix {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.app-table th,
.app-table td,
.risk-matrix th,
.risk-matrix td {
  border: 1px solid var(--mh-paper-200);
  padding: 10px;
  vertical-align: top;
}

.app-table th,
.risk-matrix th {
  background: var(--mh-paper-100);
  color: var(--mh-ink-900);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
}

.hazard-table th:not(:first-child),
.hazard-table td:not(:first-child) {
  width: 92px;
  text-align: center;
}

.table-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 52px;
}

.signature-placeholder {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  color: var(--mh-ink-600);
}

.risk-matrix {
  min-width: 720px;
}

.risk-matrix th,
.risk-matrix td {
  text-align: center;
}

.risk-matrix th.axis {
  text-align: left;
  background: var(--mh-white);
}

.risk-matrix td {
  color: var(--mh-ink-900);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.risk-matrix .r-low {
  background: var(--risk-low);
}

.risk-matrix .r-medium {
  background: var(--risk-medium);
}

.risk-matrix .r-high {
  background: var(--risk-high);
  color: var(--mh-white);
}

.risk-matrix .r-extreme {
  background: var(--risk-extreme);
  color: var(--mh-white);
}

.risk-key,
.scales {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--mh-ink-600);
  font-size: 14px;
}

.risk-key span,
.scales div {
  min-width: 220px;
  flex: 1;
}

.chip,
.rc-chip {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1px solid rgba(29, 30, 27, 0.35);
  vertical-align: -3px;
}

.risk-low {
  background: var(--risk-low);
}

.risk-medium {
  background: var(--risk-medium);
}

.risk-high {
  background: var(--risk-high);
}

.risk-extreme {
  background: var(--risk-extreme);
}

.nogo-section {
  border-color: rgba(179, 64, 30, 0.35);
}

.nogo-title,
.todo {
  color: var(--mh-ink-900);
  font-weight: 700;
}

.nogo-title {
  color: var(--risk-extreme);
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-size: 24px;
  text-transform: uppercase;
}

.todo {
  background: #ffe066;
  padding: 1px 5px;
  border-radius: 4px;
}

.take5-card-head {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--mh-navy-900);
  color: var(--mh-white);
  font-family: "Saira Condensed", "Arial Narrow", sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
}

.card-sub {
  margin: 0;
  color: var(--mh-ink-600);
  font-size: 11px;
}

.take5-steps {
  display: grid;
  gap: 14px;
}

.take5-step {
  display: grid;
  gap: 8px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-title h2 {
  font-size: 28px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mh-sky-700);
  color: var(--mh-white);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;
}

.rules-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px var(--wrap-pad) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(228, 218, 197, 0.9);
  background: rgba(247, 243, 234, 0.96);
  backdrop-filter: blur(12px);
}

.bottom-actions {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.bottom-bar .btn {
  min-width: 120px;
  white-space: nowrap;
}

.is-hidden {
  display: none;
}

.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;
}

@media (max-width: 900px) {
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .app-header {
    min-height: 68px;
  }

  .brand-icon {
    width: 42px;
    height: 42px;
  }

  .brand-text {
    font-size: 21px;
  }

  .hero-panel,
  .toolbar,
  .doc-row,
  .form-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .form-section {
    padding: 20px;
  }

  .library-summary,
  .record-stamp {
    justify-items: start;
  }

  .doc-row {
    align-items: stretch;
  }

  .doc-link,
  .toolbar .btn,
  .record-actions .btn,
  .photo-actions .btn {
    width: 100%;
  }

  .choice-list {
    display: grid;
  }

  .bottom-bar {
    justify-content: flex-start;
  }

  .bottom-actions {
    flex: 1;
  }

  .bottom-bar .btn {
    min-width: max-content;
    padding: 0 14px;
  }
}
