:root {
  --background: #f9f9ff;
  --surface: #ffffff;
  --surface-low: #f2f3fa;
  --surface-mid: #e7e8ef;
  --surface-high: #e1e2e9;
  --on-surface: #191c21;
  --on-muted: #414751;
  --outline: #727783;
  --outline-soft: #c1c6d3;
  --primary: #004481;
  --primary-bright: #005baa;
  --primary-container: #d5e3ff;
  --on-primary: #ffffff;
  --secondary: #006e2e;
  --secondary-container: #80fc98;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --annotation-bg: #111316;
  --annotation-panel: #1e2023;
  --annotation-border: #333538;
  --annotation-accent: #ff6b00;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 16px 40px rgba(25, 28, 33, 0.12);
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--on-surface);
  font-size: 16px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
}

.material-symbols-outlined.fill {
  font-variation-settings: "FILL" 1, "wght" 450, "GRAD" 0, "opsz" 24;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-soft);
}

.topbar h1,
.topbar p,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 700;
}

.topbar p {
  color: var(--on-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--surface-low);
  outline: 0;
}

.app-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 16px 16px 96px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.step-pill,
.nav-item {
  border: 1px solid var(--outline-soft);
  background: var(--surface);
  color: var(--on-muted);
}

.step-pill {
  min-height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.step-pill span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-low);
}

.step-pill.active,
.nav-item.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.step-pill.complete {
  border-color: var(--secondary);
  color: var(--secondary);
}

.step-pill.complete span {
  background: var(--secondary-container);
  color: #002109;
}

.banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--primary-container);
  color: #001c3b;
  border: 1px solid #a6c8ff;
  font-weight: 600;
}

.banner.error {
  background: var(--error-container);
  border-color: var(--error);
  color: #410002;
}

.hidden {
  display: none !important;
}

.panel,
.screen {
  background: var(--surface);
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.data-panel {
  display: none;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  margin-bottom: 16px;
}

.data-panel.open {
  display: flex;
}

.screen {
  display: none;
  padding: 20px;
}

.screen.active {
  display: block;
}

.screen-heading {
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.15;
}

.screen-heading p:last-child,
.muted {
  margin-top: 8px;
  color: var(--on-muted);
}

.file-drop {
  min-width: 220px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 2px dashed var(--outline);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-weight: 700;
}

.file-drop input {
  display: none;
}

.data-actions {
  display: flex;
  min-width: min(100%, 360px);
  flex-direction: column;
  gap: 10px;
}

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

.download-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-container);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

.download-button.subtle {
  border-color: var(--outline-soft);
  background: var(--surface);
  color: var(--on-muted);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.field > span,
.panel-title,
.zoom-control {
  color: var(--on-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--on-surface);
}

input,
select {
  min-height: 52px;
  padding: 0 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(0, 91, 170, 0.18);
  outline: 0;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 44px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.input-with-icon span {
  position: absolute;
  right: 12px;
  top: 50%;
  color: var(--outline);
  transform: translateY(-50%);
}

.lookup-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius-md);
  background: var(--surface-low);
}

.lookup-card > span {
  color: var(--primary);
}

.lookup-card p {
  margin-top: 4px;
  color: var(--on-muted);
}

.primary-action,
.secondary-action,
.text-button {
  min-height: 52px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.primary-action {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.primary-action:disabled,
.secondary-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-action {
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--primary);
}

.text-button {
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--primary);
}

.transcript-panel,
.summary-card {
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-low);
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-title strong,
.panel-title .text-button {
  margin-left: auto;
}

.mic-zone {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 32px 0;
}

.mic-button {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border-radius: 999px;
  border: 2px solid var(--outline-soft);
  background: var(--surface);
  color: var(--primary);
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.mic-button span {
  font-size: 56px;
}

.mic-button.recording {
  background: var(--secondary);
  color: var(--on-primary);
  transform: scale(0.96);
  box-shadow: 0 0 0 18px rgba(0, 110, 46, 0.12);
}

.photo-topline,
.photo-actions,
.photo-footer,
.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-actions {
  margin: 16px 0;
}

.photo-actions .secondary-action,
.photo-footer .secondary-action,
.photo-footer .primary-action {
  width: auto;
  flex: 1;
}

.photos-screen {
  background: var(--surface);
}

.annotation-workspace {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--annotation-border);
  border-radius: var(--radius-lg);
  background: var(--annotation-bg);
}

.tool-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--annotation-panel);
  border-right: 1px solid var(--annotation-border);
}

.tool-button {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--annotation-border);
  border-radius: var(--radius-sm);
  background: #2b2d31;
  color: #eff0f8;
}

.tool-button small {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-button.active {
  border-color: var(--annotation-accent);
  background: var(--annotation-accent);
  color: #351000;
}

.canvas-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.canvas-toolbar {
  min-height: 56px;
  padding: 8px 12px;
  background: #1e2023;
  color: #eff0f8;
  border-bottom: 1px solid var(--annotation-border);
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eff0f8;
}

#zoom-slider {
  width: 120px;
  min-height: auto;
  padding: 0;
}

#annotation-canvas {
  width: 100%;
  height: 464px;
  display: block;
  background-color: #0c0e11;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  touch-action: none;
}

.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
}

.thumb {
  width: 86px;
  min-width: 86px;
  height: 64px;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
}

.thumb.active {
  border-color: var(--primary);
}

.thumb.approved::after {
  content: "Saved";
  display: block;
  margin-top: 40px;
  background: var(--secondary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--outline-soft);
}

.nav-item {
  display: flex;
  min-height: 54px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

@media (max-width: 680px) {
  .app-shell {
    padding-inline: 12px;
  }

  .data-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .data-actions {
    min-width: 0;
  }

  .form-grid,
  .verify-grid {
    grid-template-columns: 1fr;
  }

  .screen {
    padding: 16px;
    box-shadow: none;
  }

  h2 {
    font-size: 24px;
  }

  .step-pill {
    font-size: 10px;
    flex-direction: column;
  }

  .photo-topline,
  .photo-actions,
  .photo-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .annotation-workspace {
    grid-template-columns: 1fr;
  }

  .tool-rail {
    order: 2;
    flex-direction: row;
    overflow-x: auto;
    border-top: 1px solid var(--annotation-border);
    border-right: 0;
  }

  .tool-button {
    min-width: 62px;
  }

  #annotation-canvas {
    height: 390px;
  }

  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
