:root {
  --red: #E5342A;
  --red-dark: #C22921;
  --ink: #1A1A1A;
  --gray: #6B6B6B;
  --line: #EBEBEB;
  --bg: #FAFAFA;
  --white: #FFFFFF;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--red); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- Auth pages ---------- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg); padding: 24px;
}
.auth-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 40px 32px; width: 100%; max-width: 380px;
}
.auth-logo { font-size: 28px; font-weight: 800; color: var(--red); letter-spacing: 1px; }
.auth-tagline { color: var(--gray); margin: 4px 0 28px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; color: var(--gray); margin-top: 12px; }
.auth-form input {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.auth-form input:focus { outline: none; border-color: var(--red); }
.auth-error {
  background: #FDECEA; color: var(--red-dark); padding: 10px 14px; border-radius: 8px;
  font-size: 14px; margin-bottom: 16px;
}
.auth-switch { margin-top: 20px; font-size: 14px; color: var(--gray); text-align: center; }

.btn-primary {
  background: var(--red); color: white; border: none; border-radius: 8px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 18px;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary {
  background: white; color: var(--red); border: 1px solid var(--red); border-radius: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-block;
}

/* ---------- App shell ---------- */
.app-body { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 220px; background: var(--white); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 12px; flex-shrink: 0;
}
.sidebar-logo { font-size: 22px; font-weight: 800; color: var(--red); padding: 8px 12px 24px; }
.sidebar-link {
  color: var(--ink); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--bg); }
.sidebar-link.active { background: #FDECEA; color: var(--red-dark); font-weight: 600; }
.sidebar-logout { margin-top: auto; color: var(--gray); }

.page-main { flex: 1; padding: 32px 40px; max-width: 900px; }
.page-main h1 { font-size: 24px; margin-bottom: 4px; }
.page-sub { color: var(--gray); font-size: 14px; margin-bottom: 24px; max-width: 560px; }
.section-heading { font-size: 16px; margin-top: 32px; }
.empty-note { color: var(--gray); font-size: 14px; }

/* ---------- Chat ---------- */
.chat-main { flex: 1; display: flex; flex-direction: column; height: 100vh; }
.chat-header { padding: 18px 28px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.chat-header-title { font-weight: 700; }
.chat-header-sub { font-size: 13px; color: var(--gray); }
.chat-log { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 65%; padding: 12px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; }
.bubble.ai { background: var(--white); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { background: var(--red); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble-image { max-width: 220px; border-radius: 10px; display: block; margin-bottom: 6px; }
.chat-input-row {
  display: flex; align-items: center; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--line);
}
.chat-input-row input[type=text] {
  flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 24px; font-size: 15px;
}
.chat-input-row input[type=text]:focus { outline: none; border-color: var(--red); }
.chat-input-row .btn-primary { margin-top: 0; border-radius: 20px; }
.attach-btn, .upload-btn {
  cursor: pointer; font-size: 18px; padding: 8px; border-radius: 50%;
}
.hidden-file-input { display: none; }

.summary-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-top: 10px; font-size: 14px;
}
.summary-row { margin-bottom: 4px; }
.approve-project-btn { width: 100%; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.project-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.project-card-img { width: 100%; height: 130px; object-fit: cover; display: block; }
.project-card-body { padding: 14px; }
.project-card-title { font-weight: 700; margin-bottom: 6px; }
.project-card-row { font-size: 13px; color: var(--gray); margin-top: 4px; }
.status-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; margin: 4px 0; }
.status-pending { background: #FFF4E5; color: #B26A00; }
.status-active { background: #E6F4EA; color: #1E7E34; }
.status-paused { background: #F1F1F1; color: var(--gray); }
.status-completed { background: #EAEAFB; color: #4B4BCB; }

/* ---------- Account ---------- */
.wallet-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 420px; }
.wallet-balance-label { color: var(--gray); font-size: 13px; }
.wallet-balance-amount { font-size: 32px; font-weight: 800; margin: 4px 0 18px; }
.topup-form { display: flex; gap: 8px; }
.topup-form input { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.topup-form .btn-primary { margin-top: 0; }
.topup-status { margin-top: 12px; font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--bg); }
.tx-list { margin-top: 12px; }
.tx-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tx-type { font-weight: 600; font-size: 14px; }
.tx-note { font-size: 12px; color: var(--gray); }
.tx-amount { font-weight: 700; }
.tx-credit { color: #1E7E34; }
.tx-debit { color: var(--red-dark); }

/* ---------- Facebook connect ---------- */
.fb-status { margin-bottom: 20px; font-size: 14px; }
.fb-steps { max-width: 560px; line-height: 1.8; font-size: 14px; }
.fb-form { max-width: 420px; margin-top: 24px; display: flex; flex-direction: column; gap: 6px; }
.fb-form label { font-size: 13px; color: var(--gray); }
.fb-form input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.banner-success { background: #E6F4EA; color: #1E7E34; padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
