:root {
  --ink: #1c2024;
  --paper: #edeff1;
  --ink-soft: #5a616a;
  --struct: #38566e;
  --redline: #c23b2e;
  --linea: #c9ced3;
  --blanco: #f7f8f9;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
}

h1 { font: 600 22px/1.2 Saira, sans-serif; margin: 0 0 16px; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.marca { font: 600 14px/1 Saira, sans-serif; letter-spacing: 0.14em; }
.error { color: var(--redline); min-height: 1.5em; }
.meta, .huella, .autor { color: var(--ink-soft); font-size: 13px; }
.huella, .autor, .estado { font-family: "Azeret Mono", monospace; }
.aviso { color: var(--redline); font-weight: 600; }

button, input, textarea { font: inherit; color: inherit; }
button {
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  min-height: 40px;
  padding: 6px 14px;
}
button:hover { border-color: var(--struct); color: var(--struct); }
button:disabled { opacity: 0.5; cursor: default; }
button.primario { background: var(--ink); color: var(--paper); }
button.primario:hover { background: var(--struct); color: var(--paper); }
:focus-visible { outline: 2px solid var(--struct); outline-offset: 2px; }

label { display: grid; gap: 4px; font-weight: 500; }
input, textarea {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: 2px;
  font-weight: 400;
  padding: 10px;
  width: 100%;
}

.entrada { display: grid; min-height: 100dvh; padding: 16px; place-items: center; }
.entrada form { display: grid; gap: 16px; max-width: 360px; width: 100%; }

.oficina { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100dvh; }

.lista {
  border-right: 1px solid var(--linea);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}
.lista header {
  align-items: center;
  border-bottom: 1px solid var(--linea);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 16px;
}
.lista ul { overflow-y: auto; }
.lista footer {
  align-items: center;
  border-top: 1px solid var(--linea);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 16px;
}
#yo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.encargo {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--linea);
  border-radius: 0;
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  text-align: left;
  width: 100%;
}
.encargo.activo { background: var(--blanco); box-shadow: inset 3px 0 0 var(--struct); }
.encargo .titulo {
  display: -webkit-box;
  font-weight: 500;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.encargo .meta { font-size: 13px; }

.hilo { min-width: 0; overflow-y: auto; padding: 24px; }
.hilo > * { margin-inline: auto; max-width: 760px; }
.vacio { color: var(--ink-soft); padding-top: 20vh; text-align: center; }
.volver { display: none; margin-bottom: 16px; }

.tarjeta { display: grid; gap: 16px; }
.redactar { border-top: 1px solid var(--linea); display: grid; gap: 12px; margin-top: 24px; padding-top: 16px; }
.mensaje.cargo { border-left: 3px solid var(--ink); }

.mensaje {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: 2px;
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 14px 16px;
}
.mensaje .cuerpo { overflow-wrap: anywhere; white-space: pre-wrap; }
.mensaje pre {
  background: var(--paper);
  font: 400 13px/1.5 "Azeret Mono", monospace;
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.accion { border-left: 3px solid var(--struct); }
.estado-pendiente, .estado-incierta { border-left-color: var(--redline); }
.estado-incierta .estado { color: var(--redline); font-weight: 500; }
.estado-reemplazada { opacity: 0.65; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) {
  .oficina { grid-template-columns: minmax(0, 1fr); }
  .lista { border-right: 0; }
  .hilo { display: none; padding: 16px; }
  .en-hilo .lista { display: none; }
  .en-hilo .hilo { display: block; }
  .volver { display: block; }
}
