.history-shell {
  display: grid;
  gap: 18px;
}

.history-hero {
  display: grid;
  gap: 10px;
  padding: 14px 2px 4px;
}

.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-title-row > div {
  min-width: 0;
}

.history-logo-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(54px, 18vw, 86px);
  aspect-ratio: 1;
  max-width: 28vw;
  padding: 5px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: var(--radius);
  background: rgba(8, 10, 15, 0.76);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.history-logo-frame img {
  display: block;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.history-hero h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 10vw, 3.8rem);
  line-height: 1;
  text-transform: uppercase;
}

.history-hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.history-hero .ghost-button {
  width: max-content;
}

.history-brand-panel {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.history-brand-panel img {
  display: block;
  width: min(100%, 520px);
  max-width: 100%;
  height: auto;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius);
}

.history-home-link {
  width: 100%;
}

.period-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.period-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.period-button.is-active {
  border-color: rgba(56, 189, 248, 0.68);
  background: rgba(14, 165, 233, 0.18);
  color: #e0f2fe;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(25, 33, 49, 0.96), rgba(18, 23, 34, 0.98));
}

.summary-card span,
.summary-card small,
.insight-panel span,
.insight-panel small,
.mode-line span,
.history-meta,
.history-detail,
.history-date {
  color: var(--muted);
}

.summary-card small,
.insight-panel small {
  font-size: 0.82rem;
  line-height: 1.35;
}

.summary-card small.is-positive {
  color: #86efac;
}

.summary-card small.is-negative {
  color: #fecaca;
}

.summary-card small.is-neutral {
  color: #cbd5e1;
}

.summary-card strong {
  font-size: clamp(1.45rem, 7vw, 2.15rem);
  line-height: 1;
}

.insight-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insight-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: var(--radius);
  background: rgba(14, 165, 233, 0.08);
}

.insight-panel strong {
  font-size: clamp(1.08rem, 4vw, 1.38rem);
  line-height: 1.25;
}

.mode-summary,
.history-list,
.daily-activity {
  display: grid;
  gap: 10px;
}

.mode-line {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.74);
}

.mode-line strong {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mode-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.mode-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #f97316);
}

.origin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
}

.origin-summary strong {
  color: var(--text);
}

.subtle-section {
  margin-top: 0;
}

.day-line {
  display: grid;
  grid-template-columns: 46px 1fr 58px;
  align-items: center;
  gap: 10px;
}

.day-line strong {
  font-size: 0.82rem;
  text-transform: uppercase;
}

.day-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.day-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #38bdf8;
}

.day-line em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.86rem;
  text-align: right;
}

.date-group {
  display: grid;
  gap: 10px;
}

.history-date {
  margin: 12px 0 0;
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 10, 15, 0.78);
}

.history-item summary {
  cursor: pointer;
  list-style: none;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.history-main h3 {
  margin: 0;
  font-size: 1.05rem;
}

.history-duration {
  flex: 0 0 auto;
  color: #e0f2fe;
  font-weight: 900;
}

.history-meta,
.history-detail {
  margin: 0;
  font-size: 0.92rem;
}

.execution-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.execution-list li {
  margin-left: 18px;
}

.manual-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
}

.empty-history {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 620px) {
  .summary-grid,
  .period-filters,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .history-main {
    display: grid;
  }
}
