:root {
  --ink: #19121b;
  --muted: #7e6f7d;
  --paper: #fff7fb;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(39, 22, 38, 0.12);
  --pink: #ff3d91;
  --blue: #437dff;
  --green: #0f9f6e;
  --red: #d93e55;
  --shadow: 0 22px 70px rgba(100, 43, 82, 0.15);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 92, 160, 0.28), transparent 30%),
    radial-gradient(circle at 86% 12%, rgba(83, 137, 255, 0.22), transparent 36%),
    linear-gradient(135deg, #fff7fb, #ffffff 46%, #f4f7ff);
}

.page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.hero,
.panel,
.metrics article,
.footer {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 36px;
  padding: 22px;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.nav-actions button {
  border: 0;
  border-radius: 999px;
  padding: 11px 17px;
  color: white;
  background: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.nav-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: white;
  background: #19121b;
  font-weight: 900;
}

.nav small,
.eyebrow,
.panel-head p,
.footer {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: end;
  padding: clamp(32px, 6vw, 72px) clamp(12px, 4vw, 44px) 20px;
}

h1 {
  margin: 0;
  font-size: clamp(3.4rem, 8vw, 7.8rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

h1 em {
  color: var(--pink);
  font-style: normal;
}

.lead {
  max-width: 620px;
  color: #594b58;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.65;
}

.brief-card {
  min-height: 230px;
  padding: 26px;
  border-radius: 30px;
  color: white;
  background: #19121b;
}

.brief-card span {
  display: block;
  color: #ffc7df;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.brief-card strong {
  display: block;
  margin-top: 56px;
  font-size: 1.32rem;
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metrics article {
  border-radius: 24px;
  padding: 20px;
}

.metrics small {
  color: var(--muted);
  font-weight: 800;
}

.metrics b {
  display: block;
  margin-top: 10px;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.panel {
  margin-top: 18px;
  border-radius: 28px;
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-head.compact { margin-bottom: 10px; }
.panel-head p,
.panel-head h2 { margin: 0; }
.panel-head h2 {
  margin-top: 6px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.05em;
}

input[type="search"] {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  outline: none;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.up { color: var(--red); font-weight: 800; }
.down { color: var(--green); font-weight: 800; }

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rank-list li,
.news-item {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.rank-line,
.news-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rank-line b,
.news-item b {
  letter-spacing: -0.02em;
}

.rank-list small,
.news-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.news-item p {
  margin: 0;
  color: #473b46;
  line-height: 1.6;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 18px 22px;
  border-radius: 22px;
}

.live-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.calendar-tab,
.preset-grid button,
.secondary-button,
.export-actions button,
.results-form button,
.tracked-controls button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.calendar-tab.active,
.preset-grid button.active {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 20px;
  align-items: start;
}

.calendar-view {
  min-height: 580px;
}

.calendar-view-head,
.tracked-controls > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.calendar-view-head small,
.tracked-controls label,
.detail-select,
.export-status,
.source-description,
.results-form p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.calendar-view-head strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.18rem;
}

.month-calendar-panel {
  margin-top: 16px;
}

.month-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.month-toolbar > div {
  display: flex;
  gap: 6px;
}

.month-toolbar button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.month-toolbar strong {
  font-size: 1.16rem;
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  min-width: 644px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.month-calendar-scroll {
  overflow-x: auto;
}

.month-weekday {
  padding: 9px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(238, 242, 238, 0.75);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.month-day {
  min-height: 116px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.month-day.outside {
  color: #a8a1a8;
  background: rgba(242, 244, 241, 0.66);
}

.month-day.today {
  box-shadow: inset 0 0 0 2px #168577;
}

.month-day-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 900;
}

.month-day.today .month-day-number {
  color: white;
  background: #168577;
}

.month-event-chip {
  margin-top: 4px;
  padding: 4px 5px;
  border-left: 3px solid var(--blue);
  color: #34404d;
  background: #f1f5ff;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-event-chip.macro {
  border-left-color: #de7435;
  background: #fff4ed;
}

.month-event-chip.disposition {
  border-left-color: #dc4b64;
  background: #fff0f3;
}

.month-event-chip.attention {
  border-left-color: #d69428;
  background: #fff8e9;
}

.month-event-chip.earnings {
  border-left-color: #168577;
  background: #edf8f6;
}

.month-more {
  margin-top: 5px;
  color: #168577;
  font-size: 0.67rem;
  font-weight: 900;
}

.tracked-controls {
  margin-top: 16px;
  padding: 15px;
  border-radius: 18px;
  background: #fff5f9;
}

.tracked-controls input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font: inherit;
}

.calendar-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.calendar-event {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.calendar-event time {
  color: var(--pink);
  font-size: 0.82rem;
  font-weight: 900;
}

.calendar-event b,
.calendar-event p {
  margin: 0;
}

.calendar-event p {
  margin-top: 5px;
  color: #594b58;
  font-size: 0.88rem;
  line-height: 1.5;
}

.calendar-event small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.empty-state {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.export-card {
  position: sticky;
  top: 18px;
  padding: 22px;
  border-radius: 24px;
  color: white;
  background: var(--ink);
}

.export-card > p:first-child {
  margin: 0;
  color: #ffbbd7;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.export-card h3 {
  margin: 6px 0 18px;
  font-size: 1.55rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.preset-grid button,
.export-actions button {
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.preset-grid button.active {
  border-color: white;
  color: var(--ink);
  background: white;
}

.date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 9px;
  align-items: end;
  margin-top: 15px;
}

.date-range label,
.results-form label {
  font-size: 0.76rem;
  font-weight: 800;
}

.date-range input,
.results-form input,
.detail-select select {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 10px;
  color: inherit;
  background: rgba(255, 255, 255, 0.09);
  font: inherit;
  color-scheme: dark;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 17px 0 0;
  padding: 0;
  border: 0;
}

.check-grid legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: #d9cdd7;
  font-size: 0.76rem;
  font-weight: 800;
}

.check-grid label {
  font-size: 0.84rem;
}

.detail-select {
  display: block;
  margin-top: 17px;
  color: #d9cdd7;
  font-weight: 800;
}

.detail-select select {
  color: white;
}

.detail-select option {
  color: var(--ink);
}

.export-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.export-actions button {
  width: 100%;
  border-radius: 12px;
  text-align: left;
}

.export-actions button:disabled,
.results-form button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.export-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: #ffbdd8;
}

.source-description {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.results-form {
  display: grid;
  grid-template-columns: minmax(210px, 280px) auto minmax(240px, 1fr);
  gap: 14px;
  align-items: end;
}

.results-form input {
  border-color: var(--line);
  color: var(--ink);
  background: white;
  color-scheme: light;
}

.results-form button {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.results-form p {
  margin: 0 0 10px;
}

@media (max-width: 820px) {
  .hero-grid,
  .grid.two,
  .metrics,
  .calendar-layout,
  .results-form {
    grid-template-columns: 1fr;
  }
  .panel-head,
  .footer,
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-view {
    min-height: 0;
  }

  .month-calendar-panel {
    overflow-x: auto;
  }

  .export-card {
    position: static;
  }

  .calendar-event {
    grid-template-columns: 1fr;
  }
}
