/* Theme geometry is independent of interaction: buttons retain rectangular hit areas. */
#settings-dialog .dialog-actions button:not(.confirm) {
  color: var(--ink); border-color: var(--muted); background: transparent;
}
#settings-dialog .dialog-actions button:not(.confirm):hover {
  color: var(--ink); background: var(--soft);
}
.status-restoration-disabled { border-radius: 999px; }

body[data-theme="journal"] :is(button, input, select, textarea) {
  border-radius: 2px !important;
}
body[data-theme="journal"] .tab { border-radius: 0 !important; }
body[data-theme="journal"] .collection-switch button,
body[data-theme="journal"] :is(.edit, .delete, .dialog-actions button) {
  border-radius: 3px !important;
}
body[data-theme="journal"] .collection-switch button[aria-pressed="true"] {
  background: var(--soft); border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 2px 2px 0 var(--accent);
}
body[data-theme="directorate"] { --command-fill: #742e40; --command-ink: #ffffff; --command-edge: #b97586; }
body[data-theme="directorate"] :is(button, input, select, textarea) {
  border-radius: 0 !important;
}
body:is([data-theme="journal"], [data-theme="directorate"]) :is(
  .tab, .collection-switch button, .edit, .delete, .restore, .add-entry,
  .cancel-composer, .reset, .theme-selector button, .dialog-actions button,
  .crop-controls button, input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select
) { min-height: 44px; min-width: 44px; }
body[data-theme="journal"] .journal-database .record-actions-button { min-height: 44px; }
body:is([data-theme="journal"], [data-theme="directorate"]) button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
body[data-theme="journal"] .tab:focus-visible { outline-color: #d6a340; outline-offset: -4px; }

/* A neutral outline opens the export workflow; the final command is primary. */
body[data-theme="directorate"] [data-download-record] {
  background: transparent; color: var(--ink); border-color: var(--muted);
}
body[data-theme="directorate"] [data-download-record]:hover {
  background: var(--soft); color: var(--ink);
}
body[data-theme="directorate"] :is(#settings-dialog #reset, #confirm-reset) {
  background: transparent; color: #a4283d; border: 1px solid currentColor;
}
body[data-theme="directorate"][data-view="ugly"] :is(#settings-dialog #reset, #confirm-reset) { color: #ffb5bf; }

/* Reusable command selector: final confirmations opt in through .confirm.
   Reset is deliberately excluded because it manages the demo, not the archive. */
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
) {
  --command-cut: 8px;
  position: relative; isolation: isolate; overflow: visible;
  clip-path: none; mask: none; background: transparent; border: 1px solid transparent;
  color: var(--command-ink); box-shadow: none; filter: none;
  min-height: 44px; min-width: 44px; padding: 10px 18px;
}
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
)::before,
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
)::after {
  content: ""; position: absolute; pointer-events: none;
  clip-path: polygon(0 0, calc(100% - var(--command-cut)) 0, 100% var(--command-cut), 100% 100%, var(--command-cut) 100%, 0 calc(100% - var(--command-cut)));
}
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
)::before { inset: -1px; z-index: -2; background: var(--command-edge); }
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
)::after { inset: 0; z-index: -1; background: var(--command-fill); }
body[data-theme="directorate"] button:is(
  .delete, .edit-delete, [data-hide-record], #confirm-delete, #confirm-restoration-eligibility
) { --command-fill: #832d3c; --command-edge: #d77b89; }
body[data-theme="directorate"] button[data-restore] { --command-fill: #35563f; --command-edge: #87ad90; }
body[data-theme="directorate"] button#confirm-record-download { --command-fill: #263e35; --command-edge: #8aa898; }
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
):hover:not(:disabled)::after { filter: brightness(1.18); }
body[data-theme="directorate"] button:is(
  .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
  .dialog-actions .confirm:not(#confirm-reset)
):active:not(:disabled)::after { filter: brightness(.9); }
body[data-theme="directorate"] button:disabled { cursor: not-allowed; }

/* Status stamps have smaller cuts and no interactive states. */
body[data-theme="directorate"] :is(.dir-stamp, .dir-retained-label) {
  --stamp-cut: 4px; position: relative; isolation: isolate; display: inline-block;
  border: 1px solid transparent; border-radius: 0; padding: 6px 10px;
}
body[data-theme="directorate"] :is(.dir-stamp, .dir-retained-label)::before,
body[data-theme="directorate"] :is(.dir-stamp, .dir-retained-label)::after {
  content: ""; position: absolute; pointer-events: none;
  clip-path: polygon(0 0, calc(100% - var(--stamp-cut)) 0, 100% var(--stamp-cut), 100% 100%, var(--stamp-cut) 100%, 0 calc(100% - var(--stamp-cut)));
}
body[data-theme="directorate"] :is(.dir-stamp, .dir-retained-label)::before { inset: -1px; z-index: -2; background: currentColor; }
body[data-theme="directorate"] :is(.dir-stamp, .dir-retained-label)::after { inset: 0; z-index: -1; background: var(--surface); }
body[data-theme="directorate"] .dir-retained-label::after { background: var(--soft); }
@media (max-width: 600px) {
  body[data-theme="directorate"] button:is(
    .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
    .dialog-actions .confirm:not(#confirm-reset)
  ) { --command-cut: 6px; }
}
@media (forced-colors: active) {
  body[data-theme="directorate"] button:is(
    .add-entry, .delete, .edit-delete, [data-restore], [data-hide-record],
    .dialog-actions .confirm:not(#confirm-reset)
  ) { border-color: ButtonText; background: ButtonFace; color: ButtonText; }
}
