/* Mailjar — porcelain + bottle-glass green, honey for codes. */
:root {
  --porcelain: #E9EFEC;
  --paper: #FAFCFB;
  --glass: #1E4A42;
  --glass-deep: #133630;
  --ink: #16201E;
  --muted: #5E6D68;
  --line: #D5DEDA;
  --line-soft: #E4EBE8;
  --honey: #B9781A;
  --honey-ink: #855610;
  --honey-soft: #FBF1DF;
  --danger: #B4382F;

  --display: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--porcelain);
  color: var(--ink);
  font: 15px/1.55 var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--honey); outline-offset: 2px; }

/* ── header ─────────────────────────────────────────────── */
.top { max-width: 1080px; margin: 0 auto; padding: 22px 24px 6px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--glass); text-decoration: none; }
.brand svg { width: 28px; height: 28px; fill: var(--glass); }
.brand svg .env { fill: none; stroke: var(--porcelain); stroke-width: 1.6; stroke-linejoin: round; }
.brand span { font: 700 21px/1 var(--display); letter-spacing: -0.02em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 12px 24px 56px; display: grid; gap: 18px; }

/* ── hero: the glass jar ────────────────────────────────── */
.hero {
  position: relative;
  padding: 24px 28px 22px;
  border-radius: 22px;
  color: #EAF3F0;
  background:
    radial-gradient(120% 150% at 88% -30%, rgba(255, 255, 255, .17), transparent 52%),
    linear-gradient(165deg, #255A50 0%, var(--glass) 45%, var(--glass-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 18px 40px -24px rgba(19, 54, 48, .55);
  overflow: hidden;
}
.addr-row { display: flex; align-items: center; gap: 16px; }
.address {
  flex: 1; min-width: 0; margin: 0;
  font: 600 clamp(22px, 4vw, 42px)/1.1 var(--display);
  letter-spacing: -0.025em;
  color: #FFFFFF;
  overflow-wrap: anywhere;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* buttons: light context by default, glass context inside .hero */
.btn {
  height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink);
  font-weight: 500; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover:not(:disabled) { border-color: #B9C8C2; background: #F1F5F3; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--glass); border-color: var(--glass); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--glass-deep); border-color: var(--glass-deep); }
.btn.danger { color: var(--danger); }

.hero .btn { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .17); color: #EAF3F0; }
.hero .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); }
.hero .btn.primary { background: var(--paper); border-color: var(--paper); color: var(--glass); }
.hero .btn.primary:hover:not(:disabled) { background: #fff; }
.hero .addr-row .btn.primary { height: 46px; padding: 0 24px; border-radius: 12px; font-size: 16px; }
.hero .btn.danger { color: #FFB8AD; }
.hero .btn.danger.confirm { background: #E0564A; border-color: #E0564A; color: #fff; }

.custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.name-field {
  flex: 1 1 260px; min-width: 0; display: flex; align-items: center; height: 40px;
  border-radius: 10px; background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .2);
}
.name-field:focus-within { border-color: rgba(255, 255, 255, .5); }
.name-field { cursor: text; }
.name-field input {
  flex: 0 1 auto; field-sizing: content; min-width: 3ch; max-width: 65%;
  height: 100%; padding: 0 0 0 12px; border: 0; background: none; color: #fff; outline: none;
}
.name-field input::placeholder { color: #8FB1A8; }
.domain { flex: 1; padding-right: 12px; color: #A9C7BF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.custom .btn { height: 40px; }
.or { color: #A9C7BF; font-size: 14px; }
.error { margin: 12px 0 0; color: #FFC9C1; font-size: 14px; }

.saved { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); }
.saved-label { margin: 0 0 10px; font-size: 14px; color: #A9C7BF; }
.saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.saved-item {
  display: flex; align-items: center; overflow: hidden;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(0, 0, 0, .14);
}
.saved-item button { height: 32px; border: 0; background: none; color: #DCEBE6; cursor: pointer; }
.saved-item .pick { padding: 0 8px 0 14px; font-size: 13.5px; }
.saved-item .pick:hover:not(:disabled) { color: #fff; }
.saved-item .forget { padding: 0 12px 0 6px; color: #8FB1A8; font-size: 16px; }
.saved-item .forget:hover { color: #FFB8AD; }
.saved-item.current { background: var(--paper); border-color: var(--paper); }
.saved-item.current .pick { color: var(--glass); font-weight: 600; padding-right: 14px; cursor: default; }

/* ── inbox ──────────────────────────────────────────────── */
.inbox {
  display: grid; grid-template-columns: 330px minmax(0, 1fr);
  min-height: 500px; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
}
.list-pane { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line-soft); }
.pane-head { display: flex; align-items: baseline; gap: 10px; padding: 20px 20px 12px; }
.pane-head h2 { margin: 0; font: 600 19px/1 var(--display); letter-spacing: -0.01em; }
.count { color: var(--muted); font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; max-height: 600px; }
.item {
  position: relative; display: grid; gap: 1px;
  padding: 12px 12px; border-radius: 12px;
}
.item:hover { background: #EFF4F2; }
.item.selected { background: #E3EDE9; }
.item .open { position: absolute; inset: 0; width: 100%; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.item .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; pointer-events: none; }
.item .from { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.item .time { flex-shrink: 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.item .subject, .item .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.item .subject { font-weight: 500; }
.item .preview { color: var(--muted); font-size: 13.5px; }
.item.unread .from { color: var(--ink); font-weight: 600; }
.item.unread .subject { font-weight: 600; }

/* the code can be copied straight from the list */
.code-chip {
  position: relative; z-index: 1; justify-self: start;
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 0 4px 0 12px; height: 34px;
  border-radius: 10px; border: 1px solid #EFD9AE; background: var(--honey-soft);
  cursor: pointer; transition: background-color .15s, border-color .15s;
}
.code-digits { font: 700 16px/1 var(--display); letter-spacing: .08em; color: var(--honey-ink); font-variant-numeric: tabular-nums; }
.code-act {
  padding: 0 10px; height: 26px; display: inline-flex; align-items: center;
  border-radius: 7px; background: var(--honey); color: #fff; font-size: 12.5px; font-weight: 600;
}
.code-chip:hover { border-color: var(--honey); }
.code-chip.done { border-color: var(--glass); background: #E3EDE9; }
.code-chip.done .code-digits { display: none; }
.code-chip.done .code-act { background: var(--glass); font-size: 14px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.btn.copied, .btn.copied:hover:not(:disabled) { background: var(--glass) !important; border-color: var(--glass) !important; color: #fff; }
.dot-new { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--glass); }

.empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 36px 28px; text-align: center; }
.empty p { margin: 12px 0 0; font: 600 17px/1.2 var(--display); }
.empty span { max-width: 26ch; color: var(--muted); font-size: 14px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--glass); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(30, 74, 66, .35); } 100% { box-shadow: 0 0 0 18px rgba(30, 74, 66, 0); } }

/* ── reader ─────────────────────────────────────────────── */
.view-pane { display: flex; flex-direction: column; min-width: 0; }
.placeholder { flex: 1; display: grid; place-content: center; color: var(--muted); }
.msg-head { padding: 24px 28px 18px; border-bottom: 1px solid var(--line-soft); }
.msg-head h3 { margin: 0 0 8px; font: 600 24px/1.25 var(--display); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.msg-meta { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.msg-date { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.msg-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.back { display: none; }

.otp-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: 20px 28px 0; padding: 18px 22px;
  background: var(--honey-soft); border: 1px solid #EFD9AE; border-radius: 16px;
}
.otp-box small { display: block; margin-bottom: 2px; color: var(--honey-ink); font-size: 13.5px; }
.otp-code { font: 700 clamp(32px, 4vw, 42px)/1.1 var(--display); letter-spacing: .08em; color: var(--honey); font-variant-numeric: tabular-nums; }
.otp-box .btn.primary { background: var(--honey); border-color: var(--honey); height: 42px; padding: 0 20px; }
.otp-box .btn.primary:hover { background: var(--honey-ink); border-color: var(--honey-ink); }

.attach { margin: 14px 28px 0; color: var(--muted); font-size: 13.5px; }
.body-frame { flex: 1; width: calc(100% - 56px); min-height: 440px; margin: 20px 28px 28px; border: 1px solid var(--line-soft); border-radius: 12px; background: #fff; }
.body-text { flex: 1; margin: 20px 28px 28px; white-space: pre-wrap; overflow-wrap: anywhere; font: 15px/1.65 var(--text); }

.foot { margin: 2px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 12px;
  background: var(--ink); color: #F2F6F4; font-size: 14px;
  box-shadow: 0 12px 30px -12px rgba(22, 32, 30, .5);
}

/* ── small screens ──────────────────────────────────────── */
@media (max-width: 760px) {
  .top { padding: 16px 16px 2px; }
  .brand svg { width: 24px; height: 24px; }
  .brand span { font-size: 19px; }
  .wrap { padding: 8px 12px 32px; gap: 12px; }
  .hero { padding: 18px 16px 16px; border-radius: 18px; }
  .addr-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .address { font-size: clamp(18px, 6vw, 28px); }
  .hero .addr-row .btn.primary { width: 100%; height: 44px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .actions .btn { width: 100%; padding: 0 8px; }
  .name-field { flex-basis: 100%; }
  .custom > .btn { flex: 1; }
  .saved-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .saved-item { flex-shrink: 0; }

  .inbox { grid-template-columns: 1fr; min-height: 340px; border-radius: 16px; }
  .list-pane { border-right: 0; }
  .list { max-height: none; }
  .inbox.reading .list-pane { display: none; }
  .inbox:not(.reading) .view-pane { display: none; }
  .pane-head { padding: 16px 16px 10px; }
  .item { padding: 12px 10px; }
  .code-chip { height: 38px; }
  .back { display: inline-block; }
  .msg-head { padding: 16px 16px 14px; }
  .msg-head h3 { font-size: 20px; }
  .otp-box { margin: 14px 16px 0; padding: 14px 16px; }
  .otp-box .btn.primary { width: 100%; }
  .attach { margin: 12px 16px 0; }
  .body-frame { width: calc(100% - 32px); min-height: 360px; margin: 14px 16px 16px; }
  .body-text { margin: 14px 16px 16px; }
  .toast { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
}

/* address Copy button after copying (inside the green hero) */
.hero .btn.copied, .hero .btn.copied:hover:not(:disabled) { background: #7EE0B5 !important; border-color: #7EE0B5 !important; color: var(--glass-deep); }
