/* =====================================================================
   TODAY HUB — dashboard hero (greeting + clock status / ops degrade).
   Uses existing theme tokens; subtle motion; respects prefers-reduced-motion.
   ===================================================================== */

.today-hub {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px 28px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
}

.today-hub__glow {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 55%;
  height: 120%;
  background: radial-gradient(
    ellipse at 30% 20%,
    rgba(var(--success-rgb), 0.08) 0%,
    transparent 55%
  );
  pointer-events: none;
  z-index: 0;
}

.today-hub.is-clocked-in .today-hub__glow {
  background: radial-gradient(
    ellipse at 30% 20%,
    rgba(var(--success-rgb), 0.14) 0%,
    transparent 60%
  );
}

.today-hub > *:not(.today-hub__glow) {
  position: relative;
  z-index: 1;
}

.today-hub__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.today-hub__eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 6px;
}

.today-hub__greeting {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 6px;
  line-height: var(--leading-tight);
}

.today-hub__name {
  color: var(--secondary);
}

.today-hub__status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.today-hub.is-clocked-in .today-hub__status {
  color: var(--success);
}

.today-hub__clock-now {
  text-align: right;
  flex-shrink: 0;
  min-width: 7.5rem;
}

.today-hub__clock-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.today-hub__clock-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* ----- Staff body: ring + timeline + metrics ----- */
.today-hub__body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px 32px;
  align-items: center;
}

.today-hub__ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.today-hub__ring {
  display: block;
  transform: rotate(-90deg);
}

.today-hub__ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.today-hub__ring-fill {
  fill: none;
  stroke: var(--success);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.today-hub.is-clocked-in .today-hub__ring-fill {
  filter: drop-shadow(0 0 6px rgba(var(--success-rgb), 0.35));
}

.today-hub__ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.today-hub__ring-hours {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.today-hub__ring-pct {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.today-hub__shift { min-width: 0; }

.today-hub__timeline {
  margin-bottom: 18px;
}

.today-hub__timeline-track {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: visible;
  margin-bottom: 10px;
}

.today-hub__timeline-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--success) 55%, transparent),
    var(--success)
  );
  border-radius: 999px;
  transition: width 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

.today-hub__timeline-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--fg);
  border: 2px solid var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
  transition: left 350ms cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
}

.today-hub.is-clocked-in .today-hub__timeline-marker {
  opacity: 1;
  animation: today-hub-marker-pulse 2.4s ease-in-out infinite;
}

@keyframes today-hub-marker-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 12%, transparent); }
}

.today-hub__timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.today-hub__placeholder-mark {
  font-style: normal;
  font-size: 0.6rem;
  opacity: 0.65;
  margin-left: 2px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

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

.today-hub__metric {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin: 0;
  transition: border-color 200ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.today-hub__metric:hover {
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.today-hub__metric dt {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0 0 4px;
}

.today-hub__metric dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.today-hub__metric--placeholder dd {
  color: var(--fg-muted);
  font-weight: 500;
}

.today-hub__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.today-hub__clock-btn {
  min-width: 140px;
}

.today-hub__clock-btn.is-out {
  background: var(--danger) !important;
  background-image: none !important;
}

.today-hub__hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.today-hub__checklist-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.today-hub__checklist-strip a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.today-hub__checklist-strip a:hover { color: var(--fg); }
.today-hub__checklist-strip strong { color: var(--fg); font-weight: 600; }
.today-hub__checklist-strip--overdue,
.today-hub__checklist-strip--overdue strong { color: var(--danger); }

/* ----- Clock activity strip ----- */
.today-hub__activity {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.today-hub__activity-title {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 12px;
  font-weight: 500;
}

.today-hub__activity-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: 0;
  padding: 0;
}

.today-hub__activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--fg-muted);
  opacity: 0;
  transform: translateY(4px);
  animation: today-hub-activity-in 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.today-hub__activity-item time {
  color: var(--fg);
  margin-left: 4px;
}

.today-hub__activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.today-hub__activity-dot--clock_in { background: var(--success); }
.today-hub__activity-dot--clock_out { background: var(--danger); }

.today-hub__activity-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fg-muted);
}

@keyframes today-hub-activity-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Owner / manager ops degrade ----- */
.today-hub__ops-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.today-hub__ops-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 200ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.today-hub__ops-stat:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.today-hub__ops-num {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.today-hub__ops-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.today-hub__ops-stat--done .today-hub__ops-num { color: var(--success); }
.today-hub__ops-stat--overdue .today-hub__ops-num { color: var(--danger); }

/* ----- Mobile: clock card always on top via order; stack metrics ----- */
@media (max-width: 768px) {
  .today-hub {
    padding: 22px 18px 18px;
    /* Ensure hub stays above checklist column content in document flow */
    order: -1;
  }

  .today-hub__header {
    flex-direction: column;
    gap: 14px;
  }

  .today-hub__clock-now {
    text-align: left;
  }

  .today-hub__body {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
  }

  .today-hub__shift {
    width: 100%;
  }

  .today-hub__metrics {
    grid-template-columns: 1fr 1fr;
  }

  .today-hub__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .today-hub__clock-btn {
    width: 100%;
  }

  .today-hub__hint {
    text-align: center;
  }
}

@media (max-width: 400px) {
  .today-hub__metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .today-hub__ring-fill,
  .today-hub__timeline-fill,
  .today-hub__timeline-marker,
  .today-hub__metric,
  .today-hub__ops-stat {
    transition: none !important;
  }

  .today-hub.is-clocked-in .today-hub__timeline-marker,
  .today-hub__activity-item {
    animation: none !important;
  }

  .today-hub__activity-item {
    opacity: 1;
    transform: none;
  }

  .today-hub.is-clocked-in .today-hub__ring-fill {
    filter: none;
  }
}
