:root {
  --bg: #f2f2f2;
  --bg-elevated: #ffffff;
  --text: #111111;
  --muted: #777777;
  --primary: #2979ff;
  --accent: #3dff7f;
  --danger: #ff4b4b;
  --border: #e0e0e0;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
  --nav-height: 80px;
  --gradient-main: linear-gradient(90deg, var(--accent), var(--primary));
  --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #05060a;
  --bg-elevated: #111320;
  --text: #f7f7ff;
  --muted: #898ca5;
  --border: #26293a;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* Auth */
.auth-screen {
  min-height: 100vh;
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.auth-header {
  margin-bottom: 24px;
}

.logo-text {
  letter-spacing: 0.35em;
  font-weight: 700;
  font-size: 20px;
}

.auth-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.auth-form {
  display: none;
  gap: 12px;
  flex-direction: column;
}

.auth-form.active {
  display: flex;
}

.auth-form label span {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.auth-form input,
.auth-form select {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 15px;
}

.btn-primary,
.btn-secondary {
  border-radius: 999px;
  padding: 12px 18px;
  border: none;
  font-weight: 600;
  font-size: 15px;
}

.btn-primary {
  background-image: var(--gradient-main);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.error-text {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}

/* App wrapper */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: var(--nav-height);
  position: relative;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border-radius: 999px;
  border: none;
  padding: 8px;
  background: var(--bg);
}

/* Views */
.views {
  padding: 12px 12px 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view h2 {
  margin: 8px 4px;
}

.view-subtitle {
  margin: 0 4px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* Feed */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.post-header {
  display: flex;
  padding: 12px 14px 8px;
  gap: 10px;
  align-items: center;
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #ddd;
}

.post-header-info {
  flex: 1;
}

.post-username {
  font-weight: 600;
  font-size: 14px;
}

.post-meta {
  font-size: 12px;
  color: var(--muted);
}

.post-media {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.post-body {
  padding: 10px 14px 6px;
  font-size: 14px;
}

.post-footer {
  padding: 4px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-actions {
  display: flex;
  gap: 8px;
}

.post-actions button {
  border-radius: 999px;
  border: none;
  padding: 6px 10px;
  background: transparent;
  font-size: 14px;
}

.post-actions .liked {
  color: #ff3269;
}

.reserve-btn {
  border-radius: 999px;
  padding: 8px 14px;
  border: none;
  background: #24c36b;
  color: #fff;
  font-size: 13px;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  z-index: 30;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: 0 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.03);
}

.nav-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  margin: 0 12px;
  border-radius: 999px;
  border: none;
  padding: 12px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  background: transparent;
  color: var(--muted);
}

.nav-btn.active {
  background: #111827;
  color: #fff;
}

/* Search */
.search-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.search-icon {
  font-size: 16px;
}

.search-bar-wrapper input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.chip {
  border-radius: 999px;
  border: none;
  padding: 6px 12px;
  background: #e5e7eb;
  font-size: 13px;
}

.chip-active {
  background: #111827;
  color: #fff;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.search-grid img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 12px;
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
}

.map-card {
  padding-bottom: 12px;
}

.mini-map {
  margin-top: 8px;
  border-radius: var(--radius-md);
  height: 150px;
  background: #d1d5db;
}

.card-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.small-card {
  flex: 1;
}

.badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5e7eb;
}

/* Activity */
.segmented-control {
  margin: 6px 0 10px;
  display: flex;
  border-radius: 999px;
  background: #e5e7eb;
  padding: 4px;
}

.segmented-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 14px;
  color: var(--muted);
}

.segmented-btn.active {
  background: #2563eb;
  color: #fff;
}

.activity-panel {
  display: none;
}

.activity-panel.active {
  display: block;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-item {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

/* Chat */
.chat-panel {
  margin-top: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  height: 360px;
}

.chat-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 75%;
  padding: 8px 10px;
  border-radius: 14px;
  margin-bottom: 6px;
  font-size: 13px;
}

.chat-bubble.me {
  margin-left: auto;
  background: #2563eb;
  color: #fff;
}

.chat-bubble.them {
  margin-right: auto;
  background: #e5e7eb;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 10px;
}

/* Perfil */
.profile-header {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  align-items: center;
}

.avatar-circle {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: #d1d5db;
}

.profile-main-info {
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-badge {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  background: #e0edff;
  color: #2563eb;
}

.profile-username,
.profile-location {
  font-size: 13px;
  color: var(--muted);
}

.profile-stats {
  display: flex;
  gap: 12px;
  font-size: 13px;
  margin-top: 4px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  padding: 4px 4px 10px;
}

.big-cta {
  margin: 0 4px 10px;
}

.profile-panel {
  display: none;
}

.profile-panel.active {
  display: block;
}

.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 4px;
}

.profile-posts-grid img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
}

/* Store */
.store-placeholder {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 40;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  padding: 14px 16px 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-vertical input,
.form-vertical textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px 10px;
}

.plan-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* New post */
.new-post-step {
  display: none;
}

.new-post-step.active {
  display: block;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.post-preview {
  margin: 8px 0;
  min-height: 180px;
  border-radius: 16px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.post-preview img,
.post-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sliders */
.slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0;
  font-size: 13px;
}

.slider-label input[type="range"] {
  flex: 1;
  margin-left: 8px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--nav-height);
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
}

/* Misc */
.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-item {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: none;
  padding: 8px 10px;
  background: var(--bg);
  margin-top: 6px;
}

.settings-item.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}