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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  --bg: #f5f4ee;
  --bg-raised: #faf9f5;
  --bg-inset: #ece9de;
  --fg: #161616;
  --fg-muted: #4b4b48;
  --fg-subtle: #8a8a85;
  --border: rgba(22, 22, 22, 0.12);
  --border-strong: rgba(22, 22, 22, 0.25);
  --accent: #FF5C00;
  --accent-hover: #E05200;
  --accent-bg: rgba(255, 92, 0, 0.1);
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.06);

  --radius: 4px;
  --radius-sm: 3px;
  --radius-lg: 6px;
  --transition: 120ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  font-feature-settings: 'ss01', 'ss02', 'cv11', 'liga';
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 0.925rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

::selection { background: var(--accent-bg); }

/* ===== UTILITIES ===== */
.prose-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
  font-weight: 500;
}

.text-muted { color: var(--fg-muted); }
.text-subtle { color: var(--fg-subtle); }
.text-accent { color: var(--accent); }

.hairline { border-color: var(--border); }

/* ===== NAV ===== */
.nav {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}

.nav-brand:hover { text-decoration: none; }
.nav-brand .logo-dot { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ===== AVATAR ===== */
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-initial.sm { width: 20px; height: 20px; font-size: 0.55rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-inset);
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn-primary:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: var(--bg);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}
.btn-ghost:hover {
  background: var(--bg-inset);
  border-color: transparent;
  color: var(--fg);
}

.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--fg-subtle);
  padding: 0.25rem 0.4rem;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}
.idea-row:hover .btn-danger { opacity: 1; }
.btn-danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.75rem; }

.btn-join {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
  font-size: 0.75rem;
}
.btn-join:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-leave {
  background: transparent;
  color: var(--fg-subtle);
  border-color: var(--border);
  font-size: 0.75rem;
}
.btn-leave:hover {
  background: var(--bg-inset);
  color: var(--fg-muted);
}

/* ===== LAYOUT ===== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1.2;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.page-count {
  font-size: 0.8rem;
  color: var(--fg-subtle);
}

/* ===== IDEA LIST ===== */
.idea-list {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.idea-row {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: default;
}

.idea-row:last-child { border-bottom: none; }
.idea-row:hover { background: rgba(22, 22, 22, 0.03); }

.idea-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.idea-title {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
}

.idea-description {
  color: var(--fg-muted);
  font-size: 0.835rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.idea-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.idea-meta-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: wrap;
}

.idea-author {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--fg-subtle);
  font-weight: 500;
}

.idea-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  background: var(--bg-inset);
  color: var(--fg-muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 500;
}

/* ===== PARTICIPANTS ===== */
.participants {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.participant-faces {
  display: flex;
  align-items: center;
}

.participant-faces .avatar,
.participant-faces .avatar-initial {
  margin-left: -4px;
  border: 2px solid var(--bg);
}

.participant-faces .avatar:first-child,
.participant-faces .avatar-initial:first-child { margin-left: 0; }

.participant-faces .avatar { width: 20px; height: 20px; }

.participant-count {
  font-size: 0.7rem;
  color: var(--fg-subtle);
  font-weight: 500;
  margin-left: 0.15rem;
}

.participant-names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.participant-chip .avatar-initial { width: 14px; height: 14px; font-size: 0.45rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 0.85rem; }

.form-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
  color: var(--fg-subtle);
  margin-bottom: 0.3rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--fg-subtle); }

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

/* ===== TAG INPUT ===== */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 34px;
  align-items: center;
}

.tag-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.tag-input-wrapper .tag {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.tag-remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 0.8rem;
  line-height: 1;
}
.tag-remove:hover { opacity: 1; }

.tag-input-field {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 0.835rem;
  font-family: var(--font-sans);
  outline: none;
  padding: 0.1rem 0;
}
.tag-input-field::placeholder { color: var(--fg-subtle); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 22, 22, 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 12vh 1.5rem 2rem;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
  animation: modal-in 0.15s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-subtle);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--fg); background: var(--bg-inset); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 1rem;
}

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  text-align: center;
  max-width: 340px;
  width: 100%;
  padding: 2rem;
}

.login-brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.25rem;
}

.login-brand .dot { color: var(--accent); }

.login-subtitle {
  color: var(--fg-subtle);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.login-domain {
  color: var(--fg-subtle);
  font-size: 0.7rem;
  margin-top: 0.85rem;
  font-weight: 500;
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(185, 28, 28, 0.12);
  color: var(--danger);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.login-users {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dev-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.btn-google {
  background: var(--fg);
  color: var(--bg);
  font-size: 0.85rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  gap: 0.5rem;
  border: 1px solid var(--fg);
}
.btn-google:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: var(--bg);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.35rem;
}

.empty-state-text {
  color: var(--fg-subtle);
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  background: var(--bg-inset);
  color: var(--fg-subtle);
}

.status-pitching { background: #EFF6FF; color: #2563EB; }
.status-accepted { background: #F0FDF4; color: #16A34A; }
.status-building { background: #FFFBEB; color: #D97706; }
.status-demo { background: #FDF2F8; color: #DB2777; }
.status-completed { background: #F0FDF4; color: #15803D; }

/* ===== REACTIONS ===== */
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  color: var(--fg-muted);
}

.reaction-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-inset);
}

.reaction-active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.reaction-add {
  color: var(--fg-subtle);
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
}

.reaction-picker {
  position: relative;
  display: inline-flex;
}

.reaction-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.3rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.3rem;
  display: flex;
  gap: 0.15rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 10;
}

.reaction-menu-item {
  padding: 0.25rem 0.4rem;
  border: none;
  background: none;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.reaction-menu-item:hover { background: var(--bg-inset); }

.join-request-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 240px;
}

.form-error {
  background: var(--danger-bg);
  border: 1px solid rgba(185, 28, 28, 0.12);
  color: var(--danger);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ===== HTMX ===== */
.htmx-indicator { opacity: 0; transition: opacity 0.1s; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .nav { padding: 0 1rem; }
  .container { padding: 2rem 1rem; }
  .idea-meta-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .login-card { padding: 1.5rem 1rem; }
}
