:root {
  /* CRM-aligned palette */
  --primary: #0D47A1;
  --primary-hover: #0a3a85;
  --primary-10: rgba(13, 71, 161, 0.08);
  --primary-20: rgba(13, 71, 161, 0.16);

  --text: #1A2B3C;
  --text-soft: #5A6B7C;
  --text-mute: #8A9BAC;

  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --border: #E1E8EF;
  --border-hover: #C9D3DD;

  --success: #16A34A;
  --success-bg: #DCFCE7;
  --warn: #D97706;
  --danger: #DC2626;

  /* Platform accent colors (soft) */
  --crm-1: #0D47A1; --crm-2: #1E88E5;
  --log-1: #EA580C; --log-2: #FB923C;
  --ana-1: #7C3AED; --ana-2: #A78BFA;
  --reg-1: #059669; --reg-2: #34D399;
  --uni-1: #DC2626; --uni-2: #F87171;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow:    0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --shadow-xl: 0 24px 60px rgba(16, 24, 40, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================== LOGIN ===================== */
.login-body { background: #FFFFFF; }

.login-split {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #FFFFFF;
}

.login-container {
  width: 100%;
  max-width: 440px;
}

.logo-box {
  width: 180px;
  height: 180px;
  margin: 0 auto 40px;
  border-radius: 30px;
  background: #FFFFFF;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.logo-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.login-heading { text-align: center; margin-bottom: 32px; }
.login-heading h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-heading p {
  color: var(--text-soft);
  font-size: 14px;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.alert-err {
  align-items: center;
  gap: 10px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.alert-err:not([hidden]) { display: flex; }
.alert-err[hidden] { display: none !important; }

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-field input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}
.form-field input::placeholder { color: var(--text-mute); }
.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px var(--primary-10);
}

.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 48px; }
.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 8px;
  transition: all .15s;
}
.pwd-toggle:hover { color: var(--text-soft); background: var(--primary-10); }

.btn-submit {
  margin-top: 6px;
  padding: 14px 20px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.25);
}
.btn-submit:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.login-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
}

/* Login right side (image) */
.login-right {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.login-right img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.login-right-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13, 71, 161, 0.85), rgba(13, 71, 161, 0.35) 50%, rgba(13, 71, 161, 0.75));
}
.login-right-content {
  position: relative;
  z-index: 1;
  padding: 60px;
  color: #fff;
  max-width: 560px;
}
.right-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}
.login-right-content h3 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.login-right-content p {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 1024px) {
  .login-right { display: none; }
}

/* ===================== PORTAL ===================== */
.portal-body { background: var(--bg); padding-bottom: 40px; }

.portal-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
}
.header-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.header-sub {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 6px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #1E88E5);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(13, 71, 161, 0.3);
}
.user-info { line-height: 1.2; padding-right: 8px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text-mute); }
.logout-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:hover { background: #DC2626; color: #fff; }

.portal-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.hero-left { flex: 1; min-width: 280px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-10);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.hero-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 4px;
}
.hero-left p { color: var(--text-soft); font-size: 13px; max-width: 560px; }

.hero-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 130px;
}
.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-10);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 14px;
}
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.accent { background: #FEF3C7; color: #D97706; }
.stat-num { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-lbl { font-size: 10px; color: var(--text-mute); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; }

.section-header { margin-bottom: 14px; }
.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.section-header p {
  font-size: 12px;
  color: var(--text-soft);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.platform-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(.2, .8, .2, 1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  isolation: isolate;
}

/* Background image layer */
.platform-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  opacity: 0.8;
  transition: opacity 0.35s, transform 0.6s cubic-bezier(.2, .8, .2, 1);
  z-index: -2;
}

/* Gradient overlay to keep text legible */
.platform-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.78) 100%);
  z-index: -1;
  transition: opacity 0.35s;
}

.platform-card:hover::before { opacity: 1; transform: scale(1.05); }
.platform-card:hover::after { opacity: 0.7; }

.card-glow {
  position: absolute;
  top: -50%;
  right: -30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--c1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  z-index: 0;
}

.platform-card:hover {
  transform: translateY(-4px);
  border-color: var(--c1);
  box-shadow: 0 20px 40px -10px var(--c1-glow);
}
.platform-card:hover .card-glow { opacity: 0.08; }
.platform-card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }
.platform-card:hover .card-go { gap: 10px; color: var(--c1); }

.platform-card > * { position: relative; z-index: 1; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-icon-wrap { position: relative; }
.card-icon-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  filter: blur(14px);
  opacity: 0.3;
  z-index: -1;
}
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 19px;
  box-shadow: 0 6px 16px -4px var(--c1-glow);
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1);
}

.card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--success-bg);
  border-radius: 999px;
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
}
.card-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.card-body { flex: 1; }
.card-body h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.card-body p {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.card-url {
  font-size: 11px;
  color: var(--text-mute);
  font-family: 'SF Mono', Consolas, monospace;
}
.card-go {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all 0.2s;
}

/* Per-platform colors + background images */
.card-crm {
  --c1: var(--crm-1); --c2: var(--crm-2);
  --c1-glow: rgba(13, 71, 161, 0.25);
  --bg-img: url('/card-crm.jpg');
}
.card-logistica {
  --c1: var(--log-1); --c2: var(--log-2);
  --c1-glow: rgba(234, 88, 12, 0.25);
  --bg-img: url('/card-logistica.jpg');
}
.card-analiticos {
  --c1: var(--ana-1); --c2: var(--ana-2);
  --c1-glow: rgba(124, 58, 237, 0.25);
  --bg-img: url('/card-analiticos.jpg');
}
.card-regulatorio {
  --c1: var(--reg-1); --c2: var(--reg-2);
  --c1-glow: rgba(5, 150, 105, 0.25);
  --bg-img: url('/card-regulatorio.jpg');
}
.card-unimix {
  --c1: var(--uni-1); --c2: var(--uni-2);
  --c1-glow: rgba(220, 38, 38, 0.25);
  --bg-img: url('/card-unimix.jpg');
}

.portal-footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-mute);
}

@media (max-width: 768px) {
  .header-inner { padding: 14px 18px; }
  .portal-main { padding: 24px 18px 0; }
  .hero { padding: 24px; }
  .hero-left h1 { font-size: 28px; }
  .user-info { display: none; }
  .cards-grid { grid-template-columns: 1fr; gap: 16px; }
  .header-logo { height: 40px; }
  .header-divider { display: none; }
}
