:root {
  --ink: #15302a;
  --muted: #64746f;
  --green-950: #0b2a21;
  --green-900: #12372c;
  --green-800: #195143;
  --green-700: #26705e;
  --green-100: #dfeee8;
  --green-50: #f0f7f4;
  --orange: #f2a23a;
  --orange-dark: #9e5b0a;
  --red: #bd3a35;
  --red-soft: #fbe8e7;
  --blue: #276a8d;
  --white: #ffffff;
  --surface: #f4f7f5;
  --line: #d9e2de;
  --shadow: 0 14px 36px rgba(15, 49, 39, 0.10);
  --radius: 18px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface); }
body { margin: 0; min-height: 100vh; background: var(--surface); }
button, select, input { font: inherit; }
button, select { min-height: 46px; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; padding-bottom: 86px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  min-height: 72px; padding: 11px max(16px, env(safe-area-inset-left));
  color: var(--white);
  background: linear-gradient(118deg, var(--green-950), var(--green-800));
  box-shadow: 0 5px 22px rgba(7, 35, 27, .2);
}
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 14px; background: var(--orange); color: var(--green-950);
  font-weight: 900; letter-spacing: -.04em;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.12; }
.brand-copy strong { font-size: 1.12rem; }
.brand-copy span { margin-top: 4px; font-size: .79rem; opacity: .82; }
.demo-badge {
  margin-left: auto; padding: 6px 9px; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; font-size: .73rem; font-weight: 800; letter-spacing: .08em;
}

.role-strip {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: #e9f1ee; border-bottom: 1px solid var(--line);
}
.role-strip label { font-size: .86rem; font-weight: 750; }
.role-strip select {
  flex: 0 1 220px; padding: 0 36px 0 13px; color: var(--ink); background: var(--white);
  border: 1px solid #bfd0c9; border-radius: 12px; font-weight: 700;
}
.install-button {
  margin-left: auto; padding: 0 14px; border: 0; border-radius: 12px;
  color: white; background: var(--green-800); font-weight: 750;
}

main { width: min(100%, 1160px); margin: 0 auto; padding: 20px 16px 30px; }
.eyebrow { margin: 0 0 7px; color: var(--green-700); font-size: .78rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.55rem, 6vw, 2.35rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 14px; font-size: 1.2rem; letter-spacing: -.015em; }
h3 { margin-bottom: 8px; font-size: 1.03rem; }
.muted { color: var(--muted); }
.lead { margin-bottom: 20px; color: var(--muted); font-size: 1rem; line-height: 1.5; }

.card {
  padding: 18px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 5px 18px rgba(20, 52, 43, .05);
}
.card + .card { margin-top: 14px; }
.card-accent { overflow: hidden; position: relative; border: 0; box-shadow: var(--shadow); }
.card-accent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--orange); }
.card-dark { color: white; background: linear-gradient(135deg, var(--green-950), var(--green-800)); border: 0; }
.card-dark .muted { color: rgba(255,255,255,.72); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { margin-bottom: 4px; font-size: 1.13rem; font-weight: 850; }
.date-tile {
  display: grid; place-items: center; align-content: center; min-width: 64px; height: 68px;
  border-radius: 15px; color: var(--green-950); background: var(--orange); line-height: 1;
}
.date-tile strong { font-size: 1.65rem; }
.date-tile span { margin-top: 4px; font-size: .72rem; font-weight: 850; }
.meta-list { display: grid; gap: 9px; margin: 16px 0; }
.meta-row { display: flex; gap: 10px; align-items: flex-start; line-height: 1.35; }
.meta-icon { width: 24px; flex: 0 0 24px; text-align: center; }

.status {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px;
  border-radius: 999px; font-size: .78rem; font-weight: 800;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-planned { color: var(--blue); background: #e5f1f7; }
.status-present { color: #167451; background: #e0f4ea; }
.status-open { color: var(--orange-dark); background: #fff1dc; }
.status-missing { color: var(--red); background: var(--red-soft); }

.primary, .secondary, .ghost, .danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px; border-radius: 13px; font-weight: 820; text-decoration: none;
}
.primary { color: white; background: var(--green-800); border: 2px solid var(--green-800); }
.primary:hover, .primary:focus-visible { background: var(--green-950); border-color: var(--green-950); }
.secondary { color: var(--green-900); background: var(--white); border: 2px solid #a9c3b9; }
.secondary:hover, .secondary:focus-visible { border-color: var(--green-700); }
.ghost { color: var(--green-800); background: transparent; border: 1px solid var(--line); }
.danger { color: var(--red); background: var(--red-soft); border: 1px solid #f0bebc; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1 1 180px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.quick-action {
  min-height: 118px; padding: 16px; text-align: left; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 4px 12px rgba(20,52,43,.04);
}
.quick-action .icon { display: block; margin-bottom: 15px; color: var(--green-700); font-size: 1.55rem; }
.quick-action strong { display: block; font-size: 1rem; }
.quick-action small { display: block; margin-top: 5px; color: var(--muted); font-size: .79rem; line-height: 1.35; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.section-head h2 { margin: 0; }
.doc-list, .people-list { display: grid; gap: 10px; }
.doc-item, .person-item {
  display: flex; align-items: center; gap: 13px; padding: 14px; background: var(--white);
  border: 1px solid var(--line); border-radius: 15px;
}
.doc-icon, .avatar {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 14px; color: var(--green-800); background: var(--green-100); font-weight: 850;
}
.doc-copy, .person-copy { min-width: 0; flex: 1; }
.doc-copy strong, .person-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.doc-copy span, .person-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: .82rem; line-height: 1.3; }
.chevron { color: var(--muted); font-size: 1.35rem; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.metric strong { display: block; font-size: 1.75rem; line-height: 1; }
.metric span { display: block; margin-top: 8px; color: var(--muted); font-size: .83rem; line-height: 1.25; }
.metric.attention strong { color: var(--red); }

.table-wrap { overflow-x: auto; margin: 0 -2px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: .91rem; }

.qr-layout { display: grid; gap: 18px; align-items: start; }
.qr-box { padding: 18px; text-align: center; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.qr-box img { display: block; width: min(100%, 280px); margin: 0 auto 14px; border-radius: 12px; }
.session-code { font: 800 1.2rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }

.check-grid { display: grid; gap: 12px; margin: 16px 0; }
.check-option {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--green-50);
}
.check-option input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--green-700); }
.check-option span { line-height: 1.38; }

.upload-box { padding: 18px; border: 2px dashed #acc7bd; border-radius: var(--radius); background: var(--green-50); text-align: center; }
.upload-box input { width: 100%; margin: 12px 0; }
.import-result { margin-top: 12px; padding: 12px; border-radius: 12px; background: white; border: 1px solid var(--line); text-align: left; }

.bottom-nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -7px 22px rgba(18,55,44,.08);
}
.nav-button {
  display: grid; place-items: center; gap: 3px; min-height: 56px; padding: 5px 3px;
  color: var(--muted); background: transparent; border: 0; border-radius: 12px;
  font-size: .69rem; font-weight: 760;
}
.nav-button .nav-icon { font-size: 1.28rem; line-height: 1; }
.nav-button.active { color: var(--green-900); background: var(--green-100); }

.app-dialog { width: min(calc(100% - 28px), 520px); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 22px 70px rgba(5,30,22,.35); }
.app-dialog::backdrop { background: rgba(6, 30, 23, .63); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; }
.close-button { width: 42px; height: 42px; min-height: 42px; border-radius: 50%; border: 0; background: var(--surface); font-size: 1.35rem; }
.code-input { width: 100%; padding: 14px; border: 2px solid #abc2b9; border-radius: 13px; text-align: center; font: 800 1.1rem ui-monospace, monospace; letter-spacing: .06em; }
.camera-box { display: grid; place-items: center; min-height: 180px; margin-bottom: 14px; overflow: hidden; border-radius: 15px; background: #0d211b; color: white; }
.camera-box video { width: 100%; display: block; }
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: 92px; transform: translate(-50%, 20px);
  width: min(calc(100% - 32px), 440px); padding: 13px 16px; color: white; background: var(--green-950);
  border-radius: 13px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); background: white; border: 1px dashed #b9ccc5; border-radius: var(--radius); }
.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; }

@media (min-width: 760px) {
  .app-shell { padding-bottom: 30px; }
  .topbar, .role-strip { padding-left: max(24px, calc((100vw - 1160px)/2)); padding-right: max(24px, calc((100vw - 1160px)/2)); }
  main { padding: 28px 24px 40px; }
  .bottom-nav { position: static; width: min(100% - 48px, 1160px); margin: 0 auto 24px; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 6px 20px rgba(18,55,44,.06); }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .qr-layout { grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr); }
  .doc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .brand-copy span { display: none; }
  .role-strip { flex-wrap: wrap; }
  .role-strip select { flex: 1; }
  .install-button { width: 100%; margin-left: 0; }
}
