/* ============ Design tokens ============ */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --line: #e7e9f2;
  --line-strong: #d7dbe8;

  --brand: #6d5efc;
  --brand-2: #8b5cf6;
  --brand-soft: #efedff;
  --brand-ink: #4c3fd6;
  --grad: linear-gradient(135deg, #6d5efc 0%, #8b5cf6 50%, #ec4899 100%);

  --ok: #10b981; --warn: #f59e0b; --danger: #ef4444;

  --sidebar: #0f1020;
  --sidebar-2: #1a1b33;
  --sidebar-text: #a5a8c8;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 24px -6px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 50px -12px rgba(76, 63, 214, .28);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* status palette: bg / ink / dot */
  --s-new: #eef2ff;      --s-new-i: #4338ca;      --s-new-d: #6366f1;
  --s-contacted: #fef6e4; --s-contacted-i: #a16207; --s-contacted-d: #f59e0b;
  --s-meeting: #f5ecff;  --s-meeting-i: #7e22ce;  --s-meeting-d: #a855f7;
  --s-proposal: #e6f6fe; --s-proposal-i: #0369a1; --s-proposal-d: #0ea5e9;
  --s-won: #e7f8f0;      --s-won-i: #047857;      --s-won-d: #10b981;
  --s-lost: #f1f2f6;     --s-lost-i: #64748b;     --s-lost-d: #94a3b8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c18; --surface: #14152a; --surface-2: #191a33; --text: #eceefe; --text-2: #b4b8d8; --muted: #7c80a6;
    --line: #25274a; --line-strong: #30335c; --brand-soft: #262158; --brand-ink: #b3abff;
    --sidebar: #08091a; --sidebar-2: #15163a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 6px 24px -6px rgba(0,0,0,.5); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.6);
    --s-new: #1f2156; --s-new-i: #c7cbff; --s-contacted: #3a2c10; --s-contacted-i: #fcd58a; --s-meeting: #33194f; --s-meeting-i: #e2c2ff;
    --s-proposal: #0c2f44; --s-proposal-i: #9ddcfb; --s-won: #0d3426; --s-won-i: #8ff0c6; --s-lost: #22243c; --s-lost-i: #a3a8c6;
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand-ink); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand); }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 750; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Layout ============ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: radial-gradient(120% 60% at 0% 0%, #2a2470 0%, transparent 60%), var(--sidebar);
  color: var(--sidebar-text); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
  /* the menu scrolls on its own when it's taller than the window (the page behind it doesn't move) */
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar > * { flex-shrink: 0; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.logo:hover { color: #fff; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px -4px rgba(139, 92, 246, .7); }
.logo-mark svg { width: 18px; height: 18px; stroke: #fff; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5f6290; padding: 14px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--sidebar-text);
  font-weight: 550; transition: background .2s var(--ease), color .2s, transform .2s var(--ease); position: relative;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; transform: translateX(2px); }
.nav a.active { background: linear-gradient(90deg, rgba(109, 94, 252, .35), rgba(109, 94, 252, .08)); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #a78bfa; }
.nav .count { margin-left: auto; background: rgba(255,255,255,.1); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.sidebar .spacer { flex: 1; }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 10px; color: var(--sidebar-text); font-size: 12px; }
.lang-row > span { display: inline-flex; align-items: center; gap: 6px; }
.lang-row svg { width: 15px; height: 15px; }
.lang-switch { display: inline-flex; gap: 2px; margin: 0; padding: 3px; border-radius: 10px; background: var(--sidebar-2); }
.lang-switch button { border: 0; background: none; color: inherit; font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.lang-switch button:hover { color: #fff; }
.lang-switch button.on { background: var(--brand); color: #fff; }
.auth-lang, .pick-tools .lang-switch { color: var(--text-2); }
.auth-lang .lang-switch, .pick-tools .lang-switch { background: var(--surface); border: 1px solid var(--line); }
.auth-lang .lang-switch button:hover, .pick-tools .lang-switch button:hover { color: var(--text); }
.auth-lang .lang-switch button.on, .pick-tools .lang-switch button.on { color: #fff; }
.auth-lang { position: absolute; top: 18px; right: 20px; }
.pick-tools { display: inline-flex; align-items: center; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--sidebar-2); }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { color: #fff; display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who span { font-size: 11px; color: var(--sidebar-text); }
.user-card form { margin: 0; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--sidebar-text); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* `backwards`, not `both`: an animation that stays in effect on transform makes .main the containing block
   for position:fixed children (the bulk-assign bar), which then stretch the page below the sidebar. */
.main { min-width: 0; padding: 28px 36px 110px; animation: rise .45s var(--ease) backwards; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--text-2); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 550; margin-bottom: 14px; }
.back svg { width: 16px; height: 16px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--grad); background-size: 140% 140%; color: #fff; font: inherit; font-weight: 650;
  padding: 10px 18px; border-radius: 11px; box-shadow: 0 8px 20px -8px rgba(109, 94, 252, .7);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-position .4s; white-space: nowrap;
}
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(109, 94, 252, .8); background-position: 100% 0; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .7; cursor: progress; transform: none; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { color: var(--text); border-color: var(--brand); }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: none; border: 1px solid transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); box-shadow: none; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }

input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 11px; font: inherit;
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea { resize: vertical; min-height: 44px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 6px; color: var(--text-2); }
.field { margin-bottom: 14px; }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.field ul li label { margin: 0; }
.errorlist { color: var(--danger); margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; font-weight: 500; }

/* Tag picker: checkboxes rendered as toggle chips */
.tag-picker ul li label {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-strong);
  cursor: pointer; font-weight: 550; color: var(--text-2); transition: all .15s var(--ease); background: var(--surface);
}
.tag-picker ul li label:hover { border-color: var(--brand); color: var(--text); }
.tag-picker ul li input { display: none; }
.tag-picker ul li label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.tag-picker ul li label:has(input:checked)::before { content: "✓"; font-weight: 800; }

/* ============ Toasts ============ */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .35s var(--ease) both; transition: opacity .4s, transform .4s var(--ease);
}
.toast.error { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateX(30px); }
.toast .x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

/* ============ Avatars, badges, tags ============ */
.avatar {
  --c1: #6366f1; --c2: #8b5cf6; width: 36px; height: 36px; border-radius: 12px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 4px 12px -4px var(--c1);
}
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.avatar.round { border-radius: 50%; }
.av-0 { --c1: #6366f1; --c2: #8b5cf6; } .av-1 { --c1: #ec4899; --c2: #f43f5e; } .av-2 { --c1: #0ea5e9; --c2: #6366f1; }
.av-3 { --c1: #10b981; --c2: #0ea5e9; } .av-4 { --c1: #f59e0b; --c2: #ef4444; } .av-5 { --c1: #8b5cf6; --c2: #ec4899; }
.av-6 { --c1: #14b8a6; --c2: #22c55e; } .av-7 { --c1: #f97316; --c2: #f59e0b; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.status-new { background: var(--s-new); color: var(--s-new-i); }
.status-contacted { background: var(--s-contacted); color: var(--s-contacted-i); }
.status-meeting { background: var(--s-meeting); color: var(--s-meeting-i); }
.status-proposal { background: var(--s-proposal); color: var(--s-proposal-i); }
.status-won { background: var(--s-won); color: var(--s-won-i); }
.status-lost { background: var(--s-lost); color: var(--s-lost-i); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; margin: 0 4px 4px 0; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: currentColor; }
.tag-gray { background: #f1f5f9; color: #475569; } .tag-red { background: #fef2f2; color: #dc2626; }
.tag-orange { background: #fff7ed; color: #ea580c; } .tag-green { background: #f0fdf4; color: #16a34a; }
.tag-blue { background: #eff6ff; color: #2563eb; } .tag-purple { background: #faf5ff; color: #9333ea; } .tag-pink { background: #fdf2f8; color: #db2777; }
@media (prefers-color-scheme: dark) {
  .tag-gray { background: #262840; color: #cbd5e1; } .tag-red { background: #3b1518; color: #fca5a5; } .tag-orange { background: #3a2210; color: #fdba74; }
  .tag-green { background: #0f3020; color: #86efac; } .tag-blue { background: #132447; color: #93c5fd; } .tag-purple { background: #2c1747; color: #d8b4fe; }
  .tag-pink { background: #3a1430; color: #f9a8d4; }
}

/* ============ Stats ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px;
  color: var(--text); box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--text); }
.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--dot, var(--brand)); opacity: .9; }
.stat .k { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.stat .k i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--brand)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot, var(--brand)) 18%, transparent); }
.stat b { display: block; font-size: 28px; font-weight: 750; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.on { border-color: var(--dot, var(--brand)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--brand)) 16%, transparent), var(--shadow); }
.stat.hero { background: var(--grad); color: #fff; border: 0; box-shadow: var(--shadow-lg); }
.stat.hero .k { color: rgba(255,255,255,.85); }
.stat.hero .k i { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.25); }
.stat.hero::after { display: none; }
.stat.hero::before { content: ""; position: absolute; width: 120px; height: 120px; right: -30px; top: -40px; border-radius: 50%; background: rgba(255,255,255,.14); }
.dot-new { --dot: var(--s-new-d); } .dot-contacted { --dot: var(--s-contacted-d); } .dot-meeting { --dot: var(--s-meeting-d); }
.dot-proposal { --dot: var(--s-proposal-d); } .dot-won { --dot: var(--s-won-d); } .dot-lost { --dot: var(--s-lost-d); } .dot-none { --dot: #f43f5e; }

/* ============ Filters & toolbar ============ */
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 10px; align-items: center; padding: 14px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.search input { padding-left: 38px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 210px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: var(--shadow-sm); }
.segmented a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 13px; transition: all .2s var(--ease); }
.segmented a.on { background: var(--brand-soft); color: var(--brand-ink); }
.segmented a:hover { color: var(--text); }
.segmented svg { width: 16px; height: 16px; }

.bulkbar {
  position: fixed; bottom: 22px; left: calc(50% + 124px); z-index: 30; width: max-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 14px; flex-wrap: wrap;
  background: #14152a; color: #fff; box-shadow: 0 20px 40px -10px rgba(15, 16, 32, .5); transform: translate(-50%, 160%); opacity: 0;
  transition: transform .35s var(--ease), opacity .25s; pointer-events: none;
}
.bulkbar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
@media (max-width: 860px) { .bulkbar { left: 50%; } }
.bulkbar select { width: auto; min-width: 200px; background-color: #23244a; color: #fff; border-color: #34366a; }
.bulkbar b { font-variant-numeric: tabular-nums; }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid var(--line); transition: background .15s; }
tbody tr:last-child { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
tbody tr.selected { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.person { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.person b { color: var(--text); font-weight: 650; }
.person .sub, td .sub { color: var(--muted); font-size: 12.5px; }
.owner { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--text-2); font-weight: 550; }
.when { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ============ Lead detail ============ */
.hero-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 22px; position: relative; overflow: hidden; }
.hero-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.hero-card .ident { flex: 1; min-width: 220px; }
.hero-card h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-card .role { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 18px; width: 100%; }
.pipeline .step { position: relative; padding-top: 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.pipeline .step::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: 99px; background: var(--line); transition: background .4s var(--ease); }
.pipeline .step.done::before { background: var(--grad); }
.pipeline .step.done { color: var(--text-2); }
.pipeline .step.current { color: var(--brand-ink); }
.pipeline.lost .step.done::before { background: var(--s-lost-d); }

.detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.detail .side { position: sticky; top: 20px; }
dl.info { display: grid; grid-template-columns: 22px 1fr; gap: 12px 12px; margin: 0; align-items: center; }
dl.info dt { color: var(--muted); display: grid; place-items: center; }
dl.info dt svg { width: 17px; height: 17px; }
dl.info dd { margin: 0; word-break: break-word; }
dl.info dd small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* conversation */
.thread { list-style: none; padding: 4px 4px 4px 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 14px; max-height: 620px; overflow: auto; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; max-width: 88%; animation: rise .4s var(--ease) both; }
.msg-out { align-self: flex-end; flex-direction: row-reverse; }
.bubble { border-radius: 16px; padding: 12px 14px; min-width: 0; }
.msg-in .bubble { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg-out .bubble { background: linear-gradient(135deg, #6d5efc, #8b5cf6); color: #fff; border-top-right-radius: 4px; box-shadow: 0 10px 24px -12px rgba(109, 94, 252, .9); }
.msg .meta { font-size: 11.5px; margin-bottom: 4px; color: var(--muted); }
.msg-out .meta { color: rgba(255,255,255,.75); }
.msg .subject { font-weight: 650; font-size: 13px; margin-bottom: 4px; }
.msg .body { white-space: pre-wrap; font-size: 13.5px; word-break: break-word; }
.msg .files { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.msg .files a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text); }
.msg .quoted { margin-top: 8px; font-size: 12px; }
.msg .quoted summary { cursor: pointer; opacity: .75; }
.msg .quoted .body { opacity: .7; border-left: 2px solid currentColor; padding-left: 10px; margin-top: 6px; font-size: 12.5px; }
.msg-out a { color: #fff; }

.composer { border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.composer textarea { border: 0; box-shadow: none !important; border-radius: 14px 14px 0 0; padding: 14px; min-height: 120px; background: transparent; }
.composer .bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.composer .bar .hint { color: var(--muted); font-size: 12px; flex: 1; min-width: 160px; }
.attach { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; border: 1px dashed var(--line-strong); color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 13px; margin: 0; transition: all .15s; }
.attach:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.attach input { display: none; }
.attach svg { width: 16px; height: 16px; }
.field ul.file-list { list-style: none; padding: 0 12px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.file-list:not(:empty) { padding: 10px 12px 0 !important; }
.file-list li { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.file-list .file-x { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.file-list .file-x:hover { color: #e11d48; }
.file-list .warn { background: #fffbeb; border-color: #fde68a; color: #b45309; font-weight: 600; }
.file-list .total { background: transparent; border: 0; color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 16px 0 0; position: relative; }
.timeline li { display: flex; gap: 12px; padding: 0 0 18px; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 30px; bottom: 4px; width: 2px; background: var(--line); }
.timeline .meta { color: var(--muted); font-size: 12px; }
.timeline .meta b { color: var(--text); font-weight: 600; }
.timeline .change { color: var(--text-2); font-size: 13px; }
.timeline .note { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 6px; }
.timeline .email { white-space: pre-wrap; background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; margin-top: 6px; color: var(--text); }
.tl-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.tl-icon svg { width: 14px; height: 14px; }

/* ============ Board (kanban) ============ */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 200px; transition: background .2s, border-color .2s; }
.col.over { background: color-mix(in srgb, var(--dot) 10%, var(--surface)); border-color: var(--dot); border-style: dashed; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 700; font-size: 13.5px; }
.col-head i { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.col-head .n { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); padding: 1px 9px; border-radius: 99px; border: 1px solid var(--line); }
.col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px; box-shadow: var(--shadow-sm); cursor: grab;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .2s; display: block; color: var(--text); position: relative;
}
.kcard::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--dot); }
.kcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.kcard.dragging { opacity: .4; transform: rotate(2deg); }
.kcard .top { display: flex; gap: 10px; align-items: center; }
.kcard b { font-weight: 650; font-size: 13.5px; display: block; line-height: 1.3; }
.kcard .sub { color: var(--muted); font-size: 12px; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.kcard .tags { margin-top: 8px; }
.col-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 8px; border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ============ Misc ============ */
.pager { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 18px; }
.pager .range b { color: var(--text); font-variant-numeric: tabular-nums; }
.pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pg {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 10px; font-weight: 600;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
  transition: all .18s var(--ease);
}
a.pg:hover { border-color: var(--brand); color: var(--brand-ink); transform: translateY(-1px); }
.pg.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px rgba(109, 94, 252, .8); }
.pg.off { opacity: .4; }
.pg.gap { border: 0; background: none; min-width: 20px; }
.pager .per { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.pager .per select { width: auto; padding: 6px 30px 6px 10px; }
.col .more { width: 100%; margin-top: 10px; border: 1px dashed var(--line-strong); }
.col .more:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.col .more em { font-style: normal; color: var(--muted); font-weight: 500; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.inline-form .field { margin: 0; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); padding: 6px 6px 6px 12px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.sync-pill .live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: pulse 2s infinite; }
.sync-pill.err .live { background: var(--danger); animation: none; }
.sync-pill form { margin: 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 22px; }
.person-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s; }
.person-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.person-card.inactive { opacity: .55; }
.person-card .top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.person-card .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.person-card .nums div { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.person-card .nums b { display: block; font-size: 18px; font-weight: 750; }
.person-card .nums span { font-size: 11px; color: var(--muted); font-weight: 600; }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-card { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 10px 14px; box-shadow: var(--shadow-sm); }
.tag-card a.n { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.tag-card form { margin: 0; }
.color-picker ul { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.color-picker li label { margin: 0; cursor: pointer; }
.color-picker input { display: none; }
.color-picker .swatch { display: inline-flex; padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 2px solid transparent; transition: transform .15s; }
.color-picker label:has(input:checked) .swatch { border-color: currentColor; transform: scale(1.05); }

/* ============ Auth ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(80% 60% at 20% 20%, rgba(236, 72, 153, .5), transparent 60%), radial-gradient(70% 60% at 80% 80%, rgba(14, 165, 233, .45), transparent 60%), linear-gradient(135deg, #2a1f8f, #6d5efc 55%, #8b5cf6);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); right: -120px; bottom: -120px; box-shadow: 0 0 0 60px rgba(255,255,255,.04), 0 0 0 120px rgba(255,255,255,.03); }
.auth-art h2 { font-size: 38px; line-height: 1.1; letter-spacing: -.03em; font-weight: 800; max-width: 440px; display: block; margin: 0 0 14px; }
.auth-art p { color: rgba(255,255,255,.8); max-width: 400px; font-size: 15px; margin: 0; }
.auth-art .logo { padding: 0; }
.auth-art .logo-mark { background: rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-form form { width: 100%; max-width: 380px; animation: rise .5s var(--ease) both; }
.auth-form h1 { margin-bottom: 6px; }
.auth-form .sub { color: var(--text-2); margin: 0 0 26px; }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
  .detail { grid-template-columns: 1fr; }
  .detail .side { position: static; }
}
/* Phone top bar + slide-in menu (hidden on desktop). */
.m-top, .m-backdrop, .m-close { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .m-top {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 25; padding: 10px 14px;
    background: var(--sidebar); color: #fff; box-shadow: 0 6px 20px -10px rgba(0,0,0,.5);
  }
  .m-top .logo { padding: 0; font-size: 17px; }
  .m-top .logo-mark { width: 30px; height: 30px; }
  .m-burger { position: relative; width: 40px; height: 40px; border: 0; border-radius: 11px; background: rgba(255,255,255,.08); cursor: pointer; display: grid; place-content: center; gap: 4px; padding: 0; }
  .m-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: #fff; }
  .m-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--sidebar); }
  .m-tasks { margin-left: auto; position: relative; width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; }
  .m-tasks:hover { color: #fff; }
  .m-tasks b { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #6d5efc; font-size: 11px; display: grid; place-items: center; }
  .m-tasks b.alert { background: #ef4444; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(290px, 84vw); height: 100%;
    transform: translateX(-102%); transition: transform .3s var(--ease); overflow-y: auto; box-shadow: 20px 0 50px -20px rgba(0,0,0,.6);
  }
  .nav-open .sidebar { transform: none; }
  .m-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 10, 25, .5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .nav-open .m-backdrop { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }
  .m-close { display: block; position: absolute; top: 18px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font-size: 22px; cursor: pointer; }
  .nav a { padding: 12px 12px; }
  .main { padding: 18px 14px 90px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .msg { max-width: 100%; }
  .hide-sm { display: none; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ============ Tasks ============ */
.nav .count.alert { background: #ef4444; color: #fff; animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.overdue-bar {
  display: flex; align-items: center; gap: 10px; margin: -6px 0 20px; padding: 11px 16px; border-radius: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, #ef4444 14%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
  color: var(--text); animation: rise .4s var(--ease) both;
}
.overdue-bar:hover { color: var(--text); border-color: #ef4444; }
.overdue-bar svg { color: #ef4444; }
.overdue-bar .go { margin-left: auto; color: #ef4444; font-weight: 700; transition: transform .2s var(--ease); }
.overdue-bar:hover .go { transform: translateX(4px); }

.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); transition: background .15s, opacity .3s; }
.tasks .task:first-child { border-top: 0; }
.task:hover { background: color-mix(in srgb, var(--brand) 3%, transparent); }
.task .tick {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); flex: none;
  display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0; transition: all .2s var(--ease);
}
.task .tick svg { width: 14px; height: 14px; stroke-width: 3; }
.task .tick:hover { border-color: var(--ok); color: var(--ok); }
.task.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.pop .tick { transform: scale(1.25); }
.task .kind { font-size: 17px; flex: none; }
.task .what { flex: 1; min-width: 0; }
.task .title { color: var(--text); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task.done { opacity: .7; }
.task .sub { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.task .auto { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink); font-weight: 600; }
.task .auto svg { width: 12px; height: 12px; }
.task .due { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.task .due svg { width: 14px; height: 14px; }
.task.late .due { color: #ef4444; }
.avatar.unassigned { --c1: #94a3b8; --c2: #cbd5e1; }
.tasks.compact .task { padding: 9px 0; gap: 10px; }
.tasks.compact .task .title { white-space: normal; font-size: 13.5px; }
.tasks.compact .avatar { display: none; }

.task-group { padding: 6px 20px 10px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 0 8px; cursor: default; list-style: none; }
.group-head::-webkit-details-marker { display: none; }
details > summary.group-head { cursor: pointer; }
.group-head h2 { margin: 0; }
.group-head .n { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.g-overdue { border-color: color-mix(in srgb, #ef4444 35%, var(--line)); }
.g-overdue .group-head h2 { color: #ef4444; }
.g-overdue .group-head .n { background: #ef4444; color: #fff; border-color: transparent; }
.g-today .group-head .n { background: var(--brand-soft); color: var(--brand-ink); }

.team-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.team-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); white-space: nowrap; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s;
}
.team-chip:hover { color: var(--text); transform: translateY(-2px); border-color: var(--brand); }
.team-chip.on { border-color: var(--brand); background: var(--brand-soft); }
.team-chip .nm { font-weight: 650; }
.team-chip .nums { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); }
.late-n { background: #ef4444; color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 11.5px; }
.new-task summary { list-style: none; cursor: pointer; }
.new-task summary::-webkit-details-marker { display: none; }
.new-task:not([open]) { display: none; }

.quick-tasks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chip-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 99px; cursor: pointer; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line); transition: all .15s var(--ease);
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); transform: translateY(-1px); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cal-head h2 { margin: 0 6px; min-width: 150px; text-align: center; display: block; font-size: 17px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 118px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background .15s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: color-mix(in srgb, var(--brand) 3%, transparent); }
.cal-day.out { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal-day.out .num { color: var(--muted); opacity: .6; }
.cal-day .num { font-weight: 700; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .num { background: var(--grad); color: #fff; box-shadow: 0 4px 12px -4px rgba(109, 94, 252, .8); }
.cal-task {
  display: block; font-size: 12px; padding: 4px 7px; border-radius: 7px; background: var(--brand-soft); color: var(--brand-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--brand); transition: transform .15s;
}
.cal-task:hover { transform: translateX(2px); color: var(--brand-ink); }
.cal-task b { font-weight: 700; }
.cal-task.late { background: color-mix(in srgb, #ef4444 12%, var(--surface)); color: #dc2626; border-left-color: #ef4444; }
.cal-task.done { background: var(--surface-2); color: var(--muted); border-left-color: var(--ok); text-decoration: line-through; }
.cal-more { font-size: 11.5px; color: var(--muted); font-weight: 600; padding-left: 4px; }

/* scenarios */
.scenarios { display: grid; gap: 12px; margin-bottom: 18px; }
.scenario { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: opacity .2s, transform .2s var(--ease); }
.scenario:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.scenario.off { opacity: .55; }
.scenario .flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.scenario .when { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; font-size: 13px; }
.scenario .when svg { width: 15px; height: 15px; }
.scenario .arrow { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.scenario .then { padding: 6px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.scenario .meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scenario .meta form { margin: 0; }
.switch { width: 44px; height: 24px; border-radius: 99px; border: 0; background: var(--line-strong); position: relative; cursor: pointer; padding: 0; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--ease); }
.switch.on { background: var(--ok); }
.switch.on i { transform: translateX(20px); }
.toast.reminder { border-left-color: var(--brand); }
.toast.reminder a { color: var(--text); font-weight: 600; }

@media (max-width: 860px) {
  .cal-day { min-height: 70px; padding: 4px; }
  .cal-task { font-size: 10.5px; padding: 2px 4px; }
  .cal-task b { display: none; }
  .task .avatar { display: none; }
}

/* date + time picker for tasks */
.due-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.due-row label { margin-bottom: 6px; }
.time-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.time-chip {
  font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px; cursor: pointer;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); transition: all .15s var(--ease);
}
.time-chip b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.time-chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.time-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.time-chip.on b { color: var(--brand-ink); }
input[type=date] { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 11px; font: inherit; background: var(--surface); color: var(--text); color-scheme: light dark; }
input[type=date]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }

/* ============ Sales ============ */
.deal-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.deal-summary div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
.deal-summary small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.deal-summary b { display: block; font-size: 15px; font-weight: 750; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.deal-summary div:last-child { background: var(--brand-soft); border-color: transparent; }
.deal-summary div:last-child b { color: var(--brand-ink); }
.lost-box { background: color-mix(in srgb, #ef4444 9%, var(--surface)); border: 1px solid color-mix(in srgb, #ef4444 25%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.sub-section { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.sub-section > summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; font-size: 13.5px; }
.mini-list { list-style: none; margin: 0 0 8px; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li > a, .mini-list li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.mini-list .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-list form { margin: 0; }
.icon-del { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.icon-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.offer-st, .pay-st { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.st-draft { background: var(--s-lost); color: var(--s-lost-i); }
.st-sent { background: var(--s-proposal); color: var(--s-proposal-i); }
.st-accepted, .ps-paid { background: var(--s-won); color: var(--s-won-i); }
.st-rejected, .ps-overdue { background: color-mix(in srgb, #ef4444 14%, var(--surface)); color: #dc2626; }
.ps-unpaid { background: var(--s-contacted); color: var(--s-contacted-i); }
.ps-partial { background: var(--s-new); color: var(--s-new-i); }
.pay-progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 6px 0 6px; }
.pay-progress span { display: block; height: 100%; max-width: 100%; background: var(--ok); border-radius: 99px; }
.kval { color: var(--text); font-weight: 750; font-size: 12.5px; }

/* offer editor */
.items input { padding: 7px 9px; }
.items td { vertical-align: top; padding: 8px 10px; }
.items td:nth-child(n+2):nth-child(-n+5) input { min-width: 80px; text-align: right; }
.items .line-total { text-align: right; font-weight: 700; white-space: nowrap; padding-top: 16px; font-variant-numeric: tabular-nums; }
.items .removed { opacity: .35; }
.items .removed input { text-decoration: line-through; }
.row-del { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px; border-radius: 8px; display: inline-block; margin: 0; }
.row-del:hover { color: var(--danger); }
.row-del input { display: none; }
.totals { display: grid; gap: 6px; justify-content: end; padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.totals div, .doc-totals div { display: flex; justify-content: space-between; gap: 40px; min-width: 300px; font-variant-numeric: tabular-nums; }
.totals span, .doc-totals span { color: var(--text-2); }
.totals .grand, .doc-totals .grand { font-size: 18px; border-top: 2px solid var(--text); padding-top: 8px; margin-top: 4px; }
.totals .grand span, .doc-totals .grand span { color: var(--text); font-weight: 700; }
.offer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; }

/* printable offer document */
.offer-doc { padding: 40px 44px; max-width: 900px; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 3px solid transparent; border-image: var(--grad) 1; }
.doc-kicker { font-size: 12px; font-weight: 800; letter-spacing: .2em; color: var(--brand-ink); }
.doc-title { font-size: 22px; margin: 6px 0 0; display: block; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; font-size: 13px; }
.doc-meta dt { color: var(--muted); }
.doc-meta dd { margin: 0; font-weight: 650; text-align: right; }
.doc-to { display: flex; flex-direction: column; gap: 2px; margin: 24px 0; font-size: 13.5px; }
.doc-to small { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 700; }
.doc-to b { font-size: 16px; }
.doc-items th { background: var(--surface-2); }
.doc-items td, .doc-items th { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.doc-items .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-totals { display: grid; gap: 6px; justify-content: end; margin-top: 18px; }
.doc-notes { margin-top: 28px; padding: 16px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.doc-notes small { display: block; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; margin-bottom: 6px; }
.doc-notes p { margin: 0; }
.doc-foot { margin-top: 28px; font-size: 12px; color: var(--muted); }

@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f5f6fa; --text: #111; --text-2: #444; --muted: #777; --line: #ddd; }
  body { background: #fff; }
  .sidebar, .no-print, .toasts, .overdue-bar, .bulkbar { display: none !important; }
  .app { display: block; }
  .main { padding: 0; animation: none; }
  .offer-doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .doc-items tr { break-inside: avoid; }
}

/* sales report */
.info-bar { padding: 11px 16px; border-radius: 12px; background: var(--brand-soft); color: var(--text); margin-bottom: 16px; font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.kpi:hover { transform: translateY(-2px); }
.kpi small { display: block; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.kpi b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi.hero { background: var(--grad); color: #fff; border: 0; box-shadow: var(--shadow-lg); grid-row: span 1; }
.kpi.hero small, .kpi.hero span { color: rgba(255,255,255,.85); }
.kpi.bad { border-color: color-mix(in srgb, #ef4444 40%, var(--line)); }
.kpi.bad b { color: #dc2626; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-grid .card { margin-bottom: 0; }
.report-grid + .card, .report-grid ~ .card { margin-top: 18px; }

.hbars { display: grid; gap: 10px; margin: 6px 0 12px; }
.hbar { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar .lbl { display: flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .lbl i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex: none; }
.hbar .lbl em, .hbar .val em { font-style: normal; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.hbar .track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--dot, var(--brand)); transition: width .6s var(--ease); }
.hbar .fill.lost { background: #94a3b8; }
.hbar .val { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; min-width: 90px; }

.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.v-won { background: var(--brand); }
.v-col { background: #10b981; }
.vbars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 200px; align-items: end; padding-top: 18px; border-bottom: 1px solid var(--line); }
.vbar-group { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; position: relative; }
.vbar-pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.vbar { width: 40%; max-width: 26px; min-height: 2px; border-radius: 4px 4px 0 0; position: relative; transition: height .6s var(--ease), filter .15s; }
.vbar:hover { filter: brightness(1.15); }
.vbar em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; padding-bottom: 2px; }
.vlbl { position: absolute; top: 100%; font-size: 11.5px; color: var(--muted); padding-top: 6px; white-space: nowrap; }
.vbars + * { margin-top: 28px; }

/* lost-reason dialog */
.modal { border: 0; border-radius: 18px; padding: 24px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.modal::backdrop { background: rgba(15, 16, 32, .45); backdrop-filter: blur(3px); }
.modal h2 { display: block; font-size: 18px; margin: 0 0 4px; }

@media (max-width: 1000px) {
  .report-grid { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 110px 1fr auto; }
  .offer-doc { padding: 24px 18px; }
  .totals div, .doc-totals div { min-width: 0; }
}

/* ============ Phone layouts ============ */
.offer-head { grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(150px, 1fr)); }
.kcard { cursor: pointer; }
.kcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kmove { display: none; }
.jump, .cal-agenda { display: none; }
.card[id], form[id] { scroll-margin-top: 76px; }

/* Touch screens can't drag cards: show a "move to" picker on every card instead. */
@media (hover: none), (max-width: 860px) {
  .kmove {
    display: block; width: 100%; margin-top: 10px; padding: 7px 30px 7px 10px; font-size: 12.5px; font-weight: 600;
    border-radius: 9px; background-color: var(--surface-2);
  }
}

@media (max-width: 860px) {
  .page-head { margin-bottom: 16px; }
  .page-head .toolbar { width: 100%; }
  .sync-pill { flex-wrap: wrap; }

  /* status counters: one swipeable row instead of a wall of cards */
  .stats { display: flex; overflow-x: auto; gap: 10px; margin: 0 -14px 16px; padding: 2px 14px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { flex: 0 0 auto; min-width: 118px; padding: 12px 14px 10px; scroll-snap-align: start; }
  .stat b { font-size: 22px; }
  .filters { grid-template-columns: 1fr 1fr !important; }
  .filters .search { grid-column: 1 / -1; }

  /* lead list: each row becomes a card */
  .lead-table thead { display: none; }
  .lead-table, .lead-table tbody { display: block; }
  .lead-table tr.clickable {
    display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line);
  }
  .lead-table td { padding: 0; display: block; min-width: 0; }
  .lead-table .c-check { grid-row: 1; grid-column: 1; }
  .lead-table .c-person { grid-row: 1; grid-column: 2; }
  .lead-table .person { min-width: 0; }
  .lead-table .c-when { grid-row: 1; grid-column: 3; font-size: 11.5px; align-self: start; }
  .lead-table .c-company, .lead-table .c-status, .lead-table .c-tags, .lead-table .c-owner { grid-column: 2 / -1; }
  .lead-table tr:not(:has(.c-check)) .c-person { grid-column: 1 / 3; }
  .lead-table tr:not(:has(.c-check)) .c-company, .lead-table tr:not(:has(.c-check)) .c-status,
  .lead-table tr:not(:has(.c-check)) .c-tags { grid-column: 1 / -1; }
  .lead-table .c-company { font-size: 13px; }
  .lead-table .c-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .lead-table .c-status .sub { margin: 0 !important; }
  .lead-table .c-tags:has(.muted) { display: none; }
  .lead-table .c-tags .tag { margin-bottom: 0; }
  .lead-table .c-owner { font-size: 12.5px; grid-column: 3; justify-self: end; }
  .lead-table .c-status { grid-column: 2; }
  .bulkbar { bottom: 12px; padding: 8px 10px; gap: 8px; }
  .bulkbar select { min-width: 0; flex: 1; }
  .pager { justify-content: center; }
  .pager .range { width: 100%; text-align: center; }

  /* lead page: section shortcuts, tighter header */
  .jump {
    display: flex; gap: 8px; overflow-x: auto; position: sticky; top: 60px; z-index: 15; margin: -6px -14px 14px; padding: 8px 14px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); scrollbar-width: none;
  }
  .jump::-webkit-scrollbar { display: none; }
  .jump a { flex: none; padding: 7px 13px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 13px; box-shadow: var(--shadow-sm); }
  .jump b { background: var(--brand-soft); color: var(--brand-ink); border-radius: 99px; padding: 0 6px; font-size: 11px; }
  .hero-card { padding: 18px; gap: 12px; }
  .hero-card .avatar.lg { width: 48px; height: 48px; border-radius: 15px; font-size: 17px; }
  .hero-card h1 { font-size: 20px; }
  .quick { width: 100%; }
  .quick .btn { flex: 1; }
  .pipeline .step { font-size: 10.5px; }
  .thread { max-height: 460px; }
  .composer .bar .hint { display: none; }
  .composer .bar { justify-content: space-between; }
  .card { padding: 16px; }
  .card.flush { padding: 0; }
  .deal-summary b { font-size: 13.5px; }

  /* calendar: grid shows dots, the agenda below lists the tasks */
  .cal-head { flex-wrap: wrap; padding: 12px; }
  .cal-head h2 { min-width: 0; flex: 1; font-size: 16px; }
  .cal-head .btn[href*="ay="]:last-child { margin-left: 0 !important; }
  .cal-dow { padding: 8px 2px; text-align: center; font-size: 10px; letter-spacing: 0; }
  .cal-day { min-height: 54px; padding: 4px 2px; align-items: center; gap: 3px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: center; }
  /* side margins fill the row, so the task dots always start on the line below the number */
  .cal-day .num { width: 24px; height: 24px; font-size: 12px; flex: none; margin: 0 calc(50% - 12px) 2px; }
  .cal-grid .cal-task { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; font-size: 0; background: var(--brand); }
  .cal-grid .cal-task.late { background: #ef4444; }
  .cal-grid .cal-task.done { background: var(--ok); }
  .cal-grid .cal-more { display: none; }
  .cal-agenda { display: grid; gap: 12px; margin-top: 16px; }
  .agenda-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; }
  .agenda-day.today { border-color: var(--brand); }
  .agenda-day h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 650; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
  .agenda-day h3 b { font-size: 18px; color: var(--text); }
  .agenda-day h3 span { margin-left: auto; font-size: 11px; background: var(--brand-soft); color: var(--brand-ink); padding: 2px 8px; border-radius: 99px; }
  .agenda-day .cal-task { white-space: normal; font-size: 13px; padding: 8px 10px; }

  /* board: narrower columns so the next one peeks in */
  .board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 12px; }
  .col { scroll-snap-align: start; }

  /* offer editor: each line item becomes a small form */
  .offer-head { grid-template-columns: 1fr; }
  .items thead { display: none; }
  .items, .items tbody { display: block; }
  .items .item-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .items td { padding: 0; display: block; }
  .items td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
  .items td:first-child { grid-column: 1 / -1; padding-right: 36px; }
  .items td:nth-child(n+2):nth-child(-n+5) input { min-width: 0; width: 100%; }
  .items .line-total { padding-top: 0; text-align: left; font-size: 15px; }
  .items td:last-child { position: absolute; top: 30px; right: 10px; }
  .totals { justify-content: stretch; }
  .totals div { min-width: 0; }
  .offer-actions .btn { flex: 1; }

  /* report */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 18px; }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi.hero b { font-size: 26px; }
  .hbar { grid-template-columns: 1fr auto; grid-template-areas: "lbl val" "track track"; gap: 4px 8px; }
  .hbar .lbl { grid-area: lbl; }
  .hbar .val { grid-area: val; min-width: 0; }
  .hbar .track { grid-area: track; }
  .vbars { height: 160px; gap: 4px; }
  .vlbl { font-size: 10px; }
  .vbar em { display: none; }

  /* tasks */
  .task { gap: 10px; align-items: flex-start; }
  .task .due { font-size: 11.5px; }
  .team-strip { margin: 0 -14px 14px; padding: 0 14px 6px; }
  .new-task .inline-form .field[style] { grid-column: auto !important; }
  .people-grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
}

/* ============ Customer management ============ */
#filters { grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(120px, 1fr)) auto; }
.dup-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; }
.dup-box ul { margin: 6px 0 0; padding-left: 18px; }
.dup-box a { color: #92400e; font-weight: 700; text-decoration: underline; }
@media (prefers-color-scheme: dark) { .dup-box, .dup-box a { background: #3a2c10; border-color: #6b4f16; color: #fcd58a; } }
.manual-note { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 16px; }
.manual-note p { margin: 0 0 10px; }
.manual-note p:last-child { margin: 10px 0 0; }

.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.company-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; display: block; }
.company-card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.company-card .top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.company-card .top b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-card .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-card .top .badge { margin-left: auto; }
.company-card .nums { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 10px; }
.company-card .nums b { color: var(--text); font-size: 14px; }

.steps { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 10px; font-size: 13.5px; }
.imp-error td { background: color-mix(in srgb, #ef4444 5%, transparent); }
.imp-duplicate td { background: color-mix(in srgb, #f59e0b 6%, transparent); }

@media (max-width: 1100px) { #filters { grid-template-columns: 1fr 1fr; } #filters .search { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .company-grid { grid-template-columns: 1fr; }
  .page-head .toolbar .btn { flex: 1; }
}

/* ============ Projects ============ */
.pc-purple { --pc1: #6d5efc; --pc2: #a855f7; }
.pc-green { --pc1: #10b981; --pc2: #0ea5e9; }
.pc-blue { --pc1: #3b82f6; --pc2: #6366f1; }
.pc-orange { --pc1: #f97316; --pc2: #f59e0b; }
.pc-pink { --pc1: #ec4899; --pc2: #f43f5e; }
.pc-red { --pc1: #ef4444; --pc2: #f97316; }
.pc-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--pc1, #6d5efc), var(--pc2, #a855f7)); box-shadow: 0 6px 16px -6px var(--pc1, #6d5efc); }
.pc-avatar { --c1: var(--pc1); --c2: var(--pc2); }
.pc-chip { display: inline-block; margin: 4px 4px 0 0; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, var(--pc1), var(--pc2)); }

.proj-switch { display: flex; align-items: center; gap: 10px; margin: -8px 0 10px; padding: 10px; border-radius: 13px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: #fff; transition: background .2s; }
.proj-switch:hover { background: rgba(255,255,255,.11); color: #fff; }
.proj-switch .pj { min-width: 0; flex: 1; }
.proj-switch .pj small { display: block; font-size: 10.5px; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: .06em; }
.proj-switch .pj b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-switch .pj-change { font-size: 11px; color: var(--sidebar-text); border: 1px solid rgba(255,255,255,.15); padding: 2px 8px; border-radius: 99px; }
.m-proj { font-size: 15px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pick-wrap { min-height: 100vh; display: grid; place-items: start center; padding: 48px 16px;
  background: radial-gradient(60% 50% at 10% 0%, rgba(109, 94, 252, .16), transparent 60%), radial-gradient(50% 40% at 100% 100%, rgba(236, 72, 153, .12), transparent 60%), var(--bg); }
.pick { width: 100%; max-width: 860px; animation: rise .45s var(--ease) backwards; }
.pick-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 34px; }
.pick-head .logo { color: var(--text); padding: 0; }
.pick-head form { margin: 0; }
.pick h1 { font-size: 30px; }
.pick .sub { color: var(--text-2); margin: 6px 0 24px; font-size: 15px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pick-card { margin: 0; }
.pick-card button {
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s, border-color .2s;
}
.pick-card button::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--pc1), var(--pc2)); }
.pick-card button:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--pc1); }
.pick-card.current button { border-color: var(--pc1); }
.pick-card .pc-mark { width: 48px; height: 48px; border-radius: 15px; font-size: 16px; margin-bottom: 4px; }
.pc-name { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.pc-desc { color: var(--text-2); font-size: 13px; }
.pc-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.pc-stats b { color: var(--text); }
.pc-stats .late, .pc-stats .late b { color: #ef4444; }
.pc-go { margin-top: 8px; font-weight: 700; color: var(--pc1); }

/* CC on replies */
.cc-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.cc-row label { margin: 0; font-weight: 700; color: var(--muted); font-size: 12.5px; }
.cc-row input { border: 0; box-shadow: none !important; padding: 4px 0; background: transparent; }
.cc-keep { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 12.5px; color: var(--text-2); }
.cc-keep input { margin-top: 2px; }
.msg .meta.cc { margin-top: -2px; }
.to-row span { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-row b { color: var(--text); }

/* Unread customer messages */
.new-msg { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; }
.new-msg.hot { background: #ef4444; color: #fff; box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); animation: pulse-red 2s infinite; }
.kcard .new-msg { display: table; margin: 4px 0 2px; }
.unread-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 11px 16px; border-radius: 12px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); color: var(--text); }
.unread-bar:hover { color: var(--text); border-color: var(--brand); }
.unread-bar span { margin-left: auto; color: var(--brand-ink); font-weight: 650; white-space: nowrap; }
.unread-bar.on { background: var(--surface); }

form.inline { display: inline-flex; margin: 0; }
