:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --text: #101820;
  --muted: #667483;
  --line: #dbe4ec;
  --brand: #136f63;
  --brand-2: #1f9d7a;
  --brand-3: #2c7be5;
  --ink: #17202a;
  --mail-card-bg: #17202a;
  --mail-card-line: rgba(255, 255, 255, 0.12);
  --accent: #e9583f;
  --warning: #f0b84b;
  --gold: #d99a22;
  --shadow: 0 24px 60px rgba(17, 31, 43, 0.12);
  --radius: 8px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #101418;
  --surface: #171d22;
  --surface-2: #202830;
  --text: #eef5f7;
  --muted: #9aaab8;
  --line: #2d3942;
  --brand: #48c9a9;
  --brand-2: #2da5d3;
  --brand-3: #7aa7ff;
  --ink: #eef5f7;
  --mail-card-bg: #0d1519;
  --mail-card-line: rgba(111, 227, 198, 0.22);
  --accent: #ff765f;
  --warning: #f3c15c;
  --gold: #f2bf4d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 12% 15%, rgba(31, 157, 122, 0.14), transparent 32rem),
    linear-gradient(135deg, var(--bg), var(--surface-2));
  background-size: 44px 44px, 44px 44px, auto, auto;
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.side-rail {
  display: none;
}

.page {
  min-width: 0;
  overflow-x: hidden;
}

.topbar,
.hero-panel,
.inbox-panel,
.detail-panel,
.ad-banner,
.ad-slot {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius);
}

.topbar::after {
  content: "";
  position: absolute;
  inset-inline: 14px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--brand-3), transparent);
  opacity: 0.55;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark,
.brand-logo {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
}

.brand-logo {
  border-radius: 14px;
  object-fit: contain;
  object-position: center;
  background: #0d1519;
  padding: 3px;
  box-shadow: 0 10px 24px rgba(19, 111, 99, 0.18);
}

.brand-mark {
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.mail-label,
.panel-tools,
.ad-slot,
.ad-banner,
.message-meta {
  color: var(--muted);
}

.top-actions,
.panel-tools,
.status-row,
.message-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body[data-page="home"] #newEmailTop {
  display: none;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.text-link,
.footer-links a {
  color: var(--text);
  text-decoration: none;
}

.text-link:hover,
.footer-links a:hover {
  color: var(--brand);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  gap: 26px;
  margin-top: 20px;
  padding: clamp(20px, 5vw, 56px);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 42%, rgba(255, 255, 255, 0.08) 48%, transparent 58%),
    radial-gradient(circle at 75% 18%, rgba(44, 123, 229, 0.13), transparent 19rem);
}

.standalone-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 0;
  max-width: 100%;
}

.hero-copy {
  align-self: center;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 7vw, 4.7rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.mail-card,
.inbox-panel,
.detail-panel {
  border-radius: var(--radius);
}

.mail-card {
  align-self: center;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--mail-card-line);
  background:
    linear-gradient(145deg, rgba(72, 201, 169, 0.08), transparent 42%),
    var(--mail-card-bg);
  color: #fff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  position: relative;
  z-index: 1;
}

.status-row {
  justify-content: space-between;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(240, 184, 75, 0.16);
}

.timer {
  margin-right: auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-variant-numeric: tabular-nums;
}

.mail-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.email-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.email-box input {
  min-width: 0;
  border: 0;
  padding: 0 14px;
  background: transparent;
  color: #fff;
  direction: ltr;
  text-align: left;
  font-size: clamp(0.9rem, 3vw, 1.08rem);
  outline: none;
}

.icon-action {
  display: grid;
  place-items: center;
  background: var(--brand-2);
  color: #fff;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.soft-button,
.danger-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.primary-button:hover,
.soft-button:hover,
.danger-button:hover,
.ghost-button:hover,
.icon-button:hover,
.icon-action:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
}

.soft-button,
.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.danger-button {
  background: rgba(233, 88, 63, 0.16);
  color: #fff;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.icon-button svg,
.ghost-button svg,
.primary-button svg,
.soft-button svg,
.danger-button svg,
.icon-action svg {
  width: 18px;
  height: 18px;
}

.ad-banner,
.ad-slot {
  display: grid;
  place-items: center;
  min-height: 92px;
  margin: 18px 0;
  border-radius: var(--radius);
  border-style: dashed;
  text-align: center;
}

.ad-grid-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 22px 0 0;
}

.ad-card {
  min-height: 250px;
  margin: 0;
}

.ad-wide {
  min-height: 120px;
  margin: 0;
}

.page-ad {
  margin-top: 18px;
}

.footer-ad {
  margin-top: 22px;
  margin-bottom: 0;
}

.ad-banner strong,
.ad-slot strong {
  color: var(--text);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.inbox-panel,
.detail-panel {
  min-width: 0;
  padding: 16px;
}

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

.panel-head h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  gap: 9px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  padding: 24px;
}

.empty-state.compact {
  min-height: 210px;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  color: var(--brand);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state p {
  max-width: 430px;
  color: var(--muted);
  line-height: 1.7;
}

.message-list {
  display: grid;
  gap: 10px;
}

.message-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-align: right;
}

.message-item:hover,
.message-item.active {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--brand) 9%, var(--surface-2));
}

.message-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.message-title span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.84rem;
}

.message-detail {
  min-height: 260px;
}

.detail-content {
  display: grid;
  gap: 14px;
}

.detail-content h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.field-line {
  display: grid;
  gap: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.field-line strong {
  color: var(--text);
}

.code-strip {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 14%, var(--surface-2));
}

.code-strip.visible {
  display: flex;
}

.code-strip code {
  direction: ltr;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand);
}

.text-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  line-height: 1.7;
}

.html-frame {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ad-square {
  min-height: 280px;
  margin-bottom: 0;
}

.ad-vertical {
  min-height: 600px;
  margin: 0;
}

.content-section,
.site-footer,
.admin-panel,
.admin-card,
.admin-topbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.content-section {
  margin-top: 18px;
  padding: clamp(20px, 4vw, 38px);
}

.section-head {
  max-width: 760px;
  margin-bottom: 20px;
}

.section-head h2,
.page-content h1,
.article-page h1 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.12;
}

.section-head p:last-child,
.lead,
.feature-card p,
.article-card p,
.site-footer p,
.small-note {
  color: var(--muted);
  line-height: 1.8;
}

.feature-grid,
.article-grid,
.admin-grid,
.admin-lists {
  display: grid;
  gap: 16px;
}

.feature-card,
.article-card,
.content-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 18px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.feature-card:hover,
.article-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  box-shadow: 0 18px 38px rgba(17, 31, 43, 0.09);
}

.feature-card svg {
  width: 30px;
  height: 30px;
  color: var(--brand);
}

.feature-card h3,
.article-card h3 {
  margin: 10px 0;
}

.split-section {
  display: grid;
  gap: 20px;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list div {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.info-list span {
  color: var(--muted);
  line-height: 1.7;
}

.article-card {
  display: grid;
  align-content: start;
}

.text-link {
  margin-top: 8px;
  font-weight: 800;
}

.page-content,
.article-page {
  max-width: 900px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.prose {
  color: var(--text);
  line-height: 1.9;
}

.prose p {
  margin-bottom: 16px;
}

.wide {
  width: 100%;
}

.site-footer {
  display: grid;
  gap: 18px;
  margin: 18px 0 28px;
  padding: 22px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.footer-nav a {
  flex: 1 1 120px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.footer-nav a:hover {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-note {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 0.92rem;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 16px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 800;
}

.faq-list p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.contact-form,
.admin-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.contact-form label,
.admin-panel label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

.contact-form input,
.contact-form textarea,
.contact-form select,
.admin-panel input,
.admin-panel textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px;
  outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus,
.admin-panel input:focus,
.admin-panel textarea:focus {
  border-color: var(--brand);
}

.form-status {
  display: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.32);
  color: var(--muted);
  line-height: 1.8;
}

.form-status.sending,
.form-status.success,
.form-status.error {
  display: block;
}

.form-status.success {
  border-color: rgba(63, 207, 197, 0.35);
  background: rgba(63, 207, 197, 0.08);
  color: #d7fffb;
}

.form-status.error {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: #ffe1e1;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px !important;
  height: 1px;
  opacity: 0;
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.admin-login {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.admin-card {
  width: min(520px, 100%);
  padding: 24px;
}

.credential-box {
  display: grid;
  gap: 7px;
  margin: 18px 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.credential-box span {
  color: var(--muted);
}

.credential-box strong {
  direction: ltr;
  text-align: left;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

.admin-topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
}

.admin-grid {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 18px;
}

.admin-panel {
  padding: 18px;
}

.content-list p {
  margin: 0 0 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 20px;
  z-index: 40;
  max-width: min(440px, calc(100vw - 28px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--mail-card-bg);
  color: #fff;
  box-shadow: var(--shadow);
  transform: translate(50%, 120px);
  transition: transform 180ms ease;
}

.toast.visible {
  transform: translate(50%, 0);
}

.is-loading {
  opacity: 0.72;
}

@media (min-width: 860px) {
  .hero-panel {
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  }

  .feature-grid,
  .article-grid,
  .admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ad-grid-block {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ad-wide {
    grid-column: 1 / -1;
  }

  .split-section {
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.7fr);
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1240px) {
  .app-shell {
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .side-rail {
    position: sticky;
    top: 20px;
    display: block;
    align-self: start;
  }
}

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

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

  .top-actions {
    justify-content: space-between;
  }

  .ghost-button {
    flex: 1;
  }

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

  .message-title {
    flex-direction: column;
  }

}
