:root {
  --ink: #13201f;
  --muted: #6a7470;
  --line: #d8dfdb;
  --panel: #ffffff;
  --paper: #f4f7f5;
  --pine: #122826;
  --teal: #2f806f;
  --coral: #d85b4a;
  --gold: #d9a93f;
  --soft-teal: #dcefea;
  --soft-coral: #f8dfd8;
  --shadow: 0 24px 70px rgba(18, 40, 38, 0.18);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(135deg, rgba(47, 128, 111, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(216, 91, 74, 0.11), transparent 32%),
    var(--paper);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.phone-stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  background: var(--paper);
  overflow: hidden;
  position: relative;
}

.screen {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  background: var(--pine);
  color: white;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 700;
}

.title {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

.date-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.content {
  padding: 16px 14px 96px;
  overflow: auto;
}

.section-title {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0;
}

.capture-rail {
  display: grid;
  gap: 12px;
}

.camera-card,
.panel,
.record-card,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(18, 40, 38, 0.06);
}

.camera-card {
  overflow: hidden;
}

.viewfinder {
  aspect-ratio: 1.48;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 26px 26px,
    #18201f;
  position: relative;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.74);
}

.viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viewfinder::before,
.viewfinder::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  pointer-events: none;
}

.viewfinder::after {
  inset: 34px 30px;
  border-color: rgba(216, 91, 74, 0.82);
  border-style: dashed;
}

.scan-line {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 38px;
  height: 3px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(217, 169, 63, 0.7);
  animation: sweep 2.4s ease-in-out infinite;
}

@keyframes sweep {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(148px);
  }
}

.camera-empty {
  z-index: 2;
  display: grid;
  gap: 8px;
  text-align: center;
  padding: 0 42px;
}

.camera-empty strong {
  font-size: 17px;
}

.camera-empty span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.35;
}

.capture-actions {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  color: var(--ink);
  background: #e7ece9;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn.danger {
  background: var(--soft-coral);
  color: #8f2f23;
}

.btn.ghost {
  background: transparent;
  color: var(--teal);
}

.btn.small {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.btn.full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
}

.btn-symbol {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.panel {
  padding: 14px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 8px;
  background: #fbfcfb;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.1;
}

.review-list {
  display: grid;
  gap: 8px;
}

.field-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(92px, 0.72fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #eef2ef;
  padding: 8px 0;
}

.field-row:last-child {
  border-bottom: 0;
}

.field-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-row strong,
.field-row input,
.field-row textarea {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  word-break: break-word;
}

.field-row input,
.field-row textarea,
.search-input,
.sheet input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  outline: none;
}

.field-row textarea {
  min-height: 74px;
  resize: vertical;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft-teal);
  color: #175449;
  font-size: 12px;
  font-weight: 850;
}

.tag.warn {
  background: var(--soft-coral);
  color: #8f2f23;
}

.tag.gold {
  background: #f4e8c5;
  color: #704d05;
}

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

.toolbar .search-input {
  flex: 1;
}

.records {
  display: grid;
  gap: 10px;
}

.record-card {
  width: 100%;
  text-align: left;
  padding: 12px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.avatar {
  inline-size: 48px;
  block-size: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--pine);
  color: white;
  font-weight: 900;
}

.record-main {
  min-width: 0;
}

.record-main strong {
  display: block;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--muted);
  font-size: 20px;
}

.detail-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-head .avatar {
  inline-size: 56px;
  block-size: 56px;
}

.detail-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.detail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.setting-row {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #eef2ef;
  padding: 10px 0;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-copy {
  min-width: 0;
}

.setting-copy strong {
  display: block;
  font-size: 15px;
}

.setting-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.switch {
  position: relative;
  inline-size: 48px;
  block-size: 30px;
  flex: 0 0 48px;
}

.switch input {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d7ded9;
}

.slider::after {
  content: "";
  position: absolute;
  inline-size: 24px;
  block-size: 24px;
  border-radius: 50%;
  left: 3px;
  top: 3px;
  background: white;
  box-shadow: 0 2px 8px rgba(18, 40, 38, 0.22);
  transition: transform 160ms ease;
}

.switch input:checked + .slider {
  background: var(--teal);
}

.switch input:checked + .slider::after {
  transform: translateX(18px);
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  background: rgba(244, 247, 245, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-btn {
  min-height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.nav-btn.active {
  background: var(--pine);
  color: white;
}

.nav-icon {
  inline-size: 22px;
  block-size: 22px;
  position: relative;
}

.nav-icon.scan::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.nav-icon.scan::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 10px;
  border-top: 2px solid currentColor;
}

.nav-icon.list::before,
.nav-icon.list::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  border-top: 2px solid currentColor;
  box-shadow: 0 7px 0 currentColor;
}

.nav-icon.list::before {
  top: 5px;
}

.nav-icon.list::after {
  top: 19px;
  box-shadow: none;
}

.nav-icon.lock::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-icon.lock::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 8px;
  height: 10px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 40, 38, 0.36);
  display: grid;
  align-items: end;
  z-index: 20;
}

.sheet {
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  box-shadow: 0 -24px 60px rgba(18, 40, 38, 0.2);
}

.sheet h2 {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: 0;
}

.check-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eef2ef;
}

.check-row input {
  inline-size: 20px;
  block-size: 20px;
  accent-color: var(--teal);
}

.check-row span {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  width: min(344px, calc(100vw - 32px));
  transform: translate(-50%, 120px);
  border-radius: 8px;
  background: var(--pine);
  color: white;
  padding: 12px 14px;
  font-size: 14px;
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  z-index: 40;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

@media (min-width: 720px) {
  .phone-stage {
    padding: 28px;
  }

  .app-shell {
    width: 393px;
    min-height: 852px;
    max-height: 852px;
    border: 8px solid #0b1413;
    border-radius: 42px;
    box-shadow: var(--shadow);
  }

  .screen {
    min-height: 836px;
  }

  .topbar {
    padding-top: 26px;
  }
}
