/* X (module pulse): app skin. Rules moved verbatim from styles.css (C1); the variables are the app identity, posture themes re-map the shell only. */
.module-body[data-module="pulse"] {
  --app-font: "Inter", "Open Sans", Arial, sans-serif;
  --app-accent: #1d9bf0;
  --app-bg: #000000;
  --app-surface: #16181c;
  --app-radius: 16px;
  /* C9 X: black and white with the blue accent; the module's controls read these names */
  --bg: #000000;
  --surface: #16181c;
  --border: #2f3336;
  --border-strong: #536471;
  --muted: #8b98a5; /* P9: AA on #16181c (X #71767b was 3.9:1) */
  --faint: #8b98a5;
  --brand: #1d9bf0;
  --radius: 16px;
  color: #e7e9ea;
  background: #000000;
}

/* ---------- Pulse ---------- */
.pulse-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
.pulse-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.composer-card { padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.composer-top { display: flex; gap: 10px; }
.composer-form { flex: 1; }
.composer-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  padding: 9px 10px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}
.composer-form textarea:focus { border-color: var(--border-strong); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.composer-hint { font-size: 10.5px; color: var(--faint); }

.feed { display: flex; flex-direction: column; gap: 9px; }
.post { display: flex; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.post-head strong { font-size: 12.5px; }
.post-role { font-size: 10.5px; color: var(--muted); }
.post-time { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.post-text { font-size: 13.5px; margin: 7px 0 10px; white-space: pre-wrap; }
.hashtag { color: var(--brand); font-weight: 600; }
.post-actions { display: flex; gap: 6px; }
.metric { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; font-size: 11px; color: var(--muted); border-radius: 7px; }
.metric:hover { background: var(--surface-2); color: var(--text); }
.metric.is-on { color: var(--accent); background: var(--brand-soft); }
.metric.muted { cursor: default; }
.pulse-side { display: flex; flex-direction: column; gap: 12px; }
.trend { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; font-size: 12px; }
.trend span { color: var(--brand); }
.trend small { color: var(--faint); font-family: var(--font-mono); }
.presence { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; color: var(--muted); }

@media (max-width: 1180px) {
  .pulse-layout { grid-template-columns: minmax(0, 1fr);  }
  .pulse-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));  }
}
@media (max-width: 720px) {
  .pulse-side { grid-template-columns: 1fr;  }
}
/* ---------- Pulse ---------- */
[data-module="pulse"] .pulse-main { background: #fff; border: 1px solid #eff3f4; border-radius: 8px; overflow: hidden; }
[data-module="pulse"] .feed { gap: 0; }
[data-module="pulse"] .composer-card { background: #fff; border: none; border-bottom: 1px solid #eff3f4; border-radius: 0; padding: 14px 16px; }
[data-module="pulse"] .composer-form textarea { background: #fff; border: none; padding: 4px 0; font-size: 15px; min-height: 52px; }
[data-module="pulse"] .composer-form textarea:focus { border: none; }
[data-module="pulse"] .composer-actions { border-top: 1px solid #eff3f4; padding-top: 8px; }
[data-module="pulse"] .btn-accent { background: #1d9bf0; color: #fff; border-radius: 999px; font-weight: 700; padding: 7px 16px; }
[data-module="pulse"] .btn-accent:hover { background: #1a8cd8; }
[data-module="pulse"] .post { background: #fff; border: none; border-bottom: 1px solid #eff3f4; border-radius: 0; padding: 14px 16px; }
[data-module="pulse"] .post:last-child { border-bottom: none; }
[data-module="pulse"] .hashtag { color: #1d9bf0; }
[data-module="pulse"] .post-role, [data-module="pulse"] .metric { color: #8b98a5; }
[data-module="pulse"] .metric:hover { background: #f7f9f9; }
[data-module="pulse"] .metric.is-on { color: #1d9bf0; background: #e8f5fe; }
[data-module="pulse"] .pulse-side .side-card { border-color: #eff3f4; }
[data-module="pulse"] .trend span { color: #1d9bf0; }

/* ---------- X ---------- */
.x-tabs { display: flex; border-bottom: 1px solid #eff3f4; background: #fff; border-radius: 8px 8px 0 0; overflow: hidden; }
.x-tab { flex: 1; padding: 13px 8px; font-size: 12.5px; color: #8b98a5; border-bottom: 2px solid transparent; }
.x-tab:hover { background: #f7f9f9; }
.x-tab.is-active { color: #0f1419; font-weight: 700; border-bottom-color: #1d9bf0; }
.x-search { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #eff3f4; }
.x-search input { flex: 1; padding: 8px 12px; font-size: 13px; background: #f7f9f9; border: 1px solid transparent; border-radius: 999px; outline: none; }
.x-search input:focus { background: #fff; border-color: #1d9bf0; }
.x-filter-bar { padding: 9px 14px; font-size: 12px; color: #8b98a5; background: #f7f9f9; border-bottom: 1px solid #eff3f4; }
.post-author { font-size: 12.5px; font-weight: 700; color: #0f1419; }
.post-author:hover { text-decoration: underline; }
.post-replies { margin: 8px 0 10px 6px; padding-left: 12px; border-left: 2px solid #eff3f4; display: flex; flex-direction: column; gap: 8px; }
.post-reply { display: flex; gap: 8px; }
.post-reply strong { font-size: 11.5px; }
.post-reply small { font-size: 9.5px; color: #8b98a5; margin-left: 4px; }
.post-reply p { font-size: 12.5px; margin-top: 2px; }
.reply-context { font-size: 11px; color: #8b98a5; margin-bottom: 6px; }
.reply-context strong { color: #1d9bf0; }
.composer-tools { display: flex; align-items: center; gap: 6px; }
.char-count { font-size: 10.5px; color: #8b98a5; font-family: var(--font-mono); }
.pulse-post-btn:disabled { opacity: 0.45; }
.trend { width: 100%; text-align: left; }
.pulse-profile-backdrop { align-items: flex-start; padding-top: 8vh; }
.pulse-profile { width: min(600px, 94vw); max-height: 84vh; overflow: auto; background: #fff; border-radius: 14px; overflow-x: hidden; }
.pulse-profile-cover { height: 130px; background: linear-gradient(135deg, var(--avatar), #1d9bf0 70%); }
.pulse-profile-body { padding: 0 18px 18px; }
.pulse-profile-top { display: flex; align-items: flex-end; justify-content: space-between; margin-top: -30px; }
.avatar.large { width: 76px; height: 76px; font-size: 20px; border: 4px solid #fff; }
.pulse-profile-actions { display: flex; align-items: center; gap: 6px; padding-bottom: 4px; }

.pulse-profile-body h2 { font-size: 20px; margin-top: 8px; }
.pulse-handle { font-size: 12px; color: #8b98a5; }
.pulse-bio { font-size: 13px; color: #0f1419; margin-top: 8px; }
.pulse-stats { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: #8b98a5; }
.pulse-stats strong { color: #0f1419; }
.pulse-profile-posts { margin-top: 14px; border-top: 1px solid #eff3f4; }
.profile-post { padding: 10px 0; border-bottom: 1px solid #eff3f4; }
.profile-post p { font-size: 12.5px; margin-top: 2px; }
.x-notifications, .x-messages { background: #fff; border-radius: 8px; overflow: hidden; }
.x-notification { display: flex; gap: 10px; padding: 13px 14px; border-bottom: 1px solid #eff3f4; }
.x-notification p { font-size: 12.5px; }
.x-notification small { font-size: 10px; color: #8b98a5; }
.x-inject-icon { width: 30px; height: 30px; display: grid; place-items: center; background: #e8f5fe; color: #1d9bf0; border-radius: 50%; flex: none; }
.x-messages-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid #eff3f4; }
.x-messages-head h2 { font-size: 16px; }
.x-dm { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; border-bottom: 1px solid #eff3f4; }
.x-dm:hover { background: #f7f9f9; }
.x-dm-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.x-dm-copy strong { font-size: 12.5px; }
.x-dm-copy small { font-size: 11px; color: #8b98a5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-dm-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.x-dm-unread { background: #1d9bf0; color: #fff; font-size: 9.5px; border-radius: 999px; padding: 1px 5px; }

/* ---------- C9 X (pulse): three columns, timeline cards, thread, profile, notifications, phone ---------- */
.module-body[data-module="pulse"] .x-layout { display: grid; grid-template-columns: 240px minmax(0, 600px) 330px; justify-content: center; min-height: 100%; }
.module-body[data-module="pulse"] .x-nav { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; height: 100vh; box-sizing: border-box; }
.x-nav-item { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 999px; background: none; border: 0; color: #e7e9ea; font: inherit; font-size: 19px; text-align: left; cursor: pointer; }
.x-nav-item:hover { background: #16181c; }
.x-nav-item.is-active { font-weight: 700; }
.x-post-nav { margin-top: 14px; border-radius: 999px; padding: 13px 0; font-weight: 700; justify-content: center; }
.module-body[data-module="pulse"] .x-center { border-left: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 0; }
.x-feed-tabs { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, 0.85); border-bottom: 1px solid var(--border); }
.x-feed-tab, .x-profile-tab { padding: 16px 0; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.x-feed-tab.is-active, .x-profile-tab.is-active { color: #e7e9ea; box-shadow: inset 0 -4px 0 var(--brand); }
.module-body[data-module="pulse"] .x-composer { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.x-composer-avatar { flex: 0 0 auto; }
.x-composer .composer-form textarea { background: transparent; border: 0; font-size: 19px; color: #e7e9ea; resize: none; }
.x-quote-draft { margin-top: 8px; }
.x-post { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.x-post-compact { padding: 10px 16px; }
.x-post-avatar { flex: 0 0 auto; }
.x-post .post-head { align-items: center; gap: 4px; font-size: 15px; }
.x-post .post-author, .x-post .post-time, .x-reply .post-author { background: none; border: 0; padding: 0; color: #e7e9ea; font-weight: 700; font: inherit; cursor: pointer; }
.x-post .post-time { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 0; }
.post-handle, .post-dot { color: var(--muted); font-size: 15px; }
.x-post .post-text { font-size: 15px; line-height: 1.4; margin: 2px 0 10px; }
.x-open { cursor: pointer; }
.mention { color: var(--brand); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.x-actions { justify-content: space-between; max-width: 425px; margin-top: 6px; }
.x-actions .metric { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.x-actions .metric:hover { color: var(--brand); }
.x-actions .metric.is-on { color: #f91880; }
.x-actions .metric[data-action="pulse-repost"].is-on { color: #00ba7c; }
.x-actions .metric[data-action="pulse-bookmark"].is-on { color: var(--brand); }
.x-views { cursor: default; }
.x-media { display: grid; gap: 2px; margin: 4px 0 10px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.x-file { display: flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; margin: 4px 0 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.x-file:hover { background: rgba(127, 127, 127, 0.08); }
.x-file .icon { flex: none; }
.x-media-2 { grid-template-columns: 1fr 1fr; }
.x-media-3 { grid-template-columns: 1fr 1fr; }
.x-media-3 .x-media-item:first-child { grid-row: span 2; }
.x-media-4 { grid-template-columns: 1fr 1fr; }
.x-media-item { display: block; width: 100%; max-height: 300px; object-fit: cover; background: #202327; }
.x-quote { margin: 4px 0 10px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; cursor: pointer; }
.x-quote .post-text { margin: 4px 0 6px; font-size: 14px; }
.x-quote-missing { color: var(--muted); font-size: 14px; cursor: default; }
.x-thread-head { display: flex; align-items: center; gap: 18px; padding: 8px 16px; position: sticky; top: 0; z-index: 1; background: rgba(0, 0, 0, 0.85); border-bottom: 1px solid var(--border); }
.x-thread-head h2 { margin: 0; font-size: 19px; }
.x-thread-head small { color: var(--muted); }
.x-thread-parent { border-left: 2px solid var(--border); margin-left: 40px; }
.x-thread-parent .x-post { border-bottom: 0; }
.x-thread-replies { margin-left: 40px; border-left: 2px solid var(--border); }
.x-reply { display: flex; gap: 12px; padding: 12px 16px 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.x-reply .post-text { margin: 2px 0 6px; font-size: 14px; }
.x-show-replies { display: block; width: 100%; padding: 14px; background: none; border: 0; color: var(--brand); font: inherit; text-align: left; cursor: pointer; }
.x-reply-prompt { display: block; width: 100%; padding: 14px 16px; background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.x-notifications { display: flex; flex-direction: column; }
.x-notification { display: flex; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; color: #e7e9ea; font: inherit; text-align: left; width: 100%; cursor: pointer; }
.x-notification p { margin: 2px 0; font-size: 15px; }
.x-notif-icon { color: var(--muted); flex: 0 0 auto; }
.x-notification-like .x-notif-icon { color: #f91880; }
.x-notification-repost .x-notif-icon { color: #00ba7c; }
.x-notif-text { color: var(--muted); font-size: 14px; margin: 0; }
.x-profile-banner { height: 160px; background: linear-gradient(135deg, var(--avatar, #1d9bf0), #16181c); }
.x-profile-top { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 16px; margin-top: -54px; }
.x-profile-avatar { border: 4px solid #000; border-radius: 50%; background: #000; display: inline-flex; }
.x-profile-name { margin: 10px 16px 0; font-size: 20px; }
.x-profile-meta { margin: 6px 16px 0; color: var(--muted); font-size: 14px; }
.x-profile .pulse-stats, .x-profile .pulse-handle, .x-profile .pulse-bio { margin-left: 16px; margin-right: 16px; }
.x-profile-tabs { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px; border-bottom: 1px solid var(--border); }
.x-profile-body .x-post:first-child { border-top: 0; }
.x-right { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 14px; padding: 8px 16px; height: 100vh; box-sizing: border-box; overflow: auto; }
.x-search-side { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 999px; background: #202327; color: var(--muted); }
.x-search-side input { flex: 1; min-width: 0; background: none; border: 0; color: #e7e9ea; font: inherit; outline: none; }
.x-card { padding: 12px 16px; border-radius: 16px; background: #16181c; }
.x-card h3 { margin: 0 0 8px; font-size: 19px; }
.x-follow-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.x-follow-row .post-author { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #e7e9ea; font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.x-follow-row small { display: block; color: var(--muted); font-weight: 400; }
.x-note { color: var(--muted); font-size: 12px; padding: 0 4px; }
.x-messages .x-dm { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; color: #e7e9ea; font: inherit; text-align: left; cursor: pointer; }
@media (max-width: 1100px) {
  .module-body[data-module="pulse"] .x-layout { grid-template-columns: 88px minmax(0, 1fr) 0; }
  .x-right { display: none; }
  .x-nav-item span { display: none; }
}
@media (max-width: 760px) {
  .module-body[data-module="pulse"] .x-layout { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .module-body[data-module="pulse"] .x-center { order: 1; border: 0; }
  .module-body[data-module="pulse"] .x-nav { order: 2; position: sticky; bottom: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px; background: #000; border-top: 1px solid var(--border); z-index: 2; }
  .x-nav-item { padding: 8px; }
  .x-nav-item span { display: none; }
  .x-post-nav span { display: inline; }
  .x-post-nav { margin-top: 0; padding: 8px 12px; }
  .x-thread-replies, .x-thread-parent { margin-left: 24px; }
  .x-right { display: none; }
  .x-actions { max-width: 100%; }
  .x-post, .x-reply, .x-composer { padding-left: 12px; padding-right: 12px; }
}


/* C9 X is dark: the C1 light surfaces above (#fff, #eff3f4 lines, #0f1419 ink) must not stay white under its light
   text (demo-shots: names and post text were near-invisible on the feed and notifications) */
.module-body[data-module="pulse"] .pulse-main,
.module-body[data-module="pulse"] .post,
.module-body[data-module="pulse"] .composer-card,
.module-body[data-module="pulse"] .composer-form textarea,
.module-body[data-module="pulse"] .x-tabs,
.module-body[data-module="pulse"] .x-search,
.module-body[data-module="pulse"] .x-filter-bar,
.module-body[data-module="pulse"] .x-notifications,
.module-body[data-module="pulse"] .x-messages,
.pulse-profile { background: #000; border-color: var(--border, #2f3336); color: #e7e9ea; }
.module-body[data-module="pulse"] .post-author, .module-body[data-module="pulse"] .x-tab.is-active, .pulse-profile .post-author { color: #e7e9ea; }
.module-body[data-module="pulse"] .post-role, .module-body[data-module="pulse"] .metric, .module-body[data-module="pulse"] .x-tab { color: #8b98a5; }

/* --- T1 fidelity: native X details ---------------------------------------------------------------------------- */
[data-module="pulse"] .trend { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 10px 2px; border: 0; background: none; cursor: pointer; }
[data-module="pulse"] .trend:hover { background: rgba(231, 233, 234, 0.04); }
[data-module="pulse"] .trend span { color: #e7e9ea; font-weight: 700; font-size: 15px; }
[data-module="pulse"] .trend small { color: #8b98a5; font-family: inherit; font-size: 13px; }
.x-note-block { margin: 10px 0 4px; border: 1px solid #2f3336; border-radius: 16px; padding: 12px 14px; font-size: 14px; color: #e7e9ea; }
.x-note-head { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.x-note-block p { margin: 0 0 6px; line-height: 1.35; }
.x-note-block small { color: #8b98a5; display: block; }
.x-note-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid #2f3336; color: #8b98a5; font-size: 13px; }
.x-note-rate { border: 1px solid #536471; border-radius: 999px; background: transparent; padding: 4px 14px; font-weight: 700; color: #e7e9ea; cursor: pointer; }
.x-tools { display: flex; align-items: center; gap: 2px; color: #1d9bf0; flex-wrap: wrap; }
.x-tool { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 0; background: none; color: #1d9bf0; cursor: pointer; overflow: hidden; }
.x-tool:hover { background: rgba(29, 155, 240, 0.1); }
.x-gif { border: 1.5px solid currentColor; border-radius: 3px; font-size: 9px; font-weight: 800; padding: 0 2px; line-height: 13px; }
.x-upload { overflow: visible; }
.x-upload .upload-widget { position: absolute; inset: 0; }
.x-upload .upload-pick { position: absolute; inset: 0; opacity: 0; font-size: 0; padding: 0; border: 0; cursor: pointer; }
.x-upload .upload-bar { position: absolute; top: 36px; left: 0; width: 120px; }
.x-upload .upload-status { position: absolute; top: 36px; left: 0; white-space: nowrap; font-size: 12px; color: #8b98a5; }
.x-quote-avatar { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; vertical-align: middle; }
[data-module="pulse"] .post-head .verified-mark, [data-module="pulse"] .post-author .verified-mark { margin-left: 2px; vertical-align: -3px; }
[data-module="pulse"] .x-actions .metric span:empty { display: none; }
.x-show-more { display: block; width: 100%; padding: 16px; border: 0; border-bottom: 1px solid #2f3336; background: none; color: #1d9bf0; font-size: 15px; text-align: center; cursor: pointer; }
.x-show-more:hover { background: rgba(231, 233, 234, 0.03); }

/* P9 contrast (both schemes, X is dark in both): text below AA on X's black. Profile ink was the C1 light #0f1419; the
   Post / Follow pills are light with dark ink as in X's own dark mode (white on #1d9bf0 is 3:1). */
.module-body[data-module="pulse"] .pulse-bio, .module-body[data-module="pulse"] .pulse-stats strong, .module-body[data-module="pulse"] .x-tab.is-active { color: #e7e9ea; }
.module-body[data-module="pulse"] :is(.pulse-handle, .pulse-stats, .post-time, .empty-note, .char-count, .reply-context, .x-filter-bar) { color: #8b98a5; }
[data-module="pulse"] .btn-accent, .module-body[data-module="pulse"] .x-post-nav { background: #eff3f4; color: #0f1419; }
[data-module="pulse"] .btn-accent:hover, .module-body[data-module="pulse"] .x-post-nav:hover { background: #d7dbdc; }
.x-dm-unread { color: #0f1419; }
