.entity-detail-col {
  width: 1%;
  white-space: nowrap;
  text-align: left;
}
.entity-detail-form[aria-busy="true"] .entity-detail-status::before {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.4rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: entity-busy-spin 0.8s linear infinite;
}
@keyframes entity-busy-spin {
  to { transform: rotate(360deg); }
}
.entity-list-skeleton span {
  display: block;
  height: 2rem;
  margin: 0.5rem 0;
  border-radius: 0.25rem;
  background: #e2e8f0;
}
@media (prefers-reduced-motion: reduce) {
  .entity-detail-form[aria-busy="true"] .entity-detail-status::before {
    animation: none;
  }
}
/* The row actions (Detail, any per-entity action, and the to-do checkmark) must stay on one
   line. white-space:nowrap on the cell alone is not enough: when the other columns are wide the
   table squeezes this cell and the inline-block items still break onto a second line. A
   non-wrapping inline-flex row keeps them together regardless of how narrow the cell gets. */
.entity-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}
.entity-row-actions-end {
  justify-content: flex-end;
}
.entity-row-actions > * {
  flex: 0 0 auto;
}
.entity-detail-btn {
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.entity-todo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 1.25rem;
  height: 1.25rem;
  color: #2563eb;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.entity-todo-link:hover {
  color: #1d4ed8;
}
.entity-todo-count:empty {
  display: none;
}
.entity-todo-count {
  font-size: 0.7rem;
  font-weight: 600;
}
/* The paperclip shares the row action area with the to-do checkmark, so it uses the same
   non-wrapping shape. Slate rather than blue keeps the two icons tellable apart at a glance. */
.entity-doc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 1.25rem;
  height: 1.25rem;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.entity-doc-link:hover {
  color: #1e293b;
}
.entity-doc-count:empty {
  display: none;
}
.entity-doc-count {
  font-size: 0.7rem;
  font-weight: 600;
}
.entity-email-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 1.25rem;
  height: 1.25rem;
  border: 0;
  background: transparent;
  color: #0f766e;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.entity-email-link:hover {
  color: #115e59;
}
.entity-email-count:empty {
  display: none;
}
.entity-email-count {
  font-size: 0.7rem;
  font-weight: 600;
}
.app-form-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.entity-prompt-cards {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}
.entity-prompt-cards[data-prompt-context="detail"] {
  margin: 0 0 0.9rem;
}
.entity-prompt-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}
.entity-prompt-card.btn-quiet {
  background: var(--brand-blue, var(--saycompute-accent));
  border-color: transparent;
  color: #0f172a;
}
.entity-prompt-card.btn-quiet:hover,
.entity-prompt-card.btn-quiet:focus-visible {
  background: #3ad6ef;
  border-color: transparent;
  color: #0f172a;
  outline: none;
}
.entity-detail-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
}
.entity-detail-form, .entity-detail-page {
  width: 100%;
  max-width: none;
}
.entity-detail-dialog[hidden] { display: none; }
.e-dialog.entity-add-dialog .e-dlg-content {
  max-height: calc(100vh - 8rem);
  overflow: auto;
}
.entity-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.entity-detail-panel {
  position: relative;
  z-index: 1;
  width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 1rem 1.15rem 1.15rem;
}
.entity-delete-btn, .entity-detail-sub .entity-btn {
  border-radius: 999px;
}
.entity-row-actions .entity-detail-first { order: -1; }
.entity-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.entity-detail-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #0f172a;
}
.bill-paid-badge {
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.05em;
}
td .bill-paid-badge {
  font-size: 0.75rem;
}
.entity-detail-grid {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
}
.entity-detail-field {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}
.entity-detail-form .entity-detail-field > input,
.entity-detail-form .entity-detail-field > select,
.entity-detail-form .entity-detail-field > textarea,
.entity-detail-form .entity-detail-field > .entity-detail-readonly,
.entity-detail-form .entity-detail-field .e-control-wrapper,
.entity-detail-form .entity-detail-field .e-input-group {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.todo-calendar-row {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
  margin: 0.75rem 0 0;
}
.entity-detail-readonly {
  min-height: 2.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.35rem 0.55rem;
  font: 400 0.875rem system-ui, sans-serif;
  color: #0f172a;
  background: #f8fafc;
}
.entity-detail-field input {
  min-height: 2.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.35rem 0.55rem;
  font: 400 0.875rem system-ui, sans-serif;
  color: #0f172a;
  background: #fff;
}
.entity-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.entity-detail-status { min-height: 1.1rem; }
.entity-detail-close { margin-left: auto; }

/* Staff attendee picker (scheduling/appointments detail dialog). Spans the grid because the
   list of users is taller than a single field, and resets the field-wide input sizing above
   so the checkboxes stay checkbox sized. */
.entity-attendees { grid-column: 1 / -1; }
.entity-attendees .entity-attendee-list {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0.35rem 0.55rem;
  max-height: 11rem;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
}
.entity-attendees .entity-attendee-list label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0;
  font: 400 0.875rem system-ui, sans-serif;
  color: #0f172a;
  cursor: pointer;
}
.entity-attendees .entity-attendee-list input[type="checkbox"] {
  min-height: 0;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  border-radius: 0.25rem;
  flex: 0 0 auto;
}

/* "Show Recommended Images" (menu-categories/menu-items/menu-modifiers detail dialogs) */
.entity-image-recommend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.entity-image-preview {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.4rem;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
}
.image-recommend-btn { font-size: 0.7rem; padding: 0.3rem 0.55rem; }

.image-recommend-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
}
.image-recommend-dialog[hidden] { display: none; }
.image-recommend-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}
.image-recommend-panel {
  position: relative;
  z-index: 1;
  width: min(38rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 1rem 1.15rem 1.15rem;
}
.image-recommend-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.image-recommend-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.image-recommend-search input {
  flex: 1;
  min-height: 2.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.35rem 0.55rem;
  font: 400 0.875rem system-ui, sans-serif;
}
.image-recommend-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}
.image-recommend-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.5rem;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.image-recommend-item:hover,
.image-recommend-item:focus-visible {
  border-color: var(--brand-blue, var(--saycompute-accent));
  outline: none;
}
.image-recommend-item img {
  width: 100%;
  height: 6rem;
  object-fit: cover;
  border-radius: 0.4rem;
  background: #f1f5f9;
}
.image-recommend-credit {
  font-size: 0.7rem;
  color: #64748b;
}
.image-recommend-score {
  font-size: 0.7rem;
  font-weight: 600;
  color: #0f766e;
}

.menu-image-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.menu-image-preview {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.35rem;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
}
.menu-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.menu-crop-panel {
  width: min(32rem, calc(100vw - 1.5rem));
  background: #fff;
  border-radius: 0.85rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 0.9rem 1rem 1rem;
}
.menu-crop-title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: #334155;
}
.menu-crop-stage {
  display: grid;
  place-items: center;
  background: #0f172a;
  border-radius: 0.5rem;
  overflow: hidden;
  max-height: min(70vh, 28rem);
}
.menu-crop-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}
.menu-crop-img {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 28rem);
  user-select: none;
  pointer-events: none;
}
.menu-crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--saycompute-accent);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
  cursor: move;
  touch-action: none;
}
.menu-crop-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: var(--saycompute-accent);
  border: 2px solid #0f172a;
  border-radius: 2px;
  cursor: nwse-resize;
}
.menu-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

/* A detail opened from a parent record's child list: it is 200px narrower than the parent page and has
   side borders so the user can tell they are no longer on the main form. */
.entity-sub-detail.max-w-5xl {
  max-width: none;
  width: calc(100% - 200px);
  border-left: 6px solid var(--brand-blue, #0ea5e9);
  border-right: 6px solid var(--brand-blue, #0ea5e9);
  background: rgba(14, 165, 233, 0.04);
}
@media (max-width: 760px) {
  .entity-sub-detail.max-w-5xl { width: 100%; }
}
