:root {
  --bg: #050816;
  --panel: rgba(10, 20, 44, 0.82);
  --line: rgba(115, 158, 255, 0.4);
  --text: #e8f0ff;
  --sub: #9bb2df;
  --ok: #3ad29f;
  --err: #ff6b7b;
  --brand: #4aa2ff;
  --brand-2: #6c7bff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, #12234f 0%, #060912 42%, #04060c 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(69, 98, 176, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 98, 176, 0.14) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(74px);
  pointer-events: none;
}

.bg-glow-1 {
  background: rgba(66, 152, 255, 0.26);
  top: -130px;
  left: -80px;
}

.bg-glow-2 {
  background: rgba(115, 92, 255, 0.2);
  right: -120px;
  bottom: -140px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  backdrop-filter: blur(8px);
  background: rgba(3, 8, 18, 0.6);
  border-bottom: 1px solid rgba(90, 125, 215, 0.25);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-main {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 18px;
}

.brand-sub {
  font-size: 11px;
  color: var(--sub);
  letter-spacing: 0.6px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page {
  position: relative;
  z-index: 1;
  padding: 36px 18px 46px;
  max-width: 1120px;
  margin: 0 auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.auth-panel {
  max-width: 460px;
  margin: 30px auto 0;
}

h1 {
  margin: 0 0 10px;
}

.sub {
  margin: 0 0 20px;
  color: var(--sub);
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(136, 167, 249, 0.5);
  background: rgba(8, 17, 36, 0.85);
  color: var(--text);
  padding: 11px 12px;
}

button,
.portal-btn,
.chip {
  border-radius: 10px;
  border: 1px solid rgba(103, 145, 255, 0.7);
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

button,
.portal-btn {
  margin-top: 14px;
}

button.danger,
.chip.danger {
  background: linear-gradient(140deg, #f05b77, #e73d55);
  border-color: rgba(252, 131, 148, 0.85);
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

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

.portal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 120px;
  justify-content: center;
  text-align: center;
  background: linear-gradient(145deg, rgba(59, 125, 255, 0.28), rgba(98, 83, 255, 0.28));
  border: 1px solid rgba(126, 162, 255, 0.65);
  box-shadow: inset 0 0 0 1px rgba(165, 196, 255, 0.12), 0 12px 28px rgba(8, 16, 40, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.portal-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(174, 202, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(188, 211, 255, 0.25), 0 16px 30px rgba(15, 28, 65, 0.55);
}

.portal-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 21, 50, 0.72);
  border: 1px solid rgba(149, 180, 255, 0.45);
}

.portal-icon svg {
  width: 24px;
  height: 24px;
  stroke: #d9e8ff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-icon .dot {
  fill: #d9e8ff;
  stroke: none;
}

.chip {
  margin: 0;
  display: inline-block;
  white-space: nowrap;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 9px;
}

.flash-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(180, 198, 255, 0.3);
}

.flash.ok {
  border-color: rgba(70, 230, 174, 0.5);
  background: rgba(41, 131, 97, 0.2);
}

.flash.error {
  border-color: rgba(255, 108, 122, 0.55);
  background: rgba(154, 45, 62, 0.25);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(134, 160, 232, 0.25);
  text-align: left;
  vertical-align: top;
  padding: 10px 8px;
  font-size: 14px;
}

form.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  margin-bottom: 6px;
}

.password-mask {
  width: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.8px;
}

.regen-btn {
  padding: 7px 9px;
  font-size: 12px;
}

.copy-btn {
  padding: 7px 9px;
  font-size: 12px;
}

.copy-feedback {
  min-width: 52px;
  font-size: 12px;
  color: var(--ok);
}

.request-actions-cell {
  min-width: 420px;
}

.request-approve-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(120, 155, 237, 0.35);
  background: rgba(9, 20, 46, 0.6);
}

.password-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.request-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.approve-btn {
  margin-top: 0;
}

.request-reject-form {
  margin-top: 8px;
}

.request-reject-form .danger {
  margin-top: 0;
  padding: 7px 12px;
}

.small-check {
  font-size: 13px;
  color: var(--sub);
}

.link-line {
  display: inline-block;
  margin-top: 14px;
  color: #95c6ff;
}

.hint {
  color: var(--sub);
  font-size: 12px;
  margin-top: 10px;
}

.empty {
  color: var(--sub);
}

hr {
  border: 0;
  border-top: 1px solid rgba(112, 144, 227, 0.3);
  margin: 20px 0;
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 12px 28px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

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

  .portal-btn {
    min-height: 104px;
  }

  .top-actions .chip,
  .top-actions form {
    flex: 1 1 calc(50% - 6px);
  }

  .top-actions form .chip {
    width: 100%;
  }

  .brand-main {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 10px;
  }

  .request-actions-cell {
    min-width: 280px;
  }

  .password-mask {
    width: 100%;
  }

  .request-actions-row {
    align-items: stretch;
  }

  .request-actions-row .approve-btn {
    width: 100%;
  }
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.modal.show {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.66);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  margin: 4vh auto;
  width: min(1080px, calc(100vw - 20px));
  height: 92vh;
  border: 1px solid rgba(122, 160, 255, 0.55);
  border-radius: 14px;
  background: rgba(8, 16, 36, 0.96);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(124, 156, 239, 0.35);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
}

#modalFrame {
  width: 100%;
  flex: 1;
  border: 0;
  background: #070d1f;
}
