:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #202124;
  background: #fff;
  --blue: #0b57d0;
  --line: #e4e9f0;
  --muted: #738093;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

.login {
  height: 100dvh;
  background: #f3f6fb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  overflow: auto;
}

.login-panel {
  width: min(100%, 1080px);
  min-height: 420px;
  background: #fff;
  border-radius: 28px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 430px);
  gap: 72px;
  align-items: start;
  padding: 56px;
}

.brand-logo {
  width: 56px;
  height: auto;
  display: block;
  margin: 0 0 36px;
}

.login h1 {
  font-size: 42px;
  line-height: 1.08;
  font-weight: 400;
  margin: 0 0 24px;
  color: #202124;
  letter-spacing: 0;
}

.login p {
  font-size: 20px;
  line-height: 1.35;
  color: #030303;
  margin: 0;
}

.login-fields {
  padding-top: 98px;
  display: grid;
  gap: 14px;
}

.login label {
  display: block;
  margin: 0;
}

.login label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.login input {
  width: 100%;
  height: 56px;
  border: 1px solid #747775;
  border-radius: 4px;
  padding: 0 16px;
  color: #202124;
  background: #fff;
  font-size: 17px;
  outline: none;
}

.login input::placeholder {
  color: #3c4043;
  opacity: 1;
}

.login input:focus {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
}

.login button,
#composer button {
  border: 0;
  background: var(--blue);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.login button {
  min-width: 88px;
  height: 48px;
  border-radius: 24px;
  padding: 0 24px;
  font-size: 16px;
}

.login output {
  display: block;
  color: #b3261e;
  font-size: 14px;
  line-height: 1.4;
  min-width: 0;
}

main {
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px 1fr;
  background: #fff;
  overflow: hidden;
  min-height: 0;
}

aside {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

aside header {
  min-height: 70px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: start;
  gap: 12px;
}

header small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.notification-toggle {
  position: relative;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #667285;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.notification-toggle:hover {
  background: #f1f5ff;
  color: var(--blue);
}

.notification-toggle svg,
#composer button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav {
  min-height: 0;
  overflow-y: auto;
}

.new-chat-form {
  border-bottom: 1px solid var(--line);
  padding: 12px 15px;
  display: grid;
  gap: 12px;
}

.new-chat-form label {
  display: grid;
  gap: 6px;
  color: #4b5565;
  font-size: 13px;
  font-weight: 700;
}

.new-chat-form input[type="text"],
.new-chat-form input:not([type]) {
  width: 100%;
  height: 38px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  color: #202124;
  background: #fff;
  padding: 0 11px;
  outline: none;
}

.new-chat-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #0b57d019;
}

.new-chat-form strong {
  display: block;
  color: #3d4857;
  font-size: 13px;
  margin-bottom: 7px;
}

#new-chat-users {
  display: grid;
  gap: 7px;
}

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

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 600 !important;
}

.check-row input {
  width: 16px;
  height: 16px;
}

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

.new-chat-actions output {
  margin-right: auto;
  color: #b3261e;
  font-size: 12px;
  line-height: 1.35;
}

.new-chat-actions button {
  border: 0;
  border-radius: 18px;
  min-height: 36px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.new-chat-actions .ghost {
  background: transparent;
  color: #667285;
}

.new-chat-actions button:hover {
  background: #084dbb;
}

.new-chat-actions .ghost:hover {
  background: #f1f5ff;
  color: #334155;
}

.sidebar-empty {
  padding: 18px 15px;
  color: var(--muted);
  font-size: 13px;
}

.chat {
  width: 100%;
  display: grid;
  grid-template-columns: 43px 1fr auto;
  gap: 11px;
  padding: 13px 15px;
  cursor: pointer;
  border: 0;
  border-left: 3px solid transparent;
  background: #fff;
  color: #202124;
  text-align: left;
}

.chat:hover,
.chat.active {
  background: #f1f5ff;
  border-left-color: var(--blue);
}

.avatar {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: #dbe6ff;
  color: #2759c4;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.chat-copy {
  min-width: 0;
}

.chat b,
.chat span span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat span span {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.badge {
  background: var(--blue);
  color: white;
  border-radius: 99px;
  padding: 2px 7px;
  font-size: 11px;
  height: max-content;
}

.team {
  min-height: 0;
  overflow-y: auto;
  padding: 15px;
  border-top: 1px solid var(--line);
}

.team > strong {
  display: block;
  color: #3d4857;
  font-size: 13px;
  margin-bottom: 10px;
}

.team-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 0;
}

.team-row b,
.team-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-row small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.bot-row .account-avatar {
  background: #e6f7f9;
  color: #087c8c;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #f8fafc;
}

.conversation > header {
  height: 70px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
}

.conversation > header > div {
  flex: 1;
  min-width: 0;
}

.conversation h2 {
  font-size: 17px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-action,
.mobile-menu {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667285;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
}

.mobile-menu {
  display: none;
}

.header-action {
  display: grid;
  place-items: center;
}

.header-action:hover {
  background: #f1f5ff;
  color: var(--blue);
}

.header-action.danger:hover {
  background: #fceeee;
  color: #b3261e;
}

.header-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add-people-form {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(16px, 4vw, 60px);
  display: grid;
  gap: 12px;
}

.add-people-form strong {
  display: block;
  color: #3d4857;
  font-size: 13px;
  margin-bottom: 8px;
}

#add-people-users {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
}

.add-people-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.add-people-actions output {
  color: #b3261e;
  font-size: 13px;
  margin-right: auto;
}

.add-people-actions button {
  border: 0;
  border-radius: 18px;
  min-height: 36px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.add-people-actions .ghost {
  background: transparent;
  color: #667285;
}

.add-people-actions button:hover {
  background: #084dbb;
}

.add-people-actions .ghost:hover {
  background: #f1f5ff;
  color: #334155;
}

.users-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px clamp(16px, 4vw, 60px);
  display: grid;
  align-content: start;
  gap: 18px;
}

.user-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.user-form > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.user-form strong {
  color: #253246;
  font-size: 15px;
}

.user-form output {
  color: #b3261e;
  font-size: 13px;
  text-align: right;
}

.user-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.user-fields label {
  display: grid;
  gap: 6px;
  color: #4b5565;
  font-size: 13px;
  font-weight: 800;
}

.user-fields input {
  width: 100%;
  height: 40px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  color: #202124;
  background: #fff;
  padding: 0 11px;
  outline: none;
}

.user-fields input:disabled {
  color: #667285;
  background: #f5f7fb;
}

.user-fields input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #0b57d019;
}

.user-form-actions,
.user-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.user-form-actions button,
.user-row-actions button {
  border: 0;
  border-radius: 18px;
  min-height: 36px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.user-form-actions .ghost,
.user-row-actions .ghost {
  background: transparent;
  color: #667285;
}

.user-row-actions .danger {
  background: transparent;
  color: #b3261e;
}

.user-form-actions button:hover,
.user-row-actions button:hover {
  background: #084dbb;
}

.user-form-actions .ghost:hover,
.user-row-actions .ghost:hover {
  background: #f1f5ff;
  color: #334155;
}

.user-row-actions .danger:hover {
  background: #fceeee;
  color: #8c1d18;
}

.users-list {
  display: grid;
  gap: 8px;
}

.user-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
}

.user-row b,
.user-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row small {
  color: var(--muted);
  margin-top: 2px;
}

#history {
  padding: 24px clamp(16px, 4vw, 60px);
  min-height: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  margin: auto;
  text-align: center;
  color: #8390a0;
  display: grid;
  gap: 7px;
}

.empty b {
  color: #3d4857;
}

.message {
  max-width: min(720px, 82%);
  padding: 10px 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px 15px 15px 15px;
  box-shadow: 0 2px 6px #1f355308;
  position: relative;
}

.message.outgoing {
  align-self: flex-end;
  background: #e6efff;
  border-radius: 15px 6px 15px 15px;
}

.message.bot {
  border-color: #b8edf3;
  background: #f0fbfc;
}

.message.system {
  align-self: center;
  max-width: min(620px, 90%);
  background: transparent;
  border-style: dashed;
  color: #667285;
  box-shadow: none;
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #7a8798;
  margin-bottom: 5px;
}

.meta b {
  color: #3b67bb;
}

.message.bot .meta b {
  color: #087c8c;
}

.message p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  line-height: 1.45;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.message-action,
.edit-actions button {
  border: 0;
  background: transparent;
  color: #667285;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  padding: 0;
}

.message-action:hover,
.edit-actions button:hover {
  color: var(--blue);
  text-decoration: underline;
}

.edit-form {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.edit-form textarea {
  width: min(560px, 100%);
  min-height: 78px;
  resize: vertical;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 9px;
  color: #202124;
  background: #fff;
  outline: none;
}

.edit-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #0b57d019;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.edit-actions button:last-child {
  color: var(--blue);
}

#composer {
  margin: 0 clamp(14px, 3vw, 45px) 20px;
  background: white;
  border: 1px solid #dce2eb;
  border-radius: 14px;
  padding: 9px;
  display: flex;
  align-items: end;
  gap: 8px;
  box-shadow: 0 8px 30px #22355510;
}

#composer textarea {
  resize: none;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 9px;
  max-height: 140px;
  min-height: 40px;
}

#composer textarea:focus {
  box-shadow: none;
}

#composer button {
  min-height: 40px;
  border-radius: 20px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mic-button {
  width: 40px;
  justify-content: center;
  padding: 0 !important;
  background: #eef3fb !important;
  color: #4b5f7c !important;
  flex: 0 0 auto;
}

.mic-button:hover {
  background: #e2ebfa !important;
  color: var(--blue) !important;
}

.mic-button.recording {
  background: #b3261e !important;
  color: white !important;
}

.mic-button.busy {
  background: #f1f5ff !important;
  color: var(--blue) !important;
}

.login button:hover,
#composer button:hover {
  background: #084dbb;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  position: relative;
}

.sidebar-tool {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-align: left;
}

.sidebar-tool:hover,
.sidebar-tool.active {
  background: #f1f5ff;
  color: var(--blue);
}

.sidebar-tool.danger {
  color: #b3261e;
}

.sidebar-tool.danger:hover {
  background: #fceeee;
  color: #8c1d18;
}

.sidebar-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.account-menu-toggle {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #202124;
  cursor: pointer;
  padding: 8px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
}

.account-menu-toggle:hover {
  background: #f1f5ff;
}

.account-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px #22355514;
}

.account-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #dbe6ff;
  color: #2759c4;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.account-menu-toggle b,
.account-menu-toggle small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-toggle small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.account-menu-toggle i {
  color: #667285;
  font-style: normal;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #202a38;
  color: white;
  padding: 12px 16px;
  border-radius: 9px;
  pointer-events: none;
  box-shadow: 0 14px 38px #10182733;
}

@media (max-width: 820px) {
  .login {
    align-items: flex-start;
    padding: 24px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: auto;
    padding: 36px 28px;
    border-radius: 24px;
  }

  .brand-logo {
    width: 52px;
    margin-bottom: 30px;
  }

  .login h1 {
    font-size: 40px;
    margin-bottom: 18px;
  }

  .login p {
    font-size: 19px;
  }

  .login-fields {
    padding-top: 0;
  }

  main {
    grid-template-columns: 1fr;
  }

  aside {
    display: none;
  }

  .mobile-menu {
    display: grid;
    place-items: center;
  }

  .message {
    max-width: 94%;
  }

  .user-fields,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-row-actions {
    justify-content: flex-start;
  }

  #composer {
    margin: 0 12px 14px;
  }

  #composer button span {
    display: none;
  }
}
