:root {
  --forest-900: #08130f;
  --forest-800: #0b1b15;
  --forest-700: #10251d;
  --forest-600: #163327;
  --forest-500: #1d4433;
  --mint-400: #4ade80;
  --mint-300: #86efac;
  --mint-500: #22c55e;
  --sand-100: #f4f7f5;
  --sand-300: #cbd8d1;
  --sand-500: #8ea49a;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(4, 12, 9, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 15% -10%, #123024 0%, var(--forest-900) 55%);
  color: var(--sand-100);
  font: 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

button, input, textarea { font: inherit; color: inherit; }

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--sand-300);
  letter-spacing: .02em;
}

/* ---------- desbloqueio ---------- */

.unlock {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.unlock__card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(22, 51, 39, .95), rgba(11, 27, 21, .95));
  border: 1px solid rgba(74, 222, 128, .18);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.unlock__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mint-300);
}

.unlock h1 { margin: 0 0 10px; font-size: 22px; }

.unlock__lead { margin: 0 0 20px; color: var(--sand-300); font-size: 14px; }

.unlock label { display: block; font-size: 13px; color: var(--sand-300); margin-bottom: 6px; }

.unlock input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(203, 216, 209, .22);
  background: rgba(8, 19, 15, .7);
  margin-bottom: 14px;
}

.unlock input:focus { outline: 2px solid rgba(74, 222, 128, .45); border-color: transparent; }

.unlock button {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--mint-400), var(--mint-500));
  color: #062015;
  font-weight: 650;
  cursor: pointer;
}

.unlock__error { min-height: 18px; margin: 0 0 10px; color: var(--danger); font-size: 13px; }

/* ---------- app ---------- */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(203, 216, 209, .1);
  background: rgba(8, 19, 15, .72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(74, 222, 128, .14);
  color: var(--mint-300);
}
.topbar__name { font-weight: 700; letter-spacing: .01em; }

.topbar__who { display: flex; align-items: center; gap: 12px; color: var(--sand-300); font-size: 13px; }

.btn {
  border-radius: 10px;
  padding: 8px 14px;
  border: 1px solid rgba(203, 216, 209, .18);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: rgba(74, 222, 128, .5); }
.btn--primary {
  background: linear-gradient(180deg, var(--mint-400), var(--mint-500));
  color: #062015;
  border-color: transparent;
  font-weight: 650;
}
.btn--ghost { color: var(--sand-300); }

.layout {
  display: grid;
  grid-template-columns: 220px minmax(280px, 380px) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}

.folders {
  border-right: 1px solid rgba(203, 216, 209, .1);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.folders__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.folders__list button {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sand-300);
  cursor: pointer;
  font-size: 13.5px;
}
.folders__list button:hover { background: rgba(74, 222, 128, .08); color: var(--sand-100); }
.folders__list button[aria-current="true"] {
  background: rgba(74, 222, 128, .14);
  color: var(--mint-300);
  font-weight: 600;
}

.folders__filter input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(203, 216, 209, .16);
  background: rgba(8, 19, 15, .55);
  font-size: 13px;
}

.list {
  border-right: 1px solid rgba(203, 216, 209, .1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.list__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 10px;
}
.list__head h2 { margin: 0; font-size: 15px; letter-spacing: .01em; }
.list__meta { color: var(--sand-500); font-size: 12px; }

.list__items { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }

.row {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
}
.row:hover { background: rgba(74, 222, 128, .06); }
.row[aria-current="true"] { background: rgba(74, 222, 128, .12); border-color: rgba(74, 222, 128, .28); }
.row__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row__from { font-size: 13px; color: var(--sand-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__date { font-size: 11.5px; color: var(--sand-500); white-space: nowrap; }
.row__subject { font-size: 13px; color: var(--sand-300); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row--unread .row__from, .row--unread .row__subject { color: #fff; font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}
.chip--ok { background: rgba(74, 222, 128, .16); color: var(--mint-300); }
.chip--warn { background: rgba(251, 191, 36, .16); color: var(--warn); }
.chip--bad { background: rgba(248, 113, 113, .16); color: var(--danger); }
.chip--mute { background: rgba(203, 216, 209, .12); color: var(--sand-300); }

.list__more { margin: 8px 16px 16px; align-self: flex-start; }

.reader { padding: 20px 24px; overflow-y: auto; min-height: 0; }

.reader__empty {
  display: grid;
  place-content: center;
  gap: 6px;
  height: 100%;
  color: var(--sand-500);
  text-align: center;
}
.reader__hint { font-size: 12.5px; max-width: 34ch; }

.reader__head { display: grid; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid rgba(203, 216, 209, .12); }
.reader__subject { margin: 0; font-size: 19px; line-height: 1.3; }
.reader__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--sand-300); font-size: 13px; }
.reader__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

.reader__body { margin-top: 16px; }
.reader__body iframe {
  width: 100%;
  min-height: 420px;
  border: 1px solid rgba(203, 216, 209, .14);
  border-radius: 12px;
  background: #fff;
}
.reader__body pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(8, 19, 15, .55);
  border: 1px solid rgba(203, 216, 209, .12);
  border-radius: 12px;
  padding: 16px;
  font-size: 13.5px;
}

.reader__attachments { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reader__attachments a {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid rgba(203, 216, 209, .18);
  color: var(--sand-100);
  text-decoration: none;
  font-size: 12.5px;
}
.reader__attachments a:hover { border-color: rgba(74, 222, 128, .5); }

.symbols {
  margin-top: 14px;
  font-size: 12px;
  color: var(--sand-500);
  word-break: break-word;
}

/* ---------- compose ---------- */

.compose {
  border: 1px solid rgba(74, 222, 128, .2);
  border-radius: 18px;
  background: var(--forest-800);
  color: var(--sand-100);
  padding: 22px;
  width: min(640px, 94vw);
  box-shadow: var(--shadow);
}
.compose::backdrop { background: rgba(4, 12, 9, .65); }
.compose h2 { margin: 0 0 14px; font-size: 17px; }
.compose label { display: block; font-size: 12.5px; color: var(--sand-300); margin-bottom: 10px; }
.compose input, .compose textarea {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(203, 216, 209, .18);
  background: rgba(8, 19, 15, .6);
  resize: vertical;
}
.compose menu { display: flex; justify-content: flex-end; gap: 8px; margin: 12px 0 0; padding: 0; }
.compose__status { min-height: 18px; font-size: 12.5px; color: var(--sand-300); margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--forest-600);
  border: 1px solid rgba(74, 222, 128, .3);
  color: var(--sand-100);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 190px minmax(240px, 320px) minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .folders { border-right: 0; border-bottom: 1px solid rgba(203, 216, 209, .1); }
  .folders__list { display: flex; flex-wrap: wrap; gap: 6px; }
  .list { border-right: 0; border-bottom: 1px solid rgba(203, 216, 209, .1); max-height: 45vh; }
  .reader { padding: 16px; }
}
