/* Visual clarity pass layered on top of the original build.
   Structure is untouched; only type scale, weight and colour change. */

:root {
  --gk-ink: #111827;
  --gk-ink-2: #374151;
  --gk-label: #6b7280;
  --gk-red: #dc2626;
  --gk-amber: #d97706;
  --gk-green: #059669;
  --gk-accent: #059669;
}
html.dark {
  --gk-ink: #f4f4f5;
  --gk-ink-2: #d4d4d8;
  --gk-label: #a1a1aa;
  --gk-red: #f87171;
  --gk-amber: #fbbf24;
  --gk-green: #34d399;
  --gk-accent: #34d399;
}

/* stronger, more saturated status colours (the -400 tints were washed out on white) */
.text-red-400, .text-red-500 { color: var(--gk-red) !important; }
.text-amber-400, .text-amber-500 { color: var(--gk-amber) !important; }
.text-emerald-400, .text-green-500, .text-green-400 { color: var(--gk-green) !important; }

/* ── Header ── */
header .text-xl.font-semibold { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
header .text-base.text-gray-500 { font-size: 0.95rem; }
header .text-xs.uppercase.tracking-wider { font-size: 0.72rem; font-weight: 700; color: var(--gk-label); }
header .text-2xl.font-bold { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; }

/* ── Status tiles: Attention / Watch / Healthy ── */
aside.order-3 .grid.grid-cols-3 > div {
  padding: 16px 18px; border-radius: 16px; gap: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px -8px rgba(0,0,0,.18);
}
aside.order-3 .grid.grid-cols-3 > div:has(.lucide-triangle-alert) { background: linear-gradient(135deg, rgba(220,38,38,.10), transparent 70%), var(--tw-bg, #fff); }
aside.order-3 .grid.grid-cols-3 > div:has(.lucide-eye) { background: linear-gradient(135deg, rgba(217,119,6,.11), transparent 70%), #fff; }
aside.order-3 .grid.grid-cols-3 > div:has(.lucide-circle-check) { background: linear-gradient(135deg, rgba(5,150,105,.10), transparent 70%), #fff; }
html.dark aside.order-3 .grid.grid-cols-3 > div:has(.lucide-triangle-alert) { background: linear-gradient(135deg, rgba(248,113,113,.16), transparent 70%), #18181b; }
html.dark aside.order-3 .grid.grid-cols-3 > div:has(.lucide-eye) { background: linear-gradient(135deg, rgba(251,191,36,.14), transparent 70%), #18181b; }
html.dark aside.order-3 .grid.grid-cols-3 > div:has(.lucide-circle-check) { background: linear-gradient(135deg, rgba(52,211,153,.13), transparent 70%), #18181b; }
aside.order-3 .grid.grid-cols-3 svg.lucide { width: 28px; height: 28px; stroke-width: 2.2; }
aside.order-3 .grid.grid-cols-3 .font-heading.font-bold { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.03em; }
aside.order-3 .grid.grid-cols-3 .text-xs.uppercase { font-size: 0.85rem; font-weight: 800; letter-spacing: 0.06em; margin-top: 6px; }
aside.order-3 .grid.grid-cols-3 .flex-col::after {
  content: 'businesses'; font-size: 0.75rem; font-weight: 500; color: var(--gk-label); margin-top: 1px;
}

/* ── Section headings ── */
aside.order-3 h2.text-base { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; color: var(--gk-ink); }
aside.order-3 header button.text-sm { font-size: 0.95rem; font-weight: 700; color: var(--gk-accent); }

/* ── Priority cards ── */
#alerts button.rounded-xl {
  border-radius: 16px; border-left-width: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 22px -12px rgba(0,0,0,.25);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s;
}
#alerts button.rounded-xl:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 14px 30px -12px rgba(0,0,0,.3); }
#alerts .space-y-2 > * + * { margin-top: 10px !important; }
#alerts .p-3 { padding: 14px 16px; }

/* identity column */
#alerts .h-12.w-12 { width: 56px; height: 56px; border-radius: 12px; background: #fff; }
#alerts .text-sm.font-bold.uppercase.truncate {
  font-size: 1.05rem; font-weight: 800; letter-spacing: -0.005em; text-transform: none;
  white-space: normal; overflow: visible; line-height: 1.2; color: var(--gk-ink);
}
#alerts .flex.items-center.gap-1 > .text-sm.font-bold { font-size: 0.95rem; font-weight: 800; }
#alerts .flex.items-center.gap-1 > .text-xs.font-bold { font-size: 0.9rem; font-weight: 800; }
#alerts .flex.items-center.gap-1 > .text-xs:not(.font-bold) { font-size: 0.78rem; color: var(--gk-label); }

/* falling numbers read as red, not neutral grey */
#alerts .flex.items-center.gap-1:has(> svg.lucide-chevron-down) > svg,
#alerts .flex.items-center.gap-1:has(> svg.lucide-chevron-down) > .font-bold { color: var(--gk-red) !important; }
#alerts li:has(svg.lucide-chevron-down) svg { color: var(--gk-red) !important; }
#alerts svg.lucide-chevron-up, #alerts svg.lucide-chevron-down { stroke-width: 3; }

/* column labels: WHY? / HEALTH SCORE / DEREXA RECOMMENDS */
#alerts .text-xs.uppercase.tracking-widest {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; color: var(--gk-label);
}

/* why list */
#alerts li.text-sm { font-size: 0.95rem; font-weight: 500; color: var(--gk-ink-2); line-height: 1.3; }
#alerts li .truncate { white-space: normal; overflow: visible; }
#alerts ul.space-y-1 > * + * { margin-top: 6px !important; }

/* health score */
#alerts .font-heading.text-3xl { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.035em; }

/* recommendation */
#alerts .text-xs.uppercase.tracking-widest:has(+ .flex svg.lucide-target),
#alerts div:has(> svg.lucide-target) { color: var(--gk-accent); }
#alerts .min-w-0 > .text-xs.uppercase.tracking-widest.mb-1\.5 { color: var(--gk-accent); }
#alerts svg.lucide-target { color: var(--gk-accent) !important; }
#alerts .line-clamp-2 { font-size: 0.97rem; font-weight: 600; color: var(--gk-ink); -webkit-line-clamp: 3; line-height: 1.35; }
#alerts svg.lucide-chevron-right { width: 20px; height: 20px; color: var(--gk-label); }

/* ── Quick actions ── */
aside.order-3 button span.text-xs.font-semibold.tracking-wider { font-size: 0.85rem; font-weight: 700; color: var(--gk-ink-2); letter-spacing: 0.04em; }
aside.order-3 button:has(> span.tracking-wider) svg { color: var(--gk-accent); width: 26px; height: 26px; }

/* ── Live control on the map ── */
.gk-live {
  position: absolute; top: 12px; left: 56px; z-index: 1000;
  display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; border-radius: 999px;
  background: rgba(17, 24, 39, .72); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.18); box-shadow: 0 6px 20px rgba(0,0,0,.35);
  font: 700 13px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: .06em; cursor: pointer; user-select: none;
  transition: background .2s, transform .15s;
}
.gk-live:hover { background: rgba(17, 24, 39, .85); }
.gk-live:active { transform: scale(.97); }
.gk-live-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; flex: none; }
.gk-live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #ef4444; animation: gk-blink 1.6s ease-out infinite; }
.gk-live small { font-weight: 500; letter-spacing: 0; opacity: .75; font-size: 12px; }
.gk-live.paused .gk-live-dot { background: #9ca3af; }
.gk-live.paused .gk-live-dot::after { display: none; }
@keyframes gk-blink { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.8); opacity: 0; } }

/* pins ripple on every live refresh */
.gk-ping .gk-pin-head::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; border-radius: 50%;
  transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.9); pointer-events: none;
  animation: gk-ripple 1.4s ease-out forwards;
}
@keyframes gk-ripple { 0% { opacity: .95; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }

/* ── Map pins: clean, modern location pins ──
   white head + business glyph in its brand colour, status dot, pointed tip on the exact spot */
.gk-marker { background: none; border: 0; }
.gk-pin { position: relative; width: 34px; height: 44px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)) drop-shadow(0 1px 1px rgba(0,0,0,.25)); transition: transform .18s cubic-bezier(.3,1.4,.5,1); transform-origin: 50% 100%; }
.gk-marker:hover { z-index: 9999 !important; }
.gk-marker:hover .gk-pin { transform: scale(1.18) translateY(-2px); }
.gk-pin-head {
  position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 2.5px var(--v), inset 0 0 0 4px #fff;
}
.gk-pin-glyph { width: 17px; height: 17px; color: var(--v); }
.gk-pin-tip {
  position: absolute; left: 50%; top: 27px; width: 14px; height: 14px; background: #fff;
  transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0;
  box-shadow: 2.5px 2.5px 0 -0px var(--v);
}
.gk-pin-dot {
  position: absolute; right: -2px; top: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--s); box-shadow: 0 0 0 2px #fff;
}
.gk-pin-halo {
  position: absolute; left: 17px; top: 17px; width: 34px; height: 34px; border-radius: 50%;
  transform: translate(-50%, -50%); background: rgba(239, 68, 68, .45);
  animation: gk-halo 2.2s ease-out infinite;
}
@keyframes gk-halo { 0% { transform: translate(-50%, -50%) scale(1); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
.gk-pin-attention .gk-pin-head { box-shadow: inset 0 0 0 2.5px #ef4444, inset 0 0 0 4px #fff; }

html.dark .gk-pin-head, html.dark .gk-pin-tip { background: #18181b; }
html.dark .gk-pin-head { box-shadow: inset 0 0 0 2.5px var(--v), inset 0 0 0 4px #18181b; }
html.dark .gk-pin-attention .gk-pin-head { box-shadow: inset 0 0 0 2.5px #ef4444, inset 0 0 0 4px #18181b; }
html.dark .gk-pin-dot { box-shadow: 0 0 0 2px #18181b; }
html.dark .gk-pin-glyph { filter: brightness(1.25); }

/* ── Derexa recommendation + WhatsApp assign ── */
.gk-rec {
  border-radius: 12px; padding: 24px; background: #fff;
  background-image: linear-gradient(135deg, rgba(5,150,105,.08), transparent 60%);
  border: 1px solid rgba(5,150,105,.25);
}
html.dark .gk-rec { background-color: #18181b; background-image: linear-gradient(135deg, rgba(52,211,153,.12), transparent 60%); border-color: rgba(52,211,153,.25); }
.gk-rec-k { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gk-accent); }
.gk-rec-text { margin: 10px 0 18px; font-size: 1.3rem; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: var(--gk-ink); }
.gk-owner { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.gk-owner b, .gk-sheet-top b, .gk-assigned b { display: block; font-size: 1rem; font-weight: 700; color: var(--gk-ink); }
.gk-owner span:not(.gk-avatar), .gk-sheet-top span:not(.gk-avatar):not(.gk-wa-badge), .gk-assigned span:not(.gk-wa-badge) { display: block; font-size: .85rem; color: var(--gk-label); margin-top: 1px; }
.gk-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #334155, #0f172a); color: #fff; font-weight: 700; font-size: .95rem;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #25d366;
}
html.dark .gk-avatar { box-shadow: 0 0 0 2px #18181b, 0 0 0 3.5px #25d366; }
.gk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 20px;
  border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer; border: 0; transition: filter .15s, transform .1s;
}
.gk-btn:active { transform: scale(.98); }
.gk-btn.wa { background: #25d366; color: #fff; box-shadow: 0 6px 18px -6px rgba(37,211,102,.7); }
.gk-btn.wa:hover { filter: brightness(1.05) saturate(1.1); }
.gk-btn.wide { width: 100%; }
.gk-btn.ghost { background: rgba(0,0,0,.06); color: var(--gk-ink); }
html.dark .gk-btn.ghost { background: rgba(255,255,255,.1); }
.gk-wa-badge { width: 34px; height: 34px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; flex: none; }
.gk-assigned { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(37,211,102,.12); }
.gk-assigned > div { flex: 1; }
.gk-link { background: none; border: 0; color: var(--gk-accent); font-weight: 700; cursor: pointer; font-size: .9rem; }

.gk-sheet-wrap { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; animation: gk-fade .15s; }
.gk-sheet { width: min(440px, 100%); border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: gk-up .25s cubic-bezier(.2,1.2,.4,1); }
html.dark .gk-sheet { background: #18181b; }
.gk-sheet-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #075e54; }
.gk-sheet-top b { color: #fff !important; }
.gk-sheet-top span:not(.gk-avatar):not(.gk-wa-badge) { color: rgba(255,255,255,.75) !important; }
.gk-sheet-top > div { flex: 1; }
.gk-sheet-top .gk-avatar { box-shadow: none; }
.gk-chat { padding: 18px 16px; background: #efeae2; }
html.dark .gk-chat { background: #0b141a; }
.gk-bubble { margin-left: auto; max-width: 92%; background: #d9fdd3; color: #111b21; border-radius: 10px 0 10px 10px; padding: 10px 12px 6px; font-size: .92rem; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
html.dark .gk-bubble { background: #005c4b; color: #e9edef; }
.gk-time { display: block; text-align: right; font-size: .72rem; opacity: .6; margin-top: 4px; }
.gk-sheet-actions { display: flex; gap: 10px; padding: 14px 16px; }
.gk-sheet-actions .gk-btn.wa { flex: 1; }
.gk-toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 6000; display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 8px; border-radius: 999px; background: #111827; color: #fff; font-weight: 600; font-size: .95rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.35); animation: gk-up .3s cubic-bezier(.2,1.2,.4,1); transition: opacity .35s;
}
.gk-toast.out { opacity: 0; }
@keyframes gk-fade { from { opacity: 0; } }
@keyframes gk-up { from { opacity: 0; transform: translate(var(--tx, 0), 12px) scale(.98); } }
.gk-toast { --tx: -50%; }
/* pin tip: one solid pointer in the ring colour */
.gk-pin-tip, html.dark .gk-pin-tip {
  top: 30px; width: 0; height: 0; border-radius: 0; background: none; box-shadow: none;
  transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 12px solid var(--v);
}
.gk-pin-attention .gk-pin-tip { border-top-color: #ef4444; }
.gk-pin-head { box-shadow: inset 0 0 0 3px var(--v), inset 0 0 0 4.5px #fff; }
.gk-pin-attention .gk-pin-head { box-shadow: inset 0 0 0 3px #ef4444, inset 0 0 0 4.5px #fff; }
html.dark .gk-pin-head { box-shadow: inset 0 0 0 3px var(--v), inset 0 0 0 4.5px #18181b; }
html.dark .gk-pin-attention .gk-pin-head { box-shadow: inset 0 0 0 3px #ef4444, inset 0 0 0 4.5px #18181b; }
.gk-pin-dot { width: 11px; height: 11px; right: -1px; top: -1px; }
.gk-quick {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px;
  background: #25d366; color: #fff; font-weight: 700; font-size: .92rem; border: 0; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 16px -6px rgba(37,211,102,.75); transition: filter .15s, transform .1s;
}
.gk-quick:hover { filter: brightness(1.05) saturate(1.1); }
.gk-quick:active { transform: scale(.97); }
.gk-quick.done { background: rgba(37,211,102,.14); color: #128c4b; box-shadow: none; cursor: default; }
html.dark .gk-quick.done { color: #4ade80; }
.gk-quick svg { width: 18px; height: 18px; flex: none; }
.gk-quick span { overflow: hidden; text-overflow: ellipsis; }
.gk-quick { max-width: 62%; min-width: 0; }

/* ── Calmer WhatsApp buttons (soft tint instead of neon green) ── */
.gk-btn.wa, .gk-quick {
  background: #e8f5ee; color: #0d6b3c; border: 1px solid #bfe3cf; box-shadow: none; filter: none;
}
.gk-btn.wa svg, .gk-quick svg { color: #1aa055; }
.gk-btn.wa:hover, .gk-quick:hover { background: #dcefe4; border-color: #a9d8bd; filter: none; }
html.dark .gk-btn.wa, html.dark .gk-quick { background: rgba(52, 168, 104, .14); color: #8fd9ae; border-color: rgba(143, 217, 174, .25); }
html.dark .gk-btn.wa svg, html.dark .gk-quick svg { color: #5cc98a; }
html.dark .gk-btn.wa:hover, html.dark .gk-quick:hover { background: rgba(52, 168, 104, .22); }

/* the final "Send" in the preview: WhatsApp's darker teal, solid but not glaring */
.gk-sheet-actions .gk-btn.wa { background: #128c7e; color: #fff; border-color: #128c7e; }
.gk-sheet-actions .gk-btn.wa svg { color: #fff; }
.gk-sheet-actions .gk-btn.wa:hover { background: #0f7a6e; }

/* softer badges, avatar ring and assigned state */
.gk-wa-badge { background: #1f9d5c; }
.gk-avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #9fd8b6; }
html.dark .gk-avatar { box-shadow: 0 0 0 2px #18181b, 0 0 0 3.5px #2f7a52; }
.gk-assigned { background: #eef7f2; border: 1px solid #d3ecdd; }
html.dark .gk-assigned { background: rgba(52, 168, 104, .1); border-color: rgba(143, 217, 174, .18); }
.gk-quick.done { background: transparent; border-color: transparent; color: #2f855a; }
html.dark .gk-quick.done { color: #7dd3a3; }
