/* ==========================================================================
   Shared Record Actions + Export dialog styles
   Used by static/record-actions.js and static/export-dialog.js on every shell
   page (loaded from _nav.html). Token-driven so light/dark themes and the
   existing design system carry through unchanged.
   ========================================================================== */

/* ── Floating ⋯ menu (RecordActions.attachMenu / renderInto) ─────────────── */
.ra-menu { position: relative; display: inline-flex; }
.ra-menu-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface, #fff); color: var(--muted);
  cursor: pointer; font-size: var(--text-xl); line-height: 1;
  transition: border-color .15s, color .15s;
}
.ra-menu-btn:hover,
.ra-menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

.ra-menu-list {
  min-width: 200px; padding: 6px;
  background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg, 0 10px 28px rgba(0,0,0,.14));
  display: flex; flex-direction: column; gap: 2px;
}
.ra-menu-list[hidden] { display: none; }
/* Body-appended floating variant sits above the nav drawer/menus (z 4001–4100). */
.ra-menu-floating { position: fixed; z-index: 4200; max-height: 80vh; overflow-y: auto; }

.ra-menu-item {
  text-align: left; padding: .5rem .6rem;
  border: 0; border-radius: 7px; background: none;
  font-size: var(--text-sm); color: var(--text); cursor: pointer;
  transition: background .12s;
}
.ra-menu-item:hover,
.ra-menu-item:focus-visible { background: var(--surface-soft, #f1f5f9); outline: none; }
.ra-menu-item.is-danger { color: var(--danger, #dc2626); }
.ra-menu-item.is-danger:hover { background: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent); }

.ra-menu-label {
  padding: .5rem .6rem .25rem; margin: var(--space-1) 0 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
/* No top border on a group heading that is the very first row. */
.ra-menu-list > .ra-menu-label:first-child { border-top: 0; margin-top: 0; }
.ra-menu-sep { height: 1px; margin: var(--space-1) 2px; background: var(--border); }

/* ── Export dialog (ExportDialog.open) ───────────────────────────────────── */
.xdlg-backdrop {
  position: fixed; inset: 0; z-index: 4300;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.xdlg-card {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,.28));
  padding: var(--space-5);
}
.xdlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.xdlg-title { margin: 0; font-size: var(--text-lg); font-weight: 650; color: var(--text); }
.xdlg-close {
  border: 0; background: none; color: var(--muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 .25rem;
}
.xdlg-close:hover { color: var(--text); }
.xdlg-subtitle {
  margin: .25rem 0 0; font-size: var(--text-sm); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xdlg-section { margin-top: var(--space-4); }
.xdlg-section-label {
  margin: 0 0 var(--space-2); font-size: var(--text-2xs); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.xdlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.xdlg-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  text-align: left; padding: .7rem .8rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface, #fff);
  font-size: var(--text-sm); font-weight: 600; color: var(--text);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.xdlg-item:hover:not(.is-disabled) { border-color: var(--accent); color: var(--accent); background: var(--surface-soft, #f1f5f9); }
.xdlg-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.xdlg-item-label { flex: 1 1 auto; }
.xdlg-item-hint {
  flex: 0 0 auto; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .04em;
  color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.xdlg-item.is-disabled {
  cursor: not-allowed; opacity: .55; background: var(--surface-soft, #f1f5f9);
  color: var(--muted); border-style: dashed;
  flex-wrap: wrap;
}
.xdlg-item.is-disabled:hover { border-color: var(--border); color: var(--muted); }
.xdlg-item-reason {
  flex-basis: 100%; margin-top: .2rem; font-size: var(--text-2xs); font-weight: 500;
  color: var(--muted); font-family: inherit;
}

/* ── Shared confirm / prompt modals (RecordActions.confirm/promptText) ───── */
.ra-modal-backdrop {
  position: fixed; inset: 0; z-index: 4400;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.ra-modal-card {
  width: 100%; max-width: 400px;
  background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,.28));
  padding: var(--space-5);
}
.ra-modal-title { margin: 0; font-size: var(--text-md, 1.05rem); font-weight: 650; color: var(--text); }
.ra-modal-message { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--muted); }
.ra-modal-field { display: block; margin-top: var(--space-3); }
.ra-modal-field-label { display: block; margin-bottom: var(--space-1); font-size: var(--text-xs); color: var(--muted); }
.ra-modal-input {
  width: 100%; box-sizing: border-box; padding: .55rem .65rem;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-input, var(--surface, #fff)); color: var(--text);
  font-size: var(--text-sm);
}
.ra-modal-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.ra-modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }
.ra-modal-btn {
  padding: .5rem .9rem; border-radius: 9px; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface, #fff); color: var(--text);
  transition: background .12s, border-color .12s;
}
.ra-modal-cancel:hover { background: var(--surface-soft, #f1f5f9); }
.ra-modal-confirm { border-color: var(--accent); background: var(--accent); color: #fff; }
.ra-modal-confirm:hover { filter: brightness(.96); }
.ra-modal-confirm.is-danger { border-color: var(--danger, #dc2626); background: var(--danger, #dc2626); }

/* ── Mobile: dialog + export picker become bottom sheets ─────────────────── */
@media (max-width: 480px) {
  .xdlg-grid { grid-template-columns: 1fr; }
  .xdlg-backdrop, .ra-modal-backdrop { align-items: flex-end; padding: 0; }
  .xdlg-card, .ra-modal-card {
    max-width: none; border-radius: 16px 16px 0 0; max-height: 90vh;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .xdlg-card, .ra-modal-card, .ra-menu-floating { animation: ra-rise .16s ease both; }
  @keyframes ra-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
