:root {
  --bg: #f4f1ea;
  --bg-soft: #efe8dc;
  --ink: #1f2a2b;
  --ink-muted: #516061;
  --surface: #fffdf8;
  --line: #d9d2c5;
  --accent: #1f6f66;
  --accent-strong: #175750;
  --glow: #d8eadf;
  --danger: #ac2f2f;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body.history-page {
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, #fef6dd 0%, transparent 35%),
    radial-gradient(circle at 90% 15%, #dbead8 0%, transparent 35%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--ink);
}

.history-shell {
  width: min(980px, 94vw);
  margin: 28px auto;
}

.history-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.history-topbar h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4vw, 3rem);
}

.history-topbar p {
  margin: 6px 0 0;
  color: var(--ink-muted);
}

.back-link,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 11px 18px;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid #b8c5c1;
  background: #f9fcfa;
  color: #2e4b47;
  cursor: pointer;
}

.history-panel {
  background: color-mix(in srgb, var(--surface) 88%, white 12%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(31, 42, 43, 0.1);
  padding: 22px;
}

.history-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid #e6dfd3;
}

.history-user-name {
  font-weight: 800;
  font-size: 1.1rem;
}

.history-user-email {
  margin-top: 4px;
  color: var(--ink-muted);
}

.history-count-box {
  min-width: 92px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8faf7;
  border: 1px solid #ddd6c7;
  text-align: center;
}

.history-count-box span {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.history-count-box strong {
  display: block;
  font-size: 1.2rem;
  margin-top: 4px;
}

.history-page-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.history-card {
  border: 1px solid #ddd6c7;
  border-radius: 16px;
  background: #fffefb;
  padding: 14px;
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.84rem;
  color: #4c5b5b;
}

.history-tool {
  font-weight: 800;
  text-transform: capitalize;
}

.history-preview {
  color: #4f6061;
  line-height: 1.45;
}

.history-empty {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed #cdc5b7;
  color: var(--ink-muted);
  background: #fffdf8;
}

.history-empty.compact {
  padding: 10px;
}

.is-hidden { display: none; }

@media (max-width: 720px) {
  .history-topbar,
  .history-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
}