/* Hallmark · v2.0.0 · scope: app · genre: modern-minimal · theme: Learnova · component: action groups · states: existing server-backed states */
/* Critique: keep actions beside their task, let groups reflow before labels become cramped, and preserve DOM/keyboard order. */
:root {
  --action-gap: 8px;
  --action-group-gap: 12px;
  --action-target: 44px;
  --action-label-size: 14px;
}

/* Curated action primitives; answer choices, rating controls and navigation keep their own recipes. */
:is(.button,.ai-button,.lv-button,.st-button) {
  min-width: 0;
  max-width: 100%;
  min-height: var(--action-target);
  gap: var(--action-gap);
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
  line-height: 1.5;
}
:is(.button,.ai-button,.lv-button,.st-button) > svg { flex-shrink: 0; }
:is(.button,.ai-button,.lv-button,.st-button) > span { min-width: 0; }
:is(.button,.ai-button,.lv-button,.st-button):focus-visible {
  outline: 2px solid var(--lv-focus);
  outline-offset: 3px;
}
:is(.button,.ai-button,.lv-button,.st-button)[aria-busy=true] { cursor: progress; }
:is(.button,.ai-button,.lv-button,.st-button):disabled { cursor: not-allowed; }
:is(.button,.ai-button,.lv-button,.st-button):active:not(:disabled) { transform: translateY(1px); }
@media (hover: hover) {
  :is(.button,.ai-button,.lv-button,.st-button):hover:not(:disabled) { border-color: var(--lv-primary); }
}

/* Action rows share a rhythm, without moving controls away from their original region. */
:is(.ai-actions,.ai-studio-buttons,.lv-home-actions,.bill-actions,.bill-row-actions,.cm-actions,.docs-pagination,.flash-controls) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--action-group-gap);
  min-width: 0;
}
:is(.ai-actions,.ai-studio-buttons,.lv-home-actions,.bill-actions,.bill-row-actions,.cm-actions,.docs-pagination,.flash-controls) > :is(button,a) {
  flex-shrink: 1;
}
:is(.ai-heading,.docs-heading,.lv-ops-heading,.cm-head,.bill-heading,.cf-section-head) {
  flex-wrap: wrap;
  row-gap: 16px;
}
:is(.ai-heading,.docs-heading,.lv-ops-heading,.cm-head,.bill-heading,.cf-section-head) > div { min-width: 0; }
.lv-ops-heading-actions { flex-wrap: wrap; max-width: 100%; }
.lv-ops-heading-actions > .lv-button { flex-shrink: 1; }
.ai-studio-buttons { align-items: stretch; }
.ai-studio-buttons > .ai-button--primary { margin-inline-start: auto; }
.ai-progress-actions { align-items: center; }
.ai-progress-actions > [data-ai-job-actions] { display: flex; flex-wrap: wrap; gap: var(--action-gap); }
.ai-text-link { min-height: var(--action-target); display: inline-flex; align-items: center; }

/* Row actions remain readable; destructive actions keep the existing confirmation flow. */
.bill-row-actions { max-width: none; gap: var(--action-gap); }
.bill-row-actions .lv-button { font-size: var(--action-label-size); padding: 8px 12px; }
.bill-table .lv-button { white-space: normal; }
:is(.docs-danger,.fc-remove) { color: var(--lv-error); }
.lv-button[data-action="REVOKED"], .st-button[data-st-action="request-deletion"] {
  color: var(--lv-error);
  border-color: var(--lv-error);
  background: var(--lv-error-surface);
}
.st-row-control:has(> .st-button) { gap: var(--action-gap); align-items: stretch; }
.st-row-control > .st-button { flex: 0 1 auto; }
.st-form footer > div { align-items: stretch; gap: var(--action-gap); }
.cp-footer > div { flex-wrap: wrap; max-width: 100%; }
.bill-dialog footer { flex-wrap: wrap; gap: var(--action-group-gap); }
.docs-dialog .docs-pagination { justify-content: flex-end; }

/* Filters align with their inputs rather than with the labels above them. */
:is(.lv-ops-filters,.cf-order-filter,.bill-filters) > :is(button,.lv-button) { align-self: flex-end; }
.fc-deck-row .ai-actions { flex-wrap: wrap; max-width: 100%; }

/* Form submission is a distinct region, including editors whose submit was a bare fieldset child. */
.cm-editor-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--action-group-gap);
  margin-block-start: var(--lv-space-6);
  padding-block-start: var(--lv-space-4);
  border-block-start: 1px solid var(--lv-border);
}
.cm-editor-actions > .lv-button { min-height: 48px; padding-inline: 24px; font-size: var(--lv-body-size); }

@media (min-width: 75.001rem) {
  .lv-ops-jobs .lv-ops-table td:last-child { width: 128px; min-width: 128px; }
  .lv-ops-jobs [data-ops-job] { min-width: 100px; white-space: nowrap; }
}

/* Wide tables expose their action column on tablets instead of requiring a horizontal hunt. */
@media (max-width: 75rem) {
  .lv-ops-table thead,.bill-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: clip; }
  .lv-ops-table :is(table,tbody,tr),.bill-table :is(table,tbody,tr) { display: block; width: 100%; }
  .lv-ops-table caption { display: block; width: 100%; }
  .lv-ops-table tr,.bill-table tr { padding: 12px; border-bottom: 1px solid var(--lv-border); }
  .lv-ops-table td { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: var(--action-gap); border: 0; min-width: 0; padding: 8px 0; overflow-wrap: anywhere; }
  .lv-ops .lv-ops-table td[data-label] { width: 100%; min-width: 0; white-space: normal; }
  .lv-ops-table td[colspan] { display: block; }
  .lv-ops-table td[data-label]::before { content: attr(data-label); display: block; color: var(--lv-muted); }
  .bill-table td { display: block; width: 100%; min-width: 0; padding: 8px 0; border: 0; overflow-wrap: anywhere; }
  .bill-table td::before { content: attr(data-label); display: block; color: var(--lv-muted); font-size: var(--action-label-size); }
  .bill-table .lv-button { min-width: 0; }
}

@media (max-width: 60rem) {
  .lv-ops-heading-actions { flex-shrink: 1; }
  .cf-section-head { align-items: flex-start; }
  .cf-section-head .lv-button { flex-shrink: 1; }
  .st-row-control > .st-button { flex: 1 1 8rem; }
}

@media (max-width: 40rem) {
  :is(.button,.ai-button,.lv-button,.st-button) { font-size: var(--action-label-size); }
  :is(.ai-studio-buttons,.bill-heading > .bill-actions,.cm-head > .cm-actions,.lv-ops-heading-actions,.cf-header-actions) { width: 100%; }
  :is(.ai-actions,.ai-studio-buttons,.lv-home-actions,.bill-actions,.bill-row-actions,.cm-actions,.docs-pagination,.flash-controls) > :is(button,a) {
    flex: 1 1 9rem;
    justify-content: center;
  }
  .ai-studio-buttons > .ai-button--primary { margin-inline-start: 0; }
  .ai-studio-buttons > .ai-button { flex: 1 1 100%; width: 100%; }
  .ai-progress-actions { display: flex; flex-direction: column; align-items: stretch; }
  .ai-progress-actions > :is(.ai-button,.ai-text-link,[data-ai-job-actions]) { width: 100%; flex: 0 0 auto; margin-inline-start: 0; }
  .ai-progress-actions > .ai-button { font-size: var(--action-label-size); padding-inline: 16px; }
  .ai-progress-actions > [data-ai-job-actions] > .ai-button { flex: 1 1 9rem; }
  .ai-attempt-footer > .ai-button { width: 100%; }
  .lv-ops-heading-actions > .lv-button { flex: 1 1 9rem; }
  .lv-ops[data-ops-admin] .lv-ops-filters > .lv-button { flex: 1 1 9rem; }
  .cf-section-head > .lv-button { flex: 1 1 100%; }
  .cf-order-filter > .lv-button { flex: 1 1 100%; }
  .bill-payment-footer .lv-button { min-width: 0; }
  .bill-payment-footer .bill-actions > .lv-button { flex: 0 0 auto; width: 100%; }
  .bill-dialog footer > .lv-button { flex: 1 1 9rem; }
  .docs-heading > .button { width: 100%; }
  .docs-selected > .button { flex: 1 1 9rem; }
  .st-form footer > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  .st-form footer .st-button { font-size: var(--action-label-size); padding: 8px 12px; }
  .st-form footer [data-st-save] { grid-column: 1 / -1; }
  .st-form footer > div:has([data-st-reset][hidden]) [data-st-save] { grid-column: auto; }
  .st-row-control:has(> .st-button) { width: 100%; max-width: 100%; }
  .st-row-control > .st-button { flex: 1 1 100%; }
  .cp-footer > div { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--action-gap); }
  .cp-footer .lv-button { min-width: 0; }
  .cm-editor-actions > .lv-button,
  .cm-plans .cp-submit > .lv-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  :is(.button,.ai-button,.lv-button,.st-button) { transition: none; }
  :is(.button,.ai-button,.lv-button,.st-button):active:not(:disabled) { transform: none; }
}
