:root {
  color-scheme: dark;
  --bg: #020506;
  --panel: #071015;
  --panel-2: #0a1217;
  --line: rgba(222, 169, 63, .28);
  --line-soft: rgba(189, 206, 214, .14);
  --gold: #e7ad35;
  --gold-light: #ffd978;
  --text: #f4f5f3;
  --muted: #96a0a5;
  --green: #53d474;
  --red: #ff5b4d;
  --blue: #5aa7ff;
  --purple: #bd83ff;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 65% -10%, rgba(42, 95, 122, .15), transparent 34rem),
    linear-gradient(145deg, #010304 0%, #071016 52%, #020405 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .01em;
}
button, input { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 50; padding: .65rem 1rem; background: var(--gold); color: #080603; }
.skip-link:focus { top: 1rem; }

.site-header {
  min-height: 72px;
  padding: 0 1.4rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(230px, .9fr) minmax(560px, 1.5fr) minmax(140px, .45fr);
  align-items: center;
  gap: 1.25rem;
  background: rgba(1, 4, 5, .92);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand > span { display: grid; }
.brand strong { font-size: 1.2rem; letter-spacing: .16em; }
.brand strong span { color: var(--gold); }
.brand small { margin-top: .18rem; color: #b3b9bc; font-size: .55rem; letter-spacing: .11em; }
.site-header nav { height: 100%; display: flex; align-items: stretch; justify-content: center; }
.site-header nav a { min-width: 108px; display: grid; place-items: center; padding: 0 .85rem; color: #c5cbce; font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-decoration: none; text-transform: uppercase; border-bottom: 2px solid transparent; }
.site-header nav a:hover, .site-header nav a:focus-visible, .site-header nav a.active { color: var(--gold-light); background: linear-gradient(180deg, transparent, rgba(218, 161, 44, .08)); border-bottom-color: var(--gold); }
.terminal-link { justify-self: end; padding: .62rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--gold-light); font-size: .67rem; letter-spacing: .09em; text-decoration: none; text-transform: uppercase; }

.calendar-shell { max-width: 1740px; margin: 0 auto; padding: 1rem; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; }
.filters, .calendar-panel, .calendar-footer, .next-impact, .summary-strip > div, .mobile-day-panel {
  background: linear-gradient(145deg, rgba(11, 20, 25, .96), rgba(4, 9, 12, .98));
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px rgba(255, 255, 255, .025), 0 18px 50px rgba(0, 0, 0, .16);
}
.filters { min-height: calc(100vh - 104px); border-radius: 10px; padding: 1rem; }
.filters-heading { display: flex; align-items: center; justify-content: space-between; padding: .25rem 0 1rem; }
.filters-heading strong, fieldset legend, .scope-note strong, .source-health strong { color: var(--gold-light); font-size: .7rem; letter-spacing: .1em; }
.filters-heading button { color: #aab2b6; border: 0; background: transparent; font-size: .65rem; cursor: pointer; }
.search-field { height: 40px; display: flex; align-items: center; gap: .55rem; padding: 0 .7rem; border: 1px solid var(--line-soft); border-radius: 6px; color: #8e999f; background: rgba(0, 0, 0, .25); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: .75rem; }
.filters fieldset { margin: 1.25rem 0 0; padding: 0; border: 0; }
.filters fieldset legend { margin-bottom: .7rem; }
.filters fieldset label { min-height: 34px; display: flex; align-items: center; gap: .55rem; color: #d2d6d8; font-size: .75rem; cursor: pointer; }
.filters input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--gold); }
.source-dot, .type-dot, .impact-dot { width: 8px; height: 8px; border-radius: 50%; background: #829097; box-shadow: 0 0 10px currentColor; }
.source-dot.bea, .type-dot.economic { color: #dd715b; background: currentColor; }
.source-dot.bls { color: var(--blue); background: currentColor; }
.source-dot.fed, .type-dot.central { color: var(--purple); background: currentColor; }
.impact-dot.high { color: var(--red); background: currentColor; }
.impact-dot.standard { color: #829097; background: currentColor; }
.scope-note, .source-health { margin-top: 1.4rem; padding: .9rem; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(0, 0, 0, .2); }
.scope-note p, .source-health p { margin: .55rem 0 0; color: #9ca6ab; font-size: .67rem; line-height: 1.55; }
.source-health ul { margin: .6rem 0 0; padding: 0; display: grid; gap: .45rem; list-style: none; }
.source-health li { display: flex; align-items: center; justify-content: space-between; color: #c8ced1; font-size: .67rem; }
.source-health li span:last-child { color: var(--green); text-transform: uppercase; }
.source-health li.unavailable span:last-child { color: var(--red); }

.calendar-workspace { min-width: 0; }
.calendar-hero { min-height: 112px; display: grid; grid-template-columns: minmax(300px, 1.4fr) minmax(400px, 1fr) minmax(245px, .72fr); align-items: center; gap: 1rem; padding: .2rem .7rem 1rem; }
.eyebrow { color: var(--gold); font-size: .64rem; font-weight: 800; letter-spacing: .15em; }
.calendar-hero h1 { margin: .18rem 0 .2rem; font: 700 clamp(1.8rem, 3vw, 2.65rem)/1 Georgia, "Times New Roman", serif; letter-spacing: .02em; }
.calendar-hero > div > p { max-width: 580px; margin: 0; color: #c4cbce; font-size: .8rem; line-height: 1.5; }
.summary-strip { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.summary-strip > div { min-height: 72px; display: grid; place-content: center; text-align: center; border-width: 0 0 0 1px; }
.summary-strip dt { color: var(--gold-light); font: 700 1.4rem/1 Georgia, serif; }
.summary-strip dd { margin: .35rem 0 0; color: #abb4b8; font-size: .58rem; line-height: 1.25; letter-spacing: .06em; }
.next-impact { min-height: 82px; padding: .8rem 1rem; border-radius: 8px; display: grid; align-content: center; }
.next-impact small { color: #c6ccd0; font-size: .6rem; letter-spacing: .08em; }
.next-impact strong { margin-top: .3rem; color: var(--text); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-impact span { margin-top: .25rem; color: var(--gold-light); font-size: .68rem; }

.calendar-tabs { min-height: 42px; display: flex; gap: 1rem; align-items: end; border-bottom: 1px solid var(--line-soft); }
.calendar-tabs button { height: 42px; padding: 0 .85rem; border: 0; border-bottom: 2px solid transparent; color: #9fa8ad; background: transparent; font-size: .67rem; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.calendar-tabs button[aria-selected="true"] { color: var(--gold-light); border-bottom-color: var(--gold); }
.calendar-panel { position: relative; margin-top: .75rem; overflow: hidden; border-radius: 10px; }
.calendar-toolbar { min-height: 58px; padding: .45rem .75rem; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: .7rem; border-bottom: 1px solid var(--line-soft); }
.back-button, .refresh-button { border: 1px solid var(--line-soft); border-radius: 5px; color: #d7dcde; background: #071015; text-decoration: none; cursor: pointer; }
.back-button { width: 38px; height: 36px; display: grid; place-items: center; font-size: 1.6rem; }
.refresh-button { padding: .55rem .8rem; color: var(--gold-light); font-size: .65rem; text-transform: uppercase; letter-spacing: .07em; }
.window-label { color: #9fa9ad; font-size: .55rem; letter-spacing: .12em; }
.calendar-toolbar h2 { margin: .1rem 0 0; font: 500 1.1rem/1.2 Georgia, serif; letter-spacing: .05em; text-transform: uppercase; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { height: 32px; border-bottom: 1px solid var(--line-soft); }
.weekday-row span { display: grid; place-items: center; border-left: 1px solid var(--line-soft); color: #aeb6ba; font-size: .6rem; letter-spacing: .08em; }
.weekday-row span:first-child { border-left: 0; }
.calendar-grid { min-height: 620px; background: rgba(0, 0, 0, .08); }
.day-cell { position: relative; min-width: 0; min-height: 124px; padding: .55rem; border: solid var(--line-soft); border-width: 0 0 1px 1px; outline: 0; overflow: hidden; }
.day-cell:nth-child(7n+1) { border-left: 0; }
.day-cell.outside { color: #536067; background: rgba(0, 0, 0, .22); }
.day-cell.today, .day-cell.selected { box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 30px rgba(221, 164, 45, .07); }
.day-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--gold-light); }
.day-number { display: flex; align-items: center; justify-content: space-between; color: #eceded; font: 700 .75rem/1 Georgia, serif; }
.outside .day-number { color: #657178; }
.event-count { color: #7f8b91; font: 500 .5rem/1 Inter, sans-serif; letter-spacing: .05em; }
.events { margin-top: .5rem; display: grid; gap: .35rem; }
.event-chip { width: 100%; min-width: 0; padding: .35rem .4rem; border: 0; border-left: 2px solid #7c8990; border-radius: 3px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem; text-align: left; color: #d9dddf; background: rgba(19, 31, 37, .76); cursor: pointer; }
.event-chip:hover, .event-chip:focus-visible { color: #fff; background: rgba(35, 49, 55, .96); outline: 1px solid var(--line); }
.event-chip.market-moving { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(222, 169, 63, .14), rgba(16, 27, 33, .82)); }
.event-agency { color: var(--gold-light); font-size: .48rem; font-weight: 900; }
.event-copy { min-width: 0; }
.event-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .59rem; font-weight: 650; }
.event-copy small { display: block; margin-top: .16rem; color: #939ea3; font-size: .5rem; }
.more-events { color: var(--gold-light); font-size: .52rem; }
.event-dots { display: none; }

.calendar-state { position: absolute; inset: 91px 0 0; display: grid; place-content: center; justify-items: center; text-align: center; background: rgba(3, 8, 10, .93); z-index: 5; }
.calendar-state.hidden { display: none; }
.calendar-state strong { margin-top: .75rem; font: 500 1.35rem Georgia, serif; }
.calendar-state p { max-width: 420px; margin: .45rem 1rem 0; color: #96a0a5; font-size: .75rem; line-height: 1.5; }
.state-orbit { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 0 24px rgba(231, 173, 53, .18); animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.82); box-shadow: 0 0 40px rgba(231, 173, 53, .38); } }

.mobile-day-panel { display: none; }
.calendar-footer { margin-top: .75rem; padding: .8rem 1rem; border-radius: 8px; display: grid; grid-template-columns: 1.4fr .8fr 1.5fr .8fr; gap: 1rem; }
.calendar-footer strong { color: var(--gold-light); font-size: .58rem; letter-spacing: .09em; }
.calendar-footer p { margin: .35rem 0 0; color: #9da6aa; font-size: .62rem; line-height: 1.45; }
.calendar-footer a { color: #b9c6cc; text-decoration-color: rgba(231, 173, 53, .5); }

.event-dialog { width: min(480px, calc(100vw - 2rem)); padding: 1.5rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: linear-gradient(145deg, #0c161b, #030708); box-shadow: 0 32px 90px #000; }
.event-dialog::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(6px); }
.event-dialog > button { position: absolute; right: .8rem; top: .65rem; border: 0; color: #aab3b7; background: transparent; font-size: 1.5rem; cursor: pointer; }
.event-dialog > small { color: var(--gold); font-size: .62rem; letter-spacing: .1em; }
.event-dialog h2 { margin: .5rem 2rem 1rem 0; font: 500 1.6rem/1.2 Georgia, serif; }
.event-dialog dl { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.event-dialog dl div { padding: .65rem; border: 1px solid var(--line-soft); border-radius: 5px; }
.event-dialog dt { color: #88949a; font-size: .54rem; letter-spacing: .08em; }
.event-dialog dd { margin: .28rem 0 0; color: #dfe3e4; font-size: .7rem; }
.event-dialog a { display: inline-block; margin-top: .8rem; color: var(--gold-light); font-size: .7rem; }

@media (max-width: 1240px) {
  .site-header { grid-template-columns: 220px 1fr auto; }
  .site-header nav a { min-width: auto; }
  .calendar-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .calendar-hero { grid-template-columns: 1fr 1fr; }
  .calendar-hero > div { grid-column: 1; }
  .summary-strip { grid-column: 2; }
  .next-impact { grid-column: 1 / -1; }
  .calendar-grid { min-height: 570px; }
  .day-cell { min-height: 112px; }
}

@media (max-width: 920px) {
  .site-header { min-height: 64px; grid-template-columns: 1fr auto; }
  .site-header nav { display: none; }
  .terminal-link { font-size: .6rem; }
  .calendar-shell { display: block; padding: .7rem; }
  .filters { min-height: auto; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem 1rem; margin-bottom: .7rem; }
  .filters-heading, .search-field, .scope-note, .source-health { grid-column: 1 / -1; }
  .filters fieldset { margin: .25rem 0; }
  .calendar-hero { grid-template-columns: 1fr; }
  .calendar-hero > div, .summary-strip, .next-impact { grid-column: 1; }
}

@media (max-width: 680px) {
  .site-header { padding: 0 .7rem; }
  .brand img { width: 38px; height: 38px; }
  .brand strong { font-size: .92rem; }
  .brand small { display: none; }
  .terminal-link { padding: .5rem .65rem; }
  .filters { grid-template-columns: 1fr; }
  .filters fieldset { display: none; }
  .filters-heading, .search-field, .scope-note, .source-health { grid-column: 1; }
  .scope-note { display: none; }
  .calendar-hero { padding: .35rem .25rem .75rem; }
  .calendar-hero h1 { font-size: 1.8rem; }
  .calendar-hero > div > p { font-size: .72rem; }
  .summary-strip > div { min-height: 62px; }
  .summary-strip dt { font-size: 1.15rem; }
  .next-impact { min-height: 70px; }
  .calendar-tabs { overflow-x: auto; gap: .2rem; }
  .calendar-tabs button { flex: 0 0 auto; padding: 0 .62rem; font-size: .58rem; }
  .calendar-toolbar { grid-template-columns: 34px 1fr auto; }
  .back-button { width: 32px; height: 32px; }
  .refresh-button { width: 34px; overflow: hidden; color: transparent; padding: 0; position: relative; }
  .refresh-button::after { content: "↻"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold-light); font-size: 1rem; }
  .weekday-row { height: 28px; }
  .calendar-grid { min-height: 0; }
  .day-cell { min-height: 62px; padding: .4rem .3rem; cursor: pointer; }
  .day-number { justify-content: center; font-size: .72rem; }
  .event-count { display: none; }
  .events { display: none; }
  .event-dots { min-height: 12px; margin-top: .35rem; display: flex; justify-content: center; gap: 3px; }
  .event-dots i { width: 4px; height: 4px; border-radius: 50%; background: #7e8b91; }
  .event-dots i.high { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
  .mobile-day-panel { margin-top: .7rem; padding: .85rem; border-radius: 8px; display: block; }
  .mobile-day-panel h2 { margin: 0; color: var(--gold-light); font-size: .67rem; letter-spacing: .09em; }
  .mobile-day-panel > p { margin: .4rem 0 0; color: #99a4a9; font-size: .68rem; }
  .mobile-day-panel .mobile-event { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--line-soft); }
  .mobile-event button { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
  .mobile-event small { color: var(--gold); font-size: .55rem; }
  .mobile-event strong { display: block; margin-top: .2rem; font: 500 .95rem/1.25 Georgia, serif; }
  .mobile-event span { display: block; margin-top: .25rem; color: #97a2a7; font-size: .62rem; }
  .calendar-footer { grid-template-columns: 1fr 1fr; }
  .calendar-footer > div:first-child { grid-column: 1 / -1; }
  .calendar-footer > div:nth-child(3) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { .state-orbit { animation: none; } }
