:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #5b9fd4;
  --accent-dim: #3d7aad;
  --danger: #e06c6c;
  --ok: #7fd99a;
  --warn: #e5c07b;
  --font: "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, #1e3a5f 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 20%, #2a1f3d 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sub {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.warn {
  margin: 0;
  font-size: 0.8rem;
  color: var(--warn);
  padding: 0.6rem 0.75rem;
  background: rgba(229, 192, 123, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(229, 192, 123, 0.25);
}

.warn code {
  font-size: 0.85em;
  color: #f0d9a8;
}

.conn-banner {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(91, 159, 212, 0.1);
  color: var(--text);
}

.conn-banner.conn-err {
  border-color: rgba(224, 108, 108, 0.55);
  background: rgba(224, 108, 108, 0.12);
  color: #ffc9c9;
}

details.adv {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

details.adv summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  user-select: none;
}

details.adv summary code {
  font-size: 0.8em;
  color: var(--warn);
}

label.check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

label.check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.card {
  margin-top: 1.25rem;
  padding: 1.25rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

label.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #0d1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(91, 159, 212, 0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #243044;
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #2c3a52;
  border-color: #3d4f6a;
}

.btn.primary {
  background: linear-gradient(180deg, #4a8ec4 0%, var(--accent-dim) 100%);
  border-color: #4a8ec4;
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.danger {
  background: rgba(224, 108, 108, 0.15);
  border-color: rgba(224, 108, 108, 0.45);
  color: #ffb4b4;
}

.btn.danger:hover {
  background: rgba(224, 108, 108, 0.28);
}

.btn.ghost {
  background: transparent;
}

.btn.sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.card.out .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.status {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #243044;
  color: var(--muted);
}

.status.busy {
  color: var(--accent);
  background: rgba(91, 159, 212, 0.12);
}

.status.ok {
  color: var(--ok);
  background: rgba(127, 217, 154, 0.12);
}

.status.err {
  color: var(--danger);
  background: rgba(224, 108, 108, 0.12);
}

.output {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 1rem;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.accounts {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.accounts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.accounts-title {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0e14;
}

.account-email {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.account-copy-one {
  flex-shrink: 0;
}

.account-btn {
  width: 100%;
  max-width: 100%;
  word-break: break-word;
}

@media (max-width: 560px) {
  .accounts-list {
    gap: 0.5rem;
  }
}

.mail_list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 120px;
  max-height: min(55vh, 480px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0a0e14;
}

.mail-pager {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mail-pager-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.mail-pager .pager-size {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.mail-pager .pager-size select {
  min-width: 4.5rem;
}

.mail-pager .pager-meta {
  flex: 1 1 200px;
  margin: 0;
  text-align: right;
}

.mail-pager-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

@media (max-width: 560px) {
  .mail-pager .pager-meta {
    text-align: left;
    flex-basis: 100%;
  }
}

.mail-item {
  text-align: left;
  width: 100%;
  white-space: normal;
  padding: 0.6rem 0.85rem;
}

.mail-item:hover {
  filter: brightness(1.05);
}

.hint {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.45rem;
}

.lang-bar-fixed {
  position: fixed;
  top: 0.65rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.lang-bar-fixed .btn.lang-active {
  border-color: var(--accent);
  color: var(--accent);
}

.console-userbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.console-userbar strong {
  color: var(--text);
  font-weight: 600;
}

details.imported-fold {
  margin: 0;
}

details.imported-fold > summary {
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  user-select: none;
}

details.imported-fold > summary::-webkit-details-marker {
  display: none;
}

details.imported-fold .fold-inner {
  margin-top: 0;
}
