:root {
  --navy: #f52020;
  --navy-light: #30517e;
  --gold: #d8b781;
  --gold-light: #e8c98a;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --success: #1a7f4b;
  --success-bg: #e6f6ee;
  --error: #b3261e;
  --error-bg: #fdecea;
  --border: #e5e7eb;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.navbar .brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}
.navbar .brand span { color: var(--gold-light); }
.navbar .brand:hover { text-decoration: none; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-links a {
  color: #e6e9ef;
  font-size: 14.5px;
}
.nav-links a:hover { color: var(--gold-light); text-decoration: none; }
.nav-badge {
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: 4px;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.role-pill {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  flex: 1;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { margin: 0; font-size: 26px; }
.page-header p.subtitle { color: var(--muted); margin: 4px 0 0; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 7px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); text-decoration: none; }
.btn-gold { background: var(--gold); color: #1a1a1a; }
.btn-gold:hover { background: var(--gold-light); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; text-decoration: none; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  border-left: 4px solid var(--gold);
}
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.listing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.listing-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #dfe3e8;
}
.listing-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.listing-card h3 { margin: 0 0 6px; font-size: 17px; }
.listing-card .meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.listing-card .price { font-weight: 700; color: var(--navy); font-size: 16px; margin-bottom: 10px; }
.listing-card .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--error-bg); color: var(--error); }
.badge-pending { background: #fff4e0; color: #a15c00; }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--error-bg); color: var(--error); }
.badge-neutral { background: #eef0f3; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:last-child td { border-bottom: none; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.form-group .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0a1730 100%);
}
.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.auth-card p.tagline { color: var(--muted); margin: 0 0 26px; font-size: 14px; }

.flash { padding: 12px 16px; border-radius: 7px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #b7e4cc; }
.flash-error { background: var(--error-bg); color: var(--error); border: 1px solid #f3c2be; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  background: #eef0f3;
  color: var(--text);
}
.tabs a.active { background: var(--navy); color: #fff; }
.tabs a:hover { text-decoration: none; opacity: 0.9; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f8fafc; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); margin-top: 6px; flex-shrink: 0;
}
.notif-dot.read { background: transparent; }

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0a1730 100%);
  color: #fff;
  text-align: center;
  padding: 20px;
}
.hero h1 { font-size: 40px; margin-bottom: 10px; }
.hero p { color: #cdd6e5; font-size: 16px; max-width: 520px; margin: 0 auto 28px; }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 20px;
}

.section-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 30px 0 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.section-title:first-child { margin-top: 0; }
.text-muted { color: var(--muted); }
.mb-0 { margin-bottom: 0; }

/* Avatars */
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; border: 2px solid rgba(255,255,255,0.3);
}
.avatar-lg {
  width: 110px; height: 110px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--border);
}
.profile-header { display: flex; align-items: center; gap: 22px; margin-bottom: 24px; }
.profile-header h2 { margin: 0 0 4px; }

/* Listing image gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.gallery img { width: 100%; height: 260px; object-fit: cover; border-radius: 8px; background: #dfe3e8; }
.video-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--navy); color: #fff; padding: 8px 16px;
  border-radius: 7px; font-size: 13.5px; font-weight: 600;
}
.video-link:hover { background: var(--navy-light); text-decoration: none; }
.file-input-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hidden { display: none !important; }

/* Receipt */
.receipt-card { max-width: 620px; margin: 0 auto; }
.receipt-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:20px; border-bottom:1px solid var(--border); padding-bottom:16px; }
.receipt-header h2 { margin:0; color: var(--navy); }
.receipt-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px dashed var(--border); font-size:14px; }
.receipt-row:last-child { border-bottom:none; }
.receipt-row .label { color: var(--muted); }
.receipt-total { font-size:20px; font-weight:700; color: var(--navy); text-align:right; margin-top:14px; }

@media print {
  .navbar, .page-header a, .no-print, .footer-note { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; box-shadow: none; }
}

/* Floating chat widget */
.chat-widget { position: fixed; bottom: 22px; right: 22px; z-index: 1000; font-family: inherit; }
.chat-widget-toggle {
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: var(--navy); color: #fff; font-size: 24px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15,37,69,0.35);
}
.chat-widget-toggle:hover { background: var(--navy-light); }
.chat-widget-panel {
  position: absolute; bottom: 72px; right: 0;
  width: 320px; max-height: 480px;
  background: #fff; border-radius: 12px; border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-widget-header {
  background: var(--navy); color: #fff; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.chat-widget-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; }
.chat-widget-body { padding: 14px 16px; overflow-y: auto; }
.chat-widget-option {
  display: block; width: 100%; text-align: left; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 10px; cursor: pointer; text-decoration: none; color: var(--text);
}
.chat-widget-option:hover { background: #eef2f7; text-decoration: none; }
.chat-widget-option strong { display: block; font-size: 13.5px; color: var(--navy); }
.chat-widget-option span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-widget-back {
  background: none; border: none; color: var(--muted); font-size: 12.5px;
  cursor: pointer; padding: 0 0 10px; text-align: left;
}
.chat-widget-messages { max-height: 260px; overflow-y: auto; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; max-width: 85%; }
.chat-bubble-user { background: var(--navy); color: #fff; align-self: flex-end; }
.chat-bubble-assistant { background: #f0f2f5; color: var(--text); align-self: flex-start; }
.chat-bubble-typing { font-style: italic; color: var(--muted); }
.chat-widget-ai-form { display: flex; gap: 8px; }
.chat-widget-ai-form input[type=text] { flex: 1; }
.chat-widget-callback .form-group { margin-bottom: 10px; }
.chat-widget-callback label { font-size: 12.5px; }

/* ============ App Shell: Sidebar + Topbar (authenticated pages) ============ */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 246px;
  flex-shrink: 0;
  background: var(--navy);
  color: #e6e9ef;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px;
  font-size: 19px;
  font-weight: 700;
}
.sidebar-brand a { color: #fff; }
.sidebar-brand a:hover { text-decoration: none; }
.sidebar-brand span { color: var(--gold-light); }
.sidebar-close-btn { display: none; background: none; border: none; color: #fff; cursor: pointer; padding: 4px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: #c9d2e0; font-size: 14px; font-weight: 500;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.sidebar-link.active { background: var(--gold); color: #1a1a1a; font-weight: 700; }
.sidebar-icon { display: flex; align-items: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: #fff; }
.sidebar-user:hover { text-decoration: none; }
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.sidebar-user-info .role-pill { font-size: 10px; padding: 1px 8px; width: fit-content; }
.sidebar-logout { background: none; border: none; color: #c9d2e0; cursor: pointer; padding: 6px; border-radius: 6px; display: flex; }
.sidebar-logout:hover { background: rgba(255,255,255,0.08); color: #fff; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 150;
}
.sidebar-backdrop.visible { display: block; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 60px;
}
.topbar-menu-btn { display: none; background: none; border: none; color: var(--navy); cursor: pointer; padding: 4px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--navy); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-icon-btn { position: relative; display: flex; color: var(--navy); }
.topbar-badge { position: absolute; top: -6px; right: -8px; }
.topbar-avatar { display: flex; }
.topbar-avatar .avatar-sm { border-color: var(--border); }

.app-content { flex: 1; padding: 28px 22px 60px; }
.app-content .container { padding: 0; max-width: 1100px; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block; }
  .topbar-menu-btn { display: block; }
  .app-content { padding: 20px 16px 60px; }
}

/* ============ Dashboard ============ */
.dash-header {
  /* background: linear-gradient(135deg, var(--navy) 0%, #8ca5cc 100%); */
  background-image: url(/assets1/img/invest.gif);
  background-size: cover;
  border-radius: 14px;
  padding: 26px 28px;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.dash-header h1 { margin: 0 0 6px; font-size: 23px; }
.dash-header p { margin: 0; color: #cdd6e5; font-size: 14px; }
.dash-header .role-pill { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.28); color: #fff; }

.stat-card { display: flex; align-items: flex-start; gap: 14px; }
.stat-card-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(198,151,73,0.14); color: var(--gold);
}
.stat-card-body { flex: 1; min-width: 0; }
.stat-card.accent-blue { border-left-color: #2563eb; }
.stat-card.accent-blue .stat-card-icon { background: rgba(37,99,235,0.1); color: #2563eb; }
.stat-card.accent-green { border-left-color: #1a7f4b; }
.stat-card.accent-green .stat-card-icon { background: rgba(26,127,75,0.1); color: #1a7f4b; }
.stat-card.accent-purple { border-left-color: #7c3aed; }
.stat-card.accent-purple .stat-card-icon { background: rgba(124,58,237,0.1); color: #7c3aed; }
.stat-card.accent-red { border-left-color: #b3261e; }
.stat-card.accent-red .stat-card-icon { background: rgba(179,38,30,0.1); color: #b3261e; }

.section-heading { font-size: 15px; font-weight: 700; color: var(--navy); margin: 30px 0 14px; }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.quick-action-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; color: var(--text);
}
.quick-action-card:hover { border-color: var(--navy); text-decoration: none; box-shadow: 0 4px 14px rgba(15,37,69,0.08); }
.quick-action-card .qa-icon {
  width: 38px; height: 38px; border-radius: 9px; background: rgba(15,37,69,0.06); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.quick-action-card strong { font-size: 14px; }
.quick-action-card span.qa-desc { font-size: 12px; color: var(--muted); }

.recent-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.recent-list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.recent-list-item:last-child { border-bottom: none; }
.recent-list-item .rli-main { min-width: 0; }
.recent-list-item .rli-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-list-item .rli-sub { color: var(--muted); font-size: 12px; }

/* Rich text editor (Quill) */
.quill-editor-wrap .ql-toolbar.ql-snow {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: #fafbfc;
}
.quill-editor-wrap .ql-container.ql-snow {
  border: 1px solid var(--border);
  border-radius: 0 0 7px 7px;
  font-family: inherit;
  font-size: 14px;
  min-height: 160px;
}
.quill-editor-wrap .ql-editor { min-height: 160px; }
.quill-editor-wrap .ql-editor.ql-blank::before { color: #9aa1ab; font-style: normal; }

/* Rendered rich text (listing descriptions) */
.rich-text { line-height: 1.65; }
.rich-text p { margin: 0 0 12px; }
.rich-text h1, .rich-text h2, .rich-text h3 { color: var(--navy); margin: 18px 0 10px; }
.rich-text ul, .rich-text ol { margin: 0 0 12px; padding-left: 22px; }
.rich-text li { margin-bottom: 4px; }
.rich-text blockquote {
  border-left: 3px solid var(--gold);
  margin: 0 0 12px; padding: 4px 0 4px 14px;
  color: var(--muted); font-style: italic;
}
.rich-text a { color: var(--navy); text-decoration: underline; }
