/* Timeline navigation + date editor. Uses the shared dark theme custom
   properties from main.css (--bg, --accent, etc.). */

/* ---- Date editor modal ---- */
.de-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.de-card {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  width: min(520px, 96vw); max-height: 92vh; overflow-y: auto;
  padding: 18px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.de-head { display: flex; align-items: center; justify-content: space-between; }
.de-title { margin: 0; font-size: 1.15rem; }
.de-close { background: none; border: none; color: var(--text-muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.de-ai-note {
  margin: 10px 0; padding: 8px 10px; border-radius: 6px;
  background: var(--bg-surface); border-left: 3px solid var(--accent);
  font-size: 0.85rem; color: var(--text-muted);
}
.de-pills { display: flex; gap: 6px; margin: 12px 0; }
.de-pill {
  flex: 1; padding: 7px 10px; border-radius: 6px; cursor: pointer;
  background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border);
}
.de-pill.active { background: var(--accent); color: #1a1410; border-color: var(--accent); font-weight: 600; }
.de-ladders { display: flex; gap: 16px; }
.de-ladder { flex: 1; }
.de-ladder-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.de-rung { display: flex; gap: 6px; margin-bottom: 8px; }
.de-input {
  flex: 1; padding: 8px 10px; border-radius: 6px;
  background: var(--bg-surface); color: var(--text); border: 1px solid var(--border);
}
.de-input:disabled { opacity: 0.45; }
.de-qual {
  width: 38px; border-radius: 6px; cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--accent); font-size: 0.95rem;
}
.de-rung-time { align-items: center; }
.de-time-at { color: var(--text-muted); font-size: 0.85rem; flex: 0 0 auto; }
.de-time-colon { color: var(--text-muted); flex: 0 0 auto; }
.de-input-time { width: 52px; flex: 0 0 auto; text-align: center; }
.de-input-offset { flex: 1; }
.de-raw { margin: 10px 0; }
.de-raw-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.de-link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.82rem; padding: 4px 0; }
.de-preview {
  margin: 12px 0; padding: 10px 12px; border-radius: 8px;
  background: var(--bg-surface); border: 1px dashed var(--border);
}
.de-preview-human { font-size: 1.05rem; font-weight: 600; }
.de-preview-edtf { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.de-preview-edtf code { color: var(--accent); }
.de-error { color: var(--danger); font-size: 0.85rem; min-height: 1.1em; margin: 4px 0; }
.de-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.de-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Timeline overlay ---- */
.tl-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
}
.tl-shell { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.tl-head {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.tl-head-titles { flex: 1; min-width: 180px; }
.tl-title { margin: 0; font-size: 1.3rem; }
.tl-summary { font-size: 0.82rem; color: var(--text-muted); }
.tl-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-zoom {
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-muted);
}
.tl-zoom.active { background: var(--accent); color: #1a1410; border-color: var(--accent); font-weight: 600; }

/* Histogram */
.tl-histogram { padding: 14px 20px 4px; border-bottom: 1px solid var(--border); }
.tl-bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; overflow-x: auto; }
.tl-bar-col {
  position: relative; width: var(--tl-bar-w, 16px); height: 100%;
  display: flex; align-items: flex-end; cursor: pointer; flex: 0 0 auto;
}
.tl-bar-col.in-selection { background: rgba(196, 149, 106, 0.12); }
.tl-bar { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-height: 2px; }
.tl-bar-fine { background: var(--accent); }
.tl-bar-coarse {
  background: repeating-linear-gradient(45deg, var(--accent) 0 2px, transparent 2px 5px);
  opacity: 0.7;
}
.tl-bar-empty { background: transparent; }
.tl-bar-gap-hatch {
  background: repeating-linear-gradient(45deg, var(--border) 0 1px, transparent 1px 6px);
  opacity: 0.5;
}
.tl-bar-col:hover .tl-bar-tip { display: block; }
.tl-bar-tip {
  display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: var(--bg-card); border: 1px solid var(--border);
  padding: 4px 8px; border-radius: 5px; font-size: 0.75rem; z-index: 2; pointer-events: none;
}
.tl-axis { display: flex; gap: 2px; margin-top: 4px; overflow-x: hidden; }
.tl-axis-tick { flex: 0 0 auto; font-size: 0.68rem; color: var(--text-muted); text-align: left; overflow: visible; white-space: nowrap; }

/* Grid */
.tl-grid {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-content: start;
}
.tl-gap {
  grid-column: 1 / -1; text-align: center; color: var(--text-muted);
  font-size: 0.82rem; padding: 6px 0; border-top: 1px dashed var(--border); margin-top: 4px;
}
.tl-gap-undated { color: var(--accent); font-weight: 600; }
.tl-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
}
.tl-card:hover { border-color: var(--accent); }
.tl-card-thumb {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 5px; overflow: hidden;
  background: var(--bg-surface); border: 1px solid var(--border);
}
.tl-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-card-thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--text-muted);
}
.tl-card-top { display: flex; align-items: baseline; gap: 8px; }
.tl-card-pos { font-size: 0.72rem; color: var(--text-muted); flex: 0 0 auto; }
.tl-card-title { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-card-chip-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-card-actions { display: flex; gap: 6px; }
.tl-mini { font-size: 0.78rem; padding: 3px 8px; }

/* Date chips */
.tl-chip {
  display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 0.8rem; white-space: nowrap;
}
.tl-chip-user { background: var(--accent); color: #1a1410; font-weight: 600; }
.tl-chip-inherited { background: var(--bg-surface); color: var(--text); border: 1px solid var(--accent); }
.tl-chip-ai { background: transparent; color: var(--accent-hover); border: 1px dashed var(--accent-hover); }
.tl-chip-none { background: var(--bg-surface); color: var(--text-muted); border: 1px dashed var(--border); }
.tl-chip-flag {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em;
  background: var(--accent-hover); color: #1a1410; padding: 1px 5px; border-radius: 8px;
}

.tl-empty { color: var(--text-muted); padding: 24px; text-align: center; grid-column: 1 / -1; }

/* ---- Per-page date badge in the caption column (reading views) ---- */
.page-date-section {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.page-date-edit { font-size: 0.78rem; padding: 3px 9px; }
