/* wave_inbox — app-like messenger */
:root {
  --wi-bg: #0f1419;
  --wi-surface: #1a222c;
  --wi-surface-2: #232d3a;
  --wi-border: #2e3a4a;
  --wi-text: #e8eef5;
  --wi-muted: #8b9bb0;
  --wi-accent: #3dbea0;
  --wi-accent-dim: #2a8f78;
  --wi-guest: #2a3544;
  --wi-staff: #1e4d42;
  --wi-danger: #e07171;
  --wi-radius: 18px;
  --wi-font: "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--wi-font);
  background: var(--wi-bg);
  color: var(--wi-text);
  -webkit-font-smoothing: antialiased;
}

.wi-app {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(61, 190, 160, 0.12), transparent 55%),
    var(--wi-bg);
}

.wi-header {
  padding: 1rem 1.15rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--wi-border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.wi-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--wi-accent), var(--wi-accent-dim));
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #06241c;
  flex-shrink: 0;
}
.wi-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.wi-header p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--wi-muted);
}

.wi-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.wi-gate {
  margin: auto 0;
  padding: 0.5rem 0 1.5rem;
}
.wi-gate h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}
.wi-gate .lead {
  color: var(--wi-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}
.wi-field {
  margin-bottom: 0.85rem;
}
.wi-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--wi-muted);
  margin-bottom: 0.35rem;
}
.wi-field input, .wi-field textarea {
  width: 100%;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface);
  color: var(--wi-text);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  outline: none;
}
.wi-field input:focus, .wi-field textarea:focus {
  border-color: var(--wi-accent);
}
.wi-hint {
  font-size: 0.75rem;
  color: var(--wi-muted);
  margin-top: 0.35rem;
}
.wi-error {
  color: var(--wi-danger);
  font-size: 0.85rem;
  margin: 0.5rem 0;
  min-height: 1.2em;
}

.wi-btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--wi-accent);
  color: #06241c;
  width: 100%;
}
.wi-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.wi-btn--ghost {
  background: var(--wi-surface-2);
  color: var(--wi-text);
}

.wi-bubble {
  max-width: 85%;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: wi-in 0.25s ease;
}
@keyframes wi-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.wi-bubble--guest {
  align-self: flex-start;
  background: var(--wi-guest);
  border-bottom-right-radius: 6px;
}
.wi-bubble--staff {
  align-self: flex-end;
  background: var(--wi-staff);
  border-bottom-left-radius: 6px;
}
.wi-bubble--system {
  align-self: center;
  background: transparent;
  color: var(--wi-muted);
  font-size: 0.8rem;
  text-align: center;
  max-width: 95%;
}
.wi-meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.65;
}

.wi-composer {
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--wi-border);
  display: flex;
  gap: 0.5rem;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(10px);
}
.wi-composer textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface);
  color: var(--wi-text);
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
  font: inherit;
}
.wi-composer button {
  width: auto;
  padding-inline: 1rem;
  flex-shrink: 0;
}

.wi-hidden { display: none !important; }

/* Staff two-pane */
.wi-staff {
  max-width: none;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  background: var(--wi-bg);
}
.wi-sidebar {
  border-left: 1px solid var(--wi-border);
  display: flex;
  flex-direction: column;
  background: var(--wi-surface);
  min-height: 0;
}
.wi-sidebar-head {
  padding: 1rem;
  border-bottom: 1px solid var(--wi-border);
}
.wi-sidebar-head h1 { margin: 0; font-size: 1.1rem; }
.wi-sidebar-head nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.wi-sidebar-head a {
  color: var(--wi-accent);
  text-decoration: none;
  font-size: 0.8rem;
}
.wi-thread-list {
  overflow-y: auto;
  flex: 1;
}
.wi-thread-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wi-border);
  cursor: pointer;
}
.wi-thread-item:hover, .wi-thread-item.is-active {
  background: var(--wi-surface-2);
}
.wi-thread-item strong { display: block; font-size: 0.92rem; }
.wi-thread-item span {
  display: block;
  color: var(--wi-muted);
  font-size: 0.78rem;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wi-badge {
  display: inline-block;
  background: var(--wi-accent);
  color: #06241c;
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  margin-inline-start: 0.35rem;
  font-weight: 700;
}
.wi-chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wi-empty-pane {
  margin: auto;
  color: var(--wi-muted);
  text-align: center;
  padding: 2rem;
}

@media (max-width: 800px) {
  .wi-staff {
    grid-template-columns: 1fr;
  }
  .wi-staff.is-chat .wi-sidebar { display: none; }
  .wi-staff:not(.is-chat) .wi-chat-pane { display: none; }
}
