:root {
  color-scheme: light;
  --paper: #f3f6f8;
  --paper-subtle: #eef2f5;
  --surface: #ffffff;
  --surface-tint: #f8fafb;
  --ink: #0f1c19;
  --ink-secondary: #334640;
  --muted: #64746f;
  --line: #e2e8ec;
  --line-strong: #cdd7dd;

  --brand: #0f6d57;
  --brand-hover: #0b5745;
  --brand-soft: #e7f5f0;
  --brand-border: #b6dfd0;

  --sidebar: #0d1f1c;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active: rgba(52, 211, 153, .14);
  --sidebar-accent: #34d399;
  --sidebar-text: #a5bcb4;
  --sidebar-muted: #67837a;
  --sidebar-line: rgba(255, 255, 255, .09);

  --tone-emerald: #0f766e;
  --tone-emerald-bg: #e6f7f2;
  --tone-blue: #1d4ed8;
  --tone-blue-bg: #eff6ff;
  --tone-amber: #b45309;
  --tone-amber-bg: #fef3c7;
  --tone-rose: #be123c;
  --tone-rose-bg: #ffe4e6;
  --tone-violet: #6d28d9;
  --tone-violet-bg: #f3e8ff;
  --tone-slate: #475569;
  --tone-slate-bg: #f1f5f9;

  --focus: #0f6d57;
  --focus-ring: 0 0 0 3px rgba(15, 109, 87, .18);
  --shadow-xs: 0 1px 2px rgba(15, 28, 25, .04);
  --shadow-sm: 0 1px 3px rgba(15, 28, 25, .05), 0 6px 18px -10px rgba(15, 28, 25, .08);
  --shadow-md: 0 12px 32px -12px rgba(15, 28, 25, .14), 0 2px 6px rgba(15, 28, 25, .05);
  --shadow-lg: 0 24px 64px -16px rgba(9, 24, 20, .28);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  font: 14.5px/1.55 "Inter", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; color: var(--ink); background: var(--paper); }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input, select, textarea { color: var(--ink); }
input::placeholder, textarea::placeholder { color: #879792; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: .84em;
  background: var(--tone-slate-bg);
  color: var(--ink-secondary);
  padding: .12rem .38rem;
  border-radius: 5px;
}

.icon {
  display: block;
  width: 1.12rem;
  height: 1.12rem;
  flex: 0 0 1.12rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.symbol-library { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.muted, .table-secondary { color: var(--muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--brand);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.eyebrow-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: var(--sidebar-accent);
  box-shadow: 0 0 10px rgba(52, 211, 153, .7);
}

/* Buttons */
.button, .icon-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.button {
  padding: .5rem .95rem;
  min-height: 2.35rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  white-space: nowrap;
  background: var(--brand-soft);
  color: var(--brand);
}
.button:hover:not(:disabled) { background: #d8efe6; text-decoration: none; }
.button.primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 1px 2px rgba(15, 109, 87, .25);
}
.button.primary:hover:not(:disabled) { background: var(--brand-hover); }
.button.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-secondary);
  box-shadow: var(--shadow-xs);
}
.button.ghost:hover:not(:disabled) {
  background: var(--surface-tint);
  border-color: var(--line-strong);
  color: var(--ink);
}
.button.small { padding: .34rem .7rem; min-height: 2rem; font-size: .83rem; }
.button.small .icon { width: .96rem; height: .96rem; flex-basis: .96rem; }
.button.danger { color: var(--tone-rose); background: var(--tone-rose-bg); border-color: #fecdd3; }
.button.danger:hover:not(:disabled) { background: #fecdd3; }

.icon-button {
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  flex-shrink: 0;
}
.icon-button:hover:not(:disabled) { background: var(--paper-subtle); color: var(--ink); }

.text-button {
  background: transparent;
  color: var(--brand);
  border-radius: 6px;
  font-size: .86rem;
  padding: .24rem .45rem;
}
.text-button:hover:not(:disabled) { background: var(--brand-soft); text-decoration: none; }

/* Avatars */
.avatar {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  color: var(--tone-emerald);
  background: var(--tone-emerald-bg);
  font-weight: 700;
  font-size: .84rem;
  letter-spacing: -.02em;
}
.avatar.avatar-color-1, .avatar.blue { background: var(--tone-blue-bg); color: var(--tone-blue); }
.avatar.avatar-color-2, .avatar.violet { background: var(--tone-violet-bg); color: var(--tone-violet); }
.avatar.avatar-color-3, .avatar.amber { background: var(--tone-amber-bg); color: var(--tone-amber); }
.avatar.avatar-color-4, .avatar.rose { background: var(--tone-rose-bg); color: var(--tone-rose); }
.avatar.avatar-lg { width: 2.65rem; height: 2.65rem; border-radius: 12px; font-size: 1rem; }

/* App Shell */
.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar-backdrop { display: none; }

.sidebar {
  position: sticky;
  inset-block-start: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, .06);
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: .72rem;
  color: #f6fbf8;
  font-size: 1.15rem;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: .01em;
}
.sidebar .brand { padding: 2px .55rem 4px; }
.brand small {
  display: block;
  color: var(--sidebar-muted);
  font-size: .72rem;
  font-weight: 500;
  margin-top: .22rem;
  letter-spacing: 0;
}
.brand-badge {
  display: inline-block;
  font-style: normal;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #0d1f1c;
  background: var(--sidebar-accent);
  padding: .08rem .35rem;
  border-radius: 5px;
  vertical-align: middle;
  margin-left: .2rem;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  color: #0b2922;
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
  box-shadow: 0 4px 14px rgba(52, 211, 153, .22);
}
.brand-icon .icon { width: 1.35rem; height: 1.35rem; stroke-width: 1.9; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 1.45rem;
  overflow-y: auto;
  padding-right: 2px;
}
.nav-label {
  color: var(--sidebar-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 0 .7rem;
  margin: 1rem 0 .32rem;
}
.nav-label:first-child { margin-top: 0; }
.nav-link {
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  text-align: start;
  padding: .56rem .72rem;
  min-height: 2.45rem;
  color: var(--sidebar-text);
  background: transparent;
  border-radius: 9px;
  font-size: .88rem;
  font-weight: 540;
  transition: background-color .14s ease, color .14s ease;
}
.nav-link .nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { background: var(--sidebar-hover); color: #f1faf6; }
.nav-link:is(.active, .is-active, [aria-current="page"], [aria-current="true"]) {
  background: var(--sidebar-active);
  color: #ffffff;
  font-weight: 640;
  box-shadow: inset 3px 0 0 var(--sidebar-accent);
}
.nav-link:is(.active, .is-active, [aria-current="page"], [aria-current="true"]) .icon { color: var(--sidebar-accent); }

.nav-badge {
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: .08rem .44rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #d6ebe3;
  line-height: 1.4;
}
.nav-badge-danger {
  background: rgba(244, 63, 94, .22);
  color: #fda4af;
}

.sidebar-bottom {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem .45rem .15rem;
  border-top: 1px solid var(--sidebar-line);
  margin-top: auto;
}
.profile-avatar {
  background: rgba(52, 211, 153, .18);
  color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, .25);
}
.profile { min-width: 0; flex: 1; display: grid; gap: 1px; font-size: .75rem; }
.profile strong {
  color: #f4fbf8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
}
.profile span { color: var(--sidebar-muted); }
.sidebar-bottom .icon-button { color: var(--sidebar-text); }
.sidebar-bottom .icon-button:hover { background: var(--sidebar-hover); color: #fff; }

/* Workspace & Topbar */
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1.1rem, 2.4vw, 2.2rem);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-start { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.global-search {
  display: flex;
  align-items: center;
  gap: .52rem;
  color: var(--muted);
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 2.35rem;
  padding: 0 .68rem;
  background: var(--surface-tint);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.global-search:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: 0;
  font-size: .86rem;
}
.global-search input:focus-visible { outline: none; }
.global-search kbd {
  display: grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 5px;
  font-size: .72rem;
  font-family: inherit;
  box-shadow: 0 1px 0 var(--line);
}
.topbar-end, .top-date, .mode-chip { display: flex; align-items: center; gap: .42rem; white-space: nowrap; }
.topbar-end { gap: .7rem; }
.top-date { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.top-date .icon { width: .96rem; height: .96rem; flex-basis: .96rem; }
.mode-chip {
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  font-size: .76rem;
  font-weight: 700;
  padding: .22rem .6rem;
}
.mode-chip::before {
  content: "";
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: #10b981;
}
.mobile-menu { display: none; }

/* Main Content */
.main-content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px clamp(1.1rem, 2.4vw, 2.2rem) 44px;
}
.main-content:focus { outline: none; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-heading h1 {
  font-size: clamp(1.38rem, 2vw, 1.65rem);
  line-height: 1.25;
  letter-spacing: -.028em;
  font-weight: 760;
}
.page-heading p { margin-top: .25rem; color: var(--muted); font-size: .88rem; }
.page-heading-actions { display: flex; align-items: center; gap: .52rem; flex-wrap: wrap; }

/* Cards */
.section-card {
  min-width: 0;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .8rem;
  margin-bottom: 14px;
}
.section-heading h2 { font-size: 1rem; font-weight: 720; line-height: 1.35; letter-spacing: -.015em; }
.section-heading h3 { font-size: .95rem; font-weight: 700; line-height: 1.35; }
.section-heading p { color: var(--muted); font-size: .81rem; margin-top: .18rem; }
.section-footer {
  border-top: 1px solid var(--line);
  font-size: .83rem;
  margin-top: 14px;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Dashboard Action Strip */
.action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.action-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.action-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--card-accent, var(--brand));
}
.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--card-accent-border, var(--line-strong));
}
.action-card.tone-rose {
  --card-accent: #e11d48;
  --card-accent-bg: #fff1f2;
  --card-accent-text: #be123c;
  --card-accent-border: #fda4af;
}
.action-card.tone-teal {
  --card-accent: #0f6d57;
  --card-accent-bg: #e7f5f0;
  --card-accent-text: #0f6d57;
  --card-accent-border: #86efac;
}
.action-card.tone-amber {
  --card-accent: #d97706;
  --card-accent-bg: #fffbeb;
  --card-accent-text: #b45309;
  --card-accent-border: #fcd34d;
}
.action-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.action-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  background: var(--card-accent-bg);
  color: var(--card-accent-text);
}
.action-card-tag {
  font-size: .74rem;
  font-weight: 700;
  padding: .16rem .5rem;
  border-radius: 999px;
  background: var(--card-accent-bg);
  color: var(--card-accent-text);
}
.action-card-body {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.action-card-count {
  font-size: clamp(1.7rem, 2.5vw, 2.05rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--ink);
}
.action-card-meta { display: grid; gap: 2px; min-width: 0; }
.action-card-meta strong { font-size: .92rem; font-weight: 700; }
.action-card-meta span {
  font-size: .78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-card-arrow {
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: var(--muted);
  opacity: .55;
  transition: transform .15s ease, opacity .15s ease, color .15s ease;
}
.action-card:hover .action-card-arrow {
  transform: translateX(3px);
  opacity: 1;
  color: var(--card-accent-text);
}

/* Dashboard Metric Grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metric-card {
  text-align: start;
  display: grid;
  gap: .3rem;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.metric-card:hover {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  font-size: .83rem;
  font-weight: 640;
  color: var(--muted);
}
.metric-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.metric-icon .icon { width: 1rem; height: 1rem; flex-basis: 1rem; }
.metric-icon.mint { color: var(--tone-emerald); background: var(--tone-emerald-bg); }
.metric-icon.blue { color: var(--tone-blue); background: var(--tone-blue-bg); }
.metric-icon.amber { color: var(--tone-amber); background: var(--tone-amber-bg); }
.metric-icon.violet { color: var(--tone-violet); background: var(--tone-violet-bg); }
.metric-card > strong {
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.metric-note { color: var(--muted); font-size: .77rem; }

/* Dashboard Revenue Strip */
.revenue-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 13px 18px;
  margin-bottom: 16px;
  background: linear-gradient(95deg, #f8fcfa 0%, #ffffff 55%, #f7f9fc 100%);
}
.revenue-strip-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.revenue-strip-title {
  font-size: .84rem;
  font-weight: 720;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.revenue-strip-totals { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.revenue-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .24rem .62rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
}
.revenue-chip strong { font-size: .92rem; color: var(--brand); font-weight: 760; }
.revenue-strip-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Dashboard Bento Grid */
.dashboard-bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.bento-span-7 { grid-column: span 7; }
.bento-span-5 { grid-column: span 5; }

/* Stage Funnel */
.stage-list { display: grid; gap: 11px; }
.stage-row { min-width: 0; }
.stage-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  font-size: .83rem;
  margin-bottom: 5px;
}
.stage-row-label { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink-secondary); font-weight: 560; }
.stage-row-val { display: inline-flex; align-items: baseline; gap: .4rem; font-variant-numeric: tabular-nums; }
.stage-row-val strong { color: var(--ink); font-weight: 700; }
.stage-row-val small { color: var(--muted); font-size: .75rem; min-width: 2.6rem; text-align: right; }
.progress-track { height: 7px; border-radius: 999px; overflow: hidden; background: var(--paper-subtle); }
.progress-fill { height: 100%; border-radius: inherit; transition: width .35s ease; }

/* Priority Tasks & Owner Ranking */
.task-row, .rank-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .68rem .45rem;
  border-top: 1px solid #edf1f4;
  min-width: 0;
  border-radius: 8px;
  transition: background-color .14s ease;
}
.task-row:first-child, .rank-row:first-child { border-top: 0; }
.task-row:hover { background: var(--surface-tint); }
.task-icon {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: var(--tone-amber-bg);
  color: var(--tone-amber);
  border-radius: 9px;
}
.task-icon .icon { width: .98rem; height: .98rem; }
.task-icon-overdue { background: var(--tone-rose-bg); color: var(--tone-rose); }
.task-icon-upcoming { background: var(--tone-emerald-bg); color: var(--tone-emerald); }
.task-body, .rank-body { flex: 1; min-width: 0; }
.task-body p, .rank-body small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: .8rem;
  margin-top: 2px;
}
.task-body .text-button {
  margin-left: -.45rem;
  font-weight: 700;
  color: var(--ink);
  font-size: .88rem;
}
.task-body .text-button:hover { color: var(--brand); }
.task-end { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.task-date { color: var(--muted); font-size: .79rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.text-button.rank-row {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  text-align: start;
  color: var(--ink);
  padding: .62rem .55rem;
  border-radius: 10px;
}
.text-button.rank-row:hover { background: var(--surface-tint); }
.rank-index {
  width: 1.35rem;
  text-align: center;
  font-size: .78rem;
  font-weight: 750;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rank-index.top { color: var(--brand); }
.rank-body strong { font-size: .88rem; font-weight: 680; display: block; }
.rank-bar-wrap { margin-top: 4px; max-width: 220px; }
.rank-value { text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rank-value strong { display: block; font-size: .92rem; color: var(--ink); }
.rank-value small { color: var(--muted); font-size: .74rem; font-weight: 500; }

/* Grade Ring */
.grade-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  min-height: 168px;
  padding: 6px 0;
}
.grade-ring {
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
  border-radius: 50%;
  background: var(--paper-subtle);
  isolation: isolate;
}
.grade-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: var(--surface);
  z-index: -1;
}
.ring-label { text-align: center; font-variant-numeric: tabular-nums; }
.ring-label strong { display: block; font-size: 1.28rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.15; }
.ring-label span { font-size: .72rem; color: var(--muted); }
.grade-legend { flex: 1; max-width: 260px; min-width: 185px; display: grid; gap: .46rem; font-size: .81rem; }
.grade-legend-row { display: flex; align-items: center; gap: .44rem; white-space: nowrap; }
.grade-legend-row strong { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.grade-legend-row small { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; min-width: 2.4rem; text-align: right; }
.grade-dot, .legend-dot { width: .58rem; height: .58rem; flex-shrink: 0; border-radius: 50%; display: inline-block; }

/* Queue Toolbar & Filters */
.queue-toolbar { margin-bottom: 14px; }
.quick-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
}
.queue-filter {
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-secondary);
  border-radius: 8px;
  padding: .32rem .72rem;
  min-height: 2rem;
  font-size: .83rem;
  gap: .4rem;
}
.queue-filter:hover:not(:disabled) { background: rgba(255, 255, 255, .65); color: var(--ink); }
.queue-filter[aria-pressed="true"], .queue-filter.active {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}
.queue-count {
  min-width: 1.35rem;
  padding: .05rem .38rem;
  border-radius: 999px;
  background: rgba(15, 28, 25, .07);
  color: var(--ink-secondary);
  font-size: .74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.queue-filter[aria-pressed="true"] .queue-count {
  background: var(--brand-soft);
  color: var(--brand);
}
.queue-description {
  margin-top: 9px;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  font-size: .81rem;
  color: var(--muted);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  border: 1px solid var(--line);
}
.filter-bar .field { margin: 0; }
.field {
  display: grid;
  gap: .3rem;
  color: var(--ink-secondary);
  font-size: .82rem;
  font-weight: 620;
  min-width: 0;
}
.filter-caption { font-size: .75rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .filter-bar > :is(input, select), .pager select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .44rem .68rem;
  min-height: 2.28rem;
  background-color: var(--surface);
  width: 100%;
  font-size: .86rem;
  font-weight: 450;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  outline: none;
}
select:not([multiple]) {
  padding-right: .75rem;
  cursor: pointer;
}
.filter-bar .search-field { flex: 1 1 14rem; position: relative; }
.filter-bar .search-field .search-icon {
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  width: .96rem;
  height: .96rem;
  color: var(--muted);
  pointer-events: none;
}
.filter-bar input[type="search"] { padding-left: 2.1rem; }
.filter-bar .filter-field select { min-width: 6.4rem; }
.filter-bar .button { min-height: 2.28rem; }
.field textarea { resize: vertical; min-height: 5.5rem; }
.field input[type="file"] { max-width: 100%; }
.field small { color: var(--muted); font-size: .78rem; font-weight: 450; }
.inline-actions, .toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }

/* Tables */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  text-align: left;
  white-space: nowrap;
  font-size: .855rem;
}
.data-table th {
  padding: .68rem .85rem;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: .72rem .85rem;
  border-bottom: 1px solid #eef2f5;
  vertical-align: middle;
}
.data-table td > .text-button:not(.customer-link):not(.opportunity-project) { margin-left: -.45rem; }
.data-table tbody tr { transition: background-color .12s ease; }
.data-table tbody tr:hover { background: #f8fbfa; }
.data-table tbody tr.is-selected { background: #eaf7f1; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.col-check { width: 2.5rem; text-align: center; }
.row-check {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: #0f2924;
  color: #f0faf5;
  box-shadow: var(--shadow-md);
}
.bulk-bar-info { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.bulk-bar-count {
  display: inline-flex;
  align-items: center;
  padding: .18rem .58rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, .2);
  color: #6ee7b7;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bulk-bar-clear {
  border: 0;
  background: transparent;
  color: #a5bcb4;
  font-size: .8rem;
  padding: .2rem .4rem;
  border-radius: 6px;
}
.bulk-bar-clear:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.bulk-bar-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-bar-form select {
  min-height: 2rem;
  padding: .26rem .65rem;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .18);
  background-color: rgba(255, 255, 255, .1);
  color: #f6fbf8;
  font-size: .82rem;
}
.bulk-bar-form select option { color: var(--ink); background: var(--surface); }
.bulk-bar-form .button.primary { background: #10b981; color: #08231d; font-weight: 720; }
.bulk-bar-form .button.primary:hover:not(:disabled) { background: #34d399; }
.customer-link {
  display: inline-flex;
  align-items: center;
  gap: .62rem;
  text-align: start;
  padding: 0;
  color: var(--ink);
  font-weight: 680;
  background: transparent;
  border: 0;
}
.customer-link:hover { color: var(--brand); }
.customer-link:hover strong { text-decoration: underline; }
.table-secondary {
  display: block;
  font-size: .77rem;
  line-height: 1.38;
  font-weight: 450;
  max-width: 26ch;
  text-overflow: ellipsis;
  overflow: hidden;
}
.table-note { white-space: normal; min-width: 12rem; max-width: 24rem; overflow-wrap: anywhere; line-height: 1.45; }
.table-money { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.table-view { white-space: nowrap; font-weight: 640; }

/* Pills & Grade Chips */
.pill, .grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: .16rem .56rem;
  white-space: nowrap;
  font-size: .76rem;
  font-weight: 700;
  color: var(--tone-emerald);
  background: var(--tone-emerald-bg);
}
.pill[data-tone="blue"], .pill.blue { color: var(--tone-blue); background: var(--tone-blue-bg); }
.pill[data-tone="amber"], .pill.amber { color: var(--tone-amber); background: var(--tone-amber-bg); }
.pill[data-tone="red"], .pill.red { color: var(--tone-rose); background: var(--tone-rose-bg); }
.pill[data-tone="muted"], .pill.neutral { color: var(--tone-slate); background: var(--tone-slate-bg); }

.grade-chip { min-width: 2.15rem; border-radius: 7px; font-weight: 760; }
.grade-chip:is([data-grade="S"], .grade-s) { color: var(--tone-violet); background: var(--tone-violet-bg); }
.grade-chip:is([data-grade="A+"], .grade-ap) { color: #c2410c; background: #ffedd5; }
.grade-chip:is([data-grade="A"], .grade-a) { color: var(--tone-emerald); background: var(--tone-emerald-bg); }
.grade-chip:is([data-grade="B"], .grade-b) { color: var(--tone-blue); background: var(--tone-blue-bg); }
.grade-chip:is([data-grade="C"], .grade-c) { color: var(--tone-slate); background: var(--tone-slate-bg); }
.grade-chip.grade-unrated { color: var(--muted); background: var(--tone-slate-bg); font-weight: 600; }

/* Pagination */
.pager, .pager-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .48rem; }
.pager {
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: .83rem;
  font-variant-numeric: tabular-nums;
}
.pager :is(select, input) { max-width: 6.2rem; min-height: 2rem; padding: .24rem .5rem; font-size: .82rem; }
.page-position { display: inline-flex; align-items: center; gap: .28rem; white-space: nowrap; }
.page-position input {
  width: 3.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: center;
}

/* Empty & Loading */
.empty-state, .inline-loading { text-align: center; color: var(--muted); padding: 2.2rem 1rem; font-size: .88rem; }
.empty-state strong { display: block; color: var(--ink); font-size: .95rem; margin-bottom: .3rem; }
.empty-state p { margin-bottom: .7rem; font-size: .84rem; }
.empty-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: inline-grid;
  place-items: center;
  margin-bottom: .6rem;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}
.layout-refresh { display: flex; justify-content: center; padding-bottom: .6rem; }

/* Notices & Toasts */
.stack { display: grid; gap: .82rem; }
.notice {
  color: #145343;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: .62rem .82rem;
  font-size: .84rem;
  overflow-wrap: anywhere;
}
.notice.error, .form-error {
  color: var(--tone-rose);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: .56rem .78rem;
  font-size: .84rem;
}
.toast-region {
  position: fixed;
  z-index: 60;
  right: 1.15rem;
  bottom: 1.15rem;
  display: grid;
  gap: .45rem;
  pointer-events: none;
  width: min(370px, calc(100vw - 2rem));
}
.toast {
  color: #fff;
  background: #102622;
  border: 1px solid rgba(255, 255, 255, .1);
  padding: .72rem .92rem;
  border-radius: 11px;
  font-size: .85rem;
  box-shadow: var(--shadow-md);
  overflow-wrap: anywhere;
}
.toast.error { background: #881337; }

/* Order Summary */
.order-date-range { align-items: end; }
.order-date-range input { min-width: 8.6rem; }
.order-summary {
  margin-bottom: 14px;
  padding: 12px 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-border);
  background: linear-gradient(95deg, #f3faf7 0%, #f8fbfc 100%);
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
}
.order-summary-currencies { gap: .45rem .6rem; }
.order-total {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .24rem .58rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.order-total strong { color: var(--brand); }

/* Dialog & Customer Detail Drawer */
.dialog, .drawer {
  border: 1px solid var(--line);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop, .drawer::backdrop {
  background: rgba(13, 31, 28, .45);
  backdrop-filter: blur(2px);
}
.dialog {
  border-radius: var(--radius-lg);
  width: min(580px, calc(100vw - 1.6rem));
  max-height: calc(100dvh - 2rem);
}
.dialog-panel { padding: 20px 22px; }
.dialog-panel .detail-heading { padding: 0 0 14px; margin-bottom: 16px; }
.dialog-panel .detail-heading h2 { font-size: 1.15rem; font-weight: 740; }
.dialog-panel .detail-heading p { font-size: .83rem; margin-top: 2px; }
.dialog-panel .form-error { margin-top: 12px; }
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .55rem;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
}

.form-grid, .detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.form-grid .wide, .form-grid .full-width { grid-column: 1 / -1; }
.result-fields {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 0;
  background: var(--surface-tint);
}
.result-fields legend { font-size: .82rem; font-weight: 700; color: var(--ink-secondary); padding: 0 .35rem; }

/* Executive Wide Drawer */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(940px, 96vw);
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  border-radius: 18px 0 0 18px;
  border-right: 0;
  overflow: hidden;
}
.drawer-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.drawer-panel > :not(.detail-scroll) { flex-shrink: 0; }
.detail-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: 16px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.detail-identity { display: flex; align-items: center; gap: .78rem; min-width: 0; }
.detail-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.detail-identity h2 { font-size: 1.2rem; font-weight: 760; letter-spacing: -.02em; }
.detail-identity p { font-size: .82rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.detail-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }

.detail-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.detail-kpi {
  background: var(--surface-tint);
  padding: 10px 18px;
  display: grid;
  gap: 2px;
}
.detail-kpi span { font-size: .74rem; color: var(--muted); font-weight: 600; }
.detail-kpi strong { font-size: .92rem; font-weight: 720; font-variant-numeric: tabular-nums; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  position: relative;
  border: 0;
  padding: .72rem .85rem;
  font-size: .86rem;
  font-weight: 560;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  transition: color .14s ease;
}
.tab:hover { color: var(--ink); }
.tab:is(.active, .is-active, [aria-selected="true"]) {
  color: var(--brand);
  font-weight: 700;
}
.tab:is(.active, .is-active, [aria-selected="true"])::after {
  content: "";
  position: absolute;
  inset: auto .4rem 0 .4rem;
  height: 2.5px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}
.tab-count {
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: .04rem .38rem;
  border-radius: 999px;
  background: var(--paper-subtle);
  color: var(--muted);
}
.tab:is(.active, .is-active, [aria-selected="true"]) .tab-count {
  background: var(--brand-soft);
  color: var(--brand);
}

.drawer .detail-scroll {
  display: block;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 26px;
  overflow-wrap: anywhere;
}
.drawer .detail-scroll > * + * { margin-top: 14px; }

.detail-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}
.detail-card > h3, .detail-notes h3 { font-size: .95rem; font-weight: 720; }
.detail-fields { margin: 12px 0 2px; gap: 10px 14px; }
.detail-property { min-width: 0; }
.detail-fields dt { color: var(--muted); font-size: .76rem; font-weight: 600; }
.detail-fields dd { margin: 2px 0 0; font-size: .86rem; font-weight: 540; color: var(--ink); overflow-wrap: anywhere; }
.detail-notes { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-notes p { margin-top: 6px; color: var(--ink-secondary); white-space: pre-wrap; font-size: .86rem; line-height: 1.55; }

/* AI Analysis Card */
.analysis-card {
  background: linear-gradient(180deg, #f3faf7 0%, #ffffff 34%);
  border: 1px solid var(--brand-border);
  border-top: 3px solid var(--brand);
}
.analysis-meta { display: flex; align-items: center; gap: .55rem; font-size: .8rem; margin-bottom: 10px; }
.analysis-summary { font-size: .88rem; line-height: 1.6; color: var(--ink); }
.analysis-evidence {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  font-size: .82rem;
}
.analysis-evidence strong { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.analysis-evidence ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
.analysis-next {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  font-size: .84rem;
}
.analysis-next strong { display: block; font-size: .76rem; color: var(--brand); margin-bottom: 3px; }
.analysis-actions:not(:empty) { margin-top: 12px; }
.analysis-reply {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 14px;
}
.analysis-reply summary {
  cursor: pointer;
  font-size: .86rem;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.analysis-reply summary::after {
  content: "展开/收起";
  font-size: .75rem;
  font-weight: 600;
  color: var(--brand);
}
.analysis-reply .field { margin-top: 8px; }
.analysis-reply textarea { min-height: 6.2rem; font-size: .85rem; line-height: 1.55; }
.analysis-reply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 8px; }

/* Chat Messages */
.message-search {
  position: sticky;
  z-index: 5;
  inset-block-start: -18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
}
.message-search :is(input, .field) { flex: 1 1 10rem; min-width: 0; }
.message-search input {
  min-height: 2.1rem;
  padding: .28rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  font-size: .85rem;
}
.message-search-count { color: var(--muted); font-size: .8rem; margin: 10px 0 6px; }
.message-page-actions, .message-load {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  flex-wrap: wrap;
  font-size: .82rem;
  margin: 8px 0;
}
.message-list { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.message-row.message-outbound { align-items: flex-end; }
.message-bubble {
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 13px;
  max-width: min(82%, 40rem);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .875rem;
  line-height: 1.55;
  box-shadow: var(--shadow-xs);
}
.message-outbound .message-bubble {
  border-radius: 14px 14px 4px 14px;
  background: #e5f4ed;
  border-color: #c3e6d6;
}
.message-bubble time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
}
.message-highlight .message-bubble {
  outline: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 109, 87, .14);
}
.message-search-results mark, .message-bubble mark {
  padding: 0 .14rem;
  background: #fde68a;
  color: #451a03;
  border-radius: 3px;
}

/* Opportunities & Activities */
.opportunity-list { display: grid; gap: 12px; }
.opportunity-card { background: var(--surface); }
.opportunity-card h3 { font-size: .96rem; font-weight: 720; }
.opportunity-note { font-size: .84rem; color: var(--ink-secondary); margin-top: 8px; }
.opportunity-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef2f5; }
.opportunity-project { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; color: var(--ink); padding: 0; }
.opportunity-project:hover { background: transparent; color: var(--brand); }
.followup-context { display: block; max-width: 36ch; white-space: normal; color: var(--muted); font-size: .79rem; margin-top: 2px; }
.followup-outcome { display: block; width: max-content; max-width: 100%; }

.activity-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px 16px;
}
.activity-item {
  position: relative;
  border-bottom: 1px solid #eef2f5;
  padding: 12px 4px 12px 18px;
}
.activity-item:last-child { border-bottom: 0; }
.activity-item::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.activity-item strong { font-size: .87rem; font-weight: 640; display: block; }
.activity-item p { margin-top: 3px; font-size: .78rem; }

/* Settings Page */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-wide { grid-column: 1 / -1; }
.settings-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.setting-stat {
  display: grid;
  gap: 3px;
  padding: 12px 12px;
  border-radius: 11px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  min-width: 0;
}
.setting-stat span { font-size: .76rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setting-stat strong { font-size: 1.22rem; font-weight: 780; font-variant-numeric: tabular-nums; color: var(--ink); }
.settings-summary { display: grid; gap: 10px; font-size: .85rem; }
.integration-badge-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.import-dropzone {
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-tint);
  transition: border-color .15s ease, background-color .15s ease;
}
.import-dropzone:hover { border-color: var(--brand); background: #f4faf7; }
.import-area input[type="file"]::file-selector-button {
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 640;
  margin-right: .65rem;
  padding: .34rem .7rem;
  cursor: pointer;
}
.import-area .notice ul { margin: 6px 0 0; padding-left: 1.25rem; }
.import-progress { min-width: 0; font-size: .85rem; }
.import-progress-meter { display: grid; gap: .38rem; margin-top: 6px; color: var(--muted); }
.import-progress progress { width: 100%; height: 8px; accent-color: var(--brand); }
.sync-metadata { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; font-size: .84rem; }
.sync-run-sources { min-width: 0; }
.sync-history { display: grid; gap: .4rem; font-size: .83rem; }
.sync-history summary { cursor: pointer; font-weight: 640; color: var(--ink-secondary); }
.sync-history ul { padding-inline-start: 1.2rem; margin: 6px 0 0; display: grid; gap: 4px; }
.sync-cli-hint {
  padding: 10px 12px;
  border-radius: 10px;
  background: #0f1f1c;
  color: #cde8de;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .78rem;
  line-height: 1.6;
  overflow-x: auto;
}
.sync-control-panel {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.sync-control-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.sync-control-grid .field { flex: 1 1 135px; max-width: 185px; }
.sync-control-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.sync-live-console {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid #1e3a33;
  background: #0d1f1c;
  color: #d6ede5;
  overflow: hidden;
}
.sync-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: .78rem;
}
.sync-console-body {
  margin: 0;
  padding: 10px 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.team-manage-meta {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface-tint);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .38rem .65rem;
  margin-bottom: 4px;
  font-size: .84rem;
}
.team-manage-section { border-top: 1px solid var(--line); padding-block: 14px; }
.team-manage-section h3 { font-size: .95rem; font-weight: 720; }
.team-manage-section header p { font-size: .81rem; margin-top: 3px; }
.team-manage-footer { display: flex; justify-content: flex-end; }
.team-assurance { display: flex; align-items: flex-start; gap: .48rem; font-size: .84rem; color: var(--tone-rose); font-weight: 560; }
.team-assurance input { margin-top: .22rem; accent-color: var(--tone-rose); }

/* Login View */
.login-view {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(380px, 46%) minmax(0, 1fr);
  background: var(--paper);
}
.login-illustration {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;
  position: relative;
  background: linear-gradient(155deg, #0b1c19 0%, #10352d 58%, #164e40 100%);
  padding: clamp(28px, 4.5vw, 64px);
  color: #f2fbf7;
}
.login-grid-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .16;
  background-image: radial-gradient(rgba(167, 243, 208, .55) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .85), rgba(0, 0, 0, .15));
}
.login-copy { margin: auto 0; padding: 28px 0; max-width: 480px; }
.login-copy .eyebrow { color: #a7f3d0; margin-bottom: 12px; }
.login-copy h2 {
  font-size: clamp(1.95rem, 3.6vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -.04em;
  font-weight: 800;
}
.login-copy > p:not(.eyebrow) { margin-top: 14px; color: #c0ddd2; font-size: .95rem; line-height: 1.6; }
.login-highlights { display: grid; gap: 12px; margin-top: 28px; }
.login-highlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}
.highlight-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 9px;
  background: rgba(52, 211, 153, .16);
  color: #6ee7b7;
  flex-shrink: 0;
}
.login-highlight-item strong { display: block; font-size: .88rem; color: #f6fbf8; }
.login-highlight-item span { display: block; font-size: .78rem; color: #9ec0b3; margin-top: 1px; }
.login-footnote { font-size: .76rem; color: #7da194; }

.login-main { display: grid; place-items: center; padding: 2rem; }
.login-form {
  width: min(100%, 420px);
  display: grid;
  gap: 18px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.login-form-header h1 { font-size: 1.5rem; font-weight: 780; letter-spacing: -.025em; margin-top: 4px; }
.login-form-header .muted { font-size: .84rem; margin-top: 4px; }
.login-fields { display: grid; gap: 14px; }
.login-submit { width: 100%; min-height: 2.65rem; font-size: .92rem; }
.demo-options { display: grid; gap: 10px; padding-top: 6px; }
.demo-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .76rem;
  color: var(--muted);
}
.demo-divider::before, .demo-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.demo-role-btn {
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-tint);
  color: var(--ink);
  transition: border-color .15s ease, background-color .15s ease;
}
.demo-role-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-role-btn strong { font-size: .84rem; color: var(--brand); }
.demo-role-btn span { font-size: .74rem; color: var(--muted); line-height: 1.35; }

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 214px minmax(0, 1fr); }
  .bento-span-7, .bento-span-5 { grid-column: span 12; }
  .detail-overview-grid { grid-template-columns: 1fr; }
  .settings-stats { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
}
@media (max-width: 900px) {
  .action-strip { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-date { display: none; }
  .detail-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    width: 248px;
    inset: 0 auto 0 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .22s ease, visibility .22s;
    box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { visibility: visible; transform: translateX(0); }
  .app-shell.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 31, 28, .48);
    z-index: 25;
  }
  .mobile-menu { display: inline-flex; }
  .topbar { padding-inline: .85rem; height: 56px; }
  .topbar-cta span { display: none; }
  .global-search kbd { display: none; }
  .main-content { padding: 16px .9rem 30px; }
  .login-view { grid-template-columns: 1fr; }
  .login-illustration { padding: 24px 20px; }
  .login-highlights { display: none; }
  .login-main { padding: 20px 16px 32px; }
  .drawer { width: 100vw; border-radius: 0; }
  .detail-heading, .detail-tabs, .drawer .detail-scroll { padding-inline: 14px; }
}
@media (max-width: 440px) {
  .form-grid, .detail-fields, .demo-cards { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .mode-chip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
