:root {
  /* SIGOPE — ver SIGOPE_IDENTIDADE_VISUAL.md */
  --bg: #f4f6fa;
  --ink: #0f1b2d;
  --muted: #5b6b82;
  --line: #d5dce8;
  --brand: #1652f0;
  --brand-dark: #0b1e3f;
  --brand-soft: #eaf0fe;
  --brand-2: #f5a524;
  --accent: #14b8a6;
  --paper: #ffffff;
  --danger: #9d2f2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35;
}

.app-header {
  align-items: center;
  background: linear-gradient(135deg, var(--brand-dark) 0%, #13306a 100%);
  border-bottom: 3px solid var(--accent);
  color: white;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
}

.app-brand {
  align-items: center;
  display: flex;
  gap: clamp(14px, 2.5vw, 24px);
  min-width: 0;
}

.app-brand img {
  display: block;
  flex: 0 0 auto;
  height: 56px;
  object-fit: contain;
  width: auto;
  max-width: min(46vw, 230px);
}

.header-copy {
  min-width: 0;
}

.app-header h1 {
  font-size: clamp(22px, 3vw, 34px);
  margin: 0;
}

.app-header p {
  margin: 4px 0 0;
}

.eyebrow {
  color: var(--brand-2);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  min-width: 142px;
  padding: 10px 12px;
  text-align: center;
}

.header-action {
  margin: 0;
}

.header-stack {
  align-items: flex-end;
  display: grid;
  gap: 8px;
}

.header-action button.secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

main {
  margin: 0 auto;
  max-width: 1120px;
  padding: 18px;
}

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

.toolbar-hint { flex-basis: 100%; margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.toolbar { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.pending-panel { background: var(--brand-soft); border-radius: 16px; padding: 20px; }
.pending-item { background: var(--paper); }
.record-state { justify-self: start; border-radius: 20px; padding: 5px 10px; }
.pending-item .confirmed { background: #e7f5ed; color: #195d3b; }
.pending-item .pending { background: #fff5d8; color: #705000; }
.record-print { grid-column: 1 / -1; justify-self: start; margin-top: 8px; }
button:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; }
#printPreview { width: min(100% - 24px, 560px); max-height: 94dvh; border: 0; border-radius: 16px; padding: 24px; color: var(--ink); }
#printPreview::backdrop { background: rgba(16, 27, 49, .65); }
.preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.preview-toolbar > div { flex: 1 1 320px; }
.preview-toolbar h2 { margin-bottom: 6px; }
.preview-toolbar p { margin: 0; color: var(--muted); font-size: 14px; }
.pdf-summary { display: grid; gap: 4px; margin-bottom: 18px; overflow-wrap: anywhere; color: var(--muted); font-size: 14px; }
.pdf-summary:empty { display: none; }
.pdf-summary strong { color: var(--ink); }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.sync-badge {
  align-items: center;
  background: #edf6f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 12px;
}

.sync-badge.warning {
  background: #fff7df;
  border-color: #e4c873;
  color: #6f5100;
}

.pending-panel {
  border: 1px solid var(--line);
  margin-bottom: 18px;
  padding: 20px;
}

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

.pending-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.pending-item strong,
.pending-item span {
  overflow-wrap: anywhere;
}

.pending-item span {
  color: var(--muted);
  font-size: 13px;
}

.pending-item time {
  color: var(--muted);
  font-size: 12px;
  grid-column: 2;
  grid-row: auto;
}

button,
.button-link {
  align-items: center;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
  padding: 11px 16px;
  text-decoration: none;
}

button.secondary,
.button-link.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.small {
  min-height: 36px;
  padding: 8px 12px;
}

button:disabled,
.is-busy {
  cursor: wait;
  opacity: 0.65;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: clamp(14px, 3vw, 22px);
}

h2 {
  font-size: 20px;
  margin: 0 0 14px;
}

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

.section-title h2 {
  margin: 0;
}

.section-title span,
.hint {
  color: var(--muted);
  font-size: 14px;
}

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

.wide {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 10px 11px;
  width: 100%;
}

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

.signature-field {
  display: grid;
  gap: 6px;
}

.signature-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.signature-pad {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  height: 140px;
  touch-action: none;
  width: 100%;
}

.signature-field .clear-signature {
  justify-self: start;
}

.risk-group {
  border-top: 3px solid var(--brand);
  margin-top: 16px;
  padding-top: 12px;
}

.risk-group:first-child {
  margin-top: 0;
}

.risk-group h3 {
  font-size: 17px;
  margin: 0 0 10px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
  padding: 12px;
}

.question-main {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.question-text {
  font-weight: 700;
}

.choices {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 64px);
}

.choices label {
  color: var(--ink);
  font-size: 12px;
  text-align: center;
}

.choices input {
  accent-color: var(--brand);
  min-height: 20px;
}

.controls-list {
  color: var(--ink);
  margin: 10px 0 0;
  padding-left: 18px;
}

.other-field {
  margin-top: 10px;
}

.worker {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 12px;
}

.worker-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.worker-head strong {
  color: var(--brand);
}

.auth-page {
  background:
    radial-gradient(circle at top left, rgba(22, 82, 240, 0.10), transparent 36%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.10), transparent 32%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.auth-card {
  border-top: 4px solid var(--brand-dark);
  box-shadow: 0 18px 50px rgba(11, 30, 63, 0.12);
  max-width: 420px;
  padding-top: 24px;
  width: min(100%, 420px);
}

.auth-brand {
  border-bottom: 1px solid var(--line);
  margin: 0 0 20px;
  padding: 0 0 18px;
}

.auth-brand img {
  display: block;
  height: 64px;
  margin: 0 auto;
  object-fit: contain;
  width: min(100%, 260px);
}

.auth-brand p {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
  text-align: center;
}

.auth-card h1 {
  font-size: 28px;
  margin: 0 0 18px;
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.form-error {
  background: #fff0f0;
  border: 1px solid #e2b7b7;
  border-radius: 8px;
  color: var(--danger);
  padding: 10px 12px;
}

.filter-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) minmax(120px, 0.7fr) auto;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-actions button,
.filter-actions .button-link {
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

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

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.apr-date { white-space: nowrap; }
.data-table .button-link { min-width: 130px; }
.header-stack[hidden] { display: none; }

.empty-state {
  color: var(--muted);
  padding: 22px 10px;
  text-align: center;
}

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

.checks label {
  align-items: center;
  color: var(--ink);
  display: flex;
  flex-direction: row;
  font-weight: 400;
}

.checks input {
  margin-right: 8px;
  min-height: auto;
  width: auto;
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-brand img {
    height: 44px;
    max-width: 190px;
  }

  .grid,
  .question-main,
  .checks,
  .filter-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-actions button,
  .filter-actions .button-link {
    justify-content: center;
  }

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

  .pending-item {
    grid-template-columns: 1fr;
  }

  .pending-panel .section-title { align-items: flex-start; flex-direction: column; gap: 6px; }

  .pending-item time {
    grid-column: 1;
    grid-row: auto;
  }

  #printPreview { padding: 14px; }
  .pdf-actions button { flex: 1 1 auto; justify-content: center; }
  .toolbar button { flex: 1 1 auto; justify-content: center; }
}

@media print {
  @page {
    margin: 10mm;
    size: A4 portrait;
  }

  body {
    background: white;
    font-size: 11px;
  }

  .no-print,
  .toolbar,
  .status {
    display: none !important;
  }

  .app-header {
    background: white;
    border-bottom: 2px solid #000;
    color: #000;
    padding: 0 0 8px;
  }

  .app-brand img {
    display: none;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .panel,
  .question-card,
  .worker {
    break-inside: avoid;
    border-color: #555;
    margin-bottom: 8px;
    padding: 8px;
  }

  input,
  textarea,
  .signature-pad {
    border-color: #777;
    min-height: 26px;
    padding: 4px;
  }

  .signature-pad {
    height: 72px;
    padding: 0;
  }

  .choices {
    grid-template-columns: repeat(3, 42px);
  }
}

/* Portal administrativo, isolado do formulário e da impressão. */
.portal-body { background: var(--bg); color: var(--ink); }
.portal-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.portal-sidebar { background: var(--brand-dark); padding: 30px 20px; display: flex; flex-direction: column; color: white; }
.portal-brand { padding: 6px 8px 22px; border-bottom: 1px solid #ffffff1f; display: block; }
.portal-brand img { width: 100%; height: 52px; object-fit: contain; object-position: left center; }
.portal-nav-label { font-size: 10px; letter-spacing: 1.8px; color: #aabbd9; margin: 42px 14px 16px; }
.portal-nav { display: grid; gap: 10px; }
.portal-nav a { display: flex; align-items: center; gap: 14px; color: #cdd8ed; padding: 14px 18px; border-radius: 10px; text-decoration: none; font-weight: 600; transition: background .18s, color .18s; }
.portal-nav a > span:first-child { font-size: 25px; line-height: 1; width: 24px; text-align: center; }
.portal-nav a:hover { background: #17305f; color: white; }
.portal-nav a[aria-current] { background: #fff; color: var(--brand-dark); box-shadow: inset 4px 0 var(--accent); }
.portal-sidebar-footer { margin-top: auto; padding: 50px 14px 4px; font-size: 12px; letter-spacing: 1px; }
.portal-sidebar-footer span { display: block; margin-top: 10px; font-size: 11px; letter-spacing: 0; color: #aabbd9; }
.portal-workspace { min-width: 0; }
.portal-topbar { background: white; border-bottom: 1px solid #e1e6ef; min-height: 94px; padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-overline { font-size: 11px; font-weight: 750; letter-spacing: 1.6px; color: #65748b; }
.portal-topbar p { margin: 6px 0 0; font-weight: 650; }
.portal-user { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.portal-content { max-width: 1440px; padding: 38px 40px; margin: 0 auto; }
.portal-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(115deg, var(--brand-dark), #16408f); border-radius: 22px; padding: 44px; color: white; overflow: hidden; }
.portal-welcome .portal-overline { color: var(--brand-2); }
.portal-welcome h1 { font-size: clamp(26px, 2.6vw, 40px); line-height: 1.2; letter-spacing: -.8px; margin: 20px 0; }
.portal-welcome-copy > p:last-of-type { color: #d4dff3; line-height: 1.6; }
.portal-art { position: relative; width: 220px; height: 230px; flex-shrink: 0; display: grid; place-items: center; }
.portal-art-sheet { width: 140px; height: 176px; padding: 22px; border-radius: 12px; background: #f5f8ff; color: #264578; transform: rotate(9deg); box-shadow: 18px 20px 0 #ffffff15; z-index: 1; }
.portal-art-sheet > span { font-size: 24px; font-weight: 800; }
.portal-art-sheet i { display: block; height: 5px; margin-top: 13px; border-radius: 5px; background: #d2dcee; }
.portal-art-sheet b { position: absolute; bottom: -14px; right: -18px; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-2); font-size: 30px; }
.portal-art-orbit { position: absolute; width: 218px; height: 218px; border: 1px solid #ffffff25; border-radius: 50%; }
.portal-card-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; background: #edf2fb; color: #244b88; border-radius: 13px; font-size: 30px; }
.portal-badge { font-size: 11px; padding: 6px 10px; border-radius: 20px; background: #e9f6f0; color: #277157; }
.portal-badge.muted { background: #f2f3f6; color: #707b8e; }
.portal-page-heading { margin-bottom: 28px; }
.portal-page-heading h1 { font-size: clamp(25px, 3vw, 34px); margin: 10px 0; }
.portal-page-heading > p:last-child { color: #637187; line-height: 1.6; }
.portal-reserved { padding: 60px 24px; text-align: center; background: white; border: 1px solid #e0e6ef; border-radius: 18px; }
.portal-reserved > .portal-card-icon { display: grid; margin: 0 auto 18px; }
.portal-reserved h2 { margin-top: 28px; }
.portal-reserved p { color: #637187; margin-bottom: 28px; }
.portal-body a:focus-visible, .portal-body button:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 4px; }
.portal-skip { position: absolute; left: 12px; top: -100px; background: white; padding: 12px; z-index: 10; }
.portal-skip:focus { top: 12px; }
@media (max-width: 1000px) { .portal-shell { grid-template-columns: 210px minmax(0,1fr); } .portal-content { padding: 26px; } .portal-topbar { padding: 20px 26px; } .portal-welcome { padding: 30px; } .portal-art { display: none; } }
@media (max-width: 720px) { .portal-shell { display: block; } .portal-sidebar { padding: 16px; } .portal-brand { padding: 0 0 12px; width: 170px; } .portal-brand img { height: 40px; } .portal-nav-label, .portal-sidebar-footer { display: none; } .portal-nav { grid-template-columns: repeat(3,1fr); margin-top: 16px; gap: 6px; } .portal-nav a { justify-content: center; padding: 10px 6px; gap: 6px; font-size: 13px; } .portal-topbar { padding: 16px; } .portal-user > span { display: none; } .portal-content { padding: 20px 16px; } .portal-welcome { padding: 26px; } }
@media (prefers-reduced-motion: reduce) { .portal-nav a { transition: none; } }
