/* Manuel Chamanique Mongol — dashboard de relecture
   Palette terre/nuit, serif pour les textes, sans-serif pour l'UI. */

:root {
  --bg: #f4efe6;          /* papier crème */
  --bg-alt: #ebe3d4;
  --ink: #1d1b17;          /* encre nuit */
  --ink-soft: #4a463e;
  --accent: #7a2f20;       /* rouge mongol */
  --accent-soft: #a6604f;
  --gold: #9c7a3c;
  --rule: #c8bfac;
  --ok: #2f6b3c;
  --warn: #8a5a16;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  --serif: "Iowan Old Style", "Palatino Linotype", "Palatino", "Georgia", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

.title {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.01em;
}
.title .book { color: var(--accent); font-weight: 600; }
.title .sep { margin: 0 8px; color: var(--rule); }
.title .fr { color: var(--ink-soft); font-style: italic; }

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pager button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  background: var(--bg);
  border-radius: 3px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
}
.pager button:hover { background: var(--bg-alt); border-color: var(--ink-soft); }
.pager label { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.pager input[type=number] {
  width: 64px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-align: right;
}
.pager .total { color: var(--ink-soft); }
.pager select {
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
}
#save-indicator { font-size: 12px; }
#save-indicator.saving { color: var(--warn); }
#save-indicator.saved  { color: var(--ok); }
#save-indicator.error  { color: var(--accent); }
.muted { color: var(--ink-soft); }

/* Grid 3 colonnes */
.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.1fr) minmax(320px, 1fr);
  gap: 1px;
  background: var(--rule);
  height: calc(100vh - 53px);
}
.col {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 14px 18px 18px;
  overflow: hidden;
}
.col h2 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Colonne originale */
.col-original .image-wrap {
  flex: 1 1 auto;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--rule);
  display: flex;
  justify-content: center;
  padding: 8px;
}
.col-original img {
  max-width: 100%;
  height: auto;
  box-shadow: var(--shadow);
  background: #fff;
}
.original-text {
  margin-top: 10px;
  max-height: 180px;
  overflow: auto;
  font-size: 12px;
}
.original-text summary {
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px 0;
}
.original-text pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--bg-alt);
  padding: 10px;
  border-radius: 3px;
  margin: 6px 0 0;
}

/* Colonne traduction */
.col-translation textarea {
  flex: 1 1 auto;
  resize: none;
  padding: 16px 20px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.col-translation textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
}

/* Colonne notes */
.col-notes {
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.col-notes > textarea#notes {
  resize: none;
  padding: 14px 16px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  background: #fffbf2;
  border: 1px solid var(--rule);
  border-radius: 3px;
  min-height: 0;
}
.col-notes > textarea#notes:focus {
  outline: none;
  border-color: var(--gold);
}

/* Bloc retraduction */
.retranslation {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}
.retranslation h3 {
  font-family: var(--serif);
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
#retranslate-passage {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 3px;
  resize: vertical;
}
.retranslation-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.retranslation-actions button {
  flex: 1;
  padding: 8px 10px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
}
.retranslation-actions button:hover { background: var(--accent-soft); }
.retranslation-actions button:disabled { background: var(--rule); cursor: not-allowed; }

.queue {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  max-height: 100px;
  overflow: auto;
}
.queue .item {
  padding: 6px 8px;
  border-left: 3px solid var(--gold);
  background: var(--bg-alt);
  margin-bottom: 4px;
}
.queue .item.pending { border-left-color: var(--warn); }
.queue .item.done    { border-left-color: var(--ok); }
.queue .item.error   { border-left-color: var(--accent); }
