:root {
  --crud-border: var(--border, #e2e8f0);
  --crud-head-bg: #f8fafc;
}

html { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
img, video, canvas, svg { max-width: 100%; height: auto; }

body { font-size: 15px; line-height: 1.55; }

.container { width: 100%; padding-left: 12px; padding-right: 12px; margin-left: auto; margin-right: auto; }

.admin-page h1 { font-size: 20px; margin: 0 0 14px; }

.admin-nav { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.admin-nav a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; }
.admin-nav-tables { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.admin-nav-tables .input { width: 100%; }

.crud-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.crud-toolbar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crud-toolbar-right { width: 100%; }
.crud-toolbar-right .input { width: 100%; }
.crud-total { font-size: 12px; color: var(--text-muted, #64748b); }

.crud-grid-wrap {
  width: 100%;
  max-height: 60vh;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--crud-border);
  border-radius: 12px;
  background: #fff;
}
.crud-grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.crud-grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--crud-head-bg);
  padding: 10px 12px; text-align: left; white-space: nowrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #475569;
  border-bottom: 1px solid var(--crud-border); cursor: pointer; user-select: none;
}
.crud-grid thead th.crud-acciones-th { cursor: default; text-align: right; }
.crud-grid thead th.active { color: #0ea5e9; }
.crud-grid td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; white-space: nowrap; }
.crud-grid tbody tr:hover { background: #f8fafc; }
.crud-empty { text-align: center; padding: 22px; color: var(--text-muted, #64748b); white-space: normal; }
.crud-acciones { display: flex; gap: 6px; justify-content: flex-end; }
.crud-btn { padding: 5px 9px; font-size: 13px; line-height: 1; }

.crud-pager { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 12px; }
.crud-pager-items { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.crud-pager-items .input { width: 90px; }
.crud-pager-nav { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.crud-pager-nav .btn { min-width: 42px; padding: 6px 10px; }
.crud-pager-nav .input { min-width: 110px; }

.crud-form { display: flex; flex-direction: column; gap: 12px; }
.crud-field { display: flex; flex-direction: column; gap: 4px; }
.crud-field .input { width: 100%; }

.modal { width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; }
.modal-body { overflow-x: auto; }

@media (min-width: 480px) {
  body { font-size: 15.5px; }
  .crud-toolbar { flex-direction: row; justify-content: space-between; align-items: center; }
  .crud-toolbar-right { width: auto; min-width: 240px; }
  .crud-pager { flex-direction: row; justify-content: space-between; align-items: center; }
  .modal { border-radius: 14px; }
}

@media (min-width: 768px) {
  .container { padding-left: 20px; padding-right: 20px; max-width: 1180px; }
  .admin-page h1 { font-size: 24px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .admin-nav-tables { flex-direction: row; align-items: center; margin-top: 0; margin-left: auto; }
  .admin-nav-tables .input { width: auto; min-width: 190px; }
  .crud-grid { font-size: 14px; }
  .crud-grid-wrap { max-height: 65vh; }
  .crud-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

@media (min-width: 1100px) {
  .crud-grid-wrap { max-height: 70vh; }
  .crud-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
