:root{
  --bg:#f6f7f4;
  --surface:#ffffff;
  --surface-soft:#eef5f0;
  --ink:#1d2522;
  --muted:#66736d;
  --line:#d9e0dc;
  --accent:#c8102e;
  --accent-dark:#8f0c22;
  --accent-soft:#fde8ec;
  --blue:#315f91;
  --amber:#a56316;
  --ok:#26735d;
  --off:#7a827e;
  --err:#b84040;
  --shadow:0 16px 40px rgba(29,37,34,.08);
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--ink)}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
code{background:#eef0ed;padding:1px 5px;border-radius:5px}
.nav{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:12px 24px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.94);position:sticky;top:0;z-index:20;backdrop-filter:blur(12px)}
.brand{display:flex;align-items:center;gap:9px;color:var(--ink);font-weight:800;text-decoration:none}
.brand:hover{text-decoration:none}
.brand-mark{width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid var(--accent);background:#fff}
.tag{font-size:11px;color:var(--muted);border:1px solid var(--line);padding:1px 6px;border-radius:6px;font-weight:700}
.nav nav{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.nav nav a{color:var(--ink);padding:8px 10px;border-radius:8px}
.nav nav a:hover{background:var(--surface-soft);text-decoration:none}
.nav-toggle{display:none}
.container{max-width:1120px;margin:26px auto 48px;padding:0 22px}
h1,h2,h3,h4,p{margin-top:0}
h1{font-size:34px;line-height:1.12;margin-bottom:10px;letter-spacing:0}
h2{font-size:24px;line-height:1.2;margin-bottom:8px;letter-spacing:0}
h3{font-size:18px;margin-bottom:10px;letter-spacing:0}
h4{font-size:15px;margin-bottom:5px;letter-spacing:0}
.muted{color:var(--muted)}
.small{font-size:13px}
.error{color:var(--err);background:#fff0f0;border:1px solid #f2c5c5;border-radius:8px;padding:10px 12px}
.eyebrow{margin-bottom:8px;color:var(--accent-dark);font-weight:800;text-transform:uppercase;font-size:12px;letter-spacing:0}
.lead{font-size:17px;color:#4b5752;max-width:680px;margin-bottom:0}
.page-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:22px;padding:24px;border:1px solid var(--line);border-radius:8px;background:linear-gradient(180deg,#fff,#f9fbf8)}
.page-hero.compact{align-items:center;padding:20px}
.hero-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.button,button{display:inline-flex;align-items:center;justify-content:center;min-height:40px;border:0;border-radius:8px;padding:10px 15px;font-weight:800;cursor:pointer;font:inherit;text-decoration:none;white-space:nowrap}
.button:hover{text-decoration:none}
.primary,.primary-action{background:var(--accent);color:#fff}
.secondary,.secondary-action{background:#fff;color:var(--ink);border:1px solid var(--line)}
button:hover,.button:hover{filter:brightness(.98);box-shadow:0 6px 18px rgba(29,37,34,.10)}
.card{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:18px;margin-bottom:16px;box-shadow:var(--shadow)}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.dashboard-grid{align-items:start}
.feedback-grid{grid-template-columns:minmax(0,1.08fr) minmax(320px,.92fr)}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:14px}
.card-head h3{margin:0}
.banner{display:flex;align-items:center;gap:10px;background:#eaf2fb;border:1px solid #c8d9ed;border-radius:8px;padding:11px 14px;margin-bottom:16px}
.banner span{font-size:12px;text-transform:uppercase;font-weight:800;color:var(--blue)}
.banner strong{font-weight:800}
.banner em{margin-left:auto;color:var(--muted);font-style:normal;font-size:13px}
.banner.success{background:#e8f5ee;border-color:#bfdfcf}
.auth-shell{display:grid;grid-template-columns:minmax(0,1fr) 430px;gap:28px;align-items:center;min-height:calc(100vh - 150px)}
.auth-intro{padding:20px}
.auth-avatar{width:118px;height:118px;object-fit:cover;border-radius:50%;border:4px solid #fff;box-shadow:var(--shadow);margin-bottom:18px}
.auth-intro h1{font-size:42px;max-width:620px}
.auth-card{margin:0}
.proof-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:24px;max-width:720px}
.proof-grid div{background:#fff;border:1px solid var(--line);border-radius:8px;padding:13px}
.proof-grid b{display:block;margin-bottom:4px}
.proof-grid span{display:block;color:var(--muted);font-size:13px}
.switcher{margin-bottom:8px}
label{display:block;margin:10px 0;color:#33413b;font-weight:700}
input,textarea,select{width:100%;padding:11px 12px;border-radius:8px;border:1px solid #cbd4cf;background:#fff;color:var(--ink);margin-top:5px;font:inherit}
textarea{resize:vertical}
input:focus,textarea:focus,select:focus{outline:3px solid var(--accent-soft);border-color:var(--accent)}
.contact-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) auto;gap:10px;align-items:end}
.contact-form label{margin:0}
.stacked-form{display:grid;gap:10px;margin-bottom:18px}
.stacked-form label{margin:0}
.stat{font-size:38px;font-weight:850;line-height:1}
.stat span{font-size:13px;color:var(--muted);margin-left:8px;font-weight:500}
.pills{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 0}
.pills li{background:#f4f6f4;border:1px solid var(--line);padding:5px 10px;border-radius:8px;font-size:13px}
.ok{color:var(--ok)}
.off{color:var(--off)}
.badge{display:inline-flex;align-items:center;min-height:26px;background:#f4f6f4;border:1px solid var(--line);border-radius:8px;padding:3px 8px;font-size:12px;font-weight:800;color:#4e5a55}
.badge.success{background:var(--accent-soft);border-color:#b9ddcf;color:var(--accent-dark)}
.table-wrap{overflow-x:auto}
.table{width:100%;border-collapse:collapse;min-width:680px}
.table th,.table td{text-align:left;padding:11px 8px;border-bottom:1px solid var(--line);vertical-align:top}
.table th{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:0}
.draft{border-top:1px solid var(--line);padding-top:12px;margin-top:12px}
.draft:first-of-type{border-top:0;margin-top:0;padding-top:0}
.draft pre{white-space:pre-wrap;background:#f7f8f6;border:1px solid var(--line);border-radius:8px;padding:11px;margin:7px 0 0;font:14px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.draft-controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.draft-controls .button{min-height:36px;padding:7px 12px;font-size:13px}
.start-here-card{border:2px dashed var(--accent);background:var(--accent-soft)}
.start-here-card h3{color:var(--accent-dark)}
.start-here-actions{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0 10px}
.start-here-nudge{margin-top:8px}
.empty-state{background:#f7f9f7;border:1px dashed #cbd6d0;border-radius:8px;padding:16px;color:var(--muted)}
.empty-state b{display:block;color:var(--ink);margin-bottom:4px}
.empty-state p{margin:0 0 12px}
.empty-state.inline{box-shadow:none;margin:8px 0}
.onboarding-panel{display:grid;grid-template-columns:minmax(0,1fr) 220px;gap:16px;padding:20px;margin-bottom:16px;background:#fff;border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow)}
.onboarding-copy h2{margin-bottom:6px}
.progress-wrap{display:flex;align-items:center;gap:12px;justify-content:flex-end}
.progress-track{width:150px;height:10px;background:#e5ebe8;border-radius:8px;overflow:hidden}
.progress-track span{display:block;height:100%;background:var(--accent)}
.task-list{grid-column:1 / -1;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.task{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid var(--line);border-radius:8px;background:#fafbf9;color:var(--ink);min-height:86px}
.task:hover{text-decoration:none;background:#fff}
.task.done{background:var(--accent-soft);border-color:#bfe1d4}
.check{display:grid;place-items:center;flex:0 0 26px;height:26px;border-radius:8px;background:#fff;border:1px solid var(--line);font-weight:800;color:var(--accent-dark)}
.task small{display:block;color:var(--muted);margin-top:2px}
.quickbar{position:sticky;top:62px;z-index:10;display:flex;gap:8px;flex-wrap:wrap;padding:10px;margin-bottom:16px;background:rgba(246,247,244,.92);border:1px solid var(--line);border-radius:8px;backdrop-filter:blur(10px)}
.quickbar a{background:#fff;border:1px solid var(--line);border-radius:8px;padding:8px 10px;color:var(--ink);font-weight:800;font-size:13px}
.quickbar a:hover{text-decoration:none;background:var(--surface-soft)}
.metric-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.metric-row span{background:#f7f8f6;border:1px solid var(--line);border-radius:8px;padding:12px}
.metric-row b{display:block;font-size:26px}
.metric-row small{color:var(--muted)}
.prompt-strip{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.prompt-strip button{background:#fff;color:var(--ink);border:1px solid var(--line);min-height:36px;padding:8px 11px;font-size:13px}
.chatlog{min-height:420px;max-height:58vh;overflow-y:auto;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:10px;box-shadow:var(--shadow)}
.msg{padding:10px 13px;border-radius:8px;max-width:min(78%,720px);white-space:pre-wrap}
.msg.user{align-self:flex-end;background:var(--accent);color:#fff}
.msg.assistant{align-self:flex-start;background:#f7f8f6;border:1px solid var(--line)}
.chatbar{display:flex;gap:8px;margin-top:12px;position:sticky;bottom:12px;background:rgba(246,247,244,.94);padding:10px;border:1px solid var(--line);border-radius:8px;backdrop-filter:blur(10px)}
.chatbar input{margin:0}
.feature-list{display:grid;gap:10px;margin-top:14px}
.feature-item{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:12px;align-items:center;border-top:1px solid var(--line);padding-top:12px}
.feature-item p{margin-bottom:6px;color:var(--muted)}
.vote-button{width:92px;min-height:66px;display:grid;gap:0;background:#fff;color:var(--ink);border:1px solid var(--line);padding:8px}
.vote-button b{font-size:22px}
.vote-button span{font-size:12px;color:var(--muted);font-weight:800}
.vote-button.voted{background:var(--accent-soft);border-color:#b9ddcf;color:var(--accent-dark)}
.crm-list{display:grid;gap:14px}
.crm-contact{border:1px solid var(--line);border-radius:8px;background:#fff;overflow:hidden}
.crm-summary{display:grid;grid-template-columns:minmax(0,1.2fr) 140px minmax(180px,.8fr);gap:12px;align-items:center;padding:13px 15px;cursor:pointer;list-style:none}
.crm-summary::-webkit-details-marker{display:none}
.crm-summary:hover{background:#fff7f8}
.crm-summary b{display:block}
.crm-summary small{display:block;color:var(--muted);margin-top:2px}
.crm-contact[open] .crm-summary{border-bottom:1px solid var(--line);background:#fff7f8}
.crm-contact-body{display:grid;grid-template-columns:minmax(190px,.8fr) minmax(280px,1.1fr) minmax(280px,1fr);gap:14px;padding:15px}
.crm-directory h4{font-size:18px;margin-bottom:6px}
.crm-directory p{margin-bottom:5px}
.crm-state-form,.crm-update-form{display:grid;gap:10px;align-content:start}
.crm-state-form label,.crm-update-form label{margin:0}
.crm-state-form{grid-template-columns:1fr 1fr}
.crm-state-form .wide,.crm-state-form button{grid-column:1 / -1}
.mini-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.last-update{padding-top:4px;border-top:1px dashed var(--line)}
.taguig-sync-form{display:grid;grid-template-columns:minmax(240px,1fr) auto;gap:10px;align-items:end;margin-bottom:14px}
.taguig-sync-form label{margin:0}
@media(max-width:920px){
  .auth-shell,.feedback-grid,.grid{grid-template-columns:1fr}
  .proof-grid{grid-template-columns:1fr}
  .contact-form{grid-template-columns:1fr 1fr}
  .contact-form button{grid-column:1 / -1}
  .task-list{grid-template-columns:1fr 1fr}
  .onboarding-panel{grid-template-columns:1fr}
  .progress-wrap{justify-content:flex-start}
  .crm-summary,.crm-contact-body,.taguig-sync-form{grid-template-columns:1fr}
}
@media(max-width:640px){
  .nav{align-items:center;padding:12px 16px}  /* keep logo + hamburger on one row */
  .container{padding:0 14px;margin-top:18px}
  h1{font-size:28px}
  .page-hero{align-items:flex-start;flex-direction:column;padding:18px}
  .hero-actions{justify-content:flex-start;width:100%}
  .button,.primary-action,.secondary-action{width:100%}
  .task-list,.contact-form{grid-template-columns:1fr}
  .quickbar{top:112px}
  .chatbar{align-items:stretch;flex-direction:column}
  .msg{max-width:92%}
  .feature-item{grid-template-columns:1fr}
  .vote-button{width:100%;min-height:50px;grid-template-columns:auto 1fr;align-items:center}
  .crm-state-form,.mini-grid{grid-template-columns:1fr}
}

/* ── BNI CRM: responsive at ≤420px (390px phone) ────────────────────────────
   Stack .crm-summary rows into single-column cards; CRM body becomes
   vertical; add-contact form collapses to 1-col stacked.                   */
@media(max-width:420px){
  .crm-summary{
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:12px;
  }
  .crm-contact-body{
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:12px;
  }
  .crm-list{gap:10px}
  .bni-crm-scroll{overflow-x:visible} /* cards, not scroll-table */
  .bni-contact-form{grid-template-columns:1fr;gap:8px}
  .bni-contact-form button{grid-column:1}
  .crm-directory h4{font-size:16px}
  .taguig-sync-form{grid-template-columns:1fr}
  /* Ensure any table-wrapped content scrolls rather than overflows */
  .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .table{min-width:480px}
  /* Draft controls stack vertically */
  .draft-controls{flex-direction:column}
  .draft-controls .button{width:100%}
}

/* ── PWA bottom-tab navigation ──────────────────────────────────────────────
   Hidden on desktop; shown on mobile (≤720 px) when the user is logged in.
   The bar sits fixed at the bottom. On mobile we add matching padding to
   .container so content isn't hidden behind the bar.                        */
.bottom-nav{display:none}

@media(max-width:720px){
  /* Header collapses to a hamburger on mobile: show the toggle (right-aligned on
     the logo's row) and turn the link list into a dropdown anchored under the
     sticky header. Uses .nav .top-nav so it outranks the base .nav nav rule. */
  .nav-toggle{
    display:flex;flex-direction:column;justify-content:center;gap:5px;
    width:42px;height:42px;padding:9px;flex:0 0 auto;
    background:transparent;border:1px solid var(--line);border-radius:10px;cursor:pointer;
  }
  .nav-toggle span{display:block;width:100%;height:2px;background:var(--ink);border-radius:2px;transition:transform .2s ease,opacity .2s ease}
  .nav-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .nav-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
  .nav-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

  .nav .top-nav{
    display:none;
    position:absolute;top:100%;left:0;right:0;
    flex-direction:column;align-items:stretch;gap:2px;flex-wrap:nowrap;
    margin:0;padding:8px 16px 14px;
    background:rgba(255,255,255,.98);border-bottom:1px solid var(--line);
    box-shadow:0 12px 24px rgba(0,0,0,.10);
    -webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);
  }
  .nav .top-nav.open{display:flex}
  .nav .top-nav a{padding:13px 12px;border-radius:10px;font-weight:600;width:100%}

  /* Push content above the tab bar height (approx 60px) + env safe area. */
  .has-user .container{padding-bottom:calc(68px + env(safe-area-inset-bottom, 0px))}

  .bottom-nav{
    display:flex;
    position:fixed;
    bottom:0;left:0;right:0;
    height:calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom:env(safe-area-inset-bottom, 0px);
    background:rgba(255,255,255,.97);
    border-top:1px solid var(--line);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
    z-index:30;
    justify-content:space-around;
    align-items:stretch;
  }

  .bottom-tab{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    color:var(--muted);
    text-decoration:none;
    font-size:11px;
    font-weight:700;
    padding:6px 4px;
    -webkit-tap-highlight-color:transparent;
  }
  .bottom-tab:hover{text-decoration:none;background:var(--surface-soft)}
  .bottom-tab.active{color:var(--accent)}
  .bottom-tab-icon{font-size:22px;line-height:1}
  .bottom-tab-label{line-height:1}
}

/* ===== CRM Visual Refresh ===== */

/* Stat Tiles */
.stat-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  flex: 1 1 140px;
  min-width: 130px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  position: relative;
  overflow: hidden;
  border-top: 4px solid transparent;
}
.stat-tile--accent { border-top-color: var(--accent); }
.stat-tile--blue   { border-top-color: var(--blue); }
.stat-tile--amber  { border-top-color: var(--amber); }
.stat-tile--ok     { border-top-color: var(--ok); }
.stat-tile--muted  { border-top-color: var(--muted); }
.stat-tile--violet { border-top-color: #6d4c9e; }
.stat-tile__num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-tile__label {
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 480px) {
  .stat-tile { flex: 1 1 calc(50% - .5rem); }
}

/* Avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.av-1 { background: rgba(200,16,46,.12); color: #a00d26; }
.av-2 { background: rgba(49,95,145,.12); color: #1e4e82; }
.av-3 { background: rgba(165,99,22,.12); color: #7a4e10; }
.av-4 { background: rgba(38,115,93,.12); color: #164d3a; }
.av-5 { background: rgba(110,108,108,.12); color: #4a4a4a; }
.av-6 { background: rgba(109,76,158,.12); color: #4a2d7a; }

/* Badge palette */
.badge {
  display: inline-block;
  padding: .2em .6em;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
/* Pipeline stages */
.stage-new       { background: rgba(110,108,108,.12); color: #4a4a4a; }
.stage-nurturing { background: rgba(49,95,145,.12); color: #1e4e82; }
.stage-opportunity { background: rgba(165,99,22,.12); color: #7a4e10; }
.stage-client    { background: rgba(38,115,93,.12); color: #164d3a; }
.stage-dormant   { background: rgba(110,108,108,.08); color: #6e6c6c; }
/* Contact kinds */
.kind-bni              { background: rgba(200,16,46,.1); color: #a00d26; }
.kind-client           { background: rgba(49,95,145,.12); color: #1e4e82; }
.kind-lead             { background: rgba(165,99,22,.12); color: #7a4e10; }
.kind-partner          { background: rgba(38,115,93,.12); color: #164d3a; }
.kind-referral_source  { background: rgba(109,76,158,.12); color: #4a2d7a; }
.kind-supplier         { background: rgba(88,80,186,.12);  color: #3d2fa0; }
.kind-customer         { background: rgba(16,160,130,.12); color: #0a6b56; }
/* Generic tag pill */
.tag-pill {
  background: var(--surface-soft);
  color: var(--muted);
  display: inline-block;
  padding: .15em .5em;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 500;
  border: 1px solid var(--line);
}

/* CRM Toolbar */
.crm-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: .75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.crm-toolbar input[type="text"],
.crm-toolbar select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .35rem .65rem;
  font-size: .82rem;
  background: var(--surface);
  color: var(--ink);
  min-width: 120px;
}
.crm-toolbar input[type="text"] { flex: 1 1 180px; }
.crm-toolbar button[type="submit"] {
  padding: .35rem .9rem;
  font-size: .82rem;
}
@media (max-width: 600px) {
  .crm-toolbar { gap: .4rem; }
  .crm-toolbar input[type="text"] { min-width: 100%; }
}

/* Kanban board */
.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 260px;
  min-width: 260px;
  background: var(--surface-soft);
  border-radius: 10px;
  overflow: hidden;
}
.kanban-col-head {
  padding: .65rem 1rem;
  font-weight: 600;
  font-size: .82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.kanban-col-head--new        { background: rgba(110,108,108,.14); color: #4a4a4a; }
.kanban-col-head--nurturing  { background: rgba(49,95,145,.14); color: #1e4e82; }
.kanban-col-head--opportunity{ background: rgba(165,99,22,.14); color: #7a4e10; }
.kanban-col-head--client     { background: rgba(38,115,93,.14); color: #164d3a; }
.kanban-col-head--dormant    { background: rgba(110,108,108,.08); color: #6e6c6c; }
.col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.6);
  color: inherit;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 .4em;
}
.kanban-cards {
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 80px;
}
.kanban-card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: .75rem;
  cursor: grab;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.kanban-card.dragging { opacity: .45; cursor: grabbing; }
.kanban-col.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kanban-card__top {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.kanban-card__name {
  font-weight: 600;
  font-size: .85rem;
  color: var(--ink);
  text-decoration: none;
}
.kanban-card__name:hover { color: var(--accent); }
.kanban-card__sub {
  font-size: .72rem;
  color: var(--muted);
}
.kanban-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}
/* CRM contact row enhancements */
.crm-contact-row {
  transition: box-shadow .15s ease, transform .12s ease;
}
.crm-contact-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.09);
  transform: translateY(-1px);
}
.contact-meta {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.contact-meta__text { display: flex; flex-direction: column; }
.contact-meta__name { font-weight: 600; font-size: .9rem; color: var(--ink); }
.contact-meta__sub  { font-size: .75rem; color: var(--muted); }

/* ── Daily Briefing Card (polished redesign) ────────────────────────────────
   All elements below are scoped inside .briefing-card so they can't bleed
   into other cards.  Uses only existing design-system tokens.                */

/* Hero: greeting + summary line */
.briefing-hero {
  margin-bottom: 1.25rem;
}
.briefing-hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .35rem;
}
.briefing-ask-link {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.briefing-greeting {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 .25rem;
  line-height: 1.2;
}
.briefing-summary {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

/* Stat tiles — reuse .stat-tiles / .stat-tile from CRM visual refresh */
.briefing-tiles {
  margin-bottom: 1.25rem;
}
.briefing-tile-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  transition: box-shadow .15s ease, transform .12s ease;
}
.briefing-tile-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(29,37,34,.13);
}
.briefing-tile-icon {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: .2rem;
}

/* Section headers inside briefing */
.briefing-section {
  border-top: 1px solid var(--line);
  padding-top: .9rem;
  margin-top: .9rem;
}
.briefing-section--inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}
.briefing-section-label {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .5rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.briefing-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 .4em;
}
.briefing-ref-counts {
  font-size: .85rem;
}
.briefing-muted {
  font-size: .8rem;
  color: var(--muted);
  margin: .3rem 0 .4rem;
}

/* Name chips */
.briefing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .5rem;
}
.briefing-chip {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2em .65em;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.briefing-chip--muted {
  color: var(--muted);
  background: #f4f6f4;
}

/* "See all" link */
.briefing-see-all {
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-block;
  margin-top: .25rem;
}

/* Today's agenda list */
.briefing-agenda {
  list-style: none;
  padding: 0;
  margin: 0 0 .5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.briefing-agenda-item {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
}
.briefing-agenda-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: .38rem;
}
.briefing-agenda-body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.briefing-agenda-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink);
}
.briefing-agenda-time {
  font-size: .75rem;
  color: var(--muted);
}

/* Callout banners (Givers Gain, Presentation reminder) */
.briefing-callout {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  border-radius: 10px;
  padding: .85rem 1rem;
  margin-top: .9rem;
  border: 1px solid transparent;
}
.briefing-callout--accent {
  background: var(--accent-soft);
  border-color: #f0b8c4;
  border-left: 4px solid var(--accent);
}
.briefing-callout--blue {
  background: #eaf2fb;
  border-color: #c8d9ed;
  border-left: 4px solid var(--blue);
}
.briefing-callout-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: .1rem;
}
.briefing-callout-body {
  flex: 1;
  min-width: 0;
}
.briefing-callout-body b {
  display: block;
  font-size: .85rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: .15rem;
}
.briefing-callout-body p {
  margin: 0;
  font-size: .8rem;
  color: var(--muted);
}
.briefing-callout-cta {
  flex-shrink: 0;
  min-height: 32px;
  padding: 6px 12px;
  font-size: .78rem;
  align-self: center;
}

/* Empty / caught-up state */
.briefing-caught-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  gap: .4rem;
}
.briefing-caught-up-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: .2rem;
}
.briefing-caught-up b {
  font-size: 1rem;
  color: var(--ink);
}
.briefing-caught-up .briefing-muted {
  max-width: 320px;
}

/* ── Mobile: tighten up briefing card at small viewports ─────────────────── */
@media (max-width: 480px) {
  .briefing-greeting { font-size: 1.1rem; }
  .briefing-tiles { gap: .6rem; }
  .briefing-callout { flex-wrap: wrap; }
  .briefing-callout-cta { width: 100%; justify-content: center; }
}

/* ── WhatsApp Inbox ─────────────────────────────────────────────────────────
   Two-pane layout: conversation list (left) + thread + composer (right).
   Metronic-inspired; uses Donna's existing CSS variables.                   */
.inbox-shell{display:grid;grid-template-columns:320px 1fr;gap:0;height:calc(100vh - 130px);min-height:500px;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface);box-shadow:var(--shadow)}

/* Conversation list pane */
.conv-list{display:flex;flex-direction:column;border-right:1px solid var(--line);overflow:hidden;background:#f9fbf9}
.conv-list-header{padding:14px 16px 10px;border-bottom:1px solid var(--line);flex:0 0 auto}
.conv-list-title{font-size:17px;font-weight:800;margin:0}
.conv-items{list-style:none;padding:0;margin:0;overflow-y:auto;flex:1}
.conv-item{border-bottom:1px solid var(--line)}
.conv-item-link{display:flex;align-items:center;gap:10px;padding:12px 14px;text-decoration:none;color:var(--ink)}
.conv-item-link:hover{background:var(--surface-soft);text-decoration:none}
.conv-item--active .conv-item-link{background:var(--accent-soft);border-left:3px solid var(--accent)}
.conv-avatar{flex:0 0 40px;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-size:15px;font-weight:800;color:#fff}
/* Avatar tints — reuse av-1..av-6 from existing CSS pattern */
.av-1{background:#c8102e}.av-2{background:#315f91}.av-3{background:#26735d}.av-4{background:#a56316}.av-5{background:#6b3fa0}.av-6{background:#1d6d7a}
.conv-meta{flex:1;min-width:0}
.conv-name{display:block;font-weight:700;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv-snippet{display:block;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.conv-starred{color:var(--amber);font-size:13px}
.conv-draft-dot{flex:0 0 10px;width:10px;height:10px;background:var(--accent);border-radius:50%;margin-left:4px}

/* Empty state inside conv-list */
.inbox-empty-state{padding:28px 18px;text-align:center;color:var(--muted)}
.inbox-empty-state .inbox-empty-icon{font-size:36px;margin:0 0 10px}
.inbox-empty-state b{display:block;color:var(--ink);margin-bottom:6px}
.inbox-empty-state p{font-size:13px;margin-bottom:14px}

/* Chat pane (right) */
.chat-pane{display:flex;flex-direction:column;overflow:hidden}
.chat-pane--empty{align-items:center;justify-content:center}
.chat-pane-placeholder{text-align:center;color:var(--muted);padding:32px 24px}
.chat-pane-placeholder-icon{font-size:48px;margin:0 0 12px}
.chat-pane-placeholder b{display:block;color:var(--ink);margin-bottom:6px;font-size:17px}

/* Thread header */
.chat-thread-header{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line);flex:0 0 auto;background:#fff}
.chat-back-btn{font-size:18px;color:var(--muted);text-decoration:none;flex:0 0 auto;padding:4px 6px}
.chat-back-btn:hover{color:var(--ink);text-decoration:none}
.chat-thread-avatar{flex:0 0 36px;width:36px;height:36px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:800;color:#fff}
.chat-thread-name-wrap{flex:1;min-width:0}
.chat-thread-name{display:block;font-weight:700;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-thread-sub{font-size:12px}

/* Message bubbles */
.chat-thread{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;background:var(--bg)}
.chat-thread-empty{align-self:center;margin-top:24px;font-size:13px}
.bubble{max-width:74%;padding:10px 13px;border-radius:12px;font-size:14px;line-height:1.45;word-break:break-word}
.bubble--them{align-self:flex-start;background:var(--surface);border:1px solid var(--line);border-bottom-left-radius:4px}
.bubble--me{align-self:flex-end;background:var(--accent-soft);border:1px solid #e8c5cc;color:var(--ink);border-bottom-right-radius:4px}
.bubble-text{white-space:pre-wrap}

/* Composer */
.composer{flex:0 0 auto;padding:12px 16px;border-top:1px solid var(--line);background:#fff;display:flex;flex-direction:column;gap:8px}
.composer-label{font-size:11px;text-transform:uppercase;font-weight:700;letter-spacing:.03em}
.composer-textarea{width:100%;min-height:70px;max-height:160px;resize:vertical;border:1px solid var(--line);border-radius:8px;padding:10px 12px;font:14px/1.45 inherit;color:var(--ink)}
.composer-textarea:focus{outline:3px solid var(--accent-soft);border-color:var(--accent)}
.composer-actions{display:flex;gap:8px;flex-wrap:wrap}
.composer-actions .button{min-height:36px;padding:7px 12px;font-size:13px}
.composer-no-draft{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.composer-improve-row{display:flex;flex-direction:column;gap:8px;padding:10px;background:var(--surface-soft);border:1px solid var(--line);border-radius:8px}
.composer-feedback-input{margin-top:0}
.composer-presets{display:flex;gap:6px;flex-wrap:wrap}
.composer-preset-btn{min-height:30px;padding:5px 10px;font-size:12px}
.composer-status{padding:6px 10px;border-radius:6px;background:#f5f6f4;border:1px solid var(--line);font-size:13px;color:var(--muted)}

/* Mobile: stack panes vertically */
@media(max-width:720px){
  .inbox-shell{grid-template-columns:1fr;height:auto;min-height:0}
  .conv-list{max-height:50vh;border-right:none;border-bottom:1px solid var(--line)}
  .conv-list--hidden-mobile{display:none}
  .chat-pane{min-height:60vh}
  .chat-thread{max-height:40vh}
  .chat-back-btn{display:inline-flex}
}
