:root {
  color-scheme: light;
  --bg: #eef7f5;
  --panel: #ffffff;
  --panel-soft: #f7fbfa;
  --text: #10201d;
  --muted: #637571;
  --line: #dce9e6;
  --brand: #0b806f;
  --brand-dark: #07594e;
  --accent: #f3b840;
  --danger: #d94b4b;
  --shadow: 0 20px 70px rgba(8, 49, 43, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 10%, rgba(11, 128, 111, 0.18), transparent 28%),
    linear-gradient(135deg, #eef7f5 0%, #f8fbf7 44%, #e3f2ef 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card img {
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
}

.auth-card h1 {
  margin-bottom: 22px;
  font-size: 38px;
}

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

.auth-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.auth-actions {
  grid-template-columns: 1fr 1fr;
}

.auth-error {
  min-height: 22px;
  margin: 2px 0 0;
  color: var(--danger);
  font-weight: 700;
}

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

.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.78);
  border-right: 1px solid rgba(220, 233, 230, 0.9);
  backdrop-filter: blur(22px);
}

.brand,
.account,
.thread,
.conversation-head,
.topbar,
.composer,
.call-panel div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand img {
  width: 44px;
  height: 44px;
}

.brand strong,
.account strong {
  display: block;
  font-size: 17px;
}

.brand span,
.account span,
.thread span,
.conversation-head p,
.eyebrow,
.status-card p {
  color: var(--muted);
}

.brand span,
.account span,
.thread span {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  background: #e5f1ee;
  border-radius: 8px;
}

.nav-tabs button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.nav-tabs button.active {
  color: var(--brand-dark);
  background: #fff;
  box-shadow: 0 5px 16px rgba(8, 49, 43, 0.08);
}

.search span {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.search input,
.composer input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: #fff;
}

.search input {
  height: 44px;
  padding: 0 14px;
}

.search input:focus,
.composer input:focus {
  border-color: rgba(11, 128, 111, 0.65);
  box-shadow: 0 0 0 3px rgba(11, 128, 111, 0.12);
}

.thread-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.thread {
  width: 100%;
  gap: 12px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
}

.thread.active,
.thread:hover {
  background: #fff;
  box-shadow: 0 10px 24px rgba(8, 49, 43, 0.08);
}

.thread .avatar,
.account .avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), #21a590);
  border-radius: 8px;
}

.thread p {
  margin: 0;
  font-weight: 700;
}

.thread small {
  margin-left: auto;
  color: var(--muted);
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state strong {
  color: var(--text);
}

.empty-state.center {
  place-items: center;
  margin: auto;
  text-align: center;
}

.account {
  gap: 12px;
  margin-top: auto;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.top-actions,
.call-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary,
.ghost,
.composer button,
.call-buttons button,
.call-panel button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 8px;
  font-weight: 800;
}

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

.ghost {
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.full-width {
  width: 100%;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
}

.conversation,
.details {
  min-width: 0;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(220, 233, 230, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.conversation-head {
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid var(--line);
}

.conversation-head p,
.conversation-head h2 {
  margin: 0;
}

.conversation-head h2 {
  margin-top: 3px;
}

.call-buttons button {
  width: 44px;
  padding: 0;
  color: var(--brand-dark);
  background: #e8f4f1;
}

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

.message {
  max-width: min(590px, 86%);
  padding: 12px 14px;
  background: #f2f8f6;
  border-radius: 8px;
}

.message.me {
  align-self: flex-end;
  color: #fff;
  background: var(--brand);
}

.message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

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

.message small {
  display: block;
  margin-top: 7px;
  color: rgba(16, 32, 29, 0.55);
}

.message.me small {
  color: rgba(255, 255, 255, 0.72);
}

.composer {
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer input {
  height: 46px;
  padding: 0 14px;
}

.composer button {
  color: #fff;
  background: var(--brand);
}

.composer button:first-child {
  width: 46px;
  padding: 0;
  color: var(--brand-dark);
  background: #e8f4f1;
}

.details {
  display: grid;
  align-content: start;
  gap: 14px;
}

.status-card,
.call-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scope-list span {
  padding: 7px 9px;
  color: var(--brand-dark);
  background: #e8f4f1;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
}

.compact h3 {
  margin-bottom: 8px;
}

.compact p {
  margin-bottom: 0;
  line-height: 1.5;
}

.call-panel {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), #0b806f);
  box-shadow: var(--shadow);
}

.call-panel p {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.74);
}

.call-panel strong {
  display: block;
  font-size: 26px;
  margin-bottom: 16px;
}

.call-panel div {
  gap: 10px;
}

.call-panel button {
  flex: 1;
  color: #fff;
}

.call-panel .danger {
  background: var(--danger);
}

.call-panel .accept {
  color: var(--brand-dark);
  background: #fff;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .thread-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    overflow-x: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .conversation {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

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

  .top-actions {
    width: 100%;
  }

  .top-actions button {
    flex: 1 1 160px;
  }

  .thread-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  h1 {
    font-size: 31px;
  }

  .content-grid {
    gap: 12px;
  }

  .conversation {
    min-height: 580px;
  }

  .composer {
    display: grid;
    grid-template-columns: 46px 1fr;
  }

  .composer button[type="submit"] {
    grid-column: 1 / -1;
  }
}
