:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-strong: #f9faf8;
  --text: #16211d;
  --muted: #69756f;
  --line: #dfe5e1;
  --accent: #176b63;
  --accent-dark: #0f4f49;
  --warn: #b45309;
  --urgent: #c24136;
  --done: #25784f;
  --shadow: 0 18px 45px rgba(27, 39, 34, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.auth-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.auth-panel > div,
.auth-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.auth-panel > div {
  grid-column: 1 / -1;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.auth-form input,
.auth-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

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

.sidebar {
  background: #101917;
  color: #f8fbf9;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand,
.topbar,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #7a8b85;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: #9db3ab;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-panel div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.06);
}

.metric {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.metric.urgent {
  color: #ffb4a9;
}

.metric.done {
  color: #9ee6bc;
}

.summary-panel span:last-child {
  display: block;
  color: #bbcac5;
  font-size: 12px;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.channel-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
}

.channel-wrap:hover,
.channel-wrap.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.channel {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.delete-button {
  align-self: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffcbc4;
  font-size: 12px;
  font-weight: 800;
}

.delete-button:hover {
  background: rgba(194, 65, 54, 0.2);
}

.delete-button.light {
  border-color: #f1c7c1;
  background: #fff;
  color: var(--urgent);
}

.channel strong,
.channel span,
.channel small {
  display: block;
}

.channel strong {
  margin-bottom: 4px;
}

.channel span {
  color: #b7c7c1;
  font-size: 13px;
}

.channel small {
  margin-top: 4px;
  color: #879993;
  font-size: 12px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.topbar {
  min-height: 72px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.round-action {
  display: inline-grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.round-action.important {
  background: #fde2de;
  color: var(--urgent);
  border-color: #f5b8b0;
}

#clearPrivateChatButton {
  width: auto;
  min-width: 92px;
  color: var(--urgent);
}

.primary-button,
.ghost-button,
.send-button,
.filter,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 750;
}

.primary-button,
.send-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover,
.send-button:hover {
  background: var(--accent-dark);
}

.ghost-button,
.filter,
.icon-button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.manage-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(210, 244, 238, 0.26);
  border-radius: 8px;
  background: #1c342e;
  color: #effaf6;
  font-weight: 900;
}

.mobile-panel-heading {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mobile-panel-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.chat-panel,
.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-panel {
  display: flex;
  min-height: calc(100vh - 128px);
  flex-direction: column;
}

.filter-row {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.filter {
  min-height: 36px;
  white-space: nowrap;
}

.filter.is-active {
  background: #e4f1ee;
  border-color: #a8d0c8;
  color: var(--accent-dark);
}

.members-panel {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
}

.member-chip {
  display: grid;
  gap: 2px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f9fbfa;
  color: var(--text);
  text-align: left;
}

.member-chip span,
.member-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-chip span {
  font-weight: 850;
}

.member-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.member-chip.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.message {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.message.is-urgent {
  border-left: 5px solid var(--urgent);
}

.message.is-high {
  border-left: 5px solid var(--warn);
}

.message.is-overdue {
  background: #fff7f5;
}

.message.is-jump-target {
  outline: 3px solid rgba(23, 107, 99, 0.28);
  outline-offset: 2px;
}

.message-meta,
.message-actions,
.task-meta,
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.message-meta {
  justify-content: space-between;
}

.author {
  font-weight: 800;
}

.time {
  color: var(--muted);
  font-size: 13px;
}

.edit-message-button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.message-meta > .edit-message-button {
  display: none;
}

.edit-message-button:hover {
  color: var(--accent-dark);
  border-color: #a8d0c8;
}

.message-tools {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.danger-mini {
  color: var(--urgent);
}

.message.is-deleted {
  color: var(--muted);
  border-style: dashed;
  background: #f4f6f5;
  font-style: italic;
}

.edited-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.message-text {
  margin-bottom: 0;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  background: #edf1ef;
  color: #33403b;
}

.badge.urgent {
  background: #fde2de;
  color: var(--urgent);
}

.badge.high {
  background: #ffe8c2;
  color: var(--warn);
}

.badge.done {
  background: #dcf7e6;
  color: var(--done);
}

.badge.owner {
  background: #e7edf7;
  color: #27507c;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.action-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 130px 150px 110px;
  gap: 8px;
}

.composer input,
.composer select,
.mini-form input,
.mini-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.file-field {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.file-field input {
  min-height: auto;
  border: 0;
  padding: 0;
  font-size: 11px;
}

.message-photo {
  margin: 0;
  display: grid;
  gap: 6px;
}

.photo-open-button {
  width: min(360px, 100%);
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.message-photo img {
  width: min(360px, 100%);
  max-height: 320px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.message-photo figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.send-button {
  min-width: 112px;
}

.detail-panel {
  display: grid;
  gap: 16px;
}

.status-card {
  padding: 16px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 8px;
  margin: -4px 0 14px;
  border-radius: 999px;
  background: #e8eeeb;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--done);
  transition: width 180ms ease;
}

.mini-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.mini-form .ghost-button {
  width: 100%;
}

.inline-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compact-button {
  min-height: 42px;
  padding: 0 10px;
  font-size: 13px;
}

.people-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-strong);
}

.person-row div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.person-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.person-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.task-list,
.history-list {
  display: grid;
  gap: 10px;
}

.task {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.task.done {
  opacity: 0.72;
}

.task-title {
  margin: 0;
  font-weight: 800;
}

.task-meta,
.history-item {
  color: var(--muted);
  font-size: 13px;
}

.history-card {
  max-height: 360px;
  overflow: auto;
}

.history-item {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

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

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfb;
  font-weight: 700;
  text-align: center;
  padding: 18px;
}

.empty-state.compact {
  min-height: 84px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 14px 16px;
  background: #101917;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(130%);
  transition: transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 31, 28, 0.48);
}

.modal-panel {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 31, 28, 0.24);
}

.modal-panel .mini-form:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(9, 15, 14, 0.94);
}

.photo-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
}

.photo-viewer-bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.photo-viewer-bar div {
  display: flex;
  gap: 8px;
}

.photo-viewer img {
  align-self: center;
  justify-self: center;
  max-width: min(96vw, 1200px);
  max-height: calc(100vh - 82px);
  object-fit: contain;
}

.confirm-panel {
  width: min(440px, 100%);
}

.confirm-panel p {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.danger-button {
  min-height: 42px;
  border: 1px solid #b8322a;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--urgent);
  color: #fff;
  font-weight: 800;
}

.danger-button:hover {
  background: #a9362e;
}

.only-mobile {
  display: none;
}

@media (max-width: 1040px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 62vh;
  }

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

  #ownerInput,
  .file-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 330px);
    z-index: 5;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .workspace {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .channel-heading {
    flex: 1;
    min-width: 0;
  }

  .content-grid {
    gap: 12px;
  }

  .composer,
  .composer-grid {
    grid-template-columns: 1fr;
  }

  #ownerInput,
  .file-field {
    grid-column: auto;
  }

  .send-button {
    width: 100%;
  }

  .only-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .topbar {
    flex-wrap: wrap;
  }

  h2 {
    font-size: 22px;
  }

  .primary-button,
  .ghost-button {
    padding: 0 12px;
  }
}

/* Modern messenger pass */
.app-shell {
  grid-template-columns: 360px minmax(0, 1fr);
  max-height: 100vh;
  overflow: hidden;
}

.sidebar {
  min-height: 0;
  padding: 18px;
  gap: 14px;
  background: #0f1f1c;
}

.channel-search {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.channel-search::placeholder {
  color: #9fb1ab;
}

.channel-list {
  min-height: 0;
  gap: 6px;
}

.list-title {
  margin: 10px 4px 2px;
  color: #9fb1ab;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.list-empty {
  padding: 16px 10px;
  color: #9fb1ab;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.channel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.channel-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #d7eee8;
  color: var(--accent-dark);
  font-size: 17px;
  font-weight: 900;
}

.channel-main {
  min-width: 0;
}

.channel-main strong,
.channel-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-members {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #d7eee8;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-side {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: #9fb1ab;
  font-size: 11px;
  font-weight: 750;
}

.urgent-dot {
  color: #ffb4a9;
}

.muted-channel {
  opacity: 0.72;
}

.workspace {
  min-height: 0;
  padding: 0;
}

.topbar {
  min-height: 76px;
  margin-bottom: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.channel-status {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0;
  align-items: stretch;
  height: calc(100vh - 77px);
  min-height: 0;
}

.chat-panel {
  min-height: 0;
  height: 100%;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.filter-row {
  padding: 10px 14px;
  background: #fbfcfb;
}

.messages {
  padding: 18px;
  background:
    linear-gradient(rgba(238, 242, 241, 0.92), rgba(238, 242, 241, 0.92)),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(23, 107, 99, 0.035) 18px 19px);
}

.message {
  width: min(680px, 86%);
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 8px 8px 8px 2px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(18, 32, 28, 0.05);
}

.message.is-own {
  margin-left: auto;
  border-color: #b8dfd6;
  border-radius: 8px 8px 2px 8px;
  background: #e3f4ef;
}

.message.is-own .message-meta {
  justify-content: flex-end;
}

.message.is-own .author {
  display: none;
}

.message-text {
  overflow-wrap: anywhere;
}

.meta-row {
  gap: 6px;
}

.composer {
  padding: 12px 14px;
  background: #f9fbfa;
}

.messenger-composer {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  align-items: center;
}

.message-box {
  min-height: 46px;
}

.quick-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quick-controls select {
  width: auto;
  max-width: 140px;
  min-height: 38px;
  font-size: 12px;
  font-weight: 800;
}

.type-select {
  width: auto;
  max-width: 104px;
  min-height: 38px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.attach-button {
  display: grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
}

.attach-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.recording-state {
  color: var(--urgent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.message-audio {
  display: grid;
  gap: 6px;
}

.message-audio audio {
  width: min(320px, 100%);
}

.message-audio a {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.composer input,
.composer select,
.mini-form input,
.mini-form select,
.file-field {
  border-radius: 999px;
}

.send-button {
  min-width: 72px;
  border-radius: 999px;
}

.detail-panel {
  align-content: start;
  height: 100%;
  overflow-y: auto;
  padding: 14px;
  background: #f7f9f8;
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

@media (max-width: 1040px) {
  .content-grid {
    height: auto;
  }

  .detail-panel {
    height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    max-height: none;
    overflow: visible;
  }

  .workspace {
    padding: 0;
  }

  .topbar {
    padding: 10px 12px;
  }

  .content-grid {
    gap: 0;
  }

  .message {
    width: min(94%, 620px);
  }

  .messenger-composer {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .quick-controls {
    grid-column: 1 / -1;
    overflow-x: auto;
  }

  .recording-state {
    grid-column: 1 / -1;
  }

  .quick-controls select {
    flex: 1;
    min-width: 112px;
  }
}

/* Split chat view */
.app-shell {
  height: 100dvh;
  min-height: 0;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
}

.content-grid {
  flex: 1 1 auto;
  min-height: 0;
}

.messages {
  min-height: 0;
  overscroll-behavior: contain;
}

.channel-heading {
  min-width: 0;
}

.channel-heading h2,
.channel-status,
.user-pill {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messenger-composer {
  min-width: 0;
}

.message-box {
  min-width: 0;
}

@media (max-width: 1180px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .app-shell:not(.chat-open) .workspace {
    display: none;
  }

  .app-shell.chat-open .sidebar {
    display: none;
  }

  .sidebar {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100%;
    height: 100dvh;
    padding: 14px;
    transform: none;
    transition: none;
  }

  .brand {
    min-height: 52px;
  }

  #closeChannels {
    display: none;
  }

  .summary-panel {
    flex: 0 0 auto;
  }

  .channel-list {
    flex: 1 1 auto;
  }

  .workspace {
    height: 100dvh;
  }

  .topbar {
    min-height: 64px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .top-actions {
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
  }

  .user-pill {
    display: none;
  }

  .round-action {
    min-width: 38px;
    height: 38px;
    padding: 0 8px;
  }

  .content-grid {
    height: auto;
    min-height: 0;
  }

  .chat-panel {
    height: 100%;
    min-height: 0;
  }

  .filter-row {
    flex: 0 0 auto;
  }

  .messages {
    flex: 1 1 auto;
    padding: 12px;
  }

  .messenger-composer {
    flex: 0 0 auto;
    grid-template-columns: 40px 40px minmax(0, 1fr) 76px;
    gap: 6px;
    padding: 8px;
  }

  .type-select {
    grid-column: 1 / 3;
    width: 100%;
    max-width: none;
  }

  .quick-controls {
    grid-column: 3 / 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(86px, 1fr));
    overflow-x: auto;
  }

  .quick-controls.is-hidden {
    display: none !important;
  }

  .recording-state {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .send-button {
    width: auto;
    min-width: 76px;
  }

  .detail-panel {
    position: fixed;
    inset: 0;
    z-index: 8;
    display: none;
    height: 100dvh;
    padding: 14px;
    overflow-y: auto;
    background: #f7f9f8;
  }

  .detail-panel.is-mobile-open {
    display: block;
  }

  .detail-panel::before {
    content: none;
  }

  .mobile-panel-heading {
    display: flex;
    position: sticky;
    top: -14px;
    z-index: 2;
    padding: 10px 0 12px;
    background: #f7f9f8;
  }

  .mobile-panel-heading .ghost-button {
    min-width: 92px;
  }
}

@media (max-width: 430px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .messenger-composer {
    grid-template-columns: 38px 38px minmax(0, 1fr);
  }

  .send-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .type-select,
  .quick-controls {
    grid-column: 1 / -1;
  }
}
