:root {
  --ink: #162029;
  --muted: #5e6c77;
  --line: #d1d8dd;
  --soft: #eef3f4;
  --paper: #f8fbfb;
  --white: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0c5955;
  --gold: #d3a33d;
  --coral: #b65448;
  --shadow: 0 18px 50px rgba(22, 32, 41, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #dce6e6;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.2), transparent 34rem),
    linear-gradient(315deg, rgba(211, 163, 61, 0.18), transparent 32rem),
    #e8efee;
}

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

button {
  cursor: pointer;
}

svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.symbols {
  display: none;
}

.hidden {
  display: none !important;
}

.prototype {
  min-height: 100vh;
}

.auth-screen,
.app-shell {
  min-height: 100svh;
  background: var(--paper);
}

.auth-screen {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 2rem;
  padding: max(4rem, env(safe-area-inset-top)) 1.35rem max(1.5rem, env(safe-area-inset-bottom));
}

.auth-brand {
  align-self: center;
  text-align: center;
}

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

.auth-brand h1 {
  margin: 1rem 0 0.25rem;
  font-size: clamp(2.35rem, 7vw, 3.2rem);
  line-height: 1;
}

.auth-brand p,
.eyebrow {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.field,
.search-bar,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--white);
}

.field {
  display: grid;
  gap: 0.35rem;
  padding: 0.68rem 0.85rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.field-large {
  min-height: 4.65rem;
  align-content: center;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 3.3rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid var(--teal);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

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

.secondary-button {
  color: var(--teal-dark);
  background: var(--white);
}

.text-button {
  border: 0;
  color: var(--teal-dark);
  background: transparent;
  padding: 0.4rem;
}

.auth-footer {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  text-align: center;
  color: var(--muted);
}

.bridge-mark {
  position: relative;
  display: inline-grid;
  width: 2rem;
  height: 1.45rem;
  place-items: end center;
  color: currentColor;
}

.bridge-mark::before {
  position: absolute;
  right: 0.08rem;
  bottom: 0.25rem;
  left: 0.08rem;
  height: 0.9rem;
  border-bottom: 0.13rem solid;
  border-radius: 50% 50% 0 0;
  content: "";
}

.bridge-mark::after,
.bridge-mark span::before,
.bridge-mark span::after {
  position: absolute;
  bottom: 0.1rem;
  width: 0.12rem;
  height: 1.15rem;
  background: currentColor;
  content: "";
}

.bridge-mark::after {
  left: 0.35rem;
}

.bridge-mark span::before {
  left: 0.95rem;
}

.bridge-mark span::after {
  right: 0.35rem;
}

.bridge-mark-large {
  width: 6.8rem;
  height: 4.3rem;
  border-radius: 50%;
  color: var(--teal);
  transform: scale(1.3);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.mobile-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem 0.85rem;
}

.mobile-header h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 0.22rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  width: 2.85rem;
  height: 2.85rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  color: var(--ink);
  background: var(--white);
}

.icon-button.ghost {
  width: 2rem;
  height: 2rem;
  border: 0;
}

.screen {
  display: none;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 1rem 6.4rem;
}

.screen.active {
  display: block;
}

.metric-grid,
.analytics-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric,
.panel,
.record-card,
.report-card,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
}

.metric {
  display: grid;
  min-height: 9.1rem;
  align-content: space-between;
  gap: 0.22rem;
  padding: 0.85rem;
}

.metric svg,
.metric > .bridge-mark {
  width: 2rem;
  height: 2rem;
  color: var(--teal);
}

.metric strong {
  font-size: 2rem;
  line-height: 1;
}

.metric span,
.metric small {
  overflow-wrap: anywhere;
}

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

.metric.alert svg {
  color: var(--coral);
}

.analytics-grid {
  margin-top: 0.75rem;
}

.panel {
  padding: 0.9rem;
}

.panel h2 {
  margin-bottom: 0.85rem;
  font-size: 1rem;
}

.bars {
  display: flex;
  height: 10.8rem;
  align-items: end;
  justify-content: space-between;
  gap: 0.35rem;
  border-bottom: 1px solid var(--ink);
  padding: 0 0.2rem;
}

.bars i {
  position: relative;
  display: block;
  width: 1rem;
  height: var(--value);
  min-height: 1rem;
  border: 1px solid var(--teal);
  background: linear-gradient(var(--teal), #91c9c2);
}

.bars b {
  position: absolute;
  right: -0.75rem;
  bottom: -1.5rem;
  width: 2.5rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.labor-chart {
  display: grid;
  gap: 0.7rem;
}

.donut {
  width: min(8rem, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(var(--white) 0 39%, transparent 40%), conic-gradient(var(--teal) 0 45%, var(--gold) 0 75%, #7aa7b4 0 90%, #d9dfdf 0);
}

.labor-chart ul {
  display: grid;
  gap: 0.36rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.72rem;
  list-style: none;
}

.labor-chart li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.labor-chart li i {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 0.15rem;
  background: var(--teal);
}

.labor-chart li:nth-child(2) i {
  background: var(--gold);
}

.labor-chart li:nth-child(3) i {
  background: #7aa7b4;
}

.labor-chart li:nth-child(4) i {
  background: #d9dfdf;
}

.labor-chart b {
  margin-left: auto;
  color: var(--ink);
}

.recent-panel {
  margin-top: 0.75rem;
}

.panel-heading,
.record-head,
.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.inspection-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.72rem 0;
  border-top: 1px solid var(--line);
}

.mini-bridge {
  display: grid;
  width: 2.65rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0.55rem;
  color: var(--teal-dark);
  background: var(--soft);
}

.inspection-row h3,
.record-card h2,
.report-card h2 {
  margin: 0 0 0.18rem;
  font-size: 1rem;
}

.inspection-row p,
.record-card p,
.report-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.pill {
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  color: var(--teal-dark);
  background: #d8eeeb;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.review {
  color: #725100;
  background: #f6e6b8;
}

.pill.pending {
  color: #803b34;
  background: #f2d5d1;
}

.search-bar {
  display: flex;
  min-height: 3.3rem;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0 0.85rem;
  color: var(--muted);
}

.search-bar input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.screen > .secondary-button {
  width: 100%;
  margin-bottom: 0.75rem;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.record-card,
.report-card {
  padding: 0.95rem;
}

.record-card dl,
.inspector-details {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 0.36rem 0.65rem;
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}

.record-card dt,
.inspector-details span:nth-child(odd) {
  color: var(--muted);
}

.record-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.avatar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
}

.avatar {
  display: grid;
  width: 2.75rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--soft);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-tools .icon-button,
.report-actions .icon-button {
  width: 2.45rem;
  height: 2.45rem;
}

.inspection-form {
  display: grid;
  gap: 0.65rem;
}

.form-panel {
  min-inline-size: 0;
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.8rem;
}

.form-panel legend {
  padding: 0 0.32rem;
  font-size: 0.95rem;
  font-weight: 900;
}

.form-panel label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.form-panel input,
.form-panel select,
.form-panel textarea,
.filter-grid select {
  min-width: 0;
  min-height: 2.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  color: var(--ink);
}

.split-fields,
.filter-grid,
.action-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.choice-row label,
.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.55rem;
  color: var(--ink);
  background: var(--white);
  font-weight: 600;
}

.choice-row input,
.checklist input {
  width: 1rem;
  min-height: 1rem;
  margin: 0.1rem 0 0;
}

.checklist h2 {
  margin: 0.24rem 0 0;
  color: var(--teal-dark);
  font-size: 0.86rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.photo-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-grid button {
  display: grid;
  min-height: 5.2rem;
  place-content: center;
  gap: 0.3rem;
  border: 1px dashed #8ea5a5;
  border-radius: 0.55rem;
  color: var(--teal-dark);
  background: var(--soft);
  font-size: 0.68rem;
}

.photo-grid button.added {
  border-style: solid;
  color: var(--white);
  background:
    linear-gradient(rgba(12, 89, 85, 0.2), rgba(12, 89, 85, 0.68)),
    linear-gradient(135deg, #a3c7c8, #3e7777);
}

.filter-grid {
  margin-bottom: 0.75rem;
}

.report-meta {
  display: grid;
  gap: 0.22rem;
  margin: 0.55rem 0 0.8rem;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.38rem;
}

.bottom-nav {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.18rem;
  border-top: 1px solid var(--line);
  padding: 0.52rem 0.35rem max(0.52rem, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(1rem);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  min-height: 3.6rem;
  place-content: center;
  justify-items: center;
  gap: 0.2rem;
  border: 0;
  border-radius: 0.6rem;
  color: var(--muted);
  background: transparent;
  font-size: 0.65rem;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--teal-dark);
  background: #d8eeeb;
}

.bottom-nav .bridge-mark {
  width: 1.85rem;
}

dialog {
  width: min(calc(100% - 1.5rem), 26rem);
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
  border: 0;
  border-radius: 1rem;
  padding: 1rem;
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(22, 32, 41, 0.48);
}

.close-dialog {
  margin-left: auto;
}

#dialogContent h2 {
  margin: 0.45rem 0;
}

#dialogContent p {
  color: var(--muted);
}

.preview-sheet {
  border-top: 0.35rem solid var(--teal);
  padding-top: 0.85rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 4;
  border-radius: 0.8rem;
  padding: 0.85rem;
  color: var(--white);
  background: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  transform: translateY(calc(100% + 2rem));
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

@media (min-width: 44rem) {
  body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
  }

  .prototype {
    width: min(100%, 28rem);
    min-height: min(56rem, calc(100vh - 3rem));
    border: 0.55rem solid var(--ink);
    border-radius: 3rem;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .auth-screen,
  .app-shell {
    min-height: min(55rem, calc(100vh - 4.1rem));
  }
}
