:root {
  --bg: #0a1018;
  --bg-soft: #101c2b;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.17);
  --text: #edf3fa;
  --muted: #a3b7ca;
  --primary: #f3a413;
  --primary-soft: #ffd68b;
  --danger: #ff6f6f;
  --shadow: 0 12px 38px rgba(6, 12, 24, 0.35);
}

[data-theme="light"] {
  --bg: #eef4f9;
  --bg-soft: #f8fbff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --border: rgba(17, 33, 53, 0.13);
  --text: #0f2238;
  --muted: #4f647d;
  --primary: #ec9600;
  --primary-soft: #ffd07d;
  --danger: #cf3d3d;
  --shadow: 0 12px 28px rgba(23, 43, 68, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg), var(--bg-soft));
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(40px);
  pointer-events: none;
}

.bg-orb-a {
  left: -8rem;
  top: -8rem;
  background: rgba(34, 123, 255, 0.22);
}

.bg-orb-b {
  right: -8rem;
  bottom: -8rem;
  background: rgba(243, 164, 19, 0.22);
}

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
  pointer-events: none;
}

.page-shell {
  width: min(1160px, 94vw);
  margin: 18px auto 24px;
  position: relative;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 11px;
  background: linear-gradient(180deg, var(--primary-soft), var(--primary));
  box-shadow: 0 0 0 4px rgba(243, 164, 19, 0.13);
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: 0.04em;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.hero p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 14px;
}

.panel-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.section-label {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.address-box {
  border: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.13);
  border-radius: 13px;
  padding: 12px;
  font-size: 1.03rem;
  font-weight: 700;
  word-break: break-all;
}

[data-theme="light"] .address-box {
  background: rgba(255, 255, 255, 0.65);
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label {
  font-size: 0.9rem;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
}

[data-theme="light"] input {
  background: rgba(255, 255, 255, 0.75);
}

input::placeholder {
  color: var(--muted);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #2b1800;
  background: linear-gradient(180deg, var(--primary-soft), var(--primary));
}

.btn-outline {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.btn-theme {
  min-width: 88px;
}

.status-pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: lowercase;
}

.status-pill.error {
  color: var(--danger);
}

.panel-main {
  display: grid;
  align-content: start;
  gap: 10px;
}

.inbox-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.inbox-head h2 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.3rem;
}

.inbox-head small {
  color: var(--muted);
}

.inbox-grid {
  display: grid;
  grid-template-columns: minmax(230px, 300px) 1fr;
  gap: 10px;
  min-height: 430px;
}

.list-wrap,
.preview-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.11);
}

[data-theme="light"] .list-wrap,
[data-theme="light"] .preview-wrap {
  background: rgba(255, 255, 255, 0.6);
}

.list-wrap {
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  max-height: 500px;
}

.preview-wrap {
  padding: 12px;
  overflow: auto;
}

.message-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
}

.message-item.active {
  border-color: rgba(243, 164, 19, 0.7);
  background: rgba(243, 164, 19, 0.14);
}

.message-from,
.message-time {
  color: var(--muted);
  font-size: 0.79rem;
}

.message-subject {
  font-size: 0.92rem;
  font-weight: 700;
}

.preview-placeholder,
.empty-state {
  color: var(--muted);
}

.error {
  color: var(--danger);
  margin: 0;
}

.preview-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.preview-title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.08rem;
}

.preview-switch {
  display: inline-flex;
  gap: 6px;
}

.preview-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}

.preview-tab.active {
  border-color: rgba(243, 164, 19, 0.75);
  background: rgba(243, 164, 19, 0.15);
}

.preview-meta {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.preview-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.preview-html-shell {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 320px;
}

.preview-frame {
  width: 100%;
  min-height: 320px;
  border: 0;
  display: block;
}

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

  .inbox-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .list-wrap {
    max-height: 240px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    margin-top: 12px;
    margin-bottom: 14px;
  }

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

  .hero-controls {
    justify-content: space-between;
  }

  .hero p {
    font-size: 0.84rem;
  }

  .panel {
    padding: 12px;
    border-radius: 14px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

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

  .btn {
    padding: 9px 10px;
    font-size: 0.9rem;
  }

  .preview-head-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .preview-switch {
    width: 100%;
  }

  .preview-tab {
    flex: 1;
    text-align: center;
  }
}
