.aide-page {
  background: var(--bg, #f7f7f5);
  min-height: 100vh;
  padding-bottom: 72px;
}

.aide-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, #e5e5e0);
  background: var(--white, #fff);
  flex-wrap: wrap;
  gap: 12px;
}

.aide-topnav { display: flex; gap: 24px; }
.aide-topnav a { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted, #6b6b66); }
.aide-topnav a.active { color: var(--text, #141414); }

.aide-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.aide-intro { margin-bottom: 28px; }
.aide-intro h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  margin: 0 0 10px;
}
.aide-sub { margin: 0 0 8px; color: var(--text-muted); font-size: 0.95rem; max-width: 560px; }
.aide-hours { margin: 0; font-size: 0.82rem; color: var(--text-muted); }

.aide-chat-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

.aide-chat-card {
  background: var(--white, #fff);
  border: 1px solid var(--border, #e5e5e0);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  max-height: min(72vh, 640px);
}

.aide-chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #e5e5e0);
  background: linear-gradient(180deg, #fafaf8 0%, #fff 100%);
}

.aide-agent { display: flex; align-items: center; gap: 12px; }
.aide-agent strong { display: block; font-size: 0.95rem; }
.aide-agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #141414;
  color: #c8f542;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
}
.aide-agent-status {
  font-size: 0.78rem;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aide-agent-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.aide-identify {
  padding: 20px;
  display: grid;
  gap: 14px;
}
.aide-identify[hidden] { display: none !important; }
.aide-identify-lead { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.aide-identify-fields { display: grid; gap: 12px; }
.aide-identify-fields label { display: grid; gap: 6px; }
.aide-identify-fields label span { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.aide-identify-fields input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.aide-identify-hint { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

.aide-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.aide-msg {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}
.aide-msg time {
  display: block;
  font-size: 0.72rem;
  margin-top: 6px;
  opacity: 0.65;
}
.aide-msg--client {
  align-self: flex-end;
  background: #141414;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aide-msg--admin {
  align-self: flex-start;
  background: #f0f0eb;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.aide-msg--system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 8px;
}

.aide-compose {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #fafaf8;
  align-items: flex-end;
}
.aide-compose[hidden] { display: none !important; }
.aide-compose-field {
  flex: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.aide-compose textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 44px;
  max-height: 120px;
}
.aide-attach-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text-muted, #6b6b66);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.aide-attach-btn:hover {
  color: var(--text, #141414);
  border-color: #c8c8c2;
  background: #fff;
}
.aide-image-preview {
  position: relative;
  display: inline-flex;
  max-width: 120px;
}
.aide-image-preview[hidden] { display: none !important; }
.aide-image-preview img {
  width: 100%;
  max-height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.aide-image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #141414;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.aide-compose .btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
}
.aide-msg-image-link {
  display: block;
  margin-bottom: 6px;
}
.aide-msg-image {
  display: block;
  max-width: min(220px, 100%);
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
}
.aide-msg-text {
  display: block;
  white-space: pre-wrap;
}

.aide-error {
  margin: 0;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #b91c1c;
  background: #fef2f2;
}
.aide-error[hidden] { display: none !important; }

.aide-aside {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.aide-aside h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}
.aide-aside ul {
  margin: 0 0 16px;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--text-muted);
  display: grid;
  gap: 8px;
}
.aide-aside-contact {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .aide-chat-wrap { grid-template-columns: 1fr; }
  .aide-aside { order: -1; }
  .aide-chat-card { max-height: min(65vh, 520px); }
}