/* ============================================================================
   Sasya dashboard styles. Depends on theme.css tokens.
   Dashboards get restrained motion (entrance reveals + hovers), not scrolltelling.
   ============================================================================ */

.app-nav {
  position: sticky; top: 0; z-index: var(--z-nav); height: var(--nav-h);
  display: flex; align-items: center;
  background: hsl(var(--background) / 0.82); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid hsl(var(--border));
}
.app-nav .container { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.app-nav .left { display: flex; align-items: center; gap: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: hsl(var(--muted-foreground)); transition: color .2s; }
.back-link:hover { color: hsl(var(--foreground)); }
.back-link svg { width: 17px; height: 17px; }
.app-status {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
  color: hsl(var(--muted-foreground)); padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid hsl(var(--border)); background: hsl(var(--card) / 0.6);
}

/* workflow stepper */
.workstrip { border-bottom: 1px solid hsl(var(--border)); background: linear-gradient(180deg, hsl(var(--surface)), hsl(var(--background) / 0)); }
.workstrip .container { display: flex; align-items: center; gap: 10px; padding: 16px 24px; flex-wrap: wrap; }
.wstep { display: flex; align-items: center; gap: 10px; color: hsl(var(--muted-foreground)); font-size: 13.5px; transition: color .3s ease; }
.wstep .wn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; border: 1px solid hsl(var(--border-strong)); flex: none; transition: background .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease; }
.wstep.active { color: hsl(var(--foreground)); }
.wstep.active .wn { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); box-shadow: 0 0 0 4px hsl(var(--primary) / 0.16); }
.wstep-sep { width: 26px; height: 2px; border-radius: 2px; background: hsl(var(--border-strong)); }
@media (max-width: 720px) { .wstep span.wl { display: none; } }

/* grid layout */
/* ambient backdrop so the tool does not read as a flat grey grid */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(72% 44% at 50% -12%, hsl(var(--foreground) / 0.04), transparent 62%);
}

/* editorial intro above the working grid */
.dash-intro { max-width: 1320px; margin: 0 auto; padding: 30px 24px 4px; }
.dash-intro h1 { font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.025em; }
.dash-intro p { margin-top: 8px; font-size: 15.5px; color: hsl(var(--muted-foreground)); max-width: 58ch; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.kpi { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: linear-gradient(180deg, hsl(var(--card)), hsl(var(--card-2))); transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.kpi:hover { border-color: hsl(var(--primary) / 0.4); transform: translateY(-2px); box-shadow: 0 20px 40px -30px hsl(var(--shadow-color)); }
.kpi-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); flex: none; }
.kpi-ic svg { width: 20px; height: 20px; }
.kpi-n { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.kpi-l { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 3px; }
@media (max-width: 900px) { .dash-kpis { grid-template-columns: 1fr 1fr; } }

.dash { max-width: 1320px; margin: 0 auto; padding: 20px 24px 48px; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel {
  min-width: 0;
  background: linear-gradient(180deg, hsl(var(--card)), hsl(var(--card-2)));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 22px;
  box-shadow: 0 1px 0 hsl(var(--foreground) / 0.03) inset, 0 26px 50px -34px hsl(var(--shadow-color) / 0.7);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.panel:hover { border-color: hsl(var(--border-strong)); }
.panel.input-panel { position: sticky; top: calc(var(--nav-h) + 16px); }
.panel.full { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.panel-head h2 { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.panel-head h2 .tk { font-family: var(--font-mono); font-size: 10.5px; color: hsl(var(--primary)); border: 1px solid hsl(var(--primary) / 0.3); background: hsl(var(--primary) / 0.1); padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; }
.panel-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); flex: none; }
.panel-ic svg { width: 17px; height: 17px; }
@media (max-width: 1080px) { .dash { grid-template-columns: 1fr; } .panel.input-panel { position: static; } .dash-main { grid-template-columns: 1fr; } .panel.full { grid-column: auto; } }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > .lbl { display: block; font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-bottom: 6px; font-weight: 500; }
input, select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: var(--font-sans);
  background: hsl(var(--input)); border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm);
  color: hsl(var(--foreground)); transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { outline: none; border-color: hsl(var(--primary)); box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18); }
input::placeholder { color: hsl(var(--muted-foreground) / 0.7); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

#map { height: 250px; border-radius: var(--radius); margin-top: 14px; border: 1px solid hsl(var(--border)); overflow: hidden; }
.leaflet-container { background: hsl(var(--muted)); font-family: var(--font-sans); }
.ndvi-legend { background: hsl(var(--card)); padding: 8px 10px; border-radius: 8px; border: 1px solid hsl(var(--border)); font-size: 11px; color: hsl(var(--muted-foreground)); }
.ndvi-legend .grad { height: 8px; border-radius: 4px; margin: 5px 0 3px; background: linear-gradient(90deg, hsl(var(--data-bad)), hsl(var(--data-warn)), hsl(var(--data-good))); }
.ndvi-legend .lbls { display: flex; justify-content: space-between; }

/* empty / skeleton states */
.empty { color: hsl(var(--muted-foreground)); font-size: 14px; padding: 20px; text-align: center; border: 1px dashed hsl(var(--border-strong)); border-radius: var(--radius); background: hsl(var(--card-2)); }
.hidden { display: none !important; }
.skeleton { position: relative; overflow: hidden; background: hsl(var(--muted)); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, hsl(var(--foreground) / 0.06), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* risk gauge */
.riskgauge { display: flex; align-items: center; gap: 20px; }
.gauge-big { --p: 0; width: 128px; height: 128px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  background: radial-gradient(closest-side, hsl(var(--card)) 71%, transparent 72% 100%), conic-gradient(var(--gcolor, hsl(var(--data-good))) calc(var(--p) * 1%), hsl(var(--muted)) 0);
  transition: --p 1.1s cubic-bezier(.16,1,.3,1); }
.gauge-big::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; z-index: -1; opacity: .5;
  background: radial-gradient(closest-side, var(--gcolor, hsl(var(--data-good))), transparent 72%); filter: blur(10px); }
.gauge-big .gv { font-family: var(--font-display); font-size: 36px; font-weight: 600; }
.gaugeband { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; display: inline-block; margin-top: 6px; }
.band-low { color: hsl(var(--data-good)); background: hsl(var(--data-good) / 0.14); }
.band-moderate { color: hsl(var(--data-warn)); background: hsl(var(--data-warn) / 0.14); }
.band-high, .band-severe { color: hsl(var(--data-bad)); background: hsl(var(--data-bad) / 0.14); }
.risk-caption { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 4px; }

.subscores { display: grid; gap: 12px; margin-top: 18px; }
.subscore .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; text-transform: capitalize; }
.subscore .lbl b { font-family: var(--font-mono); }
.subscore .track { height: 7px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; }
.subscore .fill { height: 100%; border-radius: 999px; width: 0; transition: width .8s cubic-bezier(.16,1,.3,1); }
.chart-wrap { margin-top: 18px; background: hsl(var(--card-2)); border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); padding: 12px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.chart-grid .chart-wrap { margin-top: 0; }
@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-cap { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: hsl(var(--muted-foreground)); margin-bottom: 8px; font-family: var(--font-mono); }
.warnings { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.warnings li { font-size: 13px; padding: 9px 12px 9px 34px; position: relative; border-radius: var(--radius-sm); background: hsl(var(--data-warn) / 0.08); border: 1px solid hsl(var(--data-warn) / 0.22); color: hsl(var(--foreground)); }
.warnings li::before { content: "!"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; border-radius: 50%; background: hsl(var(--data-warn)); color: hsl(var(--background)); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }

/* leaf scan */
.filedrop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 26px; border: 2px dashed hsl(var(--border-strong)); border-radius: var(--radius); cursor: pointer; transition: border-color .2s, background .2s; text-align: center; color: hsl(var(--muted-foreground)); font-size: 14px; }
.filedrop:hover { border-color: hsl(var(--primary) / 0.6); background: hsl(var(--primary) / 0.05); }
.filedrop svg { width: 26px; height: 26px; color: hsl(var(--primary)); }
.leafprev { margin-top: 14px; border-radius: var(--radius); max-height: 220px; width: 100%; object-fit: cover; border: 1px solid hsl(var(--border)); }
.scanverdict { margin-top: 14px; border-radius: var(--radius); border: 1px solid hsl(var(--border)); padding: 16px; background: hsl(var(--card-2)); }
.scanverdict.diseased { border-color: hsl(var(--data-bad) / 0.4); }
.scanverdict.healthy { border-color: hsl(var(--data-good) / 0.4); }
.scanverdict .dcrop { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: hsl(var(--muted-foreground)); }
.scanverdict .dname { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-top: 3px; }
.conf { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 10px; }
.conf .bar { height: 7px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; margin: 6px 0; }
.conf .bar span { display: block; height: 100%; border-radius: 999px; }
.heatwrap { margin-top: 12px; }
.heatmap { width: 100%; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); }
.heatcap { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 6px; }

/* recommendations */
.rec { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: hsl(var(--card-2)); transition: border-color .2s, transform .2s; position: relative; }
.rec:hover { border-color: hsl(var(--primary) / 0.4); transform: translateY(-2px); }
.rec .rank { position: absolute; top: 14px; right: 14px; font-family: var(--font-mono); font-size: 12px; color: hsl(var(--muted-foreground)); }
.rec .type { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: hsl(var(--primary)); }
.rec .name { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec .addresses { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag2 { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.reasons { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.reasons li { font-size: 13px; color: hsl(var(--muted-foreground)); padding-left: 18px; position: relative; }
.reasons li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: hsl(var(--primary)); }

/* advisory */
.advisory { border-radius: var(--radius); border: 1px solid hsl(var(--border)); padding: 18px; background: hsl(var(--card-2)); font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.advisory .src { display: inline-block; font-family: var(--font-mono); font-size: 11px; color: hsl(var(--primary)); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; }

/* economics */
.econrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.econstat { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 16px; background: hsl(var(--card-2)); }
.econstat .lbl { font-size: 12px; color: hsl(var(--muted-foreground)); }
.econstat .val { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin-top: 4px; }
.econyield { display: flex; gap: 20px; margin-top: 14px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.econyield b { color: hsl(var(--foreground)); font-family: var(--font-mono); }
.attrib { margin-top: 16px; }
.attrlbl { font-size: 12px; color: hsl(var(--muted-foreground)); margin-bottom: 8px; }
.attrbar { height: 16px; border-radius: 999px; overflow: hidden; display: flex; background: hsl(var(--muted)); }
.attrbar span { display: block; height: 100%; transition: width .8s ease; }
#attrBio { background: hsl(var(--data-good)); }
#attrRisk { background: hsl(var(--data-warn)); }
.attrlegend { display: flex; gap: 18px; margin-top: 10px; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.attrlegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.dot-bio { background: hsl(var(--data-good)); }
.dot-risk { background: hsl(var(--data-warn)); }

/* learning */
.learnresult { margin-top: 14px; }
.lifttable { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.lifttable th { text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--muted-foreground)); padding: 8px 10px; border-bottom: 1px solid hsl(var(--border)); }
.lifttable td { padding: 9px 10px; border-bottom: 1px solid hsl(var(--border)); font-family: var(--font-mono); }
.delta-pos { color: hsl(var(--data-good)); }
.delta-neg { color: hsl(var(--data-bad)); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px); z-index: var(--z-toast); background: hsl(var(--card)); border: 1px solid hsl(var(--border-strong)); color: hsl(var(--foreground)); padding: 12px 20px; border-radius: var(--radius-pill); font-size: 14px; box-shadow: 0 20px 50px -20px hsl(var(--shadow-color)); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- chat assistant ---------- */
.chat-fab {
  position: fixed; bottom: 26px; right: 26px; z-index: var(--z-overlay);
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(140deg, hsl(var(--primary)), hsl(var(--primary-strong)));
  color: hsl(var(--primary-foreground)); display: grid; place-items: center;
  box-shadow: 0 18px 42px -14px hsl(var(--primary) / 0.65);
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s ease;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.05); }
.chat-fab svg { position: absolute; width: 24px; height: 24px; transition: opacity .3s ease, transform .3s ease; }
.chat-fab .fab-ic-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
body.chat-open .chat-fab .fab-ic-chat { opacity: 0; transform: rotate(90deg) scale(.5); }
body.chat-open .chat-fab .fab-ic-close { opacity: 1; transform: none; }
.fab-ring { position: absolute; inset: 0; border-radius: 50%; animation: fabPulse 2.6s ease-out infinite; }
@keyframes fabPulse { 0% { box-shadow: 0 0 0 0 hsl(var(--primary) / 0.45); } 70%, 100% { box-shadow: 0 0 0 18px hsl(var(--primary) / 0); } }
body.chat-open .fab-ring, .chat-fab:hover .fab-ring { animation: none; }
@media (prefers-reduced-motion: reduce) { .fab-ring { animation: none; } }

.chat-panel {
  position: fixed; bottom: 96px; right: 26px; z-index: var(--z-overlay);
  width: 384px; max-width: calc(100vw - 40px); height: 544px; max-height: calc(100vh - 130px);
  display: flex; flex-direction: column; overflow: hidden;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border-strong)); border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px -30px hsl(0 0% 0% / 0.78);
  transform-origin: bottom right; transform: translateY(18px) scale(.96); opacity: 0; pointer-events: none;
  transition: opacity .26s ease, transform .34s cubic-bezier(.16,1,.3,1);
}
.chat-panel.open { transform: none; opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .chat-panel { transition: opacity .2s ease; transform: none; } }

.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 13px 13px 16px; border-bottom: 1px solid hsl(var(--border)); background: linear-gradient(180deg, hsl(var(--card-2)), hsl(var(--card))); }
.chat-id { display: flex; align-items: center; gap: 11px; }
.chat-av { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; flex: none; border: 1px solid hsl(var(--border-strong)); background: hsl(var(--card-2)); box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12); }
.chat-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.chat-status { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 1px; }
.chat-status .live-dot { background: hsl(var(--data-good)); box-shadow: 0 0 0 3px hsl(var(--data-good) / 0.18); }
.chat-head-actions { display: flex; gap: 4px; }
.chat-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.chat-icon-btn:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.chat-icon-btn svg { width: 17px; height: 17px; }

.chat-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: hsl(var(--border-strong)); border-radius: 8px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; animation: msgIn .35s cubic-bezier(.16,1,.3,1); }
.chat-msg.user { flex-direction: row-reverse; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat-msg { animation: none; } }
.msg-av { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex: none; border: 1px solid hsl(var(--border)); background: hsl(var(--card-2)); }
.msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-col { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.chat-msg.user .msg-col { align-items: flex-end; }
.bubble { padding: 10px 13px; border-radius: 15px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg.bot .bubble { background: hsl(var(--muted)); color: hsl(var(--foreground)); border-bottom-left-radius: 5px; }
.chat-msg.user .bubble { background: linear-gradient(140deg, hsl(var(--primary)), hsl(var(--primary-strong))); color: hsl(var(--primary-foreground)); border-bottom-right-radius: 5px; }
.msg-src { font-size: 9.5px; font-family: var(--font-mono); color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: .08em; padding-left: 4px; }
/* markdown-lite inside bot bubbles */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 20px; display: grid; gap: 4px; }
.bubble ul:last-child, .bubble ol:last-child { margin-bottom: 0; }
.bubble li { font-size: 13.5px; line-height: 1.5; }
.bubble strong { font-weight: 600; }
.bubble em { font-style: italic; }
.bubble code { font-family: var(--font-mono); font-size: 12px; background: hsl(var(--foreground) / 0.08); padding: 1px 5px; border-radius: 5px; }
.chat-msg.user .bubble code { background: hsl(0 0% 100% / 0.18); }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--muted-foreground)); animation: td 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes td { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 36px; }
.sug { font-size: 12.5px; padding: 8px 13px; border-radius: var(--radius-pill); border: 1px solid hsl(var(--border-strong)); background: hsl(var(--card-2)); color: hsl(var(--foreground)); cursor: pointer; transition: border-color .2s, color .2s, background .2s, transform .2s; text-align: left; }
.sug:hover { border-color: hsl(var(--primary) / 0.6); color: hsl(var(--primary)); background: hsl(var(--primary) / 0.08); transform: translateY(-1px); }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid hsl(var(--border)); background: hsl(var(--card)); }
.chat-input input { flex: 1; border-radius: var(--radius-pill); padding: 11px 16px; }
.chat-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; background: linear-gradient(140deg, hsl(var(--primary)), hsl(var(--primary-strong))); color: hsl(var(--primary-foreground)); transition: transform .2s, opacity .2s; }
.chat-send svg { width: 18px; height: 18px; }
.chat-send:hover:not(:disabled) { transform: scale(1.06); }
.chat-send:disabled { opacity: .4; cursor: default; }

@media (max-width: 560px) {
  .chat-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; height: 82vh; max-height: 82vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .chat-fab { bottom: 18px; right: 18px; }
}

/* Dashboard entrance is applied by app.js via the Web Animations API with
   fill:'none', so the resting state is always fully visible. A dashboard is a
   tool: content must never hide behind an animation that could be throttled. */

/* ---------- high-end polish: load bar, spinners, empty icons, sheen ---------- */
.load-bar { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: calc(var(--z-nav) + 5); overflow: hidden; opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.load-bar.active { opacity: 1; }
.load-bar::before { content: ""; position: absolute; height: 100%; width: 40%; left: -40%; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)), hsl(var(--data-info))); animation: loadSlide 1.05s ease-in-out infinite; }
@keyframes loadSlide { 0% { left: -42%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .load-bar::before { animation: none; width: 100%; left: 0; } }

/* inline button spinner (text stays visible next to it) */
.spin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: btnspin .7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes btnspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 1.6s; } }

/* nicer empty states with an icon badge */
.empty { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.empty-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); }
.empty-ic svg { width: 21px; height: 21px; }
.advisory.empty { line-height: 1.5; }

/* panel top sheen + a touch more depth on hover */
.panel::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 1px; background: linear-gradient(90deg, transparent, hsl(var(--foreground) / 0.12), transparent); pointer-events: none; }
.panel { position: relative; }
.panel:hover { border-color: hsl(var(--border-strong)); box-shadow: 0 1px 0 hsl(var(--foreground) / 0.04) inset, 0 30px 60px -34px hsl(var(--shadow-color) / 0.85); }

/* workflow: connector fills as steps complete */
.wstep-sep { transition: background .4s ease; }
.wstep.active + .wstep-sep { background: hsl(var(--primary)); }

/* subtle press feedback on buttons */
.btn:active { transform: translateY(1px); }
