:root {
  --bg: #090c10;
  --surface: #121821;
  --surface-soft: #1a222e;
  --surface-hover: #212b3a;
  --border: #263142;
  --text: #eef3f8;
  --muted: #8a9bb0;
  --accent: #00d084;
  --accent-dark: #00a86b;
  --amber: #ffa502;
  --danger: #ff4757;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% -15%, rgba(0, 208, 132, 0.08), transparent 48%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.accent-text { color: var(--accent); }
.muted-text { color: var(--muted); font-size: 0.92rem; }
.muted-small { color: var(--muted); font-size: 0.8rem; }

/* === LANDING === */
.landing-wrap {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 28px 16px 48px;
}
.landing-container { width: 100%; max-width: 520px; }
.landing-header { text-align: center; margin-bottom: 18px; }
.brand-row { display: inline-flex; align-items: center; gap: 10px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.brand-name { font-size: 1.5rem; font-weight: 800; letter-spacing: 0.1em; }
.brand-lock {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.pill-badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--border); color: var(--muted);
}
.brand-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.info-banner-card {
  background: rgba(15, 28, 36, 0.85);
  border: 1px solid #1e3a4c;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}
.card-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.plan-tile {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.plan-tile:hover:not(.disabled) { border-color: rgba(0, 208, 132, 0.5); }
.plan-tile.selected { border-color: var(--accent); background: rgba(0, 208, 132, 0.08); }
.plan-tile.disabled { opacity: 0.5; cursor: not-allowed; }
.plan-label { font-weight: 700; font-size: 0.95rem; }
.plan-sats { color: var(--accent); font-weight: 700; font-size: 0.88rem; margin-top: 2px; }
.plan-days { color: var(--muted); font-size: 0.78rem; }

.restore-card { margin-top: 14px; text-align: center; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.link-inline { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.82rem; margin-left: 8px; }
.restore-panel { text-align: left; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* === INPUTS & BUTTONS === */
.field-label { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.input-field {
  width: 100%; background: var(--surface-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 0.92rem; outline: none;
}
.input-field:focus { border-color: var(--accent); }

.vilmail-address-input {
  display: flex; align-items: center;
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.vilmail-address-input:focus-within { border-color: var(--accent); }
.vilmail-address-input input {
  flex: 1; background: transparent; border: none; color: var(--text);
  padding: 10px 12px; font-size: 1rem; font-family: ui-monospace, monospace; outline: none;
}
.vilmail-suffix {
  padding: 10px 12px; background: rgba(0, 208, 132, 0.08);
  color: var(--accent); font-weight: 700; font-size: 0.88rem;
  border-left: 1px solid var(--border); user-select: none;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; font-weight: 700; font-size: 0.9rem; padding: 11px 16px;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #04130e; }
.btn-primary:hover:not(:disabled) { background: #14e095; }
.btn-ghost { background: var(--surface-soft); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-soft { background: rgba(255, 71, 87, 0.14); color: #fca5a5; border-color: rgba(255, 71, 87, 0.35); }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-xs { padding: 4px 9px; font-size: 0.74rem; border-radius: 6px; }

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px;
}
.bulk-check-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.8rem; color: var(--muted); cursor: pointer; user-select: none;
}
.bulk-check-label input[type="checkbox"],
.mail-chk,
.msg-chk {
  accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0;
}
.mail-item-row { display: flex; align-items: flex-start; gap: 10px; }
.mail-item-content { flex: 1; min-width: 0; }
.contact-pick-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; cursor: pointer;
}

.btn-row { display: flex; gap: 8px; }
.btn-wrap-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stack-buttons { display: flex; flex-direction: column; gap: 10px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip-btn {
  background: var(--surface-soft); border: 1px solid var(--border); color: var(--accent);
  border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; cursor: pointer;
}
.divider-text { text-align: center; margin: 14px 0; position: relative; font-size: 0.78rem; color: var(--muted); }
.divider-text::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.divider-text span { position: relative; background: var(--surface); padding: 0 10px; }

.alert-amber {
  background: rgba(255, 165, 2, 0.12); border: 1px solid rgba(255, 165, 2, 0.4);
  color: #fcd34d; padding: 10px 12px; border-radius: 10px; font-size: 0.86rem; margin-top: 12px;
}

/* === APP SHELL === */
.app-shell { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  gap: 12px; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.header-brand { display: none; align-items: center; gap: 6px; }
.brand-mini { color: var(--accent); font-weight: 800; letter-spacing: 0.08em; font-size: 0.95rem; }
.identity-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 208, 132, 0.15);
  border: 1px solid rgba(0, 208, 132, 0.4); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem;
  overflow: hidden; flex-shrink: 0;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; }

.identity-number-line { font-weight: 800; font-size: 0.98rem; white-space: nowrap; }
.domain-tag { color: var(--accent); font-size: 0.78rem; font-weight: 700; margin-left: 3px; }
.identity-sub-line { display: flex; align-items: center; gap: 8px; font-size: 0.76rem; color: var(--muted); }
.mini-pill-btn {
  background: rgba(0, 208, 132, 0.14); border: 1px solid rgba(0, 208, 132, 0.4);
  color: var(--accent); border-radius: 6px; padding: 1px 7px; font-size: 0.7rem; font-weight: 700; cursor: pointer;
}
.badge-amber { background: rgba(255, 165, 2, 0.18); color: var(--amber); padding: 1px 6px; border-radius: 6px; font-weight: 700; }

.header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.hdr-btn {
  background: var(--surface-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.hdr-btn.active { background: rgba(255, 165, 2, 0.2); border-color: var(--amber); color: var(--amber); }
.hdr-btn-green { border-color: rgba(0, 208, 132, 0.45); color: var(--accent); }

.grace-bar {
  background: rgba(255, 165, 2, 0.15); border-bottom: 1px solid rgba(255, 165, 2, 0.4);
  color: #fde68a; padding: 8px 16px; font-size: 0.84rem;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}

.app-main { flex: 1; overflow: hidden; display: flex; }

/* === MAILBOX SPLIT LAYOUT === */
.mailbox-layout { display: flex; width: 100%; height: 100%; }
.mailbox-sidebar {
  width: 360px; max-width: 100%; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px; gap: 10px; overflow-y: auto; flex-shrink: 0;
}
.beacon-card {
  background: rgba(15, 28, 36, 0.75); border: 1px solid #1e3a4c;
  border-radius: 12px; padding: 10px 12px; font-size: 0.8rem;
}
.beacon-card a { color: var(--accent); text-decoration: none; font-weight: 600; }
.beacon-card a:hover { text-decoration: underline; }

.quota-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: 0.8rem;
}
.quota-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.quota-track { height: 6px; background: var(--surface-soft); border-radius: 999px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--accent); transition: width 0.25s, background 0.25s; }
.quota-fill.warn { background: var(--amber); }
.quota-fill.crit { background: var(--danger); }

.search-compose-row { display: flex; gap: 8px; }
.search-compose-row .input-field { flex: 1; min-width: 0; }
.search-compose-row .btn { white-space: nowrap; flex-shrink: 0; }

.folder-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.folder-pill {
  background: var(--surface-soft); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 10px; font-size: 0.76rem; font-weight: 600; cursor: pointer;
}
.folder-pill.active { background: rgba(0, 208, 132, 0.14); border-color: var(--accent); color: var(--accent); }
.count-pill { background: var(--accent); color: #04130e; border-radius: 999px; padding: 0 6px; font-size: 0.7rem; margin-left: 4px; }

.segmented-bar {
  display: flex; background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; gap: 3px;
}
.seg-btn {
  flex: 1; background: transparent; border: none; color: var(--muted);
  border-radius: 7px; padding: 5px 8px; font-size: 0.76rem; font-weight: 700; cursor: pointer;
}
.seg-btn.active { background: rgba(0, 208, 132, 0.16); color: var(--accent); }

.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.mail-item:hover { background: var(--surface-soft); }
.mail-item.active { border-color: var(--accent); background: rgba(0, 208, 132, 0.06); }
.mail-item.unread { border-left: 3px solid var(--accent); }
.mail-item-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--muted); }
.mail-item-subject { font-size: 0.92rem; margin: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item.unread .mail-item-subject { font-weight: 700; color: #fff; }
.mail-item-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 0.74rem; color: var(--muted); }
.mode-tag { padding: 1px 6px; border-radius: 6px; font-weight: 700; font-size: 0.68rem; }
.mode-burn { background: rgba(255, 165, 2, 0.18); color: var(--amber); }
.mode-reg { background: rgba(0, 208, 132, 0.15); color: var(--accent); }

.star-btn {
  background: none; border: none; color: var(--muted);
  font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.star-btn.starred { color: var(--amber); }
.btn-star-msg.starred {
  color: var(--amber);
  border-color: rgba(255, 165, 2, 0.5);
  background: rgba(255, 165, 2, 0.12);
}

/* === RIGHT PANE === */
.mailbox-pane { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }
.pane-empty { margin: auto; text-align: center; max-width: 380px; }
.empty-orb { font-size: 2.5rem; margin-bottom: 10px; }
.pane-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.reader-topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.reader-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reader-subject-bar h2 { font-size: 1.2rem; }
.reader-messages { display: flex; flex-direction: column; gap: 12px; }

.msg-bubble {
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.msg-bubble.mine { border-color: rgba(0, 208, 132, 0.35); background: rgba(12, 34, 29, 0.45); }
.msg-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.78rem; color: var(--muted); margin-bottom: 8px; }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 0.94rem; line-height: 1.6; }
.msg-body a { color: var(--accent); }
.msg-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 0.76rem; }

/* === COMPOSE === */
.compose-form { display: flex; flex-direction: column; gap: 14px; }
.recipient-row { display: flex; gap: 8px; align-items: center; }
.recipient-status { font-size: 0.8rem; margin-top: 5px; min-height: 18px; }
.compose-options-row { display: flex; gap: 12px; }
.attachment-box {
  background: var(--surface-soft); border: 1px dashed var(--border);
  border-radius: 12px; padding: 12px;
}
.att-top-row { display: flex; justify-content: space-between; align-items: center; }
.att-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.att-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 10px; font-size: 0.78rem; display: inline-flex; align-items: center; gap: 8px;
}
.large-file-hint { margin-top: 10px; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.large-file-hint a,
.large-file-hint a:visited,
.beacon-card a:visited,
.msg-body a:visited {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.large-file-hint a:hover { text-decoration: underline; }
.compose-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* === SINGLE TABS (CONTACTS / SETTINGS) === */
.single-tab-wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 18px 16px 40px; overflow-y: auto; }
.section-heading { font-size: 1.3rem; margin-bottom: 12px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; }
.kv-row:last-of-type { border-bottom: none; }
.avatar-settings-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.contacts-list { display: flex; flex-direction: column; gap: 8px; }
.contact-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}

/* === BOTTOM NAV === */
.bottom-nav {
  display: flex; background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0;
}
.nav-tab {
  flex: 1; background: none; border: none; border-top: 2px solid transparent;
  color: var(--muted); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em;
  padding: 12px 6px; cursor: pointer;
}
.nav-tab.active { color: var(--accent); border-top-color: var(--accent); }

/* === MODALS === */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
#modal-lightning { z-index: 150; }
.modal-card {
  position: relative; width: 100%; max-width: 390px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 26px 22px; text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,0.65);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-soft); border: 1px solid var(--border); color: var(--text);
  font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ln-title { font-size: 1.15rem; margin-bottom: 6px; }
.ln-sats { font-size: 1.45rem; font-weight: 800; color: var(--accent); margin-bottom: 16px; }
.qr-box {
  display: inline-flex; justify-content: center; align-items: center;
  background: #fff; padding: 14px; border-radius: 16px; margin-bottom: 18px; min-height: 180px;
}
.ln-waiting { color: var(--muted); font-size: 0.84rem; margin-top: 14px; }

/* === PRIVACY BLUR & TOAST === */
body.blur-mode .privacy-blur-target { filter: blur(6px); transition: filter 0.15s; }
body.blur-mode .privacy-blur-target:hover { filter: none; }

.toast {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
  background: #132822; border: 1px solid var(--accent); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; z-index: 200;
}

.mobile-only { display: none; }

@media (min-width: 760px) {
  .header-brand { display: flex; }
}
@media (max-width: 759px) {
  .mailbox-sidebar { width: 100%; }
  .mailbox-pane { display: none; }
  .mailbox-layout.mobile-pane-open .mailbox-sidebar { display: none; }
  .mailbox-layout.mobile-pane-open .mailbox-pane { display: flex; width: 100%; }
  .compose-options-row { flex-direction: column; }
  .mobile-only { display: inline-flex; }
}