:root {
  --color-bg: #F4F6F8;
  --color-card: #FFFFFF;
  --color-text: #2E2E2E;
  --color-label: #4A4A4A;
  --color-version: #A0A0A0;
  --color-border: #D9DDE3;

  --color-accent: #15144F;
  --color-accent-hover: #10103E;
  --color-menu-active: #2A2977;

  --color-danger: #B91C1C;
  --color-success: #15803D;
  --color-warning: #B45309;
  --color-info: #1D4ED8;

  --header-height: 52px;
  --sidebar-width: 180px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

button,
input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* =========================
   LOGIN
========================= */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--color-bg);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--color-card);
  border-radius: 18px;
  padding: 30px 32px 28px 32px;
  border: 1px solid rgba(217, 221, 227, 0.9);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.login-version {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 4px 6px;
  color: var(--color-version);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-align: right;
}

.login-brand {
  text-align: center;
  margin-bottom: 18px;
  padding: 0;
  background: transparent;
  border: none;
}

.login-logo {
  width: 100%;
  max-width: 320px;
  max-height: 145px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.login-logo-placeholder,
.login-brand h1,
.login-brand p {
  display: none;
}

.login-message {
  text-align: center;
  margin: 0 0 22px 0;
  color: #2E2E2E;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
}

.login-form label {
  color: #4A4A4A;
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

.input-icon-group {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.input-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.login-form input {
  width: 100%;
  height: 48px;
  padding: 12px 14px 12px 48px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  background: #FFFFFF;
  color: #2E2E2E;
}

.login-form input::placeholder {
  color: #A0A0A0;
}

.login-form input:focus {
  border-color: #15144F;
  box-shadow: 0 0 0 3px rgba(21, 20, 79, 0.10);
}

.login-form button {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: #15144F;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.login-form button:hover {
  background: #10103E;
}

.login-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-alert {
  margin-top: 14px;
  min-height: 22px;
  color: var(--color-danger);
  font-size: 13px;
  text-align: center;
}

/* =========================
   APP BASE
========================= */

.app-screen {
  min-height: 100vh;
  background: var(--color-bg);
}

/* HEADER */

.app-header {
  min-height: var(--header-height);
  height: var(--header-height);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(21, 20, 79, 0.04);
}

.header-left,
.header-user {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-left {
  min-width: 260px;
  gap: 0;
}

.header-brand {
  display: flex;
  align-items: center;
}

.header-logo-wrap {
  display: flex;
  align-items: center;
  gap: 30px;
}

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.header-title-block strong {
  color: #2E2E2E;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.header-title-block small {
  margin-top: 3px;
  color: #A0A0A0;
  font-size: 11px;
  font-weight: 400;
}

.header-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 0 18px;
}

.header-breadcrumb {
  max-width: 100%;
  color: #4A4A4A;
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user {
  min-width: 150px;
  justify-content: flex-end;
  gap: 12px;
}

.header-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

#headerUserName {
  color: #2E2E2E;
  font-size: 13px;
  font-weight: 600;
}

#headerUserRole {
  margin-top: 3px;
  color: #A0A0A0;
  font-size: 11px;
  font-weight: 400;
}

#btnLogout {
  border: none;
  background: #15144F;
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

#btnLogout:hover {
  background: #10103E;
}

.menu-mobile-btn {
  display: none;
  border: 1px solid var(--color-border);
  background: #FFFFFF;
  color: #15144F;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

/* LAYOUT */

.app-body {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

/* MENÚ LATERAL */

.side-menu {
  width: var(--sidebar-width);
  background: #15144F;
  color: #FFFFFF;
  flex-shrink: 0;
  padding: 10px 7px;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height));
}

.side-menu nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  width: 100%;
  min-height: 36px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.menu-icon {
  width: 16px;
  min-width: 16px;
  height: 16px;
  font-size: 16px;
  line-height: 1;
  color: currentColor;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.menu-item.active {
  background: #2A2977;
  color: #FFFFFF;
  font-weight: 700;
}

/* CONTENIDO */

.main-content {
  flex: 1;
  padding: 18px;
  overflow: auto;
  background: #F4F6F8;
}

.content-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Pantalla base de módulo */

.module-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 28px rgba(21, 20, 79, 0.06);
}

.breadcrumb {
  font-size: 12px;
  color: #A0A0A0;
  margin-bottom: 8px;
  font-weight: 400;
}

.module-title {
  margin: 0 0 8px 0;
  color: #2E2E2E;
  font-size: 24px;
  font-weight: 700;
}

.module-description {
  margin: 0;
  color: #4A4A4A;
  font-size: 14px;
  font-weight: 400;
}

/* Preparación para futuras tarjetas internas por módulo */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.submodule-card {
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(21, 20, 79, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.submodule-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(21, 20, 79, 0.08);
}

.submodule-card h3 {
  margin: 0 0 6px 0;
  color: #2E2E2E;
  font-size: 15px;
  font-weight: 700;
}

.submodule-card p {
  margin: 0;
  color: #4A4A4A;
  font-size: 13px;
  line-height: 1.4;
}

.submodule-card {
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--color-border);
}

.submodule-card strong {
  display: block;
  margin: 0 0 6px 0;
  color: #2E2E2E;
  font-size: 15px;
  font-weight: 700;
}

.submodule-card span {
  display: block;
  color: #4A4A4A;
  font-size: 13px;
  line-height: 1.4;
}

.submodule-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.submodule-card.disabled:hover {
  transform: none;
  box-shadow: 0 6px 18px rgba(21, 20, 79, 0.04);
}



/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {
  .login-screen {
    padding: 16px;
    align-items: center;
  }

  .login-card {
    max-width: 100%;
    border-radius: 18px;
    padding: 28px 22px 24px 22px;
  }

  .login-logo {
    max-width: 285px;
    max-height: 130px;
  }

  .login-message {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .app-header {
    min-height: 56px;
    height: 56px;
    padding: 0 10px;
    gap: 8px;
  }

  .menu-mobile-btn {
    display: inline-block;
  }

  .header-left {
    min-width: 0;
    flex: 1;
  }

  .header-logo-wrap {
    gap: 12px;
  }

  .header-logo {
    width: 34px;
    height: 34px;
  }

  .header-title-block strong {
    font-size: 13px;
  }

  .header-title-block small {
    font-size: 10px;
  }

  .header-center {
    display: none;
  }

  .header-user {
    min-width: auto;
    gap: 8px;
  }

  .header-user-info {
    display: none;
  }

  #btnLogout {
    padding: 7px 11px;
    font-size: 12px;
  }

  .app-body {
    display: block;
    min-height: calc(100vh - 56px);
  }

  .side-menu {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 150px;
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

  .side-menu.open {
    transform: translateX(0);
  }

  .main-content {
    padding: 14px;
  }

  .module-card {
    border-radius: 14px;
    padding: 18px;
  }

  .module-title {
    font-size: 22px;
  }

  .module-description {
    font-size: 14px;
  }

  .module-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}