:root {
  --bg: #ffffff;
  --text: #0f1419;
  --muted: #536471;
  --border: #eff3f4;
  --primary: #1d9bf0;
  --primary-hover: #1a8cd8;
  --danger: #f4212e;
  --success: #00ba7c;
  --hover-bg: #f7f9f9;
  --pill-bg: #eff3f4;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
textarea, input, select { font-family: inherit; }

.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: #cfd9de; color: var(--text); background: #fff; }
.btn-outline:hover { background: var(--hover-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.compose-open-btn { width: calc(100% - 24px); margin: 12px; }

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 275px minmax(0, 600px) 350px;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
}
.app-shell--guest { grid-template-columns: 1fr; }

/* Side nav */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-weight: 800;
  font-size: 20px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 500;
  width: fit-content;
}
.nav-link:hover { background: var(--hover-bg); }
.nav-link.active { font-weight: 800; }
.nav-icon { font-size: 22px; width: 26px; text-align: center; }
.nav-link--btn { background: none; border: none; cursor: pointer; width: 100%; text-align: left; }
.logout-form { margin-top: auto; }

/* Main column */
.main-col {
  border-right: 1px solid var(--border);
  min-height: 100vh;
}
.feed-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  z-index: 5;
}
.feed-header h1 { margin: 0; font-size: 20px; }

.compose-inline {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.compose-inline-trigger {
  flex: 1;
  text-align: left;
  background: var(--pill-bg);
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

/* Avatars */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--pill-bg); }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 96px; height: 96px; border: 4px solid #fff; }

/* Post card */
.post-list--single .post-card { border-bottom: none; }
.post-card { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.post-relook-banner { color: var(--muted); font-size: 13px; font-weight: 700; margin-left: 56px; margin-bottom: 4px; }
.post-main { display: flex; gap: 12px; }
.post-body-col { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 15px; }
.post-name { font-weight: 700; }
.post-name:hover { text-decoration: underline; }
.post-handle, .post-dot, .post-time { color: var(--muted); }
.post-time:hover { text-decoration: underline; }
.post-delete { margin-left: auto; }
.post-delete-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px; }
.post-text { white-space: pre-wrap; word-wrap: break-word; margin: 2px 0 8px; font-size: 15px; }
.post-text a { color: var(--primary); }

.post-images {
  display: grid;
  gap: 2px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}
.post-images--1 { grid-template-columns: 1fr; }
.post-images--2 { grid-template-columns: 1fr 1fr; }
.post-images--3 { grid-template-columns: 1fr 1fr; }
.post-images--3 .post-image-frame:first-child { grid-row: span 2; }
.post-images--4 { grid-template-columns: 1fr 1fr; }
.post-images--5 { grid-template-columns: repeat(6, 1fr); }
.post-images--5 .post-image-frame:nth-child(1) { grid-column: span 3; }
.post-images--5 .post-image-frame:nth-child(2) { grid-column: span 3; }
.post-images--5 .post-image-frame:nth-child(n+3) { grid-column: span 2; }
.post-image-frame { display: block; background: var(--pill-bg); aspect-ratio: 1 / 1; overflow: hidden; }
.post-image-frame img { width: 100%; height: 100%; object-fit: cover; }
.post-images--1 .post-image-frame { aspect-ratio: 16 / 10; }

.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; max-width: 425px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.action-btn:hover { background: var(--hover-bg); }
.action-like.is-active { color: #ffab00; }
.action-relook.is-active { color: var(--success); }
.action-connect.is-active { color: var(--primary); }
.action-icon { font-size: 16px; }

.post-comments { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.comments-list .comment-item { display: flex; gap: 8px; padding: 8px 0; font-size: 14px; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.comment-form--standalone { padding: 12px 16px; border-bottom: 1px solid var(--border); }

.load-more { text-align: center; padding: 20px; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }

/* Side widgets */
.side-widgets { padding: 12px; }
.widget { background: var(--hover-bg); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.widget h3 { margin: 0 0 8px; font-size: 18px; }
.suggest-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.suggest-user { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.suggest-user span { display: flex; flex-direction: column; min-width: 0; }
.suggest-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-handle { color: var(--muted); font-size: 13px; }

/* Compose modal */
.compose-modal { position: fixed; inset: 0; z-index: 50; }
.compose-modal[hidden] { display: none; }
.compose-modal__backdrop { position: absolute; inset: 0; background: rgba(91,112,131,0.4); }
.compose-modal__panel {
  position: relative;
  max-width: 600px;
  margin: 5vh auto;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
}
.compose-modal__close { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.compose-body { display: flex; gap: 12px; }
.compose-body textarea {
  flex: 1;
  border: none;
  resize: none;
  font-size: 18px;
  min-height: 120px;
  outline: none;
}
.compose-preview { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 8px 56px; }
.compose-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.compose-actions { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; margin-left: 56px; }
.compose-count { color: var(--muted); font-size: 13px; margin-left: auto; }

/* Forms / auth */
.auth-card { max-width: 420px; margin: 40px auto; padding: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form--inline { flex-direction: row; align-items: center; }
.auth-form label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="tel"],
.auth-form input[type="password"], .auth-form input[type="number"], .auth-form input[type="url"],
.auth-form textarea, .auth-form select {
  border: 1px solid #cfd9de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  width: 100%;
}
.auth-form textarea { min-height: 80px; resize: vertical; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.field-hint { color: var(--muted); font-size: 13px; margin: -6px 0 0; }
.auth-switch { text-align: center; font-size: 14px; margin-top: 16px; }
.auth-switch a { color: var(--primary); font-weight: 700; }

.flash { padding: 12px 16px; border-radius: 8px; margin: 12px 16px; font-size: 14px; }
.flash--error { background: #fdecea; color: #c0392b; }
.flash--success { background: #e8f8f0; color: #0a7a4d; }

/* Profile */
.profile-header { padding: 16px; border-bottom: 1px solid var(--border); }
.profile-header h1 { margin: 8px 0 0; font-size: 20px; }
.profile-handle { color: var(--muted); margin: 0 0 8px; }
.profile-bio { margin: 0 0 12px; }
.profile-stats { display: flex; gap: 16px; margin-bottom: 12px; font-size: 14px; }
.profile-stats strong { color: var(--text); }

.single-comments { padding: 0 0 24px; }
.single-comments h2 { padding: 16px; margin: 0; font-size: 18px; border-bottom: 1px solid var(--border); }
.comment-row { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.comment-row p { margin: 4px 0 0; }

/* Settings */
.settings-page { padding: 16px; max-width: 500px; }
.settings-section { margin-bottom: 32px; }
.settings-avatar-row { display: flex; align-items: center; gap: 16px; }

/* Landing */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; }
.landing-nav-actions { display: flex; gap: 12px; }
.landing-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; }
.landing-hero h1 { font-size: 56px; margin: 0 0 8px; background: linear-gradient(90deg, var(--primary), #7856ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-sub { font-size: 22px; font-weight: 700; margin: 0; }
.landing-tagline { color: var(--muted); font-size: 17px; margin: 8px 0 0; max-width: 480px; }
.landing-mission { font-weight: 700; font-size: 17px; margin: 12px 0 24px; }
.landing-cta { display: flex; gap: 12px; }

/* Admin */
.admin-body { background: var(--hover-bg); }
.admin-shell { display: grid; grid-template-columns: 220px 1fr; max-width: 1200px; margin: 0 auto; min-height: 100vh; }
.admin-nav { background: #fff; border-right: 1px solid var(--border); padding: 16px 8px; display: flex; flex-direction: column; gap: 4px; }
.admin-main { padding: 24px; }
.admin-stat-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 24px; text-align: center; min-width: 120px; }
.admin-stat-num { display: block; font-size: 26px; font-weight: 800; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
.admin-table th { background: var(--hover-bg); font-size: 12px; text-transform: uppercase; color: var(--muted); }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 400px; }
.admin-search input { flex: 1; border: 1px solid #cfd9de; border-radius: 8px; padding: 8px 12px; }
.credit-wallet-form { display: inline-flex; gap: 4px; align-items: center; }
.credit-wallet-amount { width: 90px; border: 1px solid #cfd9de; border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.admin-post-body { max-width: 320px; }
.badge { display: inline-block; background: var(--pill-bg); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; margin-right: 4px; }
.badge--ok { background: #e8f8f0; color: #0a7a4d; }
.badge--danger { background: #fdecea; color: #c0392b; }
.inline-form { display: inline-block; }

/* Marketplace */
.product-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.product-price { font-weight: 800; font-size: 15px; }
.compose-sell-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 56px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.sell-toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.compose-price-input { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.compose-price-input input {
  border: 1px solid #cfd9de;
  border-radius: 8px;
  padding: 6px 10px;
  width: 100px;
  font-size: 14px;
}

.wallet-page { padding: 16px; max-width: 600px; }
.wallet-balance-card {
  background: linear-gradient(135deg, var(--primary), #7856ff);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}
.wallet-actions-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wallet-balance-label { font-size: 13px; opacity: 0.85; }
.wallet-balance-amount { font-size: 32px; font-weight: 800; }
.money-positive { color: var(--success); font-weight: 700; }
.money-negative { color: var(--danger); font-weight: 700; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.85); }
.lightbox img {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  z-index: 1;
}

/* Responsive */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 88px minmax(0, 1fr); }
  .side-widgets { display: none; }
}
@media (max-width: 700px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-top: 1px solid var(--border);
    background: #fff;
    padding: 6px;
    z-index: 20;
  }
  .side-nav .brand, .side-nav .compose-open-btn, .side-nav .nav-label { display: none; }
  .logout-form { margin-top: 0; }
  .main-col { padding-bottom: 0; border-right: none; }
  .side-widgets { display: block; padding: 12px 16px; padding-bottom: 76px; border-top: 8px solid var(--border); }
  .compose-modal__panel { margin: 0; border-radius: 0; min-height: 100vh; }
  .landing-hero h1 { font-size: 36px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
}
