:root {
  --ink: #10231f;
  --muted: #66756f;
  --line: #dfe8e4;
  --paper: #fbfdfb;
  --soft: #eef6f2;
  --brand: #0f6f5c;
  --brand-2: #13a37d;
  --attention: #ffefe3;
  --attention-ink: #9a4d13;
  --recent: #e9f4ff;
  --recent-ink: #245f99;
  --quiet: #f1eefc;
  --quiet-ink: #6651a8;
  --danger: #fff0f0;
  --shadow: 0 18px 50px rgba(16, 35, 31, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(19, 163, 125, .16), transparent 32rem),
    radial-gradient(circle at 90% 10%, rgba(91, 124, 250, .12), transparent 28rem),
    linear-gradient(180deg, #f7fbf8 0%, #eef4f1 100%);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px clamp(18px, 5vw, 68px);
  color: white;
  background: linear-gradient(135deg, #0d4238, #116e5a 62%, #1aa37c);
}

header strong {
  display: block;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: .02em;
}

header span { opacity: .68; font-weight: 500; }

header small {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,.78);
}

main {
  width: min(1040px, calc(100% - 28px));
  margin: 28px auto 44px;
}

section {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(223,232,228,.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
  backdrop-filter: blur(14px);
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

p { color: var(--muted); line-height: 1.55; }

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

button {
  border: 0;
  border-radius: 13px;
  padding: 12px 16px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(16,35,31,.10);
}

button:active { transform: translateY(0); }

#logout {
  background: rgba(255,255,255,.94);
  color: #164139;
}

#compose, #verify, #send {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
}

label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(19, 163, 125, .14);
}

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

#auth {
  max-width: 520px;
  margin: 36px auto;
}

#inbox > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

#search {
  margin: 4px 0 18px;
  font-size: 17px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}

.tabs button {
  padding: 11px 15px;
  background: #edf4f1;
  color: #24433c;
  font-weight: 650;
}

.tabs button[data-section="attention"].active {
  background: var(--attention);
  color: var(--attention-ink);
}

.tabs button[data-section="recent"].active {
  background: var(--recent);
  color: var(--recent-ink);
}

.tabs button[data-section="quiet"].active {
  background: var(--quiet);
  color: var(--quiet-ink);
}

.tabs button.active:not([data-section]) {
  background: #eaf5f1;
  color: var(--brand);
}

#refresh {
  margin-bottom: 12px;
  background: white;
  border: 1px solid var(--line);
}

#list {
  display: grid;
  gap: 10px;
}

.mail-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(160px, 280px) 1fr;
  gap: 8px 16px;
  align-items: center;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 16px 18px;
  background: white;
  box-shadow: 0 8px 24px rgba(16,35,31,.055);
}

.mail-item:hover {
  border-color: rgba(19, 163, 125, .38);
  background: #fbfffd;
}

.mail-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.mail-item span {
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item small {
  grid-column: 2;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item.empty {
  grid-template-columns: 1fr;
  color: var(--muted);
  background: #f7faf8;
}

#reader {
  max-width: 900px;
}

#back {
  margin-bottom: 18px;
}

#subject {
  margin-bottom: 8px;
}

#sender {
  margin: 0 0 22px;
  color: var(--muted);
  font-weight: 650;
}

#body {
  white-space: pre-wrap;
  line-height: 1.62;
  font-size: 17px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#reader button {
  margin: 12px 8px 0 0;
}

#reader label {
  margin-top: 20px;
}

#composer {
  max-width: 820px;
}

#status, [role="status"] {
  width: min(1040px, calc(100% - 28px));
  margin: 14px auto 0;
  color: #8a4f22;
  font-weight: 650;
}

[hidden] { display: none !important; }

@media (max-width: 720px) {
  header {
    padding: 20px 18px;
  }

  main {
    width: calc(100% - 18px);
    margin-top: 12px;
  }

  section {
    border-radius: 16px;
    padding: 16px;
  }

  #inbox > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mail-item {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .mail-item small {
    grid-column: auto;
  }
}

/* ZUVO dashboard polish bodyfix5 */
#welcomePanel {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 18px 20px;
  border: 1px solid rgba(19, 163, 125, .18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(19, 163, 125, .12), rgba(71, 139, 255, .10)),
    #ffffff;
}

#welcomePanel strong {
  font-size: clamp(22px, 3vw, 30px);
}

#welcomePanel span {
  color: var(--muted);
  line-height: 1.45;
}

.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-count {
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 800;
}

.mail-item {
  grid-template-columns: 46px minmax(180px, 260px) 1fr auto;
  min-height: 74px;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-weight: 850;
  background: linear-gradient(135deg, #0f6f5c, #5b7cfa);
}

.mail-meta {
  min-width: 0;
}

.mail-meta strong,
.mail-main span {
  display: block;
}

.mail-main {
  min-width: 0;
}

.mail-main small {
  display: block;
  margin-top: 4px;
  grid-column: auto;
}

.badge {
  justify-self: end;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.attention {
  background: var(--attention);
  color: var(--attention-ink);
}

.badge.recent {
  background: var(--recent);
  color: var(--recent-ink);
}

.badge.quiet {
  background: var(--quiet);
  color: var(--quiet-ink);
}

#reader {
  position: relative;
}

#reader::before {
  content: "Conversation";
  display: inline-block;
  margin-bottom: 10px;
  border-radius: 999px;
  padding: 6px 11px;
  background: #eaf5f1;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

@media (max-width: 720px) {
  .mail-item {
    grid-template-columns: 42px 1fr;
  }

  .mail-main, .badge {
    grid-column: 2;
  }

  .badge {
    justify-self: start;
  }
}

/* ZUVO sender/date polish bodyfix8 */
.mail-item {
  grid-template-columns: 46px minmax(140px, 220px) 1fr auto auto;
}

.mail-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

#sender {
  white-space: pre-line;
}

#sender::first-line {
  color: var(--ink);
}

@media (max-width: 720px) {
  .mail-date {
    grid-column: 2;
    justify-self: start;
  }
}

/* ZUVO filters bodyfix9 */
.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) minmax(150px, 1fr);
  gap: 12px;
  margin: 0 0 18px;
}

.filters label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.filters select {
  margin-top: 7px;
  padding: 11px 12px;
  border-radius: 12px;
  background: white;
}

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

/* ZUVO tactile 3D + filter visibility bodyfix10 */
#refresh {
  display: none !important;
}

.filters {
  display: grid !important;
  grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) minmax(150px, 1fr);
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #edf7f3);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 12px 26px rgba(16,35,31,.08);
}

.filters label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 850;
}

.filters select {
  margin-top: 7px;
  border: 1px solid rgba(15,111,92,.14);
  background: linear-gradient(180deg, #ffffff, #f6fbf8);
  box-shadow: 0 5px 0 rgba(15,111,92,.10), 0 12px 24px rgba(16,35,31,.08);
}

button,
.mail-item,
.tabs button,
#compose,
#verify,
#send,
#logout {
  transform: translateY(0);
  box-shadow:
    0 6px 0 rgba(15,111,92,.16),
    0 16px 28px rgba(16,35,31,.10),
    inset 0 1px 0 rgba(255,255,255,.85);
  transition:
    transform .11s ease,
    box-shadow .11s ease,
    filter .11s ease,
    background .12s ease;
}

button:hover,
.mail-item:hover,
.tabs button:hover {
  transform: translateY(-2px);
  filter: saturate(1.04);
  box-shadow:
    0 8px 0 rgba(15,111,92,.16),
    0 20px 34px rgba(16,35,31,.13),
    inset 0 1px 0 rgba(255,255,255,.9);
}

button:active,
.mail-item:active,
.tabs button:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 rgba(15,111,92,.18),
    0 8px 16px rgba(16,35,31,.10),
    inset 0 2px 8px rgba(16,35,31,.10);
}

.tabs button.active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(15,111,92,.18),
    0 8px 18px rgba(16,35,31,.10),
    inset 0 2px 10px rgba(255,255,255,.7);
}

.mail-item {
  background: linear-gradient(145deg, #ffffff, #f7fbf9);
  border: 1px solid rgba(15,111,92,.08);
}

.mail-item:hover {
  border-color: rgba(19,163,125,.38);
}

.avatar {
  box-shadow:
    0 5px 0 rgba(15,111,92,.18),
    0 12px 22px rgba(16,35,31,.13),
    inset 0 1px 0 rgba(255,255,255,.32);
}

#compose {
  background: linear-gradient(145deg, #11a87f, #0b6d5a);
}

#logout {
  background: linear-gradient(145deg, #ffffff, #eef6f2);
}

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

/* ZUVO status and role badges rescue2 */
.filters {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.mail-item.unread {
  font-weight: 850;
  background: linear-gradient(145deg, #ffffff, #ecfff7);
  border-color: rgba(17,168,127,.35);
}

.mail-item.action-required {
  border-left: 7px solid #f59e0b;
}

.mail-item.urgent {
  border-left: 7px solid #ef4444;
}

.mail-item.replied {
  border-left: 7px solid #16a34a;
}

.mail-item.forwarded {
  border-left: 7px solid #6366f1;
}

.badge.status-unread { background: #dcfce7; color: #166534; }
.badge.status-read { background: #eef2f7; color: #475569; }
.badge.status-replied { background: #dcfce7; color: #15803d; }
.badge.status-forwarded { background: #e0e7ff; color: #4338ca; }
.badge.status-no-action { background: #fef3c7; color: #92400e; }
.badge.status-action-required { background: #ffedd5; color: #c2410c; }
.badge.status-urgent { background: #fee2e2; color: #b91c1c; }
.badge.status-fyi { background: #e0f2fe; color: #0369a1; }

.role-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  background: #ecfeff;
  color: #0f766e;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .filters { grid-template-columns: 1fr; }
}

/* ZUVO mobile compact inbox */
@media (max-width: 640px) and (orientation: portrait) {
  body {
    padding: 0;
  }

  header {
    padding: 10px 12px;
    min-height: auto;
  }

  header strong {
    font-size: 18px;
  }

  header small {
    display: none;
  }

  main {
    padding: 8px;
  }

  #inbox {
    gap: 8px;
  }

  #greeting {
    font-size: 20px;
    margin: 2px 0;
  }

  #compose {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
  }

  #search {
    width: 100%;
    min-height: 38px;
    padding: 9px 12px;
    font-size: 14px;
  }

  #filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
    max-height: 86px;
    overflow: auto;
  }

  #filters label,
  #filters > div {
    min-width: 0;
    font-size: 11px;
  }

  #filters select {
    width: 100%;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 12px;
    border-radius: 9px;
  }

  .tabs,
  #tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar,
  #tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs button,
  #tabs button {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
  }

  #list {
    gap: 7px;
  }

  .mail-item {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    grid-template-areas:
      "avatar meta date"
      "avatar main badge";
    gap: 3px 8px;
    padding: 9px 10px;
    min-height: 58px;
    border-radius: 13px;
    align-items: center;
  }

  .mail-item .avatar {
    grid-area: avatar;
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .mail-item .mail-meta {
    grid-area: meta;
    min-width: 0;
  }

  .mail-item .mail-meta strong {
    display: block;
    font-size: 13px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mail-item .mail-main {
    grid-area: main;
    min-width: 0;
  }

  .mail-item .mail-main span {
    display: block;
    font-size: 13px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mail-item .mail-main small {
    display: none;
  }

  .mail-date {
    grid-area: date;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0.72;
  }

  .role-badge {
    display: none;
  }

  .badge {
    grid-area: badge;
    justify-self: end;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .mail-item.unread {
    border-left-width: 4px;
  }

  #reader,
  #composer {
    padding: 10px;
  }

  #readerSubject {
    font-size: 18px;
    line-height: 1.2;
  }

  #readerBody {
    font-size: 14px;
    line-height: 1.45;
  }

  button {
    min-height: 34px;
  }
}
