:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #68736f;
  --line: #dce3df;
  --green: #15803d;
  --red: #c92a2a;
  --red-soft: #ffe3e3;
  --blue: #1c64d1;
  --blue-soft: #dbeafe;
  --dark: #334155;
  --shadow: 0 10px 28px rgba(18, 32, 27, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
.primary,
.success,
.danger {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 750;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #12362f;
  color: #fff;
}

.secondary-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #12362f;
  font-weight: 800;
}

.success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
}

.danger {
  background: var(--red);
  color: #fff;
}

.small {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.block {
  width: 100%;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 22px;
}

.login-panel {
  width: min(100%, 420px);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-panel h1,
.topbar h1 {
  margin: 2px 0 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.login-logo {
  display: block;
  width: min(100%, 230px);
  height: auto;
  margin: 0 0 18px;
}

.brand-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title img {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-title div {
  min-width: 0;
}

.brand-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: #49615a;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.muted,
label {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 13px 12px;
}

textarea {
  resize: vertical;
}

.test-users {
  margin-top: 18px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(244, 246, 245, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.icon-button {
  width: 48px;
  min-height: 48px;
  border-radius: 999px;
  background: #e5ebe8;
  color: var(--ink);
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
}

.profile-strip,
.section,
.detail-panel,
.route-card,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.route-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.route-card h2 {
  margin: 0;
  font-size: 1.1rem;
  text-transform: capitalize;
}

.route-card > span {
  color: var(--muted);
  font-weight: 750;
}

.route-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.route-meta div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.route-meta span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.profile-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
}

.profile-strip div,
.work-card div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.profile-strip span,
.work-card span,
.module-row span,
.timeline span {
  color: var(--muted);
  font-size: 0.86rem;
}

.section {
  margin-top: 14px;
  padding: 14px;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
}

.section-title a {
  color: #12362f;
  font-weight: 800;
  font-size: 0.9rem;
}

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

.module-card,
.module-row,
.work-card,
.empty-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.module-card {
  min-height: 98px;
  display: grid;
  align-content: space-between;
  padding: 14px;
}

.module-card span {
  color: var(--muted);
  font-weight: 800;
}

.module-card strong {
  font-size: 1.8rem;
}

.module-card strong.metric {
  font-size: 1.05rem;
}

.module-card .subtle {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.module-card.red,
.module-row.red,
.detail-panel.red,
.red-line {
  border-left: 5px solid var(--red);
}

.module-card.blue,
.module-row.blue,
.detail-panel.blue,
.blue-line {
  border-left: 5px solid var(--blue);
}

.module-list,
.card-list,
.timeline {
  display: grid;
  gap: 10px;
}

.module-row,
.work-card {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.planning-card {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.planning-date {
  min-height: 68px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 8px;
  background: #e8eeeb;
  text-transform: capitalize;
}

.planning-date span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.planning-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.planning-main span,
.planning-main li {
  color: var(--muted);
  font-size: 0.86rem;
}

.planning-main ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.task-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.task-list span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 750;
}

.work-card strong,
.module-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.chevron {
  flex: 0 0 auto;
  font-size: 1.8rem;
}

.status {
  flex: 0 0 auto;
  max-width: 46%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.74rem !important;
  font-weight: 850;
  text-align: center;
  line-height: 1.15;
}

.status.red,
.alert.red {
  background: var(--red-soft);
  color: var(--red);
}

.status.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.status.green {
  background: #dcfce7;
  color: var(--green);
}

.status.dark {
  background: #e2e8f0;
  color: var(--dark);
}

.status.neutral {
  background: #e8eeeb;
  color: #31423d;
}

.detail-panel {
  padding: 16px;
}

.detail-panel h2 {
  margin: 12px 0 6px;
  font-size: 1.35rem;
}

.detail-panel p {
  margin: 6px 0;
  color: var(--muted);
}

.info-grid {
  display: grid;
  gap: 10px;
}

.info-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.info-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.map-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.contact-list {
  display: grid;
  gap: 10px;
}

.document-list {
  display: grid;
  gap: 10px;
}

.document-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.document-card div:first-child {
  display: grid;
  gap: 4px;
}

.document-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

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

.presence-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.presence-card > div:first-child,
.presence-times {
  display: grid;
  gap: 4px;
}

.presence-card span,
.presence-times span {
  color: var(--muted);
  font-size: 0.84rem;
}

.presence-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contact-card {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.contact-card div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.contact-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.contact-card strong,
.contact-card a {
  overflow-wrap: anywhere;
}

.contact-card div a {
  color: #1c64d1;
  font-weight: 850;
}

.call-button {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #12362f;
  color: #fff;
  font-size: 1.25rem;
}

.action-box {
  box-shadow: none;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.check-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-group legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.check-group label {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.check-group input {
  width: 22px;
  height: 22px;
}

.group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.group-pills span {
  border-radius: 999px;
  background: #e8eeeb;
  color: #31423d;
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.draw-tools .tool {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.draw-tools .tool.active {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.draw-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ef;
  min-height: 220px;
}

.photo-editor {
  position: relative;
  display: none;
  touch-action: none;
  user-select: none;
}

.photo-editor.ready {
  display: block;
}

.photo-editor img {
  width: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}

.draw-stage span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.photo-frame {
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-image-wrap {
  position: relative;
}

.photo-frame img {
  width: 100%;
  display: block;
}

.photo-frame figcaption {
  padding: 12px;
  color: var(--muted);
  font-weight: 750;
}

.annotation-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotation-overlay line,
.annotation-overlay ellipse {
  fill: none;
  stroke: #d91f26;
  stroke-width: 2;
  stroke-linecap: round;
}

.editor-overlay {
  z-index: 2;
}

.alert,
.empty-card,
.empty-state {
  padding: 14px;
}

.checkin-status {
  min-height: 42px;
  display: grid;
  align-items: center;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f3f6f4;
  color: var(--muted);
  font-weight: 800;
}

.checkin-status:empty {
  display: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.checkin-status.pending {
  background: #e8eeeb;
  color: #31423d;
}

.checkin-status.success {
  background: #dcfce7;
  color: var(--green);
}

.checkin-status.error {
  background: var(--red-soft);
  color: var(--red);
}

.empty-state {
  text-align: center;
}

.timeline article {
  display: grid;
  gap: 4px;
  border-left: 4px solid #cbd5d1;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
}

code {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: #edf2ef;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.78rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.bottom-nav a {
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.bottom-nav span {
  font-size: 1.1rem;
}

.bottom-nav a.active {
  background: #e4eeeb;
  color: #12362f;
}

@media (min-width: 680px) {
  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
