@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #FAFAFA;
  --surface:   #FFFFFF;
  --border:    #E0E0E0;
  --text:      #1A1A1A;
  --muted:     #757575;
  --placeholder: #BDBDBD;
  --btn:       #2C3E50;
  --btn-hover: #1A252F;
  --btn-active:#0D1520;
  --danger:    #C0392B;
  --warning:   #E67E22;
  --info:      #2980B9;
  --success:   #27AE60;
  --neutral:   #7F8C8D;
  --radius:    4px;
  --shadow:    0 1px 4px rgba(0,0,0,0.06);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Tipografia ───────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 600; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 500; }
p  { font-size: 1rem; color: var(--muted); }

/* ── Layout ───────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: 560px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Header ───────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header__logo { height: 96px; width: auto; object-fit: contain; display: block; border-radius: 12px; }
.header a { text-decoration: none; }
.header__logo-placeholder {
  height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--btn);
  letter-spacing: -0.5px;
}

/* ── Botoes ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  font-size: .875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  text-decoration: none;
}
.btn--primary {
  background: var(--btn);
  color: #fff;
}
.btn--primary:hover  { background: var(--btn-hover); }
.btn--primary:active { background: var(--btn-active); }
.btn--primary:disabled { background: var(--placeholder); cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  color: var(--btn);
  border: 1.5px solid var(--btn);
}
.btn--ghost:hover { background: rgba(44,62,80,.05); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #a93226; }

.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: .5rem 1rem; font-size: .8125rem; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ── Formulario ───────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .375rem;
}
.form-group label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s;
  outline: none;
}
.form-control:focus  { border-color: var(--btn); }
.form-control.error  { border-color: var(--danger); }
.form-control::placeholder { color: var(--placeholder); }

textarea.form-control { resize: vertical; min-height: 140px; }
select.form-control   { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23757575' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }

.form-error { font-size: .8125rem; color: var(--danger); margin-top: .25rem; display: none; }
.form-error.visible { display: block; }

.form-hint { font-size: .8125rem; color: var(--muted); margin-top: .25rem; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  margin-bottom: 1rem;
}
.checkbox-group input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--btn); flex-shrink: 0; }

/* ── Upload ───────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
}
.upload-area:hover { border-color: var(--btn); }
.upload-area input { display: none; }
.upload-area p { font-size: .875rem; margin-top: .5rem; }

/* ── Badges de gravidade e status ─────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .625rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge--critica   { background: #fdecea; color: var(--danger); }
.badge--alta      { background: #fef3e7; color: var(--warning); }
.badge--media     { background: #e8f4fd; color: var(--info); }
.badge--baixa     { background: #e9f7ef; color: var(--success); }
.badge--pendente  { background: #f5f5f5; color: var(--muted); }
.badge--novo      { background: #e8f4fd; color: var(--info); }
.badge--em_analise{ background: #fef3e7; color: var(--warning); }
.badge--concluido { background: #e9f7ef; color: var(--success); }
.badge--arquivado { background: #f5f5f5; color: var(--neutral); }

/* ── Stats cards (dashboard) ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card__value { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-card__label { font-size: .8125rem; color: var(--muted); margin-top: .25rem; }

/* ── Tabela ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: .8125rem; font-weight: 600; color: var(--muted); text-align: left; padding: .75rem 1rem; border-bottom: 2px solid var(--border); }
td { font-size: .875rem; padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,.01); }

/* ── Hero (home) ──────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a252f;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background: url('/images/hero-compliance.webp') center/cover no-repeat;
  transform: scale(1.02);
}
.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(26, 37, 47, 0.82) 0%,
    rgba(26, 37, 47, 0.65) 50%,
    rgba(26, 37, 47, 0.75) 100%
  );
}
.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 580px;
}
.hero__content h1 { color: #fff; font-size: 2.25rem; line-height: 1.2; text-shadow: 0 2px 12px rgba(0,0,0,.3); }
.hero__content p  { color: rgba(255,255,255,.82); font-size: 1.125rem; margin: 1rem 0 2rem; text-shadow: 0 1px 6px rgba(0,0,0,.25); }

.hero__features {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--muted);
  font-weight: 500;
}
.feature__icon { font-size: 1.5rem; }

/* ── Protocolo box ────────────────────────────────────── */
.protocolo-box {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 2rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--btn);
  margin: 1.5rem 0;
  font-family: monospace;
}

/* ── Sidebar layout (dashboard) ───────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 65px);
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
}
.sidebar__title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: .75rem; padding: 0 .5rem; }
.sidebar__item {
  display: block;
  padding: .625rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .15s;
  margin-bottom: .125rem;
}
.sidebar__item:hover { background: var(--bg); }
.sidebar__item.active { background: var(--bg); font-weight: 600; color: var(--btn); }
.sidebar__divider { height: 1px; background: var(--border); margin: 1rem 0; }

.main-content { padding: 1rem 1.25rem; }

/* ── Historico timeline ───────────────────────────────── */
.timeline { list-style: none; position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-bottom: 1.25rem; }
.timeline__item::before { content: ''; position: absolute; left: -1.19rem; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--btn); border: 2px solid var(--surface); }
.timeline__date { font-size: .75rem; color: var(--muted); }
.timeline__label { font-size: .875rem; font-weight: 500; margin-top: .125rem; }

/* ── Alert ────────────────────────────────────────────── */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert--success { background: #e9f7ef; color: #1e8449; border-left: 4px solid var(--success); }
.alert--error   { background: #fdecea; color: #922b21; border-left: 4px solid var(--danger); }
.alert--info    { background: #e8f4fd; color: #1a5276; border-left: 4px solid var(--info); }

/* ── Loader ───────────────────────────────────────────── */
.loader { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Separador de secao ───────────────────────────────── */
.section { padding: 2.5rem 0; }
.section__title { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--text); }
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── Paginacao ────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-top: 1.5rem; }
.pagination button { padding: .5rem .875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .875rem; cursor: pointer; }
.pagination button.active { background: var(--btn); color: #fff; border-color: var(--btn); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Filtros ──────────────────────────────────────────── */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: flex-end; }
.filters .form-group { margin-bottom: 0; }
.filters select { padding: .5rem .875rem; font-size: .875rem; }

/* ── Responsivo ───────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; }
  .hero__content h1 { font-size: 1.75rem; }
  .hero__features { flex-direction: column; gap: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
