/* Huginn dock — ASGARD DS tokens only (no hardcoded brand hex) */
:root {
  --hg-rail-w: 52px;
  --hg-panel-w: 400px;
  --hg-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.hg-chrome {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 1200;
  display: flex;
  flex-direction: row-reverse;
  pointer-events: none;
  font-family: inherit;
}

.hg-chrome * { box-sizing: border-box; }

.hg-rail {
  width: var(--hg-rail-w);
  height: 100%;
  background: var(--bg-elevated, var(--surface, #fff));
  border-left: 1px solid var(--border, rgba(0,0,0,.08));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  pointer-events: auto;
}

.hg-rail-btn {
  width: 44px;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--text-muted, #667);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  transition: background .2s var(--hg-ease), color .2s var(--hg-ease), transform .2s var(--hg-ease);
}

.hg-rail-btn:hover { background: var(--bg-hover, rgba(0,0,0,.04)); color: var(--text, #111); }
.hg-rail-btn.is-active { color: var(--accent, #2563eb); background: var(--accent-soft, rgba(37,99,235,.1)); }
.hg-rail-btn svg { width: 22px; height: 22px; }

.hg-panel {
  width: var(--hg-panel-w);
  height: 100%;
  background: var(--bg, #f7f8fa);
  border-left: 1px solid var(--border, rgba(0,0,0,.08));
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform .28s var(--hg-ease), opacity .2s var(--hg-ease);
  box-shadow: -8px 0 24px rgba(0,0,0,.06);
}

.hg-chrome.is-collapsed .hg-panel {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.hg-panel-head {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.08));
  background: var(--bg-elevated, #fff);
}

.hg-panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  flex: 1;
}

.hg-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted, #667);
  cursor: pointer;
}
.hg-icon-btn:hover { background: var(--bg-hover, rgba(0,0,0,.05)); color: var(--text, #111); }

.hg-stories {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.06));
  background: var(--bg-elevated, #fff);
}

.hg-story {
  flex: 0 0 auto;
  width: 56px;
  text-align: center;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-muted, #667);
}
.hg-story-ring {
  width: 48px;
  height: 48px;
  margin: 0 auto 4px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(var(--accent, #2563eb), var(--accent-2, #7c3aed));
}
.hg-story-ring.is-viewed { background: var(--border, #ddd); }
.hg-story-av {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg, #eee);
  border: 2px solid var(--bg-elevated, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text, #222);
}

.hg-search {
  margin: 8px 12px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(0,0,0,.1));
  padding: 0 12px;
  background: var(--bg-elevated, #fff);
  color: var(--text, #111);
}

.hg-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.hg-chat-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border: 0;
  width: 100%;
  background: transparent;
  text-align: left;
  color: inherit;
  transition: background .15s var(--hg-ease);
}
.hg-chat-row:hover, .hg-chat-row.is-active { background: var(--bg-hover, rgba(0,0,0,.04)); }
.hg-chat-av {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-soft, rgba(37,99,235,.12));
  color: var(--accent, #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-weight: 650; flex: 0 0 auto;
}
.hg-chat-meta { flex: 1; min-width: 0; }
.hg-chat-top { display: flex; justify-content: space-between; gap: 8px; }
.hg-chat-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-chat-time { font-size: 11px; color: var(--text-muted, #889); }
.hg-chat-prev { font-size: 12px; color: var(--text-muted, #667); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.hg-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent, #2563eb); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}

.hg-thread { display: flex; flex-direction: column; height: 100%; }
.hg-thread-head {
  height: 56px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px; border-bottom: 1px solid var(--border, rgba(0,0,0,.08));
  background: var(--bg-elevated, #fff);
}
.hg-thread-title { flex: 1; min-width: 0; }
.hg-thread-title strong { display: block; font-size: 14px; }
.hg-thread-title span { font-size: 11px; color: var(--text-muted, #667); }
.hg-msgs {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin;
}
.hg-bubble {
  max-width: 82%; padding: 8px 12px; border-radius: 16px; font-size: 14px; line-height: 1.35;
  animation: hg-in .18s var(--hg-ease);
}
@keyframes hg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hg-bubble.me {
  align-self: flex-end;
  background: var(--accent, #2563eb); color: #fff;
  border-bottom-right-radius: 6px;
}
.hg-bubble.them {
  align-self: flex-start;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.06));
  border-bottom-left-radius: 6px;
}
.hg-bubble .hg-meta { font-size: 10px; opacity: .75; margin-top: 4px; text-align: right; }
.hg-bubble.voice audio { width: 180px; margin-top: 4px; }
.hg-bubble.circle video {
  width: 160px; height: 160px; border-radius: 50%; object-fit: cover; background: #000;
}
.hg-transcript {
  margin-top: 6px; padding: 6px 8px; border-radius: 10px;
  background: rgba(0,0,0,.06); font-size: 12px;
}
.hg-bubble.me .hg-transcript { background: rgba(255,255,255,.18); }

.hg-composer {
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
  background: var(--bg-elevated, #fff);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.hg-composer-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.hg-composer-row { display: flex; gap: 6px; align-items: flex-end; }
.hg-composer textarea {
  flex: 1; min-height: 40px; max-height: 120px; resize: none;
  border-radius: 14px; border: 1px solid var(--border, rgba(0,0,0,.1));
  padding: 10px 12px; font: inherit; background: var(--bg, #f7f8fa); color: var(--text, #111);
}
.hg-send {
  width: 40px; height: 40px; border: 0; border-radius: 14px;
  background: var(--accent, #2563eb); color: #fff; cursor: pointer;
}
.hg-send:disabled { opacity: .45; cursor: default; }

.hg-ai-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.hg-chip {
  border: 1px solid var(--border, rgba(0,0,0,.1)); background: var(--bg, #fff);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.hg-chip:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }

.hg-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bg-elevated, #fff);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.12);
  padding: 8px 0 16px;
  animation: hg-up .22s var(--hg-ease);
  z-index: 5;
}
@keyframes hg-up { from { transform: translateY(100%); } to { transform: none; } }
.hg-sheet button {
  display: block; width: 100%; text-align: left; padding: 12px 16px;
  border: 0; background: transparent; font: inherit; cursor: pointer;
}
.hg-sheet button:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }

.hg-ting-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--accent-soft, rgba(37,99,235,.12));
  border-bottom: 1px solid var(--border, rgba(0,0,0,.06));
  font-size: 13px;
}
.hg-ting-overlay {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.hg-ting-stage {
  width: min(960px, 92vw); height: min(640px, 80vh);
  background: var(--bg, #111); border-radius: 16px; overflow: hidden;
  position: relative; color: #fff;
}
.hg-ting-pip {
  position: fixed; right: 72px; bottom: 24px; width: 280px; height: 160px;
  z-index: 1300; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); background: #111;
}

body.hg-dock-open { padding-right: calc(var(--hg-panel-w) + var(--hg-rail-w)); }
body.hg-dock-collapsed { padding-right: var(--hg-rail-w); }
@media (max-width: 900px) {
  body.hg-dock-open, body.hg-dock-collapsed { padding-right: 0; }
  .hg-panel { width: min(100vw, 400px); }
}
