:root {
  --background: oklch(0.975 0.005 240);
  --foreground: oklch(0.22 0.04 260);
  --primary: oklch(0.24 0.05 260);
  --muted: oklch(0.955 0.008 240);
  --muted-foreground: oklch(0.5 0.02 258);
  --border: oklch(0.91 0.008 250);
  --sidebar: oklch(0.22 0.05 260);
  --sidebar-accent: oklch(0.28 0.06 260);
  --sidebar-border: oklch(0.3 0.05 260);
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  color: var(--foreground);
  background: var(--background);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }

button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--primary);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover { background: #2d4265; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #aabbd6;
  outline-offset: 2px;
}
.secondary {
  background: white;
  color: var(--foreground);
  border-color: var(--border);
}
.secondary:hover { background: var(--muted); }
.danger {
  color: #b93838;
  background: #fff5f5;
  border-color: #f2dcdc;
}
.danger:hover { background: #ffeaea; }

h1, h2, p { margin-top: 0; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.5px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.2px; margin-bottom: 18px; }
p { color: var(--muted-foreground); line-height: 1.65; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 20px; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.6;
}
input::placeholder, textarea::placeholder { color: #8c96a5; }
textarea { min-height: 115px; resize: vertical; }

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  padding: 0;
  background: var(--sidebar);
  color: #e8edf5;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
aside .brand {
  height: 100px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--sidebar-border);
}
aside .brand-logo {
  width: 80px;
  height: 50px;
  object-fit: contain;
}
aside .app-name { display: none; }
nav { padding: 22px 14px; display: grid; gap: 6px; }
nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #b9c6d8;
  font-size: 13px;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 7px;
}
nav button:hover { background: var(--sidebar-accent); color: white; }
nav button.active {
  color: white;
  background: var(--sidebar-accent);
  border-color: #ffffff0d;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.account {
  margin-top: auto;
  padding: 22px;
  border-top: 1px solid var(--sidebar-border);
  display: grid;
  gap: 5px;
}
.account strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.account span { font-size: 11px; color: #97abc4; }
.account button {
  margin-top: 14px;
  background: transparent;
  border-color: var(--sidebar-border);
  color: #c9d5e6;
}
.account button:hover { background: var(--sidebar-accent); }

main { margin-left: 240px; padding: 0; min-height: 100vh; }
main > header {
  height: 84px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
}
header h1 { font-size: 20px; margin: 0; }
.eyebrow { display: none; }
.company {
  font-size: 12px;
  color: var(--muted-foreground);
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
#content { max-width: 1440px; margin: 0 auto; padding: 30px 32px 60px; }
.toolbar, .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.toolbar {
  background: white;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 10px;
}
.toolbar input { margin: 0; flex: 1; min-width: 180px; }
.actions .badge { margin-right: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}
.card, .form-card, .step, .stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px #14243b04;
}
.card {
  padding: 24px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card:hover { border-color: #bbc8d9; }
.card h2 { font-size: 17px; margin: 0; overflow-wrap: anywhere; }
.card p { margin: 0; font-size: 12px; }
.card button {
  margin-top: auto;
  align-self: flex-start;
  background: var(--muted);
  color: var(--primary);
}
.card button:hover { background: #e6edf6; }
.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 500;
  background: #f0f3f8;
  color: #53657f;
  white-space: nowrap;
}
.badge.published { background: #eaf6ef; color: #32815b; }
.empty {
  grid-column: 1 / -1;
  padding: 65px 25px;
  text-align: center;
  border: 1px dashed #c7d1de;
  border-radius: 10px;
  background: white;
  color: var(--muted-foreground);
}

.dashboard-welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}
.dashboard-welcome h2 { font-size: 24px; margin: 0 0 7px; }
.dashboard-welcome p { font-size: 13px; margin: 0; max-width: 620px; }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat { padding: 22px 24px; position: relative; display: grid; gap: 8px; }
.stat::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 24px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #6484b0;
}
.stat:nth-child(2)::after { background: #50a47b; }
.stat:nth-child(3)::after { background: #d0a253; }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted-foreground); }
.stat strong { font-size: 30px; font-weight: 600; letter-spacing: -.8px; }
.stat small { font-size: 12px; color: var(--muted-foreground); }
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.dashboard-heading h2 { margin: 0; }
.dashboard-heading button { font-size: 12px; min-height: 34px; }
.dashboard-list { display: grid; }
.dashboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
  width: 100%;
  padding: 19px 0;
  background: white;
  color: var(--foreground);
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.dashboard-row:last-child { border-bottom: 0; }
.dashboard-row:hover { background: #f8fafc; }
.dashboard-row strong { display: block; font-size: 14px; font-weight: 500; }
.dashboard-row small { display: block; font-size: 12px; font-weight: 400; color: var(--muted-foreground); margin-top: 5px; }

.form-card { padding: 26px; margin-bottom: 24px; }
.fields { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.form-card .actions { margin-bottom: 0; }
.step { padding: 26px; margin-bottom: 20px; position: relative; }
.step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 24px;
}
.step-top h2 { font-size: 16px; margin: 0; }
.step-tools { display: flex; gap: 7px; }
.step-tools button { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.photo {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--background);
  margin: 20px 0;
}
.upload {
  border: 1px dashed #bcc9da;
  border-radius: 8px;
  padding: 18px;
  background: #fafbfd;
  color: #53657f;
  font-size: 12px;
}
.upload input { background: transparent; border: 0; padding: 4px 0 0; font-size: 12px; }
.upload input::file-selector-button {
  font: inherit;
  border: 1px solid var(--border);
  background: white;
  color: var(--primary);
  border-radius: 5px;
  padding: 7px 12px;
  margin-right: 12px;
  cursor: pointer;
}
.instruction { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.8; }
.attention {
  white-space: pre-wrap;
  background: #fff9ec;
  border: 1px solid #efdfb5;
  border-radius: 7px;
  padding: 18px;
  margin-top: 20px;
  color: #806529;
}
#addStep { width: 100%; border: 1px dashed #bbc8d9; color: var(--primary); background: transparent; padding: 16px; }
#addStep:hover { background: #eaf0f7; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.login-card {
  width: 100%;
  max-width: 410px;
  background: white;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 35px #14243b08;
}
.login-card .brand { display: flex; justify-content: center; margin-bottom: 24px; }
.login-card .brand-logo { width: 120px; height: 80px; object-fit: contain; }
.login-card h1 { font-size: 20px; text-align: center; }
.login-card p { font-size: 13px; text-align: center; margin-bottom: 28px; }
.login-card button { width: 100%; }

#message {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: min(430px, calc(100vw - 32px));
  background: white;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 8px 28px #14243b18;
  padding: 16px 20px;
  z-index: 80;
}

@media(min-width:1200px) {
  #steps { max-width: 960px; margin: 0 auto; }
}
@media(max-width:800px) {
  aside { position: static; width: auto; }
  aside .brand { height: 76px; min-height: 76px; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px; gap: 6px; }
  nav button { justify-content: center; padding: 10px 6px; font-size: 11px; gap: 6px; }
  .account { padding: 12px 18px; grid-template-columns: 1fr auto; align-items: center; }
  .account span { display: none; }
  .account button { margin: 0; min-height: 32px; }
  main { margin-left: 0; }
  main > header { height: 70px; padding: 0 20px; }
  .company { display: none; }
  #content { padding: 24px 18px 45px; }
  .dashboard-welcome { align-items: flex-start; flex-direction: column; }
  .dashboard-welcome h2 { font-size: 22px; }
  .fields { grid-template-columns: 1fr; gap: 0; }
  .form-card, .step { padding: 20px; }
  .step-top { flex-wrap: wrap; }
  .dashboard-row { gap: 10px; }
  .dashboard-row .badge { font-size: 10px; }
  .actions .badge { margin-right: 0; }
}
@media(prefers-reduced-motion:reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

.card.sop-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  gap: 0;
  min-height: 285px;
  border: 1px solid #dce4ee;
  border-radius: 14px;
  box-shadow: 0 3px 12px #172b4405;
  transition: border-color .18s, box-shadow .18s;
}
.card.sop-card:hover {
  border-color: #9aafc9;
  box-shadow: 0 8px 24px #172b4410;
}
.sop-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.sop-card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #edf2f8;
  color: #365779;
  border: 1px solid #e1e8f1;
  border-radius: 12px;
}
.sop-card-icon svg { width: 23px; height: 23px; }
.sop-card-top .badge {
  align-self: center;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 10px;
}
.sop-card-top .badge::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 6px;
}
.sop-card-category {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #748397;
  margin-bottom: 8px;
}
.card.sop-card h2 {
  font-size: 19px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -.35px;
  color: #203247;
  margin: 0;
}
.sop-card-body { margin-bottom: 22px; }
.sop-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: #748397;
  margin-top: auto;
  padding-bottom: 17px;
  border-bottom: 1px solid #edf0f4;
}
.card.sop-card .sop-card-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 16px;
  padding: 11px 14px;
  background: #edf2f8;
  color: #365779;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.card.sop-card .sop-card-open:hover {
  background: #365779;
  color: white;
}
.sop-card-open svg { width: 17px; height: 17px; }

.pdf-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 7px;
  font-weight: 500;
}
.public-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.public-header img { width: 100px; height: 60px; object-fit: contain; }
.public-header span { font-size: 12px; color: var(--muted-foreground); }
main.public-main {
  margin: 0 auto;
  padding: 30px 20px;
  max-width: 1000px;
}
#shareBox input { margin-bottom: 18px; }

.catalog-page { min-height: 100vh; display: flex; flex-direction: column; }
.catalog-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 42px 24px 60px; flex: 1; }
.catalog-intro { margin-bottom: 30px; }
.catalog-kicker { font-size: 10px; letter-spacing: 1.5px; font-weight: 600; color: #748397; }
.catalog-intro h1 { margin: 10px 0; font-size: 30px; }
.catalog-intro p { max-width: 680px; margin: 0; }
.catalog-main .toolbar select { width: 220px; margin: 0; }
#catalogCount { font-size: 12px; margin-bottom: 18px; }
.catalog-open {
  display: flex; align-items: center; justify-content: space-between;
  background: #edf2f8; color: #365779; text-decoration: none;
  padding: 11px 14px; border-radius: 8px; margin-top: 16px;
  font-size: 12px; font-weight: 600;
}
.catalog-open:hover { background: #365779; color: white; }
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 22px 28px; background: white;
  border-top: 1px solid var(--border); color: #748397; font-size: 12px;
}
.site-footer a { color: #365779; text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.users-table-wrap { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th { text-align: left; color: #748397; font-weight: 500; background: #f7f9fb; }
.users-table th, .users-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
@media(max-width:800px) {
  .catalog-intro h1 { font-size: 25px; }
  .catalog-main .toolbar select { width: 100%; }
  .site-footer { flex-wrap: wrap; }
}

.catalog-page { min-height: 100vh; display: flex; flex-direction: column; }
.catalog-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 42px 24px 60px; flex: 1; }
.catalog-intro { margin-bottom: 30px; }
.catalog-kicker { font-size: 10px; letter-spacing: 1.5px; font-weight: 600; color: #748397; }
.catalog-intro h1 { margin: 10px 0; font-size: 30px; }
.catalog-intro p { max-width: 680px; margin: 0; }
.catalog-main .toolbar select { width: 220px; margin: 0; }
#catalogCount { font-size: 12px; margin-bottom: 18px; }
.catalog-open {
  display: flex; align-items: center; justify-content: space-between;
  background: #edf2f8; color: #365779; text-decoration: none;
  padding: 11px 14px; border-radius: 8px; margin-top: 16px;
  font-size: 12px; font-weight: 600;
}
.catalog-open:hover { background: #365779; color: white; }
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 22px 28px; background: white;
  border-top: 1px solid var(--border); color: #748397; font-size: 12px;
}
.site-footer a { color: #365779; text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.users-table-wrap { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th { text-align: left; color: #748397; font-weight: 500; background: #f7f9fb; }
.users-table th, .users-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
@media(max-width:800px) {
  .catalog-intro h1 { font-size: 25px; }
  .catalog-main .toolbar select { width: 100%; }
  .site-footer { flex-wrap: wrap; }
}

/* Cards com capa — biblioteca pública e painel */
.card.sop-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  min-height: 410px;
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 5px 18px rgba(25, 45, 70, .05);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card.sop-card:hover {
  transform: translateY(-4px);
  border-color: #b5c6d9;
  box-shadow: 0 16px 34px rgba(25, 45, 70, .12);
}
.sop-card .sop-card-top { display: none; }
.sop-cover {
  position: relative;
  height: 190px;
  flex-shrink: 0;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, #163653, #426d91);
}
.sop-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 26, 43, .08), rgba(9, 26, 43, .4));
  z-index: 1;
  pointer-events: none;
}
.sop-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.sop-card:hover .sop-cover img { transform: scale(1.04); }
.sop-cover-label {
  position: absolute;
  left: 22px;
  bottom: 20px;
  z-index: 2;
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.sop-cover > svg {
  position: absolute;
  width: 95px;
  height: 95px;
  right: 30px;
  top: 35px;
  color: rgba(255, 255, 255, .2);
  transform: rotate(-10deg);
}
.sop-cover:not(.sop-cover-fallback) > svg { display: none; }
.sop-cover .badge {
  position: absolute;
  z-index: 2;
  right: 16px;
  top: 16px;
  padding: 7px 11px;
  border-radius: 30px;
  font-size: 10px;
  background: #fff;
  color: #496078;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.sop-cover .badge.published {
  background: #effbf6;
  color: #187752;
}
.sop-card .sop-card-body {
  padding: 22px 22px 0;
  margin-bottom: 18px;
}
.sop-card .sop-card-category {
  color: #527598;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  margin-bottom: 9px;
}
.card.sop-card h2 {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: #17334d;
  letter-spacing: -.5px;
  overflow-wrap: anywhere;
}
.sop-card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: #6b7c8e;
  overflow-wrap: anywhere;
}
.sop-card .sop-card-meta {
  margin: auto 22px 0;
  padding: 0 0 16px;
  font-size: 12px;
}
.card.sop-card .sop-card-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 44px);
  margin: 16px 22px 22px;
  padding: 13px 16px;
  border: 0;
  border-radius: 10px;
  background: #173b5b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.card.sop-card .sop-card-open:hover { background: #245477; }
.sop-card-open:focus-visible {
  outline: 3px solid #79a8cf;
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .card.sop-card, .sop-cover img { transition: none; }
  .card.sop-card:hover, .sop-card:hover .sop-cover img { transform: none; }
}
