.lenormand-history-band {
  padding: clamp(28px, 5vw, 68px) 0 72px;
}

.lenormand-history-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.lenormand-history-subtitle,
.lenormand-history-access p,
.lenormand-history-count,
.lenormand-history-empty {
  color: var(--muted);
}

.lenormand-history-subtitle {
  max-width: 720px;
  margin: 8px 0 0;
  line-height: 1.7;
}

.lenormand-history-access {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.lenormand-history-access p {
  margin: 0;
  line-height: 1.6;
}

[data-lenormand-history-login][hidden] {
  display: none;
}

.lenormand-history-access[data-state="error"] p,
.lenormand-history-access[data-state="forbidden"] p {
  color: #8b3b43;
}

.lenormand-history-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 16px;
  align-items: center;
  margin: 0 0 20px;
}

.lenormand-history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lenormand-history-filters button,
.lenormand-history-actions button,
.lenormand-history-pagination button {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.lenormand-history-filters button {
  padding: 0 14px;
  color: var(--muted);
}

.lenormand-history-filters button.is-active {
  border-color: #296d66;
  background: #296d66;
  color: #fff;
}

.lenormand-history-search-field {
  display: block;
}

.lenormand-history-search-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.lenormand-history-search-field input:focus {
  border-color: #296d66;
  outline: 3px solid rgba(41, 109, 102, 0.16);
  outline-offset: 1px;
}

.lenormand-history-records {
  display: grid;
  gap: 12px;
}

.lenormand-history-record {
  overflow: hidden;
  border: 1px solid rgba(44, 91, 84, 0.22);
  border-radius: 8px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 92%, #edf4f0 8%);
}

.lenormand-history-record > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 80px;
  padding: 15px 16px;
  list-style: none;
  cursor: pointer;
}

.lenormand-history-record > summary::-webkit-details-marker {
  display: none;
}

.lenormand-history-summary-copy {
  min-width: 0;
}

.lenormand-history-question {
  margin: 0 0 7px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.lenormand-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.lenormand-history-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid rgba(181, 146, 98, 0.34);
  border-radius: 999px;
  color: #795d2a;
  font-size: 0.74rem;
  font-weight: 700;
}

.lenormand-history-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.lenormand-history-preview img {
  width: 38px;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(44, 91, 84, 0.22);
  border-radius: 4px;
  object-fit: cover;
}

.lenormand-history-preview-more {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.lenormand-history-body {
  display: grid;
  gap: 18px;
  padding: 18px 16px 20px;
  border-top: 1px solid var(--line);
}

.lenormand-history-section {
  display: grid;
  gap: 8px;
}

.lenormand-history-section h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 750;
}

.lenormand-history-section p,
.lenormand-history-followup p {
  margin: 0;
  color: var(--ink);
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.lenormand-history-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.lenormand-history-card {
  min-width: 0;
  margin: 0;
}

.lenormand-history-card img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(44, 91, 84, 0.22);
  border-radius: 6px;
  object-fit: cover;
}

.lenormand-history-card figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

.lenormand-history-followups {
  display: grid;
  gap: 14px;
}

.lenormand-history-followup {
  display: grid;
  gap: 6px;
  padding-left: 12px;
  border-left: 2px solid rgba(41, 109, 102, 0.3);
}

.lenormand-history-followup strong {
  color: #296d66;
  font-size: 0.8rem;
}

.lenormand-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.lenormand-history-actions button {
  padding: 0 14px;
}

.lenormand-history-actions button.lenormand-history-primary-action {
  border-color: #296d66;
  background: #296d66;
  color: #fff;
}

.lenormand-history-actions button[data-action="delete"] {
  border-color: rgba(139, 59, 67, 0.34);
  color: #8b3b43;
}

.lenormand-history-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.lenormand-history-action-status {
  flex: 1 1 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.lenormand-history-empty {
  margin: 8px 0 0;
  padding: 26px 0;
  border-block: 1px solid var(--line);
  line-height: 1.7;
  text-align: center;
}

.lenormand-history-pagination {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.lenormand-history-pagination[hidden] {
  display: none;
}

.lenormand-history-pagination button[hidden] {
  display: none;
}

.lenormand-history-pagination button {
  padding: 0 18px;
}

.lenormand-history-pagination p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

html[data-theme="night"] .lenormand-history-record,
html[data-theme="night"] .lenormand-history-filters button,
html[data-theme="night"] .lenormand-history-search-field input,
html[data-theme="night"] .lenormand-history-actions button,
html[data-theme="night"] .lenormand-history-pagination button {
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="night"] .lenormand-history-actions button.lenormand-history-primary-action {
  border-color: #8bc6bd;
  background: #8bc6bd;
  color: #142018;
}

html[data-theme="night"] .lenormand-history-badge {
  color: #e0c079;
}

html[data-theme="night"] .lenormand-history-followup strong {
  color: #8bc6bd;
}

@media (max-width: 720px) {
  .lenormand-history-band {
    padding-top: 24px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .lenormand-history-shell {
    width: min(100% - 20px, 1120px);
  }

  .lenormand-history-toolbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .lenormand-history-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lenormand-history-filters button {
    min-width: 0;
    padding-inline: 6px;
    overflow-wrap: anywhere;
  }

  .lenormand-history-record > summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .lenormand-history-preview {
    justify-content: flex-start;
  }

  .lenormand-history-cards {
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  }

  .lenormand-history-pagination {
    flex-direction: column;
  }

  .lenormand-history-pagination button {
    width: 100%;
  }
}
