/* Reporting › Appointment report (public/appointment-report.js). It borrows the
   Attribution report's buttons, menus and date range (.ar-*); what is here is
   the page's own: tiles, chart cards, the table, and the insights dialog.
   Colours come from the theme variables, so Midnight and Daylight restyle it. */

.apr { gap: 18px; }
.apr.busy .apr-tiles, .apr.busy .apr-charts { opacity: .7; }
.apr-title { margin: 4px 0 0; font-size: 30px; font-weight: 600; line-height: 1.2; }
.apr-muted { color: var(--muted); }

/* ----- the header row stays under the module tabs while the page scrolls ----- */
.apr-bar-head {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 -26px; padding: 10px 26px; background: var(--bg);
}
.apr-bar-left, .apr-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.apr-insights { padding: 9px 11px; }

/* ----- drop-downs ----- */
.apr-sel { position: relative; }
.apr-sel-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; text-align: left;
}
.apr-sel-btn:hover:not(:disabled), .apr-sel-btn[aria-expanded="true"] { border-color: var(--brand); }
.apr-sel-btn:focus-visible, .apr-opt:focus-visible, .apr-legend-item:focus-visible, .apr-info:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.apr-sel-btn:disabled { opacity: .6; cursor: progress; }
.apr-sel-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apr-sel-text.ph { color: var(--dim); }
.apr-cal { width: 210px; }
.apr-date-by { width: 160px; }
.apr-status { width: 190px; }
.apr-size { width: 132px; }
.apr-source-by { width: 140px; }
.apr-dash-sel { width: min(100%, 460px); }
.apr-sel-menu { min-width: 100%; width: max-content; max-width: 320px; padding: 6px; }
.apr-sel-search { margin-bottom: 6px; }
.apr-sel-list { display: flex; flex-direction: column; max-height: 280px; overflow: auto; }
.apr-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; text-align: left; }
.apr-opt:hover { background: var(--hover); }
.apr-opt.on { color: var(--brand); background: var(--brand-soft); }
.apr-opt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* ----- tiles and cards ----- */
.apr-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 16px; }
.apr-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.apr-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.apr-card-title { margin: 0; font-size: 17px; font-weight: 500; }
.apr-head-extra { display: flex; align-items: center; gap: 8px; }
.apr-card-body { padding: 16px 20px 20px; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.apr-tile .apr-card-title { font-size: 15px; }
.apr-tile-value { padding: 22px 12px 26px; text-align: center; font-size: 44px; font-weight: 500; line-height: 1.1; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.apr-charts { display: flex; flex-direction: column; gap: 24px; }
.apr-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1000px) { .apr-row { grid-template-columns: minmax(0, 1fr); } }

/* ----- spinner, empty ----- */
.apr-spin { display: flex; align-items: center; justify-content: center; padding: 24px; }
.apr-spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: apr-turn .8s linear infinite; }
@keyframes apr-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .apr-spinner { animation-duration: 2.4s; } }
.apr-nodata { padding: 56px 16px; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); }

/* ----- charts ----- */
.apr-donut { display: flex; align-items: center; justify-content: center; gap: 28px; width: 100%; flex-wrap: wrap; }
.apr-donut-svg { width: 220px; height: 220px; flex: none; }
.apr-donut-track { fill: none; stroke: var(--hover); stroke-width: 20; }
.apr-donut-arc { fill: none; stroke-width: 20; }
.apr-donut-arc:hover { stroke-width: 24; }
.apr-donut-total { font-size: 26px; font-weight: 600; fill: var(--text); }
.apr-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; }
.apr-legend-item { display: inline-flex; align-items: center; gap: 8px; padding: 3px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 13px; text-align: left; }
.apr-legend-item:hover { background: var(--hover); }
.apr-legend-item.off { color: var(--dim); text-decoration: line-through; }
.apr-legend-item.off .apr-dot { background: var(--dim) !important; }
.apr-legend-top { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 16px; max-height: none; margin-bottom: 4px; }
.apr-legend-static { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.apr-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.apr-bars { width: 100%; }
.apr-svg svg { width: 100%; height: auto; max-height: 320px; display: block; }
.apr-gridline { stroke: var(--line-soft); stroke-width: 1; }
.apr-axis { font-size: 11.5px; fill: var(--muted); }
.apr-axis-title { font-size: 11.5px; fill: var(--muted); }
.apr-bar:hover { opacity: .85; }
.apr-info { position: relative; display: inline-flex; color: var(--muted); cursor: help; }
.apr-tip { position: absolute; z-index: 30; right: 0; top: calc(100% + 6px); width: 220px; padding: 8px 10px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 12.5px; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity .12s; }
.apr-info:hover .apr-tip, .apr-info:focus .apr-tip { opacity: 1; }

/* ----- the table ----- */
.apr-table-card { padding: 16px 20px 0; }
.apr-table-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; }
.apr-table-body.busy { opacity: .55; }
.apr-scroll { max-height: 480px; overflow: auto; border-top: 1px solid var(--line-soft); }
.apr-table { width: 100%; border-collapse: collapse; }
.apr-table th { position: sticky; top: 0; z-index: 1; background: var(--surface); white-space: nowrap; text-align: left; font-weight: 500; color: var(--muted); font-size: 13.5px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.apr-table td { padding: 12px 14px; vertical-align: middle; border-bottom: 1px solid var(--line-soft); font-size: 14px; min-width: 150px; max-width: 260px; overflow-wrap: anywhere; }
.apr-table tbody tr:hover td { background: var(--hover); }
.apr-c-id { min-width: 190px; }
.apr-sub { color: var(--muted); font-size: 13px; }
.apr-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0 16px; }
.apr-count { font-size: 14px; }
.apr-pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.apr-page { min-width: 36px; justify-content: center; padding: 6px 8px; }
.apr-page.on { border-color: var(--brand); color: var(--brand); }
.apr-ellipsis { color: var(--muted); padding: 0 4px; }
.apr-cols-menu { width: 260px; padding: 0; }
.apr-cols-head { padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.apr-cols-list { padding: 8px 10px; max-height: 300px; overflow: auto; }
.apr-cols-foot { justify-content: center; margin: 0; padding: 10px; border-top: 1px solid var(--line-soft); }

/* ----- dialogs ----- */
.apr-back { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.apr-modal { width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.apr-modal.wide { width: min(1068px, 100%); }
.apr-modal-head { padding: 20px 24px 4px; }
.apr-modal-title { margin: 0; font-size: 18px; font-weight: 600; }
.apr-modal-desc { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.apr-modal-body { padding: 14px 24px 20px; overflow: visible; }
.apr-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line-soft); }
.apr-modal-foot:empty { display: none; }
.apr-ins-label { display: block; margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.apr-ins-box { margin-top: 18px; padding: 16px 20px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--hover); transition: opacity .15s; }
.apr-ins-box.off { opacity: .55; }
.apr-ins-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 16px; font-weight: 600; }
.apr-ins-navs { display: flex; gap: 8px; }
.apr-ins-nav { border: 0; background: transparent; padding: 6px; }
.apr-ins-track { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; scrollbar-width: thin; }
.apr-ins-card { flex: 0 0 260px; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--brand); border-radius: 8px; background: var(--surface); scroll-snap-align: start; cursor: pointer; }
.apr-ins-title { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.apr-ins-value { padding: 14px 0; text-align: center; font-size: 44px; font-weight: 600; line-height: 1.1; }
.apr-ins-desc { color: var(--muted); font-size: 12.5px; line-height: 1.35; min-height: 34px; }
.apr-progress { position: relative; height: 22px; margin-top: 18px; border-radius: 11px; background: var(--hover); overflow: hidden; }
.apr-progress-fill { height: 100%; background: var(--brand); transition: width .2s; }
.apr-progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text); mix-blend-mode: normal; }
.apr-progress-status { margin-top: 10px; font-size: 14px; color: var(--muted); }
@media (max-width: 700px) {
  .apr-bar-head { margin: 0 -14px; padding: 10px 14px; }
  .apr-cal, .apr-date-by { width: 100%; }
  .apr-title { font-size: 24px; }
}
