.page-title {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: #17210f;
}

.page-subtitle {
  margin: 8px 0 0;
  max-width: 640px;
  font-size: 14px;
  line-height: 1.55;
  color: #78836f;
}

.history-new-link {
  text-decoration: none;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.summary-card {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(58, 102, 0, 0.12);
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(37, 54, 20, 0.06);
}

.summary-card.primary {
  background: linear-gradient(135deg, #edf7df 0%, #ffffff 100%);
}

.summary-label {
  font-size: 13px;
  font-weight: 700;
  color: #78836f;
}

.summary-value {
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #17210f;
}

.summary-text {
  margin-top: 8px;
  font-size: 13px;
  color: #78836f;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  margin-top: 22px;
}

.history-panel,
.history-side-panel .panel {
  border: 1px solid rgba(58, 102, 0, 0.12);
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(37, 54, 20, 0.08);
}

.history-panel {
  padding: 24px;
  min-height: 540px;
}

.history-header {
  align-items: flex-start;
}

.history-search-row {
  margin-top: 18px;
}

.history-search {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(58, 102, 0, 0.12);
  color: #78836f;
}

.history-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: #17210f;
}

.history-search input::placeholder {
  color: #9ba493;
}

.history-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.filter-pill {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(58, 102, 0, 0.12);
  background: #ffffff;
  color: #64705b;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.filter-pill:hover,
.filter-pill.active {
  color: #2f5200;
  background: #edf7df;
  border-color: rgba(58, 102, 0, 0.2);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(58, 102, 0, 0.1);
  background: #ffffff;
  text-decoration: none;
  transition: 0.18s ease;
}

.history-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(37, 54, 20, 0.08);
  border-color: rgba(58, 102, 0, 0.18);
}

.history-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.history-date-box {
  width: 52px;
  height: 58px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: #f0f7e7;
  color: #3a6600;
}

.history-date-box span {
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.history-date-box small {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-info {
  min-width: 0;
}

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

.history-title {
  font-size: 15px;
  font-weight: 750;
  color: #17210f;
  letter-spacing: -0.02em;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 13px;
  color: #78836f;
}

.history-note-preview {
  max-width: 780px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8faf5;
  border: 1px solid rgba(58, 102, 0, 0.08);
  font-size: 13px;
  line-height: 1.55;
  color: #4e5a45;
}

.status-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  background: #f3f4f1;
  color: #66705e;
}

.status-draft,
.status-recording_uploaded {
  background: #f3f4f1;
  color: #66705e;
}

.status-transcribing,
.status-generating_soap {
  background: #fff7dd;
  color: #876200;
}

.status-ready_for_review {
  background: #edf7df;
  color: #3a6600;
}

.status-completed {
  background: #eaf5ff;
  color: #1f5f8b;
}

.status-failed {
  background: #fff1f1;
  color: #a02525;
}

.history-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.history-tag {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f4f1;
  color: #66705e;
  font-size: 12px;
  font-weight: 700;
}

.history-tag.success {
  background: #edf7df;
  color: #3a6600;
}

.history-tag.ehr {
  background: #eaf5ff;
  color: #1f5f8b;
}

.history-side {
  flex: 0 0 auto;
  padding-top: 2px;
}

.history-open {
  color: #3a6600;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.history-side-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.timeline-card,
.export-card {
  padding: 24px;
}

.side-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: #17210f;
}

.side-text {
  margin: 8px 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #78836f;
}

.side-btn {
  width: 100%;
  justify-content: center;
}

.export-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #edf7df;
  color: #3a6600;
  margin-bottom: 18px;
}

.timeline-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 19px;
  width: 2px;
  height: calc(100% + 2px);
  background: #e1e8d8;
}

.timeline-item > span {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border-radius: 999px;
  background: #e1e8d8;
  border: 4px solid #ffffff;
  box-shadow: 0 0 0 1px #dce5d0;
  z-index: 1;
}

.timeline-item.done > span,
.timeline-item.active > span {
  background: #3a6600;
  box-shadow: 0 0 0 1px rgba(58, 102, 0, 0.2);
}

.timeline-item strong {
  display: block;
  font-size: 14px;
  color: #17210f;
}

.timeline-item p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #78836f;
}

.history-empty {
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .history-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .history-summary-grid {
    grid-template-columns: 1fr;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-side-panel {
    grid-template-columns: 1fr;
  }

  .history-row,
  .history-side {
    align-items: stretch;
    flex-direction: column;
  }

  .history-main {
    flex-direction: column;
  }

  .filter-pill {
    flex: 1;
  }

  .history-open {
    display: none;
  }
}