/* ── History sidebar / lists ─────────────────────────────────── */
.sidebar-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--color-border-light);
}

.history-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.history-list { min-height: 64px; }
/* Avoid global opacity fades on load (perceived flicker). Keep layout stable instead. */
.history-list.is-loading { opacity: 1; transition: none; }
.history-list.is-loaded { opacity: 1; transition: none; }

/* Compact list: "one by one" rows without item containers */
.history-list--compact {
  padding: 0;
  gap: 0;
}
.history-list--compact .file-item.modern {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.history-list--compact .file-item.modern:last-child {
  border-bottom: 0;
}
.history-list--compact .file-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 9px;
}
.history-list--compact .file-name { font-size: 12px; font-weight: 600; }
.history-list--compact .file-meta { font-size: 11px; }

/* Modal list: pleasant full-width rows (no card containers) */
.history-list--modal {
  padding: 0;
  gap: 0;
  min-height: 0;
}
.history-list--modal .file-item.modern {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: none;
}
.history-list--modal .file-item.modern:last-child { border-bottom: 0; }
.history-list--modal .file-item.modern:hover {
  background: color-mix(in srgb, var(--color-blue-light) 18%, white);
}
.history-list--modal .file-item.modern:active { transform: none; }

/* ftl_per-like item layout */
.file-item.modern {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border-light);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .08s ease;
}

.history-list:not(.history-list--compact) .file-item.modern:hover {
  background: color-mix(in srgb, var(--color-blue-light) 22%, white);
  border-color: color-mix(in srgb, var(--color-blue) 16%, var(--color-border-light));
  box-shadow: 0 8px 18px rgba(15, 27, 51, 0.06);
}

.history-list:not(.history-list--compact) .file-item.modern:active {
  transform: translateY(1px);
}

.file-index {
  width: 18px;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  width: 100%;
  text-align: left;
}

/* Status badge: keep existing .badge/.badge-blue but tune appearance in history items */
.file-item.modern .badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border-light);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
}

.file-item.modern .badge.badge-blue {
  background: color-mix(in srgb, var(--color-blue-light) 68%, white);
  border-color: color-mix(in srgb, var(--color-blue) 18%, var(--color-border-light));
  color: var(--color-blue);
}

.file-item.modern .badge.badge-green {
  background: color-mix(in srgb, var(--color-success-bg) 70%, white);
  border-color: color-mix(in srgb, var(--color-success) 22%, var(--color-border-light));
  color: var(--color-success);
}

.file-item.modern .badge.badge-red {
  background: color-mix(in srgb, var(--color-danger-bg) 75%, white);
  border-color: color-mix(in srgb, var(--color-danger) 25%, var(--color-border-light));
  color: var(--color-danger-strong);
}

.history-preview {
  border: 1px solid var(--color-border-light);
  border-radius: 14px;
  overflow: auto;
  max-height: min(60vh, 520px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--color-bg);
}

.history-preview__table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-preview__table thead th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--color-bg-secondary) 75%, var(--color-bg));
  border-bottom: 1px solid var(--color-border-light);
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 800;
}

.history-preview__table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
  white-space: nowrap;
}

.history-preview__table tbody tr:last-child td {
  border-bottom: none;
}

.history-preview__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 0;
}

.history-item__delete {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-item__delete:hover { background: var(--color-danger-weak-bg); color: var(--color-danger-strong); }

.history-item__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Compact history: keep buttons visually lighter and prevent row overflow */
.history-list--compact .history-item__actions {
  gap: 6px;
}
.history-list--compact .history-item__actions .tbtn {
  min-height: 32px;
  padding: 6px 10px;
}

/* Button styling is unified globally in app.css; keep this file focused on layout. */

.history-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg);
}

