:root {
  color-scheme: light;
  --bg: #161a13;
  --text: #eef1e7;
  --muted: #aeb79d;
  --line: #3d4632;
  --panel: #202719;
  --panel-2: #11150f;
  --accent: #6f8f3f;
  --accent-2: #b9a45d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11150f;
  color: var(--text);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 238px minmax(280px, 370px) minmax(0, 1fr);
  width: min(1440px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.sidebar,
.mail-column,
.reader {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #1c2316;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #78984d;
  border-radius: 8px;
  background: #26331d;
  color: #dbe8bd;
  font-size: 24px;
  font-weight: 800;
}

.brand p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.brand h1,
.list-header h2,
.reader h2,
.compose-header h2 {
  margin: 0;
}

.brand h1 {
  font-size: 28px;
}

.compose-main {
  width: 100%;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
}

.compose-main span {
  font-size: 20px;
  line-height: 1;
}

.folders {
  display: grid;
  gap: 8px;
}

.folder-button {
  justify-content: space-between;
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.folder-button:hover,
.folder-button.active {
  background: #26331d;
  color: var(--text);
}

.mail-column {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
}

.search-row {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151b12;
}

.search input {
  border: 0;
  background: transparent;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.list-header h2 {
  font-size: 20px;
}

.list-header span,
.preview,
.mail-time,
.reader-meta,
.empty-state p {
  color: var(--muted);
}

.message-list {
  display: grid;
  align-content: start;
  overflow: auto;
}

.mail-item {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 142px;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.mail-item:hover,
.mail-item.selected {
  background: var(--panel);
}

.mail-topline,
.subject-line,
.reader-actions,
.compose-header,
.compose-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mail-topline {
  justify-content: space-between;
}

.subject-line {
  min-width: 0;
  font-weight: 700;
}

.unread-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-2);
}

.preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.45;
}

.tag {
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #5b684c;
  border-radius: 999px;
  color: #dbe8bd;
  font-size: 12px;
}

.reader {
  padding: 24px;
  background: linear-gradient(180deg, rgba(111, 143, 63, .1), rgba(17, 21, 15, 0) 210px), var(--panel-2);
}

.reader-actions {
  justify-content: flex-end;
  margin-bottom: 24px;
}

.reader-actions button,
.compose-header button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: #151b12;
}

.reader-head {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.reader-head h2 {
  font-size: 30px;
  line-height: 1.15;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.reader-body {
  max-width: 760px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: #e6eadc;
  font-size: 17px;
  line-height: 1.7;
}

.empty-state {
  margin: 18px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #151b12;
}

.empty-state p {
  margin-bottom: 0;
}

.compose-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(92vw, 460px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
}

.compose-panel.hidden {
  display: none;
}

.compose-header {
  justify-content: space-between;
}

.compose-header h2 {
  font-size: 18px;
}

.secondary {
  border-color: var(--line);
  background: transparent;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .reader {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-width: 0;
    border-radius: 0;
  }

  .sidebar,
  .mail-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .reader {
    padding: 18px;
  }

  .reader-head h2 {
    font-size: 24px;
  }

  .compose-panel {
    right: 12px;
    bottom: 12px;
  }
}
