/* ============================================================
   Access Editora — Lex Lit CSS v3.0
   Paleta: Azul-escuro #0f2540 → Grená #6b1420
   Degradê aplicado em todo o sistema
   ============================================================ */

:root {
  --blue:       #0f2540;
  --blue-mid:   #1e3a5f;
  --blue-light: #2a4d7f;
  --grena:      #6b1420;
  --grena-mid:  #8b1a2b;
  --grena-light:#a52435;
  --grad-v:     linear-gradient(180deg, #0f2540 0%, #6b1420 100%);
  --grad-d:     linear-gradient(135deg, #0f2540 0%, #6b1420 100%);
  --grad-h:     linear-gradient(90deg,  #0f2540 0%, #6b1420 100%);
  --grad-btn:   linear-gradient(135deg, #1e3a5f 0%, #7b1921 100%);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.10);
  --shadow-md:  0 4px 16px rgba(0,0,0,.15);
  --radius:     .75rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #1f2937;
  min-height: 100vh;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR — degradê azul → grená
   ============================================================ */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--grad-v);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
  overflow-y: auto;
  box-shadow: 3px 0 20px rgba(0,0,0,.25);
}

.sidebar-brand {
  padding: 1.5rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  text-align: center;
  background: rgba(0,0,0,.15);
}
.sidebar-brand a { display: block; }
.sidebar-brand img {
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto .4rem;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.22));
}
.sidebar-subtitle {
  display: block;
  font-size: .6rem;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: .25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .68rem 1.2rem;
  color: rgba(255,255,255,.68);
  text-decoration: none;
  font-size: .86rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
}
.sidebar-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-left-color: rgba(255,255,255,.3);
}
.sidebar-link.active {
  background: rgba(255,255,255,.13);
  color: #fff;
  border-left-color: #c9a84c;
  font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 2px;
  background: rgba(255,255,255,.15);
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: .6rem 1.2rem;
}
.sidebar-group-label {
  font-size: .62rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .35rem 1.2rem .15rem;
}

.sidebar-footer {
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.15);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .75rem;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-h);
  border: 2px solid rgba(255,255,255,.25);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name {
  font-size: .82rem; color: #fff; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: .68rem; color: rgba(255,255,255,.45); }

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .8rem;
  padding: .4rem .5rem;
  border-radius: .375rem;
  transition: background .15s, color .15s;
  width: 100%;
}
.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Hamburguer mobile */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: .9rem; left: .9rem;
  z-index: 300;
  background: var(--blue);
  border: none;
  border-radius: .4rem;
  padding: .45rem .5rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-md);
}
.sidebar-toggle span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 190;
}

/* ============================================================
   CONTEUDO PRINCIPAL
   ============================================================ */
.main-content {
  margin-left: 240px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1120px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ============================================================
   FOOTER — gradiente sutil
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: .72rem;
  margin-left: 240px;
  border-top: 1px solid #e5e7eb;
  background: linear-gradient(90deg, #f8f8f9 0%, #f0f2f5 100%);
  color: #9ca3af;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  border-top: 3px solid transparent;
  border-image: var(--grad-h) 1;
}
.card h1 { font-size: 1.45rem; margin-bottom: .4rem; color: #0f2540; }
.card h2 { font-size: 1.08rem; margin-bottom: .9rem; color: #374151; }
.subtitle { color: #6b7280; font-size: .88rem; margin-bottom: 1.1rem; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .84rem; font-weight: 500; color: #374151; margin-bottom: .28rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: .6rem .9rem;
  border: 1px solid #d1d5db;
  border-radius: .5rem;
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(30,58,95,.12);
}

/* ============================================================
   BOTOES — gradiente azul → grená
   ============================================================ */
.btn {
  display: inline-block;
  padding: .55rem 1.25rem;
  border-radius: .5rem;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s, box-shadow .15s, transform .1s;
  line-height: 1.4;
}
.btn:hover { opacity: .9; box-shadow: 0 3px 10px rgba(0,0,0,.18); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad-btn);
  color: #fff;
}
.btn-success { background: linear-gradient(135deg, #047857 0%, #059669 100%); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%); color: #fff; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: .32rem .75rem; font-size: .78rem; }

/* ============================================================
   ALERTAS
   ============================================================ */
.alert { padding: .8rem 1rem; border-radius: .5rem; margin-bottom: 1rem; font-size: .88rem; border-left: 4px solid; }
.alert-error   { background: #fef2f2; color: #7f1d1d; border-color: #dc2626; }
.alert-success { background: #ecfdf5; color: #064e3b; border-color: #059669; }
.alert-info    { background: #eff6ff; color: #1e3a8a; border-color: #3b82f6; }
.alert-warning { background: #fffbeb; color: #78350f; border-color: #f59e0b; }

/* ============================================================
   TABELAS
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table-wrap { width: 100%; overflow-x: auto; }
th, td { padding: .6rem 1rem; text-align: left; border-bottom: 1px solid #e5e7eb; }
th {
  background: linear-gradient(90deg, #f0f4f8 0%, #f5f0f2 100%);
  font-weight: 600;
  color: #374151;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tr:hover td { background: #fafafa; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block; padding: .14rem .55rem;
  border-radius: 9999px; font-size: .72rem; font-weight: 700;
}
.badge-critical { background: #fee2e2; color: #7f1d1d; }
.badge-high     { background: #fde68a; color: #78350f; }
.badge-medium   { background: #dbeafe; color: #1e3a8a; }
.badge-low      { background: #d1fae5; color: #064e3b; }
.badge-info     { background: #e5e7eb; color: #374151; }
.badge-success  { background: #d1fae5; color: #064e3b; }
.badge-warning  { background: #fef3c7; color: #78350f; }

/* ============================================================
   SCORE BAR
   ============================================================ */
.score-bar { display: flex; align-items: center; gap: .8rem; margin: .5rem 0; }
.score-bar .bar { flex: 1; height: 10px; background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.score-bar .fill { height: 100%; border-radius: 9999px; transition: width .4s; }
.fill-low    { background: linear-gradient(90deg, #059669, #34d399); }
.fill-medium { background: linear-gradient(90deg, #d97706, #fbbf24); }
.fill-high   { background: linear-gradient(90deg, #7b1921, #dc2626); }

/* ============================================================
   FINDINGS
   ============================================================ */
.finding-item { border-left: 4px solid #e5e7eb; padding: .7rem 1rem; margin-bottom: .7rem; border-radius: 0 .5rem .5rem 0; background: #f9fafb; }
.finding-item.critical { border-color: #7b1921; background: #fff5f5; }
.finding-item.high     { border-color: #d97706; }
.finding-item.medium   { border-color: #3b82f6; }
.finding-item.low      { border-color: #059669; }
.finding-item .excerpt { font-family: monospace; font-size: .78rem; color: #6b7280; margin-top: .3rem; background: #fff; padding: .3rem .5rem; border-radius: .25rem; white-space: pre-wrap; word-break: break-all; }

/* ============================================================
   LOGIN — degradê azul escuro → grená
   ============================================================ */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--grad-d);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  top: -150px; left: -150px;
  pointer-events: none;
}
.login-wrap::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
  bottom: -100px; right: -80px;
  pointer-events: none;
}
.login-box {
  background: #fff;
  border-radius: 1.1rem;
  padding: 2.5rem 2.2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-box-wide { max-width: 560px; }
.login-box::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--grad-h);
  border-radius: 1.1rem 1.1rem 0 0;
  position: absolute;
  top: 0; left: 0; right: 0;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img {
  max-width: 200px;
  height: auto;
  margin: 0 auto .6rem;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.18));
}
.login-logo p { font-size: .8rem; color: #6b7280; letter-spacing: .04em; }
.auth-links {
  margin-top: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  align-items: center;
}
.auth-links a {
  color: var(--blue-mid);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
}
.auth-links a:hover { color: var(--grena); text-decoration: underline; }

/* ============================================================
   GRIDS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.approval-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.approval-stat {
  background: linear-gradient(135deg, #f8fafc 0%, #fdf2f8 100%);
  border: 1px solid #e5e7eb;
  border-radius: .8rem;
  padding: 1rem;
  text-align: center;
}
.approval-stat strong {
  display: block;
  font-size: 1.6rem;
  color: #0f2540;
}
.approval-stat span {
  display: block;
  margin-top: .25rem;
  font-size: .8rem;
  color: #6b7280;
}
.approval-actions {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-width: 260px;
}
.inline-form {
  display: flex;
  gap: .45rem;
  align-items: center;
}
.approval-reject-form { flex-wrap: wrap; }
.input-inline {
  flex: 1 1 150px;
  min-width: 150px;
  padding: .42rem .65rem;
  border: 1px solid #d1d5db;
  border-radius: .45rem;
  font-size: .82rem;
}
.empty-state {
  padding: 1rem 1.1rem;
  border: 1px dashed #d1d5db;
  border-radius: .7rem;
  color: #6b7280;
  background: #f9fafb;
}
.small-text {
  font-size: .77rem;
  margin-top: .3rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-h);
}
.stat-card .number { font-size: 1.9rem; font-weight: 700; background: var(--grad-d); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card .label  { font-size: .75rem; color: #6b7280; margin-top: .2rem; font-weight: 500; }

/* ============================================================
   TABS
   ============================================================ */
.tab-nav {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1rem;
}
.tab-nav a {
  padding: .5rem 1rem;
  text-decoration: none;
  color: #6b7280;
  font-size: .88rem;
  border-radius: .375rem .375rem 0 0;
  transition: color .15s, background .15s;
}
.tab-nav a:hover { color: var(--blue-mid); background: #f3f4f6; }
.tab-nav a.active {
  color: var(--blue-mid);
  border-bottom: 2px solid var(--blue-mid);
  margin-bottom: -2px;
  font-weight: 600;
  background: linear-gradient(180deg, rgba(30,58,95,.04) 0%, transparent 100%);
}

/* ============================================================
   RECOMENDACOES
   ============================================================ */
.rec-aprovado        { color: #064e3b; font-weight: 600; }
.rec-revisar_leve    { color: #78350f; }
.rec-revisar         { color: #d97706; font-weight: 600; }
.rec-revisar_urgente { color: #7b1921; font-weight: 600; }
.rec-nao_publicar    { color: #6b1420; font-weight: 700; }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-board {
  display: flex;
  gap: .85rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-col {
  min-width: 210px;
  flex: 1;
  background: #f8f9fb;
  border-radius: .75rem;
  padding: .8rem;
  border: 1px solid #e5e7eb;
}
.kanban-col.drag-over {
  background: #eef2ff;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 2px rgba(30,58,95,.15);
}
.kanban-col-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .7rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-card {
  background: #fff;
  border-radius: .5rem;
  padding: .75rem;
  margin-bottom: .45rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  font-size: .84rem;
  cursor: grab;
  border-left: 3px solid var(--blue-mid);
  transition: box-shadow .15s, transform .1s;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-1px); }
.kanban-card.dragging { opacity: .6; transform: rotate(1deg); }
.kanban-empty { text-align: center; font-size: .78rem; color: #9ca3af; padding: 1rem .5rem; }

/* ============================================================
   MANUSCRITOS — ms-card
   ============================================================ */
.ms-list { display: flex; flex-direction: column; gap: .7rem; }
.ms-card {
  border: 1px solid #e5e7eb;
  border-radius: .6rem;
  padding: .85rem 1rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  border-left: 4px solid var(--blue-mid);
  transition: box-shadow .15s;
}
.ms-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.09); }
.ms-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ms-title { font-weight: 600; font-size: .92rem; color: #111827; }
.ms-author { font-size: .78rem; color: #6b7280; margin-top: .1rem; }
.ms-card-meta { margin-bottom: .5rem; }
.ms-file-info { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; font-size: .76rem; padding: .3rem .6rem; border-radius: .35rem; }
.ms-file-ok  { background: #ecfdf5; color: #064e3b; }
.ms-file-error { background: #fef2f2; color: #7f1d1d; }
.ms-card-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.ms-original-name { font-style: italic; color: #6b7280; }

/* Upload area */
.upload-area {
  border: 2px dashed #c4b5c8;
  border-radius: .6rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: linear-gradient(135deg, #f8f9ff 0%, #fdf5f5 100%);
}
.upload-area:hover { border-color: var(--blue-mid); background: linear-gradient(135deg, #eff6ff 0%, #fff1f2 100%); }
.upload-icon { font-size: 2.2rem; margin-bottom: .4rem; }
.upload-text { font-weight: 600; color: var(--blue-mid); font-size: .92rem; }
.upload-sub  { font-size: .76rem; color: #9ca3af; margin-top: .2rem; }

/* ============================================================
   HISTORY TAB
   ============================================================ */
.history-item {
  display: flex;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: flex-start;
  font-size: .84rem;
}
.history-item:last-child { border-bottom: none; }
.history-badge {
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   PAGE HEADER — degradê para titulos de secao
   ============================================================ */
.page-header {
  background: var(--grad-d);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { color: #fff; font-size: 1.5rem; }
.page-header .subtitle { color: rgba(255,255,255,.75); }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show,
  .sidebar.open ~ .sidebar-overlay { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; padding-top: 3.5rem; }
  .app-footer { margin-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; }
  .kanban-col { min-width: unset; }
  .approval-actions { min-width: 0; }
  .inline-form { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
  .container { padding: 0 .85rem; margin: 1.2rem auto; }
  .card { padding: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-box { padding: 1.8rem 1.2rem; }
  .ms-card-actions { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   SCROLLBAR personalizada — degradê
   ============================================================ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--blue-mid), var(--grena)); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--blue), var(--grena-mid)); }

/* ============================================================
   SIDEBAR SCROLLBAR — mais sutil
   ============================================================ */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 999px; }
