:root {
  --gold: #c8930a;
  --gold-strong: #a67808;
  --gold-tint: #fdf8e8;
  --gold-line: rgba(200, 147, 10, 0.28);

  --ink: #171714;
  --ink-soft: #57544c;
  --ink-faint: #8b877d;

  --shell: #17170f;
  --shell-line: rgba(255, 255, 255, 0.09);
  --shell-text: rgba(255, 255, 255, 0.62);
  --shell-text-strong: #f6f4ee;

  --paper: #f7f6f2;
  --card: #ffffff;
  --line: #e4e1d8;
  --line-soft: #efece4;

  --positive: #3f7d20;
  --positive-tint: #f0f7e9;
  --waiting: #b0480a;
  --waiting-tint: #fdf1e7;

  --sidebar-width: 232px;
  --radius: 12px;
  --radius-small: 8px;

  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- sign in ---------- */

.signin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.signin-pitch {
  background: var(--shell);
  color: var(--shell-text-strong);
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.signin-pitch img {
  width: 132px;
  height: auto;
}

.signin-pitch h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 12ch;
}

.signin-pitch h1 em {
  font-style: normal;
  color: var(--gold);
}

.signin-pitch p {
  color: var(--shell-text);
  max-width: 42ch;
  margin-top: 18px;
}

.signin-ledger {
  display: grid;
  gap: 1px;
  background: var(--shell-line);
  border: 1px solid var(--shell-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.signin-ledger div {
  background: var(--shell);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--shell-text);
}

.signin-ledger strong {
  color: var(--shell-text-strong);
  font-weight: 500;
}

.signin-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 60px;
  max-width: 520px;
}

.signin-form h2 {
  font-size: 21px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.signin-form > p {
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.signin-note {
  margin-top: 22px;
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .signin {
    grid-template-columns: 1fr;
  }
  .signin-pitch {
    padding: 36px 28px;
    gap: 28px;
  }
  .signin-form {
    padding: 36px 28px;
    max-width: none;
  }
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--card);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-primary {
  background: var(--gold);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--gold-strong);
}

.button-quiet {
  border-color: var(--line);
  color: var(--ink);
}

.button-quiet:hover:not(:disabled) {
  background: var(--paper);
}

.button-wide {
  width: 100%;
  padding: 13px 16px;
}

.button-small {
  padding: 6px 12px;
  font-size: 13px;
}

.button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ---------- app shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--shell);
  color: var(--shell-text);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand img {
  width: 104px;
  height: auto;
  display: block;
  margin-left: 6px;
}

.workspace {
  border: 1px solid var(--shell-line);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workspace:hover {
  border-color: var(--gold-line);
}

.workspace-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 2px;
}

.workspace-name {
  color: var(--shell-text-strong);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.workspace-menu[hidden] {
  display: none;
}

.workspace-menu {
  border: 1px solid var(--shell-line);
  border-radius: var(--radius-small);
  background: #201f16;
  padding: 5px;
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
}

.workspace-menu button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--shell-text);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}

.workspace-menu button:hover,
.workspace-menu button[aria-current="true"] {
  background: rgba(255, 255, 255, 0.07);
  color: var(--shell-text-strong);
}

.nav {
  display: grid;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-small);
  color: var(--shell-text);
  text-decoration: none;
  font-size: 14px;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--shell-text-strong);
}

.nav a[aria-current="page"] {
  background: rgba(200, 147, 10, 0.16);
  color: #f2d072;
  box-shadow: inset 2px 0 0 var(--gold);
}

.nav svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 1px 7px;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--shell-text-strong);
  padding: 0 4px;
}

.identity img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.sign-out {
  background: transparent;
  border: 0;
  color: var(--shell-text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  padding: 4px;
}

.sign-out:hover {
  color: var(--shell-text-strong);
}

/* ---------- main ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.view-head {
  padding: 26px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.view-head h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.view-head p {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin-top: 3px;
  max-width: 62ch;
}

.view-body {
  padding: 24px 32px 44px;
  flex: 1;
  min-height: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.tabs button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tabs button[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- inbox ---------- */

.inbox {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  align-items: start;
}

.thread-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.thread-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px;
  cursor: pointer;
}

.thread-item:last-child {
  border-bottom: 0;
}

.thread-item:hover {
  background: var(--paper);
}

.thread-item[aria-current="true"] {
  background: var(--gold-tint);
  box-shadow: inset 3px 0 0 var(--gold);
}

.thread-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.thread-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-time {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.thread-preview {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 999px;
  padding: 2px 9px;
  margin-top: 8px;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-waiting {
  background: var(--waiting-tint);
  color: var(--waiting);
}

.status-answered {
  background: var(--positive-tint);
  color: var(--positive);
}

.conversation {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.conversation-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.conversation-head strong {
  font-weight: 500;
}

.conversation-head span {
  display: block;
  color: var(--ink-faint);
  font-size: 12.5px;
}

.messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}

.message {
  max-width: 74%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.8px;
}

.message-in {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-bottom-left-radius: 5px;
  align-self: flex-start;
}

.message-out {
  background: var(--gold-tint);
  border: 1px solid var(--gold-line);
  border-bottom-right-radius: 5px;
  align-self: flex-end;
}

.message time {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.composer {
  border-top: 1px solid var(--line-soft);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
}

.composer .button {
  flex-shrink: 0;
}

.composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 11px 14px;
  background: var(--card);
}

.composer input::placeholder {
  color: var(--ink-faint);
}

/* ---------- comments ---------- */

.comments-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.post {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  padding: 0;
  text-align: left;
  position: relative;
}

.post img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.post[aria-current="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-line);
}

.post-meta {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.comment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-head strong {
  font-weight: 500;
}

.comment-head time {
  color: var(--ink-faint);
  font-size: 12px;
}

.comment-replies {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--gold-line);
  display: grid;
  gap: 8px;
}

.comment-reply {
  font-size: 13.5px;
}

.comment-reply strong {
  font-weight: 500;
}

.reply-actions {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.reply-row {
  display: flex;
  gap: 8px;
}

.reply-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 9px 12px;
}

/* ---------- table ---------- */

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.campaign-name {
  font-weight: 500;
  max-width: 320px;
}

.campaign-objective {
  display: block;
  color: var(--ink-faint);
  font-size: 12px;
  margin-top: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  padding: 3px 10px;
}

.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.pill-active {
  background: var(--positive-tint);
  color: var(--positive);
}

.pill-paused {
  background: var(--paper);
  color: var(--ink-soft);
}

/* ---------- connections ---------- */

.stack {
  display: grid;
  gap: 14px;
  max-width: 840px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2 {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-head p {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 2px;
}

.asset {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.asset:last-child {
  border-bottom: 0;
}

.asset img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.asset-body {
  min-width: 0;
  flex: 1;
}

.asset-body strong {
  font-weight: 500;
  display: block;
}

.asset-body span {
  color: var(--ink-faint);
  font-size: 12.5px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  flex-shrink: 0;
}

.switch-track {
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: #ddd9cf;
  position: relative;
  transition: background 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.switch[aria-pressed="true"] .switch-track {
  background: var(--gold);
}

.switch[aria-pressed="true"] .switch-track::after {
  transform: translateX(17px);
}

.switch-label {
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 74px;
  text-align: left;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border-top: 1px solid var(--line-soft);
}

.metric {
  background: var(--card);
  padding: 16px 20px;
}

.metric strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metric span {
  color: var(--ink-faint);
  font-size: 12.5px;
}

.access-list {
  display: grid;
  gap: 9px;
  padding: 18px 20px;
}

.access-list div {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.access-list svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------- states ---------- */

.empty {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 44px 32px;
  text-align: center;
  color: var(--ink-soft);
}

.empty strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 5px;
}

.notice {
  background: var(--gold-tint);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-small);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

.error {
  background: #fdf0ee;
  border: 1px solid #f0c8c0;
  border-radius: var(--radius-small);
  padding: 11px 14px;
  font-size: 13.5px;
  color: #9c3520;
  margin-bottom: 14px;
}

.skeleton {
  background: linear-gradient(90deg, #eeebe3 25%, #f6f4ef 50%, #eeebe3 75%);
  background-size: 300% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

.skeleton-rows {
  display: grid;
  gap: 10px;
}

.skeleton-rows .skeleton {
  height: 62px;
}

@media (max-width: 1080px) {
  .inbox,
  .comments-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .view-head,
  .view-body {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.message-empty {
  color: var(--ink-faint);
  font-style: italic;
}
