:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f0f2f5;
  --text: #151923;
  --muted: #606a78;
  --line: #d9dee7;
  --primary: #ff9f1a;
  --primary-strong: #de7900;
  --navy: #081a33;
  --danger: #d92d20;
  --success: #16803c;
  --radius: 8px;
  --shadow: 0 6px 18px rgba(18, 28, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  font-size: 16px;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px clamp(16px, 4vw, 32px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  display: block;
  width: auto;
  height: 40px;
  max-width: min(180px, 42vw);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.user-name {
  display: none;
  color: var(--muted);
  font-size: 14px;
}

.app-main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 28px) 48px;
}

.login-main {
  width: min(420px, 100%);
  margin: 0 auto;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 18px;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.05;
}

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

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 18px;
}

.alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 700;
}

.alert.success {
  color: var(--success);
  background: #e8f6ed;
  border: 1px solid #b9e3c7;
}

.alert.error {
  color: var(--danger);
  background: #fff0ed;
  border: 1px solid #ffd1ca;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
button.primary {
  background: var(--primary);
  color: #111827;
}

.button.secondary,
button.secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

fieldset.field {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field label,
.field-label {
  color: #283244;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #b8c0cc;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(255, 159, 26, 0.25);
  border-color: var(--primary-strong);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.actions.compact {
  margin-top: 0;
}

.actions form {
  margin: 0;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  margin: 18px -14px -18px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.service-list {
  display: grid;
  gap: 8px;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.check-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.check-card input {
  width: 22px;
  min-height: 22px;
  margin: 1px 0 0;
}

.report-list {
  overflow: hidden;
}

.report-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas:
    "number meta"
    "equipment equipment"
    "date date"
    "actions actions";
  gap: 10px 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.report-row.header {
  display: none;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.data-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.data-row:last-child {
  border-bottom: 0;
}

.report-row:last-child,
.user-row:last-child {
  border-bottom: 0;
}

.report-number {
  grid-area: number;
  font-size: 22px;
  font-weight: 900;
}

.report-meta {
  grid-area: meta;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.report-meta strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

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

.report-equipment {
  grid-area: equipment;
  display: grid;
  gap: 3px;
}

.report-date {
  grid-area: date;
  display: grid;
  gap: 3px;
}

.report-detail-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-actions {
  grid-area: actions;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
}

.report-actions .button {
  min-width: 0;
  padding-inline: 10px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.finalizado {
  background: #e8f6ed;
  color: var(--success);
}

.badge.enviado {
  background: #e8f1ff;
  color: #175cd3;
}

.badge.cancelado {
  background: #fff0ed;
  color: var(--danger);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.detail-table th,
.detail-table td {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.detail-table th {
  background: var(--surface-alt);
  font-size: 13px;
}

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

.photo-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid #b8c0cc;
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
}

.signature-preview {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 760px) {
  .user-name {
    display: inline;
  }

  .app-main {
    padding-top: 28px;
  }

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

  .field.full {
    grid-column: 1 / -1;
  }

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

  .report-row {
    grid-template-columns: 90px 1.5fr 1fr 120px 140px;
    align-items: center;
  }

  .report-number,
  .report-meta,
  .report-equipment,
  .report-date,
  .report-actions {
    grid-area: auto;
  }

  .user-row {
    grid-template-columns: 1.5fr 130px 110px 100px 190px;
    align-items: center;
  }

  .report-row.header,
  .user-row.header {
    display: grid;
    background: var(--surface-alt);
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .report-detail-label {
    display: none;
  }

  .report-equipment,
  .report-date {
    display: block;
  }

  .report-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .detail-table th,
  .detail-table td {
    display: table-cell;
  }

  .detail-table th {
    width: 190px;
  }

  .filters {
    grid-template-columns: 1fr 180px 130px;
    align-items: end;
  }

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