:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #000;
  color: #e7e9ea;
}

a { color: inherit; text-decoration: none; }

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

.shell {
  --bg: #000;
  --text: #e7e9ea;
  --muted: #71767b;
  --line: #2f3336;
  --accent: #1d9bf0;
  --accent-text: #fff;
  --like: #f91880;
  --dislike: #1d9bf0;
  --hover: rgba(231, 233, 234, 0.08);
  --danger: #f4212e;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 275px minmax(0, 600px) minmax(290px, 350px);
  justify-content: center;
}

.theme-dim { --bg: #15202b; --line: #38444d; }
.theme-light { --bg: #fff; --text: #0f1419; --muted: #536471; --line: #eff3f4; --hover: rgba(15, 20, 25, 0.06); color-scheme: light; }
.theme-paper { --bg: #f6f1e7; --text: #1f1a14; --muted: #6b6258; --line: #e4dccf; --accent: #8a4b08; --hover: rgba(31, 26, 20, 0.06); color-scheme: light; }
.theme-contrast { --bg: #000; --text: #fff; --muted: #fff; --line: #fff; --accent: #ffe14a; --accent-text: #000; }

.nav, .rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px;
  overflow: auto;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 22px;
  padding: 12px;
}

.nav a, .nav-button {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 500;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.nav a.active, .nav a:hover, .nav-button:hover { background: var(--hover); }
.nav a.active { font-weight: 700; }

.nav .glyph,
.nav a:not(.brand) > span:not(.label):not(.nav-avatar) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.5em;
  width: 1.5em;
  min-width: 1.5em;
  max-width: 1.5em;
  height: 1.15em;
  line-height: 1;
  overflow: visible;
}

.nav-icon {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex: none;
}

.nav .nav-post {
  width: 100%;
  gap: 16px;
  font-size: 20px;
  flex: 0 0 auto;
}

.center {
  min-height: 100vh;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  height: 100vh;
  overflow-y: auto;
}

h1, h2, h3 {
  margin: 0;
  padding: 8px 0;
  line-height: 1.3;
  font-weight: 800;
}

h1 { font-size: 20px; }
h2 { font-size: 18px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px 0;
}

.topbar h1 { padding: 12px 4px 14px; }
.section-title { padding: 16px 20px 8px; }

.tabs { display: flex; }
.tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 16px 18px;
  min-height: 48px;
  font-weight: 700;
  cursor: pointer;
}
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); }
.tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 16px 18px;
  min-height: 48px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.tabs a.active { border-bottom-color: var(--accent); color: var(--accent); }

.composer, .card, .panel {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.composer textarea, .dialog textarea, .field input, .field textarea, .field select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
  font-weight: 600;
}

.row { display: flex; gap: 12px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-text);
  flex: none;
}

.company-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-main,
.company-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  color: inherit;
}

.company-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.company-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.company-name {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-handle {
  color: var(--muted);
  flex: none;
  white-space: nowrap;
}

.company-row > .ghost,
.company-actions { flex: none; }

.company-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-text);
  object-fit: cover;
}

img.company-avatar { display: block; background: transparent; }
.company-avatar-lg { width: 72px; height: 72px; font-size: 28px; }

.post-as { display: flex; flex-wrap: wrap; gap: 8px; }
.post-as-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 4px 12px 4px 4px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
  line-height: 1.2;
}
.post-as-choice:hover { background: var(--hover); }
.post-as-choice.picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.post-as-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.post-as-choice .name,
.post-as-choice .handle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9rem;
}
.post-as-choice .name { font-size: 14px; }
.post-as-choice .handle { font-size: 13px; }

.name { font-weight: 700; }
.handle, .muted { color: var(--muted); }
.dns-record {
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.body { font-size: 17px; line-height: 1.4; white-space: pre-wrap; margin: 8px 0 12px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button, .text-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 40px;
  cursor: pointer;
}
.actions button.on-like { color: var(--like); font-weight: 700; }
.actions button.on-dislike { color: var(--dislike); font-weight: 700; }
.actions button.on-bookmark { color: var(--accent); font-weight: 700; }
.actions button:hover { background: var(--hover); }

.primary, .ghost, a.primary, label.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 20px;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.2;
}
.primary, a.primary { background: var(--accent); color: var(--accent-text); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; border-color: var(--line); color: var(--text); }

.agent-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
}

.banner, .error-box, .empty {
  margin: 12px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.error-box { border-color: var(--danger); }

.skeleton {
  height: 120px;
  margin: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--line), transparent, var(--line));
  background-size: 200% 100%;
  animation: shine 1.2s infinite;
}
@keyframes shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.ratio-list { display: flex; flex-direction: column; gap: 16px; margin: 8px 0 4px; }
.ratio-scale { display: flex; flex-direction: column; gap: 4px; }
.ratio-name { font-weight: 700; }
.ratio-legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 13px; }
.ratio-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ratio-track {
  position: relative;
  height: 8px;
  margin: 12px 10px 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--low), var(--high));
}
.ratio-mark {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  pointer-events: none;
}
.ratio-legend .ratio-mark { position: static; transform: none; flex: none; }
.ratio-mark.actual {
  background: #fff;
  border: 2px solid #111;
  z-index: 1;
}
.ratio-mark.perceived {
  width: 20px;
  height: 20px;
  background: transparent;
  border: 2px solid var(--text);
  box-shadow: 0 0 0 2px var(--bg);
  z-index: 2;
}
.ratio-slider {
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(90deg, var(--low), var(--high));
}
.ratio-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #111;
}

.demos { display: flex; gap: 6px; align-items: center; }
.demo {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,.45);
}
.breakdown { margin-top: 8px; padding: 8px 0; display: grid; gap: 6px; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button.picked { border-color: var(--accent); color: var(--accent); }
.mark-ok { color: #00ba7c; font-weight: 700; }
.mark-wrong { color: var(--danger); font-weight: 700; }

.rail .panel { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; }
.person { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.list-actions { display: flex; gap: 8px; flex: none; }
.picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
.picker button { width: 100%; justify-content: flex-start; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
}

.dialog {
  width: min(520px, 100%);
  max-height: min(720px, 100%);
  overflow: auto;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.dialog-wide { width: min(640px, 100%); }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
}

.tag-picker { display: flex; flex-direction: column; gap: 6px; }
.tag-picker h3 { margin: 0; font-size: 15px; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 0 14px; }
.tag-grid .check { width: calc(50% - 14px); padding: 4px 2px; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 4px;
}

.dialog-header h2 { padding: 8px 4px; font-size: 20px; min-width: 0; }

.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.dialog-close:hover { background: var(--hover); }

.dialog-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dialog-close svg {
  width: 20px;
  height: 20px;
  display: block;
}
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 8px 20px 20px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.profile-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row.company-actions { flex-wrap: wrap; justify-content: flex-end; }
.restraint-choices { display: flex; flex-direction: column; gap: 14px; }
.restraint-choices button { width: 100%; justify-content: flex-start; }
.dialog .composer { padding: 0; border: 0; }
.dialog .banner, .dialog .error-box { margin: 0; }
.dialog .dialog-backdrop { z-index: 60; }

.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.composer-tools .muted { margin-left: auto; }
label.file-pick { position: relative; overflow: hidden; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chip { display: flex; flex-direction: column; gap: 6px; width: 140px; }
.attach-chip img, .attach-chip video { width: 140px; height: 100px; object-fit: cover; border-radius: 12px; background: var(--line); }
.post-media { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.post-media img, .post-media video { width: 100%; max-height: 360px; object-fit: contain; border-radius: 16px; background: var(--line); }
.poll { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.poll-option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
}
.poll-option.picked { border-color: var(--accent); color: var(--accent); }
.poll-option:disabled { cursor: default; opacity: 0.85; }
.mark-button {
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gif-grid button { padding: 0; border: 2px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; overflow: hidden; }
.gif-grid button:hover { border-color: var(--accent); }
.gif-grid img { display: block; width: 100%; height: 100px; object-fit: cover; }
.history-rev { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.history-rev p { margin: 0; white-space: pre-wrap; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 80px minmax(0, 600px); }
  .rail, .label { display: none; }
  .nav a, .brand, .nav .nav-post { justify-content: center; padding: 12px; }
  .nav .nav-post { width: auto; align-self: center; }
}
@media (max-width: 700px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    overflow: auto;
    border-bottom: 1px solid var(--line);
    z-index: 3;
    background: var(--bg);
  }
  .nav > * { flex-shrink: 0; }
  .center { height: auto; border: 0; }
  .label { display: none; }
}

.nav .company-avatar {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.nav-avatar {
  position: relative;
  display: inline-flex;
  flex: none;
}

.verify-check {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
  pointer-events: none;
}

.verify-check svg {
  width: 10px;
  height: 10px;
  display: block;
}

.profile-panel { padding: 0; }
.profile-body { padding: 16px; }
.profile-avatar-slot { flex: none; display: flex; }
.profile-avatar-slot .company-avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 36px;
}

.profile-banner {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: var(--line);
}
img.profile-banner { background: transparent; }

.profile-banner-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.photo-edit { position: relative; }
.photo-edit-button {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 1;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
.photo-edit:hover .photo-edit-button,
.photo-edit:focus-within .photo-edit-button {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  .photo-edit-button { opacity: 1; pointer-events: auto; }
}
.profile-avatar-slot .photo-edit-button {
  bottom: 6px;
  padding: 4px 10px;
  min-height: 28px;
}

.crop-scroll { max-width: 100%; overflow-x: auto; }
.crop-viewport {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  touch-action: none;
  cursor: grab;
  user-select: none;
  background-color: #16181c;
  background-image:
    linear-gradient(45deg, #2f3336 25%, transparent 25%),
    linear-gradient(-45deg, #2f3336 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2f3336 75%),
    linear-gradient(-45deg, transparent 75%, #2f3336 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
}
.crop-zoom { width: 100%; accent-color: var(--accent); }

.company-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
}
.company-head .company-actions { justify-self: end; }
.company-head .owned-by { justify-self: end; align-self: center; text-align: right; }
.owned-by { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
.owned-by a { color: inherit; white-space: nowrap; }

.follow-counts { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.follow-counts a { color: inherit; }
.follow-counts strong { font-weight: 800; }

.menu { position: relative; display: inline-flex; }
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: default;
  min-height: 0;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 21;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.menu-panel a,
.menu-panel button {
  display: flex;
  width: 100%;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
}
.menu-panel a:hover,
.menu-panel button:hover { background: var(--hover); }
.menu-panel .error-box { margin: 6px; }
