:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e0e8;
  --primary: #175cd3;
  --primary-strong: #123f91;
  --accent: #008579;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.09);
  --ok: #07885f;
  --fail: #c0362c;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101418;
  --surface: #181f26;
  --surface-soft: #222b34;
  --text: #f3f6f8;
  --muted: #a8b3bf;
  --line: #34404c;
  --primary: #74a7ff;
  --primary-strong: #a9c8ff;
  --accent: #4fd1c5;
  --danger: #ff8a80;
  --warning: #ffc069;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --ok: #46d39a;
  --fail: #ff8a80;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.mobile-appbar,
.mobile-menu-backdrop {
  display: none;
}

.sidebar {
  min-height: 100vh;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(23, 92, 211, 0.16), transparent 38%),
    #1e2630;
  color: #f7fafc;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
}

.sidebar .muted,
.sidebar .small,
.sidebar .brand p {
  color: rgba(255, 255, 255, 0.68);
}

.hamburger {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
}

.hamburger span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.mobile-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  background: #020b20;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.muted,
.small {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  background: transparent;
}

.nav button {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
}

.nav button.active,
.nav button:hover,
.ghost-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-icon,
.icon-text svg,
.theme-button svg,
.logout-button svg {
  width: 18px;
  height: 18px;
  display: inline-flex;
  flex: 0 0 18px;
}

.nav-icon svg,
.icon-text svg,
.theme-button svg,
.logout-button svg,
.icon-button svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.sidebar-footer {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.sidebar-footer .badge {
  color: #d8e7ff;
  background: rgba(116, 167, 255, 0.18);
  border-color: rgba(116, 167, 255, 0.28);
}

.main {
  padding: 28px;
  min-width: 0;
  padding-bottom: 110px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2,
.section-title {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
}

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

.icon-text,
.theme-button,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logout-button {
  background: #d92d20;
  border-color: #d92d20;
  color: #fff;
}

.theme-button {
  color: #101828;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-button.danger {
  color: var(--danger);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.auth-panel,
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
}

.card h3,
.card h4 {
  margin: 0 0 8px;
}

.metric {
  min-height: 120px;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
}

.form {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 8px;
}

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

label {
  font-weight: 650;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
}

.auth-panel {
  margin: 28px;
  padding: 28px;
  align-self: center;
  backdrop-filter: blur(16px);
}

.install-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: -8px 0 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary-strong);
  font-weight: 800;
}

.install-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.auth-visual {
  display: flex;
  align-items: end;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(10, 20, 35, 0.28), rgba(0, 133, 121, 0.76)),
    url("https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.auth-visual h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(36px, 6vw, 76px);
  line-height: 0.94;
  letter-spacing: 0;
  text-wrap: balance;
}

.tabs,
.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.tabs button,
.segmented button {
  flex: 1;
  border: 0;
  border-radius: 6px;
  min-height: 36px;
  background: transparent;
  color: var(--text);
}

.tabs button.active,
.segmented button.active {
  background: var(--surface);
}

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

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  display: grid;
  gap: 10px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, transparent), transparent 55%),
    linear-gradient(120deg, var(--surface), var(--surface-soft));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dashboard-hero h3 {
  max-width: 780px;
  margin: 8px 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.dashboard-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.hero-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.list-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-summary-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.dashboard-summary-card article {
  min-height: 94px;
  padding: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, transparent), transparent),
    var(--surface);
}

.dashboard-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.compact-task {
  cursor: pointer;
}

.section-heading,
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h3,
.modal-head h2,
.modal-head p {
  margin: 0;
}

.section-heading h3 {
  margin-top: 4px;
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.task-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.task-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.task-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.task-calendar {
  margin-bottom: 14px;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  text-transform: capitalize;
}

.calendar-head span {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.calendar-nav {
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  font-weight: 900;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-cell {
  position: relative;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 5px;
  font-weight: 800;
}

.calendar-cell.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.calendar-cell.has-task:not(.active) {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.calendar-cell small {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
}

.calendar-cell.active small {
  background: #fff;
  color: var(--primary);
}

.muted-cell {
  opacity: 0;
  pointer-events: none;
}

.task-day {
  display: grid;
  gap: 12px;
}

.task-card.done {
  opacity: 0.72;
}

.task-card.done strong {
  text-decoration: line-through;
}

.compact-modal {
  width: min(680px, 100%);
}

.success-modal {
  text-align: center;
  display: grid;
  place-items: center;
  gap: 12px;
}

.success-modal h2,
.success-modal p {
  margin: 0;
}

.success-check {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ok);
  animation: popSuccess 520ms ease both;
}

.success-check svg {
  width: 42px;
  height: 42px;
  fill: currentColor;
}

.success-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

@keyframes popSuccess {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-grid p {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-grid span {
  color: var(--muted);
}

.task-card {
  cursor: pointer;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
    var(--surface);
  color: var(--accent);
  text-align: center;
}

.empty-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
}

.badge.warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.template-gallery.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.template-card {
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.template-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent-color, var(--primary));
}

.template-card::after {
  content: "";
  position: absolute;
  right: -52px;
  top: -52px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-color, var(--primary)) 15%, transparent);
}

.template-card > * {
  position: relative;
  z-index: 1;
}

.template-kicker,
.task-template-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 750;
  color: var(--accent-color, var(--primary));
  background: color-mix(in srgb, var(--accent-color, var(--primary)) 12%, transparent);
}

.task-template-chip {
  margin-top: 8px;
}

.accent-blue { --accent-color: #175cd3; }
.accent-teal { --accent-color: #008579; }
.accent-violet { --accent-color: #7950f2; }
.accent-amber { --accent-color: #b76e00; }
.accent-rose { --accent-color: #c43c64; }

.builder-field,
.runtime-field,
.task-row {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
}

.field-head,
.task-row {
  display: grid;
  grid-template-columns: 1fr 150px 40px;
  gap: 10px;
  align-items: center;
}

.header-field-head {
  grid-template-columns: 1fr 130px auto 40px;
}

.builder-header-grid {
  margin: 8px 0;
}

.header-builder-field {
  padding: 10px;
}

.field-options,
.checkline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.field-options label,
.checkline label,
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--muted);
}

.field-options input,
.checkline input,
.inline-check input {
  width: auto;
  min-height: auto;
}

.runtime-field {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 5%, transparent), transparent),
    var(--surface);
}

.runtime-field legend {
  padding: 0 8px;
}

.checklist-header-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent),
    var(--surface);
}

.checklist-header-card h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

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

.header-runtime-field textarea {
  min-height: 72px;
}

.status-picker {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.status-button {
  width: 64px;
  height: 64px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}

.status-button.ok {
  color: var(--ok);
}

.status-button.fail {
  color: var(--fail);
}

.status-button.nt {
  color: var(--warning);
}

.status-button.selected {
  transform: scale(1.14);
  opacity: 1;
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 11%, var(--surface));
  box-shadow: 0 12px 30px color-mix(in srgb, currentColor 20%, transparent);
}

.status-button.dimmed {
  opacity: 0.38;
}

.signature-pad {
  height: 150px;
  width: 100%;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.photo-preview {
  max-width: 180px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 15, 20, 0.52);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(920px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.report-paper {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 16mm;
  background: #fff;
  color: #15202b;
  border-radius: 3px;
  display: grid;
  align-content: start;
  gap: 8mm;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5pt;
  line-height: 1.42;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.report-a4-cover {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  padding: 12mm;
  border-radius: 4px;
  color: #fff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-color, #175cd3) 84%, #111827), #111827);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.report-label {
  display: block;
  margin-bottom: 6px;
  font-size: 8.5pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.76);
}

.report-logo {
  width: 54px;
  height: 54px;
  display: block;
  margin-bottom: 12px;
  border-radius: 10px;
  object-fit: cover;
}

.report-cover h1 {
  margin: 0;
  font-size: 23pt;
  line-height: 1.05;
}

.report-cover p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.76);
}

.report-code {
  min-width: 36mm;
  padding: 7mm;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  text-align: right;
}

.report-code strong,
.report-code span {
  display: block;
}

.report-code strong {
  font-size: 7.5pt;
  color: rgba(255, 255, 255, 0.7);
}

.report-code span {
  margin-top: 4px;
  font-size: 13pt;
  font-weight: 800;
}

.report-section {
  border: 1px solid #d7dee8;
  border-radius: 4px;
  padding: 7mm;
  break-inside: avoid;
}

.report-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5mm;
}

.report-section-title span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent-color, #175cd3);
  font-size: 8pt;
  font-weight: 800;
}

.report-section-title h2 {
  margin: 0;
  font-size: 13pt;
}

.report-identity,
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 1px;
  overflow: hidden;
  padding: 0;
  background: #d7dee8;
}

.report-identity div,
.report-summary-grid article {
  padding: 5mm;
  background: #f8fafc;
}

.report-identity strong,
.report-summary-grid span {
  display: block;
  margin-bottom: 3px;
  color: #667085;
  font-size: 8pt;
  text-transform: uppercase;
}

.report-identity span {
  word-break: break-word;
}

.report-summary-grid strong {
  display: block;
  color: #101828;
  font-size: 20pt;
}

.report-summary-text {
  margin: 0 0 5mm;
}

.report-alert,
.report-ok-box {
  display: grid;
  gap: 2px;
  padding: 4mm;
  border-radius: 4px;
}

.report-alert {
  color: #7a271a;
  background: #ffead5;
  border: 1px solid #f9dbaf;
}

.report-ok-box {
  color: #05603a;
  background: #dcfae6;
  border: 1px solid #abefc6;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}

.report-table th,
.report-table td {
  padding: 8px;
  border: 1px solid #d7dee8;
  vertical-align: top;
}

.report-table th {
  color: #475467;
  background: #f2f4f7;
  text-align: left;
  text-transform: uppercase;
  font-size: 7.5pt;
}

.report-table td:first-child {
  width: 9mm;
  text-align: center;
  font-weight: 800;
}

.report-check-list {
  display: grid;
  gap: 5mm;
}

.report-check-card {
  break-inside: avoid;
  padding: 5mm;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-color, #175cd3) 8%, transparent), transparent 66%),
    #fff;
}

.report-check-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 4mm;
  border-bottom: 1px solid #e7edf5;
}

.report-check-head span {
  display: block;
  color: var(--accent-color, #175cd3);
  font-size: 8pt;
  font-weight: 800;
  text-transform: uppercase;
}

.report-check-head h3 {
  margin: 2px 0 0;
  font-size: 11pt;
}

.report-note-grid {
  display: grid;
  gap: 3mm;
  margin-top: 4mm;
}

.report-note-grid p {
  margin: 0;
  display: grid;
  gap: 2px;
}

.report-note-grid strong {
  color: #667085;
  font-size: 8pt;
  text-transform: uppercase;
}

.report-note-grid span {
  color: #1d2939;
}

.report-muted-line {
  margin: 4mm 0 0;
  color: #667085;
}

.report-media-under-item {
  margin-top: 4mm;
  padding-top: 4mm;
  border-top: 1px solid #e7edf5;
}

.report-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 118px;
  min-height: 38px;
  border-radius: 999px;
  font-weight: 850;
}

.report-status.ok {
  color: #067647;
  background: #dcfae6;
}

.report-status.fail {
  color: #b42318;
  background: #fee4e2;
}

.report-status.nt {
  color: #92400e;
  background: #fef3c7;
}

.report-status svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.report-status .status-symbol {
  font-size: 11px;
}

.report-media {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.report-media figure {
  margin: 0;
}

.report-media figcaption {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}

.report-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5mm;
}

.report-evidence-grid article {
  break-inside: avoid;
}

.report-evidence-grid h3 {
  margin: 0 0 3mm;
  font-size: 10pt;
}

.report-paper img {
  max-width: 48mm;
  max-height: 34mm;
  border-radius: 3px;
  border: 1px solid #d7dee8;
  object-fit: cover;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5mm;
}

.signature-grid > div,
.signature-grid figure {
  min-height: 30mm;
  margin: 0;
  padding: 5mm;
  border: 1px solid #d7dee8;
  border-radius: 4px;
  display: grid;
  align-content: end;
}

.signature-grid img {
  max-width: 70mm;
  max-height: 22mm;
  object-fit: contain;
  border: 0;
}

.signature-grid figcaption,
.signature-grid span {
  margin-top: 4px;
  color: #667085;
  font-size: 8.5pt;
}

.fab {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 12;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  background: var(--text);
  color: var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  font-weight: 800;
}

.fab:hover {
  transform: translateY(-1px);
}

.checklist-modal {
  width: min(860px, 100%);
  padding: 18px;
}

.checklist-modal .form {
  gap: 8px;
}

.checklist-top {
  margin: -18px -18px 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.checklist-top h2 {
  margin-bottom: 4px;
}

.checklist-top p {
  margin-top: 0;
}

.art-stripe {
  border-left: 6px solid var(--accent-color, var(--primary));
}

.art-glass {
  background: color-mix(in srgb, var(--accent-color, var(--primary)) 10%, var(--surface));
  backdrop-filter: blur(14px);
}

.art-solid {
  background: var(--accent-color, var(--primary));
  color: #fff;
}

.art-solid p,
.art-solid .template-kicker {
  color: color-mix(in srgb, #fff 84%, transparent);
}

.border-line {
  border-color: var(--accent-color, var(--primary));
}

.border-shadow {
  box-shadow: 0 22px 60px color-mix(in srgb, var(--accent-color, var(--primary)) 18%, transparent);
}

.border-frame {
  border: 2px solid var(--accent-color, var(--primary));
}

.runtime-field {
  padding: 0;
  border: 0;
  background: transparent;
}

.runtime-field legend {
  display: none;
}

.inspection-card {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-color, var(--primary)) 50%, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-color, var(--primary)) 13%, transparent), transparent 72%),
    var(--surface);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.inspection-card h3 {
  margin: 0;
  min-width: 0;
  text-align: left;
  font-size: 15px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0;
}

.field-kind-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-color, var(--primary));
  background: color-mix(in srgb, var(--accent-color, var(--primary)) 12%, transparent);
}

.field-kind-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.inspection-status,
.inspection-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.inspection-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.status-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  font-size: 0;
  box-shadow: none;
}

.status-button svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.status-symbol {
  display: inline-grid;
  min-width: 28px;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.status-button.selected {
  transform: scale(1.08);
  background: transparent;
  box-shadow: none;
}

.tool-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: color-mix(in srgb, var(--accent-color, var(--primary)) 82%, #21314a);
  background: transparent;
  transition: background 160ms ease, transform 160ms ease;
}

.tool-icon:hover {
  background: color-mix(in srgb, var(--accent-color, var(--primary)) 10%, transparent);
  transform: translateY(-1px);
}

.tool-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0;
}

.tool-icon .camera-glyph {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.camera-tool {
  color: #0f766e;
  background: color-mix(in srgb, #0f766e 9%, transparent);
}

.signature-inline {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.signature-field .inspection-card {
  grid-template-columns: 34px 1fr;
}

.signature-field .inspection-status,
.signature-field .inspection-actions {
  display: none;
}

.signature-open-button {
  min-height: 36px;
  white-space: nowrap;
}

.signature-preview {
  min-height: 44px;
  flex: 1;
  display: grid;
  align-items: center;
  padding: 7px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.signature-preview img {
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
}

.signature-modal {
  width: min(940px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 24px));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  position: relative;
}

.signature-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.signature-modal-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.signature-board {
  min-height: 0;
  display: grid;
}

.signature-pad-large {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 34px, rgba(23, 92, 211, 0.08) 35px) border-box;
  border: 1px dashed color-mix(in srgb, var(--primary) 42%, var(--line));
  border-radius: 12px;
}

.signature-floating-actions {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
}

.signature-done-button {
  background: var(--ok);
  border-color: var(--ok);
}

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

.photo-source-actions .icon-text {
  justify-content: center;
  min-height: 52px;
}

.tool-icon svg path,
.tool-icon svg rect,
.tool-icon svg circle {
  vector-effect: non-scaling-stroke;
}

.hidden-file {
  display: none;
}

.photo-strip,
.audio-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thumb {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-preview {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.thumb > button:not(.thumb-preview) {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-weight: 850;
}

.photo-preview-modal {
  width: min(920px, calc(100vw - 28px));
  max-height: min(92vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.photo-preview-modal img {
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface-soft);
}

.evidence-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  white-space: pre-wrap;
}

.evidence-modal {
  width: min(620px, 100%);
}

.evidence-modal textarea {
  min-height: 180px;
}

.audio-pill {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.audio-pill audio {
  width: 100%;
}

.audio-pill p {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.audio-pill.recording {
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--danger);
}

.report-paper {
  max-width: 100%;
  margin: 0 auto;
}

.report-cover {
  min-height: auto;
}

.report-cover h1 {
  line-height: 1.05;
}

.report-status {
  min-width: auto;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.report-media {
  gap: 8px;
}

@page {
  size: A4;
  margin: 10mm;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
}

@media (max-width: 900px) {
  .app-shell,
  .auth-page,
  .grid.cols-2,
  .grid.cols-3,
  .split {
    grid-template-columns: 1fr;
  }

  body {
    background: var(--surface-soft);
  }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 19;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    padding: 10px 14px;
    background: #1e2630;
    color: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  }

  .mobile-appbar .brand-mark {
    width: 34px;
    height: 34px;
    background: #fff;
    color: #1e2630;
  }

  .mobile-appbar .icon-button {
    width: 42px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(82vw, 310px);
    min-height: 100vh;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.26);
  }

  .mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: none;
    background: rgba(0, 0, 0, 0.42);
  }

  .mobile-menu-open .mobile-menu-backdrop {
    display: block;
  }

  .main {
    padding: 12px;
    padding-bottom: 96px;
  }

  .auth-visual {
    min-height: 138px;
    order: -1;
    padding: 22px;
  }

  .auth-visual h2 {
    font-size: 30px;
    line-height: 1;
  }

  .auth-panel {
    margin: 14px;
    padding: 20px;
    box-shadow: none;
  }

  .topbar,
  .list-item-head,
  .dashboard-hero,
  .report-item-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .topbar p {
    display: none;
  }

  .dashboard-hero {
    display: none;
  }

  .dashboard-hero h3 {
    font-size: 26px;
  }

  .dashboard-hero p,
  .template-card::after {
    display: none;
  }

  .card,
  .list-item,
  .modal {
    box-shadow: none;
  }

  .metric {
    min-height: 72px;
    padding: 12px;
  }

  .dashboard-summary-card {
    grid-template-columns: 1fr;
    gap: 0;
    border: 0;
    border-radius: 14px;
    background:
      radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 38%),
      linear-gradient(135deg, #182434, #24364a);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
  }

  .dashboard-summary-card article {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: transparent;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .dashboard-summary-card article:last-child {
    border-bottom: 0;
  }

  .dashboard-summary-card span {
    color: rgba(255, 255, 255, 0.72);
  }

  .dashboard-summary-card strong {
    margin: 0;
    font-size: 26px;
  }

  .metric strong {
    margin-top: 5px;
    font-size: 24px;
  }

  .dashboard-lists {
    gap: 10px;
    margin-top: 10px !important;
  }

  .dashboard-lists .card,
  .dashboard-lists .list-item {
    padding: 12px;
  }

  .dashboard-lists .list {
    gap: 8px;
  }

  .task-summary {
    gap: 8px;
    margin-bottom: 10px;
  }

  .task-summary article {
    padding: 10px;
  }

  .task-summary strong {
    font-size: 22px;
  }

  .task-calendar {
    padding: 12px;
  }

  .calendar-grid,
  .calendar-weekdays {
    gap: 4px;
  }

  .calendar-cell {
    min-height: 40px;
    padding: 4px;
    border-radius: 7px;
  }

  .section-heading {
    align-items: stretch;
    margin-bottom: 8px;
  }

  .section-heading .primary-button {
    display: none;
  }

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

  .fab {
    right: 16px;
    bottom: 16px;
    left: 16px;
    min-height: 50px;
  }

  .field-head,
  .task-row {
    grid-template-columns: 1fr;
  }

  .checklist-header-grid {
    grid-template-columns: 1fr;
  }

  .header-field-head {
    grid-template-columns: 1fr;
  }

  .inspection-card {
    grid-template-columns: 1fr auto;
    gap: 8px;
    min-height: 58px;
    padding: 8px;
  }

  .signature-field .inspection-card {
    grid-template-columns: 28px 1fr;
  }

  .inspection-status {
    order: 1;
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 6px;
  }

  .inspection-card h3 {
    order: 2;
    grid-column: 1 / -1;
    font-size: 13px;
    padding-top: 2px;
  }

  .inspection-actions {
    order: 4;
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 2px;
  }

  .field-kind-icon {
    order: 1;
    width: 26px;
    height: 26px;
  }

  .status-button {
    width: 36px;
    height: 38px;
  }

  .tool-icon {
    width: 30px;
    height: 30px;
  }

  .status-button svg {
    width: 32px;
    height: 32px;
  }

  .tool-icon svg {
    width: 20px;
    height: 20px;
  }

  .signature-inline {
    order: 5;
    align-items: stretch;
    gap: 8px;
  }

  .signature-preview {
    min-height: 38px;
  }

  .signature-modal {
    width: calc(100vw - 12px);
    height: min(76vh, 520px);
    border-radius: 12px;
    padding: 10px;
  }

  .signature-pad-large {
    min-height: 280px;
  }

  .signature-floating-actions {
    right: 14px;
    bottom: 14px;
  }

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

  .photo-preview-modal img {
    max-height: 72vh;
  }

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

  .icon-button {
    width: 100%;
  }

  .modal-head .icon-button,
  .toolbar .icon-button,
  .calendar-nav {
    width: 40px;
    flex: 0 0 40px;
  }

  .modal-backdrop {
    padding: 0;
    place-items: end center;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    padding: 16px;
  }

  .checklist-modal {
    border-radius: 0;
    max-height: 100vh;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .signature-backdrop {
    place-items: stretch;
  }

  .signature-modal {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 10px;
  }

  .signature-modal-head h2 {
    font-size: 15px;
  }

  .signature-board {
    min-height: 0;
  }

  .signature-pad-large {
    min-height: 0;
  }

  .signature-floating-actions {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .signature-landscape-open body {
    overflow: hidden;
  }

  .signature-backdrop {
    place-items: center;
    overflow: hidden;
  }

  .signature-modal {
    width: 100dvh;
    height: 100dvw;
    max-width: none;
    max-height: none;
    border-radius: 0;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 10px;
    transform: rotate(90deg);
    transform-origin: center center;
  }

  .signature-modal-head h2 {
    font-size: 15px;
  }

  .signature-board,
  .signature-pad-large {
    min-height: 0;
  }

  .signature-floating-actions {
    right: 10px;
    bottom: 10px;
  }
}

@media print {
  html,
  body {
    width: auto;
    min-height: auto;
    margin: 0;
    background: #fff !important;
  }

  body * {
    visibility: hidden;
  }

  .modal-backdrop,
  .modal {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .modal > .topbar {
    display: none !important;
  }

  #print-area,
  #print-area * {
    visibility: visible;
  }

  #print-area {
    position: static !important;
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none;
    border-radius: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-section,
  .report-check-card,
  .signature-grid figure,
  .signature-grid > div {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
