@layer page {
  /* ===== Hub layout ===== */
  .agenda-hub {
    padding-bottom: calc(var(--nav-bar-height) + 16px);
    display: flex;
    flex-direction: column;
  }

  /* "Novo" CTA — outlined gray chip in the hub header, matching the muted icon buttons. */
  .agenda-new-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px 6px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;

    svg {
      width: 16px;
      height: 16px;
    }

    &:active {
      background: var(--color-bg-tertiary);
    }
  }

  /* ===== Schedule section — edge-to-edge "active day is the screen" ===== */
  .agenda-schedule {
    overflow: hidden;
  }

  /* ===== Day-tab strip ===== */
  .agenda-day-tabs {
    display: flex;
    gap: 4px;
    padding: 4px var(--content-padding) 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .agenda-day-tabs::-webkit-scrollbar {
    display: none;
  }

  .agenda-day-tab {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 46px;
    padding: 8px 10px 9px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-muted);

    &:active {
      background: var(--color-bg-tertiary);
    }
  }

  .agenda-day-tab-dow {
    font-size: var(--text-label);
    letter-spacing: 0.3px;
    text-transform: capitalize;
  }

  .agenda-day-tab-dom {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
  }

  /* Today: a faint crimson-tinted chip marks "you are here" while leaving the
     stronger filled treatment to the currently-selected day. */
  .agenda-day-tab.is-today {
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-text);

    .agenda-day-tab-dom {
      color: var(--color-text);
    }
  }

  /* Active tab is a standalone filled chip — a slightly lightened crimson that
     unifies with the selected month tab on the history page. Defined after
     .is-today so the selected day always wins when it is also today. */
  .agenda-day-tab.is-active {
    background: var(--color-primary-selected);
    color: #fff;
    border-radius: var(--radius-md);

    &:active {
      background: var(--color-primary-selected);
    }

    .agenda-day-tab-dom {
      color: #fff;
    }
  }

  /* ===== Content surface (header + list) — only the active tab carries a fill ===== */
  .agenda-schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--content-padding) 8px;
  }

  .agenda-schedule-date {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
  }

  .agenda-schedule-count {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-caption);
    font-weight: var(--font-weight-medium);
    color: var(--color-muted);
    text-decoration: none;

    svg {
      width: 16px;
      height: 16px;
    }

    &:active {
      opacity: 0.7;
    }
  }

  .agenda-schedule-list {
    padding: 0 var(--content-padding);
  }

  .agenda-schedule-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    text-decoration: none;
    color: var(--color-text);
    border-top: 1px solid var(--color-border);

    &:first-child {
      border-top: none;
    }

    /* Last row's bottom space comes from the following section divider's margin,
       so the gap to the divider equals the divider's own margin — no double spacing. */
    &:last-child {
      padding-bottom: 0;
    }

    &:active {
      opacity: 0.6;
    }
  }

  /* Time over its state mark — the time leads, the mark sits quietly beneath it.
     The column widens on the reviews queue (longer distance phrases) so the
     name column still starts at a consistent x within the page. */
  .agenda-schedule-item-time-col {
    flex-shrink: 0;
    width: 44px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .reviews-list .agenda-schedule-item-time-col {
    width: 72px;
  }

  /* Time is the index, not the content: a quiet small/muted lead + its own column
     + tabular figures keep it scannable without out-shouting the name (the anchor
     below). One voice across the agenda — the live day, the requests queue, and the
     browsable history all read the time the same way. */
  .agenda-schedule-item-time {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
  }

  .agenda-schedule-item-mark {
    display: inline-flex;

    svg {
      width: 14px;
      height: 14px;
    }
  }

  /* Micro-label family — small, semibold, lowercase. The whole agenda schedule
     reads with one quiet voice; the color carries the semantics (crimson =
     appointment domain, red = alert, green = done, gray = chrome). */
  .agenda-schedule-item-now,
  .agenda-schedule-item-action,
  .agenda-schedule-item-distance {
    font-size: var(--text-label);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
  }

  /* "agora" — the one legitimate crimson accent: this session is happening now. */
  .agenda-schedule-item-now {
    color: var(--color-primary);
  }

  /* Reviews queue: a muted distance phrase under the time. */
  .agenda-schedule-item-distance {
    color: var(--color-muted);
  }

  .agenda-schedule-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* The name is the row's anchor — the one element carrying real weight. */
  .agenda-schedule-item-name {
    font-weight: var(--font-weight-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agenda-schedule-item-neighborhood,
  .agenda-schedule-item-services {
    font-size: var(--text-caption);
    color: var(--color-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Right column — value stacks above the action cue, chevron sits beside. */
  .agenda-schedule-item-end {
    flex-shrink: 0;
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
  }

  .agenda-schedule-item-value-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
  }

  /* Appointment value — informational by default, not actionable. */
  .agenda-schedule-item-value {
    font-size: var(--text-sm);
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* Action cue — pending = crimson "revisar pedido", reviews = crimson
     "responder pedido". The alert variant flags unpaid completed rows. */
  .agenda-schedule-item-action {
    color: var(--color-primary);
  }

  .agenda-schedule-item-action--alert {
    color: var(--color-danger);
  }

  /* Reviews queue: every row is a pending request, so a crimson CTA on each one
     reads as alarm rather than signal. Mute it to gray (the row + chevron already
     say "tap to act") and wrap it to two lines to keep the right rail narrow. */
  .reviews-list .agenda-schedule-item-action {
    color: var(--color-muted);
    white-space: normal;
    width: min-content;
    text-align: right;
  }

  .agenda-schedule-item-chevron {
    width: 16px;
    height: 16px;
    color: var(--color-gray-500);
    margin-top: 1px;
  }

  /* Done rows: only the small green check is colored — name/time/value stay in
     the default voice so a past day of completed work doesn't read as a wall
     of green. */
  .agenda-schedule-item--done .agenda-schedule-item-mark {
    color: var(--color-success-text);
  }

  /* Unpaid completed: the value side comes back red + bold, signaling "this
     row is the one that wants attention." */
  .agenda-schedule-item--unpaid .agenda-schedule-item-value {
    color: var(--color-danger);
    font-weight: var(--font-weight-semibold);
  }

  .agenda-schedule-empty {
    padding: 28px var(--content-padding);
    text-align: center;
    color: var(--color-muted);
    font-size: var(--text-sm);
  }

  /* ===== Month calendar (kept for wizard) ===== */
  .month-calendar {
    padding: 8px var(--content-padding) var(--content-padding);
  }

  .month-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 16px;
  }

  .month-calendar-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-decoration: none;

    svg {
      width: 18px;
      height: 18px;
      stroke: var(--color-muted);
      fill: none;
      stroke-width: 2;
    }
  }

  .month-calendar-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
  }

  .month-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: var(--text-label);
    color: var(--color-muted);
    font-weight: var(--font-weight-semibold);
    padding-bottom: 8px;
    text-transform: capitalize;
  }

  .month-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }

  .month-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    border-radius: 50%;
    text-decoration: none;
    color: var(--color-text);
    position: relative;

    &.empty {
      pointer-events: none;
    }

    &.is-today {
      font-weight: var(--font-weight-bold);
      background: var(--color-primary);
      color: #fff;
    }

    &.has-dot::after {
      content: '';
      position: absolute;
      bottom: 4px;
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: var(--color-primary);
    }

    &.is-today.has-dot::after {
      background: #fff;
    }
  }

  .month-calendar-loading {
    height: 200px;
  }

  /* ===== Hub summary sections (Pedidos, Pagamentos a receber) ===== */
  .agenda-summary-headline {
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
  }

  .agenda-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 10px 0 14px;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-light);
    color: var(--color-muted);
  }

  .agenda-summary-positive {
    font-weight: var(--font-weight-semibold);
    color: var(--color-success-text);
  }

  /* Booking-link URL — rendered as the "headline" of the booking link section. */
  .agenda-booking-link-url {
    /*font-family: var(--font-mono);*/
    font-size: var(--text-sm);
    font-weight: var(--font-weight-light);
    color: var(--color-text);
    word-break: break-all;
  }
}
