:root {
  --bg: #070b14;
  --bg-2: #0a1120;
  --surface: rgba(14, 23, 40, 0.78);
  --surface-2: rgba(23, 36, 60, 0.72);
  --surface-3: rgba(32, 49, 80, 0.6);
  --line: rgba(96, 132, 190, 0.16);
  --line-strong: rgba(96, 132, 190, 0.32);
  --text: #e9f0fb;
  --muted: #93a6c2;
  --faint: #63758f;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-light: #60a5fa;
  --accent-soft: #1e3a8a;
  --admin: #f59e0b;
  --ok: #10b981;
  --err: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(37, 99, 235, 0.18), transparent 70%),
    linear-gradient(180deg, #070b14 0%, #080e1a 45%, #070b14 100%);
}

.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 68%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 68%);
}

.backdrop-glow {
  position: absolute;
  width: 760px;
  height: 760px;
  top: -420px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 68%);
  filter: blur(40px);
}

.shape {
  position: absolute;
  border-radius: 26%;
  background: rgba(59, 130, 246, 0.03);
  border: 1px solid rgba(96, 165, 250, 0.055);
  transform: rotate(18deg);
}

.shape-1 {
  width: 96px;
  height: 96px;
  top: 16%;
  left: 6%;
}

.shape-2 {
  width: 58px;
  height: 58px;
  top: 60%;
  left: 12%;
  transform: rotate(-12deg);
}

.shape-3 {
  width: 116px;
  height: 116px;
  top: 22%;
  right: 5%;
  transform: rotate(30deg);
}

.shape-4 {
  width: 70px;
  height: 70px;
  bottom: 12%;
  right: 14%;
  transform: rotate(-24deg);
}

.topbar {
  position: relative;
  z-index: 3;
  padding: 18px clamp(16px, 4vw, 36px) 0;
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, opacity 0.18s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(147, 197, 253, 0.35);
  color: #fff;
  box-shadow: 0 10px 28px -14px rgba(37, 99, 235, 0.9);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4f90f8, #2f6fed);
}

.btn-ghost {
  background: rgba(18, 30, 51, 0.7);
  border-color: var(--line);
  color: var(--muted);
  font-weight: 500;
  padding: 7px 12px;
  font-size: 12.5px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 14.5px;
}

.btn-login {
  background: rgba(18, 30, 51, 0.8);
  border-color: var(--line-strong);
  font-size: 13px;
  padding: 9px 16px;
}

.btn-login:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(26, 43, 72, 0.9);
}

.btn-login[data-blocked="1"] {
  opacity: 0.5;
}

.profile {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 23, 40, 0.85);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s;
}

.profile-trigger:hover {
  border-color: var(--line-strong);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
}

.profile-name {
  font-weight: 500;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--admin);
  color: #1a1205;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.role.user {
  background: rgba(96, 165, 250, 0.2);
  color: var(--accent-light);
}

.chev {
  color: var(--faint);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #0d1626;
  box-shadow: 0 24px 50px -20px #000;
  display: none;
}

.profile.is-open .profile-menu {
  display: block;
}

.menu-name {
  margin: 6px 10px 0;
  font-size: 13px;
  font-weight: 600;
}

.menu-email {
  margin: 0 10px 8px;
  font-size: 11.5px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.menu-item.danger:hover {
  color: var(--err);
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 28px) 40px;
}

.brand {
  text-align: center;
  padding: 18px 0 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  box-shadow: 0 14px 34px -14px rgba(37, 99, 235, 0.95);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #f2f7ff;
}

.brand-tag {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.72);
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 20, 35, 0.85);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-field:focus-within {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.search-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--faint);
}

.search-field input {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.search-field input::placeholder {
  color: var(--faint);
}

.copy-inline {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.copy-inline:hover {
  color: var(--accent-light);
  border-color: var(--line-strong);
}

.copy-inline svg {
  width: 15px;
  height: 15px;
}

.btn-check {
  padding: 0 24px;
  font-size: 14px;
  border-radius: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin: 0 auto 24px;
  width: fit-content;
  border-radius: 12px;
  background: rgba(11, 19, 33, 0.7);
  border: 1px solid var(--line);
}

.tab {
  padding: 9px 20px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 8px 22px -12px rgba(37, 99, 235, 0.95);
}

.tab[hidden] {
  display: none;
}

.panel {
  display: none;
  animation: fade 0.28s ease both;
}

.panel.is-active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty {
  padding: 52px 24px 40px;
  text-align: center;
}

.empty.small {
  padding: 34px 20px;
}

.empty-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(16, 27, 46, 0.7);
  color: var(--faint);
}

.empty-mark svg {
  width: 24px;
  height: 24px;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.empty-sub {
  margin: 0;
  font-size: 13px;
  color: var(--faint);
}

.inbox {
  animation: fade 0.25s ease both;
}

.inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 12px;
}

.inbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.msg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.14s;
}

.msg:hover {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(19, 31, 52, 0.92);
  transform: translateY(-1px);
}

.msg-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-subject {
  margin: 5px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--faint);
}

.msg-code {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.38);
  font-family: var(--mono);
  font-size: 12.5px;
  color: #bfdbfe;
  letter-spacing: 0.06em;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 26px 60px -34px rgba(0, 0, 0, 0.9);
}

.card-title {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.usage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(30, 58, 138, 0.16);
  font-size: 12.5px;
  color: #bfdbfe;
}

.usage svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent-light);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-grid .field {
  margin-bottom: 0;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(9, 16, 28, 0.85);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field input::placeholder {
  color: var(--faint);
}

.field input:focus,
.field select:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.field select option {
  background: #0d1626;
  color: var(--text);
}

.mine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.mine-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.mine-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-light);
}

.mine-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mine-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(96, 132, 190, 0.1);
  cursor: pointer;
  transition: background 0.16s;
}

.mine-item:last-child {
  border-bottom: 0;
}

.mine-item:hover {
  background: rgba(30, 48, 80, 0.35);
}

.mine-address {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.mine-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--faint);
}

.mine-count {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  font-size: 11.5px;
  font-weight: 600;
}

.footer {
  margin-top: 46px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(99, 117, 143, 0.85);
}

.footer .sep {
  margin: 0 6px;
  opacity: 0.5;
}

.reader-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 15, 0.78);
  backdrop-filter: blur(5px);
}

.reader-modal[hidden] {
  display: none;
}

.reader-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  background: #0b1422;
  box-shadow: 0 50px 100px -40px #000;
  animation: fade 0.22s ease both;
}

.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #0b1422;
}

.reader-heading {
  min-width: 0;
}

.reader-subject {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #f2f7ff;
}

.reader-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: var(--faint);
}

.reader-meta b {
  font-weight: 500;
  color: var(--muted);
}

.reader-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(18, 30, 51, 0.9);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.reader-close:hover {
  color: #fff;
  border-color: var(--line-strong);
}

.reader-close svg {
  width: 15px;
  height: 15px;
}

.reader-body {
  flex: 1;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

.reader-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: 0;
  background: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 15, 0.8);
  backdrop-filter: blur(5px);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 390px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0d1626;
  box-shadow: 0 40px 90px -40px #000;
  animation: fade 0.22s ease both;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
}

.modal-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(9, 16, 28, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.modal-input:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.modal-error {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--err);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 16px);
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(13, 22, 38, 0.97);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 22px 50px -22px #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s;
  max-width: min(90vw, 420px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-color: rgba(16, 185, 129, 0.45);
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.45);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  height: 76px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(19, 31, 52, 0.7), rgba(28, 45, 74, 0.7), rgba(19, 31, 52, 0.7));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 640px) {
  .page {
    padding-top: 4px;
  }

  .brand {
    padding: 10px 0 24px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }

  .brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .search-row {
    flex-direction: column;
  }

  .btn-check {
    width: 100%;
    padding: 13px;
  }

  .tabs {
    width: 100%;
    justify-content: space-between;
  }

  .tab {
    flex: 1;
    padding: 9px 8px;
    font-size: 12.5px;
  }

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

  .reader-modal {
    padding: 0;
  }

  .reader-card {
    max-width: none;
    max-height: none;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .profile-name {
    display: none;
  }

  .btn-login span {
    display: none;
  }

  .shape {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
