/* Shared action levels. Navigation, audio states and road alerts keep their own cues. */
:root {
  --action-ink: var(--ui-text-secondary);
  --action-muted: var(--ui-text-muted);
  --action-border: var(--ui-border);
  --action-surface: var(--ui-surface-raised);
  --action-hover: var(--ui-surface-hover);
  --action-danger: var(--ui-danger);
  --action-danger-border: var(--ui-danger-border);
  --action-danger-hover: var(--ui-danger-surface);
}

/* Secondary actions remain easy to tap without competing with the main button. */
body :is(.button.button-outline, .organization-contacts a, .ride-tools a, .ride-tools button):not(:where(.button-dark, .button-light, .button-danger-outline, .button-quiet, .cm-delete-button)) {
  color: var(--action-ink);
  border: 1px solid var(--action-border);
  background: var(--action-surface);
  box-shadow: none;
  font-weight: 600;
}
body :is(.button.button-outline, .organization-contacts a, .ride-tools a, .ride-tools button):not(:where(.button-dark, .button-light, .button-danger-outline, .button-quiet, .cm-delete-button)):hover:not(:disabled) {
  color: var(--action-ink);
  border-color: var(--ui-focus);
  background: var(--action-hover);
  box-shadow: none;
}
body :is(.button.button-dark, .button.button-light):not(.button-danger-outline) {
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  border-color: var(--ui-focus);
  box-shadow: 0 2px 5px color-mix(in srgb, var(--ui-shadow) 7.1%, transparent);
  font-weight: 700;
}
body :is(.button.button-dark, .button.button-light):not(.button-danger-outline):hover:not(:disabled) {
  color: var(--ui-text);
  background: var(--ui-primary-hover);
  border-color: var(--ui-focus);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--ui-shadow) 12.5%, transparent);
}

/* Refresh, cancel and close are tertiary actions; their touch targets stay at least 44px. */
body :is(.button.button-quiet, .text-button, .cm-heading-actions .button-outline, .cm-list-summary > button,
  .approval-toolbar > button, .ride-qr-header .ride-qr-close, #staff-member-close, #organization-detail-close) {
  min-height: 44px;
  padding: 10px 14px;
  color: var(--action-muted);
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  font-weight: 600;
}
body :is(.button.button-quiet, .text-button, .cm-heading-actions .button-outline, .cm-list-summary > button,
  .approval-toolbar > button, .ride-qr-header .ride-qr-close, #staff-member-close, #organization-detail-close):hover:not(:disabled) {
  color: var(--action-ink);
  border-color: transparent;
  background: var(--action-hover);
  box-shadow: none;
}

body :is(.button.button-danger-outline, .cm-danger .cm-delete-button, #remove-photo) {
  color: var(--action-danger);
  border-color: var(--action-danger-border);
  background: transparent;
  box-shadow: none;
}
body :is(.button.button-danger-outline, .cm-danger .cm-delete-button, #remove-photo):hover:not(:disabled) {
  color: var(--action-danger);
  border-color: var(--action-danger);
  background: var(--action-danger-hover);
  box-shadow: none;
}

/* Quiet controls also need readable contrast on dark cards. */
:is(.radio-card, .ride-qr-dialog, .admin-sidebar, .ride-summary) {
  --action-ink: var(--ui-text-secondary);
  --action-muted: var(--ui-text-muted);
  --action-border: var(--ui-border);
  --action-surface: var(--ui-surface-raised);
  --action-hover: var(--ui-surface-hover);
  --action-danger: var(--ui-danger);
  --action-danger-border: var(--ui-danger-border);
  --action-danger-hover: var(--ui-danger-surface);
}
.intercom-page .ride-summary {
  --action-ink: var(--ui-text-secondary);
  --action-muted: var(--ui-text-muted);
  --action-border: var(--ui-border);
  --action-surface: var(--ui-surface-raised);
  --action-hover: var(--ui-surface-hover);
}
/* Keep the main listening controls large, and their stopping/alert states distinct. */
.intercom-page #microphone[aria-pressed="true"] { color: var(--ui-text); background: var(--ui-danger); border-color: var(--ui-danger-border); }
.intercom-page #microphone[aria-pressed="true"]:hover { background: var(--ui-danger-surface); border-color: var(--ui-danger-border); }
.cm-card-actions { align-items: center; }
.cm-card-actions .button-dark { flex-grow: 2; }
.cm-card-actions .button-outline { flex-grow: 1; }
.cm-heading-actions { align-items: center; }
.editor-actions, .approval-actions { column-gap: 12px; row-gap: 8px; }
body :is(.button, .text-button):focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
body :is(.button, .text-button):disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
@media (max-width: 600px) {
  .cm-card-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .cm-card-actions .button { width: 100%; min-width: 0; white-space: normal; }
  .cm-heading-actions > .button-dark { flex: 1 1 100%; }
  .cm-heading-actions > .button-outline { flex: 0 1 auto; }
  .editor-actions > .button-dark { width: 100%; }
}
