/* Open Paddock.ai Public Chat — Unified Monochrome Dark Theme (matches openpaddock.ai/) */
:root {
  --bg: #000000;
  --surface: #0A0A0A;
  --surface-elevated: #141414;
  --surface-muted: #171717;
  --border: #262626;
  --border-hover: #404040;
  --text: #FFFFFF;
  --text-secondary: #D4D4D4;
  --text-muted: #A3A3A3;
  --text-dim: #737373;
  --accent: #FFFFFF;
  --accent-text: #000000;
  --accent-soft: #171717;
  --danger: #F87171;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-bd: rgba(239, 68, 68, 0.35);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-secondary); }
a:hover { color: var(--text); }

.chat-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 100%;
}

/* Topbar */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
  background: #1F1F1F;
  border-color: var(--border-hover);
  color: var(--text);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover {
  background: #E5E5E5;
  border-color: #E5E5E5;
  color: #000000;
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--surface-muted);
  border-color: transparent;
  color: var(--text);
}
.btn-danger {
  color: var(--danger);
  border-color: var(--danger-bd);
  background: var(--danger-bg);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--danger);
  color: #FCA5A5;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Body layout */
.chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Sidebar */
.chat-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-head {
  padding: 12px 14px;
  border-bottom: 1px solid #1F1F1F;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.session-item:hover {
  background: var(--surface-elevated);
  color: var(--text);
}
.session-item.active {
  background: var(--surface-muted);
  border-color: var(--border-hover);
  color: var(--text);
  font-weight: 600;
}
.session-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.session-del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 12px;
  border-radius: 4px;
}
.session-del:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid #1F1F1F;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main conversation area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 28px;
}

.messages-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 12px 18px;
}
.empty-state h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.empty-state p {
  margin: 0 auto 24px;
  max-width: 480px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}

.starter-chip {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  transition: border-color 0.15s, background 0.15s;
}
.starter-chip:hover {
  border-color: var(--border-hover);
  background: var(--surface-elevated);
}
.starter-chip small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 3px;
}

/* Profile card */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}
.profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text);
}
.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.role-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  font-size: 11.5px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.role-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.role-chip.selected {
  background: #FFFFFF;
  border-color: #FFFFFF;
  color: #000000;
  font-weight: 600;
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.airport-input {
  width: 90px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  text-transform: uppercase;
  background: var(--surface-elevated);
  color: var(--text);
}
.airport-input:focus {
  outline: none;
  border-color: #525252;
}

/* Message bubbles */
.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}
.msg-user { align-items: flex-end; }
.msg-assistant { align-items: flex-start; }

.msg-bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  max-width: 92%;
  word-break: break-word;
}
.msg-user .msg-bubble {
  background: #1C1C1C;
  color: var(--text);
  border: 1px solid #333333;
  border-bottom-right-radius: 4px;
}
.msg-assistant .msg-bubble {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-bubble strong { color: var(--text); }
.msg-bubble a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.msg-bubble a:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}
.msg-bubble p { margin: 0 0 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 4px 0 8px; padding-left: 18px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.tool-badge {
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.grounding-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.source-chip:hover {
  border-color: #525252;
  color: var(--text);
}
.source-kind {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* Soft-gate card */
.gate-card {
  background: var(--surface);
  border: 1px solid #404040;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}
.gate-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--text);
}
.gate-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Composer */
.composer-wrap {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px 14px;
  flex-shrink: 0;
}
.composer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.composer-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface-elevated);
  border: 1px solid #2E2E2E;
  border-radius: 10px;
  padding: 6px 6px 6px 12px;
}
.composer-form:focus-within {
  border-color: #525252;
}
.composer-input {
  flex: 1;
  resize: none;
  border: none;
  padding: 6px 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  max-height: 120px;
  background: transparent;
  color: var(--text);
}
.composer-input::placeholder { color: var(--text-dim); }
.composer-input:focus { outline: none; }

.composer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}

.hidden { display: none !important; }

/* Settings Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid #333333;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1F1F1F;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.field-input:focus {
  outline: none;
  border-color: #525252;
}
.field-input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #1F1F1F;
}

.modal-danger {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #1F1F1F;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-feedback {
  font-size: 12px;
  color: #4ADE80;
  min-height: 16px;
}

/* Auth Modal & Strong Password Checklist */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active {
  background: #262626;
  color: var(--text);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #262626;
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  font-weight: 600;
}
.btn-google:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.pw-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-field-wrap .field-input {
  padding-right: 54px;
}
.pw-toggle-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-family: inherit;
}
.pw-toggle-btn:hover { color: var(--text); }

.pw-hidden-username {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.pw-strength-bar {
  height: 4px;
  border-radius: 999px;
  background: #262626;
  overflow: hidden;
  margin-top: 2px;
}
.pw-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.pw-checklist {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
}
.pw-checklist li {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pw-checklist li.met {
  color: #4ADE80;
}

.link-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--text); }

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.settings-divider {
  border: none;
  border-top: 1px solid #1F1F1F;
  margin: 2px 0;
}

.settings-pw-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.provider-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

@media (max-width: 768px) {
  .chat-sidebar {
    position: fixed;
    top: 53px;
    bottom: 0;
    left: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.75);
  }
  .chat-sidebar.open { transform: translateX(0); }
  .starter-grid { grid-template-columns: 1fr; }
}
