/* ──────────────────────────────────────────────────────────────────────────
   hawz-shell — the Hawz ecosystem launcher + command palette.
   Drop this CSS alongside hawz-shell.js into any app at hawz.net.
   All styles are prefixed .hz- so nothing leaks into the host app.
   Pulls from the canonical hawz-tokens (--bg, --surface, --brand-1, etc.) —
   falls back to hard values if tokens aren't present (so it also works on
   orphan pages that haven't adopted tokens yet).
   ────────────────────────────────────────────────────────────────────────── */

.hz-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
  font-family: var(--font-sans, "Inter", system-ui, -apple-system, sans-serif);
  color: var(--text, #f4f5fa);
  -webkit-font-smoothing: antialiased;
}
.hz-root * { box-sizing: border-box; }

/* ── Corner launcher ──────────────────────────────────────────────────── */
.hz-launch {
  pointer-events: auto;
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 10px;
  border-radius: 999px;
  background: rgba(10, 10, 16, 0.72);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text, #f4f5fa);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 180ms var(--ease, cubic-bezier(.2,.7,.2,1)),
              background 180ms var(--ease, cubic-bezier(.2,.7,.2,1)),
              border-color 180ms var(--ease, cubic-bezier(.2,.7,.2,1)),
              box-shadow 240ms var(--ease, cubic-bezier(.2,.7,.2,1));
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
}
.hz-launch:hover {
  transform: translateY(-1px);
  background: rgba(16, 16, 26, 0.88);
  border-color: var(--stroke-2, rgba(255, 255, 255, 0.16));
  box-shadow: 0 16px 50px -10px rgba(167, 139, 250, 0.25),
              0 0 0 1px rgba(167, 139, 250, 0.18);
}
.hz-launch:focus-visible {
  outline: 2px solid var(--brand-1, #a78bfa);
  outline-offset: 3px;
}

.hz-launch-dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-1, #a78bfa), var(--brand-2, #60a5fa) 55%, var(--brand-3, #22d3ee));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.02em;
  color: #0a0a10;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25),
              0 0 16px rgba(167, 139, 250, 0.35);
}
.hz-launch-label {
  font-family: var(--font-sans, "Inter", sans-serif);
}
.hz-launch-kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  color: var(--text-dim, #bfc4d3);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Hide launcher when palette is open (looks cleaner) */
.hz-root[data-open="true"] .hz-launch { opacity: 0; pointer-events: none; transform: translateY(4px); }

/* ── Palette ──────────────────────────────────────────────────────────── */
.hz-backdrop {
  pointer-events: none; /* invisible when closed — don't eat clicks */
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 8, 0.55);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  opacity: 0;
  transition: opacity 160ms var(--ease, cubic-bezier(.2,.7,.2,1));
}
.hz-root[data-open="true"] .hz-backdrop { opacity: 1; pointer-events: auto; }

.hz-palette {
  pointer-events: none; /* palette box is invisible when closed — don't eat clicks */
  position: fixed;
  top: 15vh;
  left: 50%;
  width: min(640px, calc(100vw - 32px));
  max-height: 70vh;
  transform: translate(-50%, -8px);
  opacity: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(22, 22, 34, 0.92), rgba(14, 14, 22, 0.92));
  border: 1px solid var(--stroke-2, rgba(255, 255, 255, 0.16));
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.75),
              0 0 0 1px rgba(255, 255, 255, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: transform 180ms var(--ease, cubic-bezier(.2,.7,.2,1)),
              opacity 160ms var(--ease, cubic-bezier(.2,.7,.2,1));
}
.hz-root[data-open="true"] .hz-palette {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* Brand bleed at the top of the palette */
.hz-palette::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-1, #a78bfa) 25%,
    var(--brand-2, #60a5fa) 50%,
    var(--brand-3, #22d3ee) 75%,
    transparent 100%);
  opacity: 0.55;
}

.hz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
}
.hz-header-dot {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-1, #a78bfa), var(--brand-3, #22d3ee));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #0a0a10;
}
.hz-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text, #f4f5fa);
  font: inherit;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 2px 0;
}
.hz-input::placeholder { color: var(--text-mute, #8b90a3); }
.hz-header-hint {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--text-mute, #8b90a3);
  letter-spacing: 0;
}

.hz-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  max-height: calc(70vh - 56px);
  scrollbar-width: thin;
}
.hz-list::-webkit-scrollbar { width: 8px; }
.hz-list::-webkit-scrollbar-thumb {
  background: var(--stroke-2, rgba(255,255,255,0.16));
  border-radius: 999px;
}

.hz-section {
  padding: 10px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute, #8b90a3);
}
.hz-section:first-child { padding-top: 6px; }

.hz-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim, #bfc4d3);
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: background 100ms linear, color 100ms linear;
}
.hz-item[aria-current="true"] {
  color: var(--text, #f4f5fa);
  background: rgba(167, 139, 250, 0.12);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.22);
}
.hz-item:hover { color: var(--text, #f4f5fa); background: rgba(255, 255, 255, 0.05); }

.hz-ico {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  color: var(--text, #f4f5fa);
}
.hz-ico-brand {
  background: linear-gradient(135deg, var(--brand-1, #a78bfa), var(--brand-3, #22d3ee));
  border-color: transparent;
  color: #0a0a10;
}
.hz-item-body { flex: 1; min-width: 0; }
.hz-item-title { font-weight: 500; color: inherit; }
.hz-item-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-mute, #8b90a3);
}
.hz-item-kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  color: var(--text-mute, #8b90a3);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
}
.hz-item-chip {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.14);
  color: var(--brand-1, #a78bfa);
  border: 1px solid rgba(167, 139, 250, 0.28);
}

.hz-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-mute, #8b90a3);
  font-size: 13px;
}

.hz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-mute, #8b90a3);
  font-size: 11.5px;
  gap: 10px;
}
.hz-foot-keys { display: inline-flex; align-items: center; gap: 10px; }
.hz-foot-keys span { display: inline-flex; align-items: center; gap: 5px; }
.hz-foot kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  color: var(--text-dim, #bfc4d3);
}

/* ── Token bar ────────────────────────────────────────────────────────── */
.hz-token-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(167, 139, 250, 0.06);
  border-bottom: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  font-size: 12.5px;
}
.hz-token-bar[hidden] { display: none; }
.hz-token-msg { color: var(--text-dim, #bfc4d3); flex-shrink: 0; }
.hz-token-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  border-radius: 7px;
  padding: 6px 10px;
  color: var(--text, #f4f5fa);
  font: inherit;
  font-size: 13px;
  outline: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.hz-token-input:focus { border-color: rgba(167, 139, 250, 0.4); }
.hz-token-save {
  background: linear-gradient(135deg, var(--brand-1, #a78bfa), var(--brand-3, #22d3ee));
  color: #0a0a10;
  border: 0;
  border-radius: 7px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Ask thread ───────────────────────────────────────────────────────── */
.hz-thread {
  overflow-y: auto;
  max-height: calc(70vh - 56px);
  padding: 14px 16px 16px;
  scrollbar-width: thin;
}
.hz-thread[hidden] { display: none; }
.hz-thread::-webkit-scrollbar { width: 8px; }
.hz-thread::-webkit-scrollbar-thumb {
  background: var(--stroke-2, rgba(255,255,255,0.16));
  border-radius: 999px;
}

.hz-ask-welcome {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-mute, #8b90a3);
}
.hz-ask-welcome-dot {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--brand-1, #a78bfa), var(--brand-2, #60a5fa) 55%, var(--brand-3, #22d3ee));
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.35);
}
.hz-ask-welcome-title {
  color: var(--text, #f4f5fa);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.hz-ask-welcome-sub { font-size: 12.5px; line-height: 1.5; }

.hz-msg { margin-bottom: 14px; }
.hz-msg:last-child { margin-bottom: 0; }
.hz-msg-role {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute, #8b90a3);
  margin-bottom: 4px;
}
.hz-msg-user .hz-msg-role { color: var(--brand-1, #a78bfa); }
.hz-msg-assistant .hz-msg-role {
  background: linear-gradient(90deg, var(--brand-1, #a78bfa), var(--brand-3, #22d3ee));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hz-msg-body {
  color: var(--text, #f4f5fa);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}
.hz-msg-body a { color: var(--brand-1, #a78bfa); text-decoration: underline; text-underline-offset: 2px; }
.hz-msg-body strong { font-weight: 600; color: var(--text, #f4f5fa); }
.hz-msg-body em { font-style: italic; color: var(--text-dim, #bfc4d3); }

.hz-code-inline {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.08));
  color: var(--brand-3, #22d3ee);
}
.hz-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  color: var(--text-dim, #bfc4d3);
  overflow-x: auto;
  white-space: pre;
}
.hz-code code { background: none; border: 0; padding: 0; color: inherit; }

/* ── Jarvis-style cards (for assistant responses) ─────────────────────── */
@keyframes hzCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hz-card {
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 18, 28, 0.72), rgba(10, 11, 18, 0.72));
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  position: relative;
  overflow: hidden;
  animation: hzCardIn 260ms var(--ease, cubic-bezier(.2,.7,.2,1)) both;
}

/* Recommendation — primary answer */
.hz-card-rec {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(34, 211, 238, 0.06));
  border-color: rgba(167, 139, 250, 0.28);
  padding: 14px 16px;
}
.hz-card-rec::before {
  content: "";
  position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-1, #a78bfa), var(--brand-3, #22d3ee), transparent);
  opacity: 0.7;
}
.hz-card-title {
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text, #f4f5fa);
  margin-bottom: 4px;
}
.hz-card-body {
  font-size: 13px; line-height: 1.55;
  color: var(--text-dim, #bfc4d3);
  letter-spacing: -0.005em;
}
.hz-card-eyebrow {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-mute, #8b90a3);
  margin-bottom: 6px;
  display: block;
}
.hz-card-caption { margin-top: 4px; font-size: 11.5px; color: var(--text-mute, #8b90a3); }

/* Timeline — sequence of time blocks */
.hz-card-timeline { padding: 14px 16px; }
.hz-tl { display: flex; flex-direction: column; gap: 2px; }
.hz-tl-item {
  display: grid;
  grid-template-columns: 52px 14px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  position: relative;
}
.hz-tl-item + .hz-tl-item::before {
  content: "";
  position: absolute;
  left: 58px;
  top: -6px;
  bottom: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--stroke-2, rgba(255,255,255,.16)));
}
.hz-tl-item::after {
  content: "";
  position: absolute;
  left: 58px;
  top: 50%;
  bottom: -6px;
  width: 1px;
  background: linear-gradient(180deg, var(--stroke-2, rgba(255,255,255,.16)), transparent);
}
.hz-tl-item:last-child::after { display: none; }

.hz-tl-time {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 11.5px; font-weight: 600;
  color: var(--brand-3, #22d3ee);
  letter-spacing: 0.02em;
  padding-top: 2px;
  text-align: right;
}
.hz-tl-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand-1, #a78bfa);
  box-shadow: 0 0 12px currentColor, inset 0 0 0 2px rgba(10, 10, 16, 0.9);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.hz-tl-event   .hz-tl-dot { background: var(--brand-1, #a78bfa); color: rgba(167,139,250,.6); }
.hz-tl-focus   .hz-tl-dot { background: var(--brand-2, #60a5fa); color: rgba(96,165,250,.6); }
.hz-tl-break   .hz-tl-dot { background: #34d399; color: rgba(52,211,153,.6); }
.hz-tl-prep    .hz-tl-dot { background: #fbbf24; color: rgba(251,191,36,.6); }
.hz-tl-rest    .hz-tl-dot { background: var(--text-mute, #8b90a3); color: rgba(139,144,163,.5); }
.hz-tl-travel  .hz-tl-dot { background: var(--brand-3, #22d3ee); color: rgba(34,211,238,.6); }

.hz-tl-body { min-width: 0; padding-top: 2px; }
.hz-tl-label {
  font-size: 13px; font-weight: 500;
  color: var(--text, #f4f5fa);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.hz-tl-meta {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 10px;
  color: var(--text-mute, #8b90a3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

/* Stat — one big number */
.hz-card-stat {
  padding: 14px 16px;
}
.hz-stat-value {
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-size: 32px; font-weight: 400; line-height: 1; letter-spacing: -0.025em;
  color: var(--text, #f4f5fa);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--text, #f4f5fa), var(--brand-1, #a78bfa));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Action — suggested next step */
.hz-card-action {
  background: rgba(255, 255, 255, 0.03);
  border-style: dashed;
  border-color: var(--stroke-2, rgba(255,255,255,.16));
  padding: 10px 14px;
}
.hz-action-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hz-action-label {
  font-size: 13px; font-weight: 500; color: var(--text, #f4f5fa);
  letter-spacing: -0.005em;
}
.hz-action-hint {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 10.5px;
  color: var(--text-mute, #8b90a3);
}

/* Note — secondary / caveat */
.hz-card-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--stroke, rgba(255,255,255,.1));
  padding: 10px 12px;
}
.hz-note-glyph {
  color: var(--text-mute, #8b90a3);
  font-size: 13px;
  line-height: 1.5;
  flex-shrink: 0;
  padding-top: 1px;
}
.hz-card-note .hz-card-body {
  font-size: 12px; color: var(--text-mute, #8b90a3); line-height: 1.55;
}

/* Memory chip — shown when auto-capture saves a fact */
.hz-card-memory {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  margin: 8px 0;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  font-size: 11px;
}
.hz-memory-glyph { color: #34d399; }
.hz-memory-label {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #34d399; font-weight: 600;
}
.hz-memory-text {
  color: var(--text-dim, #bfc4d3);
  font-size: 11px;
  max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Thinking indicator (3 pulsing dots while Hawz composes) */
.hz-thinking {
  display: inline-flex; gap: 4px;
  padding: 12px 4px;
}
.hz-thinking span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-1, #a78bfa);
  opacity: 0.3;
  animation: hzThink 1.1s ease-in-out infinite both;
}
.hz-thinking span:nth-child(1) { animation-delay: 0s; }
.hz-thinking span:nth-child(2) { animation-delay: 0.15s; }
.hz-thinking span:nth-child(3) { animation-delay: 0.30s; }
@keyframes hzThink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .hz-card, .hz-thinking span { animation: none !important; }
}

/* Sync + deploy */

/* In ask mode, use a bigger / pill-free palette header */
.hz-root[data-mode="ask"] .hz-palette { max-height: 78vh; }
.hz-root[data-mode="ask"] .hz-thread { max-height: calc(78vh - 56px); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hz-backdrop, .hz-palette, .hz-launch { transition: none; }
}

/* Tiny screens */
@media (max-width: 480px) {
  .hz-launch-label { display: none; }
  .hz-launch { right: 14px; bottom: 14px; padding: 8px; }
  .hz-launch-kbd { display: none; }
  .hz-palette { top: 8vh; max-height: 84vh; }
  .hz-list { max-height: calc(84vh - 56px); }
}
