:root {
  color-scheme: dark;
  --bg: #060a11;
  --bg-2: #0a1220;
  --panel: rgba(16, 26, 44, 0.82);
  --panel-solid: #101a2c;
  --panel-2: #0c1524;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e9effc;
  --muted: #8fa1be;
  --muted-2: #64748b;
  --accent: #4de2c2;
  --accent-2: #6ea8fe;
  --accent-soft: rgba(77, 226, 194, 0.12);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.12);
  --warning: #f6c85f;
  --warning-soft: rgba(246, 200, 95, 0.12);
  --success: #55e6a5;
  --success-soft: rgba(85, 230, 165, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(77, 226, 194, 0.11), transparent 60%),
    radial-gradient(760px 480px at 95% 0%, rgba(110, 168, 254, 0.12), transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 46%);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px 16px 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(6, 10, 17, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041018;
  font-weight: 900;
  letter-spacing: -1px;
  box-shadow: 0 8px 26px rgba(77, 226, 194, 0.24);
  flex: 0 0 auto;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.conn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.12);
}

.conn.online::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(85, 230, 165, 0.12);
}

.conn.offline::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 107, 122, 0.12);
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  margin: 18px 0 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(16, 26, 44, 0.5);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.tab:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.tab.active {
  color: #041018;
  background: linear-gradient(135deg, var(--accent), #7ef0d7);
}

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

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

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 2px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

h3 {
  margin-bottom: 2px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sub,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  margin: 8px 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 33, 55, 0.78), rgba(12, 21, 36, 0.72));
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -28px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 226, 194, 0.13), transparent 70%);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-card small {
  color: var(--muted-2);
  font-size: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  padding: 16px;
  margin-bottom: 14px;
}

.panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel > header p {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7ef0d7);
  color: #041018;
  box-shadow: 0 8px 24px rgba(77, 226, 194, 0.16);
}

.btn.secondary {
  background: rgba(110, 168, 254, 0.11);
  border-color: rgba(110, 168, 254, 0.24);
  color: #b9d3ff;
}

.btn.ghost {
  border-color: var(--border);
  color: var(--muted);
  background: rgba(148, 163, 184, 0.04);
}

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

.btn.danger {
  background: var(--danger-soft);
  border-color: rgba(255, 107, 122, 0.3);
  color: #ffb3bb;
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 12px;
}

.btn.icon {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.inline-form input {
  flex: 1 1 auto;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: rgba(6, 10, 17, 0.55);
  color: var(--text);
  font-size: 16px;
}

input::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(77, 226, 194, 0.55);
  box-shadow: 0 0 0 3px rgba(77, 226, 194, 0.1);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field {
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.active {
  color: var(--success);
  background: var(--success-soft);
}

.badge.verified {
  color: var(--accent-2);
  background: rgba(110, 168, 254, 0.12);
}

.badge.pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.expired,
.badge.offline {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.1);
}

.badge.otp {
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  letter-spacing: 0.12em;
}

.domain-list,
.mailbox-list {
  display: grid;
  gap: 10px;
}

.domain-card,
.mailbox-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(8, 14, 24, 0.5);
  padding: 13px;
}

.domain-head,
.mailbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.domain-title,
.mailbox-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.domain-meta,
.mailbox-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.domain-actions,
.mailbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.txt-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed rgba(77, 226, 194, 0.28);
  border-radius: 11px;
  background: rgba(77, 226, 194, 0.05);
}

.txt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 6px;
}

.txt-row:last-child {
  margin-bottom: 0;
}

.txt-row .label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.txt-row code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #c8fff3;
}

.empty {
  padding: 26px 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.capacity {
  position: relative;
  height: 12px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.capacity > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent));
  transition: width 0.35s ease;
}

.capacity.warning > span {
  background: linear-gradient(90deg, var(--warning), #ff9f5a);
}

.capacity.critical > span {
  background: linear-gradient(90deg, #ff8a5c, var(--danger));
}

.capacity-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 11px;
}

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

.kv > div {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 10, 17, 0.3);
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kv strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(246, 200, 95, 0.24);
  border-radius: 11px;
  background: var(--warning-soft);
  color: #ffe6a6;
  font-size: 12px;
}

.notice.danger {
  border-color: rgba(255, 107, 122, 0.26);
  background: var(--danger-soft);
  color: #ffc1c7;
}

.result-box {
  max-height: 260px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(6, 10, 17, 0.62);
  color: #b9c8e2;
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 33, 55, 0.9), rgba(10, 18, 32, 0.92));
  box-shadow: var(--shadow);
}

.login-card .brand {
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 28px;
}

.login-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: #ffb3bb;
  font-size: 12px;
}

.login-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  max-width: min(460px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(16, 26, 44, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast.error {
  border-color: rgba(255, 107, 122, 0.36);
  color: #ffc1c7;
}

.toast.success {
  border-color: rgba(85, 230, 165, 0.32);
  color: #bfffe3;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(80vh, 760px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.modal-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-card > header h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.message-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.message-item h3 {
  margin: 0 0 4px;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 820px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .shell {
    padding: 16px 12px 92px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .brand-sub,
  .conn span {
    display: none;
  }

  .stat-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 13px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .panel {
    padding: 13px;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .btn {
    width: 100%;
  }

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

  .tabs {
    position: sticky;
    top: 59px;
    z-index: 20;
    margin-top: 12px;
    background: rgba(6, 10, 17, 0.92);
    backdrop-filter: blur(12px);
  }

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

  .domain-head,
  .mailbox-head {
    flex-direction: column;
  }
}

/* Public inbox + message detail */

.address {
  font-family: var(--mono);
  font-size: clamp(16px, 4.2vw, 25px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.message-button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 13px 6px;
}

.message-button:hover {
  background: rgba(148, 163, 184, 0.05);
}

.message-preview {
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-body {
  margin: 14px 0 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(6, 10, 17, 0.4);
  color: #cfdcf2;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.otp-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
  padding: 13px 14px;
  border: 1px solid rgba(77, 226, 194, 0.28);
  border-radius: 13px;
  background: var(--accent-soft);
}

.otp-hero .label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.otp-hero strong {
  display: block;
  color: #c8fff3;
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.16em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.badge.critical {
  color: var(--danger);
  background: var(--danger-soft);
}

details summary {
  cursor: pointer;
  padding: 6px 0;
}

details summary:hover {
  color: var(--text);
}

.link-section {
  margin: 14px 0 0;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(6, 10, 17, 0.35);
}

.link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.link-head .label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.link-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.link-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.link-url {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.link-url:hover {
  text-decoration: underline;
}

.link-host {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.link-item .btn {
  flex: 0 0 auto;
}

.panel > h3 {
  margin: 18px 0 6px;
  font-size: 14px;
}

.name-mode {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.chip {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.active {
  border-color: rgba(77, 226, 194, 0.42);
  background: var(--accent-soft);
  color: #c8fff3;
}

#namePreview {
  margin: 6px 0 0;
  min-height: 18px;
}

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

.doc-toc a {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.doc-toc a:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.doc-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 12px;
}

.doc-table th,
.doc-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.doc-table thead th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.doc-table tbody th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.doc-table td code {
  overflow-wrap: anywhere;
}

.doc-table tr:last-child th,
.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-steps,
.doc-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: #cfdcf2;
  font-size: 13px;
  line-height: 1.65;
}

.doc-steps li::marker,
.doc-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.doc-code {
  max-height: none;
  white-space: pre;
  overflow-x: auto;
  word-break: normal;
}

@media (max-width: 560px) {
  .otp-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .otp-hero .btn {
    width: 100%;
  }

  .link-item {
    flex-direction: column;
    align-items: stretch;
  }

  .link-item .btn {
    width: 100%;
  }
}
