.button { min-height: var(--marh-control-height); display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid transparent; border-radius: var(--marh-radius-sm); font-weight: 600; font-size: .84rem; text-decoration: none; line-height: 1.5; transition: background-color 140ms; }
.button-primary { background: var(--marh-primary); color: var(--marh-on-dark); }
.button-primary:hover { background: var(--marh-primary-hover); }
.button-secondary { background: var(--marh-surface); border-color: var(--marh-border); color: var(--marh-text); }
.button-secondary:hover { background: var(--marh-bg); }
.button-danger { background: var(--marh-danger); color: var(--marh-on-dark); }
.button-danger:hover { background: var(--marh-danger-hover); }
.button-text { background: transparent; color: var(--marh-primary); }
.button-text:hover { background: var(--marh-primary-soft); }
.button-block { width: 100%; }
.button:disabled { opacity: .7; }
.button-arrow { margin-left: auto; font-size: 1.2rem; line-height: 1; }
.icon-button { min-height: var(--marh-control-height); min-width: var(--marh-control-height); display: inline-grid; place-items: center; background: transparent; border: 1px solid var(--marh-border); border-radius: var(--marh-radius-sm); color: inherit; font-size: 1rem; }
.icon-button:hover { background: var(--marh-bg); }
.field { display: grid; gap: 7px; margin: 0 0 22px; }
.field label { font-size: .78rem; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: var(--marh-control-height); padding: 7px 11px; background: var(--marh-surface); border: 1px solid var(--marh-border); color: var(--marh-text); border-radius: var(--marh-radius-sm); }
.field textarea { min-height: 90px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--marh-muted); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--marh-primary); outline-offset: 2px; }
.field input.input-validation-error, .field [aria-invalid="true"] { border-color: var(--marh-danger); }
.field-help { color: var(--marh-muted); font-size: .75rem; line-height: 1.6; margin: 0; }
.field-error { color: var(--marh-danger); font-size: .78rem; }
.field-error:empty { display: none; }
.panel { background: var(--marh-surface); border: 1px solid var(--marh-border); border-radius: var(--marh-radius); padding: 18px; box-shadow: var(--marh-shadow-card); }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; background: var(--marh-bg); color: var(--marh-muted); border-radius: 999px; font-size: .7rem; font-weight: 650; line-height: 1.6; }
.badge-success { color: var(--marh-success); background: var(--marh-success-bg); }
.badge-warning { color: var(--marh-warning); background: var(--marh-warning-bg); }
.badge-danger { color: var(--marh-danger); background: var(--marh-danger-bg); }
.badge-info { color: var(--marh-info); background: var(--marh-info-bg); }
.alert { padding: 10px 14px; border: 1px solid currentColor; border-radius: var(--marh-radius-sm); margin-bottom: 22px; font-size: .83rem; }
.alert p { margin: 6px 0 0; }
.alert ul { margin: 8px 0 0; padding-left: 18px; }
.alert-danger { background: var(--marh-danger-bg); color: var(--marh-danger); }
.alert-warning { background: var(--marh-warning-bg); color: var(--marh-warning); }
.alert-success { background: var(--marh-success-bg); color: var(--marh-success); }
.alert-info { background: var(--marh-info-bg); color: var(--marh-info); border-color: var(--marh-border); }
.table-scroll { overflow-x: auto; border: 1px solid var(--marh-border); border-radius: var(--marh-radius-sm); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .82rem; }
caption { text-align: left; font-weight: 650; padding: 12px 16px; }
th { color: var(--marh-muted); font-size: .72rem; font-weight: 650; background: var(--marh-surface-subtle); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--marh-border); }
.breadcrumbs { color: var(--marh-muted); font-size: .76rem; margin-bottom: 32px; }
.breadcrumbs ol { display: flex; gap: 10px; padding: 0; margin: 0; list-style: none; flex-wrap: wrap; }
.breadcrumbs li + li::before { content: "/"; margin-right: 10px; }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 24px; }
.pagination a, .pagination button { min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--marh-border); border-radius: var(--marh-radius-sm); background: var(--marh-surface); text-decoration: none; }
.pagination [aria-current="page"] { color: var(--marh-on-dark); background: var(--marh-primary); }
.empty-state, .loading-state, .error-state { text-align: center; padding: 32px 20px; }
.empty-symbol { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--marh-radius); background: var(--marh-primary-soft); color: var(--marh-primary); font-size: 1.7rem; }
.loading-state::before { content: ""; display: block; width: 24px; height: 24px; margin: 0 auto 12px; border: 2px solid var(--marh-border); border-top-color: var(--marh-primary); border-radius: 50%; animation: marh-spin 900ms linear infinite; }
@keyframes marh-spin { to { transform: rotate(360deg); } }
.dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; border: 1px solid var(--marh-border); border-radius: var(--marh-radius-lg); padding: 28px; background: var(--marh-surface); color: var(--marh-text); box-shadow: var(--marh-shadow-raised); }
.dialog::backdrop { background: var(--marh-overlay); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-header h2 { margin: 0; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 12px); min-width: 240px; max-width: min(320px, calc(100vw - 32px)); padding: 12px; background: var(--marh-surface); border: 1px solid var(--marh-border); border-radius: var(--marh-radius); box-shadow: var(--marh-shadow-raised); z-index: 20; }
.menu-panel p { padding: 10px; font-size: .8rem; overflow-wrap: anywhere; margin: 0 0 8px; border-bottom: 1px solid var(--marh-border); }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: grid; gap: 12px; width: min(380px, calc(100% - 48px)); }
.toast { background: var(--marh-surface); color: var(--marh-text); border: 1px solid var(--marh-border); border-left: 4px solid var(--marh-primary); border-radius: var(--marh-radius-sm); padding: 16px; box-shadow: var(--marh-shadow-raised); display: flex; align-items: start; gap: 12px; }
.toast p { margin: 0; overflow-wrap: anywhere; }
.toast button { margin-left: auto; }

/* Optional presentation primitives; data and behavior remain in their modules. */
.page-header, .section-header, .toolbar, .filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--marh-space-4); }
.page-header { margin-bottom: var(--marh-space-6); }
.page-header h1, .section-header h2 { margin-bottom: var(--marh-space-2); }
.page-header p, .section-header p { margin: 0; color: var(--marh-muted); }
.toolbar, .filter-bar { justify-content: flex-start; }
.filter-bar .field { flex: 1 1 180px; margin-bottom: 0; }
.status-indicator { display: inline-flex; align-items: center; gap: var(--marh-space-2); }
.status-indicator::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.button:disabled, .icon-button:disabled { cursor: not-allowed; }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }
.table-scroll tbody tr:hover { background: var(--marh-surface-subtle); }
/* Phones: list tables turn into cards. Each cell shows its column name (data-label); the first cell is the card title. */
@media (max-width: 640px) {
  .table-cards { border: 0; overflow: visible; }
  .table-cards table, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; min-width: 0 !important; }
  .table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-cards caption { display: none; }
  .table-cards tr { margin-bottom: 10px; padding: 10px 14px; border: 1px solid var(--marh-border); border-radius: var(--marh-radius-sm); background: var(--marh-surface); }
  .table-cards tbody tr:hover { background: var(--marh-surface); }
  .table-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
  .table-cards td::before { content: attr(data-label); flex: 0 0 38%; color: var(--marh-muted); font-size: .74rem; font-weight: 600; text-align: left; }
  .table-cards td:first-child { display: block; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--marh-border); text-align: left; font-size: .92rem; }
  .table-cards td:first-child::before { display: none; }
  .table-cards td[data-label="Acciones"], .table-cards td[data-label="Acción"] { display: block; padding-top: 8px; text-align: left; }
  .table-cards td[data-label="Acciones"]::before, .table-cards td[data-label="Acción"]::before { display: none; }
  .table-cards td.numeric { text-align: right; }
}
.menu-link { display: flex; align-items: center; gap: 10px; min-height: var(--marh-control-height); padding: 8px 10px; border-radius: var(--marh-radius-sm); color: var(--marh-text); font-weight: 600; text-decoration: none; }
.menu-link:hover, .menu-link:focus-visible { background: var(--marh-primary-soft); color: var(--marh-primary); }
.menu-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
