:root {
  color-scheme: light;
  --ink: #17342f;
  --muted: #71827d;
  --paper: #f4f6f1;
  --card: #ffffff;
  --green: #155d4d;
  --green-dark: #123b35;
  --line: #e5ebe5;
  --gold: #c58b35;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(26px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
}

.topbar, .section-heading, .inbox-heading { display: flex; align-items: center; }
.topbar { gap: 13px; margin-bottom: 30px; }
.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 17px 17px 17px 6px;
  background: var(--green-dark);
  color: #f8f4e8;
  font-size: 24px;
  font-weight: 700;
}
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 20px; letter-spacing: .02em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.02em; }
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--green-dark);
  font-size: 25px;
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 23px 22px;
  border-radius: 22px;
  background: var(--green-dark);
  color: #f8f5ec;
}
.intro h2 { margin-bottom: 7px; font-size: 21px; }
.intro p { margin: 0; color: #cad8d0; font-size: 13px; }
.status-dot { width: 11px; height: 11px; border-radius: 99px; background: #71827d; box-shadow: 0 0 0 5px #ffffff18; }
.status-dot.connected { background: #9dc76a; }

.setup-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 8px 28px #1b40350a;
}
.section-heading { justify-content: space-between; margin-bottom: 18px; }
.lock-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; background: #edf3ee; color: var(--green); font-size: 22px; }
label { display: block; margin-bottom: 8px; color: #566a64; font-size: 12px; font-weight: 650; }
.token-row { display: flex; gap: 8px; }
input {
  min-width: 0;
  flex: 1;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 13px;
}
input:focus { border-color: #79a595; box-shadow: 0 0 0 3px #155d4d15; }
.button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; font-size: 13px; font-weight: 700; }
.button.secondary { background: #eef3ef; color: var(--green); }
.button.primary { width: 100%; margin-top: 13px; background: var(--green); color: white; }
.help { margin: 11px 1px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.feedback { min-height: 16px; margin: 8px 1px 0; color: var(--green); font-size: 11px; }
.feedback.error { color: #a34837; }

.inbox-heading { justify-content: space-between; margin: 29px 2px 13px; }
.text-button { padding: 8px 4px; border: 0; background: transparent; color: #8a5d42; font-size: 12px; }
.messages { display: grid; gap: 9px; }
.message-card { padding: 16px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.message-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sender { overflow: hidden; color: var(--green-dark); font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.time { flex: none; color: #91a09a; font-size: 10px; }
.message-body { margin: 0; color: #354d46; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty-state { display: grid; justify-items: center; padding: 37px 22px 34px; border: 1px dashed #d7e0d8; border-radius: 18px; text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; margin-bottom: 12px; place-items: center; border-radius: 16px; background: #e9f0e9; color: var(--green); font-size: 24px; }
.empty-state h3 { margin-bottom: 7px; font-size: 14px; }
.empty-state p { max-width: 230px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
footer { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 24px 0 4px; color: #87948e; font-size: 10px; }
.footer-lock { color: #729384; font-size: 8px; }

@media (min-width: 640px) {
  .shell { padding-top: 42px; }
}
