@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
}

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

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

#app {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100dvh;
  background: var(--color-canvas);
  position: relative;
  box-shadow: 0 0 0 1px var(--color-line);
  overflow-x: hidden;
}

.proto-banner {
  background: #eef4ff;
  color: var(--color-brand-dark);
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  padding-top: max(0.4rem, env(safe-area-inset-top));
}

.app-header {
  display: grid;
  grid-template-columns: 2.75rem 1fr 2.75rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-copy {
  min-width: 0;
  text-align: center;
}

.header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-sub {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.header-logo img,
.login-logo {
  height: 2rem;
  width: auto;
  display: block;
  margin: 0 auto;
}

.login-logo {
  height: 2.75rem;
  margin: 0.5rem auto 1.25rem;
}

.header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--color-brand);
  text-decoration: none;
}

.header-back.spacer {
  visibility: hidden;
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 0;
  background: var(--color-brand);
  color: #fff;
  font: 700 0.7rem/1 var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto;
}

.avatar.static {
  cursor: default;
  background: #dbe7fb;
  color: var(--color-brand-dark);
}

.account-scrim {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.28);
  z-index: 30;
}

.account-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  background: var(--color-surface);
  border-radius: 1.1rem 1.1rem 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 31;
  box-shadow: 0 -8px 32px rgb(15 23 42 / 0.12);
}

.account-name {
  margin: 0 0 0.15rem;
  font-weight: 700;
}

img {
  max-width: 100%;
}

.page {
  padding: 1rem 1.15rem 1.5rem;
  overflow-x: hidden;
}

.page-with-tabbar {
  padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
}

.page-gallery {
  padding-bottom: calc(9.5rem + env(safe-area-inset-bottom));
}

.login-page {
  padding-top: 1.5rem;
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--color-brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lede,
.muted {
  color: var(--color-muted);
  font-size: 0.9375rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  min-height: 3.5rem;
  text-decoration: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.card svg {
  color: var(--color-muted);
  flex-shrink: 0;
}

.person-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.person-name,
.building-name {
  font-weight: 700;
}

.person-role {
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.building-icon {
  color: var(--color-brand);
  display: flex;
}

.floor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.floor-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 4.5rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  text-decoration: none;
  color: inherit;
}

.floor-tile.done {
  border-color: #84cc16;
  background: #f7fee7;
}

.floor-n {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.floor-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
}

.task-choice .task-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.rank {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.45rem;
}

.rank-mandatory {
  background: #eef4ff;
  color: var(--color-brand-dark);
}

.rank-important {
  background: #fef3c7;
  color: #92400e;
}

.rank-optional {
  background: #f1f5f9;
  color: var(--color-muted);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.big-btn {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 5.5rem;
  padding: 1rem 1.05rem;
  border-radius: 0.9rem;
  text-decoration: none;
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
}

.big-btn-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.big-btn-icon svg {
  color: #fff;
  stroke: #fff;
}

.big-btn.photos .big-btn-icon { background: var(--color-brand); }
.big-btn.rapport .big-btn-icon { background: var(--color-brand-dark); }

.big-btn-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.big-btn-label {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.big-btn-meta {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.big-btn > svg {
  color: var(--color-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  min-height: 2.75rem;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.btn:hover { background: var(--color-brand-dark); }

.btn.secondary {
  background: var(--color-surface);
  color: var(--color-brand);
  border: 1px solid var(--color-line);
}

.btn.danger { background: #b91c1c; }
.btn.ghost { background: transparent; color: var(--color-ink); }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  background: #eef4ff;
  color: var(--color-brand);
}

.chip.ok { background: #ecfccb; color: #3f6212; }
.chip.warn { background: #fef3c7; color: #92400e; }
.chip.bad { background: #fee2e2; color: #991b1b; }

.filters {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  margin: 0.75rem 0;
}

.filters a,
.filters button {
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  border-radius: var(--radius-full);
  padding: 0.45rem 0.85rem;
  min-height: 2.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.filters .on {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.import-btn { padding: 0.45rem 0.9rem; min-height: 2.4rem; font-size: 0.8125rem; }

.sync-warn {
  margin: 0;
  color: #991b1b;
  font-size: 0.8rem;
  font-weight: 600;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 1rem;
}

.photo-actions .btn {
  flex: 1;
  min-width: 9rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
}

.photo-grid > img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.photo-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
}

.photo-stack figure {
  margin: 0;
  width: 100%;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #dbe4f0;
  border: 1px solid var(--color-line);
}

.photo-stack img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 13.5rem;
  object-fit: cover;
}

.photo-stack figcaption {
  padding: 0.4rem 0.7rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--color-muted);
}

.photo-tile {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #dbe4f0;
  aspect-ratio: 1;
  border: 2px solid transparent;
}

.photo-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  display: block;
}

.photo-tile input[type="checkbox"] {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  cursor: pointer;
}

.photo-remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 999px;
  background: rgb(15 23 42 / 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.photo-tile.selected { border-color: var(--color-brand); }

.photo-tile .badge {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  z-index: 2;
  max-width: calc(100% - 0.8rem);
}

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(5.1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 2.3rem), calc(var(--app-width) - 2.3rem));
  max-width: 24rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px rgb(37 78 168 / 0.35);
  z-index: 15;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--color-surface);
  border-top: 1px solid var(--color-line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 16;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.55rem 0.25rem 0.45rem;
  min-height: 3.15rem;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
}

.tab.on { color: var(--color-brand); }

.camera-stage {
  position: relative;
  background: #000;
  min-height: 58dvh;
}

.camera-stage.short { min-height: 38dvh; }

.camera-stage video,
.camera-stage img.preview {
  width: 100%;
  height: 58dvh;
  object-fit: cover;
  display: block;
}

.camera-stage.short img.preview { height: 38dvh; }

.camera-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1rem;
  background: var(--color-surface);
}

.shutter {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 9999px;
  border: 4px solid var(--color-brand);
  background: #fff;
}

.camera-hint {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  padding: 0 1rem 1rem;
  margin: 0;
}

.type-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.type-btn {
  min-height: 4.25rem;
  border-radius: 0.85rem;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  font: 700 0.95rem var(--font-sans);
  cursor: pointer;
}

.type-avant { color: var(--color-brand); }
.type-apres { color: #3f6212; background: #f7fee7; }
.type-dommage { color: #9a3412; background: #fff7ed; }

.form-step h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.field-label {
  margin: 1rem 0 0.4rem;
  font-weight: 650;
  font-size: 0.88rem;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0;
  font-weight: 650;
  font-size: 0.9rem;
}

label.field input,
label.field textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--color-line);
  border-radius: 0.65rem;
  background: #fff;
  min-height: 2.75rem;
}

.choice-list { display: flex; flex-direction: column; gap: 0.35rem; }

.choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 500;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-line);
  border-radius: 0.7rem;
  background: var(--color-surface);
}

.choice:has(input:checked) {
  border-color: var(--color-brand);
  background: #eef4ff;
}

.identity {
  background: #eef4ff;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
}

.identity strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.progress {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin: 0.9rem 0 0.35rem;
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 99px;
  background: var(--color-line);
}

.dot.on { background: var(--color-brand); width: 1.1rem; }
.dot.done { background: var(--color-badge); }

.page-rapport {
  padding-bottom: calc(9.75rem + env(safe-area-inset-bottom));
}

.step-nav {
  position: fixed;
  left: 50%;
  bottom: calc(3.55rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 2.3rem), calc(var(--app-width) - 2.3rem));
  display: flex;
  gap: 0.6rem;
  background: var(--color-canvas);
  padding: 0.55rem 0 0.35rem;
  z-index: 40;
}

.step-nav .btn { flex: 1; }

.search {
  width: 100%;
  font: inherit;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  margin: 0.35rem 0 0.75rem;
  min-height: 2.75rem;
}

.tabs {
  display: flex;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.35rem 0 0.5rem;
}

.tabs a {
  flex: 1;
  text-align: center;
  padding: 0.65rem;
  text-decoration: none;
  color: var(--color-ink);
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--color-surface);
}

.tabs a.on { background: var(--color-brand); color: #fff; }

.access-link {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.access-link a { color: var(--color-brand); font-weight: 600; }
.access-link .btn {
  min-height: 2.25rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
}

.row-card {
  align-items: flex-start;
}

.row-card .thumb {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 0.5rem;
  background: #dbe4f0;
  flex-shrink: 0;
}

.row-card .person-copy {
  min-width: 0;
}

.row-card .chip {
  align-self: flex-start;
  margin-top: 0.3rem;
  white-space: nowrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.7rem 0.4rem;
  border-bottom: 1px solid var(--color-line);
}

.detail-photo img {
  width: 100%;
  border-radius: 0.85rem;
}

.meta-list {
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.meta-list div {
  display: grid;
  grid-template-columns: minmax(0, 7rem) minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.9rem;
}

.meta-list dt,
.meta-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.meta-list dt { color: var(--color-muted); }
.meta-list dd { font-weight: 600; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-muted);
}

.done-photos { padding-left: 1.1rem; color: var(--color-ink); }

.page-review {
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

.page-review h2 {
  margin: 1.25rem 0 0.55rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.page-review .btn[type="submit"] {
  width: 100%;
  margin-top: 1.1rem;
}

.photo-stack .filters {
  padding: 0 0.55rem 0.55rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin: 0.25rem 0 1.1rem;
}

.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.85rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat strong {
  display: block;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.stat span {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.story-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.story {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.85rem;
  padding: 0.8rem 0.9rem;
  text-decoration: none;
  color: inherit;
  display: block;
}

.story p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
}

.floor-status {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.85rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.65rem;
}

.floor-status h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.page h2 {
  margin: 1.2rem 0 0.55rem;
  font-size: 1.05rem;
}
