:root {
  --bg: #07111f;
  --bg-soft: rgba(10, 22, 38, 0.82);
  --panel: rgba(11, 25, 43, 0.78);
  --panel-strong: rgba(14, 32, 54, 0.96);
  --panel-muted: rgba(18, 39, 63, 0.72);
  --line: rgba(130, 170, 220, 0.16);
  --line-strong: rgba(128, 204, 255, 0.3);
  --text: #e8f1ff;
  --muted: #96abc8;
  --accent: #59c3ff;
  --accent-strong: #2d8fff;
  --success: #85f1b7;
  --danger: #ff7b8d;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 15%, rgba(50, 130, 255, 0.16), transparent 24%),
    radial-gradient(circle at 85% 12%, rgba(50, 220, 180, 0.1), transparent 22%),
    linear-gradient(180deg, #08111d 0%, #07111f 45%, #09192c 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: transparent;
}

button,
input {
  font: inherit;
}

.pageGlow {
  position: fixed;
  inset: auto;
  width: 34vw;
  height: 34vw;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.42;
}

.pageGlowLeft {
  top: -8vw;
  left: -8vw;
  background: rgba(47, 130, 255, 0.22);
}

.pageGlowRight {
  right: -10vw;
  bottom: -10vw;
  background: rgba(60, 255, 197, 0.16);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 32px));
  margin: 24px auto;
}

.loginScene {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

.heroPanel,
.authCard,
.topbar,
.sidebarPanel,
.readerPanel,
.settingsPanel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.heroPanel {
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(160deg, rgba(18, 42, 72, 0.96), rgba(8, 19, 34, 0.94)),
    var(--panel);
}

.heroPanel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0%, rgba(89, 195, 255, 0.09) 52%, transparent 100%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 38px,
      rgba(143, 191, 255, 0.035) 39px,
      rgba(143, 191, 255, 0.035) 40px
    );
  pointer-events: none;
}

.heroPanel > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 16px;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.03em;
}

h3 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 48ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.heroStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.statCard {
  padding: 18px;
  border: 1px solid rgba(132, 177, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.statCard span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.statCard strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.loginPanel {
  display: grid;
  align-items: center;
}

.authCard {
  border-radius: 32px;
  padding: 34px;
  background:
    linear-gradient(180deg, rgba(13, 29, 49, 0.98), rgba(8, 21, 37, 0.95));
}

.loginSwitch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  margin-bottom: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(120, 166, 218, 0.12);
}

.switchButton {
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.switchButton.active {
  color: #03111e;
  background: linear-gradient(135deg, var(--accent), #8fffe1);
}

.authHeader p:last-child {
  color: var(--muted);
  line-height: 1.7;
}

.authForm {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 10px;
  color: #d9e7fb;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid rgba(120, 166, 218, 0.18);
  border-radius: 18px;
  padding: 15px 16px;
  color: var(--text);
  background: rgba(18, 39, 63, 0.88);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(89, 195, 255, 0.1);
  transform: translateY(-1px);
}

input::placeholder {
  color: #7892b5;
}

button {
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  color: #03111e;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #8fffe1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 14px 30px rgba(63, 159, 255, 0.18);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(63, 159, 255, 0.22);
}

button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(120, 166, 218, 0.14);
  box-shadow: none;
}

button.ghost.danger {
  color: #ffd5db;
}

button.danger {
  color: #ffdbe1;
  background: rgba(255, 123, 141, 0.14);
  box-shadow: none;
}

.authFooter,
.hint,
.error,
.meta {
  color: var(--muted);
}

.authFooter {
  margin-top: 18px;
  font-size: 13px;
}

.error {
  min-height: 22px;
  margin-top: 14px;
  color: #ffb6c0;
}

.workspace {
  display: grid;
  gap: 18px;
}

.adminGrid {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 182px);
}

.topbar {
  border-radius: 28px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(14, 31, 52, 0.94), rgba(10, 22, 37, 0.9));
}

.brandBlock h2 {
  margin: 0;
}

.topbarActions {
  display: flex;
  gap: 12px;
}

.workspaceGrid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1.45fr) minmax(220px, 260px);
  gap: 18px;
  min-height: calc(100vh - 182px);
}

.sidebarPanel,
.readerPanel,
.settingsPanel,
.adminPanel {
  border-radius: 28px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(13, 28, 47, 0.95), rgba(8, 20, 35, 0.92));
}

.panelTitle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panelBadge {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(89, 195, 255, 0.08);
  color: #b8e6ff;
  font-size: 12px;
  white-space: nowrap;
}

.readerHeader {
  align-items: center;
}

.readerHeader .meta {
  margin: 0;
  max-width: 360px;
  text-align: right;
  font-size: 12px;
  line-height: 1.6;
}

.messageList {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 270px);
  overflow: auto;
  padding-right: 4px;
}

.messageList::-webkit-scrollbar,
.messageBody::-webkit-scrollbar {
  width: 10px;
}

.messageList::-webkit-scrollbar-thumb,
.messageBody::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(134, 166, 211, 0.22);
}

.messageItem {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(120, 166, 218, 0.12);
  background: linear-gradient(180deg, rgba(18, 39, 63, 0.96), rgba(12, 28, 47, 0.9));
  color: var(--text);
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
}

.messageItem strong,
.messageItem span,
.messageItem small,
.messageItem p {
  margin: 0;
}

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

.messageItem strong {
  font-size: 15px;
}

.messageItem p {
  line-height: 1.6;
  font-size: 13px;
}

.messageItem.active {
  border-color: rgba(89, 195, 255, 0.4);
  box-shadow: inset 0 0 0 1px rgba(89, 195, 255, 0.22), 0 14px 30px rgba(8, 16, 28, 0.3);
}

.readerPanel {
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.messageBody {
  margin: 0;
  white-space: pre-wrap;
  overflow: auto;
  min-height: 420px;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid rgba(120, 166, 218, 0.12);
  background: rgba(6, 16, 30, 0.65);
  font-family: "IBM Plex Mono", "SF Mono", monospace;
  line-height: 1.75;
  color: #dfeaff;
}

.messageInfoCard {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(120, 166, 218, 0.12);
  background: rgba(6, 16, 30, 0.42);
}

.infoRow {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
}

.infoRow span {
  color: var(--muted);
  font-size: 13px;
}

.infoRow strong {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.attachmentPanel {
  margin-bottom: 14px;
}

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

.attachmentItem {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(120, 166, 218, 0.12);
  background: rgba(6, 16, 30, 0.5);
  color: var(--text);
  text-decoration: none;
}

.attachmentItem span,
.attachmentItem small {
  color: var(--muted);
}

.messageHtmlFrame {
  width: 100%;
  min-height: 520px;
  border: 1px solid rgba(120, 166, 218, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(236, 244, 252, 0.92), rgba(248, 250, 252, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.settingsPanel {
  align-self: start;
}

.adminDivider {
  height: 1px;
  margin: 26px 0;
  background: rgba(120, 166, 218, 0.1);
}

.searchField {
  margin-bottom: 16px;
}

.textArea {
  min-height: 160px;
  resize: vertical;
  width: 100%;
  border: 1px solid rgba(120, 166, 218, 0.18);
  border-radius: 18px;
  padding: 15px 16px;
  color: var(--text);
  background: rgba(18, 39, 63, 0.88);
  outline: none;
}

.textArea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(89, 195, 255, 0.1);
}

.adminTableWrap {
  overflow: auto;
  border: 1px solid rgba(120, 166, 218, 0.12);
  border-radius: 22px;
  background: rgba(6, 16, 30, 0.5);
}

.adminTable {
  width: 100%;
  border-collapse: collapse;
}

.adminTable th,
.adminTable td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(120, 166, 218, 0.1);
  text-align: left;
  vertical-align: middle;
}

.adminTable th {
  color: #bfd7f5;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.adminTable td {
  color: var(--text);
  font-size: 14px;
}

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

.miniButton {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: none;
}

.miniButton.active {
  color: #03111e;
  background: linear-gradient(135deg, var(--accent), #8fffe1);
}

.recordList {
  display: grid;
  gap: 12px;
}

.recordCard {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(120, 166, 218, 0.12);
  background: rgba(6, 16, 30, 0.5);
}

.recordCard strong,
.recordCard span,
.recordCard small,
.recordCard p {
  margin: 0;
}

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

.statusTag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.statusTag.is-on {
  color: #d9ffeb;
  background: rgba(133, 241, 183, 0.12);
}

.statusTag.is-off {
  color: #ffd8de;
  background: rgba(255, 123, 141, 0.12);
}

.emptyRow {
  text-align: center !important;
  color: var(--muted) !important;
}

.passwordForm {
  display: grid;
  gap: 16px;
}

.hint {
  min-height: 22px;
  margin: 14px 0 0;
}

.hidden {
  display: none;
}

@media (max-width: 1180px) {
  .workspaceGrid {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .settingsPanel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 920px) {
  .loginScene,
  .workspaceGrid,
  .heroStats,
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbarActions {
    display: grid;
  }

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

  .heroPanel,
  .authCard,
  .sidebarPanel,
  .readerPanel,
  .settingsPanel,
  .adminPanel {
    padding: 22px;
    border-radius: 24px;
  }

  h1 {
    max-width: none;
    font-size: 40px;
  }

  .readerHeader {
    align-items: flex-start;
  }

  .readerHeader .meta {
    max-width: none;
    text-align: left;
  }

  .messageList {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 100%);
    margin: 10px auto;
  }

  .loginScene {
    min-height: auto;
  }

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

  .pageGlow {
    width: 56vw;
    height: 56vw;
  }
}
