/* ==========================================================================
   BzHub Connect Command Center — stylesheet
   Sections: tokens, reset, layout, sidebar/topbar, components, pages, responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ---- 1. Design tokens ---------------------------------------------------- */
:root {
  --background: #faf8f3;
  --foreground: #1c1a16;
  --surface: #ffffff;
  --surface-2: #f6f2e8;
  --border: #e7e0cf;
  --border-strong: #d8cead;
  --muted: #f1ece0;
  --muted-foreground: #6b6456;
  --accent: #b8901e;
  --accent-foreground: #1c1a16;
  --accent-soft: #f0c75e;
  --sidebar: #0f0e0c;
  --sidebar-foreground: #efe9db;
  --sidebar-muted: #a89f8b;
  --sidebar-border: #262319;
  --success: #3f7d52;
  --success-soft: #e4efe6;
  --warning: #b8862b;
  --warning-soft: #f6ebd6;
  --danger: #b3463c;
  --danger-soft: #f5e4e1;
  --info: #3d6f8e;
  --info-soft: #e3edf2;
  --shadow: 0 1px 2px rgba(20, 16, 8, 0.04), 0 8px 24px rgba(20, 16, 8, 0.06);
  --radius: 12px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;
}

html[data-theme='dark'] {
  --background: #0b0b0c;
  --foreground: #efe9db;
  --surface: #161512;
  --surface-2: #1c1a16;
  --border: #2a2822;
  --border-strong: #3a362c;
  --muted: #1d1b17;
  --muted-foreground: #a89f8b;
  --accent: #d4af37;
  --accent-foreground: #0b0b0c;
  --accent-soft: #f0c75e;
  --sidebar: #08080a;
  --sidebar-foreground: #efe9db;
  --sidebar-muted: #8f8877;
  --sidebar-border: #201f1a;
  --success: #6fbf86;
  --success-soft: #17251b;
  --warning: #e0ac4c;
  --warning-soft: #2b2013;
  --danger: #e0776a;
  --danger-soft: #2c1917;
  --info: #7fb3d1;
  --info-soft: #16232b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---- 2. Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 0.4em; line-height: 1.2; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; }
table { border-collapse: collapse; width: 100%; }

/* ---- 3. App shell layout -------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar__brand img { width: 40px; height: 40px; border-radius: 50%; }
.sidebar__brand-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.sidebar__brand-tag { font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--sidebar-muted); }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(239, 233, 219, 0.8);
  margin-bottom: 2px;
}
.sidebar__link:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-foreground); }
.sidebar__link.is-active { background: rgba(212, 175, 55, 0.15); color: var(--accent-soft); }
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar__footer { padding: 16px 20px; border-top: 1px solid var(--sidebar-border); font-size: 0.7rem; color: var(--sidebar-muted); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35;
}

.app-main { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { font-size: 1.5rem; margin: 0; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--foreground);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

.content { padding: 28px; flex: 1; }

/* ---- 4. Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent;
  background: var(--muted);
  color: var(--foreground);
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.btn:hover { opacity: 0.9; }
.btn--primary { background: var(--accent); color: var(--accent-foreground); }
.btn--outline { background: transparent; border-color: var(--border-strong); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 14px; font-size: 0.8rem; }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 5. Cards, grids -------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__body { padding: 22px; }
.card__header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card__header h2, .card__header h3 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card__label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); margin-bottom: 6px; }
.stat-card__value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; }
.stat-card--accent { border-color: var(--accent); }
.stat-card--accent .stat-card__value { color: var(--accent); }

.section-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* ---- 6. Badges / pills ------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge--new-lead, .badge--not-paid { background: var(--info-soft); color: var(--info); }
.badge--contacted, .badge--partially-paid { background: var(--warning-soft); color: var(--warning); }
.badge--conversation-started { background: var(--info-soft); color: var(--info); }
.badge--qualified, .badge--deposit-paid { background: var(--warning-soft); color: var(--warning); }
.badge--pricing-sent { background: var(--warning-soft); color: var(--warning); }
.badge--awaiting-payment { background: var(--warning-soft); color: var(--warning); }
.badge--won, .badge--paid-in-full, .badge--completed { background: var(--success-soft); color: var(--success); }
.badge--lost, .badge--overdue { background: var(--danger-soft); color: var(--danger); }
.badge--follow-up-later { background: var(--muted); color: var(--muted-foreground); }
.badge--cold { background: var(--info-soft); color: var(--info); }
.badge--warm { background: var(--warning-soft); color: var(--warning); }
.badge--hot { background: var(--danger-soft); color: var(--danger); }

.tag-pill { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); font-size: 0.72rem; font-weight: 500; margin: 2px; }

/* ---- 7. Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.data-table { min-width: 720px; }
.data-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted-foreground); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--muted); }
.data-table a.row-link { font-weight: 600; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--muted-foreground); }

/* ---- 8. Forms ------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group--full { grid-column: 1 / -1; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--muted-foreground); }
.form-control {
  padding: 10px 13px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--foreground); font-size: 0.92rem;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
.form-hint { font-size: 0.78rem; color: var(--muted-foreground); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }

/* ---- 9. Flash messages ---------------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem; font-weight: 500; }
.flash--success { background: var(--success-soft); color: var(--success); }
.flash--error { background: var(--danger-soft); color: var(--danger); }
.flash--info { background: var(--info-soft); color: var(--info); }

/* ---- 10. Empty / coming soon ------------------------------------------------------ */
.empty-state {
  min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; border: 1px dashed var(--border-strong); border-radius: 16px; padding: 40px; background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty-state h2 { font-size: 1.5rem; }
.empty-state p { max-width: 420px; color: var(--muted-foreground); }

/* ---- 11. Pipeline / dashboard widgets ----------------------------------------------- */
.pipeline { display: flex; flex-direction: column; gap: 10px; }
.pipeline__row { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 12px; font-size: 0.85rem; }
.pipeline__track { background: var(--muted); border-radius: 999px; height: 10px; overflow: hidden; }
.pipeline__fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); border-radius: 999px; }
.pipeline__count { text-align: right; font-weight: 600; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-item__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-item__meta { font-size: 0.78rem; color: var(--muted-foreground); }
.activity-item__action { font-weight: 600; font-size: 0.88rem; }

/* ---- 12. Kanban ------------------------------------------------------------------------ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban__column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 200px; }
.kanban__column-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; }
.kanban__card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: grab; }
.kanban__card:active { cursor: grabbing; }
.kanban__card h4 { font-size: 0.95rem; margin-bottom: 4px; }
.kanban__card-meta { font-size: 0.76rem; color: var(--muted-foreground); }
.kanban__column.is-dragover { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ---- 13. Checklist ----------------------------------------------------------------------- */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist__item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist__item:last-child { border-bottom: none; }
.checklist__item.is-done .checklist__label { text-decoration: line-through; color: var(--muted-foreground); }

/* ---- 14. Login page ----------------------------------------------------------------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--background);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; right: -120px; top: 50%; transform: translateY(-50%);
  width: 620px; height: 620px; background: url('../images/globe.png') center/contain no-repeat;
  opacity: 0.14; pointer-events: none;
}
.login-card { position: relative; z-index: 1; width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 36px 32px; text-align: center; }
.login-card img { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-card p.subtitle { color: var(--muted-foreground); font-size: 0.85rem; margin-bottom: 24px; }
.login-card .form-group { text-align: left; }
.login-card .btn { width: 100%; margin-top: 8px; }

/* ---- 15. Utility ---------------------------------------------------------------------------- */
.text-muted { color: var(--muted-foreground); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters-bar .form-control { max-width: 220px; }
.small-text { font-size: 0.78rem; }

/* ---- 16. Responsive ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-overlay.is-open { display: block; }
  .app-main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .topbar__title { font-size: 1.2rem; }
  .content { padding: 16px; }
  .btn span.btn-label { display: none; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
