/* X Monitor UI — compact account rail, not a wall of pills */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  line-height: 1.5;
  color: #111318;
  background: #f2f2f0;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 18px;
}
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #d9dadb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}
.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #0f1419;
}
.brand .sub {
  margin: 1px 0 0;
  font-size: 13px;
  color: #536471;
}
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn {
  font: inherit;
  font-size: 14px;
  border: 1px solid #0f1419;
  background: #0f1419;
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.btn.secondary {
  background: #fff;
  color: #0f1419;
  border-color: #cfd9de;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.rail-toggle { display: none; }
.status {
  font-size: 13px;
  color: #536471;
  min-height: 1.2em;
  max-width: 240px;
}
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: start;
  padding-top: 16px;
}
.rail {
  position: sticky;
  top: 68px;
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 88px);
  min-height: 240px;
}
.rail-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid #eef1f3;
}
.rail-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #536471;
  text-transform: uppercase;
}
.rail-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.all-item {
  margin: 6px 6px 0;
  width: calc(100% - 12px);
  flex: 0 0 auto;
}
.rail-head input,
.add-handle input {
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  border: 1px solid #cfd9de;
  background: #fff;
  padding: 7px 9px;
  border-radius: 6px;
}
.rail-head input:focus,
.add-handle input:focus {
  outline: 2px solid #0f1419;
  outline-offset: 1px;
}
.handle-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
}
.handle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 5px;
  font: inherit;
  font-size: 13.5px;
  color: #0f1419;
  cursor: pointer;
}
.handle-item:hover { background: #f2f4f6; }
.handle-item.active {
  background: #0f1419;
  color: #fff;
}
.handle-item.active:hover { background: #0f1419; }
.handle-item .meta {
  font-size: 11.5px;
  color: #8a9aa6;
  font-variant-numeric: tabular-nums;
}
.handle-item.active .meta { color: #c5ccd2; }
.handle-empty {
  padding: 14px 8px;
  font-size: 13px;
  color: #536471;
  text-align: center;
}
.add-handle {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 10px 10px;
  border-top: 1px solid #eef1f3;
}
.add-handle input { flex: 1 1 auto; }
.add-handle .btn { flex: 0 0 auto; padding: 7px 10px; }
.trending {
  position: sticky;
  top: 68px;
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 10px 12px 10px;
  max-height: calc(100vh - 88px);
  overflow: auto;
}
.trending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trending-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #536471;
}
.trending-sub {
  margin: 2px 0 8px;
  font-size: 12.5px;
  color: #8a9aa6;
}
.window-toggle {
  display: flex;
  gap: 4px;
}
.window-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cfd9de;
  background: #fff;
  color: #0f1419;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.window-btn.active {
  background: #0f1419;
  color: #fff;
  border-color: #0f1419;
}
.trending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trend-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 5px;
  padding: 5px 6px;
  font: inherit;
  font-size: 13px;
  color: #0f1419;
  cursor: pointer;
}
.trend-item:hover { background: #f2f4f6; }
.trend-item.active {
  background: #0f1419;
  color: #fff;
}
.trend-item .n {
  font-size: 12px;
  color: #536471;
  font-variant-numeric: tabular-nums;
}
.trend-item.active .n { color: #c5ccd2; }
.trending-empty {
  margin: 0;
  font-size: 13px;
  color: #536471;
}
.feed-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 10px;
}
.feed-toolbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f1419;
}
#countInfo {
  font-size: 13px;
  color: #536471;
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tweet {
  display: flex;
  gap: 12px;
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 12px 14px;
}
.tweet:hover { border-color: #c8d3db; }
.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #e7ecef;
  border: 1px solid #e1e8ed;
}
.tweet-body { flex: 1 1 auto; min-width: 0; }
.tweet-head {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.display-name {
  font-weight: 700;
  font-size: 14.5px;
  color: #0f1419;
  text-decoration: none;
}
.display-name:hover { text-decoration: underline; }
.username {
  font-size: 14px;
  color: #536471;
  text-decoration: none;
}
.username:hover { text-decoration: underline; }
.dot { color: #8a9aa6; }
.time {
  font-size: 13.5px;
  color: #536471;
  text-decoration: none;
}
.time:hover { text-decoration: underline; }
.pinned-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #5b6b7a;
  background: #f0f3f5;
  border: 1px solid #e1e8ed;
  padding: 1px 6px;
  border-radius: 4px;
}
.tweet-text {
  margin: 4px 0 8px;
  font-size: 15px;
  line-height: 1.45;
  color: #0f1419;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.tweet-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.action-link {
  font-size: 13.5px;
  color: #1d9bf0;
  text-decoration: none;
  font-weight: 600;
}
.action-link:hover { text-decoration: underline; }
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0 10px;
}
.foot {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: #536471;
  padding: 10px 18px 22px;
  border-top: 1px solid #e1e8ed;
  margin-top: 14px;
}
.foot code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  background: #eef2f5;
  padding: 1px 5px;
  border-radius: 4px;
}
.empty {
  text-align: center;
  padding: 30px 14px;
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  color: #536471;
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr) 210px; }
}
@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }
  .trending {
    position: static;
    max-height: none;
    order: 3;
  }
  .rail-toggle { display: inline-flex; }
  .rail {
    display: none;
    position: fixed;
    top: 62px;
    left: 12px;
    right: 12px;
    max-height: min(70vh, 520px);
    z-index: 20;
    box-shadow: 0 10px 28px rgba(15, 20, 25, 0.14);
  }
  .rail.open { display: flex; }
  .brand .sub { display: none; }
  .tweet { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
