/* Economic calendar widget (econ-calendar.js). Uses each page's own tokens;
   fallbacks cover the token names that differ between pages
   (--danger on sub-pages, --risk on the home page). */
.ecal {
  --ecal-good: var(--profit, oklch(72% 0.16 150));
  --ecal-bad: var(--danger, var(--risk, oklch(68% 0.18 25)));
  --ecal-warn: var(--warn, oklch(78% 0.14 75));
  --ecal-line: var(--border, oklch(28% 0.025 245));
  --ecal-muted: var(--muted, oklch(62% 0.015 240));
  color: var(--fg);
  font-family: var(--font-body, Inter, system-ui, sans-serif);
}
.ecal__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ecal__title {
  margin: 0; font-family: var(--font-display, inherit);
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--fg);
}
.ecal--page .ecal__title { font-size: 20px; }
.ecal__stamp { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 12px; color: var(--ecal-muted); }
.ecal__pulse {
  display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: var(--ecal-good); vertical-align: 1px;
  animation: ecal-pulse 2s ease-in-out infinite;
}
@keyframes ecal-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .ecal__pulse { animation: none; } }
.ecal__spacer { flex: 1; }

.ecal__seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--ecal-line); border-radius: 10px; background: var(--surface, transparent);
}
.ecal__seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  min-height: 32px; padding: 5px 11px; border-radius: 7px;
  font: 600 12.5px/1 var(--font-body, Inter, system-ui, sans-serif); color: var(--ecal-muted);
  transition: background 140ms ease, color 140ms ease;
}
.ecal__seg button:not([aria-pressed="true"]):hover { color: var(--fg); }
.ecal__seg button[aria-pressed="true"] { background: var(--accent); color: #0d0d12; }
.ecal__seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ecal__scroll {
  overflow-x: auto; margin-top: 12px;
  border: 1px solid var(--ecal-line); border-radius: 12px; background: var(--surface, transparent);
}
.ecal__table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.ecal__table th {
  text-align: left; padding: 9px 12px; white-space: nowrap;
  font-family: var(--font-mono, ui-monospace, Menlo, monospace);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ecal-muted); border-bottom: 1px solid var(--ecal-line);
}
.ecal__table td { padding: 7px 12px; border-bottom: 1px solid var(--ecal-line); vertical-align: middle; }
.ecal__table tbody tr:last-child td { border-bottom: 0; }
.ecal__table th.num, .ecal__table td.num {
  text-align: right; white-space: nowrap;
  font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-feature-settings: 'tnum' 1;
}
.ecal__day td {
  background: var(--surface-2, transparent); color: var(--ecal-muted);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding-block: 6px;
}
.ecal__today {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: #0d0d12; font-size: 10px; letter-spacing: 0.05em;
}
.ecal__time { white-space: nowrap; font-family: var(--font-mono, ui-monospace, Menlo, monospace); color: var(--fg-soft, var(--fg)); }
.ecal__ccy { font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.ecal__event { color: var(--fg); }
.ecal__past td { opacity: 0.72; }
.ecal__past .ecal__actual--better, .ecal__past .ecal__actual--worse { opacity: 1; }
.ecal__soon td { background: color-mix(in oklch, var(--ecal-warn) 14%, transparent); }

.ecal__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.ecal__dot--high { background: var(--ecal-bad); }
.ecal__dot--medium { background: oklch(74% 0.16 55); }
.ecal__dot--low { background: var(--ecal-warn); opacity: 0.85; }
.ecal__dot--none { background: var(--ecal-muted); opacity: 0.6; }

.ecal__actual--better { color: var(--ecal-good); font-weight: 700; }
.ecal__actual--worse { color: var(--ecal-bad); font-weight: 700; }
.ecal__actual--flat { font-weight: 700; }
.ecal__pending { color: var(--ecal-muted); }
.ecal__msg { padding: 18px 14px !important; color: var(--ecal-muted); font-size: 13px; text-align: center; }

.ecal__foot {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; align-items: center;
  margin-top: 10px; font-size: 12px; color: var(--ecal-muted);
}
.ecal__more { color: var(--accent); font-weight: 600; white-space: nowrap; }
.ecal__more:hover { text-decoration: underline; }

.ecal__sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ecal__narrow { display: none; }

@media (max-width: 720px) {
  .ecal__spacer { display: none; }
  .ecal__stamp { flex-basis: 100%; order: 1; margin-top: -4px; }
  .ecal__title { flex: 1; }
  .ecal__seg { order: 2; }
  .ecal__table { min-width: 0; font-size: 12px; table-layout: fixed; }
  .ecal__table th, .ecal__table td { padding: 6px 6px; }
  .ecal__table th { font-size: 9.5px; letter-spacing: 0.03em; }
  .ecal__table th:nth-child(7), .ecal__table td:nth-child(7) { display: none; }
  .ecal__table th:nth-child(1) { width: 19%; }
  .ecal__table th:nth-child(2) { width: 6%; }
  .ecal__table th:nth-child(3) { width: 12%; }
  .ecal__table th:nth-child(4) { width: 35%; }
  .ecal__table th:nth-child(5), .ecal__table th:nth-child(6) { width: 14%; }
  .ecal__time { font-size: 11px; }
  .ecal__table th:nth-child(1), .ecal__table td:nth-child(1) { padding-right: 2px; }
  .ecal__table th:nth-child(2), .ecal__table td:nth-child(2) { padding-inline: 2px; text-align: center; }
  .ecal__table td { overflow-wrap: anywhere; }
  .ecal__day td { overflow-wrap: normal; }
  .ecal__wide { display: none; }
  .ecal__narrow { display: inline; }
  .ecal__seg button { padding: 5px 9px; font-size: 12px; }
}
