:root {
  --bg-top: #d2d9e5;
  --bg-bottom: #9ca9bf;
  --surface: #eceff4;
  --line: #bcc5d3;
  --ink: #1b2230;
  --muted: #5c6b84;
  --accent: #f05d26;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  --brand-bg: linear-gradient(180deg, var(--bg-top) 0%, #c2cbd9 48%, var(--bg-bottom) 100%);
  background:
    radial-gradient(1200px 400px at 20% 0%, rgba(240, 93, 39, .10), transparent 60%),
    radial-gradient(900px 360px at 80% 0%, rgba(17, 17, 17, .06), transparent 55%),
    var(--brand-bg);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.site-header,
.site-footer {
  background: linear-gradient(90deg, #030407 0%, #14171d 55%, #23262d 100%);
  color: #fff;
}

.site-header { border-bottom: 1px solid #2d3441; }
.site-footer { border-top: 1px solid #2d3441; margin-top: auto; }

.site-header-inner,
.site-footer-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.jump-form,
.search-form { display: flex; gap: 0.45rem; }
.jump-form input { width: min(36vw, 19rem); }

input {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.56rem 0.72rem;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 0.56rem 0.88rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.danger { background: var(--accent); color: #fff; }

.page {
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem 0.7rem 1rem;
  flex: 1;
}

.flash {
  margin-bottom: 0.6rem;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  background: #eaf8f0;
  border: 1px solid #b7e4ca;
}

.inbox-identity h1 {
  margin: 0.15rem 0 0.1rem;
  font-size: clamp(2rem, 3.5vw, 3rem);
  color: #1d2534;
  font-weight: 700;
}

.inbox-identity p {
  margin: 0;
  color: #495a7a;
  font-weight: 700;
}

.controls { margin: 0.55rem 0 0.7rem; }
.controls-yop { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.controls-inline .search-form { max-width: 650px; flex: 1; }
.search-form input { flex: 1; }

.ghost-link { color: var(--muted); display: inline-flex; align-items: center; }

.mail-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 1rem;
}

.mail-list-panel,
.mail-preview-panel {
  background: var(--surface);
  border: 1px solid #b8c1d0;
  border-radius: 16px;
  box-shadow: 0 12px 22px rgba(27, 36, 55, 0.24);
  overflow: hidden;
  min-height: 76vh;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.8rem;
  color: #34486e;
  background: linear-gradient(180deg, #cfd6e2 0%, #bcc5d4 100%);
  border-bottom: 1px solid #aeb8c8;
  font-weight: 700;
}

.toolbar-actions .toolbar-page { margin-left: auto; }
.panel-toolbar-light {
  justify-content: flex-end;
  background: transparent;
  border-bottom: 0;
  padding: 0 0 0.45rem;
}

.email-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  grid-template-areas:
    "check sender time"
    "check subject time"
    "check snippet time";
  gap: 0.14rem 0.55rem;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #c7cfdb;
}

.email-row::before {
  content: "";
  grid-area: check;
  width: 12px;
  height: 12px;
  border: 1px solid #7f8ca5;
  border-radius: 2px;
  margin-top: 0.25rem;
}

.email-row:hover { background: #e3e9f3; }
.email-row.is-active { background: #d7e0ee; }

.sender, .subject, .snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender { grid-area: sender; font-size: 1.02rem; font-weight: 700; color: #4f6184; }
.subject { grid-area: subject; font-size: 0.9rem; color: #475875; }
.snippet { grid-area: snippet; font-size: 0.86rem; color: #5f6d83; }
time { grid-area: time; font-size: 0.8rem; color: #5f7090; }

.preview-header {
  padding: 0.7rem 0.9rem 0.8rem;
  border-bottom: 1px solid #c6ccd7;
}

.preview-header h2 {
  margin: 0 0 0.6rem;
  font-size: 1.45rem;
  line-height: 1.2;
}

.preview-meta { margin: 0; display: grid; gap: 0.38rem; }
.preview-meta div { display: grid; grid-template-columns: 5rem 1fr; gap: 0.45rem; }
dt { color: #62708a; font-weight: 700; }
dd { margin: 0; overflow-wrap: anywhere; }

.preview-body {
  margin: 0;
  padding: 0.95rem;
  white-space: pre-wrap;
  overflow-x: auto;
  flex: 1;
  font-family: Arial, sans-serif;
}

.empty-state {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  padding: 1rem;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.7rem;
  color: #5e6d87;
}

.pagination a,
.footer-brand { color: #f8a482; font-weight: 700; }

.footer-copy,
.footer-brand { margin: 0; }

@media (max-width: 1100px) {
  .mail-layout { grid-template-columns: 1fr; }
  .mail-list-panel, .mail-preview-panel { min-height: auto; }
}

@media (max-width: 760px) {
  .site-header-inner, .site-footer-inner, .controls-yop {
    flex-direction: column;
    align-items: stretch;
  }
  .jump-form input { width: 100%; }
  .email-row {
    grid-template-columns: 18px 1fr;
    grid-template-areas:
      "check sender"
      "check subject"
      "check snippet"
      "check time";
  }
}
