:root {
  --brand: #D9A51E;
  --brand-deep: #B98408;
  --brand-soft: #F8E9B9;
  --ink: #18344A;
  --teal: #087C91;
  --paper: #F7F8FA;
  --surface: #FFFFFF;
  --muted: #73808B;
  --line: rgba(24, 52, 74, 0.11);
  --shadow: 0 28px 80px rgba(21, 42, 58, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button, input { font: inherit; }
button { cursor: pointer; }

/* Fondo animado */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--brand) 19%, transparent), transparent 32%),
              radial-gradient(circle at 90% 85%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 32%),
              linear-gradient(135deg, #f8f9fb, #eef2f4);
}

.ambient:before, .ambient:after {
  content: "";
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-radius: 50%;
  width: 48vw;
  height: 48vw;
  right: -13vw;
  top: -20vw;
  animation: float 18s ease-in-out infinite alternate;
}

.ambient:after {
  width: 32vw;
  height: 32vw;
  right: auto;
  left: -12vw;
  top: auto;
  bottom: -16vw;
  border-color: color-mix(in srgb, var(--teal) 20%, transparent);
  animation-delay: -5s;
}

@keyframes float {
  to { transform: translate(2vw, 3vh) rotate(12deg); }
}

.hidden { display: none !important; }

/* LOGIN STYLES */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(100%, 1000px);
  min-height: 590px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: appear 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 76%, #fff));
  overflow: hidden;
}

.brand-panel:before, .brand-panel:after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  width: 420px;
  height: 420px;
  right: -190px;
  top: 80px;
}

.brand-panel:after {
  width: 300px;
  height: 300px;
  right: -130px;
  top: 140px;
}

.brand-logo {
  width: min(270px, 85%);
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 12px 16px rgba(37, 54, 65, 0.08));
}

.brand-copy { position: relative; z-index: 1; max-width: 360px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(24, 52, 74, 0.68); }
.brand-copy h1 { font: 800 clamp(34px, 4vw, 52px)/1.04 'Manrope', sans-serif; margin: 14px 0; color: #17374B; letter-spacing: -0.05em; }
.brand-copy p { font-size: 14px; line-height: 1.8; color: rgba(24, 52, 74, 0.78); max-width: 310px; margin: 0; }
.brand-foot { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(24, 52, 74, 0.6); position: relative; z-index: 1; }

.form-panel { padding: 54px clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; }
.form-panel .eyebrow { color: var(--teal); }
.form-panel h2 { font: 800 31px 'Manrope', sans-serif; letter-spacing: -0.04em; margin: 12px 0 8px; color: var(--ink); }
.intro { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0 0 32px; }
.field { margin: 0 0 19px; }
.field label { display: block; font-size: 12px; font-weight: 700; margin: 0 0 9px; color: #354A59; }
.input-wrap { position: relative; }
.field input { width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 13px; background: #F9FAFB; padding: 0 15px; color: var(--ink); outline: none; transition: 0.2s; }
.field input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 12%, transparent); background: #fff; }
.password-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.login-button { width: 100%; height: 53px; border: 0; border-radius: 13px; color: #fff; font-weight: 700; letter-spacing: 0.02em; background: linear-gradient(110deg, var(--teal), color-mix(in srgb, var(--teal) 72%, var(--ink))); box-shadow: 0 12px 25px color-mix(in srgb, var(--teal) 24%, transparent); transition: 0.25s; }
.login-button:hover { transform: translateY(-2px); box-shadow: 0 16px 30px color-mix(in srgb, var(--teal) 30%, transparent); }
.error { min-height: 20px; margin: 10px 0 0; color: #B54747; font-size: 12px; }
.palette-area { margin-top: 29px; padding-top: 22px; border-top: 1px solid var(--line); }
.palette-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 13px; }
.palette-label { font-size: 11px; color: var(--muted); margin-left: 4px; }
.credential-note { font-size: 11px; color: #89939B; margin-top: 22px; line-height: 1.6; }

/* PORTAL STYLES */
.portal { min-height: 100vh; padding: 28px; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 auto 32px; width: min(1200px, 100%); }
.top-logo { width: 150px; height: 90px; object-fit: contain; }
.user-pill { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.78); border: 1px solid var(--line); padding: 10px 15px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.user-dot { width: 8px; height: 8px; background: #4E9B72; border-radius: 50%; box-shadow: 0 0 0 4px rgba(78, 155, 114, 0.12); }
.logout { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; margin-left: 8px; text-decoration: none; }
.portal-content { width: min(1100px, 100%); margin: auto; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-bottom: 40px; }
.portal-kicker { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--teal); font-weight: 700; }
.portal-content h1 { font: 800 clamp(42px, 7vw, 82px)/1.05 'Manrope', sans-serif; letter-spacing: -0.06em; margin: 14px 0; color: var(--ink); }
.portal-content > p { color: var(--muted); font-size: 15px; margin: 0 0 38px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(230px, 300px)); gap: 20px; width: 100%; justify-content: center; }
.module-card { border: 1px solid rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.78); border-radius: 22px; padding: 28px; text-align: left; box-shadow: 0 16px 45px rgba(21, 42, 58, 0.08); transition: 0.25s; position: relative; overflow: hidden; }
.module-card:hover { transform: translateY(-6px); box-shadow: 0 24px 55px rgba(21, 42, 58, 0.14); border-color: color-mix(in srgb, var(--brand) 55%, white); }
.module-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 17%, white); color: var(--teal); font-size: 23px; margin-bottom: 22px; }
.module-card h3 { font: 800 20px 'Manrope', sans-serif; margin: 0 0 7px; }
.module-card p { font-size: 12px; color: var(--muted); margin: 0; }
.module-arrow { position: absolute; right: 25px; bottom: 28px; color: var(--teal); font-size: 20px; }

.workspace { 
  width: 100%; 
  max-width: 100%; 
  margin: 0; 
  padding: 0 20px; 
  display: flex; 
  gap: 16px; 
  flex: 1; 
  min-height: 0; 
}
.sidebar { 
  width: 200px; 
  flex: 0 0 200px; 
  padding: 14px; 
  background: rgba(255, 255, 255, 0.85); 
  border: 1px solid white; 
  border-radius: 20px; 
  box-shadow: 0 16px 45px rgba(21, 42, 58, 0.07); 
  height: fit-content;
}
.side-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px 15px; }
.side-link { width: 100%; border: 0; background: transparent; border-radius: 13px; padding: 14px 13px; text-align: left; display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 12px; color: var(--ink); margin-bottom: 7px; transition: 0.2s; }
.side-link:hover, .side-link.active { background: color-mix(in srgb, var(--brand) 18%, white); color: var(--teal); }
.side-icon { font-size: 18px; width: 24px; text-align: center; }
.view-panel { 
  flex: 1; 
  min-width: 0; 
  background: rgba(255, 255, 255, 0.7); 
  border: 1px solid white; 
  border-radius: 22px; 
  padding: 8px; 
  box-shadow: 0 16px 45px rgba(21, 42, 58, 0.07); 
}
.frame { width: 100%; height: calc(100vh - 150px); border: 0; border-radius: 15px; background: #fff; }
.view-empty { height: calc(100vh - 180px); display: grid; place-items: center; text-align: center; color: var(--muted); }
.view-empty strong { display: block; color: var(--ink); font: 800 28px 'Manrope'; margin-bottom: 8px; }

@media(max-width: 760px) {
  .login-card { grid-template-columns: 1fr; max-width: 480px; }
  .brand-panel { min-height: 235px; padding: 26px; }
  .brand-logo { width: 155px; }
  .brand-copy h1 { font-size: 30px; margin: 8px 0; }
  .brand-copy p, .brand-foot { display: none; }
  .form-panel { padding: 32px 28px; }
  .portal { 
  min-height: 100vh; 
  padding: 20px 24px; 
  display: flex; 
  flex-direction: column; 
}
  .topbar { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  gap: 20px; 
  margin: 0 10px 24px 10px; 
  width: auto; 
}
  .top-logo { width: 115px; height: 68px; }
  .module-grid { grid-template-columns: 1fr; max-width: 390px; }
  .workspace { flex-direction: column; }
  .sidebar { width: 100%; flex: auto; display: flex; align-items: center; gap: 8px; padding: 10px; }
  .side-label { display: none; }
  .side-link { margin: 0; justify-content: center; padding: 12px 8px; }
  .side-link span:last-child { font-size: 10px; }
  .frame { height: 70vh; }
}

@media(prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; }
}