* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #16202b; background: #f4f6f8; }
a { color: #1d4ed8; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.login-card { width: 380px; }
.muted { color: #64748b; }
.small { font-size: 13px; }
.error { color: #b91c1c; }
.hidden { display: none !important; }
.form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
input, select, textarea, button { font-size: 15px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; }
button { background: #0b2a47; color: #fff; cursor: pointer; border: none; }
button.secondary { background: #e2e8f0; color: #16202b; }
button.danger { background: #b91c1c; }
.tabs { display: flex; gap: 8px; }
.tab { background: #e2e8f0; color: #16202b; }
.tab.active { background: #0b2a47; color: #fff; }
header { display: flex; gap: 16px; align-items: center; padding: 12px 20px; background: #0b2a47; color: #fff; }
header #who { flex: 1; opacity: .9; }
header button { background: #f0a500; color: #16202b; }
.layout { display: flex; min-height: calc(100vh - 53px); }
nav { width: 200px; background: #fff; border-right: 1px solid #e2e8f0; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
nav button { background: none; color: #16202b; text-align: left; }
nav button.active { background: #0b2a47; color: #fff; }
main { flex: 1; padding: 20px; overflow: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef2f7; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; }
.stat b { font-size: 24px; display: block; }
.kanban { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; overflow-x: auto; }
.col { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; min-width: 180px; }
.col h3 { margin: 0 0 8px; font-size: 14px; }
.deal-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: 13px; }
.deal-card select { width: 100%; margin-top: 6px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #fef3c7; font-size: 12px; }
.badge.overdue { background: #fee2e2; }
.badge.cold { background: #fee2e2; }
.badge.won { background: #dcfce7; }
.deal-card { cursor: grab; }
.deal-card:active { cursor: grabbing; }
.col.drag-over { outline: 2px dashed #0b2a47; background: #eef4ff; }
#detail .card { margin-top: 14px; }
#quick-add input { min-width: 160px; }
svg text { font-family: inherit; }

/* ---------- New app shell: dark sidebar + white topbar ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 242px; flex-shrink: 0; background: #0a1f33; color: #e2e8f0; display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .logo-text b { color: #fff; font-size: 16px; letter-spacing: .02em; }
.sidebar .logo-text span { color: #f0a500; font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.sidebar nav { width: auto; background: none; border: none; padding: 0; }
.sidebar nav button { background: none; color: #cbd5e1; border-radius: 9px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-size: 14px; width: 100%; text-align: left; }
.sidebar nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav button.active { background: #2563eb; color: #fff; }
.sidebar nav button svg { flex-shrink: 0; }
.sidebar .logout { margin-top: auto; background: none; color: #cbd5e1; display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding: 10px 12px; }
.sidebar .logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.shell.sidebar-collapsed .sidebar { width: 0; padding: 0; overflow: hidden; }
.maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.welcome { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 220px; min-width: 0; }
.welcome b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: #f1f5f9; border-radius: 10px; padding: 8px 12px; flex-shrink: 0; }
.topbar-search input { border: none; background: none; outline: none; padding: 0; font-size: 14px; width: 170px; }
.icon-btn { position: relative; background: none; color: #334155; padding: 8px; border-radius: 50%; }
.icon-btn:hover { background: #f1f5f9; }
.bell-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .avatar { width: 34px; height: 34px; border-radius: 50%; background: #0b2a47; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.user-menu .caret { color: #64748b; font-size: 12px; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; min-width: 170px; z-index: 10; }
.user-menu .menu button { background: none; color: #16202b; text-align: left; }

/* ---------- Dashboard widgets (reference layout, real data) ---------- */
.db-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.db-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; display: flex; gap: 12px; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.db-ico { width: 46px; height: 46px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; font-size: 20px; font-weight: 700; }
.db-ico.blue { background: #2563eb; } .db-ico.green { background: #16a34a; }
.db-ico.purple { background: #7c3aed; } .db-ico.orange { background: #ea580c; }
.db-stat .lbl { color: #64748b; font-size: 13px; }
.db-stat b.num { font-size: 24px; display: block; line-height: 1.2; font-variant-numeric: tabular-nums; }
.db-stat > div { flex: 1; min-width: 0; }
.db-stat .delta { color: #16a34a; font-size: 12px; font-weight: 600; }
.db-stat .delta.down { color: #dc2626; }
.db-spark { margin-left: auto; align-self: center; opacity: .85; flex-shrink: 0; }
.db-grid2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 16px; align-items: start; }
.db-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.db-card h3 { margin: 0 0 14px; font-size: 16px; }
.db-card h4 { margin: 18px 0 8px; font-size: 14px; }
.db-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.db-btns button { font-size: 13px; padding: 8px 14px; border-radius: 8px; }
.btn-blue { background: #2563eb; color: #fff; } .btn-red { background: #dc2626; color: #fff; }
.btn-green { background: #16a34a; color: #fff; } .btn-outline { background: #fff; color: #16202b; border: 1px solid #cbd5e1; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #dbeafe; color: #1d4ed8; }
.pill.booked, .pill.sold, .pill.won { background: #dcfce7; color: #15803d; }
.pill.pending { background: #fef3c7; color: #b45309; }
.pill.lost { background: #fee2e2; color: #b91c1c; }
.db-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.db-table th { text-align: left; color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.db-table td { padding: 10px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.db-props th:nth-child(1), .db-props td:nth-child(1) { width: 52px; }
.db-props th:nth-child(5), .db-props td:nth-child(5) { text-align: right; font-variant-numeric: tabular-nums; }
.db-admin td:nth-child(3) { white-space: nowrap; }
.db-admin th:nth-child(4), .db-admin td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-admin th:nth-child(5), .db-admin td:nth-child(5), .db-admin th:nth-child(6), .db-admin td:nth-child(6) { text-align: center; font-variant-numeric: tabular-nums; }
.db-sess th:nth-child(3), .db-sess td:nth-child(3) { text-align: right; white-space: nowrap; }
.db-done td:nth-child(2) { text-align: right; white-space: nowrap; }
.db-pend td:nth-child(2) { text-align: center; white-space: nowrap; }
.db-thumb { width: 44px; height: 32px; border-radius: 6px; background: linear-gradient(135deg, #0b2a47, #2563eb); display: inline-block; vertical-align: middle; }
.db-donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.db-legend { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 8px; flex: 1; min-width: 150px; }
.db-legend li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; }
.db-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.db-legend .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.db-activity { display: grid; gap: 12px; }
.db-act { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.db-act > div { min-width: 0; }
.db-activity > .db-act + .db-act { padding-top: 12px; border-top: 1px solid #f1f5f9; }
.db-act .adot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.db-act .atime { color: #94a3b8; font-size: 12px; }
.db-section { margin-bottom: 16px; }
@media (max-width: 1000px) {
  .db-stats { grid-template-columns: repeat(2, 1fr); }
  .db-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 20; transform: translateX(-105%); transition: transform .2s; }
  .shell.sidebar-open .sidebar { transform: none; }
  .shell.sidebar-collapsed .sidebar { width: 242px; padding: 16px 12px; }
  .topbar-search input { width: 110px; }
  .db-stats { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar { display: none !important; }
}

/* ---------- UI redesign: Salesforce/HubSpot-style rhythm (overrides above) ---------- */
body { line-height: 1.5; }
main { padding: 24px 28px; }
main h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; margin: 0 0 20px; }
main h3 { font-size: 15px; font-weight: 700; line-height: 1.4; }
.topbar { min-height: 64px; padding: 12px 24px; gap: 16px; }
.topbar-search input { width: 220px; }
.sidebar nav button { padding: 11px 12px; font-weight: 500; }
.sidebar nav button.active { background: #1e40af; box-shadow: inset 3px 0 0 #f0a500; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.db-table td { padding: 13px 16px; line-height: 1.5; }
.db-table th { padding: 12px 16px; }
.db-table tbody tr:hover { background: #f8fafc; }
.leads-table, .tasks-table { width: 100%; min-width: 980px; border-collapse: collapse; background: #fff; border-radius: 12px; }
.leads-table th, .tasks-table th { text-align: left; color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.leads-table td, .tasks-table td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; font-size: 14px; line-height: 1.5; }
.leads-table tbody tr:hover, .tasks-table tbody tr:hover { background: #f8fafc; }
.leads-table td:nth-child(8) { white-space: nowrap; font-weight: 500; }
.leads-table td:nth-child(3) { min-width: 190px; }
.leads-table td:nth-child(4) { overflow-wrap: anywhere; }
.score-main { display: block; font-weight: 700; line-height: 1.4; }
.score-sub { display: block; margin-top: 2px; line-height: 1.45; }
.db-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.db-main { display: grid; gap: 20px; min-width: 0; }
.db-main .db-section { margin-bottom: 0; }
.db-rail { position: sticky; top: 84px; min-width: 0; }
.db-card { padding: 20px 22px; }
.db-card h3 { margin: 0 0 16px; }
.db-stats { gap: 16px; margin-bottom: 20px; }
.db-stat { padding: 20px; }
.db-stat b.num { font-size: 28px; }
.record-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid #eef2f7; }
.record-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.record-head-side { text-align: right; flex-shrink: 0; }
.record-price { font-size: 20px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.db-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; margin: 0; }
.db-facts dt { color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: 4px; }
.db-facts dd { margin: 0; font-weight: 600; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.db-btns { margin-top: 18px; }
.act-title { font-weight: 600; line-height: 1.45; }
.act-detail { color: #475569; font-size: 13px; line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
.db-act { line-height: 1.5; }
.kanban { gap: 12px; }
.col { padding: 12px; }
.col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #475569; margin: 0 0 10px; }
.deal-card { padding: 12px; line-height: 1.5; }
.deal-card b { font-size: 14px; }
/* notification dropdown */
.notif-wrap { position: relative; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 380px; max-width: calc(100vw - 32px); max-height: 480px; display: flex; flex-direction: column; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.16); z-index: 30; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #eef2f7; }
.notif-head b { font-size: 15px; }
.notif-mark { background: none; color: #2563eb; font-size: 13px; font-weight: 600; padding: 4px 6px; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 12px; width: 100%; text-align: left; background: none; color: #16202b; padding: 12px 16px; border: none; border-bottom: 1px solid #f1f5f9; border-radius: 0; align-items: flex-start; }
.notif-item:hover { background: #f8fafc; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text b { font-size: 14px; line-height: 1.4; }
.notif-text span { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.notif-overdue { background: #fff7f7; }
.notif-empty { padding: 20px 16px; margin: 0; }
.notif-foot { padding: 10px 12px; border-top: 1px solid #eef2f7; }
.notif-foot button { width: 100%; }
@media (max-width: 1100px) {
  .db-layout { grid-template-columns: 1fr; }
  .db-rail { position: static; }
  .db-facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar-search input { width: 110px; }
  .db-facts { grid-template-columns: 1fr; }
  .record-head { flex-direction: column; }
  .record-head-side { text-align: left; }
}

/* Fix: no empty right column below the activity rail — lower sections span full width */
.db-wide { display: grid; gap: 20px; margin-top: 20px; min-width: 0; }
/* Fix: sidebar nav stays visible on scroll instead of leaving an empty dark strip */
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* Highlighted block headings: gold accent bar + stronger navy title */
.db-card h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; color: #0b2a47; }
.db-card h3::before { content: ""; width: 5px; height: 20px; background: #f0a500; border-radius: 3px; flex-shrink: 0; }

/* Pinned sidebar: fixed (not sticky) so it never scrolls away with the page */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; overflow-y: auto; z-index: 20; }
.maincol { margin-left: 242px; }
.shell.sidebar-collapsed .maincol { margin-left: 0; }
@media (max-width: 1000px) { .maincol { margin-left: 0; } }

/* Fix 2: fill the right rail — Going cold + Overdue stack under Recent Activities
   so the right column runs as tall as the main column; lower sections pair two per row */
.db-rail { position: static; display: flex; flex-direction: column; gap: 20px; }
.db-wide { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 1100px) { .db-wide { grid-template-columns: 1fr; } }
