/* Paleta corporativa — única fuente de color de toda la UI */
:root {
  --bg: #FAF8F4;
  --panel: #FFFFFF;
  --panel2: #F3EFE7;
  --line: #DDD6CA;
  --txt: #1A1D24;
  --grey: #5F6672;
  --gold: #0C7D72;
  --green: #1A8A4D;
  --orange: #C46F1E;
  --red: #CF4B3A;

  /* Tintes translúcidos de estado (opacidad subida para fondo claro) */
  --gold-tint: rgba(12, 125, 114, 0.14);
  --green-tint: rgba(26, 138, 77, 0.14);
  --orange-tint: rgba(196, 111, 30, 0.16);
  --red-tint: rgba(207, 75, 58, 0.14);
  --grey-tint: rgba(95, 102, 114, 0.12);
}

* { box-sizing: border-box; }

html, body, #app { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

h1, h2, h3 { color: var(--gold); font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; height: 100%; }

.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  gap: 4px;
}

.sidebar .brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  padding: 6px 12px 18px;
  letter-spacing: 0.3px;
}

.sidebar .nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--grey);
  font-weight: 500;
}
.sidebar .nav-item:hover { background: var(--panel2); text-decoration: none; }
.sidebar .nav-item.active { background: var(--gold-tint); color: var(--gold); }

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ---------- Componentes ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--txt);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--panel2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--panel);
}
.btn.primary:hover { background: #0a6a61; }

.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-tint); }

.btn.small { padding: 4px 10px; font-size: 12px; }

input[type="text"], input[type="number"], select, textarea {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--txt);
  font-size: 13px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold-tint);
  border-color: var(--gold);
}

label { color: var(--grey); font-size: 12px; font-weight: 500; }

/* ---------- Tabla ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
table.data th {
  text-align: left;
  font-size: 12px;
  color: var(--grey);
  font-weight: 600;
  padding: 10px 12px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--panel2); }

/* ---------- Pills de estado ---------- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.pendiente { background: var(--grey-tint); color: var(--grey); }
.pill.procesando { background: var(--gold-tint); color: var(--gold); }
.pill.finished { background: var(--green-tint); color: var(--green); }
.pill.failed { background: var(--red-tint); color: var(--red); }

.muted { color: var(--grey); }
.error-text { color: var(--red); font-size: 12px; }

/* ---------- Zona de subida ---------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  color: var(--grey);
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover {
  border-color: var(--gold);
  background: var(--gold-tint);
  color: var(--gold);
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button {
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--grey);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---------- Visor PDF ---------- */
.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.pdf-scroll {
  flex: 1;
  overflow: auto;
  background: var(--panel2);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.pdf-page {
  position: relative;
  background: var(--panel);
  box-shadow: 0 1px 6px rgba(26, 29, 36, 0.12);
}
.pdf-page canvas { display: block; }
.pdf-page .overlay { position: absolute; inset: 0; }
