:root {
  --bg: #e9dabf;
  --panel: rgba(255, 251, 242, 0.84);
  --panel-soft: rgba(255, 255, 255, 0.62);
  --line: rgba(163, 123, 74, 0.34);
  --line-strong: rgba(128, 92, 52, 0.5);
  --text: #9e2b25;
  --text-strong: #9e2b25;
  --accent: #9e2b25;
  --accent-soft: #ffb300;
  --radius: 14px;
  --radius-sm: 10px;
  --space: 14px;
  --space-lg: 18px;
  --shadow-soft: 0 6px 18px rgba(103, 73, 42, 0.1);
  --shadow-hover: 0 12px 26px rgba(103, 73, 42, 0.18);
  --ease: 220ms ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background-color: #f2ebd9;
  background-image: 
    radial-gradient(circle at 50% 0%, #fffbf2 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M54.627 0l.83.83v58.34l-.83.83H5.373l-.83-.83V.83l.83-.83h49.254zm-1.66 2.49H7.033v55.02h45.934V2.49z' fill='%23d8cbb5' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
  color: var(--text);
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.4;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.screen-bg,
.screen-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.screen-bg {
  background-image: radial-gradient(#d4c1a5 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.3;
}

.screen-overlay {
  background: radial-gradient(circle at center, transparent 30%, rgba(139, 105, 65, 0.08) 100%);
}

.dashboard {
  position: relative;
  z-index: 2;
  width: min(1900px, calc(100vw - 2 * var(--space-lg)));
  height: 100vh;
  min-height: 800px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) 0 var(--space-lg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space);
  align-content: stretch;
}

.panel {
  background: linear-gradient(165deg, rgba(255, 253, 248, 0.9), rgba(245, 238, 224, 0.85));
  border: 1px solid rgba(184, 132, 71, 0.3);
  border-radius: 16px; /* Rounded corners */
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.5), /* Inner light border */
              inset 0 0 0 5px rgba(184, 132, 71, 0.2), /* Inner dark border */
              0 6px 16px rgba(103, 73, 42, 0.08);
  position: relative;
  transition: transform var(--ease), box-shadow var(--ease);
  animation: panelFadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

/* Corner decorations for panels */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(158, 43, 37, 0.5); /* Red accent corners */
  pointer-events: none;
}

.panel::before {
  top: 6px;
  left: 6px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 10px;
}

.panel::after {
  bottom: 6px;
  right: 6px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 10px;
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.6),
              inset 0 0 0 5px rgba(184, 132, 71, 0.3),
              0 12px 24px rgba(103, 73, 42, 0.15);
}

.top-header {
  padding: 14px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 0;
  position: relative;
  min-height: 0;
}

.header-left {
  position: static;
  transform: none;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  text-align: center;
  max-width: 100%;
}

.sub-title {
  margin: 0;
  letter-spacing: 0.3em;
  color: var(--accent-soft);
  font-size: 12px;
}

.main-title {
  margin: 4px 0 0;
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(30px, 2.2vw, 44px);
  letter-spacing: 0.06em;
  color: var(--text-strong);
}

.header-right {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
}

.header-right strong {
  font-size: 30px;
  color: var(--text-strong);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 132px);
  gap: 10px;
}

.kpi-row-left {
  grid-column: 1;
  grid-row: 1;
  justify-content: end;
}

.kpi-row-right {
  grid-column: 3;
  grid-row: 1;
  justify-content: start;
}

.kpi {
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
}

.kpi::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border: 1px dashed rgba(184, 132, 71, 0.3);
  border-radius: 10px;
  pointer-events: none;
}

.kpi-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.kpi-value {
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: clamp(18px, 1.25vw, 24px);
  font-weight: 800;
  color: var(--text-strong);
  position: relative;
  z-index: 1;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.05fr 2.1fr 1.05fr;
  grid-template-rows: auto 1fr;
  gap: 14px;
  min-height: 0;
}

.col {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.card {
  padding: calc(var(--space) + 6px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px; /* Rounded corners */
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.85), rgba(245, 238, 224, 0.75));
  transition: transform var(--ease), box-shadow var(--ease);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(121, 87, 49, 0.14);
}

.card-title {
  font-family: "Noto Serif SC", "STSong", "SimSun", serif;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.chart {
  width: 100%;
  flex: 1;
  min-height: 120px;
  height: auto;
}

.collection-card .collection-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}

.collection-card {
  overflow: hidden;
}

.collection-card .collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.collection-card .collection-header .card-title {
  margin-bottom: 0;
}

.collection-card .collection-toolbar label {
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.collection-card .collection-toolbar select {
  height: 28px;
  min-width: 116px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 0 8px;
  outline: none;
}

#collectionChart {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
}

.left-col {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}

.right-col {
  grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr);
}

.center-col {
  grid-template-rows: minmax(0, 1fr) auto;
}

.hero {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.hero-badge {
  align-self: start;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  background: rgba(255, 248, 236, 0.8);
}

.hero-content {
  display: flex;
  min-height: 0;
  flex: 1;
  align-items: stretch;
}

.hero-content > * {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.hero-info,
.hero-image {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hero-info h2,
.hero-info h3 {
  margin: 0 0 6px;
  color: var(--text-strong);
}

.hero-info p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.hero-mini,
.hero-side-chart {
  width: 100%;
  min-height: 120px;
  height: clamp(120px, 18vh, 150px);
  margin-top: 10px;
  flex: 1 1 auto;
}

.hero-image {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.center-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 0;
  align-items: end;
}

.short {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}

.short::-webkit-scrollbar {
  width: 4px;
}
.short::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 4px;
}

.detail-short {
  overflow-y: hidden;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  align-items: start;
  position: relative;
  min-height: 74px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  top: 12px;
  height: 2px;
  background: linear-gradient(90deg, rgba(210, 181, 139, 0.9), rgba(179, 142, 90, 0.35));
}

.timeline li {
  font-size: 12px;
  color: var(--text);
  padding: 0 4px;
  cursor: pointer;
  transition: all 0.25s ease;
  opacity: 0;
  transform: translateY(12px);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.timeline li::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff9ee;
  border: 2px solid rgba(184, 132, 71, 0.55);
  transform: translateX(-50%) scale(1);
  z-index: 1;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 10px;
  width: 1px;
  height: 8px;
  background: rgba(184, 132, 71, 0.35);
  transform: translateX(-50%);
}

.timeline li.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline li:hover .timeline-year {
  color: var(--text-strong);
}

.timeline li:hover .timeline-label {
  color: var(--text);
}

.timeline li.is-active {
  color: var(--text-strong);
}

.timeline li.is-active::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(158, 43, 37, 0.15);
  animation: timelinePulse 1.6s ease-in-out infinite;
}

.timeline-year {
  display: block;
  margin-top: 18px;
  font-weight: 700;
  color: var(--text);
  font-size: 24px;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.timeline-label {
  margin-top: 1px;
  color: #923c27;
  font-size: 16px;
  font-style: normal;
  line-height: 1.1;
}

.timeline li.is-active .timeline-year {
  color: var(--text-strong);
}

.timeline li.is-active .timeline-label {
  color: var(--text-strong);
}

.timeline li.is-active .timeline-year {
  animation: activeYearFloat 0.5s ease;
}

.timeline-detail {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 7px 9px;
}

.timeline-detail h4 {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-strong);
}

.timeline-detail p {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
}

.timeline-detail.is-switching {
  animation: detailFadeIn 0.35s ease;
}

@keyframes timelinePulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) scale(1.25);
    opacity: 0.75;
  }
}

@keyframes activeYearFloat {
  0% {
    transform: translateY(4px);
    opacity: 0.65;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes detailFadeIn {
  0% {
    transform: translateY(6px);
    opacity: 0.2;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.detail-grid--with-note {
  grid-template-columns: minmax(0, 1fr) minmax(140px, 200px);
  align-items: center;
}

.detail-note {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

.detail-grid > div {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-grid strong {
  color: var(--text-strong);
}

.detail-grid span {
  color: var(--text);
  font-size: 12px;
}

.detail-item--with-image {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 180px);
  align-items: flex-start;
  gap: 10px;
}

.detail-item-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item-image {
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
  justify-self: end;
}

.bottom-bar {
  padding: 8px var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 12px;
  border-top: 1px solid var(--line);
  min-height: 36px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

@media (max-width: 1400px) {
  body {
    overflow: auto;
  }

  .dashboard {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto auto;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .left-col,
  .right-col,
  .center-col {
    grid-template-rows: auto;
  }

  .hero-content,
  .center-bottom {
    grid-template-columns: 1fr;
  }

  .timeline {
    grid-template-columns: repeat(5, minmax(74px, 1fr));
    overflow-x: auto;
    column-gap: 8px;
    padding-bottom: 4px;
  }

  .chart {
    min-height: 280px;
  }

  .collection-card .collection-header {
    align-items: flex-start;
  }

  .collection-card .collection-toolbar {
    margin-left: auto;
  }
}

.blank-panels-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
}

.blank-panel {
  min-height: 320px;
  background: var(--panel);
}

#panel-2,
#panel-3 {
  border-left-color: var(--line-strong);
}

@media (max-width: 1400px) {
  .blank-panels-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .blank-panel {
    min-height: 260px;
  }
}

.details-dashboard {
  position: relative;
  z-index: 2;
  width: min(1900px, calc(100vw - 2 * var(--space-lg)));
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--space-lg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space);
}

.details-header {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.details-header .sub-title {
  margin: 0;
}

.details-header .main-title {
  margin: 4px 0 0;
}

.details-footer {
  padding: 0 18px;
}

@media (max-width: 1400px) {
  .details-dashboard {
    grid-template-rows: auto 1fr auto;
  }
}

@media (max-width: 768px) {
  :root {
    --space: 10px;
    --space-lg: 12px;
    --radius: 12px;
    --radius-sm: 8px;
  }

  .dashboard,
  .details-dashboard {
    width: min(100vw, calc(100vw - 2 * var(--space-lg)));
    padding: var(--space-lg);
    gap: var(--space);
  }

  .top-header,
  .kpi,
  .hero,
  .bottom-bar {
    padding-left: var(--space);
    padding-right: var(--space);
  }

  .top-header {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .header-left {
    display: none;
  }

  .header-center,
  .header-right {
    grid-column: auto;
    justify-self: center;
    text-align: center;
  }

  .header-right {
    align-items: center;
    gap: 4px;
    white-space: normal;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-title {
    font-size: clamp(24px, 6.6vw, 32px);
  }

  .kpi-value {
    font-size: clamp(22px, 6vw, 30px);
  }
}

@media (max-width: 375px) {
  :root {
    --space: 8px;
    --space-lg: 10px;
  }

  .dashboard,
  .details-dashboard {
    width: 100vw;
    padding: var(--space-lg);
    gap: var(--space);
  }

  .top-header {
    padding: 10px;
    row-gap: 6px;
  }

  .main-title {
    font-size: clamp(20px, 7.8vw, 26px);
  }

  .top-subtitle,
  .bottom-subtitle,
  .kpi-label,
  .bottom-bar {
    font-size: 11px;
  }

  .kpi-value {
    font-size: clamp(20px, 7vw, 24px);
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }
}
