/* =====================================================================
   Mail App
   ===================================================================== */

#mail.window {
  width: 900px;
  height: 560px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 110px);
  font-family: "VT323", monospace;
}

.mail-app {
  display: flex;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: #efebe0;
}

.mail-layout {
  --mail-accent: #e2c75d;
  --mail-accent-soft: #f7e7a2;
  --mail-panel-bg: #e7dcc1;
  --mail-card-bg: #fff9ec;
  --mail-reader-header: #f7edc6;
  --mail-reader-bg: #fffdf5;
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--mail-reader-bg);
}

.mail-sidebar {
  display: flex;
  width: 42%;
  min-width: 300px;
  max-width: 390px;
  min-height: 0;
  flex-direction: column;
  padding: 14px;
  border-right: 3px solid #000;
  background: var(--mail-panel-bg);
}

.mail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mail-tab[data-folder="deleted"] {
  grid-column: 1 / 2;
}

.mail-tab {
  appearance: none;
  min-height: 48px;
  padding: 8px 10px;
  border: 3px solid #000;
  border-radius: 8px;
  background: #f8f2dd;
  color: #000;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.82);
  font-family: "VT323", monospace;
  font-size: 20px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.mail-tab:hover {
  background: #fff6da;
}

.mail-tab.active,
.mail-tab.active:hover {
  background: var(--mail-accent);
  color: #000;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.9);
}

.mail-sidebar-divider {
  flex-shrink: 0;
  height: 3px;
  margin: 14px 0 12px;
  background: rgba(0, 0, 0, 0.45);
}

.mail-list-wrap {
  flex: 1;
  min-height: 0;
}

.mail-list {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 8px;
}

.mail-list-item {
  appearance: none;
  position: relative;
  width: 100%;
  padding: 12px 14px 12px 22px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--mail-card-bg);
  color: #000;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8);
  font-family: "VT323", monospace;
  text-align: left;
  cursor: pointer;
}

.mail-list-item::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 10px;
  bottom: 12px;
  width: 5px;
  border-radius: 6px;
  background: transparent;
}

.mail-list-item.unread::before {
  background: var(--mail-accent);
}

.mail-list-item:hover {
  background: #fffdf6;
}

.mail-list-item.active {
  background: #f6eebd;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.88);
}

.mail-list-item.read .mail-list-sender,
.mail-list-item.read .mail-list-subject,
.mail-list-item.read .mail-list-date {
  color: #575757;
}

.mail-list-sender,
.mail-list-subject,
.mail-list-date {
  display: block;
}

.mail-list-sender {
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-list-subject {
  margin-top: 7px;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-list-date {
  margin-top: 10px;
  font-size: 18px;
  line-height: 1;
  color: #4d4d4d;
}

.mail-empty-state {
  padding: 20px 10px;
  border: 3px dashed #000;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: #444;
  font-size: 22px;
  line-height: 1.1;
  text-align: center;
}

.mail-detail {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--mail-reader-bg);
}

.mail-detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  color: #585858;
  font-size: 26px;
  text-align: center;
}

.mail-detail-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.mail-detail-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px 16px;
  border-bottom: 3px solid #000;
  background: var(--mail-reader-header);
}

.mail-detail-subject {
  margin: 0;
  font-size: 31px;
  line-height: 0.98;
  color: #000;
}

.mail-detail-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.mail-detail-from {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.mail-detail-from-name {
  font-size: 22px;
  line-height: 1;
  color: #1c1c1c;
}

.mail-detail-from-address {
  font-size: 18px;
  line-height: 1.05;
  color: #4b4b4b;
  overflow-wrap: anywhere;
}

.mail-detail-date {
  font-size: 18px;
  line-height: 1;
  color: #4b4b4b;
  white-space: nowrap;
}

.mail-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  background: var(--mail-reader-bg);
  color: #111;
  font-size: 22px;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mail-detail-body strong {
  padding: 0 2px;
  background: var(--mail-accent-soft);
  font-weight: normal;
}

.mail-list,
.mail-detail-body {
  scrollbar-width: auto;
  scrollbar-color: #9a9a9a #ececec;
}

.mail-list::-webkit-scrollbar,
.mail-detail-body::-webkit-scrollbar {
  width: 13px;
}

.mail-list::-webkit-scrollbar-track,
.mail-detail-body::-webkit-scrollbar-track {
  border: 2px solid #000;
  border-radius: 10px;
  background: #ececec;
}

.mail-list::-webkit-scrollbar-thumb,
.mail-detail-body::-webkit-scrollbar-thumb {
  border: 2px solid #000;
  border-radius: 10px;
  background: #9a9a9a;
}
