/* Base: reset, variables, layout centrado, componentes compartidos */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.15);
  --header-h: 64px;
  --sidebar-w: 260px;
  --accent: #ff7800;
  --accent-hover: #e56a00;
  --accent-soft: #ffedd5;
  --navy: #00112b;
  --navy-2: #0a1f3d;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --overlay: rgba(15, 23, 42, 0.75);
  --focus: 0 0 0 3px rgba(249, 115, 22, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-soft: #431407;
    --navy: #020617;
    --navy-2: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-soft: #64748b;
    --bg: #0b1120;
    --bg-soft: #111827;
    --bg-card: #1e293b;
    --border: #334155;
    --overlay: rgba(0, 0, 0, 0.82);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

main {
  display: block;
  width: 100%;
  flex: 1;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.container {
  width: 100%;
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Alias por si algún bloque usa .wrap */
.wrap {
  width: 100%;
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded", sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
  user-select: none;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn--outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn--sm { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* Formularios */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--bg);
  color: var(--text);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert--error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert__action {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.alert__action:hover {
  color: var(--accent-hover);
}

@media (prefers-color-scheme: dark) {
  .alert--error {
    background: #450a0a;
    border-color: #7f1d1d;
  }
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge--ok { background: #dcfce7; color: #166534; }
.badge--warn { background: #fef3c7; color: #92400e; }
.badge--muted { background: var(--bg-soft); color: var(--text-muted); }

@media (prefers-color-scheme: dark) {
  .badge--ok { background: #14532d; color: #86efac; }
  .badge--warn { background: #78350f; color: #fcd34d; }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-soft);
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

[data-favorite].is-favorited .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: #ef4444;
}

body.modal-open {
  overflow: hidden;
}

/* Diálogos personalizados (reemplazan alert/confirm/prompt del navegador) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.modal__panel {
  position: relative;
  background: var(--bg-card);
  color: var(--text);
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}

.modal.is-open .modal__panel {
  transform: translateY(0);
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
    padding: 1rem;
  }
  .modal__panel {
    border-radius: var(--radius-lg);
    max-height: 85vh;
  }
}

.oy-dialog__title {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.oy-dialog__message {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.oy-dialog__message--success .oy-dialog__icon {
  color: var(--success);
}

.oy-dialog__message--error .oy-dialog__icon {
  color: var(--danger);
}

.oy-dialog__message--warning .oy-dialog__icon {
  color: var(--warning);
}

.oy-dialog__message--info .oy-dialog__icon {
  color: var(--accent);
}

.oy-dialog__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.oy-dialog__body .form-group {
  margin-top: 1rem;
}

.oy-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}
