/* ===== Colors and basics ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #eef2f7;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --hover: #f3f6fb;
  --unread-bg: #f8fbff;
  --danger: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-light { background: var(--hover); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover:not(:disabled) { background: #e8eef8; }
.btn-danger { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.btn-block { width: 100%; }
a.btn { display: inline-block; text-decoration: none; }

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); }

/* ===== Forms ===== */
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--primary);
}
textarea { resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== Alerts ===== */
.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* ===== Login / Signup pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-card {
  background: var(--surface);
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.auth-card h1 { margin: 18px 0 4px; font-size: 24px; }
.auth-card .btn-block { margin-top: 20px; }
.auth-switch { text-align: center; font-size: 14px; margin-top: 18px; }

/* ===== Inbox layout ===== */
.app-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.search { flex: 1; max-width: 600px; }
.search input { background: var(--hover); border-color: transparent; }
.user-menu { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 14px; }

.banner {
  background: #fff7e6;
  color: #92400e;
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid #fde68a;
}

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 240px;
  padding: 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.folder-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.folder-link:hover { background: var(--hover); }
.folder-link.active { background: #dbeafe; color: var(--primary-dark); font-weight: 600; }
.count { font-size: 12px; font-weight: 700; }

.profile-box {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  line-height: 1.6;
}
.profile-name { color: var(--text); font-weight: 700; }

.content { flex: 1; overflow-y: auto; padding: 16px; min-width: 0; }

.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.list-header h2 { margin: 0; font-size: 20px; }

/* ===== Message list ===== */
.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.message-list:empty { display: none; }

.message-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
}
.message-item:last-child { border-bottom: none; }
.message-item:hover { background: var(--hover); }
.message-item.unread {
  background: var(--unread-bg);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}

.msg-main { display: grid; grid-template-columns: 180px 1fr; gap: 10px; min-width: 0; }
.msg-from, .msg-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg-snippet { color: var(--muted); font-weight: 400; }
.msg-date { color: var(--muted); font-size: 13px; white-space: nowrap; }

.star-toggle { background: none; border: none; font-size: 18px; cursor: pointer; color: #9ca3af; padding: 0; }
.star-toggle.starred { color: #f59e0b; }

/* Loading / empty / error boxes */
.state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.state.error { color: #991b1b; background: #fef2f2; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; }

/* ===== Reading a message ===== */
#read-view {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}
.read-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.read-meta {
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  line-height: 1.6;
}
.read-meta strong { color: var(--text); }
.read-body { white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }

.attachments { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  background: var(--hover);
}

/* ===== Compose window ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-box {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 14px;
  padding: 20px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }

.file-label { display: inline-block; cursor: pointer; color: var(--primary); }
.file-label input { display: none; }
.file-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--hover);
  border-radius: 6px;
  margin-bottom: 4px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ===== Small popup message ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 60;
}
.toast.error { background: var(--danger); }

/* ===== Mobile ===== */
.only-mobile { display: none; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 39; }

@media (max-width: 800px) {
  .only-mobile { display: inline-block; }
  .hide-mobile { display: none; }
  .topbar { gap: 8px; }
  .brand span { display: none; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.open { transform: translateX(0); }

  .msg-main { display: block; }
  .content { padding: 10px; }
}
/* ===== Public home page ===== */
a.brand { text-decoration: none; }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn-white { background: white; color: var(--primary); }

.home-page { background: var(--surface); }

.home-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
}
.home-links { display: flex; gap: 20px; }
.home-links a { color: var(--text); text-decoration: none; font-size: 15px; }
.home-links a:hover { color: var(--primary); }
.home-actions { margin-left: auto; display: flex; gap: 10px; }

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 24px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
.eyebrow {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
}
.hero h1 { font-size: 46px; line-height: 1.15; margin: 0 0 18px; }
.highlight { color: var(--primary); }
.hero-sub { font-size: 18px; color: var(--muted); line-height: 1.6; margin: 0 0 28px; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-preview {
  background: var(--bg);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(37, 99, 235, 0.12);
}
.preview-row {
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.preview-row:last-child { margin-bottom: 0; }
.preview-row.unread { box-shadow: inset 3px 0 0 var(--primary); font-weight: 700; }
.preview-row span { color: var(--muted); font-weight: 400; text-align: right; }

.band { background: var(--bg); }
.home-section { max-width: 1100px; margin: 0 auto; padding: 64px 24px; }
.home-section h2 { font-size: 32px; text-align: center; margin: 0 0 10px; }
.section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto 40px;
}
.section-sub.small { font-size: 14px; margin-bottom: 12px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.feature-icon { font-size: 28px; }
.feature-card h3 { margin: 10px 0 8px; font-size: 18px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 15px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { text-align: center; padding: 12px; }
.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.step h3 { margin: 0 0 8px; }
.step p { margin: 0; color: var(--muted); line-height: 1.6; }

.trust-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }
.badge { background: #dcfce7; color: #166534; padding: 10px 18px; border-radius: 999px; font-weight: 700; }
.auth-result {
  max-width: 640px;
  margin: 0 auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: 12px;
  font-family: Consolas, monospace;
  font-size: 14px;
  overflow-x: auto;
}
.auth-result .pass { color: #4ade80; font-weight: 700; }

.cta-band { background: var(--primary); color: white; text-align: center; padding: 56px 24px; }
.cta-band h2 { margin: 0 0 10px; font-size: 30px; }
.cta-band p { margin: 0 0 24px; opacity: 0.9; }

.home-footer {
  text-align: center;
  padding: 28px 24px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 800px) {
  .home-nav { padding: 12px 16px; gap: 12px; }
  .home-nav .brand span { display: inline; }
  .home-links { display: none; }
  .hero { grid-template-columns: 1fr; padding: 40px 16px; gap: 32px; }
  .hero h1 { font-size: 32px; }
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .home-section { padding: 48px 16px; }
}
/* ===== Countdown for temporary accounts ===== */
.countdown {
  margin: 8px 0 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--primary-dark);
  font-weight: 700;
}
.countdown.urgent {
  background: #fee2e2;
  color: #991b1b;
}
/* ===== My domains page ===== */
.domains-main { max-width: 860px; margin: 0 auto; padding: 32px 16px; }
.domains-main h1 { margin: 0 0 6px; }

.add-domain { display: flex; gap: 10px; margin: 20px 0; }
.add-domain input { flex: 1; }

.domain-list { display: flex; flex-direction: column; gap: 16px; }
.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.domain-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.domain-header h3 { margin: 0; font-size: 20px; }

.status-badge { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-badge.pending { background: #fff7e6; color: #92400e; }
.status-badge.verified { background: #dcfce7; color: #166534; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.dns-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dns-table th, .dns-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dns-table th { color: var(--muted); font-weight: 600; }
.dns-table code { background: var(--hover); padding: 4px 6px; border-radius: 6px; word-break: break-all; }

.btn-small { padding: 6px 10px; font-size: 13px; }
.domain-actions { display: flex; gap: 10px; margin-top: 16px; }

.help-box {
  margin-top: 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

@media (max-width: 600px) {
  .add-domain { flex-direction: column; }
}
/* ===== Addresses on a verified domain ===== */
.address-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.address-section h4 { margin: 0 0 10px; }
.address-list { list-style: none; padding: 0; margin: 0 0 12px; }
.address-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--hover);
  border-radius: 8px;
  margin-bottom: 6px;
}
.address-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.address-form input { flex: 1; min-width: 120px; }
.address-suffix { color: var(--muted); font-weight: 600; }