/* tempmail web panel — always-dark theme. Hand-written so the single binary is
   fully self-contained (no runtime CDN). Semantic component classes keep the
   Leptos views readable. */

:root {
  --bg: #0a0e16;
  --bg-elev: #121a27;
  --bg-elev-2: #1a2434;
  --bg-hover: #1f2a3c;
  --border: #25324a;
  --border-soft: #1c2738;
  --text: #e8eef7;
  --text-dim: #aab6c8;
  --muted: #6d7a90;
  --accent: #6e8bff;
  --accent-hover: #8aa0ff;
  --accent-soft: rgba(110, 139, 255, 0.16);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(110, 139, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(124, 108, 255, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
.muted {
  color: var(--muted);
}
.bold {
  font-weight: 600;
}
.break {
  word-break: break-all;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ok {
  color: var(--success);
}
.right {
  text-align: right;
}

a.link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s ease;
}
a.link:hover {
  color: var(--accent-hover);
}

/* ---------------------------------------------------------------- header --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  display: grid;
  place-items: center;
  height: 34px;
  width: 34px;
  border-radius: 10px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), #9d6bff);
  box-shadow: 0 6px 18px -6px rgba(110, 139, 255, 0.7);
}
.brand-mark-admin {
  background: linear-gradient(135deg, #475569, #1e293b);
  box-shadow: none;
}
.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.addr {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text-dim);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ main --- */
.app-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 20px 48px;
}

/* --------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--bg-elev-2);
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}
.btn:hover {
  background: var(--bg-hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8a7bff);
  color: #0a0e16;
  border-color: transparent;
}
.btn-primary:hover {
  filter: brightness(1.07);
  background: linear-gradient(135deg, var(--accent), #8a7bff);
}
.btn-secondary {
  background: #2b3650;
}
.btn-secondary:hover {
  background: #34415e;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
}
.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
}
.btn-xs {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 7px;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  height: 32px;
  width: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

/* ----------------------------------------------------------------- cards --- */
.auth-wrap {
  max-width: 480px;
  margin: 24px auto;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-narrow {
  max-width: 400px;
  margin: 0 auto;
}
.card-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}
.card-sub {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}
.tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover {
  color: var(--text);
}
.tab-active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #f4d58a;
  font-size: 13px;
}
.notice-info {
  background: var(--accent-soft);
  border-color: rgba(110, 139, 255, 0.3);
  color: #c5d0ff;
}

/* ----------------------------------------------------------------- forms --- */
.form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder {
  color: var(--muted);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input {
  resize: vertical;
  min-height: 72px;
}
.input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.input-group .input-flush {
  border-radius: var(--radius-sm);
}
.suffix {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------- mailbox --- */
.mailbox {
  display: grid;
  grid-template-columns: minmax(0, 370px) 1fr;
  gap: 18px;
}
@media (max-width: 880px) {
  .mailbox {
    grid-template-columns: 1fr;
  }
}
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.inbox-panel,
.detail-panel {
  max-height: calc(100vh - 168px);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head-left {
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.pill {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}
.inbox-list {
  flex: 1;
  overflow-y: auto;
}
.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.msg-item {
  display: flex;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s ease;
}
.msg-item:hover {
  background: var(--bg-elev-2);
}
.msg-item.active {
  background: var(--accent-soft);
}
.dot {
  flex-shrink: 0;
  margin-top: 6px;
  height: 8px;
  width: 8px;
  border-radius: 999px;
  background: transparent;
}
.dot-unread {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.msg-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-dim);
}
.who-unread {
  color: var(--text);
  font-weight: 700;
}
.time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
}
.msg-subject {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 13.5px;
  color: var(--text-dim);
}
.msg-subject.unread {
  color: var(--text);
  font-weight: 600;
}
.msg-intro {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- detail --- */
.detail {
  flex: 1;
  overflow-y: auto;
}
.placeholder {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 320px;
  height: 100%;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.placeholder-icon {
  display: grid;
  place-items: center;
  height: 52px;
  width: 52px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  font-size: 24px;
}
.detail-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-subject {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.detail-size {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
}
.detail-from {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.detail-date {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.badges {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-pass {
  background: var(--success-soft);
  color: var(--success);
}
.badge-fail {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-none {
  background: var(--bg-elev-2);
  color: var(--muted);
}
.detail-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail-body {
  padding: 20px 22px;
}
.mail-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: #ffffff;
}
.mail-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.attachments {
  margin-top: 20px;
}
.attachments-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.attachment {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
}
.attachment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.attachment-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- footer --- */
.footer-bar {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.footer-info {
  font-size: 13px;
  color: var(--muted);
}
.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ----------------------------------------------------------------- admin --- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
.row-form {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}
.col-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 16px;
  background: var(--bg-elev-2);
}
.table tbody td {
  padding: 13px 16px;
  border-top: 1px solid var(--border-soft);
}
.table tbody tr:hover {
  background: var(--bg-elev-2);
}
.table td.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 22px;
  width: 40px;
  border: none;
  border-radius: 999px;
  background: #3a4661;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.toggle-on {
  background: var(--success);
}
.toggle-knob {
  position: absolute;
  left: 3px;
  height: 16px;
  width: 16px;
  border-radius: 999px;
  background: white;
  transition: transform 0.15s ease;
}
.toggle-on .toggle-knob {
  transform: translateX(18px);
}

/* ----------------------------------------------------------------- modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 6, 12, 0.66);
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}
.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dns-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.dns-records {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.dns-record {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg-elev-2);
}
.dns-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chip {
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.dns-kv {
  margin-top: 9px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
}

/* --------------------------------------------------------------- toasts --- */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(92vw, 360px);
}
.toast {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: white;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: toast-in 0.18s ease;
}
.toast-info {
  background: #1f2a3c;
}
.toast-success {
  background: #137a52;
}
.toast-error {
  background: #a23046;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
