.ms-inbox-layout {
  --inbox-paper: var(--dashboard-paper, #fdfef9);
  --inbox-ink: var(--dashboard-ink, #152b31);
  --inbox-muted: var(--dashboard-muted, #536763);
  --inbox-line: var(--dashboard-line, #d8dfd4);
  --inbox-accent: var(--dashboard-accent, #1b5c53);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.85fr);
  gap: 16px;
  align-items: start;
  color: var(--inbox-ink);
}

.ms-inbox,
.ms-reader {
  min-width: 0;
  border: 1px solid var(--inbox-line);
  border-radius: 14px;
  background: var(--inbox-paper);
}

.ms-inbox-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 16px;
  border-bottom: 1px solid var(--inbox-line);
}

.ms-inbox-head h2,
.ms-reader h2 { margin: 0; line-height: 1.25; letter-spacing: -.02em; }
.ms-inbox-head h2 { font-size: 1.07rem; }
.ms-inbox-head .ms-count { margin: 0; color: var(--inbox-muted); font-size: .8rem; }
.ms-inbox-head :is(.ms-search, .tr-periods) { grid-column: 1 / -1; min-width: 0; }
.ms-inbox-head .tr-periods { width: fit-content; max-width: 100%; flex-wrap: wrap; border-radius: 9px; }
.ms-inbox-head .tr-periods button { min-height: 44px; padding-inline: 8px; border-radius: 6px; white-space: normal; }
.ms-inbox-head .tr-periods button[aria-pressed="true"] { background: var(--inbox-accent); color: white; }
.ms-inbox-head .n { margin-left: 3px; font-variant-numeric: tabular-nums; }

.ms-inbox-list {
  display: grid;
  max-height: clamp(220px, 53vh, 600px);
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #a3b6af transparent;
  margin: 0;
  padding: 4px;
  list-style: none;
}

.ms-inbox-list > li + li { border-top: 1px solid var(--inbox-line); }

.ms-inbox-row {
  display: grid;
  width: 100%;
  min-height: 62px;
  gap: 4px;
  padding: 11px 12px;
  border: 0;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  text-align: start;
  font: inherit;
  cursor: pointer;
}

.ms-inbox-row:hover { background: #edf2eb; }
.ms-inbox-row[aria-pressed="true"] { background: #deece2; }
.ms-inbox-row:focus-visible { outline: 2px solid var(--inbox-accent); outline-offset: -2px; }
.ms-inbox-row-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; align-items: baseline; }
.ms-inbox-row-top strong { overflow-wrap: anywhere; font-weight: 620; }
.ms-inbox-row.unread .ms-inbox-row-top strong { font-weight: 800; }
.ms-inbox-row.unread .ms-inbox-row-top strong::before {
  display: inline-block;
  width: .48em;
  height: .48em;
  margin-inline-end: .42em;
  vertical-align: .13em;
  border-radius: 50%;
  background: var(--inbox-accent);
  content: '';
}

.ms-inbox-row-date { flex: none; font-size: .75rem; }
.ms-inbox-row-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.ms-inbox-row-date, .ms-inbox-row-preview, .ms-inbox-state { color: var(--inbox-muted); }
.ms-inbox-state { padding: 14px; }
.ms-inbox-state button { padding: 4px; min-height: 44px; }

.ms-reader { min-height: 245px; }
.ms-reader h2 { font-size: clamp(1.2rem, 2.6vw, 1.65rem); overflow-wrap: anywhere; }
.ms-reader h2:focus { outline: 2px solid var(--inbox-accent); outline-offset: 4px; }
.ms-reader-head { display: grid; gap: 5px; border-bottom: 1px solid var(--inbox-line); }
.ms-reader-head p, .ms-reader-empty p { margin: 0; color: var(--inbox-muted); overflow-wrap: anywhere; }
.ms-reader-head a { color: var(--inbox-accent); text-decoration: underline; }
.ms-reader-head .ms-tags { margin-top: 6px; }
.ms-reader-head, .ms-reader-content, .ms-reader-empty { padding: clamp(16px, 2.8vw, 26px); }
.ms-reader-text { max-width: 72ch; margin: 0 0 20px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.ms-reader-empty p { margin-top: 7px; }
.ms-reader-content .ms-actions .btn { min-height: 44px; }
.ms-reader-content .ms-actions .primary { background: var(--inbox-accent); }
.ms-subscribe-slot:empty { display: none; }

@media (max-width: 700px) {
  .ms-inbox-layout { grid-template-columns: minmax(0, 1fr); }
  .ms-inbox-list { max-height: 16rem; }
  .ms-reader { min-height: 140px; }
  .ms-reader h2 { scroll-margin-top: 22px; }
}
