:root {
  color: #17211b;
  background: #eef2ed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(184, 216, 190, .7), transparent 28rem),
    linear-gradient(150deg, #f7f4e9 0%, #e9f0e9 52%, #dbe8df 100%);
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.shell { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.eyebrow { margin: 0 0 4px; color: #477255; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(32px, 6vw, 52px); font-weight: 500; letter-spacing: -.035em; }
h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }

.panel {
  border: 1px solid rgba(62, 83, 68, .14);
  border-radius: 22px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 18px 60px rgba(49, 71, 55, .1);
  backdrop-filter: blur(18px);
}

label { color: #405148; font-size: 13px; font-weight: 750; }
input {
  width: 100%;
  border: 1px solid #cad5cc;
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, .9);
  color: #17211b;
  padding: 13px 14px;
}
input:focus { border-color: #407752; box-shadow: 0 0 0 4px rgba(64, 119, 82, .12); }

.button { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 750; }
.primary { background: #173c28; color: white; box-shadow: 0 8px 20px rgba(23, 60, 40, .18); }
.primary:hover { background: #235535; }
.search-panel { display: flex; align-items: end; gap: 14px; padding: 20px; }
.field { display: grid; gap: 7px; }
.grow { flex: 1; }
.limit-field { width: 100px; }
.search-button { min-height: 46px; }
.status { min-height: 52px; padding: 18px 6px 10px; color: #5f6e64; }
.status.error { color: #a12e2e; }

.email-list { display: grid; gap: 10px; }
.email-card {
  width: 100%;
  border: 1px solid rgba(62, 83, 68, .13);
  border-radius: 16px;
  background: rgba(255, 255, 255, .75);
  padding: 18px 20px;
  color: inherit;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.email-card:hover { transform: translateY(-2px); border-color: #8eaa95; box-shadow: 0 12px 30px rgba(50, 70, 55, .09); }
.card-top { display: flex; gap: 20px; align-items: baseline; justify-content: space-between; }
.card-subject { margin: 0; font-size: 17px; font-weight: 800; }
.card-date { color: #748078; font-size: 12px; white-space: nowrap; }
.card-from { margin: 7px 0; color: #3f7250; font-size: 13px; font-weight: 650; }
.card-preview { margin: 0; overflow: hidden; color: #647068; font-size: 14px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }

.email-dialog { width: min(1000px, calc(100% - 30px)); height: min(820px, calc(100% - 30px)); border: 0; border-radius: 20px; padding: 0; overflow: hidden; background: #f7f8f5; box-shadow: 0 26px 90px rgba(12, 28, 18, .3); }
.email-dialog::backdrop { background: rgba(15, 29, 20, .65); backdrop-filter: blur(5px); }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; padding: 22px 26px; border-bottom: 1px solid #dce3dd; background: white; }
.dialog-header h2 { overflow-wrap: anywhere; }
.detail-date { margin: 0 0 6px; color: #708078; font-size: 12px; }
.detail-meta { margin: 9px 0 0; color: #52705d; font-size: 13px; overflow-wrap: anywhere; }
.icon-button { width: 38px; height: 38px; flex: 0 0 auto; border: 0; border-radius: 50%; background: #edf1ed; color: #31483a; font-size: 25px; }
.detail-loading { display: grid; height: calc(100% - 120px); place-items: center; color: #68766d; }
.email-frame { width: 100%; height: calc(100% - 120px); border: 0; background: white; }

@media (max-width: 650px) {
  .shell { width: min(100% - 22px, 980px); padding-top: 24px; }
  .search-panel { align-items: stretch; flex-direction: column; }
  .limit-field { width: 100%; }
  .card-top { align-items: flex-start; flex-direction: column; gap: 6px; }
  .card-preview { white-space: normal; }
  .email-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; }
}
