:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #d9dee5;
  --text: #111827;
  --muted: #667085;
  --accent: #0f766e;
  --danger: #b42318;
  --warn: #b54708;
  --soft: #f9fafb;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

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

.dashboard-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: #98a2b3;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.topbar {
  flex: 0 0 auto;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand,
.primary-nav,
.topbar-actions,
.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  min-width: 0;
}

.primary-nav {
  min-width: 0;
}

.topbar-actions {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-cluster {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.feed-cluster,
.app-account-cluster {
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.topbar .nav-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 10px;
  color: #344054;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.topbar .nav-link:hover {
  background: var(--soft);
  color: var(--text);
}

.topbar .nav-link-active {
  background: #eef2f6;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.cluster-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.topbar .feed-cluster a {
  color: var(--muted);
  font-size: 12px;
}

.app-session {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-message {
  max-width: 460px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar a {
  color: var(--accent);
  text-decoration: none;
}

.x-connection {
  max-width: 170px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-connection-action {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.x-connection-muted {
  border-style: dashed;
}

a {
  color: var(--accent);
}

.inline-form {
  margin: 0;
}

.inline-form button {
  min-height: 26px;
  padding: 0 8px;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  scroll-padding: 8px;
}

.add-column,
.column {
  flex: 0 0 340px;
  max-width: 380px;
  min-width: 320px;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  overflow: hidden;
}

.add-column {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 14px;
  border-style: dashed;
  background: transparent;
}

.add-column:not(.add-column-empty) {
  flex-basis: 220px;
  min-width: 220px;
  max-width: 260px;
}

.add-column-open:not(.add-column-empty) {
  flex-basis: 340px;
  min-width: 320px;
  max-width: 380px;
  align-content: start;
  justify-items: stretch;
  border-style: solid;
  background: var(--panel);
}

.add-column-empty {
  flex-basis: 340px;
  align-content: start;
  justify-items: stretch;
  border-style: solid;
  background: var(--panel);
}

.add-column-prompt {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.add-column-empty .add-column-prompt {
  justify-items: start;
  padding: 8px 0;
  text-align: left;
}

.add-column-prompt h1,
.add-column-panel h1,
.column-header h2 {
  margin: 0;
  font-size: 15px;
}

.column-title h2,
.column-title .source {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-column-prompt p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.add-column-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: #111827;
  border-radius: 999px;
  padding: 0 14px;
  background: #111827;
  color: #fff;
  font-weight: 650;
}

.add-column-button:hover {
  border-color: #344054;
  background: #344054;
}

.add-column-button span {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  line-height: 1;
}

.add-column-panel {
  width: 100%;
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel);
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.12);
}

.add-column:not(.add-column-empty) .add-column-panel {
  width: min(320px, calc(100vw - 24px));
}

.add-column-panel[hidden] {
  display: none;
}

.add-column-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.add-column-panel-header button {
  min-height: 28px;
  padding: 0 8px;
}

.stack {
  display: grid;
  gap: 10px;
}

label span,
.source,
.post-author span,
.private-help,
.notice,
.empty {
  color: var(--muted);
  font-size: 12px;
}

.private-help {
  margin-top: 14px;
  line-height: 1.4;
}

.column {
  display: flex;
  flex-direction: column;
}

.column-monitoring-disabled .column-header,
.column-monitoring-disabled .filter-strip {
  background: #f9fafb;
}

.column-monitoring-disabled .post-list {
  opacity: 0.82;
}

.column-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.column-title {
  min-width: 0;
}

.column-tools,
.column-settings-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-tools {
  min-width: 0;
  justify-content: end;
}

.icon-button {
  width: 32px;
  min-height: 30px;
  padding: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1;
}

.icon-button[aria-expanded="true"] {
  border-color: #98a2b3;
  background: #f9fafb;
  color: var(--text);
}

.filter-strip {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
}

.filter-strip-empty {
  color: var(--muted);
  font-size: 12px;
}

.filter-chip {
  flex: 0 0 auto;
  max-width: 150px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  background: #fff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-chip-include {
  border-color: #99f6e4;
  color: #0f766e;
}

.filter-chip-exclude {
  border-color: #fed7aa;
  color: #b54708;
}

.filter-chip-window {
  border-color: #d0d5dd;
  background: #eef2f6;
  color: #344054;
  font-weight: 650;
}

.filter-chip-cutoff {
  border-color: #bfdbfe;
  color: #175cd3;
}

.column-settings {
  display: grid;
  gap: 9px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(16, 24, 40, 0.05);
}

.column-settings[hidden] {
  display: none;
}

.column-settings form {
  margin: 0;
}

.column-settings-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.column-settings-title strong {
  font-size: 12px;
  font-weight: 650;
}

.column-settings-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.column-settings-title button,
.column-settings-actions button {
  min-height: 28px;
  padding: 0 8px;
}

.filter-form {
  display: grid;
  gap: 8px;
}

.visible-window-control {
  min-width: 0;
  display: grid;
  gap: 4px;
  margin: 0;
  border: 0;
  padding: 0;
}

.visible-window-control legend {
  padding: 0;
}

.visible-window-segments {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  background: #fff;
}

.visible-window-option {
  min-width: 0;
  position: relative;
  display: block;
}

.visible-window-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.visible-window-option span {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.visible-window-option input:checked + span {
  background: #0f766e;
  color: #fff;
}

.visible-window-option input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.settings-inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.settings-inline-control button {
  min-height: 34px;
  padding: 0 10px;
}

.settings-inline-control-compact {
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
}

.display-cutoff-form button {
  min-height: 28px;
  padding: 0 9px;
}

.filter-form button {
  justify-self: start;
  padding: 0 10px;
}

.remove-form {
  margin-left: auto;
}

.remove-form button {
  color: var(--danger);
}

.member-refresh-form button {
  border-color: #f79009;
  color: #93370d;
}

.settings-warning {
  margin: 0;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.35;
}

.column-state {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #fff7ed;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.notice {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #fff7ed;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-form {
  flex: 0 0 auto;
  margin: 0;
}

.status-button {
  min-width: 58px;
  min-height: 24px;
  border: 1px solid rgba(16, 24, 40, 0.14);
  line-height: 1;
  vertical-align: top;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}

.status-button:hover {
  border-color: currentColor;
  box-shadow:
    inset 0 0 0 1px currentColor,
    0 1px 0 rgba(16, 24, 40, 0.04);
}

.status-button:active {
  transform: translateY(1px);
}

.status::before {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-accessible,
.status-connected {
  background: #ecfdf3;
  color: #027a48;
}

.status-forbidden,
.status-notfound,
.status-apierror,
.status-disconnected {
  background: #fef3f2;
  color: var(--danger);
}

.status-ratelimited,
.status-idle,
.status-reconnecting,
.status-degraded,
.status-paused {
  background: #fffaeb;
  color: var(--warn);
}

.post-list {
  overflow-y: auto;
  min-height: 0;
}

.post {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.post-author {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.post-author img,
.avatar-fallback {
  width: 34px;
  height: 34px;
  display: block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d0d5dd;
}

.post-author-main {
  min-width: 0;
}

.post-name-row,
.post-meta {
  display: flex;
  align-items: center;
  min-width: 0;
}

.post-name-row {
  gap: 8px;
}

.post-meta {
  gap: 4px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.post-name,
.post-username,
.post-meta time {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-name {
  flex: 1 1 auto;
  font-weight: 700;
}

.post-username {
  flex: 0 1 auto;
}

.post-meta time {
  flex: 0 1 auto;
}

.post-link {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.post-link:hover {
  text-decoration: underline;
}

.post-text {
  margin: 7px 0 0 42px;
  color: #1f2937;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.42;
}

.post-actions {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0 42px;
  color: var(--muted);
  font-size: 12px;
}

.post-actions[hidden] {
  display: none;
}

.post-action {
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.post-action:hover {
  color: var(--accent);
  text-decoration: underline;
}

.translate-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0 42px;
  max-height: 330px;
  overflow: hidden;
}

.media-count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.media-count-3 .media-item:first-child {
  grid-row: span 2;
}

.media-item {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #eef2f6;
  color: #fff;
  text-decoration: none;
  aspect-ratio: 16 / 10;
}

.media-count-1 .media-item {
  aspect-ratio: 16 / 9;
  max-height: 240px;
}

.media-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

.empty {
  min-height: 112px;
  display: grid;
  align-content: center;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 44%),
    #fff;
}

.empty strong,
.empty span {
  display: block;
}

.empty strong {
  color: var(--text);
  font-weight: 650;
}

.empty span {
  margin-top: 3px;
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(100vw - 32px, 380px);
}

.login-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 18px;
}

.login-panel p {
  margin: 0 0 14px;
  color: var(--muted);
}

.ops-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 16px;
}

.ops-section {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.ops-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.ops-heading h1 {
  margin: 0;
  font-size: 15px;
}

.ops-heading span {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.metric-card {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  font-size: 20px;
  font-weight: 650;
}

.ops-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
}

.ops-links a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  text-decoration: none;
}

.ops-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  border-top: 1px solid var(--border);
  background: var(--border);
}

.ops-notes > div {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
}

.ops-notes span,
.ops-muted,
.ops-hint {
  color: var(--muted);
  font-size: 12px;
}

.ops-muted {
  display: block;
  margin-top: 3px;
}

.ops-hint {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #f9fafb;
}

.ops-table-wrap {
  overflow-x: auto;
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
}

.ops-table th,
.ops-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.ops-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.ops-table .copy-row {
  justify-content: flex-start;
  min-width: 280px;
}

.ops-table .copy-row a {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-table .copy-row button {
  min-height: 28px;
  padding: 0 8px;
}

.ops-code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
}

.ops-code-grid > div {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fff;
}

.ops-code-grid pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: #f9fafb;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
}

.error-notice {
  color: var(--danger);
  background: #fef3f2;
}

.success-notice {
  color: #067647;
  background: #ecfdf3;
}

.admin-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-actions form {
  margin: 0;
}

.admin-actions button,
.admin-create-form button {
  min-height: 32px;
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 8px 10px;
  }

  .brand,
  .primary-nav,
  .topbar-actions {
    gap: 7px;
  }

  .brand {
    flex-wrap: wrap;
  }

  .primary-nav,
  .topbar-actions {
    justify-content: flex-start;
  }

  .primary-nav {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-actions {
    row-gap: 7px;
  }

  .account-cluster {
    flex-wrap: wrap;
  }

  .feed-cluster,
  .app-account-cluster {
    padding-left: 0;
    border-left: 0;
  }

  .x-account-cluster {
    padding-right: 10px;
    border-right: 1px solid var(--border);
  }

  .stream-message {
    max-width: 100%;
    flex-basis: 100%;
  }

  .workspace {
    scroll-snap-type: x mandatory;
  }

  .add-column,
  .column {
    flex-basis: calc(100vw - 16px);
    min-width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    scroll-snap-align: start;
  }

  .add-column:not(.add-column-empty) {
    min-width: calc(100vw - 16px);
  }

  .post-text,
  .media-grid {
    margin-left: 0;
  }

  .admin-create-form {
    grid-template-columns: 1fr;
  }
}
