:root {
  --brand-gold: #D4891C;
  --brand-gold-light: #E9A83A;
  --brand-gold-dark: #B5731A;
  --brand-bg: #0D0D0D;
  --brand-surface: #1A1A1A;
  --brand-surface-2: #242424;
  --brand-text: #F5F0E8;
  --brand-text-muted: #A89B8C;
  --brand-border: #333;
  --chat-user: #D4891C;
  --chat-ziggy: #242424;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--brand-bg);
  color: var(--brand-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.logo-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  gap: 8px;
}

.logo-header img {
  height: 32px;
  width: auto;
}

.logo-header .tagline {
  font-size: 10px;
  color: var(--brand-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  gap: 12px;
}

.chat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-bg);
  flex-shrink: 0;
}

.chat-header .info h2 {
  font-size: 16px;
  font-weight: 600;
}

.chat-header .info p {
  font-size: 12px;
  color: var(--brand-text-muted);
}

.location-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--brand-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  max-width: 160px;
  text-align: right;
}

.location-status .loc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.location-status .loc-dot.detecting {
  background: var(--brand-gold);
  animation: pulse-dot 1.2s infinite;
}

.location-status .loc-dot.matched {
  background: #4CAF50;
  box-shadow: 0 0 0 2.5px var(--brand-gold);
}

.location-status .loc-dot.unmatched {
  background: #4CAF50;
}

.location-status .loc-dot.denied {
  background: #666;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.location-status .loc-text {
  line-height: 1.3;
}

.context-bar {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.context-bar::-webkit-scrollbar {
  display: none;
}

.ctx-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--brand-surface-2);
  color: var(--brand-text-muted);
  border: 1px solid var(--brand-border);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.ctx-chip.active {
  background: var(--brand-gold);
  color: var(--brand-bg);
  border-color: var(--brand-gold);
}

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

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.5;
  animation: msgIn 0.25s ease;
  word-wrap: break-word;
}

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

.message.user {
  align-self: flex-end;
  background: var(--chat-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.ziggy {
  align-self: flex-start;
  background: var(--chat-ziggy);
  color: var(--brand-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--brand-border);
}

.message .consultation-prelude {
  color: var(--brand-gold-light);
  font-style: italic;
  margin-bottom: 8px;
  font-size: 13px;
}

.message .local-says {
  background: rgba(212, 137, 28, 0.1);
  border-left: 3px solid var(--brand-gold);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: var(--chat-ziggy);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--brand-border);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-gold);
  animation: bounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.plan-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 8px 0;
  max-width: 100%;
}

.plan-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-gold);
  margin-bottom: 4px;
}

.plan-card .duration {
  font-size: 12px;
  color: var(--brand-text-muted);
  margin-bottom: 12px;
}

.plan-step {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--brand-border);
}

.plan-step:last-child {
  border-bottom: none;
}

.plan-step .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-gold);
  color: var(--brand-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.plan-step .step-content {
  flex: 1;
}

.plan-step .step-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.plan-step .step-why {
  font-size: 13px;
  color: var(--brand-text-muted);
  margin-bottom: 4px;
}

.plan-step .step-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--brand-text-muted);
}

.plan-step .step-meta a {
  color: var(--brand-gold);
  text-decoration: none;
}

.alternatives-toggle {
  padding: 10px;
  text-align: center;
  color: var(--brand-gold);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-top: 1px solid var(--brand-border);
  margin-top: 8px;
}

.alternatives {
  display: none;
}

.alternatives.show {
  display: block;
}

.alt-plan {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--brand-border);
}

.alt-plan h4 {
  font-size: 14px;
  color: var(--brand-gold-light);
  margin-bottom: 8px;
}

.booking-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-gold);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 8px 0;
}

.booking-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-gold);
  margin-bottom: 4px;
}

.booking-card .booking-detail {
  font-size: 13px;
  color: var(--brand-text-muted);
  margin: 2px 0;
}

.booking-card .booking-why {
  font-size: 14px;
  margin: 8px 0;
}

.booking-card .booking-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.booking-card .booking-actions a {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.action-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
  max-width: 85%;
  align-self: flex-start;
}

.action-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--brand-gold);
  background: transparent;
  color: var(--brand-gold);
}

.action-chip:hover {
  background: var(--brand-gold);
  color: var(--brand-bg);
}

.action-chip.primary {
  background: var(--brand-gold);
  color: var(--brand-bg);
}

.action-chip.primary:hover {
  background: var(--brand-gold-light);
}

.input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
  align-items: flex-end;
}

.input-bar textarea {
  flex: 1;
  background: var(--brand-surface-2);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--brand-text);
  font-family: var(--font);
  font-size: 15px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: var(--transition);
}

.input-bar textarea:focus {
  border-color: var(--brand-gold);
}

.input-bar textarea::placeholder {
  color: var(--brand-text-muted);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--brand-gold-light);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--brand-bg);
}

.share-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(212, 137, 28, 0.15);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 13px;
}

.share-banner a {
  color: var(--brand-gold);
  font-weight: 500;
}

.share-banner button {
  margin-left: auto;
  background: var(--brand-gold);
  color: var(--brand-bg);
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.attribution {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--brand-text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--brand-border);
}

.attribution .local-badge {
  background: var(--brand-gold);
  color: var(--brand-bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.share-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
  min-height: 100dvh;
}

.share-hero {
  padding: 32px 20px;
  text-align: center;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
}

.share-hero h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-gold);
  margin-bottom: 4px;
}

.share-hero .share-meta {
  font-size: 13px;
  color: var(--brand-text-muted);
}

.share-content {
  padding: 20px;
}

.remix-btn {
  display: block;
  width: 100%;
  padding: 16px;
  text-align: center;
  background: var(--brand-gold);
  color: var(--brand-bg);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin: 20px 0;
  transition: var(--transition);
}

.remix-btn:hover {
  background: var(--brand-gold-light);
}

.admin-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.admin-page h1 {
  color: var(--brand-gold);
  margin-bottom: 20px;
}

.admin-login {
  max-width: 400px;
  margin: 80px auto;
  padding: 32px;
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-border);
}

.admin-login h2 {
  color: var(--brand-gold);
  margin-bottom: 20px;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--brand-text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--brand-surface-2);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  color: var(--brand-text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand-gold);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font);
}

.btn-primary {
  background: var(--brand-gold);
  color: var(--brand-bg);
}

.btn-primary:hover {
  background: var(--brand-gold-light);
}

.btn-secondary {
  background: var(--brand-surface-2);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.agent-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.agent-card h3 {
  color: var(--brand-gold);
  margin-bottom: 4px;
}

.agent-card .agent-meta {
  font-size: 13px;
  color: var(--brand-text-muted);
  margin-bottom: 8px;
}

.agent-card .agent-actions {
  display: flex;
  gap: 8px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-border);
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  color: var(--brand-gold);
  margin-bottom: 16px;
}

.test-result {
  background: var(--brand-surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--brand-text-muted);
}

.empty-state h3 {
  color: var(--brand-gold);
  margin-bottom: 8px;
}

.logo-header {
  position: relative;
}

.profile-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand-text-muted);
  transition: var(--transition);
}

.profile-btn:hover {
  border-color: var(--brand-gold);
  color: var(--brand-gold);
}

.profile-btn.logged-in {
  border-color: var(--brand-gold);
  color: var(--brand-gold);
  background: rgba(212, 137, 28, 0.1);
}

.profile-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100dvh;
  background: var(--brand-surface);
  border-left: 1px solid var(--brand-border);
  z-index: 200;
  padding: 20px;
  overflow-y: auto;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

.profile-panel.open {
  right: 0;
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.profile-panel-header h3 {
  color: var(--brand-gold);
  font-size: 18px;
}

.profile-close {
  background: none;
  border: none;
  color: var(--brand-text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}

.profile-close:hover {
  color: var(--brand-text);
}

.profile-saved {
  color: var(--brand-gold);
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
  display: none;
}

.profile-saved.show {
  display: block;
}

@media (min-width: 768px) {
  .chat-container {
    border-left: 1px solid var(--brand-border);
    border-right: 1px solid var(--brand-border);
  }
}
