/* The calendar itself: the controls, the day rails and the company cards.
 *
 * Split out of calendar.css so the signed-in app can render the same calendar
 * inside its own shell. calendar.css keeps what is page chrome on the public
 * /calendar page - the :root tokens, the topbar, the hero, the footer - all of
 * which the app already provides and would be fighting over if this were one
 * file. Both pages load this one, so a card change lands on both at once
 * rather than drifting between two copies.
 *
 * Load order: after calendar.css on /calendar, after styles.css in the app.
 */

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seg { display: flex; flex-wrap: wrap; background: var(--panel-soft); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 6px;
  cursor: pointer;
}
.seg button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 33, 29, 0.12); }
.field-search {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel);
  flex: 1 1 200px;
  min-width: 0;
}
.field-search::placeholder { color: #93a09b; }
.controls-meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; font-family: var(--font-mono); }

/* ---------- Day sub-filter (Last/Next 7 days, Next 2 weeks) ---------- */
.day-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.day-chip-dow { letter-spacing: 0.06em; }
.day-chip-dom { color: var(--ink); font-weight: 700; }
.day-chip.active { background: var(--accent); border-color: var(--accent); }
.day-chip.active .day-chip-dow, .day-chip.active .day-chip-dom { color: #fff; }

/* ---------- Day groups ---------- */
.calendar { padding-block: 26px 60px; display: flex; flex-direction: column; gap: 26px; }
.day-group { display: flex; gap: 18px; }
.day-rail { flex: 0 0 84px; text-align: right; padding-top: 4px; }
.day-rail .dow { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.day-rail .dom { font-family: var(--font-sans); font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.day-rail .count { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-top: 2px; }
.day-group.is-today .day-rail .dom { color: var(--accent); }
.day-group.is-today .day-rail::before {
  content: "TODAY";
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 4px;
}
.day-body { flex: 1 1 auto; min-width: 0; border-left: 1px solid var(--line); padding-left: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

/* ---------- Ticker card ---------- */
.tcard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tcard.reported { border-color: var(--accent); }
.tcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tcard-id { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
/* Scoped to the card: the app renders its own `.chip.ticker` in Topics cards and
   loads this file, so a bare `.ticker` here would reach into them. Every calendar
   ticker is the link in a card header. */
.tcard-id .ticker { font-family: var(--font-mono); font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; }
.tcard-id a.ticker:hover, .tcard-id a.ticker:focus-visible { color: var(--accent); text-decoration: underline; }
.cname { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-pill {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 7px;
}
.time-pill.bmo { background: var(--amber-soft); color: var(--amber); }
.time-pill.amc { background: var(--blue-soft); color: var(--blue); }
.time-pill.tbd { background: var(--panel-soft); color: var(--muted); }

.tcard-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.stat-block { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.3; }

.beat-pill, .miss-pill, .na-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 5px;
  white-space: nowrap;
}
.beat-pill { background: var(--accent-soft); color: var(--accent); }
.miss-pill { background: var(--miss-soft); color: var(--miss); }
.na-pill { background: var(--panel-soft); color: var(--muted); }

.stat-block--empty {
  font-family: var(--font-sans);
  font-size: 11px;
  font-style: italic;
  color: var(--muted);
}

/* Tone value is a short LLM-written phrase (see loadEarningsSummary() in
   calendar.js), not always a single word ("Highly positive and confident"),
   so label and value stack instead of sharing a row - a side-by-side layout
   wrapped and overlapped once the value stopped being one word. Color is
   picked per card by toneCssClass() in calendar.js off the actual value
   (positive/negative/mixed/neutral), reusing the same tokens the rest of
   the page already uses for the same meanings - beat-pill/reported-border
   green for positive, miss-pill red for negative - not new colors. */
.tone-bar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-sans);
  font-size: 11.5px;
}
.tone-bar .tone-value { display: block; font-weight: 700; line-height: 1.35; }
.tone-bar.positive { background: var(--accent-soft); color: var(--muted); }
.tone-bar.positive .tone-value { color: var(--accent); }
.tone-bar.negative { background: var(--miss-soft); color: var(--muted); }
.tone-bar.negative .tone-value { color: var(--miss); }
.tone-bar.mixed { background: var(--amber-soft); color: var(--muted); }
.tone-bar.mixed .tone-value { color: var(--amber); }
.tone-bar.neutral { background: var(--panel-soft); color: var(--muted); }

.upsell-link {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid #edf0ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.upsell-link .arrow { transition: transform 0.15s ease; }
.tcard:hover .upsell-link .arrow { transform: translateX(2px); }

.upsell-teaser { font-family: var(--font-sans); font-size: 10px; color: var(--muted); line-height: 1.4; }

/* Scoped: styles.css has its own .empty-state for the app's panels. Every
   calendar empty state renders inside #calendarBody, which carries .calendar. */
.calendar .empty-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 620px) {
  .day-group { gap: 12px; }
  .day-rail { flex-basis: 56px; }
  .day-rail .dom { font-size: 18px; }
  .day-body { padding-left: 12px; }
  .controls-meta { margin-left: 0; width: 100%; }
  h1.headline { max-width: 100%; }
}
