:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #172033;
  --muted: #667085;
  --line: #d7deea;
  --panel: #ffffff;
  --soft: #eef3f8;
  --accent: #0f5f9a;
  --accent-strong: #123b5f;
  --up: #b42318;
  --down: #067647;
  --flat: #667085;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.forecast-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100svh;
}

.date-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.rail-head {
  padding: 24px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 26px;
  line-height: 1.18;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.date-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding: 14px;
}

.date-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.date-button:hover,
.date-button[aria-current="true"] {
  border-color: var(--line);
  background: var(--panel);
}

.date-button:hover {
  transform: translateX(2px);
}

.date-button strong {
  overflow-wrap: anywhere;
}

.date-button span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  height: 100svh;
  padding: 22px;
  gap: 14px;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tool-button,
.tool-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, color 160ms ease;
}

.tool-button:hover,
.tool-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.tool-link.disabled {
  pointer-events: none;
  color: #98a2b3;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-strip > div {
  min-height: 72px;
  padding: 13px 14px;
  background: var(--panel);
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.summary-strip strong {
  font-size: 18px;
  font-weight: 750;
}

.error-text {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fff5f5;
  color: #b42318;
  font-size: 13px;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #344054;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

td {
  line-height: 1.45;
}

tbody tr {
  animation: rowIn 220ms ease both;
}

tbody tr:hover {
  background: #f8fbff;
}

.stock-name {
  font-weight: 700;
}

.price-date {
  color: var(--muted);
  white-space: nowrap;
}

.price {
  white-space: nowrap;
  font-weight: 750;
}

.price.up {
  color: var(--up);
}

.price.down {
  color: var(--down);
}

.price.flat {
  color: var(--flat);
}

.reason {
  max-width: 360px;
}

.file-links {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.empty-cell {
  height: 180px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

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

@media (max-width: 900px) {
  .forecast-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100svh;
  }

  .date-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .date-list {
    display: flex;
    overflow-x: auto;
    padding-top: 10px;
  }

  .date-button {
    min-width: 150px;
  }

  .workspace {
    height: auto;
    min-height: calc(100svh - 160px);
    padding: 16px;
  }

  .workspace-head {
    flex-direction: column;
  }

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