/* Mimir design system — shared Huginn hg-* tokens and components */

:root {
  --hg-primary: #1f3a5f;
  --hg-primary-700: #16294a;
  --hg-primary-100: #e7eef7;
  --hg-accent: #c9a227;
  --hg-accent-700: #8e7012;
  --hg-bg-body: #f5f7fa;
  --hg-bg-surface: #ffffff;
  --hg-ink: #1a1f2e;
  --hg-ink-muted: #5a6478;
  --hg-border: #e3e7ee;
  --hg-red: #dc3545;
  --hg-orange: #fd7e14;
  --hg-yellow: #ffc107;
  --hg-green: #198754;
  --hg-blue: #0dcaf0;
  --hg-grey: #6c757d;
  --bs-primary: var(--hg-primary);
  --bs-primary-rgb: 31, 58, 95;
  --bs-font-sans-serif: "Montserrat", system-ui, -apple-system, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --bs-body-bg: var(--hg-bg-body);
  --bs-body-color: var(--hg-ink);
  --bs-border-color: var(--hg-border);
  --bs-link-color: var(--hg-primary);
  --bs-link-hover-color: var(--hg-primary-700);
  --hg-card-padding-y: 1.15rem;
  --hg-card-padding-x: 1.35rem;
}

body {
  min-height: 100vh;
}

.btn-primary {
  --bs-btn-bg: var(--hg-primary);
  --bs-btn-border-color: var(--hg-primary);
  --bs-btn-hover-bg: var(--hg-primary-700);
  --bs-btn-hover-border-color: var(--hg-primary-700);
  --bs-btn-active-bg: var(--hg-primary-700);
  --bs-btn-active-border-color: var(--hg-primary-700);
}

.btn-outline-primary {
  --bs-btn-color: var(--hg-primary);
  --bs-btn-border-color: var(--hg-primary);
  --bs-btn-hover-bg: var(--hg-primary);
  --bs-btn-hover-border-color: var(--hg-primary);
  --bs-btn-active-bg: var(--hg-primary-700);
}

.hg-navbar {
  /* Match body copy (BS defaults bump brand/links for marketing-style headers) */
  --bs-navbar-brand-font-size: 1rem;
  --bs-navbar-toggler-font-size: 1rem;
  background: var(--hg-primary);
  border-bottom: 3px solid var(--hg-accent);
  font-size: 1rem;
}

.hg-navbar .navbar-brand {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

.hg-navbar .navbar-brand img {
  object-fit: contain;
}

.hg-navbar .nav-link {
  color: rgba(255, 255, 255, 0.82);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: background 0.12s;
  font-size: 0.875rem;
  font-weight: 400;
}

.hg-navbar .navbar-text {
  font-size: 1rem;
}

.hg-navbar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.hg-navbar .nav-link.active,
.hg-navbar .nav-link[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.hg-page-header {
  background: var(--hg-bg-surface);
  border-bottom: 1px solid var(--hg-border);
  padding: 0.85rem 1.5rem;
}

.hg-page-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
}

/* Leading entity icon on list (and primary index) page titles — see docs/ux/IA_guidelines.md (3.5 List page headers) */
.hg-page-title-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

main.hg-main {
  padding: 1rem 1.5rem;
}

.hg-card {
  background: var(--hg-bg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}

.hg-card:hover {
  box-shadow: 0 4px 14px rgba(31, 58, 95, 0.12);
  transform: translateY(-1px);
}

.hg-card .color-bar {
  height: 6px;
}

.hg-card .color-bar.red {
  background: var(--hg-red);
}

.hg-card .color-bar.orange {
  background: var(--hg-orange);
}

.hg-card .color-bar.yellow {
  background: var(--hg-yellow);
}

.hg-card .color-bar.green {
  background: var(--hg-green);
}

.hg-card .color-bar.grey {
  background: var(--hg-grey);
}

.hg-card-name {
  font-size: 1rem;
  font-weight: 600;
}

.hg-card .card-body {
  padding: var(--hg-card-padding-y) var(--hg-card-padding-x);
  flex: 1 1 auto;
}


.hg-plot-project-path {
  max-width: min(100%, 11rem);
  text-align: end;
}

/*
 * Tactical Plot — project rows: sync status as a left tab (::before), not a Bootstrap
 * border-* accent (those tint every edge with list-group borders).
 */
.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row {
  position: relative;
}

.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row::before {
  background: var(--hg-sync-tab, var(--bs-secondary));
  content: "";
  inset-block-end: 0;
  inset-block-start: 0;
  inset-inline-start: 0;
  pointer-events: none;
  position: absolute;
  width: 3px;
}

.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row.hg-plot-sync-active {
  --hg-sync-tab: var(--bs-success);
}

.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row.hg-plot-sync-error {
  --hg-sync-tab: var(--bs-danger);
}

.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row.hg-plot-sync-syncing {
  --hg-sync-tab: var(--bs-warning);
}

.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row.hg-plot-sync-queued,
.hg-tactical-plot-grid .list-group-item.hg-plot-project-sync-row.hg-plot-sync-unknown {
  --hg-sync-tab: var(--bs-secondary);
}

.hg-plot-project-sync-row .hg-variables-dot-strip {
  position: relative;
  z-index: 1;
}

@media (min-width: 1200px) {
  .hg-tactical-plot-grid .hg-plot-work-queue {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Split fourth column vertically so Decisions + Tasks match height of sibling rails */
  .hg-tactical-plot-grid .hg-plot-queue-split-card {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
  }
}

/* Empty-state body: center copy at all breakpoints (xl-only rule caused misalignment <1200px). */
.hg-tactical-plot-grid .hg-plot-queue-split-body {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 4.5rem;
  text-align: center;
}

.hg-edit-project-source {
  max-width: min(100%, 15rem);
  padding-top: 0.125rem;
}

/* Tactical plot sidebar — cap markdown height so one long entry does not dominate the column. */
.hg-plot-rail-sa-markdown,
.hg-plot-rail-frago-markdown {
  max-height: 16rem;
  overflow-y: auto;
}

/* Project detail toolbar — link-style actions without underline (Bootstrap .btn-link hovers). */
.hg-project-actions .btn-link,
.hg-project-actions .btn-link:hover,
.hg-project-actions .btn-link:focus-visible {
  text-decoration: none;
}

.hg-card .hg-headline {
  margin-bottom: 0.55rem;
}

/* Tactical Plot — project card: SitRep micro-subcard (above stretched-link). */
.hg-sitrep-subcard {
  max-width: 100%;
}

.hg-sitrep-subcard-inner {
  align-items: flex-start;
  background: var(--hg-bg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 8px;
  border-left: 3px solid var(--bs-primary);
  box-shadow: 0 1px 2px rgba(31, 58, 95, 0.06);
  display: flex;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem 0.55rem 0.6rem;
  position: relative;
  z-index: 2;
}

.hg-sitrep-subcard-inner--empty {
  border-left-color: var(--hg-border);
  background: #fafbfd;
}

.hg-sitrep-subcard-icon {
  align-items: center;
  background: rgba(13, 110, 253, 0.1);
  border-radius: 6px;
  color: var(--bs-primary);
  display: flex;
  flex-shrink: 0;
  font-size: 0.85rem;
  height: 2.1rem;
  justify-content: center;
  width: 2.1rem;
}

.hg-sitrep-subcard-icon--muted {
  background: var(--hg-border);
  color: var(--bs-secondary-color);
}

.hg-sitrep-subcard-body {
  flex: 1 1 auto;
  min-width: 0;
}

.hg-sitrep-subcard-title {
  color: var(--bs-body-color);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

a.hg-sitrep-subcard-title {
  position: relative;
  z-index: 3;
}

a.hg-sitrep-subcard-title:hover,
a.hg-sitrep-subcard-title:focus-visible {
  color: var(--bs-primary);
  text-decoration: underline;
}

.hg-sitrep-subcard-title.is-static {
  display: block;
  -webkit-line-clamp: unset;
  font-weight: 500;
}

.hg-sitrep-subcard-meta {
  color: var(--bs-secondary-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
  font-size: 0.72rem;
  line-height: 1.35;
  margin-top: 0.2rem;
}

.hg-sitrep-subcard-kicker {
  color: var(--bs-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.hg-source-icons img {
  flex-shrink: 0;
  vertical-align: middle;
}

.hg-var-chip {
  flex-shrink: 0;
}

.hg-var-chip .hg-var-dot {
  margin-right: 0;
  cursor: help;
}

.hg-var-abbr {
  cursor: help;
}

.tooltip.hg-tooltip-wide .tooltip-inner {
  max-width: min(26rem, 92vw);
  text-align: left;
}

.hg-card .card-foot {
  padding: 0.75rem var(--hg-card-padding-x);
  border-top: 1px solid var(--hg-border);
  background: #fafbfd;
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hg-var-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.hg-var-dot.red {
  background: var(--hg-red);
}

.hg-var-dot.orange {
  background: var(--hg-orange);
}

.hg-var-dot.yellow {
  background: var(--hg-yellow);
}

.hg-var-dot.green {
  background: var(--hg-green);
}

.hg-label-caps {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hg-ink-muted);
}

.hg-chat-shell {
  min-height: calc(100vh - 120px);
}

/* Bootstrap toggler on dark navbar — ensure contrast */
.hg-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.35);
}

.hg-navbar .navbar-toggler-icon {
  filter: invert(1) grayscale(100%);
}

/* Tabbed detail card: gray tab bar, white active tab popping into white body */
.hg-detail-tabs-card > .card-header {
  background-color: var(--hg-bg-body);
  border-bottom: 0;
  padding: 0.6rem 0.75rem 0;
}

.hg-detail-tabs-card .card-header-tabs {
  margin: 0;
}

.hg-detail-tabs-card .nav-tabs {
  border-bottom: 0;
  gap: 0.25rem;
}

.hg-detail-tabs-card .nav-tabs .nav-link {
  background-color: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  color: var(--hg-ink-muted);
  margin-bottom: 0;
  padding: 0.55rem 1rem;
}

.hg-detail-tabs-card .nav-tabs .nav-link:hover,
.hg-detail-tabs-card .nav-tabs .nav-link:focus {
  background-color: rgba(255, 255, 255, 0.55);
  border-color: transparent;
  color: var(--hg-ink);
}

.hg-detail-tabs-card .nav-tabs .nav-link.active {
  background-color: var(--hg-bg-surface);
  border-color: var(--hg-border);
  border-bottom: 0;
  color: var(--hg-ink);
  font-weight: 600;
  position: relative;
}

.hg-detail-tabs-card .nav-tabs .nav-link.active::after {
  background-color: var(--hg-bg-surface);
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
}

/* ---------------------------------------------------------------------------
 * Streamlit-style metric card (base — reusable across screens)
 * ---------------------------------------------------------------------------
 * Use on a gray surface (e.g. .hg-vitals-grid) so the elevation reads correctly.
 * Markup:
 *   <article class="hg-metric-card">
 *     {% include "ui/components/_metric_card_header.html" with title="…" help="…" %}
 *     <div class="hg-metric-card__body">…</div>
 *   </article>
 */
.hg-metric-card {
  background-color: var(--hg-bg-surface);
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: 0.875rem;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 28px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.hg-metric-card:hover {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 16px 36px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.hg-metric-card__header {
  align-items: center;
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.hg-metric-card__title {
  color: var(--hg-ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
}

.hg-metric-card__help {
  color: #98a1b3;
  cursor: help;
  display: inline-flex;
  font-size: 0.95rem;
  line-height: 1;
}

.hg-metric-card__help:hover,
.hg-metric-card__help:focus-visible {
  color: var(--hg-ink-muted);
}

.hg-metric-card__help:focus-visible {
  outline: 2px solid var(--hg-primary);
  outline-offset: 2px;
  border-radius: 999px;
}

.hg-metric-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
}

/* Big value + optional inline trend (Streamlit metric pattern) */
.hg-metric {
  min-width: 0;
}

.hg-metric__label {
  color: var(--hg-ink-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.hg-metric__value {
  align-items: baseline;
  color: var(--hg-ink);
  display: flex;
  flex-wrap: wrap;
  font-size: 1.65rem;
  font-weight: 700;
  gap: 0.4rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: break-word;
}

.hg-metric__value--soft {
  color: var(--hg-ink-muted);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: normal;
}

.hg-metric-row {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

@media (min-width: 576px) {
  .hg-metric-row {
    flex-direction: row;
    gap: 2rem;
  }

  .hg-metric-row > .hg-metric {
    flex: 1;
  }
}

/* Description-list variant — keeps small body type but lines up with the metric vibe */
.hg-metric-card__dl {
  margin: 0;
}

.hg-metric-card__dl > dt {
  color: var(--hg-ink-muted);
  font-weight: 500;
}

.hg-metric-card__dl > dt,
.hg-metric-card__dl > dd {
  margin-bottom: 0.45rem;
}

.hg-metric-card__dl > dd:last-of-type,
.hg-metric-card__dl > dt:last-of-type {
  margin-bottom: 0;
}

/* Vitals grid: gray inset surface so floating metric cards read like the spec */
.hg-vitals-grid {
  background-color: var(--hg-bg-body);
  border-radius: 0.75rem;
  margin: 0;
  padding: 1rem;
}

@media (max-width: 575.98px) {
  .hg-vitals-grid {
    padding: 0.5rem;
  }
}

/* Playbook Workflow — server-rendered Markdown (mock + future read panels) */
.hg-markdown-workflow {
  color: var(--hg-ink);
}

.hg-markdown-workflow > :first-child {
  margin-top: 0;
}

.hg-markdown-workflow > :last-child {
  margin-bottom: 0;
}

.hg-markdown-workflow h1,
.hg-markdown-workflow h2,
.hg-markdown-workflow h3 {
  color: var(--hg-ink);
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 0.35rem;
}

.hg-markdown-workflow h1:first-child,
.hg-markdown-workflow h2:first-child,
.hg-markdown-workflow h3:first-child {
  margin-top: 0;
}

.hg-markdown-workflow p {
  margin: 0 0 0.5rem;
}

.hg-markdown-workflow ul,
.hg-markdown-workflow ol {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.hg-markdown-workflow code {
  font-size: 0.9em;
}

/* LIST+FIND — entity name as primary drill-down to VIEW (see mockups Data Sources list) */
.hg-list-name-link {
  border-radius: 0.25rem;
  color: var(--hg-ink);
  text-decoration: none;
}

.hg-list-name-link:hover,
.hg-list-name-link:focus-visible {
  color: var(--hg-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Projects list — Last sync + SitRep T share fixed width so stacked dates wrap the same */
.hg-projects-list-datetime-col {
  width: 7.25rem;
  min-width: 7.25rem;
  max-width: 7.25rem;
}

.hg-datetime-stack {
  display: block;
  width: 100%;
}

/* Mimir logo on Import-from-Mimir toolbar buttons (mock) */
.hg-mimir-btn-icon {
  height: 1rem;
  width: auto;
  max-width: 1.35rem;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* Disabled mock CTAs: keep full opacity so they read clearly on pale card headers */
.btn.hg-btn-disabled-visible:disabled {
  opacity: 1;
}

/* Project detail — informer bar (Playbook Variables snapshot strip, #52) */
.hg-informer-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--bs-font-monospace, ui-monospace, monospace);
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 2.4rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: default;
}

.hg-informer-dot--green {
  background-color: var(--bs-success-bg-subtle, #d1e7dd);
  color: var(--bs-success-text-emphasis, #0a3622);
}

.hg-informer-dot--orange {
  background-color: var(--bs-warning-bg-subtle, #fff3cd);
  color: var(--bs-warning-text-emphasis, #664d03);
}

.hg-informer-dot--red {
  background-color: var(--bs-danger-bg-subtle, #f8d7da);
  color: var(--bs-danger-text-emphasis, #58151c);
}

.hg-informer-dot--grey {
  background-color: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-secondary-color, #495057);
}

/* SitRep detail — variable pills (full variables with name + value + units) */
.hg-variable-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: default;
  transition: transform 0.1s;
}

.hg-variable-pill:hover,
.hg-variable-pill:focus {
  transform: translateY(-1px);
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.hg-variable-pill__abbrev {
  font-family: var(--bs-font-monospace, ui-monospace, monospace);
  font-size: 0.75rem;
  font-weight: 700;
}

.hg-variable-pill__name {
  font-weight: 500;
}

.hg-variable-pill__value {
  margin-left: auto;
  font-weight: 600;
}

.hg-variable-pill__value--empty {
  opacity: 0.5;
}

.hg-variable-pill__units {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.8125rem;
}

.hg-variable-pill--green {
  background-color: var(--bs-success-bg-subtle, #d1e7dd);
  color: var(--bs-success-text-emphasis, #0a3622);
}

.hg-variable-pill--orange {
  background-color: var(--bs-warning-bg-subtle, #fff3cd);
  color: var(--bs-warning-text-emphasis, #664d03);
}

.hg-variable-pill--red {
  background-color: var(--bs-danger-bg-subtle, #f8d7da);
  color: var(--bs-danger-text-emphasis, #58151c);
}

.hg-variable-pill--grey {
  background-color: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-secondary-color, #495057);
}


/* LIST+FIND filter controls — IA guidelines §5.2 (soft fields on page background) */
select.form-select-sm.hg-filter-control,
input.form-control-sm.hg-filter-control {
  background-color: var(--bs-secondary-bg);
  border: 0;
}

/* Marketing landing — full-viewport hero (Taciturn-style) + features below. */

/* Navbar floats transparently over the hero image. */
body.hg-landing .hg-navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  border-bottom: none;
}

/* Main loses its padding so the hero fills from the very top of the viewport. */
body.hg-landing main.hg-main {
  padding: 0;
}

/* Full-viewport hero exactly like Taciturn's fixed inset-0 h-screen. */
.hg-landing-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-image: url('../images/mimir-hero.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* 50% black overlay, same as Taciturn. */
.hg-landing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  z-index: 0;
}

.hg-landing-hero-inner {
  position: relative;
  z-index: 10;
  max-width: 700px;
  padding: 0 1.25rem;
  color: #ffffff;
}

.hg-landing-title {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  color: #ffffff;
  margin: 0;
}

.hg-landing-tagline {
  font-size: 1.5rem;
  color: #ffffff;
}

/* Ghost link buttons — white, no underline, no background. */
.hg-landing-link {
  color: #ffffff;
  font-size: 1.125rem;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline;
}

.hg-landing-link:hover {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.hg-landing-link--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.hg-landing-features-wrap {
  padding: 1.5rem 1.5rem 0;
}

.hg-landing-feature {
  background: var(--hg-bg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 0.5rem;
  padding: 1rem 1.1rem;
}

.hg-landing-feature-icon {
  align-items: center;
  background: var(--hg-primary-100);
  border-radius: 0.5rem;
  color: var(--hg-primary);
  display: inline-flex;
  font-size: 1.1rem;
  height: 2.25rem;
  justify-content: center;
  margin-bottom: 0.6rem;
  width: 2.25rem;
}
