:root {
  --bg: #f5f0ff;
  --panel: #ffffff;
  --line: #e5d8ff;
  --text: #2f1f4d;
  --sub: #7a66a3;
  --brand: #5b21b6;
  --brand-2: #7c3aed;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(124, 58, 237, 0.12) 0, rgba(124, 58, 237, 0) 30%),
    radial-gradient(circle at 86% 16%, rgba(91, 33, 182, 0.09) 0, rgba(91, 33, 182, 0) 26%),
    linear-gradient(180deg, #f5f0ff 0%, #efe9ff 100%);
}

.portal-page {
  min-height: 100vh;
  display: grid;
  align-items: start;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}

.portal-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0) 46%);
  opacity: 0.7;
}

.portal-card {
  width: min(1680px, calc(100vw - 40px));
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(63, 34, 102, 0.08);
}

#portalLoginCard {
  width: min(1120px, calc(100vw - 40px));
  min-height: 600px;
  margin-top: clamp(18px, 6vh, 64px);
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  grid-template-rows: auto auto auto;
  align-items: start;
  column-gap: 0;
  position: relative;
  overflow: hidden;
  border-color: rgba(216, 199, 255, 0.82);
  background:
    linear-gradient(90deg, rgba(250, 247, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 52%, #ffffff 100%);
  box-shadow: 0 24px 70px rgba(63, 34, 102, 0.13);
}

#portalLoginCard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 53%;
  border-radius: 18px 0 0 18px;
  background:
    linear-gradient(145deg, rgba(124, 58, 237, 0.12), rgba(91, 33, 182, 0.04) 46%, rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  pointer-events: none;
}

#portalLoginCard::after {
  content: "统一工作台\A 项目入口 · 权限管理 · 业务协同";
  position: absolute;
  left: 48px;
  bottom: 42px;
  width: 360px;
  height: 150px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.24)),
    linear-gradient(90deg, rgba(124, 58, 237, 0.12), rgba(91, 33, 182, 0.06));
  border: 1px solid rgba(216, 199, 255, 0.56);
  box-shadow: 0 18px 42px rgba(91, 33, 182, 0.1);
  opacity: 0.78;
  pointer-events: none;
  white-space: pre-line;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 28px;
  color: #5a3d86;
  font-size: 14px;
  font-weight: 700;
  line-height: 2;
}

#portalLoginCard h1,
#portalLoginCard p,
#portalLoginCard label,
#portalLoginCard button {
  position: relative;
  z-index: 1;
}

#portalLoginCard h1 {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  max-width: 500px;
  margin: 0;
  padding: clamp(56px, 7vw, 88px) clamp(34px, 5vw, 58px) 0;
  font-size: clamp(38px, 4.2vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

#portalLoginCard h1::before {
  content: "企业服务入口";
  display: block;
  width: fit-content;
  margin-bottom: 20px;
  color: var(--brand-2);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 800;
}

#portalLoginCard p {
  grid-column: 1;
  grid-row: 2;
  max-width: 440px;
  margin: 0;
  padding: 18px clamp(34px, 5vw, 58px) 0;
  font-size: 16px;
  line-height: 1.85;
}

#portalLoginCard label {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #594177;
  font-weight: 700;
}

#portalLoginCard label:first-of-type {
  grid-column: 2;
  grid-row: 1;
  padding-top: clamp(112px, 11vw, 146px);
}

#portalLoginCard label:first-of-type::before {
  content: "欢迎登录";
  display: block;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

#portalLoginCard label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 2;
  padding-top: 22px;
}

#portalLoginCard input:not([type="checkbox"]) {
  height: 50px;
  margin-top: 9px;
  border-radius: 12px;
  border-color: rgba(207, 190, 247, 0.95);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#portalLoginCard input:not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--brand-2);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12), 0 10px 24px rgba(91, 33, 182, 0.12);
}

#portalLoginCard button {
  grid-column: 2;
  grid-row: 3;
  justify-self: center;
  width: min(100%, 420px);
  height: 50px;
  margin-top: 28px;
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 12px 24px rgba(91, 33, 182, 0.18);
}

.portal-card + .portal-card {
  margin-top: 14px;
}

.portal-card h1,
.portal-card h2 {
  margin: 0 0 8px;
}

.portal-card p {
  margin: 0 0 14px;
  color: var(--sub);
}

label {
  display: block;
  margin-bottom: 10px;
  color: #50367f;
  font-size: 14px;
}

.portal-card input:not([type="checkbox"]) {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 1px solid #d8c7ff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
}

button {
  height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: #fff;
  color: #5f4397;
  border: 1px solid #d8c7ff;
}

.portal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.portal-user {
  margin: 8px 0 16px;
  color: #6a5693;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.portal-item {
  border: 1px solid #e0d2ff;
  background: #faf7ff;
  border-radius: 12px;
  padding: 14px;
}

.portal-item h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.portal-item p {
  margin: 0 0 12px;
  font-size: 13px;
}

.portal-item button {
  width: 100%;
}

.portal-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(180px, 240px) auto auto auto;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.portal-toolbar select {
  width: 100%;
  height: 42px;
  border: 1px solid #d8c7ff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
}

.portal-table-wrap {
  border: 1px solid #e0d2ff;
  border-radius: 12px;
  overflow: auto;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.portal-table th,
.portal-table td {
  border-bottom: 1px solid #eee6ff;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
}

.portal-table th {
  background: #f5efff;
}

.portal-u-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.hidden { display: none !important; }

.portal-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b1b45;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  z-index: 200;
}

.portal-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(27, 16, 44, 0.45);
  display: grid;
  place-items: center;
  z-index: 300;
}

.portal-modal {
  width: min(680px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #d9cbff;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(47, 31, 77, 0.2);
  overflow: hidden;
}

.portal-modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid #eee6ff;
}

.portal-modal-head h3 {
  margin: 0;
}

.portal-modal-body {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.portal-modal-body .full {
  grid-column: 1 / -1;
}

.portal-modal-body label {
  margin: 0;
}

.portal-modal-body input:not([type="checkbox"]) {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 1px solid #d8c7ff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
}

.portal-modal-body select {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 1px solid #d8c7ff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
}

.portal-project-checks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 2px;
}

.portal-project-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d8c7ff;
  border-radius: 10px;
  padding: 6px 10px;
  margin: 0;
}

.portal-project-checks input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #6d28d9;
}

.portal-modal-foot {
  border-top: 1px solid #eee6ff;
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1200px) {
  .portal-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 860px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  .portal-page {
    padding: 10px;
    align-items: start;
    overflow-x: hidden;
  }
  .portal-card {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    border-radius: 14px;
    padding: 14px;
  }
  .portal-head {
    flex-wrap: wrap;
  }
  .portal-toolbar {
    grid-template-columns: 1fr;
  }
  #portalLoginCard {
    width: calc(100vw - 20px);
    min-height: auto;
    margin-top: 10px;
    padding: 0 0 18px;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0;
  }
  #portalLoginCard::before {
    width: 100%;
    height: 210px;
    border-radius: 14px 14px 0 0;
  }
  #portalLoginCard::after {
    display: none;
  }
  #portalLoginCard h1,
  #portalLoginCard p,
  #portalLoginCard label:first-of-type,
  #portalLoginCard label:nth-of-type(2),
  #portalLoginCard button {
    grid-column: 1;
    grid-row: auto;
  }
  #portalLoginCard h1 {
    font-size: clamp(29px, 9vw, 40px);
    margin-bottom: 0;
    padding: 30px 22px 0;
  }
  #portalLoginCard h1::before {
    margin-bottom: 12px;
    white-space: normal;
    font-size: 13px;
  }
  #portalLoginCard p {
    max-width: none;
    padding: 12px 22px 24px;
    font-size: 14px;
    line-height: 1.7;
  }
  #portalLoginCard label {
    width: auto;
    margin: 0 22px;
  }
  #portalLoginCard input:not([type="checkbox"]) {
    max-width: 100%;
  }
  #portalLoginCard label:first-of-type {
    padding-top: 18px;
  }
  #portalLoginCard label:nth-of-type(2) {
    padding-top: 18px;
  }
  #portalLoginCard button {
    width: auto;
    max-width: calc(100% - 44px);
    justify-self: stretch;
    margin: 24px 22px 0;
  }
  .portal-modal-body {
    grid-template-columns: 1fr;
  }
}
