:root {
  color-scheme: light;
  --ink: #16201f;
  --muted: #65716f;
  --line: #dce4e1;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --warn: #9f5012;
  --shadow: 0 18px 45px rgba(21, 32, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: #eef4f1;
  padding: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  line-height: 1.2;
}

.brand p,
.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tabs,
.filters {
  display: grid;
  gap: 8px;
}

.tab,
.filter,
.iconButton,
.replyBox button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.tab,
.filter {
  min-height: 42px;
  text-align: left;
  padding: 0 14px;
}

.tab.active,
.filter.active {
  border-color: var(--accent);
  background: #dff1ec;
  color: var(--accent-strong);
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  padding: 20px 24px;
}

h2 {
  font-size: 22px;
}

.iconButton {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.pane {
  display: none;
  min-height: 0;
}

.pane.active {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.list {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

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

.item:hover,
.item.active {
  background: #edf7f4;
}

.itemTop,
.detailHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item h3 {
  margin-top: 5px;
  font-size: 16px;
}

.preview {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.platform,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e9efec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status {
  color: var(--warn);
}

.detail {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
}

.empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.thread {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.hidden {
  display: none;
}

.detailHeader {
  border-bottom: 1px solid var(--line);
  padding: 22px 24px;
}

.detailHeader h3 {
  margin-top: 7px;
  font-size: 20px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 22px 24px;
}

.bubble {
  max-width: 680px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f6;
  padding: 12px 14px;
  line-height: 1.45;
}

.bubble.outbound {
  align-self: flex-end;
  border-color: #b6d9d3;
  background: #dff1ec;
}

.bubbleMeta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.replyBox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.replyBox textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.replyBox button {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.commentBody {
  border-bottom: 1px solid var(--line);
  padding: 22px 24px;
  color: var(--ink);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .shell,
  .pane.active {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tabs,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail {
    min-height: 55vh;
  }
}
