:root {
  color-scheme: light;
  --portal-bg: #f1f5f9;
  --portal-surface: #ffffff;
  --portal-text: #0f172a;
  --portal-muted: #64748b;
  --portal-line: #e2e8f0;
  --portal-primary: #b91c1c;
  --portal-primary-dark: #991b1b;
  --portal-primary-soft: #fee2e2;
  --portal-radius: 12px;
  --portal-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--portal-text);
  background: var(--portal-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.portal-header {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 55%, #dc2626 100%);
  color: #fff;
  padding: 28px 20px 32px;
}

.portal-header__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.portal-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.portal-user[hidden] {
  display: none !important;
}

.portal-user__name {
  max-width: min(320px, 60vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.portal-user__logout {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
  line-height: 0;
}

.portal-user__logout:hover {
  background: rgba(255, 255, 255, 0.22);
}

.portal-user__logout svg {
  width: 15px;
  height: 15px;
  display: block;
}

.portal-header h1 {
  margin: 14px 0 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.2;
  font-weight: 700;
}

.portal-header p {
  margin: 0;
  max-width: 640px;
  font-size: 0.9375rem;
  opacity: 0.92;
}

.portal-main {
  max-width: 1100px;
  margin: -18px auto 32px;
  padding: 0 20px;
}

.portal-section {
  background: var(--portal-surface);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.portal-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.portal-section__head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.portal-section__head p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--portal-muted);
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.portal-card:hover {
  border-color: #fca5a5;
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.08);
  transform: translateY(-1px);
}

.portal-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--portal-primary-soft);
  color: var(--portal-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-card__icon svg {
  width: 20px;
  height: 20px;
}

.portal-card__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--portal-muted);
}

.portal-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
}

.portal-card__meta {
  margin-top: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--portal-primary);
}

.portal-footer {
  max-width: 1100px;
  margin: 0 auto 28px;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--portal-muted);
}

.portal-footer a {
  color: var(--portal-primary);
  font-weight: 600;
}

.portal-footer a:hover {
  text-decoration: underline;
}

.portal-footer .ipc-site-footer__brand-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.portal-footer .ipc-site-footer__copy,
.portal-footer .ipc-site-footer__brand {
  color: var(--portal-muted);
}

.portal-footer .ipc-legal-footer__text {
  flex: 1 1 100%;
  width: 100%;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: #94a3b8;
  text-align: center;
  white-space: nowrap;
  max-width: none;
}

@media (max-width: 900px) {
  .portal-footer .ipc-legal-footer__text {
    white-space: normal;
    font-size: 0.625rem;
    line-height: 1.35;
  }
}

/* Respaldo si falta floating-actions.css en alguna página del portal */
.ipc-float-dock .ipc-float-btn svg {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
}

@media (max-width: 640px) {
  .portal-header {
    padding: 22px 16px 28px;
  }

  .portal-main {
    padding: 0 14px;
  }

  .portal-section {
    padding: 16px;
  }
}
