/* Gemma CRM: the screens of crm.gemma.net.vn, on top of gemma-ui.css (tokens, shell, buttons, sheets, toasts).
   Mobile first. One idea per screen, one main action per row, numbers in tabular figures. */

/* ── shell ── */
.c-side-sub { font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #e0c78e; padding: 0 var(--s3) var(--s5); }
.g-sidebar .g-logo { padding-bottom: var(--s3); }
.c-me .g-avatar { background: #e0c78e; color: #2d161a; }
.g-nav__item svg { width: 20px; height: 20px; flex: none; }
.c-side-auto { margin: var(--s5) var(--s2) 0; padding: var(--s3); border-radius: var(--r); background: rgba(255,255,255,.07); font-size: var(--text-xs); line-height: 1.45; color: #e9dada; }
.c-side-auto b { color: #fff; font-weight: 600; }
.c-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; vertical-align: 1px; }
.c-dot--off { background: var(--stone-300); }
.c-me { display: flex; align-items: center; gap: var(--s3); min-width: 0; color: inherit; text-decoration: none; }
.c-me .c-grow > b { display: block; font-size: var(--text-sm); font-weight: 600; }
.c-me .c-grow > span { display: block; font-size: var(--text-xs); color: var(--text-secondary); }
.g-topbar .c-top-actions { display: flex; gap: var(--s2); align-items: center; }
.g-tab svg { width: 22px; height: 22px; }
.g-tab .c-tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.c-main { max-width: 1180px; }
.c-hide { display: none !important; }

/* ── common pieces ── */
.c-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.c-h1 { font-size: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: var(--s1) 0 var(--s2); }
.c-lede { color: var(--text-secondary); font-size: var(--text-sm); max-width: 62ch; margin: 0; }
.c-row { display: flex; align-items: center; gap: var(--s3); }
.c-wrap { flex-wrap: wrap; }
.c-grow { flex: 1; min-width: 0; }
.c-sec { margin-top: var(--s6); }
.c-sec-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.c-sec-head h2 { font-size: var(--text-md); flex: 1; min-width: 0; }
.c-sec-head a, .c-link { font-size: var(--text-sm); font-weight: 600; text-decoration: none; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; min-height: 32px; }
.c-sec-head a:hover, .c-link:hover { text-decoration: underline; }
.c-logo { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--bg-subtle); border: 1px solid var(--border-subtle); color: var(--ink-700); font-weight: 700; font-size: 13px; overflow: hidden; }
.c-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.c-av { width: 40px; height: 40px; font-size: 13px; }
.c-av--reply { background: var(--bordeaux-100); color: var(--bordeaux-800); }
.c-av--chase { background: var(--bg-muted); color: var(--ink-700); }
.c-av--fix { background: var(--warning-soft); color: var(--warning); }
.c-av--deal { background: var(--success-soft); color: var(--success); }
.c-pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--bg-muted); color: var(--ink-700); }
.c-pill--reply { background: var(--warning-soft); color: var(--warning); }
.c-pill--ok { background: var(--success-soft); color: var(--success); }
.c-pill--warn { background: var(--warning-soft); color: var(--warning); }
.c-pill--late { background: var(--danger-soft); color: var(--danger); }
.c-pill--gold { background: #fbf4e4; color: #5f4a14; }
.c-pill--accent { background: var(--accent-soft); color: var(--accent-soft-text); }
.c-meta { font-size: var(--text-xs); color: var(--text-secondary); }
.c-name { font-weight: 600; font-size: var(--text-sm); color: var(--text); }
.c-sub { font-size: var(--text-xs); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-why { font-size: var(--text-sm); color: var(--ink-700); margin-top: 2px; overflow-wrap: anywhere; }
.c-quote { font-style: italic; }
.c-num { font-variant-numeric: tabular-nums; }
.c-late { color: var(--danger); font-weight: 600; }

/* segmented filter (one choice, like the Gmail / Instagram tabs) */
.c-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full); background: var(--bg-muted); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.c-seg::-webkit-scrollbar { display: none; }
.c-seg button { border: 0; background: none; border-radius: var(--r-full); min-height: 34px; padding: 0 14px; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.c-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.c-seg .c-n { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-weight: 600; }
.c-seg button[aria-pressed="true"] .c-n { color: var(--accent); }

/* ── Today ── */
.c-today { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .c-today { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "hero week" "list week" "leads week"; align-items: start; }
  .c-hero { grid-area: hero; } .c-today__list { grid-area: list; } .c-today__leads { grid-area: leads; }
  .c-today__aside { grid-area: week; position: sticky; top: calc(var(--topbar-h) + var(--s5)); }
}
.c-hero { padding: var(--s5); border-radius: var(--r-lg); color: #f6efea; background: radial-gradient(120% 80% at 100% 0%, rgba(201,168,76,.22), transparent 55%), linear-gradient(160deg, #4a1621 0%, #2d161a 100%); position: relative; overflow: hidden; }
.c-hero::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; border: 1px solid rgba(224,199,142,.35); box-shadow: 0 0 0 40px rgba(224,199,142,.05), 0 0 0 80px rgba(224,199,142,.04); pointer-events: none; }
.c-hero .c-eyebrow { color: #e0c78e; }
.c-hero h1 { color: #fff; font-size: clamp(1.375rem, 1.05rem + 1.4vw, 2rem); margin: var(--s2) 0; letter-spacing: -0.02em; }
.c-hero p { color: #e9dada; font-size: var(--text-sm); max-width: 56ch; margin: 0 0 var(--s4); }
.c-hero .g-btn--primary { background: #e0c78e; border-color: #e0c78e; color: #2d161a; }
.c-hero .g-btn--primary:hover { background: #ecd5a6; border-color: #ecd5a6; }
.c-hero .g-btn--ghost { color: #f6efea; }
.c-hero .g-btn--ghost:hover { background: rgba(255,255,255,.1); }
.c-hero-stats { display: flex; gap: var(--s5); margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid rgba(224,199,142,.25); flex-wrap: wrap; }
.c-hero-stats div { min-width: 72px; }
.c-hero-stats b { display: block; font-size: var(--text-xl); font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.c-hero-stats span { font-size: var(--text-xs); color: #d9c2c2; }

/* goals card */
.c-goal { margin-top: var(--s3); }
.c-goal__top { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--text-sm); }
.c-goal__top > span:first-child { flex: 1; min-width: 0; color: var(--ink-700); }
.c-goal__top b { font-variant-numeric: tabular-nums; }
.c-bar { position: relative; height: 8px; border-radius: 4px; background: var(--bg-muted); margin-top: 6px; overflow: visible; }
.c-bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--accent); transition: width .6s var(--ease); }
.c-bar > i.is-ok { background: var(--success); }
.c-bar > s { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--gold-500); left: 0; }
.c-goal__note { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 4px; }
.c-card-foot { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.c-card-foot a { margin-left: auto; }

/* task list (Do now): one row per person, one button */
.c-list { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.c-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--border-subtle); align-items: start; }
.c-item:first-child { border-top: 0; }
.c-item:hover { background: #fffdfd; }
.c-item__head { display: flex; align-items: center; gap: var(--s2); min-width: 0; flex-wrap: wrap; }
.c-item__who { min-width: 0; flex: 1 1 160px; }
.c-item__who .c-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; font-weight: 600; font-size: var(--text-sm); max-width: 100%; }
.c-item__who .c-name:hover { text-decoration: underline; }
.c-item__acts { grid-column: 2; display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
@media (min-width: 760px) {
  .c-item { grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; }
  .c-item__acts { grid-column: 3; grid-row: 1; margin-top: 0; justify-content: flex-end; flex-wrap: nowrap; }
}
.c-more { width: 100%; border: 0; border-top: 1px solid var(--border-subtle); background: var(--surface); min-height: 44px; font-weight: 600; font-size: var(--text-sm); color: var(--accent); cursor: pointer; }
.c-more:hover { background: var(--bg-subtle); }

/* step dots: 7 steps, done / next / to do / passed over */
.c-dots { display: inline-flex; gap: 3px; align-items: center; }
.c-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.c-dots i.done { background: var(--accent); }
.c-dots i.next { background: var(--gold-500); box-shadow: 0 0 0 2px #fbf4e4; }
.c-dots i.skip { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }

/* lead cards */
.c-leads { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.c-lead { display: flex; flex-direction: column; gap: var(--s2); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow-sm); }
.c-lead__job { font-size: var(--text-sm); color: var(--ink-700); }
.c-lead .g-btn { margin-top: auto; align-self: flex-start; }

/* ── Chase ── */
.c-plan { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin: var(--s4) 0; }
.c-step { border-radius: var(--r); padding: var(--s3); border: 1px solid var(--border-subtle); background: var(--surface); }
.c-step--auto { background: var(--bordeaux-800); color: #f6efea; border-color: var(--bordeaux-800); }
.c-step--you { background: #fbf4e4; border-color: #efe1bd; }
.c-step__n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--gold-500); color: #2d161a; margin-bottom: var(--s2); }
.c-step--you .c-step__n { background: var(--bordeaux-800); color: #fff; }
.c-step b { display: block; font-size: var(--text-sm); }
.c-step span { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }
.c-plan-note { font-size: var(--text-xs); color: var(--text-secondary); margin: 0 0 var(--s4); }
.c-toolbar { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s3); }
.c-toolbar .c-grow { min-width: 160px; }
.c-due { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }

/* ── Find ── */
.c-kpis { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: var(--s4) 0; }
@media (min-width: 900px) { .c-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.c-kpi { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--shadow-sm); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.c-kpi[aria-pressed="true"] { box-shadow: var(--ring-selected); }
.c-kpi b { display: block; font-size: var(--text-2xl); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.c-kpi span { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 600; }
.c-cos { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.c-co { display: flex; flex-direction: column; gap: var(--s3); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow-sm); }
.c-co__people { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.c-co__p { display: flex; gap: var(--s2); align-items: baseline; font-size: var(--text-sm); min-width: 0; }
.c-co__p b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-co__p span { color: var(--text-secondary); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-co__p em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.c-co__p em.ok { color: var(--success); font-weight: 600; }
.c-co__acts { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: auto; }

/* ── Deals ── */
.c-board { display: grid; gap: var(--s4); }
@media (min-width: 900px) { .c-board { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }
.c-col h3 { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); margin-bottom: var(--s2); }
.c-col h3 .c-n { color: var(--text-secondary); font-weight: 600; }
.c-deal { display: flex; gap: var(--s3); align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s3); box-shadow: var(--shadow-sm); margin-bottom: var(--s2); cursor: pointer; font: inherit; color: inherit; min-height: 64px; }
.c-deal:hover { box-shadow: var(--shadow); }

/* ── Progress ── */
.c-funnel { display: grid; gap: var(--s2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .c-funnel { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.c-fstep { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--shadow-sm); }
.c-fstep b { display: block; font-size: var(--text-2xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.c-fstep span { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }
.c-fstep small { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.c-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.c-table th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.c-table td { padding: var(--s3); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.c-table tr.is-me td { background: #fffaf4; }
.c-table td .c-bar { width: 96px; }
.c-tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.c-cards2 { display: grid; gap: var(--s3); }
@media (min-width: 900px) { .c-cards2 { grid-template-columns: 1fr 1fr; } }
.c-win { display: flex; gap: var(--s2); align-items: baseline; padding: 6px 0; font-size: var(--text-sm); border-bottom: 1px solid var(--border-subtle); }
.c-win:last-child { border-bottom: 0; }

/* phone: people rows as cards instead of the table */
@media (max-width: 759px) {
  .c-table--cards thead { display: none; }
  .c-table--cards, .c-table--cards tbody, .c-table--cards tr, .c-table--cards td { display: block; width: 100%; }
  .c-table--cards tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border-subtle); }
  .c-table--cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: var(--s3); }
  .c-table--cards td::before { content: attr(data-label); color: var(--text-secondary); font-size: var(--text-xs); font-weight: 600; }
  .c-table--cards td:first-child::before { content: none; }
}

/* ── sheets: person, conversation, email ── */
.c-sheet-sub { font-size: var(--text-xs); color: var(--text-secondary); }
.c-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s4); font-size: var(--text-sm); margin: var(--s3) 0 var(--s4); }
.c-facts dt { color: var(--text-secondary); }
.c-facts dd { margin: 0; overflow-wrap: anywhere; }
.c-msg { border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s3); margin-bottom: var(--s3); background: var(--surface); }
.c-msg--me { background: var(--bg-subtle); }
.c-msg__head { display: flex; gap: var(--s2); font-size: var(--text-xs); color: var(--text-secondary); margin-bottom: var(--s2); }
.c-msg__head b { color: var(--text); }
.c-msg__body { white-space: pre-wrap; font-size: var(--text-sm); overflow-wrap: anywhere; }
.c-sugs { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s3); }
.c-sug { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r); padding: var(--s2) var(--s3); cursor: pointer; font: inherit; font-size: var(--text-sm); color: inherit; }
.c-sug b { display: block; font-size: var(--text-xs); color: var(--accent); }
.c-sug:hover { box-shadow: var(--ring-hover); }
.c-email { border: 1px solid var(--border-subtle); border-radius: var(--r); padding: var(--s3); margin-bottom: var(--s3); }
.c-email h3 { font-size: var(--text-sm); margin-bottom: var(--s2); display: flex; gap: var(--s2); align-items: center; }
.c-email .g-textarea { min-height: 160px; }
.c-copy { position: relative; }
.c-copy .g-textarea { min-height: 120px; }
.c-err { color: var(--danger); font-size: var(--text-sm); margin: var(--s2) 0; }
.c-choices { display: grid; gap: var(--s2); }
.c-choices .g-btn { justify-content: flex-start; }

/* sign in */
.c-signin { min-height: 100dvh; display: grid; place-items: center; padding: var(--s6); background: radial-gradient(120% 80% at 100% 0%, rgba(201,168,76,.18), transparent 55%), linear-gradient(160deg, #4a1621 0%, #2d161a 100%); }
.c-signin__card { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-lg); padding: var(--s8) var(--s6); box-shadow: var(--shadow-lg); text-align: center; }
.c-signin__card img { margin: 0 auto var(--s4); height: 56px; width: auto; }
.c-signin__card p { color: var(--text-secondary); font-size: var(--text-sm); }

/* skeleton rows while loading */
.c-skel { display: grid; gap: var(--s2); }
.c-skel .g-skeleton { height: 64px; border-radius: var(--r); }

@media (max-width: 899px) {
  .c-desk { display: none !important; }
}
@media (min-width: 900px) {
  .c-phone { display: none !important; }
}
.c-mt { margin-top: var(--s3); }

/* phone: a compact hero (the list is what matters), stats in one row */
@media (max-width: 759px) {
  .c-hero { padding: var(--s4); border-radius: var(--r); }
  .c-hero h1 { font-size: 1.25rem; }
  .c-hero p { margin-bottom: var(--s3); }
  .c-hero .c-row .g-btn--ghost { display: none; }
  .c-hero .c-row .g-btn--primary { width: 100%; }
  .c-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s3); padding-top: var(--s3); }
  .c-hero-stats b { font-size: var(--text-lg); }
  .c-hero-stats span { font-size: 11px; line-height: 1.3; display: block; }
  .c-today { gap: var(--s4); }
  .c-item { padding: var(--s3); }
}

@media (min-width: 900px) { .g-topbar__title { visibility: hidden; } }
.c-deal .c-grow > span { display: block; }
