:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1117;
  color: #edf2f7;
  --surface: #151b23;
  --surface-strong: #10161d;
  --line: #2c3744;
  --muted: #9eabb9;
  --accent: #2aa7df;
  --accent-soft: #113347;
  --danger: #ff7777;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #0d1117; }
button, input { font: inherit; }
button {
  min-height: 38px; padding: 0 14px; border: 1px solid #46586b; border-radius: 6px;
  color: #edf2f7; background: #1a2430; cursor: pointer;
}
button:hover, button:focus-visible { border-color: var(--accent); outline: none; }
button:disabled { opacity: .5; cursor: wait; }
button.danger { color: #ffc0c0; border-color: #78434b; background: #27181b; }
input {
  width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #46586b;
  border-radius: 6px; color: #edf2f7; background: #0b1016;
}
input:focus { border-color: var(--accent); outline: 2px solid rgb(42 167 223 / 22%); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 84px; padding: 17px 28px; border-bottom: 1px solid var(--line); background: #111720;
}
.brand { margin: 0 0 3px; color: var(--accent); font-size: 12px; font-weight: 760; letter-spacing: 0; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0; font-size: 18px; }
.session-actions { display: flex; align-items: center; gap: 9px; }
.session-account { max-width: 240px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
main { width: min(1180px, 100%); margin: 0 auto; padding: 26px 28px 48px; }
.login-view { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.login-form {
  width: min(400px, 100%); display: grid; gap: 12px; padding: 22px;
  border: 1px solid var(--line); background: var(--surface);
}
.login-form h2 { margin-bottom: 8px; }
.login-form label { color: var(--muted); font-size: 13px; font-weight: 650; }
.login-form button { margin-top: 4px; color: #041018; border-color: var(--accent); background: var(--accent); font-weight: 720; }
.inbox-view { display: grid; gap: 18px; }
.inbox-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-label { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 720; text-transform: uppercase; }
.last-updated { color: var(--muted); font-size: 12px; }
.inbox-layout { display: grid; grid-template-columns: minmax(310px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.message-list-region { min-width: 0; }
.message-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.message-item { min-width: 0; }
.message-button {
  width: 100%; min-height: 92px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px;
  padding: 13px 14px; text-align: left; border-color: var(--line); background: var(--surface);
}
.message-button.selected { border-color: var(--accent); background: var(--accent-soft); }
.message-button.unread .caller { color: #fff; font-weight: 760; }
.caller { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 630; }
.time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.summary { grid-column: 1 / -1; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.unread-mark { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: var(--accent); }
.empty-state { min-height: 180px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.message-detail { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.detail-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); background: var(--surface-strong); }
.detail-caller { margin: 0 0 5px; font-size: 17px; font-weight: 720; overflow-wrap: anywhere; }
.detail-time { margin: 0; color: var(--muted); font-size: 12px; }
.detail-meta { display: flex; gap: 8px; padding: 14px 18px 0; }
.detail-meta span { padding: 4px 7px; border-radius: 4px; color: #d5e2ec; background: #24313d; font-size: 11px; text-transform: capitalize; }
.message-text { min-height: 180px; margin: 0; padding: 22px 18px 28px; color: #f3f6f9; font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
#status {
  position: fixed; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px));
  padding: 10px 13px; border: 1px solid #456276; border-radius: 6px; color: #eaf5fc;
  background: #172734; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 140ms ease;
}
#status.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 780px) {
  .topbar { padding: 15px 17px; }
  .session-account { display: none; }
  main { padding: 20px 16px 36px; }
  .inbox-layout { grid-template-columns: 1fr; }
  .message-detail { min-height: 260px; }
}

@media (max-width: 520px) {
  .topbar { align-items: start; }
  h1 { font-size: 21px; }
  .session-actions { flex-wrap: wrap; justify-content: flex-end; }
  .inbox-head { align-items: start; flex-direction: column; }
  .detail-head { align-items: stretch; flex-direction: column; }
  .detail-head button { width: 100%; }
}
