@font-face {
  font-family: "Delight";
  src: url("fonts/delight-light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Delight";
  src: url("fonts/delight-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Delight";
  src: url("fonts/delight-semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Delight";
  src: url("fonts/delight-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --verde-lima: #BFE870;
  --verde-hoja: #96D14D;
  --gris-metalico: #E8E8E8;
  --negro-bosque: #1B281B;
  --primary: var(--negro-bosque);
  --primary-light: var(--verde-hoja);
  --bg: var(--gris-metalico);
  --ok: var(--verde-hoja);
  --err: #c62828;
  --pending: #ef6c00;
}
* { box-sizing: border-box; }
body {
  font-family: "Delight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  padding: 0;
  color: #1c1c1c;
  line-height: 1.5;
  transition: background 0.3s;
}
body:not(.app-active) {
  background: var(--negro-bosque);
}

/* Fondo animado de arcos (pantallas de acceso) */
@keyframes arcs-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.arcs {
  position: fixed;
  z-index: -1;
  width: 900px;
  height: 900px;
  pointer-events: none;
  display: none;
}
body:not(.app-active) .arcs {
  display: block;
}
.arcs-top-left { top: -450px; left: -450px; }
.arcs-bottom-right { bottom: -450px; right: -450px; }
.spin {
  position: absolute;
  top: 0;
  left: 0;
  width: 900px;
  height: 900px;
}
.spin-top { animation: arcs-spin 18s linear infinite; }
.spin-bottom { animation: arcs-spin 24s linear infinite reverse; }
.arc {
  position: absolute;
  width: 900px;
  height: 900px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 1.5px solid rgba(191, 232, 112, 0.5);
}
.arc-secondary {
  top: -100px;
  left: 120px;
  border-color: rgba(191, 232, 112, 0.3);
}
header {
  background: var(--negro-bosque);
  color: var(--verde-lima);
  padding: 20px 16px;
  text-align: center;
}
body:not(.app-active) header { display: none; }
header h1 { margin: 0; font-size: 1.3rem; }
.header-row {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-row h1 { flex: 1; text-align: left; }
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}
body:not(.app-active) .container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-title {
  display: none;
  text-align: center;
  color: var(--verde-lima);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0 0 20px;
}
body:not(.app-active) .auth-title { display: block; }
.auth-footer {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 20px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(232, 232, 232, 0.55);
  font-size: 1rem;
  pointer-events: none;
}
body:not(.app-active) .auth-footer { display: flex; }
.auth-footer img {
  height: 32px;
  width: auto;
  display: inline-block;
  opacity: 0.85;
}
.card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 16px;
}
input[readonly] {
  background: var(--gris-metalico);
  color: #555;
  font-weight: 600;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  outline: none;
  border-color: var(--verde-hoja);
  box-shadow: 0 0 0 3px rgba(150, 209, 77, 0.25);
}
.btn-row {
  display: flex;
  gap: 10px;
}
.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--verde-lima);
  background: var(--negro-bosque);
  cursor: pointer;
  text-align: center;
  line-height: 1;
}
.btn-icon {
  font-size: 1.25em;
  line-height: 1;
  position: relative;
  top: -3px;
}
.btn-icon.clip {
  top: -1px;
}
.btn:active { opacity: 0.85; }
.btn:disabled { background: #aaa; cursor: not-allowed; }
.anexo-firmar-btn.completed {
  background: #eaf7d9;
  color: var(--verde-hoja);
}
.anexo-firmar-btn.completed:disabled { background: #eaf7d9; }
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.secondary { background: var(--gris-metalico); color: var(--negro-bosque); }
input[type="file"] { display: none; }
#docList { margin-top: 4px; }
.doc-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #eee;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.doc-item .name { font-weight: 600; overflow-wrap: anywhere; }
.doc-item .right { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-item .status { font-size: 0.8rem; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.pending { color: var(--pending); }
.btn-delete {
  border: none;
  background: transparent;
  color: var(--err);
  font-size: 1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-delete:hover { background: #fdecea; }
.btn-delete:disabled { color: #bbb; cursor: not-allowed; }
.hint { font-size: 0.78rem; font-weight: 300; color: #777; margin-top: 10px; margin-bottom: 0; }
.banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.banner.info { background: #e3f2fd; color: #0d47a1; }
.banner.err { background: #fdecea; color: #c62828; }
.card a { color: var(--verde-hoja); font-weight: 600; text-decoration: none; }
.card a:hover { text-decoration: underline; }
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.session-row .hint { margin: 0; }
.header-row .session-row .hint {
  color: var(--verde-lima);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  flex: none;
  padding: 8px;
  width: 34px;
  height: 34px;
}
.btn-logout svg {
  width: 18px;
  height: 18px;
}
.header-row .btn-logout {
  background: var(--verde-lima);
  color: var(--negro-bosque);
}
.header-row .btn-logout:active { background: var(--verde-hoja); }
.staging {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #ddd;
}
.staging-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
}
.thumb {
  position: relative;
  flex: none;
  width: 64px;
  height: 84px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #ddd;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
#encargosList { margin-top: 4px; }
.estado-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.estado-filter-btn {
  border: none;
  background: #f5f5f4;
  color: #777;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.estado-filter-btn.active {
  background: var(--negro-bosque);
  color: var(--verde-lima);
}
#agendaContainer { margin-top: 30px; }
.agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.agenda-month-label {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: capitalize;
  margin: 0;
}
.agenda-nav-btn {
  border: none;
  background: #f5f5f4;
  color: var(--negro-bosque);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.agenda-nav-btn svg { width: 18px; height: 18px; }
.agenda-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.agenda-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--negro-bosque);
  cursor: pointer;
}
.agenda-day.other-month { color: #ccc; cursor: default; }
.agenda-day.today { box-shadow: inset 0 0 0 2px var(--verde-hoja); }
.agenda-day.pendiente { background: var(--pending); color: var(--negro-bosque); }
.agenda-day.completado { background: var(--verde-hoja); color: var(--negro-bosque); }
.agenda-day.mixed {
  background: linear-gradient(135deg, var(--pending) 50%, var(--verde-hoja) 50%);
  color: var(--negro-bosque);
}
.agenda-day.selected { background: var(--negro-bosque); color: var(--verde-lima); }

.agenda-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 4px;
  font-size: 0.72rem;
  color: #666;
}
.agenda-legend-item { display: flex; align-items: center; gap: 5px; }
.agenda-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.agenda-legend-swatch.pendiente { background: var(--pending); }
.agenda-legend-swatch.completado { background: var(--verde-hoja); }
.agenda-legend-swatch.mixed { background: linear-gradient(135deg, var(--pending) 50%, var(--verde-hoja) 50%); }
.agenda-day-detail { margin-top: 14px; }
.agenda-day-detail-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #999;
  margin: 0 0 8px;
}
.encargo-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 8px;
  cursor: pointer;
}
.encargo-card:active { opacity: 0.85; }
.encargo-card-accent {
  width: 3px;
  border-radius: 3px;
  background: var(--pending);
  flex-shrink: 0;
}
.encargo-card-accent.completed { background: var(--verde-hoja); }
.encargo-card-body { flex: 1; min-width: 0; }
.encargo-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.encargo-card-code {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--verde-hoja);
  margin: 0;
}
.encargo-card-sia { font-size: 0.85rem; font-weight: 700; margin: 2px 0 0; }
.encargo-card-sia-label { color: #999; font-weight: 600; }
.encargo-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.encargo-card-grid + .encargo-card-grid { margin-top: 8px; }
.encargo-card-grid .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #999;
  font-weight: 600;
  margin: 0;
}
.encargo-card-grid .value {
  font-size: 0.75rem;
  color: #444;
  font-weight: 600;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.pending { background: #fff3e0; color: var(--pending); }
.status-badge.completed { background: #eaf7d9; color: var(--verde-hoja); }
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.detail-back {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--gris-metalico);
  color: var(--negro-bosque);
  cursor: pointer;
  transition: background 0.15s;
}
.detail-back svg { width: 18px; height: 18px; }
.detail-back:hover { background: #dcdcdc; }
.detail-back:active { background: #cfcfcf; }
.detail-header-text { min-width: 0; }
.detail-header-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--verde-hoja);
  margin: 0;
}
.detail-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--negro-bosque);
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.detail-tabs-panel {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 16px;
}
.detail-tabs {
  display: flex;
  gap: 4px;
  background: #f5f5f4;
  padding: 10px;
  border-bottom: 1px solid #ececea;
}
.detail-tabs-panel .card {
  box-shadow: none;
  border-radius: 0;
  margin-bottom: 0;
}
.detail-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: #777;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.detail-tab.active {
  background: var(--negro-bosque);
  color: var(--verde-lima);
  box-shadow: 0 3px 8px rgba(0,0,0,0.28);
}
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--verde-hoja);
  margin: 0 0 10px;
}
.historico-title { margin-top: 18px; }
.tab-section + .tab-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f2f2f2;
  font-size: 0.85rem;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-label {
  color: #999;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
}
.info-row .info-value { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.anexo-row {
  padding: 12px 0;
  border-bottom: 1px solid #f2f2f2;
}
.anexo-row:last-child { border-bottom: none; }
.anexo-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.anexo-row-text { min-width: 0; }
.anexo-id-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gris-metalico);
  color: var(--negro-bosque);
  margin-bottom: 4px;
}
.anexo-title { font-size: 0.88rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.anexo-add-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f2f2f2; }
.anexo-add-picker { margin-top: 10px; }
.anexo-add-picker select { margin-bottom: 10px; }
