:root {
  --widget-width: 232px;
  --widget-height: 372px;
  --margin: 24px;

  /* Lucia frosted-glass palette (shared with the assistant UI). */
  --brand-ink: #091426;
  --accent: #0060ac;
  --surface-bright: #f7f9fb;
  --on-surface: #191c1e;
  --slate-muted: #64748b;
  --border-line: #e2e5e8;
}

.reopen-bar {
  position: fixed;
  bottom: var(--margin);
  left: var(--margin);
  z-index: 9998;
}

.reopen-btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 96, 172, 0.35);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
.reopen-btn:hover {
  background: var(--brand-ink);
  transform: translateY(-1px);
}

/* --- Floating chat widget --- */
.chat-widget {
  position: fixed;
  right: var(--margin);
  bottom: var(--margin);
  width: var(--widget-width);
  height: min(var(--widget-height), calc(100vh - 2 * var(--margin)));
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--border-line);
  box-shadow: 0 24px 60px rgba(9, 20, 38, 0.32);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-sizing: border-box;
  /* left/top take over once the user starts dragging */
}

/* Maximized: fill (almost) the whole viewport. */
.chat-widget.is-maximized {
  right: 0;
  bottom: 0;
  left: 0 !important;
  top: 0 !important;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.chat-widget.is-hidden {
  display: none;
}

.widget-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: var(--brand-ink);
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-sizing: border-box;
}

.chat-widget.is-maximized .widget-header {
  cursor: default;
}

.widget-header.dragging {
  cursor: grabbing;
}

.widget-title {
  flex: 1 1 auto;
  font-family: "Hanken Grotesk", "Inter", sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.widget-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, color 0.15s ease;
}
.widget-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.widget-btn.close:hover {
  background: #e5484d;
  color: #fff;
}
.widget-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.widget-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: var(--surface-bright);
}

.widget-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
