:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d1d5db;
  --soft-line: #e5e7eb;
  --accent: #d97706;
  --accent-dark: #92400e;
  --dark: #111827;
  --good: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 18px;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--soft-line);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-lockup { display: flex; gap: 14px; align-items: center; }
.brand-mark, .report-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--dark);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -0.04em;
  overflow: hidden;
}
.brand-mark img, .report-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #fff; }
.report-banner-logo { width: min(460px, 100%); height: auto; min-height: 92px; border-radius: 0; background: transparent; box-shadow: none; display: block; overflow: visible; }
.report-banner-logo img { width: 100%; height: auto; object-fit: contain; padding: 0; background: transparent; display: block; }
.app-header h1 { margin: 0; font-size: 1.15rem; }
.app-header p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.header-control-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; min-width: 0; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.layout-toggle { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.layout-toggle span { color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.layout-toggle button { padding: 7px 10px; min-height: 34px; font-size: .8rem; }
.layout-toggle button.active { background: var(--dark); color: #fff; border-color: var(--dark); }

.locked-brand-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 12px; }
.locked-brand-card .hint { margin: 4px 0 0; }

button, .upload-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.primary { background: var(--dark); color: #fff; }
.primary.accent { background: var(--accent); }
.ghost { background: #f9fafb; color: var(--ink); border: 1px solid var(--line); }
button:hover, .upload-button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(17,24,39,.08); }
button:active, .upload-button:active { transform: translateY(0); box-shadow: none; }

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
  max-width: 1500px;
  margin: 0 auto;
}
.sidebar { display: flex; flex-direction: column; gap: 16px; align-self: start; position: sticky; top: 92px; }
.workspace { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel.compact { padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 1.03rem; }
.panel p { color: var(--muted); margin: 4px 0 0; line-height: 1.45; }
.hero-panel, .section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.compact-row { margin-bottom: 10px; }
.compact-row h2 { margin: 0; }
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid var(--soft-line);
  color: var(--muted);
  font-weight: 800;
  font-size: .82rem;
}
.status-pill {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fffbeb;
  color: var(--accent-dark);
  border: 1px solid #fde68a;
  font-weight: 800;
  font-size: 0.85rem;
}
.status-pill.saved { color: var(--good); background: #ecfdf5; border-color: #a7f3d0; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.generated-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; font-weight: 800; color: #374151; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  outline: none;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,119,6,.14);
}
.field-label { margin-bottom: 8px; }
.hint { font-size: .84rem; }
.search-input { margin-bottom: 12px; background: #f9fafb; }
.mini-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: .9rem; line-height: 1.55; }

.project-list { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 360px); overflow: auto; padding-right: 2px; }
.project-item {
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}
.project-item:hover { border-color: var(--line); background: #f9fafb; }
.project-item.active { border-color: var(--accent); background: #fffbeb; }
.project-item strong { display: block; font-size: .92rem; line-height: 1.25; margin-bottom: 4px; }
.project-item span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.project-empty { color: var(--muted); font-size: .92rem; margin: 0; }

.upload-button { background: var(--dark); color: #fff; display: inline-flex; align-items: center; gap: 8px; }
.upload-button input { display: none; }
.drop-zone {
  margin-top: 12px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 26px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f9fafb;
  font-weight: 800;
}
.drop-zone.dragover { border-color: var(--accent); background: #fffbeb; color: var(--accent-dark); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.photo-card { border: 1px solid var(--soft-line); border-radius: 16px; overflow: hidden; background: #fff; }
.photo-card img { width: 100%; height: 190px; object-fit: cover; display: block; background: #f3f4f6; }
.photo-card-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.photo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photo-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.delete-btn { background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; padding: 8px 10px; }
.include-label { flex-direction: row; align-items: center; font-size: 0.84rem; color: var(--muted); font-weight: 700; }
.include-label input { width: auto; }
.photo-card textarea { min-height: 78px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.quality-control-panel { border-color: #bfdbfe; }
.quality-control-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.quality-control-toggle {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
  color: #374151;
}
.quality-control-table-wrap,
.report-quality-control-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
}
.quality-control-table,
.report-quality-control-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}
.quality-control-table { min-width: 1540px; }
.report-quality-control-table { min-width: 1120px; }
.quality-control-table th,
.quality-control-table td,
.report-quality-control-table th,
.report-quality-control-table td {
  border: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  vertical-align: top;
}
.quality-control-table th,
.report-quality-control-table th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 900;
  white-space: nowrap;
}
.quality-control-table input,
.quality-control-table select {
  min-width: 92px;
  border-radius: 8px;
  padding: 8px;
  font-size: .82rem;
}
.quality-control-table [data-qa-field="location"] { min-width: 145px; }
.quality-control-table [data-qa-field="stage"] { min-width: 130px; }
.quality-control-table [data-qa-field="notes"] { min-width: 190px; }
.quality-control-table .qa-calculated {
  min-width: 80px;
  background: #f9fafb;
  font-weight: 800;
  color: #374151;
}
.quality-control-table .delete-btn { white-space: nowrap; }
.report-quality-control-table td { white-space: pre-line; }

.report-view { display: none; }
.report-page { max-width: 980px; margin: 24px auto; background: #fff; padding: 42px; border-radius: 18px; box-shadow: var(--shadow); }
.report-cover { display: grid; grid-template-columns: 80px 1fr; gap: 22px; align-items: center; border-bottom: 3px solid var(--dark); padding-bottom: 24px; margin-bottom: 20px; }
.report-logo { width: 80px; height: 80px; border-radius: 16px; font-size: 1.25rem; }
.report-logo.report-banner-logo { width: min(520px, 100%); height: auto; min-height: 0; border-radius: 0; background: transparent; }
.eyebrow { color: var(--accent-dark) !important; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.11em; font-weight: 900; margin: 0 0 4px !important; }
.report-cover h1 { margin: 0; font-size: 2rem; line-height: 1.05; }
.muted { color: var(--muted); }
.report-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin: 18px 0 24px; }
.report-meta div { border: 1px solid var(--soft-line); border-radius: 14px; padding: 12px; background: #f9fafb; }
.report-meta strong { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.report-meta span { display: block; margin-top: 4px; font-weight: 800; }
.report-page section { margin: 22px 0; break-inside: avoid; }
.report-page section h2 { font-size: 1rem; border-bottom: 1px solid var(--soft-line); padding-bottom: 8px; margin-bottom: 8px; }
.report-page p { line-height: 1.55; white-space: pre-line; }
.report-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-photo { border: 1px solid var(--soft-line); border-radius: 14px; overflow: hidden; break-inside: avoid; margin: 0; }
.report-photo img { width: 100%; height: 240px; object-fit: cover; display: block; }
.report-photo figcaption { padding: 10px 12px; font-size: 0.88rem; color: #374151; line-height: 1.4; }
.report-photo figcaption strong { display: block; color: var(--ink); margin-bottom: 4px; }
.report-footer { border-top: 2px solid var(--dark); padding-top: 14px; margin-top: 30px; display: flex; justify-content: space-between; color: var(--muted); font-size: 0.86rem; }


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

.reference-chip,
.index-summary {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: var(--accent-dark);
  font-weight: 900;
  font-size: .82rem;
  padding: 8px 11px;
  white-space: nowrap;
}
.index-summary {
  margin-top: 8px !important;
}

.photo-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #111827;
  color: #fff;
  font-size: .82rem;
}
.photo-meta-bar span { color: rgba(255,255,255,.78); text-align: right; font-weight: 700; }
.photo-timestamp { display: block; color: var(--muted); margin-bottom: 4px; font-size: .8rem; }

body.layout-phone {
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}
body.layout-phone .app-header { align-items: stretch; flex-direction: column; padding: 12px; }
body.layout-phone .header-control-stack { align-items: stretch; }
body.layout-phone .header-actions { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: 4px; }
body.layout-phone .header-actions button { white-space: nowrap; min-height: 44px; }
body.layout-phone .layout { grid-template-columns: 1fr; max-width: 560px; padding: 12px; gap: 12px; }
body.layout-phone .sidebar { position: static; }
body.layout-phone .grid.two { grid-template-columns: 1fr; }
body.layout-phone .section-title-row, body.layout-phone .hero-panel { align-items: flex-start; flex-direction: column; }
body.layout-phone .mobile-section-nav { display: flex; }
body.layout-phone .mobile-action-bar { display: grid; }
body.layout-phone .project-list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 78vw); overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: 8px; }
body.layout-phone .photo-grid { grid-template-columns: 1fr; }
body.layout-phone .photo-row { grid-template-columns: 1fr; }
body.layout-phone .drop-zone { display: none; }

body.layout-tablet .layout { grid-template-columns: 280px minmax(0, 1fr); max-width: 1120px; }
body.layout-tablet .photo-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
body.layout-tablet .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

body.layout-desktop .layout { grid-template-columns: 340px minmax(0, 1fr); max-width: 1540px; }
body.layout-desktop .mobile-section-nav, body.layout-desktop .mobile-action-bar { display: none !important; }
body.layout-desktop .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: stretch; }
  .header-actions button { flex: 1; }
  .grid.two { grid-template-columns: 1fr; }
  .section-title-row, .hero-panel { align-items: flex-start; flex-direction: column; }
  .project-list { max-height: none; }
}


/* ATS formal document branding */
.report-view .report-cover {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(260px, 1fr);
  align-items: end;
  gap: 24px;
  border-bottom: 4px solid var(--dark);
  padding-bottom: 18px;
}
.report-cover-text h1 { margin-top: 0; }
.report-cover-text .muted { font-size: 1rem; }
.report-footer {
  border-top: 2px solid var(--dark);
  margin-top: 30px;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .report-view { display: block !important; }
  .report-page { box-shadow: none; max-width: none; margin: 0; padding: 0; border-radius: 0; }
  .report-view .report-cover { grid-template-columns: 1fr; align-items: start; }
  .report-banner-logo { width: 100%; max-width: 520px; }
  .report-meta { grid-template-columns: repeat(3, 1fr); }
  .report-quality-control-table-wrap { overflow: visible; }
  .report-quality-control-table { min-width: 0; table-layout: fixed; font-size: 7px; }
  .report-quality-control-table th,
  .report-quality-control-table td { padding: 3px; overflow-wrap: anywhere; }
  @page { size: A4; margin: 16mm; }
}

/* Mobile-first field capture additions */
.mobile-section-nav,
.mobile-action-bar {
  display: none;
}

.photo-upload-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.secondary-upload {
  background: #f9fafb;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mobile-photo-action input,
.mobile-doc-action input {
  display: none;
}

@media (max-width: 720px) {
  html {
    scroll-behavior: smooth;
  }

  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .app-header {
    padding: 12px 12px 10px;
    gap: 10px;
  }

  .brand-lockup {
    gap: 10px;
    min-width: 0;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex: 0 0 auto;
  }

  .app-header h1 {
    font-size: 1rem;
  }

  .app-header p {
    display: none;
  }

  .header-actions {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .header-actions button {
    min-height: 44px;
    white-space: nowrap;
  }

  .mobile-section-nav {
    position: sticky;
    top: 70px;
    z-index: 9;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    background: rgba(243, 244, 246, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--soft-line);
  }

  .mobile-section-nav button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    box-shadow: none;
    font-size: 0.88rem;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .workspace,
  .sidebar {
    gap: 12px;
  }

  .panel {
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06);
  }

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

  .hero-panel {
    display: none;
  }

  .section-title-row {
    gap: 10px;
  }

  .section-title-row button,
  .section-title-row .photo-upload-actions,
  .section-title-row .upload-button {
    width: 100%;
  }

  .photo-upload-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .upload-button,
  button {
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }

  input,
  textarea,
  select {
    min-height: 46px;
    border-radius: 12px;
    padding: 12px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  textarea {
    min-height: 118px;
  }

  label {
    font-size: 0.9rem;
  }

  .project-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 78vw);
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity;
  }

  .project-item {
    scroll-snap-align: start;
    min-height: 92px;
  }

  .drop-zone {
    display: none;
  }

  .photo-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .photo-card {
    border-radius: 16px;
  }

  .photo-card img {
    height: 220px;
  }

  .photo-row {
    grid-template-columns: 1fr;
  }

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

  .include-label {
    min-height: 42px;
    padding: 8px 0;
  }

  .delete-btn {
    width: 100%;
  }

  .generated-grid {
    margin-top: 12px;
  }

  .mobile-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 0.8fr 0.9fr 0.9fr 1fr 0.9fr;
    gap: 8px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--soft-line);
    box-shadow: 0 -10px 28px rgba(17, 24, 39, 0.10);
  }

  .mobile-action {
    min-height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 850;
    background: #f9fafb;
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 0.9rem;
    padding: 0 8px;
  }

  .mobile-action.primary {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
  }

  .report-meta {
    grid-template-columns: 1fr 1fr;
  }

  .report-page {
    margin: 0;
    border-radius: 0;
    padding: 20px;
  }

  .report-cover {
    grid-template-columns: 56px 1fr;
    gap: 14px;
  }

  .report-logo {
    width: 56px;
    height: 56px;
  }

  .report-cover h1 {
    font-size: 1.35rem;
  }

  .report-photo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .mobile-action-bar {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .mobile-action {
    font-size: 0.82rem;
  }

  .photo-upload-actions {
    grid-template-columns: 1fr;
  }
}

/* Document register */
.documents-panel .upload-button { width: fit-content; }
.document-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.document-card { border: 1px solid var(--soft-line); border-radius: 16px; overflow: hidden; background: #fff; }
.document-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #111827;
  color: #fff;
  font-size: .82rem;
}
.document-meta-bar span { color: rgba(255,255,255,.78); text-align: right; font-weight: 700; }
.document-card-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.document-file-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.document-file-row strong { display: block; line-height: 1.25; }
.document-file-row span { display: block; color: var(--muted); font-size: .82rem; margin-top: 3px; }
.document-open { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 12px; white-space: nowrap; }
.report-document-list { display: grid; gap: 10px; }
.report-document { border: 1px solid var(--soft-line); border-radius: 12px; padding: 10px 12px; background: #f9fafb; break-inside: avoid; }
.report-document strong { display: block; }
.report-document span { display: block; color: var(--muted); font-size: .84rem; margin-top: 3px; }
.report-document p { margin: 8px 0 0 !important; }
.mobile-doc-action input { display: none; }

@media (max-width: 720px) {
  .mobile-action-bar { grid-template-columns: 0.8fr 0.9fr 0.9fr 1fr 0.9fr; }
  .document-file-row { align-items: stretch; flex-direction: column; }
  .document-open { width: 100%; }
  .documents-panel .upload-button { width: 100%; }
  .quality-control-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .quality-control-actions button { width: 100%; }
}

@media (max-width: 380px) {
  .mobile-action-bar { grid-template-columns: repeat(5, 1fr); }
}

/* v6 workflow refinements: audio report, quick site inspection, Word export */
.three-actions { grid-template-columns: 1fr 1fr 1fr; }
.audio-panel,
.site-inspection-panel { border-color: #fde68a; }
.audio-controls,
.audio-secondary-actions,
.quick-actions,
.generated-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.audio-controls button,
.quick-actions button,
.quick-actions .upload-button,
.generated-actions button { white-space: nowrap; }
.audio-secondary-actions { margin-top: 12px; justify-content: space-between; }
.missing-flags-label { margin-top: 12px; }
.missing-flags-label textarea,
#audioSummary { background: #fffbeb; }
.site-capture-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.fast-capture-grid textarea { min-height: 104px; }
.compact-upload { padding: 10px 12px; }
.hidden-mobile-doc { display: none !important; }

@media (max-width: 720px) {
  .three-actions { grid-template-columns: 1fr; }
  .audio-controls,
  .audio-secondary-actions,
  .quick-actions,
  .generated-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .site-capture-strip { grid-template-columns: 1fr; }
  .mobile-action-bar { grid-template-columns: repeat(6, 1fr); }
  .mobile-action { font-size: 0.76rem; padding: 0 4px; }
  body.layout-phone .mobile-action-bar { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 380px) {
  .mobile-action-bar { grid-template-columns: repeat(3, 1fr); }
  body { padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
  body.layout-phone { padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
}

/* Hosted audio session additions */
.audio-session-bar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 12px 0;
}
.audio-session-status {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f9fafb;
  display: grid;
  gap: 3px;
}
.audio-session-status span { color: var(--muted, #6b7280); font-size: 0.9rem; }
.audio-segment-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
}
.audio-segment-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border, #d1d5db);
  background: #ffffff;
  border-radius: 14px;
  padding: 10px;
}
.audio-segment-card span { color: var(--muted, #6b7280); font-size: 0.9rem; }
.danger-light { border-color: #fecaca !important; color: #991b1b !important; }
@media (max-width: 760px) {
  .audio-session-bar { grid-template-columns: 1fr; align-items: stretch; }
  .audio-segment-card { grid-template-columns: 1fr; }
  .audio-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .audio-controls button { width: 100%; }
}

/* Hosted app login + team access */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(17,24,39,0.12), transparent 30%), #f5f7fb;
}
.login-card {
  width: min(460px, 100%);
  background: #ffffff;
  border: 1px solid #d9dee8;
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.16);
}
.login-logo {
  margin-bottom: 14px;
}
.login-card h1 {
  margin: 0 0 6px;
}
.login-card p {
  color: #5b6472;
}
.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.login-form input {
  width: 100%;
}
.login-message {
  min-height: 1.3em;
  color: #b42318;
  font-weight: 700;
  margin: 0;
}
.login-help {
  margin-top: 18px;
  padding: 12px;
  border-radius: 14px;
  background: #f3f4f6;
  color: #4b5563;
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}
.app-locked .app-header,
.app-locked .mobile-section-nav,
.app-locked main.layout,
.app-locked .mobile-action-bar,
.app-locked #reportView {
  display: none !important;
}
body:not(.app-locked) #loginScreen {
  display: none !important;
}
.user-chip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.9rem;
  color: #334155;
}
.user-chip span {
  padding: 8px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #dbe3ef;
  font-weight: 700;
}
.team-panel .mini-user-form {
  display: none;
  gap: 10px;
  margin-top: 12px;
}
body.is-admin .team-panel .mini-user-form {
  display: grid;
}
.user-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.user-row {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}
.user-row span {
  color: #64748b;
  font-size: 0.84rem;
}
@media (max-width: 820px) {
  .user-chip {
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .user-chip span,
  .user-chip button {
    flex: 1 1 auto;
  }
}

.report-cover-text { min-width: 0; }

@media (max-width: 760px) {
  .report-view .report-cover { grid-template-columns: 1fr; align-items: start; }
  .report-banner-logo { width: 100%; max-width: 520px; }
}
