/* All rules are scoped to these two mount roots; no page-wide styles. */
.agency-access,
.checkin-settings {
  --aa-accent: var(--ui-accent, var(--primary, #7652d7));
  --aa-text: var(--ui-text, var(--text-primary, #28243b));
  --aa-muted: var(--ui-muted, var(--text-secondary, #6b647b));
  --aa-surface: var(--ui-surface, var(--surface, #fff));
  --aa-border: var(--ui-border, var(--border-color, #e7e2ef));
  box-sizing: border-box;
  color: var(--aa-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  width: 100%;
  min-width: 0;
  max-width: 1120px;
  margin-inline: auto;
  overflow-wrap: anywhere;
}
.agency-access *, .checkin-settings * { box-sizing: border-box; }
.agency-access [hidden], .checkin-settings [hidden] { display: none !important; }
.agency-access .aa-header, .checkin-settings .aa-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px;
}
.agency-access .aa-title, .checkin-settings .aa-title { font-size: 24px; letter-spacing: -.5px; line-height: 1.35; margin: 0 0 8px; font-weight: 750; }
.agency-access .aa-subtitle, .checkin-settings .aa-subtitle { color: var(--aa-muted); margin: 0; }
.agency-access .aa-content, .checkin-settings .aa-content { display: grid; gap: 20px; min-width: 0; }
.agency-access .aa-button, .checkin-settings .aa-button {
  appearance: none; border: 1px solid transparent; border-radius: 10px; background: var(--aa-accent); color: #fff;
  font: inherit; font-weight: 600; line-height: 1.35; min-height: 42px; padding: 10px 17px; cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease; flex-shrink: 0;
}
.agency-access .aa-button:hover:not(:disabled), .checkin-settings .aa-button:hover:not(:disabled) { box-shadow: 0 3px 10px #7652d729; }
.agency-access .aa-button--secondary, .checkin-settings .aa-button--secondary { background: var(--aa-surface); color: var(--aa-text); border-color: var(--aa-border); }
.agency-access .aa-button--danger, .checkin-settings .aa-button--danger { background: #b73b51; }
.agency-access :disabled, .checkin-settings :disabled { cursor: not-allowed; opacity: .58; }
.agency-access :focus-visible, .checkin-settings :focus-visible { outline: 3px solid var(--aa-accent); outline-offset: 3px; }
.agency-access .aa-notice, .checkin-settings .aa-notice {
  padding: 12px 16px; border: 1px solid #e2d8fa; border-radius: 10px; margin-bottom: 20px; color: #4e357e; background: #f5f0ff;
}
.agency-access .aa-notice[data-kind="success"], .checkin-settings .aa-notice[data-kind="success"] { background: #eef8f3; border-color: #c6e6d7; color: #256047; }
.agency-access .aa-notice[data-kind="error"], .checkin-settings .aa-notice[data-kind="error"] { background: #fff2f3; border-color: #f0ccd1; color: #923044; }
.agency-access .aa-panel, .checkin-settings .aa-panel { border: 1px solid var(--aa-border); border-radius: 16px; background: var(--aa-surface); padding: 24px; min-width: 0; }
.agency-access .aa-panel-title, .checkin-settings .aa-panel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 17px; font-weight: 700; margin: 0 0 14px; }
.agency-access .aa-description, .checkin-settings .aa-description { margin: 0 0 16px; color: var(--aa-muted); }
.agency-access .aa-policy, .checkin-settings .aa-policy { margin: 0; color: var(--aa-muted); font-size: 13px; line-height: 1.8; }
.agency-access .aa-warning, .checkin-settings .aa-warning { margin: 0; padding: 12px 16px; color: #87541c; background: #fff7e9; border: 1px solid #f1dfbd; border-radius: 10px; }
.agency-access .aa-panel > .aa-warning, .checkin-settings .aa-panel > .aa-warning { margin-bottom: 18px; }
.agency-access .aa-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; padding: 0; border: 0; min-width: 0; }
.agency-access .aa-section-label { padding: 0 0 12px; font-weight: 700; }
.agency-access .aa-mode { display: flex; align-items: flex-start; gap: 12px; padding: 22px; background: var(--aa-surface); border: 1px solid var(--aa-border); border-radius: 14px; cursor: pointer; min-width: 0; }
.agency-access .aa-mode.is-selected { border: 2px solid var(--aa-accent); padding: 21px; background: #f8f5ff; }
.agency-access .aa-mode.is-unavailable { cursor: not-allowed; }
.agency-access .aa-mode input { accent-color: var(--aa-accent); width: 18px; height: 18px; margin: 4px 0 0; flex-shrink: 0; }
.agency-access .aa-mode-copy { display: grid; gap: 6px; flex: 1; min-width: 0; }
.agency-access .aa-mode-title { font-size: 16px; }
.agency-access .aa-mode-detail { font-size: 13px; color: var(--aa-muted); }
.agency-access .aa-mode-flag { font-size: 11px; white-space: nowrap; border-radius: 20px; padding: 3px 8px; color: var(--aa-accent); background: #eee7fb; }
.agency-access .aa-badge { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.4; padding: 4px 10px; border-radius: 20px; white-space: nowrap; color: #635a74; background: #f0edf5; }
.agency-access .aa-badge--pending { color: #76500f; background: #fff2d3; }
.agency-access .aa-badge--approved { color: #24604a; background: #e8f6ef; }
.agency-access .aa-badge--rejected, .agency-access .aa-badge--revoked { color: #96364b; background: #fdeef1; }
.agency-access .aa-details { display: grid; gap: 8px; margin: 0 0 18px; }
.agency-access .aa-detail { display: grid; grid-template-columns: 80px 1fr; gap: 12px; }
.agency-access .aa-detail dt { color: var(--aa-muted); }
.agency-access .aa-detail dd { margin: 0; white-space: pre-wrap; min-width: 0; }
.agency-access .aa-form, .checkin-settings .aa-form { display: grid; gap: 16px; justify-items: start; min-width: 0; }
.agency-access .aa-field, .checkin-settings .aa-field { display: grid; gap: 8px; width: 100%; min-width: 0; }
.agency-access .aa-field label, .checkin-settings .aa-field label { font-weight: 600; }
.agency-access .aa-field input, .agency-access .aa-field textarea, .agency-access .aa-field select,
.checkin-settings .aa-field input, .checkin-settings .aa-field textarea, .checkin-settings .aa-field select {
  font: inherit; color: var(--aa-text); background: var(--aa-surface); border: 1px solid var(--aa-border); border-radius: 9px;
  min-height: 44px; padding: 10px 12px; width: 100%; min-width: 0;
}
.agency-access .aa-field textarea, .checkin-settings .aa-field textarea { resize: vertical; }
.agency-access .aa-help, .checkin-settings .aa-help { color: var(--aa-muted); font-size: 12px; font-weight: 400; margin: 0; }
.agency-access .aa-endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--aa-muted); }
.agency-access .aa-endpoint code { font: inherit; color: var(--aa-text); padding: 3px 10px; background: #f4f1f8; border-radius: 6px; }
.agency-access .aa-channels { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 22px; padding: 0; }
.agency-access .aa-channels li { display: grid; gap: 5px; border: 1px solid var(--aa-border); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.agency-access .aa-channels strong { color: var(--aa-muted); font-size: 12px; font-weight: 500; }
.agency-access .aa-channels .aa-configured { color: #24604a; }
.agency-access .aa-toolbar { display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; margin-bottom: 20px; }
.agency-access .aa-toolbar .aa-field { width: 190px; }
.agency-access .aa-count { color: var(--aa-muted); font-size: 13px; margin: 0 0 10px; }
.agency-access .aa-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--aa-surface); border: 1px solid var(--aa-border); border-radius: 12px; overflow: hidden; table-layout: fixed; }
.agency-access .aa-table th { background: #f8f6fb; text-align: left; font-size: 12px; font-weight: 600; color: var(--aa-muted); }
.agency-access .aa-table td, .agency-access .aa-table th { padding: 14px; border-bottom: 1px solid var(--aa-border); vertical-align: top; }
.agency-access .aa-table tr:last-child td { border-bottom: 0; }
.agency-access .aa-table th:nth-child(1) { width: 16%; }
.agency-access .aa-table th:nth-child(2) { width: 10%; }
.agency-access .aa-table th:nth-child(3) { width: 34%; }
.agency-access .aa-table th:nth-child(4) { width: 19%; }
.agency-access .aa-table th:nth-child(5) { width: 21%; }
.agency-access .aa-reason p { margin: 0; white-space: pre-wrap; }
.agency-access .aa-reason .aa-help { margin-top: 6px; }
.agency-access .aa-time { font-size: 12px; color: var(--aa-muted); }
.agency-access .aa-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agency-access .aa-table .aa-button { font-size: 12px; padding: 8px 11px; min-height: 36px; }
.agency-access .aa-pagination { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 14px; color: var(--aa-muted); }
.agency-access .aa-empty, .checkin-settings .aa-empty { margin: 0; padding: 32px 20px; border: 1px dashed var(--aa-border); border-radius: 12px; color: var(--aa-muted); text-align: center; }
.agency-access .aa-dialog { max-width: min(480px, calc(100vw - 32px)); width: 480px; border: 1px solid var(--aa-border); border-radius: 16px; color: var(--aa-text); background: var(--aa-surface); padding: 24px; box-shadow: 0 24px 80px #30204c33; }
.agency-access .aa-dialog::backdrop { background: #20152d66; }
.agency-access .aa-dialog .aa-actions { justify-content: flex-end; width: 100%; margin-top: 8px; }
.checkin-settings .aa-field { max-width: 390px; }
.checkin-settings .aa-policy { margin-top: 22px; }
@media (max-width: 720px) {
  .agency-access .aa-modes { grid-template-columns: 1fr; }
  .agency-access .aa-table, .agency-access .aa-table tbody, .agency-access .aa-table tr, .agency-access .aa-table td { display: block; width: 100%; }
  .agency-access .aa-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .agency-access .aa-table tr { padding: 14px; border-bottom: 1px solid var(--aa-border); }
  .agency-access .aa-table tr:last-child { border-bottom: 0; }
  .agency-access .aa-table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; }
  .agency-access .aa-table td::before { content: attr(data-label); color: var(--aa-muted); font-size: 12px; font-weight: 500; }
}
@media (max-width: 420px) {
  .agency-access .aa-title, .checkin-settings .aa-title { font-size: 21px; }
  .agency-access .aa-header, .checkin-settings .aa-header { gap: 12px; margin-bottom: 20px; }
  .agency-access .aa-header > .aa-button, .checkin-settings .aa-header > .aa-button { padding-inline: 12px; }
  .agency-access .aa-panel, .checkin-settings .aa-panel { padding: 18px 16px; }
  .agency-access .aa-mode { padding: 18px 14px; }
  .agency-access .aa-mode.is-selected { padding: 17px 13px; }
  .agency-access .aa-mode-flag { padding-inline: 6px; }
  .agency-access .aa-channels { grid-template-columns: 1fr; }
  .agency-access .aa-channels li { grid-template-columns: 1fr auto; }
  .agency-access .aa-toolbar { align-items: flex-start; flex-direction: column; gap: 6px; }
  .agency-access .aa-toolbar .aa-field { width: 100%; }
  .agency-access .aa-pagination { justify-content: center; gap: 10px; }
  .agency-access .aa-pagination .aa-button { padding-inline: 12px; }
  .agency-access .aa-dialog { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .agency-access .aa-button, .checkin-settings .aa-button { transition: none; }
}
