:root {
  color-scheme: light;
  --bg: #eef2f5;
  --ink: #111820;
  --muted: #65717f;
  --line: #d4dde6;
  --panel: #ffffff;
  --accent: #f9eb1d;
  --accent-strong: #e3d411;
  --dark: #030405;
  --bad: #aa2438;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 242, 245, 0.96), rgba(238, 242, 245, 0.98)),
    url("hormetal-brand.jpg") center / cover fixed no-repeat,
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Inter, Arial, Helvetica, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
}

p,
small {
  color: var(--muted);
}

.loginView {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(3, 4, 5, 0.9), rgba(3, 4, 5, 0.68) 45%, rgba(238, 242, 245, 0.92) 70%),
    url("hormetal-brand.jpg") center / cover no-repeat,
    #101418;
}

.loginShell {
  width: min(980px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.loginBrand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 34px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(238, 242, 245, 0.82), rgba(247, 249, 251, 0.66)),
    url("hormetal-brand.jpg") center / cover no-repeat;
  backdrop-filter: blur(2px);
}

.loginBrand::after {
  content: "";
  position: absolute;
  inset: 0;
  border-right: 8px solid var(--accent);
  pointer-events: none;
}

.loginLogo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(408px, 78%);
  max-width: 86%;
  height: auto;
  background: var(--dark);
  object-fit: contain;
  margin: 22px auto 0;
}

.loginBrandCopy {
  position: relative;
  z-index: 1;
  max-width: 390px;
  display: grid;
  gap: 10px;
  width: 100%;
  justify-self: end;
}

.loginBrandCopy span {
  color: #314050;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.loginBrandCopy h2 {
  color: var(--dark);
  font-size: 38px;
  line-height: 1;
}

.loginBrandCopy p {
  color: #314050;
  font-size: 16px;
  line-height: 1.5;
}

.loginForms {
  display: grid;
  align-content: center;
  padding: 44px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 251, 0.96));
}

.loginPanel {
  width: 100%;
  display: grid;
  gap: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.loginPanel label {
  display: grid;
  gap: 6px;
  color: #314050;
  font-weight: 700;
}

.loginPanel input {
  width: 100%;
  height: 46px;
  border: 1px solid #c7d1dc;
  border-radius: 4px;
  padding: 0 12px;
  background: white;
}

.loginPanel input:focus {
  border-color: #1f2a35;
  box-shadow: 0 0 0 3px rgba(244, 223, 31, 0.34);
  outline: 0;
}

button,
.buttonLink {
  height: 38px;
  border: 0;
  border-radius: 4px;
  padding: 0 16px;
  color: #101418;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

button:hover,
.buttonLink:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #516070;
  color: white;
}

.portalStage button.secondary {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.linkButton {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: #263340;
  border: 1px solid transparent;
  padding: 0;
  font-weight: 700;
  text-decoration: none;
}

.linkButton:hover {
  background: transparent;
  color: #000000;
  text-decoration: underline;
}

.loginError {
  border: 1px solid #e5a3ad;
  border-radius: 6px;
  background: #fff1f3;
  color: var(--bad);
  padding: 10px 12px;
  font-weight: 700;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.loginError.isInfo {
  border-color: #9fcfc8;
  background: #edf8f6;
  color: #075c53;
}

.portalStage {
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: clamp(14px, 2vh, 24px);
  padding: clamp(18px, 3vh, 34px);
  background:
    linear-gradient(90deg, rgba(3, 4, 5, 0.9), rgba(3, 4, 5, 0.68) 45%, rgba(238, 242, 245, 0.92) 70%),
    url("hormetal-brand.jpg") center / cover no-repeat,
    #101418;
}

.portalTopbar {
  width: min(1440px, 100%);
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 12px 18px;
  border-left: 0;
  border-bottom: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(238, 242, 245, 0.88);
  backdrop-filter: blur(2px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.portalTopbar img {
  display: block;
  width: min(220px, 100%);
  height: auto;
  background: var(--dark);
  object-fit: contain;
}

.portalTopbar form {
  margin: 0;
}

.portalUser {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 3px;
  color: white;
  color: var(--ink);
}

.portalUser strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--dark);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.portalUser span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.portalIntro {
  width: min(1440px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 4px;
}

.portalIntroLine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portalIntro span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.portalIntro h1 {
  color: #f2f4f1;
  font-size: clamp(30px, 4.5vh, 48px);
  line-height: 1;
  font-weight: 900;
}

.adminTab {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  padding: 0 18px;
  color: var(--accent);
  background: var(--dark);
  box-shadow: inset 0 -4px 0 var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.appGrid {
  width: min(1440px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: minmax(104px, auto);
  align-content: start;
  justify-content: center;
  gap: clamp(14px, 1.8vh, 20px);
}

.appGrid.appCount2 {
  grid-template-columns: repeat(2, minmax(280px, 520px));
}

.appGrid.appCount3 {
  grid-template-columns: repeat(3, minmax(300px, 1fr));
}

.appGrid.appCount4 {
  width: min(900px, 100%);
  grid-template-columns: repeat(2, minmax(340px, 1fr));
}

.appGrid.appCount5,
.appGrid.appCount6 {
  grid-template-columns: repeat(5, minmax(220px, 1fr));
}

.appGrid.appCount6 .appCard:nth-child(6) {
  grid-column: 3;
}

.appCard {
  min-height: 106px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  padding: clamp(14px, 2vh, 20px);
  display: grid;
  grid-template-columns: clamp(46px, 6.2vh, 62px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 1.8vh, 18px);
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(3, 4, 5, 0.14);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.appCard:hover {
  border-color: var(--accent);
  box-shadow: inset 0 -4px 0 var(--accent), 0 20px 44px rgba(3, 4, 5, 0.2);
  transform: translateY(-2px);
}

.appIcon {
  width: clamp(46px, 6.2vh, 62px);
  height: clamp(46px, 6.2vh, 62px);
  display: block;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(3, 4, 5, 0.18);
}

.appCard strong {
  display: block;
  color: #030405;
  font-size: clamp(17px, 1.45vw, 21px);
  line-height: 1.12;
  font-weight: 900;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.appCard span {
  color: var(--muted);
  display: block;
  margin-top: 7px;
  font-size: clamp(12px, 1.55vh, 15px);
  font-weight: 700;
}

.portalStage .portalTopbar {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 3px solid var(--accent);
  background: rgba(3, 4, 5, 0.86);
}

.portalStage .portalUser {
  color: #ffffff;
}

.portalStage .portalUser strong {
  color: #ffffff;
}

.portalStage .portalUser span {
  color: rgba(255, 255, 255, 0.72);
}

.portalStage .appCard {
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  background: rgba(3, 4, 5, 0.82);
  box-shadow: 0 16px 34px rgba(3, 4, 5, 0.28);
}

.portalStage .appCard:hover {
  border-color: var(--accent);
  background: rgba(8, 11, 14, 0.94);
  box-shadow: inset 0 -4px 0 var(--accent), 0 20px 44px rgba(3, 4, 5, 0.36);
}

.portalStage .appCard strong {
  color: #ffffff;
}

.portalStage .appCard span {
  color: rgba(255, 255, 255, 0.68);
}

.usersAdminShell {
  width: min(1180px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 18px;
}

.usersList,
.permissionsPanel {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 34px rgba(3, 4, 5, 0.14);
}

.usersList {
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding: 14px;
}

.usersList h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.createUserBox {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.createUserBox form {
  display: grid;
  gap: 9px;
}

.createUserBox label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.createUserBox input[type="text"],
.createUserBox input[type="email"] {
  width: 100%;
  height: 36px;
  border: 1px solid #c7d1dc;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
}

.createUserBox .inviteCheck {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: #263340;
}

.createUserBox .inviteCheck input {
  width: 15px;
  height: 15px;
}

.createUserBox button {
  min-height: 38px;
}

.userListItem {
  display: grid;
  gap: 4px;
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  text-decoration: none;
}

.userListItem:hover,
.userListItem.isActive {
  background: #f1f4f5;
  box-shadow: inset 4px 0 0 var(--accent);
}

.userListItem strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.userListItem span,
.userListItem small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.permissionsPanel {
  min-width: 0;
  padding: 16px;
}

.permissionsHeader {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.permissionsHeader span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.permissionsHeader h2 {
  margin-top: 4px;
  color: var(--dark);
  font-size: 24px;
}

.statusPill {
  align-self: start;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff1f3;
  color: var(--bad);
  font-weight: 900;
  font-size: 12px;
}

.statusPill.isOk {
  background: #edf8f0;
  color: #11733f;
}

.permissionsForm {
  display: grid;
  gap: 14px;
}

.inviteActions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.appPermissionList {
  display: grid;
  gap: 10px;
}

.permissionApp {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.permissionApp summary {
  min-height: 76px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) minmax(140px, 230px) 54px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.permissionApp summary::-webkit-details-marker {
  display: none;
}

.permissionApp summary::after {
  content: "Abrir";
  justify-self: end;
  grid-column: 4;
  grid-row: 1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.permissionApp[open] summary {
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.permissionApp[open] summary::after {
  content: "Cerrar";
}

.appState {
  justify-self: start;
  border-radius: 999px;
  padding: 7px 10px;
  background: #f1f4f5;
  color: #596574;
  font-size: 12px;
  font-weight: 900;
}

.appState.isEnabled {
  background: #edf8f0;
  color: #11733f;
}

.appNameBlock {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.appNameBlock strong {
  overflow: hidden;
  color: var(--dark);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 900;
}

.appNameBlock small,
.appProfile {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.appProfile {
  text-align: right;
}

.permissionAppBody {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.appAccessToggle,
.fineCheck {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #263340;
  font-weight: 900;
}

.appAccessToggle input,
.fineCheck input {
  width: 16px;
  height: 16px;
}

.permissionSection {
  display: grid;
  gap: 10px;
}

.permissionSection h3 {
  margin: 0;
  color: var(--dark);
  font-size: 14px;
  font-weight: 900;
}

.finePermissions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.fineInput {
  display: grid;
  gap: 6px;
  color: #263340;
  font-size: 12px;
  font-weight: 900;
}

.fineInput input {
  width: 100%;
  height: 36px;
  border: 1px solid #c7d1dc;
  border-radius: 6px;
  padding: 0 10px;
}

.permissionsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}

.permissionCard {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.permissionCardTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.permissionCardTop strong,
.permissionCardTop span {
  display: block;
}

.permissionCardTop strong {
  color: var(--dark);
  font-size: 15px;
}

.permissionCardTop span,
.permissionCardTop small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.roleChecks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.roleChecks label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #263340;
  font-size: 12px;
  font-weight: 800;
}

.roleChecks input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.scopeBox {
  display: grid;
  gap: 6px;
}

.scopeBox span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.scopeBox textarea {
  width: 100%;
  border: 1px solid #c7d1dc;
  border-radius: 6px;
  padding: 8px;
  color: #1d2732;
  background: #f8fafb;
  font: 12px/1.35 Consolas, "Courier New", monospace;
  resize: vertical;
}

.permissionsActions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

@media (max-width: 760px) {
  .loginView {
    padding: 16px;
    place-items: start center;
  }

  .loginShell {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .loginBrand {
    min-height: 250px;
    padding: 24px;
  }

  .loginBrand::after {
    border-right: 0;
    border-bottom: 6px solid var(--accent);
  }

  .loginLogo {
    width: min(300px, 84%);
  }

  .loginBrandCopy h2 {
    font-size: 30px;
  }

  .loginForms {
    padding: 28px 22px;
  }

  .portalStage {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 14px;
    gap: 14px;
  }

  .portalTopbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .portalTopbar img {
    width: 190px;
  }

  .portalUser {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-items: start;
  }

  .appGrid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(92px, auto);
  }

  .usersAdminShell {
    grid-template-columns: 1fr;
  }

  .usersList {
    max-height: 260px;
  }

  .permissionsHeader {
    display: grid;
  }

  .roleChecks {
    grid-template-columns: 1fr;
  }

  .permissionApp summary {
    grid-template-columns: 1fr;
  }

  .permissionApp summary::after {
    grid-column: 1;
    justify-self: start;
  }

  .appProfile {
    padding-right: 0;
    text-align: left;
  }

  h1 {
    font-size: 22px;
  }
}


.appCardGroup {
  grid-template-columns: clamp(46px, 6.2vh, 62px) minmax(0, 1fr);
}

.appGroupBody {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.appSubLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appSubLinks a {
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(249, 235, 29, 0.46);
  border-radius: 4px;
  padding: 0 11px;
  color: var(--accent);
  background: rgba(249, 235, 29, 0.08);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.appSubLinks a:hover {
  color: var(--dark);
  background: var(--accent);
}
