:root {
  --bg: #0a1014;
  --bg-soft: #111b21;
  --panel: rgba(17, 27, 33, 0.92);
  --panel-2: #202c33;
  --line: rgba(255, 255, 255, 0.075);
  --text: #e9edef;
  --muted: #98aab4;
  --muted-2: #6d7f88;
  --green: #00a884;
  --green-2: #1dbf73;
  --green-3: #10382e;
  --amber: #ffb02e;
  --danger: #ff6b6b;
  --bubble-in: #1b2a31;
  --bubble-out: #025143;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(0, 168, 132, 0.18), transparent 25%),
    radial-gradient(circle at right, rgba(255, 176, 46, 0.1), transparent 18%),
    linear-gradient(180deg, #081217 0%, #101922 100%);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.wa-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr) 360px;
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.wa-sidebar,
.wa-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.wa-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.wa-main {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(rgba(10, 16, 20, 0.82), rgba(10, 16, 20, 0.9)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.035), transparent 42%);
}

.wa-brand,
.wa-quickstat,
.wa-panel__section,
.wa-chat-item,
.wa-participant-item,
.wa-status-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: var(--shadow);
}

.wa-notice {
  border: 1px solid rgba(255, 176, 46, 0.18);
  background: rgba(255, 176, 46, 0.08);
  color: #ffd58f;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
}

.wa-brand {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  padding: 12px 14px;
}

.wa-brand__icon,
.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  color: #031610;
  background: linear-gradient(135deg, #1bd741, #00a884);
}

.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  font-size: 14px;
  color: #d7fff5;
  background: linear-gradient(135deg, #203139, #35505b);
}

.wa-avatar--lg {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 16px;
}

.wa-brand__copy {
  min-width: 0;
}

.wa-brand__eyebrow {
  color: var(--green-2);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.wa-brand__title {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-brand__meta,
.wa-chat-subtitle,
.wa-panel__meta,
.wa-composer-status,
.wa-chat-item__meta,
.wa-chat-item__preview,
.wa-participant-item__meta,
.wa-field__label {
  color: var(--muted);
  font-size: 13px;
}

.wa-status-pill,
.wa-panel__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wa-status-pill.is-ready,
.wa-panel__tag.is-ready {
  background: rgba(0, 168, 132, 0.18);
  color: #73ffd6;
  border-color: rgba(0, 168, 132, 0.4);
}

.wa-status-pill.is-authenticated,
.wa-panel__tag.is-authenticated {
  background: rgba(255, 176, 46, 0.14);
  color: #ffd489;
  border-color: rgba(255, 176, 46, 0.3);
}

.wa-status-pill.is-error,
.wa-panel__tag.is-error {
  background: rgba(255, 107, 107, 0.12);
  color: #ffb8b8;
  border-color: rgba(255, 107, 107, 0.28);
}

.wa-toolbar,
.wa-quickstats {
  display: grid;
  gap: 8px;
}

.wa-actions,
.wa-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wa-quickstats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wa-quickstat {
  border-radius: 14px;
  padding: 8px 12px;
}

.wa-quickstat__label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.wa-quickstat__value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
}

.wa-field {
  display: grid;
  gap: 6px;
}

.wa-field--grow {
  min-width: 0;
}

.wa-search,
.wa-composer__input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.wa-search:focus,
.wa-composer__input:focus {
  border-color: rgba(0, 168, 132, 0.45);
  background: rgba(255, 255, 255, 0.075);
}

/* File input — hide the native text, only show styled button */
.wa-composer__file {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 0;
  color: transparent;
  cursor: pointer;
  overflow: hidden;
  outline: none;
  transition: border-color 0.16s ease;
}

.wa-composer__file:focus {
  border-color: rgba(0, 168, 132, 0.45);
}

.wa-composer__file::file-selector-button {
  height: 100%;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.wa-composer__file::file-selector-button:hover {
  background: rgba(0, 168, 132, 0.12);
  color: #7effd8;
}

.wa-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.wa-btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.wa-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.wa-btn--primary {
  background: linear-gradient(135deg, #00a884, #1bd741);
  color: #042019;
  border: 0;
  font-weight: 800;
}

.wa-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.wa-chat-list,
.wa-participant-list {
  overflow: auto;
  display: grid;
  gap: 10px;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
}

.wa-chat-item,
.wa-participant-item,
.wa-status-card,
.wa-panel__section {
  border-radius: 18px;
  padding: 14px;
}

.wa-panel__section:last-child {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-chat-item {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.wa-chat-item::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 168, 132, 0.7), transparent);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.wa-chat-item:hover::after,
.wa-chat-item.is-active::after {
  opacity: 1;
}

.wa-chat-item.is-active {
  background: rgba(0, 168, 132, 0.14);
  border-color: rgba(0, 168, 132, 0.4);
}

.wa-chat-item__layout,
.wa-participant-item__layout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.wa-chat-item__content,
.wa-participant-item__content {
  min-width: 0;
}

.wa-chat-item__top,
.wa-participant-item__top,
.wa-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wa-chat-item__name,
.wa-chat-title,
.wa-panel__title {
  font-weight: 800;
}

.wa-chat-item__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-item__preview {
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.wa-chat-item__badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--green);
  color: #04130e;
  font-size: 11px;
  font-weight: 800;
}

.wa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 27, 33, 0.82);
  backdrop-filter: blur(12px);
}

.wa-chat-header__identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.wa-chat-title {
  font-size: 21px;
}

.wa-messages {
  padding: 22px;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.02), transparent 20%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.wa-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 460px;
}

.wa-empty__title {
  font-size: 20px;
  color: var(--text);
  font-weight: 800;
  margin-bottom: 6px;
}

.wa-message {
  max-width: min(78%, 780px);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--bubble-in);
  justify-self: start;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.wa-message.is-out {
  background: var(--bubble-out);
  justify-self: end;
}

.wa-message__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: #b9d7cd;
  font-size: 11px;
  margin-bottom: 6px;
}

.wa-message.is-out .wa-message__meta {
  color: #d6f8eb;
}

.wa-message__body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.46;
}

.wa-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 100px;
  gap: 10px;
  padding: 12px 18px 8px;
  border-top: 1px solid var(--line);
  background: rgba(17, 27, 33, 0.88);
}

.wa-composer-status {
  padding: 0 22px 16px;
  min-height: 20px;
}

.wa-composer-status.is-success {
  color: #76ffd7;
}

.wa-composer-status.is-error {
  color: #ffb9b9;
}

.wa-status-card {
  min-height: 150px;
  display: grid;
  gap: 10px;
}

.wa-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-status-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.wa-status-row__label {
  color: var(--muted);
  font-size: 13px;
}

.wa-status-row__value {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  max-width: 58%;
  word-break: break-word;
}

.wa-participant-item__meta {
  margin-top: 6px;
}

.wa-participant-item__role {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(0, 168, 132, 0.14);
  color: #7effd8;
  font-size: 11px;
  font-weight: 700;
}

.wa-scrollbar::-webkit-scrollbar,
.wa-chat-list::-webkit-scrollbar,
.wa-participant-list::-webkit-scrollbar,
.wa-messages::-webkit-scrollbar {
  width: 10px;
}

.wa-scrollbar::-webkit-scrollbar-thumb,
.wa-chat-list::-webkit-scrollbar-thumb,
.wa-participant-list::-webkit-scrollbar-thumb,
.wa-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

@media (max-width: 1240px) {
  .wa-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .wa-panel {
    display: none;
  }
}

@media (max-width: 880px) {
  body {
    overflow: auto;
  }

  .wa-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .wa-main {
    min-height: 54vh;
  }

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

  .wa-chat-header {
    align-items: start;
  }

  .wa-quickstats {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════
   LOGIN OVERLAY
═══════════════════════════════════════════════════════════ */
.wa-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left,  rgba(0, 168, 132, 0.22), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 176, 46, 0.12), transparent 24%),
    linear-gradient(180deg, #060e13 0%, #0d1a22 100%);
  animation: loginFadeIn 0.3s ease;
}

@keyframes loginFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wa-login-card {
  width: min(92vw, 420px);
  background: rgba(16, 26, 34, 0.96);
  border: 1px solid rgba(0, 168, 132, 0.22);
  border-radius: 28px;
  padding: 36px 32px 32px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 32px 80px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(0, 168, 132, 0.08);
  animation: loginSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes loginSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.wa-login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.wa-login-brand__icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  color: #031610;
  background: linear-gradient(135deg, #1bd741, #00a884);
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0, 168, 132, 0.4);
}

.wa-login-brand__copy {
  min-width: 0;
}

.wa-login-brand__eyebrow {
  color: var(--green-2);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.wa-login-brand__title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.wa-login-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  border-left: 3px solid rgba(0, 168, 132, 0.5);
  padding-left: 12px;
}

.wa-login-subtitle strong {
  color: #7effd8;
}

.wa-login-form {
  display: grid;
  gap: 14px;
}

.wa-login-field {
  display: grid;
  gap: 6px;
}

.wa-login-field__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wa-login-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 16px;
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.wa-login-input:focus {
  border-color: rgba(0, 168, 132, 0.55);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.12);
}

.wa-login-btn {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #00a884, #1bd741);
  color: #042019;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 24px rgba(0, 168, 132, 0.35);
}

.wa-login-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 168, 132, 0.45);
}

.wa-login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.wa-login-error {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
  color: #ffb8b8;
  font-size: 13px;
  line-height: 1.45;
}

/* ═══════════════════════════════════════════════════════════
   USER BAR
═══════════════════════════════════════════════════════════ */
.wa-user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(0, 168, 132, 0.07);
  border: 1px solid rgba(0, 168, 132, 0.18);
}

.wa-user-bar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  color: #031610;
  background: linear-gradient(135deg, #1bd741, #00a884);
  flex-shrink: 0;
}

.wa-user-bar__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.wa-user-bar__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-user-bar__role {
  font-size: 11px;
  color: #7effd8;
  font-weight: 600;
}

.wa-user-bar__logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid rgba(255, 107, 107, 0.22);
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.07);
  color: #ffb8b8;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.wa-user-bar__logout:hover {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.4);
  transform: translateY(-1px);
}
