:root {
  color-scheme: light;
  --navy: #123a52;
  --navy-dark: #0b293c;
  --blue: #176b8c;
  --gold: #e7a928;
  --ink: #15242d;
  --muted: #53636d;
  --line: #c6d1d7;
  --surface: #ffffff;
  --background: #f3f6f8;
  --success: #176b42;
  --success-bg: #e6f5ed;
  --warning: #795300;
  --warning-bg: #fff1c9;
  --danger: #a12626;
  --danger-bg: #ffebeb;
  --shadow: 0 4px 18px rgb(12 42 59 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--blue);
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0.5rem;
  color: var(--navy-dark);
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 1rem;
  color: var(--navy-dark);
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: max(0.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
  color: #fff;
  background: var(--navy);
  box-shadow: 0 2px 12px rgb(0 0 0 / 20%);
}

.app-header a {
  color: #fff;
}

.brand,
.brand-button {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  font-size: 0.86rem;
}

.header-user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 1.2rem 1rem max(6rem, env(safe-area-inset-bottom));
}

.page.narrow {
  width: min(100%, 920px);
}

.page-heading,
.wizard-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.eyebrow,
.section-label {
  margin-bottom: 0.35rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.5;
}

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

.field-help {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.small {
  font-size: 0.88rem;
}

.panel,
.shot-card {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-grid {
  display: grid;
  gap: 1rem;
}

.step-number {
  display: inline-grid;
  width: 32px;
  height: 32px;
  margin-bottom: 0.6rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
}

.form-stack,
.form-grid,
.capture-fields {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.38rem;
  color: var(--navy-dark);
  font-size: 0.92rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.8rem;
  border: 2px solid #84949d;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #f2bd51;
  outline-offset: 2px;
}

.check-label {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 0.65rem;
}

.check-label input {
  width: 24px;
  min-height: 24px;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1rem;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  color: #fff;
  border-color: var(--navy);
  background: var(--navy);
}

.button.secondary {
  color: var(--navy-dark);
  border-color: var(--navy);
  background: #fff;
}

.button.ghost {
  min-height: 40px;
  color: #fff;
  border-color: rgb(255 255 255 / 60%);
  background: transparent;
}

.button.warning {
  color: #2d2100;
  border-color: var(--gold);
  background: var(--gold);
}

.button.danger {
  color: #fff;
  background: var(--danger);
}

.button.compact {
  min-height: 44px;
  padding: 0.5rem 0.72rem;
  font-size: 0.86rem;
}

.button.full {
  width: 100%;
  margin-top: 1rem;
}

.button-row,
.quick-actions,
.older-visits {
  display: grid;
  gap: 0.65rem;
}

.quick-visit {
  width: 100%;
  color: var(--navy-dark);
  border-color: var(--gold);
  background: #fff8e4;
}

.inset-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.older-visits {
  margin-top: 1.25rem;
}

.message {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy-dark);
  background: #e8f3f8;
  font-weight: 700;
}

.message.error,
.quality-result.bad {
  color: #761919;
  border-color: #dc8c8c;
  background: var(--danger-bg);
}

.message.success,
.quality-result.good {
  color: #0e5532;
  border-color: #74b895;
  background: var(--success-bg);
}

.message.warning,
.quality-result.warning {
  color: #604100;
  border-color: #d3a02f;
  background: var(--warning-bg);
}

.queue-banner {
  position: sticky;
  z-index: 9;
  top: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
  color: #2d2100;
  background: var(--warning-bg);
  border-bottom: 2px solid var(--gold);
}

.counter {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.shot-card {
  overflow: hidden;
}

.shot-card-heading {
  display: grid;
  gap: 1rem;
}

.angle-diagram {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 12px;
  color: var(--blue);
  background: #edf6fa;
  font-size: 0.76rem;
  font-weight: 800;
}

.angle-diagram svg {
  width: 92px;
  height: 64px;
}

.instruction {
  margin: 1rem 0 0.65rem;
  color: var(--ink);
  font-size: 1.13rem;
  font-weight: 750;
  line-height: 1.5;
}

.tip {
  padding: 0.85rem;
  border-left: 5px solid var(--gold);
  color: var(--navy-dark);
  background: #fff8e5;
  line-height: 1.45;
}

.capture-fields {
  margin: 1.15rem 0;
}

.camera-button {
  width: 100%;
  min-height: 62px;
  font-size: 1.12rem;
}

.camera-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.camera-button:focus-within {
  outline: 3px solid #f2bd51;
  outline-offset: 2px;
}

.camera-hint {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
}

.pending-photos {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.pending-photo {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
}

.quality-result {
  margin: 0.7rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 750;
  line-height: 1.4;
}

.wizard-nav {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 0.7rem;
  margin: 1rem -1rem 0;
  padding: 0.8rem max(1rem, env(safe-area-inset-right)) max(0.8rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgb(243 246 248 / 96%);
  backdrop-filter: blur(8px);
}

.review-list {
  display: grid;
  gap: 0.8rem;
}

.review-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0.8rem;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.review-item.complete {
  border-color: #69a987;
}

.review-item.missing {
  border-color: #d4a12d;
}

.review-item h2 {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.review-item p {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.review-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 1.2rem;
  font-weight: 900;
}

.review-item.missing .review-icon {
  color: #2f2200;
  background: var(--gold);
}

.review-item.needs-review {
  border-color: #cc7a27;
  box-shadow: inset 4px 0 #cc7a27;
}

.review-item.needs-review .review-icon {
  color: #2f2200;
  background: var(--gold);
}

.review-warning {
  color: var(--warning) !important;
  font-weight: 700;
}

.photo-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.4rem;
}

.photo-strip img {
  width: 76px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: cover;
  background: #dbe3e7;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(150deg, var(--navy-dark), var(--navy) 60%, #1f617e);
}

.login-shell {
  width: min(100%, 430px);
}

.login-panel {
  padding: 1.5rem;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 1.2rem;
  place-items: center;
  border-radius: 16px;
  color: var(--navy-dark);
  background: var(--gold);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.table-panel {
  margin-top: 1rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--navy-dark);
  background: #edf2f4;
  font-size: 0.8rem;
  text-transform: uppercase;
}

[hidden] {
  display: none !important;
}

@media (min-width: 700px) {
  .page {
    padding: 2rem 1.5rem 6rem;
  }

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

  .form-grid,
  .capture-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shot-card {
    padding: 1.6rem;
  }

  .shot-card-heading {
    grid-template-columns: minmax(0, 1fr) 230px;
    align-items: start;
  }

  .button-row {
    grid-template-columns: repeat(2, max-content);
  }

  .wizard-nav {
    position: static;
    width: min(100%, 620px);
    margin: 1rem 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 430px) {
  .header-user-name {
    display: none;
  }

  .header-actions {
    gap: 0.55rem;
  }
}
