/* Theme follows the SalesDen UI (D:\ui): Geist, white cards with slate-200 borders on a slate-50 page,
   a light top bar, blue-600 accent, compact type, uppercase slate table headers, flat rounded controls. */
:root {
  --bg: #f8fafc;          /* slate-50 */
  --surface: #ffffff;
  --surface-2: #f8fafc;   /* slate-50 */
  --border: #e2e8f0;      /* slate-200 */
  --border-soft: #f1f5f9; /* slate-100 */
  --border-strong: #cbd5e1; /* slate-300 */
  --text: #0f172a;        /* slate-900 */
  --text-2: #1e293b;      /* slate-800 */
  --text-3: #334155;      /* slate-700 */
  --muted: #64748b;       /* slate-500 */
  --primary: #2563eb;     /* blue-600 */
  --primary-600: #1d4ed8; /* blue-700 */
  --primary-50: #eff6ff;  /* blue-50 */
  --primary-100: #dbeafe; /* blue-100 */
  --ring: #93c5fd;        /* blue-300 */
  --danger: #dc2626;
  --success: #059669;
  --radius: 6px;          /* rounded-md */
  --radius-lg: 12px;      /* rounded-xl */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .1), 0 4px 6px -4px rgba(15, 23, 42, .1);
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* thin scrollbars, as in SalesDen */
.table-wrap, .desc-full { scrollbar-width: thin; scrollbar-color: #c1c1c1 transparent; }
.table-wrap::-webkit-scrollbar, .desc-full::-webkit-scrollbar { width: 6px; height: 6px; }
.table-wrap::-webkit-scrollbar-thumb, .desc-full::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb:hover, .desc-full::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* ---- top bar ----------------------------------------------------------------------------- */

.hero {
  background: var(--primary);   /* blue header */
  border-bottom: 1px solid var(--primary-600);
  color: #fff;
  padding: 8px 24px;
}
.hero-inner { max-width: 1680px; margin: 0 auto; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
/* The logo has dark text on a transparent background, so it sits on a white tile. */
.brand-logo { display: flex; align-items: center; background: #fff; border-radius: 8px; padding: 4px 10px; box-shadow: var(--shadow-sm); }
.brand-logo img { display: block; height: 32px; width: auto; }
.brand-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .35); }
.hero h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: #fff; }
.hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }


/* ---- page -------------------------------------------------------------------------------- */

.page { max-width: 1680px; margin: 0 auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-sm); }

/* KPI cards (SalesDen KpiCard: rounded-xl, slate-200 border, white, p-5, shadow-sm) */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start;
  position: relative; overflow: hidden; transition: border-color .15s, background .15s, box-shadow .15s;
}
button.kpi { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.kpi:hover { border-color: #bfdbfe; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.kpi:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.kpi[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm); }
.kpi[aria-pressed="true"] .kpi-icon { background: var(--primary); color: #fff; }
.kpi-body { min-width: 0; }
.kpi-date { font-weight: 500; color: var(--primary-600); background: var(--primary-100); border-radius: 999px; padding: 1px 7px; margin-left: 4px; font-size: 10.5px; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.kpi-date:empty { display: none; }
.delta { font-size: 11.5px; font-weight: 600; margin-left: 8px; padding: 0; border-radius: 0; vertical-align: middle; letter-spacing: 0; background: none; }
.delta:empty { display: none; }
.delta.up { color: #059669; }
.delta.down { color: #ef4444; }
.delta.flat { color: var(--muted); }
.kpi-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; transition: background .15s, color .15s; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi-value { margin: 4px 0 0; font-size: 24px; font-weight: 700; line-height: 1; color: var(--text-2); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { margin: 6px 0 0; color: #94a3b8; font-size: 11px; }
.kpi-red     { --accent: #2563eb; --accent-soft: #eff6ff; }
.kpi-slate   { --accent: #475569; --accent-soft: #f1f5f9; }
.kpi-amber   { --accent: #d97706; --accent-soft: #fffbeb; }

/* filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
.search { flex: 1 1 320px; min-width: 220px; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 15px; height: 15px; color: #94a3b8; pointer-events: none; }
.search input { width: 100%; padding-left: 32px; }

input, select, textarea {
  font: inherit; font-size: 12.5px; color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 11px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
select {
  appearance: none; padding-right: 30px; cursor: pointer; min-width: 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
select.active, input[type="date"].active { border-color: #bfdbfe; background-color: var(--primary-50); color: var(--primary-600); font-weight: 500; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); background-color: var(--surface); box-shadow: 0 0 0 2px var(--ring); }

/* buttons (SalesDen: rounded-md, text-xs, font-medium; primary = blue-600, secondary = white + slate-200 border) */
.btn {
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; border-radius: var(--radius); padding: 6px 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: #f1f5f9; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-50); color: var(--primary-600); border-color: transparent; }
.btn-light { background: #fff; border-color: #fff; color: var(--primary-600); box-shadow: var(--shadow-sm); }
.btn-light:hover { background: var(--primary-50); border-color: var(--primary-50); }
.btn-light:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.btn-icon { padding: 5px; border-color: var(--border); background: var(--surface); color: var(--text-3); }
.btn-icon:hover:not(:disabled) { background: #f1f5f9; color: var(--text); }

/* ---- table ------------------------------------------------------------------------------- */

.table-card { overflow: hidden; display: flex; flex-direction: column; }
.table-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.view-sub { color: #94a3b8; font-size: 11.5px; }
/* while the next card / page loads, the current rows fade a little (after a short pause, so quick answers don't flicker) */
.table-card.is-loading .table-wrap { opacity: .45; transition: opacity .15s ease .12s; cursor: progress; }
.table-wrap { overflow: auto; max-height: calc(100vh - 330px); min-height: 320px; position: relative; }
.new-pill { font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; color: #1d4ed8; background: var(--primary-100); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
th, td { padding: 9px 16px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); white-space: nowrap; user-select: none; border-bottom: 1px solid var(--border);
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text-2); }
th .arrow { display: inline-block; width: 12px; margin-left: 3px; color: var(--primary); font-size: 9px; }
th.sorted { color: var(--primary); }
td { background: var(--surface); color: var(--text-3); font-size: 12px; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

/* keep Potential Number visible while scrolling sideways */
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--border); }
th:first-child { z-index: 3; }
tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--primary), inset -1px 0 0 var(--border); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.name { min-width: 240px; max-width: 320px; font-weight: 500; color: var(--text); }
td.revenue { font-weight: 600; color: #059669; }
td.muted-cell { color: var(--muted); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); text-decoration: underline; text-underline-offset: 2px; }
.pot-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.pot-link svg { width: 13px; height: 13px; opacity: .55; }
.domain { display: inline-flex; align-items: center; gap: 6px; }
.domain svg { width: 13px; height: 13px; color: #94a3b8; }

.date { display: inline-flex; flex-direction: column; }
.date small { color: #94a3b8; font-size: 10.5px; }

/* owner avatar */
.owner { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 600; color: #fff; flex: none; background: var(--av, #64748b);
}

/* stage + small chips (SalesDen: rounded-full, text-[10px]/xs, font-medium) */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--b-bg); color: var(--b-fg);
  border: 1px solid var(--b-bd);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: #f1f5f9; color: var(--text-3); border: 0; letter-spacing: .01em;
}
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: var(--text-3); background: #f1f5f9; border: 0; white-space: nowrap; }

.id-btn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted);
  background: transparent; border: 1px dashed transparent; border-radius: 4px; padding: 2px 5px; cursor: copy;
  display: inline-flex; align-items: center; gap: 5px;
}
.id-btn svg { width: 12px; height: 12px; opacity: 0; transition: opacity .15s; }
.id-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.id-btn:hover svg { opacity: .7; }

/* description */
.desc { max-width: 340px; min-width: 240px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.link-btn { font: inherit; font-size: 11px; font-weight: 500; color: var(--primary); background: none; border: 0; padding: 2px 0 0; cursor: pointer; }
.link-btn:hover { color: var(--primary-600); text-decoration: underline; }


.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; color: #cbd5e1; }
.empty p { margin: 4px 0; font-size: 12.5px; }
.empty-title { font-weight: 600; color: var(--text-2); font-size: 14px; }

/* Action buttons: icon only (the name is in the tooltip and read out by screen readers).
   Off = outlined square with a tinted icon; on = filled with the mark's colour. */
.marks-cell { min-width: 0; }
.marks { display: flex; gap: 5px; flex-wrap: nowrap; }
.mark {
  font: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0; white-space: nowrap; cursor: pointer;
  position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border-radius: var(--radius); background: var(--surface); color: var(--text-3); border: 1px solid var(--border);
  box-shadow: none;
  transition: background .15s, color .15s, border-color .15s;
}
/* the text label stays for screen readers, hidden on screen */
.mark .lb { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.mark .ic {
  width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; flex: none;
  background: var(--m-soft); color: var(--m-fg); transition: background .15s, color .15s;
}
.mark .ic svg { width: 13px; height: 13px; stroke-width: 2; }
.mark .tick { display: none; }
.mark:hover { border-color: var(--m-bd); background: var(--m-tint); color: var(--m-fg); }
.mark:active { transform: scale(.94); }
.mark:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.mark[aria-pressed="true"] {
  background: var(--m-fg); border-color: var(--m-fg); color: #fff;
  box-shadow: var(--shadow-sm);
}
.mark[aria-pressed="true"] .ic { background: transparent; color: #fff; }
.mark[aria-pressed="true"]:hover { color: #fff; filter: brightness(1.08); }
.tone-amber  { --m-fg: #d97706; --m-soft: #fef3c7; --m-tint: #fffbeb; --m-bd: #fde68a; }
.tone-red    { --m-fg: #dc2626; --m-soft: #fee2e2; --m-tint: #fef2f2; --m-bd: #fecaca; }
.tone-blue   { --m-fg: #2563eb; --m-soft: #dbeafe; --m-tint: #eff6ff; --m-bd: #bfdbfe; }
.tone-cyan   { --m-fg: #0891b2; --m-soft: #cffafe; --m-tint: #ecfeff; --m-bd: #a5f3fc; }
.tone-silver { --m-fg: #475569; --m-soft: #e2e8f0; --m-tint: #f8fafc; --m-bd: #cbd5e1; }
.tone-violet { --m-fg: #4f46e5; --m-soft: #e0e7ff; --m-tint: #eef2ff; --m-bd: #c7d2fe; }

/* the comment button sits after a thin divider; it turns light indigo once a comment exists */
.mark.tone-violet { position: relative; margin-left: 7px; }
.mark.tone-violet::before { content: ""; position: absolute; left: -7px; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.mark.has-comment { background: var(--m-tint); border-color: var(--m-bd); color: var(--m-fg); }
.mark.has-comment .ic { background: var(--m-fg); color: #fff; }

/* the saved comment, shown under the action buttons */
.comment-note {
  font: inherit; font-size: 11.5px; line-height: 1.4; text-align: left; cursor: pointer;
  display: flex; gap: 6px; align-items: flex-start; width: fit-content; max-width: 240px; margin-top: 6px;
  color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 9px;
  transition: border-color .15s, background .15s;
}
.comment-note svg { width: 13px; height: 13px; margin-top: 1px; color: #4f46e5; }
.comment-note span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.comment-note:hover { border-color: #c7d2fe; background: #eef2ff; }

/* rows open their description when clicked */
tbody tr[data-row-index] { cursor: pointer; }
tbody tr[data-row-index]:focus-visible { outline: none; }
tbody tr[data-row-index]:focus-visible td { background: var(--primary-50); box-shadow: inset 0 1px 0 #bfdbfe, inset 0 -1px 0 #bfdbfe; }
.desc-full.is-empty { color: var(--muted); font-style: italic; }

/* high-priority rows get a red edge on the pinned first column */
tbody tr.is-priority td:first-child { box-shadow: inset 2px 0 0 #dc2626, inset -1px 0 0 var(--border); }

/* skeleton while loading (SalesDen: slate-100 pulse) */
.skeleton td div { height: 10px; border-radius: 4px; background: #f1f5f9; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* pager (SalesDen: border-t, slate-50, text-[11px]) */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 11.5px; flex-wrap: wrap; }
.pager-left { display: flex; align-items: center; gap: 16px; }
.pager-left label { display: inline-flex; align-items: center; gap: 6px; }
.pager select { min-width: 0; padding: 3px 26px 3px 8px; font-size: 11.5px; background-color: var(--surface); }
.pager-nav { display: flex; align-items: center; gap: 4px; }
#pageInfo { min-width: 90px; text-align: center; color: var(--text-2); font-weight: 500; }

/* ---- dialogs ----------------------------------------------------------------------------- */

dialog {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px 20px; width: min(640px, 92vw);
  box-shadow: var(--shadow-lg); color: var(--text);
}
dialog[open] { animation: pop .22s ease-out; }
dialog::backdrop { background: rgba(15, 23, 42, .4); animation: fade .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog[open], dialog::backdrop { animation: none; } }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.dlg-eyebrow { margin: 0 0 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.desc-full { white-space: pre-wrap; line-height: 1.6; font-size: 12.5px; max-height: 60vh; overflow: auto; overflow-wrap: anywhere; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
dialog textarea { width: 100%; resize: vertical; line-height: 1.5; }
.comment-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: #94a3b8; margin-top: 6px; }
.error { color: var(--danger); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: #1e293b; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; z-index: 50;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 15px; color: #34d399; }

/* ---- responsive -------------------------------------------------------------------------- */

@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .hero { padding: 8px 16px; }
  .brand { gap: 10px; }
  .brand-logo img { height: 26px; }
  .brand-divider { height: 20px; }
  .hero h1 { font-size: 14px; }
  .page { padding: 14px 16px 16px; }
  .kpis { grid-template-columns: 1fr; }
  .filters select, .filters .combo { flex: 1 1 140px; }
  .date-range { flex: 1 1 100%; }
  .date-range input { flex: 1 1 0; min-width: 0; }
  .table-wrap { max-height: none; }
}

/* longer messages (errors) wrap instead of running off screen */
.toast { max-width: min(640px, calc(100vw - 32px)); line-height: 1.4; }
.toast.error { background: #7f1d1d; }
.toast.error svg { color: #fca5a5; }

/* ---- Columns menu ------------------------------------------------------------------------ */

.col-picker { position: relative; margin-left: auto; align-self: center; }
.col-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
  padding: 8px; max-height: 70vh; overflow: auto;
}
.col-menu-title { margin: 2px 6px 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.col-opt { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 4px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.col-opt:hover { background: var(--surface-2); }
.col-opt input { width: 14px; height: 14px; margin: 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
.col-opt.locked { color: var(--muted); cursor: default; }
.col-opt.locked input { cursor: default; }
.col-menu .link-btn { display: block; margin: 6px 6px 2px; }

/* ---- details panel (slides in from the right) -------------------------------------------- */

dialog.drawer {
  margin: 0 0 0 auto; padding: 0; height: 100dvh; max-height: 100dvh; width: min(520px, 100vw); max-width: 100vw;
  border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--surface);
}
dialog.drawer[open] { display: flex; flex-direction: column; animation: slide-in .22s ease-out; }
/* the page behind doesn't scroll while the panel is open */
html:has(dialog.drawer[open]) { overflow: hidden; }
@keyframes slide-in { from { opacity: 0; transform: translateX(32px); } }
@media (prefers-reduced-motion: reduce) { dialog.drawer[open] { animation: none; } }
.dp-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.dp-title { min-width: 0; }
.dp-title .dlg-eyebrow { display: flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.dp-head h2 { margin: 2px 0 0; font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.dp-body { flex: 1; overflow: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 20px; scrollbar-width: thin; }
.dp-section h3 { margin: 0 0 8px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dp-marks { flex-wrap: wrap; }
.dp-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.dp-field { min-width: 0; }
.dp-field dt { font-size: 11px; color: var(--muted); }
.dp-field dd { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.dp-field .date { flex-direction: row; gap: 6px; align-items: baseline; }
.dp-comment { margin: 0; white-space: pre-wrap; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
.dp-meta { margin: 4px 0 0; font-size: 11px; color: #94a3b8; }
.dp-comment-btn { margin-top: 8px; }
.dp-body .desc-full { max-height: none; }
@media (max-width: 520px) { .dp-grid { grid-template-columns: minmax(0, 1fr); } }

/* "BH notified <date>" under the action buttons, once a record was in a Business Head email */
.notified { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 11px; font-weight: 500; color: #059669; }
.notified svg { width: 12px; height: 12px; stroke-width: 2.4; }

/* Date Inquired range in the filter bar */
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range-label, .date-range-sep { font-size: 12px; color: var(--muted); white-space: nowrap; }
.date-range input { width: 140px; padding: 6px 9px; color-scheme: light; cursor: pointer; }

/* ---- sign-in through SalesDen --------------------------------------------------------------- */

/* inside SalesDen: no blue header (SalesDen shows its own) */
body.embedded .hero { display: none; }
body.embedded .page { padding-top: 14px; }

.signed-in { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.signed-in:empty { display: none; }
.signed-in:not(:empty) { margin-left: auto; }
.signed-in:not(:empty) + .col-picker { margin-left: 8px; }

/* covers the page until the server accepts the user */
.gate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-card {
  max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 28px 28px 24px;
}
.gate-icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.gate-icon svg { width: 22px; height: 22px; }
.gate[data-kind="denied"] .gate-icon, .gate[data-kind="failed"] .gate-icon { background: #fef2f2; color: #dc2626; }
.gate h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--text); }
.gate p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* 💎 / 🔥 after the Potential Number when Marked by AI is Diamond / Platinum */
.ai-badge { display: inline-block; margin-left: 6px; font-size: 15px; line-height: 1; vertical-align: -2px; cursor: default; }
.ai-badge + .ai-badge { margin-left: 2px; }

/* Search and every filter on one line on laptop and larger screens; dropdowns share the space. */
@media (min-width: 1280px) {
  .filters { flex-wrap: nowrap; gap: 6px; }
  .search { flex: 1.5 1 170px; min-width: 150px; }
  .filters select, .filters .combo { flex: 1 1 105px; min-width: 0; text-overflow: ellipsis; }
  .date-range { flex: 0 0 auto; gap: 4px; }
  .date-range input { width: 124px; padding: 6px 7px; }
  #clearBtn { flex: 0 0 auto; padding-inline: 8px; }
}
/* Narrower screens wrap: search on its own line, then the dropdowns and dates. */
@media (max-width: 1279px) {
  .search { flex-basis: 100%; }
  .filters select, .filters .combo { flex: 1 1 140px; }
}
/* Phones: the date range takes its own row, with both date boxes sharing the width. */
@media (max-width: 640px) {
  .date-range { flex: 1 1 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
  .date-range input { width: 100%; min-width: 0; }
}

/* ---- searchable filter dropdowns (app.js, enhanceSelect) ------------------------------------ */
.combo { position: relative; min-width: 140px; }
.combo-btn {
  width: 100%; font: inherit; font-size: 12.5px; color: var(--text-3); text-align: left; cursor: pointer;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 30px 7px 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.combo-btn:hover { border-color: var(--border-strong); }
.combo-btn:focus-visible, .combo-btn[aria-expanded="true"] { outline: none; border-color: var(--ring); box-shadow: 0 0 0 2px var(--ring); }
.combo-btn.active { border-color: #bfdbfe; background-color: var(--primary-50); color: var(--primary-600); font-weight: 500; }
.combo-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 100%; width: max-content; max-width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px;
}
.combo-pop.align-right { left: auto; right: 0; }
.combo-search { width: 100%; margin-bottom: 4px; padding: 6px 9px; font-size: 12.5px; }
.combo-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; scrollbar-width: thin; }
.combo-list li { padding: 6px 8px; border-radius: 4px; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.combo-list li.is-active { background: var(--primary-50); }
.combo-list li[aria-selected="true"] { color: var(--primary-600); font-weight: 600; }
.combo-list li.combo-empty { color: var(--muted); cursor: default; font-style: italic; }
