/* Range Shoot Log: agent portal (see agent-portal.js) */
.ap {
  position: fixed; inset: 0; z-index: 110;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at top, var(--color-primary-glow), transparent 34%), var(--color-bg);
  color: var(--color-text);
  font-family: var(--app-font);
}
.ap.hidden, .ap .hidden { display: none !important; }
body.ap-open { overflow: hidden; }
.ap svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ap .primary-btn, .ap .secondary-btn { margin: 0; }
.ap-wide { width: 100%; min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ap-muted { margin: 0; color: var(--color-text-muted); font-size: 14.5px; line-height: 1.45; }
.ap-small { font-size: 13px; }
.ap-error { margin: 0; color: var(--color-danger-text, #b42318); font-size: 14px; font-weight: 500; }
.ap-field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--color-text-muted); }
.ap-field select, .ap-field input, .ap-field textarea {
  width: 100%; min-height: 50px; margin: 0; padding: 0 14px;
  border: 1px solid var(--color-border); border-radius: 14px;
  background: var(--color-surface); color: var(--color-text);
  font: 400 16px/1.3 var(--app-font);
}
.ap-field textarea { padding: 12px 14px; min-height: 0; resize: vertical; }
.ap-field select:disabled { opacity: 0.7; }
.ap-field input:focus, .ap-field select:focus, .ap-field textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--focus-ring, rgba(40, 122, 189, 0.25)); }

/* Home */
.ap-home { width: min(100%, 640px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ap-head h1 { margin: 2px 0 0; font-size: 30px; letter-spacing: -0.03em; }
.ap-signout {
  flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface); color: var(--color-text); font: 600 14px/1 var(--app-font); cursor: pointer;
}
.ap-hero {
  display: grid; gap: 4px; padding: 20px; border-radius: 24px;
  background: var(--color-primary); color: var(--on-primary, #fff);
}
.ap-hero { position: relative; overflow: hidden; isolation: isolate; }
.ap-hero.has-banner::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(40, 122, 189, 0.95) 0%, rgba(40, 122, 189, 0.72) 40%, rgba(40, 122, 189, 0.08) 100%), var(--ap-banner) right center / cover no-repeat;
}
.ap-hero small { font-size: 13px; font-weight: 600; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }
.ap-hero strong { font-size: 34px; letter-spacing: -0.03em; line-height: 1.1; }
.ap-hero strong.ap-hero-empty { font-size: 24px; }
.ap-hero span { font-size: 16px; font-weight: 600; }
.ap-hero .ap-hero-sub, .ap-hero span:last-child:not(:nth-child(3)) { font-size: 14px; font-weight: 400; opacity: 0.85; }
.ap-book svg { width: 20px; height: 20px; }
.ap-rule { margin: -4px 0 0; text-align: center; font-size: 13px; color: var(--color-text-muted); }

.ap-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--color-surface-muted); }
.ap-tabs button {
  min-height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--color-text-muted); font: 600 14.5px/1 var(--app-font); cursor: pointer;
}
.ap-tabs button.active { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.ap-list { display: grid; gap: 10px; }
.ap-item {
  display: flex; gap: 14px; align-items: stretch; width: 100%; padding: 14px 16px; margin: 0;
  border: 1px solid var(--color-border); border-radius: 18px; background: var(--color-surface);
  color: var(--color-text); text-align: left; font-family: var(--app-font);
}
button.ap-item { cursor: pointer; }
.ap-date { flex: none; display: grid; place-content: center; min-width: 46px; padding-right: 14px; border-right: 1px solid var(--color-divider); text-align: center; }
.ap-date b { font-size: 24px; color: var(--color-primary); line-height: 1; }
.ap-date small { font-size: 11.5px; font-weight: 700; color: var(--color-text-muted); }
.ap-item-main { display: grid; gap: 3px; min-width: 0; flex: 1; }
.ap-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ap-item-top small { color: var(--color-text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ap-item strong { font-size: 16.5px; font-weight: 600; overflow-wrap: anywhere; }
.ap-item-main > small { color: var(--color-text-muted); font-size: 13.5px; }
.ap-pill { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--color-surface-muted); color: var(--color-text-muted); }
.ap-pill.is-up { background: var(--color-primary-soft); color: var(--color-primary); }
.ap-pill.is-moved { background: var(--color-warning-soft); color: var(--color-warning-text); }
.ap-pill.is-off { background: var(--color-danger-soft); color: var(--color-danger-text); }
.ap-pill.is-done { background: var(--color-success-soft); color: var(--color-success-text); }
.ap-empty { margin: 0; padding: 22px 12px; text-align: center; color: var(--color-text-muted); font-size: 14.5px; }

.ap-chips { display: flex; flex-wrap: nowrap; gap: 6px; margin-top: 6px; overflow: hidden; }
.ap-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface);
  color: var(--color-text); font: 600 13.5px/1 var(--app-font); text-decoration: none; cursor: pointer;
}
.ap-chip svg { width: 16px; height: 16px; }
.ap-chip-copy { border-color: var(--color-primary-border); background: var(--color-primary-soft); color: var(--color-primary); }
.ap-chip-copy.is-copied, .ap-share.is-copied { border-color: var(--color-success-border); background: var(--color-success-soft); color: var(--color-success-text); }

/* Sheets: close only with their close button */
.ap-overlay {
  position: fixed; inset: 0; z-index: 112;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--color-backdrop, rgba(17, 24, 39, 0.32));
}
.ap-sheet {
  display: grid; gap: 14px; width: min(100%, 560px); max-height: 92dvh; overflow-y: auto;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0; background: var(--color-surface);
  animation: ap-in 0.22s ease-out;
}
@keyframes ap-in { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ap-sheet { animation: none; } }
@media (min-width: 720px) { .ap-overlay { align-items: center; padding: 24px; } .ap-sheet { border-radius: 28px; } }
.ap-sheet-head { display: flex; align-items: center; gap: 8px; }
.ap-sheet-head h2 { flex: 1; margin: 0; font-size: 24px; letter-spacing: -0.03em; }
.ap-icon-btn { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--color-surface-muted); color: var(--color-text); cursor: pointer; }
#apStepTime, #apStepDetails { display: grid; gap: 12px; }
.ap-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ap-times > p { grid-column: 1 / -1; }
.ap-time {
  min-height: 46px; padding: 0 8px; border: 1px solid var(--color-border); border-radius: 12px;
  background: var(--color-surface); color: var(--color-text); font: 600 14px/1.2 var(--app-font); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ap-time.active { background: var(--color-primary); border-color: var(--color-primary); color: var(--on-primary, #fff); }
.ap-picked { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; font-size: 15px; }
.ap-sheet-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 0 -18px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--color-surface); border-top: 1px solid var(--color-divider); }
#apBookNext:disabled { opacity: 0.5; cursor: not-allowed; }

/* Booking details */
.ap-detail-top { display: flex; justify-content: space-between; align-items: center; color: var(--color-text-muted); font-size: 14px; }
.ap-feature { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--color-border); border-radius: 18px; }
.ap-feature strong { font-size: 19px; }
.ap-feature span { color: var(--color-text-muted); }
.ap-share {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px;
  border: 1px solid var(--color-primary-border); border-radius: 14px; background: var(--color-primary-soft);
  color: var(--color-primary); font: 600 15px/1 var(--app-font); cursor: pointer;
}
.ap-rows { display: grid; border: 1px solid var(--color-border); border-radius: 18px; overflow: hidden; }
.ap-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--color-divider); font-size: 14.5px; }
.ap-row:first-child { border-top: 0; }
.ap-row span { color: var(--color-text-muted); }
.ap-row strong { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.ap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-actions button { min-height: 48px; }
.ap-actions button:disabled { opacity: 0.45; cursor: not-allowed; }
.ap-danger {
  border: 1px solid var(--color-danger-border, #f5c2c0); border-radius: 14px; background: var(--color-danger-soft, #fdecea);
  color: var(--color-danger-text, #b42318); font: 600 15px/1 var(--app-font); cursor: pointer;
}

.ap-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 119;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--color-toast-bg, #1f2937); color: #fff; font-size: 14.5px; font-weight: 500;
  transition: opacity 0.2s, transform 0.2s;
}
.ap-toast.show { opacity: 1; transform: translate(-50%, 0); }
