:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf6f5;
  --text: #141b24;
  --muted: #667085;
  --line: #d7dee8;
  --line-strong: #c3ccd8;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --accent-3: #f2b84b;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(32, 44, 60, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}

button.primary:hover {
  background: #115e59;
}

.app {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-width: 1440px;
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #162330;
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent-3);
  color: #15202b;
  font-weight: 900;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.panel-header h2,
.empty-reader h2,
.message-head h2,
.message-head p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.15;
}

.brand p {
  margin-top: 3px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38d196;
}

.status-pill strong {
  font-size: 13px;
}

.address-strip {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.address-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.address-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.address-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.address-composer input {
  min-width: 0;
  min-height: 42px;
  border: 0;
  outline: 0;
  padding: 0 13px;
  background: transparent;
  color: var(--text);
}

.address-composer span {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  border-left: 1px solid var(--line);
  padding: 0 13px;
  background: #f2f5f8;
  color: #405063;
  font-weight: 700;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.tab {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab:hover,
.tab.active {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--accent);
  box-shadow: none;
}

.mail-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: 0;
}

.mail-list-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.panel-header {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-header h2 {
  font-size: 17px;
}

.mail-list {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 203px);
  min-height: 360px;
  overflow: auto;
}

.mail-item {
  display: grid;
  width: 100%;
  min-height: 92px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 15px 18px;
  text-align: left;
}

.mail-item:hover,
.mail-item.active {
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--accent);
}

.mail-item:hover {
  background: #fbfcfe;
}

.mail-item.active {
  background: var(--surface-3);
}

.mail-subject {
  display: block;
  margin-bottom: 7px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-from,
.mail-date {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-date {
  margin-top: 5px;
}

.reader {
  min-width: 0;
  background: var(--surface);
}

.empty-reader,
.message-reader {
  padding: 28px;
}

.empty-reader {
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin-bottom: 16px;
  border: 1px solid #b8dfd9;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--accent);
  font-size: 33px;
}

.empty-reader h2 {
  color: #344054;
  font-size: 22px;
}

.message-reader.hidden,
.empty-reader.hidden,
.mail-shell.hidden,
.api-view.hidden {
  display: none;
}

.message-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.message-head h2 {
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1.25;
}

.message-head p {
  margin-top: 7px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 14px;
}

#messageBody {
  margin: 0;
  padding: 22px 0 0;
  color: #202b37;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.empty-list,
.error-list {
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

.error-list {
  color: var(--danger);
}

.api-view {
  height: calc(100vh - 253px);
  min-height: 520px;
  overflow: auto;
  padding: 24px;
  background: var(--surface-2);
}

.api-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.api-header h2,
.api-header p,
.api-card p,
.api-flow h3 {
  margin: 0;
}

.api-header h2 {
  font-size: 24px;
}

.api-header p,
.api-card p {
  margin-top: 5px;
  color: var(--muted);
}

.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.api-card,
.api-flow {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.method-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.method-row code {
  overflow: hidden;
  color: #273548;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 28px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.method.get {
  background: var(--accent-2);
}

.method.post {
  background: var(--accent);
}

.method.delete {
  background: var(--danger);
}

.api-card pre {
  overflow: auto;
  margin: 14px 0 0;
  border: 1px solid #233247;
  border-radius: 8px;
  background: #111827;
  color: #e5edf7;
  padding: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.api-card code,
.api-flow code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
}

.api-flow {
  margin-top: 16px;
}

.api-flow h3 {
  font-size: 18px;
}

.api-flow ol {
  margin: 12px 0 0;
  padding-left: 22px;
  color: #273548;
  line-height: 1.8;
}

@media (max-width: 980px) {
  .app {
    padding: 10px;
  }

  .workspace {
    min-height: calc(100vh - 20px);
  }

  .address-strip {
    grid-template-columns: 1fr;
  }

  .mail-shell {
    grid-template-columns: 1fr;
  }

  .mail-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mail-list {
    height: 320px;
    min-height: 260px;
  }

  .api-view {
    height: auto;
    min-height: 520px;
  }

  .api-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .status-pill {
    display: none;
  }

  .address-composer {
    grid-template-columns: 1fr;
  }

  .address-composer span {
    min-height: 36px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .tabs {
    padding: 8px 14px;
  }

  .empty-reader,
  .message-reader,
  .api-view {
    padding: 18px;
  }

  .api-header {
    flex-direction: column;
  }

  .message-head {
    flex-direction: column;
  }
}
