:root {
  font-family:
    Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #182431;
  background: #edf2f6;
  font-synthesis: none;
  --accent: #176b87;
  --accent-dark: #0f536a;
  --border: #d6e0e7;
  --muted: #647482;
  --surface: #ffffff;
  --surface-soft: #f6f9fb;
  --danger: #b42318;
  --success: #137a4b;
  --shadow: 0 14px 40px rgb(26 57 74 / 10%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border-radius: 10px;
  padding: 0 16px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
}

button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.primary {
  color: white;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  color: var(--accent-dark);
  border-color: #a9c0cd;
  background: white;
}

.secondary:hover {
  background: #eef6f9;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgb(44 137 163 / 20%), transparent 32%),
    linear-gradient(145deg, #f7fafc, #dfeaf0);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 22px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

h2,
h3 {
  margin-bottom: 6px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: #344653;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: #182431;
  border: 1px solid #b9c8d1;
  border-radius: 9px;
  background: white;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgb(23 107 135 / 20%);
  outline-offset: 1px;
  border-color: var(--accent);
}

.workspace {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  max-width: 1800px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar,
.table-meta,
.table-card,
.section-tabs,
.photos-view,
.admin-view {
  max-width: 1800px;
  margin-inline: auto;
}

.section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  width: fit-content;
  margin-left: max(0px, calc((100% - 1800px) / 2));
}

.section-tab {
  color: var(--muted);
  background: transparent;
}

.section-tab.active {
  color: white;
  background: var(--accent);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) auto minmax(300px, 1.4fr) auto auto auto;
  align-items: end;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgb(26 57 74 / 5%);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-actions button {
  white-space: nowrap;
}

.excel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.excel-actions > button,
.excel-file-button {
  white-space: nowrap;
}

.excel-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: var(--accent-dark);
  border: 1px solid #a9c0cd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-weight: 650;
}

.excel-file-button:has(input:disabled) {
  cursor: wait;
  opacity: 0.55;
}

.column-settings {
  position: relative;
}

.column-settings > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--accent-dark);
  border: 1px solid #a9c0cd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}

.column-settings > summary::-webkit-details-marker {
  display: none;
}

.column-settings[open] > summary {
  outline: 3px solid rgb(23 107 135 / 20%);
  border-color: var(--accent);
}

.column-settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 260px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
}

#column-visibility-options {
  display: grid;
  gap: 5px;
  margin: 10px 0 12px;
}

#column-visibility-options label {
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  cursor: pointer;
}

#column-visibility-options input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

#column-settings-reset {
  width: 100%;
}

.table-meta {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px 4px;
  font-size: 14px;
}

.table-meta p {
  margin: 0;
}

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

.message.error,
.error {
  color: var(--danger);
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 230px);
}

table {
  width: 100%;
  min-width: 1500px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

#equipment-table {
  table-layout: fixed;
}

#equipment-table .column-hidden,
#equipment-colgroup .column-hidden {
  display: none;
}

th,
td {
  padding: 9px;
  border-right: 1px solid #e3eaee;
  border-bottom: 1px solid #e3eaee;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding-block: 12px;
  color: #40525f;
  background: #eaf1f5;
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#equipment-table th {
  position: sticky;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  z-index: 7;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 4px;
  width: 2px;
  height: 100%;
  background: transparent;
}

.column-resizer:hover::after,
.resizing-column .column-resizer::after {
  background: var(--accent);
}

.resizing-column {
  cursor: col-resize;
  user-select: none;
}

.sort-button {
  min-height: auto;
  padding: 2px 0;
  color: inherit;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: inherit;
  letter-spacing: inherit;
  text-align: left;
}

.sort-button:hover {
  color: var(--accent-dark);
}

.sort-indicator {
  display: inline-block;
  min-width: 12px;
  color: var(--accent);
  font-size: 9px;
}

.column-filter {
  display: block;
  width: 190px;
  min-height: 34px;
  margin-top: 7px;
  padding: 5px 8px;
  border-color: #aebfc9;
  font-size: 12px;
  font-weight: 600;
}

tbody tr:nth-child(even) td {
  background: var(--surface-soft);
}

tbody tr:hover td {
  background: #eff7fa;
}

td input,
td select {
  min-width: 135px;
  min-height: 38px;
  padding: 7px 8px;
  font-size: 13px;
}

td.name-cell input {
  min-width: 280px;
}

#equipment-table td input,
#equipment-table td select,
#equipment-table td.name-cell input {
  width: 100%;
  min-width: 0;
}

.sticky-column {
  left: 0;
  z-index: 4;
}

td.sticky-column {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 100px;
  font-weight: 700;
  background: white;
}

.equipment-code-link {
  display: inline-block;
  padding-block: 8px;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.equipment-code-link:hover,
.equipment-code-link:focus-visible {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

#equipment-table td.sticky-column,
#equipment-table .group-cell {
  min-width: 0;
}

tbody tr:nth-child(even) td.sticky-column {
  background: var(--surface-soft);
}

tbody tr:hover td.sticky-column {
  background: #eff7fa;
}

.group-cell {
  min-width: 210px;
  color: #516472;
}

.row-save {
  min-height: 38px;
  padding-inline: 12px;
  color: white;
  background: var(--accent);
}

.row-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.row-actions button {
  min-width: 0;
  min-height: 38px;
  padding-inline: 8px;
  font-size: 12px;
}

.equipment-card-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 24px 80px rgb(13 42 57 / 28%);
}

.project-dialog {
  width: min(1050px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 24px 80px rgb(13 42 57 / 28%);
}

.project-dialog.compact-dialog {
  width: min(560px, calc(100vw - 32px));
}

.project-dialog::backdrop {
  background: rgb(16 35 46 / 62%);
}

.project-dialog-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

.project-dialog-header p {
  margin-bottom: 0;
}

.project-dialog-body {
  padding: 20px 24px;
}

.project-dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

.project-details-sections {
  display: grid;
  gap: 16px;
}

.project-details-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.project-details-section h3 {
  margin-bottom: 14px;
}

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

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

.project-logo-content {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  align-items: center;
  gap: 18px;
}

.project-logo-preview {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 14px;
  overflow: hidden;
  border: 1px dashed #a9bfca;
  border-radius: 12px;
  background: white;
}

.project-logo-preview img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.project-logo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-logo-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  cursor: pointer;
}

.project-logo-hint {
  margin-top: 10px;
}

.project-permit-upload {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.project-permit-gallery {
  display: grid;
  gap: 10px;
}

.project-permit-card {
  display: grid;
  grid-template-columns: 92px minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.project-permit-card p {
  margin: 4px 0;
}

.project-permit-preview {
  display: grid;
  place-items: center;
  width: 92px;
  height: 72px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
}

.project-permit-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-repeatable-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.project-repeatable-heading h3 {
  margin: 0;
}

.project-repeatable-list {
  display: grid;
  gap: 10px;
}

.project-repeatable-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(230px, 1.25fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cbdbe3;
  border-radius: 11px;
  background: white;
}

.project-instrument-row {
  grid-template-columns: minmax(240px, 1.4fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(220px, 1fr) auto;
}

.project-instrument-methods {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  min-width: 0;
  margin: 0;
  padding: 6px 10px 9px;
  border: 1px solid #c4d8e2;
  border-radius: 10px;
}

.project-instrument-methods legend {
  padding: 0 4px;
  color: #526773;
  font-size: 11px;
  font-weight: 700;
}

.project-instrument-methods label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.project-instrument-methods input {
  width: auto;
}

.project-protocol-settings h4 {
  margin: 20px 0 10px;
}

.project-protocol-start,
.project-group-dates label,
.project-protocol-documents label {
  display: grid;
  gap: 6px;
  color: #526773;
  font-size: 12px;
  font-weight: 700;
}

.project-protocol-start {
  max-width: 300px;
  margin-top: 14px;
}

.project-group-dates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.project-protocol-documents {
  display: grid;
  gap: 8px;
}

.project-protocol-documents details {
  padding: 10px 12px;
  border: 1px solid #d3e1e7;
  border-radius: 10px;
  background: #fbfdfe;
}

.project-protocol-documents summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.project-protocol-documents label {
  margin-top: 12px;
}

.project-protocol-documents textarea {
  resize: vertical;
}

.repeatable-add,
.repeatable-remove {
  white-space: nowrap;
}

.repeatable-remove {
  min-height: 42px;
  color: var(--danger);
  border-color: #e5aaa5;
}

.project-details-grid textarea {
  width: 100%;
  min-height: 90px;
  padding: 9px 11px;
  resize: vertical;
  color: #182431;
  border: 1px solid #b9c8d1;
  border-radius: 9px;
  background: white;
  font: inherit;
  font-weight: 500;
}

.project-details-grid input:disabled,
.project-details-grid textarea:disabled {
  color: #43535f;
  background: #eaf0f3;
  opacity: 1;
}

.readonly-notice {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid #bfd5df;
  border-radius: 10px;
  color: #315568;
  background: #eef7fa;
}

.equipment-card-dialog::backdrop {
  background: rgb(16 35 46 / 62%);
}

.equipment-card-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

.equipment-card-header p {
  margin-bottom: 0;
}

#equipment-card-form {
  padding: 20px 24px 24px;
}

.equipment-card-tabs {
  display: flex;
  gap: 8px;
  margin: -4px 0 18px;
  padding: 4px 0 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.equipment-card-tab {
  flex: none;
  min-height: 38px;
  padding: 8px 13px;
  color: #36515f;
  border: 1px solid #bfd0d9;
  border-radius: 999px;
  background: white;
  font-weight: 720;
  white-space: nowrap;
}

.equipment-card-tab:hover {
  border-color: var(--accent);
  background: #eff8fb;
}

.equipment-card-tab.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 5px 14px rgb(19 108 139 / 20%);
}

.equipment-card-tab.protocol-tab:not(.active) {
  color: #6b4f17;
  border-color: #dbc992;
  background: #fffaf0;
}

.equipment-card-tab-panel[hidden] {
  display: none;
}

.protocol-intro {
  border-color: #b8d6df;
  background: linear-gradient(135deg, #eef8fb, #f8fbfc);
}

.protocol-intro h3,
.protocol-intro p {
  margin: 0;
}

.protocol-intro .muted {
  max-width: 850px;
  margin-top: 6px;
}

.protocol-enabled-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 800;
}

.protocol-enabled-toggle input {
  width: 18px;
  height: 18px;
}

.equipment-card-tab.protocol-enabled:not(.active)::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: #1d8f5b;
}

.protocol-disabled > .equipment-card-section:not(.protocol-intro) {
  opacity: 0.48;
}

.protocol-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.protocol-fields label {
  display: grid;
  gap: 6px;
  color: #526773;
  font-size: 12px;
  font-weight: 700;
}

.protocol-fields .wide-field {
  grid-column: span 2;
}

.protocol-fields input,
.protocol-fields textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.protocol-fields textarea {
  resize: vertical;
}

.protocol-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.protocol-table-heading h3 {
  margin: 0;
}

.protocol-table-scroll {
  overflow-x: auto;
}

.protocol-table-scroll table {
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

.protocol-table-scroll th {
  position: static;
  padding: 10px;
  color: white;
  border-bottom: 1px solid #0b4d63;
  background: #115a73;
  font-size: 12px;
  line-height: 1.25;
}

.protocol-table-scroll td {
  min-width: 135px;
  padding: 8px;
  border-bottom: 1px solid #d8e5ea;
  background: white;
  vertical-align: middle;
}

.protocol-table-scroll th:last-child,
.protocol-table-scroll td:last-child {
  width: 92px;
  min-width: 92px;
}

.protocol-table-scroll input,
.protocol-table-scroll textarea {
  width: 100%;
  min-width: 110px;
}

.protocol-table-scroll textarea {
  min-height: 64px;
  resize: vertical;
}

.protocol-row-remove {
  min-height: 36px;
  padding-inline: 10px;
  font-size: 12px;
}

.equipment-card-section {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.equipment-card-section > h3 {
  margin-bottom: 14px;
}

.audio-notes-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.equipment-card-photos-heading h3,
.equipment-card-photos-heading p {
  margin: 0;
}

.equipment-card-photos-heading .muted {
  margin-top: 5px;
}

.equipment-card-photo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.photo-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #a9c0cd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.photo-file-button.primary {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.photo-file-button:has(input:disabled) {
  cursor: wait;
  opacity: 0.55;
}

.equipment-card-photo-grid {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.equipment-card-photo-group h4 {
  margin: 0 0 10px;
  color: var(--ink);
}

.equipment-card-photo-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.equipment-card-photo-items .photo-preview {
  height: 165px;
}

.pending-photo-group {
  padding: 12px;
  border: 1px solid #e0b65b;
  border-radius: 12px;
  background: #fff8e7;
}

.pending-photo-card {
  border-color: #e0b65b;
}

.pending-photo-preview {
  position: relative;
  overflow: hidden;
}

.pending-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pending-photo-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #573c00;
  background: rgba(255, 230, 159, 0.94);
  font-size: 0.78rem;
  font-weight: 800;
}

.pending-photo-status {
  color: #765700;
  font-size: 0.9rem;
}

.pending-photo-status.error {
  color: var(--danger);
}

.audio-notes-heading h3,
.audio-notes-heading p {
  margin: 0;
}

.audio-notes-heading .muted {
  margin-top: 5px;
}

.audio-recording-time {
  min-width: 66px;
  padding: 8px 12px;
  border: 1px solid #efaaa7;
  border-radius: 999px;
  color: #9b2622;
  background: #fff0ef;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: center;
}

.audio-notes-controls,
.audio-note-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.audio-file-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #a9c0cd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
}

.audio-notes-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.audio-note-card {
  padding: 13px;
  border: 1px solid #c4d8e2;
  border-radius: 12px;
  background: white;
}

.audio-note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.audio-note-meta,
.audio-note-loading {
  margin: 4px 0 0;
}

.audio-note-card audio {
  width: 100%;
  min-height: 42px;
}

.equipment-card-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.equipment-card-fields .wide-field {
  grid-column: span 2;
}

.inspection-results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.inspection-results-heading h3,
.inspection-results-heading p {
  margin: 0;
}

.inspection-results-heading .muted {
  max-width: 720px;
  margin-top: 5px;
}

.positive-default-badge {
  flex: none;
  padding: 7px 11px;
  border: 1px solid #8ec8ae;
  border-radius: 999px;
  color: #17623f;
  background: #e8f7ef;
  font-size: 12px;
  font-weight: 750;
}

.inspection-results {
  display: grid;
  gap: 10px;
}

.inspection-result-section {
  overflow: hidden;
  border: 1px solid #c4d8e2;
  border-radius: 12px;
  background: white;
}

.inspection-result-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  color: white;
  background: #115a73;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

.inspection-result-section > summary::-webkit-details-marker {
  display: none;
}

.inspection-result-section > summary::before {
  content: "+";
  width: 22px;
  flex: none;
  font-size: 20px;
  line-height: 1;
}

.inspection-result-section[open] > summary::before {
  content: "−";
}

.inspection-result-section > summary > span:first-of-type {
  flex: 1;
}

.inspection-section-count {
  color: #d9edf4;
  font-size: 12px;
  font-weight: 600;
}

.inspection-result-rows {
  display: grid;
}

.inspection-result-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.25fr) repeat(2, minmax(190px, 1fr));
  gap: 12px;
  align-items: start;
  padding: 13px 15px;
  border-top: 1px solid #d9e6ec;
}

.inspection-columns-3 .inspection-result-row {
  grid-template-columns: minmax(210px, 1.15fr) repeat(3, minmax(170px, 1fr));
}

.inspection-result-row:nth-child(even) {
  background: #f3f8fa;
}

.inspection-result-label {
  padding-top: 8px;
  font-weight: 720;
  line-height: 1.35;
}

.inspection-result-row label,
.inspection-summary-grid label {
  display: grid;
  gap: 5px;
  color: #526773;
  font-size: 12px;
  font-weight: 700;
}

.inspection-result-row input,
.inspection-result-row select,
.inspection-result-row textarea,
.inspection-summary-grid select,
.inspection-summary-grid textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.inspection-result-row textarea,
.inspection-summary-grid textarea {
  resize: vertical;
}

.inspection-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid #c4d8e2;
  border-radius: 12px;
  background: white;
}

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

.equipment-characteristics-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.equipment-characteristics-heading h3,
.equipment-characteristics-heading p {
  margin: 0;
}

.equipment-characteristics-heading p {
  margin-top: 4px;
}

.equipment-characteristics-scroll {
  overflow-x: auto;
}

.equipment-characteristics-scroll table {
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.equipment-characteristics-scroll th {
  position: static;
  padding: 0 6px;
  border: 0;
  background: transparent;
}

.equipment-characteristics-scroll td {
  padding: 0 6px;
  border: 0;
  background: transparent !important;
}

.equipment-characteristics-scroll th:first-child {
  width: 42%;
}

.equipment-characteristics-scroll input {
  width: 100%;
  min-width: 0;
}

.equipment-card-system dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.equipment-card-system dl div {
  padding: 12px;
  border-radius: 10px;
  background: white;
}

.equipment-card-system dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.equipment-card-system dd {
  margin: 5px 0 0;
  font-weight: 650;
}

#equipment-card-characteristics-json {
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  color: #314552;
  background: white;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.equipment-card-actions {
  position: sticky;
  bottom: -24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px -24px -24px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

.row-save.saved {
  background: var(--success);
}

.row-save.failed {
  background: var(--danger);
}

.empty-state {
  padding: 50px 24px;
  color: var(--muted);
  text-align: center;
}

.photos-view {
  display: grid;
  gap: 16px;
}

.photos-heading,
.photos-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.photos-heading p,
.photos-meta p {
  margin-bottom: 0;
}

.photos-toolbar {
  max-width: none;
  width: 100%;
  grid-template-columns: minmax(220px, 0.7fr) minmax(300px, 1.4fr) minmax(220px, 0.7fr);
}

.photos-meta {
  min-height: 24px;
  padding-inline: 2px;
  font-size: 14px;
}

.photos-gallery {
  display: grid;
  gap: 18px;
}

.equipment-photos {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgb(26 57 74 / 5%);
}

.equipment-photos-heading {
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.equipment-photos-heading h3,
.equipment-photos-heading p {
  margin: 0;
}

.equipment-photos-heading p {
  margin-top: 4px;
  font-size: 13px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 16px;
}

.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.photo-preview {
  width: 100%;
  height: 190px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #e9f0f4;
}

.photo-preview:hover {
  background: #dce9ef;
}

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

.photo-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.photo-card-body {
  display: grid;
  gap: 6px;
  padding: 13px;
  font-size: 13px;
}

.photo-card-body > span {
  display: block;
}

.photo-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}

.photo-card-actions button {
  flex: 1;
  min-height: 36px;
  padding: 7px 10px;
}

.photos-empty-state {
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.photo-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 80px rgb(8 30 43 / 35%);
}

.photo-dialog::backdrop {
  background: rgb(8 30 43 / 72%);
  backdrop-filter: blur(3px);
}

.photo-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.photo-dialog-header h2,
.photo-dialog-header p {
  margin-bottom: 4px;
}

.icon-button {
  min-width: 42px;
  min-height: 42px;
  padding: 3px 10px;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.photo-dialog-image-shell {
  min-height: 300px;
  max-height: calc(100vh - 260px);
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 16px;
  background: #18232a;
}

.photo-dialog-image-shell img {
  max-width: 100%;
  max-height: calc(100vh - 292px);
  display: block;
  flex: none;
  object-fit: contain;
}

.photo-dialog-image-shell .muted {
  margin: 0;
  color: #d4e0e6;
}

.photo-dialog > .message {
  min-height: 20px;
  margin: 10px 20px 0;
}

.recognition-panel {
  margin: 14px 20px 0;
  padding: 16px;
  border: 1px solid #b9ced8;
  border-radius: 12px;
  background: #f5fafc;
}

.recognition-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recognition-heading h3,
.recognition-heading p {
  margin-bottom: 0;
}

.confidence-badge {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #dceef4;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.recognition-help {
  margin: 8px 0 14px;
  font-size: 13px;
}

.recognition-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.recognition-characteristics {
  margin-top: 18px;
}

.recognition-characteristics-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.recognition-characteristics-heading h4,
.recognition-characteristics-heading p {
  margin: 0;
}

.recognition-characteristics-heading p {
  margin-top: 3px;
  font-size: 13px;
}

.recognition-characteristics-scroll {
  overflow-x: auto;
}

.recognition-characteristics table {
  width: 100%;
  min-width: 650px;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.recognition-characteristics th {
  padding: 0 6px;
  color: #536773;
  font-size: 12px;
  text-align: left;
}

.recognition-characteristics td {
  padding: 0 6px;
  border: 0;
}

.recognition-characteristics th:nth-child(1) {
  width: 42%;
}

.recognition-characteristics th:nth-child(2) {
  width: 24%;
}

.recognition-characteristics th:nth-child(3) {
  width: 18%;
}

.recognition-characteristics input {
  min-width: 0;
  width: 100%;
}

.characteristic-remove {
  padding-inline: 10px;
  white-space: nowrap;
}

.recognized-text-details {
  margin-top: 14px;
  color: #344653;
  font-size: 13px;
  font-weight: 700;
}

.recognized-text-details summary {
  cursor: pointer;
}

.recognized-text-details textarea {
  width: 100%;
  min-height: 180px;
  margin-top: 10px;
  padding: 10px;
  resize: vertical;
  border: 1px solid #b9c8d1;
  border-radius: 9px;
  color: #24343f;
  background: white;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.recognition-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.photo-zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px 0;
}

.photo-zoom-controls output {
  min-width: 54px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.icon-control {
  min-width: 38px;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 20px;
  line-height: 1;
}

.zoom-hint {
  font-size: 12px;
}

.photo-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 18px;
}

.danger-button {
  color: white;
  border-color: var(--danger);
  background: var(--danger);
}

.danger-button:hover {
  filter: brightness(0.9);
}

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

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-heading p,
.form-heading p {
  margin-bottom: 0;
}

.admin-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgb(26 57 74 / 5%);
}

.template-admin-card {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, auto);
  gap: 18px 28px;
  align-items: center;
  padding: 20px;
}

.template-admin-copy h2,
.template-admin-copy p {
  margin-bottom: 8px;
}

.template-info {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.template-admin-actions,
.template-upload-form {
  display: grid;
  gap: 10px;
}

.template-upload-form {
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
}

.template-file-name {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-message {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
}

.protocol-template-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.protocol-template-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, auto);
  gap: 12px 24px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.protocol-template-card h3,
.protocol-template-card p {
  margin: 0 0 6px;
}

.protocol-template-actions {
  display: grid;
  grid-template-columns: auto minmax(380px, 1fr);
  gap: 10px;
  align-items: center;
}

.create-user-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) minmax(210px, 1fr) minmax(210px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 18px;
}

.form-heading {
  align-self: center;
}

.admin-message {
  min-height: 20px;
  margin: 0;
}

.users-card {
  overflow: hidden;
}

.users-table-scroll {
  overflow: auto;
  max-height: calc(100vh - 410px);
}

.users-table {
  min-width: 900px;
}

.users-table th:first-child,
.users-table td:first-child {
  min-width: 190px;
}

.users-table td {
  vertical-align: middle;
}

.user-login {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.current-user-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #dceef4;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
    overflow-x: hidden;
  }

  .topbar {
    align-items: flex-start;
  }

  .account {
    align-items: flex-end;
    flex-direction: column;
  }

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

  .excel-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .project-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .project-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .project-dialog-header,
  .project-dialog-body,
  .project-dialog-actions {
    padding-inline: 14px;
  }

  .project-dialog-actions button {
    flex: 1;
  }

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

  .project-details-grid label.wide-field {
    grid-column: auto;
  }

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

  .project-logo-controls > * {
    width: 100%;
  }

  .project-repeatable-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .project-repeatable-row,
  .project-instrument-row {
    grid-template-columns: 1fr;
  }

  .repeatable-add,
  .repeatable-remove {
    width: 100%;
  }

  .column-settings-menu {
    right: auto;
    left: 0;
    width: min(300px, calc(100vw - 56px));
  }

  .section-tabs {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .section-tab {
    flex: 0 0 auto;
  }

  .admin-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .photos-heading,
  .photos-meta {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .photo-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .photo-dialog-image-shell {
    max-height: calc(100vh - 300px);
    min-height: 220px;
  }

  .photo-dialog-actions {
    flex-wrap: wrap;
  }

  .recognition-panel {
    margin-inline: 10px;
  }

  .recognition-fields {
    grid-template-columns: 1fr;
  }

  .photo-zoom-controls {
    flex-wrap: wrap;
  }

  .zoom-hint {
    width: 100%;
    text-align: center;
  }

  .photo-dialog-actions button {
    flex: 1;
  }

  .create-user-form {
    grid-template-columns: 1fr;
  }

  .template-admin-card,
  .template-upload-form {
    grid-template-columns: 1fr;
  }

  .project-permit-upload,
  .project-permit-card,
  .protocol-template-card,
  .protocol-template-actions {
    grid-template-columns: 1fr;
  }

  .project-permit-preview {
    width: 100%;
    height: 160px;
  }

  .template-file-name {
    white-space: normal;
  }

  .equipment-card-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .equipment-card-header,
  #equipment-card-form {
    padding-inline: 14px;
  }

  .equipment-card-fields,
  .protocol-fields,
  .equipment-card-system dl {
    grid-template-columns: 1fr;
  }

  .equipment-card-fields .wide-field,
  .protocol-fields .wide-field {
    grid-column: auto;
  }

  .equipment-card-tabs {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .protocol-table-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .equipment-characteristics-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .inspection-results-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .audio-notes-heading,
  .audio-note-header {
    align-items: stretch;
    flex-direction: column;
  }

  .equipment-card-photo-controls {
    flex-direction: column;
  }

  .photo-file-button {
    width: 100%;
  }

  .equipment-card-photo-items {
    grid-template-columns: 1fr;
  }

  .audio-note-actions > button,
  .audio-notes-controls > button,
  .audio-file-button {
    flex: 1 1 160px;
    justify-content: center;
    text-align: center;
  }

  .positive-default-badge {
    align-self: flex-start;
  }

  .inspection-result-row,
  .inspection-columns-3 .inspection-result-row,
  .inspection-summary-grid {
    grid-template-columns: 1fr;
  }

  .inspection-summary-grid .wide-field {
    grid-column: auto;
  }

  .inspection-result-label {
    padding-top: 0;
  }

  .equipment-card-actions {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .table-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .workspace {
    overflow-x: hidden;
  }

  .section-tabs {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

.conclusion-heading,
.conclusion-actions,
.conclusion-item,
.conclusion-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conclusion-fields {
  margin-top: 14px;
}

.conclusion-actions {
  margin-top: 14px;
  justify-content: flex-start;
}

.conclusion-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.conclusion-item {
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.conclusion-item p {
  margin: 4px 0 0;
}

@media (max-width: 640px) {
  .conclusion-item {
    display: grid;
  }

  .conclusion-item-actions button,
  .conclusion-actions button {
    width: 100%;
  }
}
