
/* =========================================================
   HEAD AGENT UI V2 — INTERACTION / POLISH LAYER
   ========================================================= */

/* Top-level navigation owns visibility.  This also wins over section
   layout rules that set display on individual section classes. */
[data-ui-section][hidden] {
  display: none !important;
}

.ha-skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 5000;

  padding: 9px 13px;

  border-radius: var(--ha-r-sm);

  background: var(--ha-text-1);
  color: var(--ha-bg);

  font-size: 11px;
  font-weight: 800;

  transition:
    top var(--ha-fast) var(--ha-ease);
}

.ha-skip-link:focus {
  top: 12px;
}

.ha-live-sync {
  min-height: 34px;
  padding: 0 10px;

  display: inline-flex;
  align-items: center;
  gap: 7px;

  border:
    1px solid var(--ha-border);

  border-radius: 999px;

  background:
    rgba(255,255,255,.025);

  color: var(--ha-text-2);

  font-size: 9px;
  font-weight: 700;
}

.ha-live-sync-dot {
  width: 7px;
  height: 7px;

  border-radius: 999px;

  background:
    var(--ha-success);

  box-shadow:
    0 0 0 4px
    rgba(85,221,161,.08);
}

.ha-live-sync.syncing
.ha-live-sync-dot {
  background:
    var(--ha-info);
}

.ha-live-sync.error
.ha-live-sync-dot {
  background:
    var(--ha-danger);
}

.ha-view-enter {
  animation:
    ha-view-enter
    220ms
    var(--ha-ease);
}

@keyframes ha-view-enter {
  from {
    opacity: 0;
    transform:
      translateY(5px);
  }

  to {
    opacity: 1;
    transform:
      translateY(0);
  }
}

.ha-command-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;

  display: grid;
  place-items: start center;

  padding:
    max(80px, 10vh)
    14px
    20px;

  background:
    rgba(0,0,0,.62);

  backdrop-filter:
    blur(10px);
}

.ha-command-palette-backdrop[hidden] {
  display: none;
}

.ha-command-palette {
  width:
    min(680px, 100%);

  max-height:
    min(650px, 75vh);

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border:
    1px solid var(--ha-border-strong);

  border-radius:
    22px;

  background:
    rgba(11,17,32,.985);

  box-shadow:
    0 35px 100px
    rgba(0,0,0,.52);
}

html[data-theme="light"]
.ha-command-palette {
  background:
    rgba(255,255,255,.985);
}

.ha-palette-header {
  padding: 14px;

  display: flex;
  align-items: center;
  gap: 10px;

  border-bottom:
    1px solid var(--ha-border);
}

.ha-palette-search {
  flex: 1;

  min-height: 44px;
  padding: 0 4px;

  border: 0;
  outline: 0;

  background: transparent;

  color: var(--ha-text-1);

  font-size: 14px;
}

.ha-palette-results {
  padding: 8px;

  display: grid;
  gap: 4px;

  overflow-y: auto;
}

.ha-palette-item {
  width: 100%;
  min-height: 50px;
  padding: 8px 10px;

  display: grid;
  grid-template-columns:
    36px
    minmax(0,1fr)
    auto;

  align-items: center;
  gap: 10px;

  border: 0;
  border-radius: 12px;

  background: transparent;
  color: var(--ha-text-2);

  text-align: left;

  cursor: pointer;
}

.ha-palette-item:hover,
.ha-palette-item.active {
  background:
    var(--ha-primary-soft);

  color:
    var(--ha-text-1);
}

.ha-palette-icon {
  width: 34px;
  height: 34px;

  display: grid;
  place-items: center;

  border:
    1px solid var(--ha-border);

  border-radius: 10px;

  background:
    rgba(255,255,255,.03);
}

.ha-palette-copy {
  min-width: 0;
}

.ha-palette-copy strong {
  display: block;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 11px;
}

.ha-palette-copy span {
  display: block;

  margin-top: 2px;

  color: var(--ha-text-3);

  font-size: 9px;
}

.ha-palette-key {
  color: var(--ha-text-3);

  font-size: 9px;
}

.ha-palette-footer {
  padding: 9px 13px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  border-top:
    1px solid var(--ha-border);

  color: var(--ha-text-3);

  font-size: 9px;
}

.ha-preferences {
  position: fixed;

  right: 18px;
  bottom: 18px;

  z-index: 900;

  width: 48px;
  height: 48px;

  display: grid;
  place-items: center;

  border:
    1px solid var(--ha-border-strong);

  border-radius: 15px;

  background:
    var(--ha-glass);

  color:
    var(--ha-text-1);

  backdrop-filter:
    blur(18px);

  box-shadow:
    var(--ha-shadow-sm);

  cursor: pointer;
}

.ha-preferences-panel {
  position: fixed;

  right: 18px;
  bottom: 76px;

  z-index: 920;

  width: min(300px, calc(100vw - 28px));
  padding: 14px;

  border:
    1px solid var(--ha-border-strong);

  border-radius: var(--ha-r-lg);

  background:
    var(--ha-glass);

  backdrop-filter:
    blur(22px);

  box-shadow:
    var(--ha-shadow-lg);
}

.ha-preferences-panel[hidden] {
  display: none;
}

.ha-preference-row {
  min-height: 45px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  border-bottom:
    1px solid var(--ha-border);
}

.ha-preference-row:last-child {
  border-bottom: 0;
}

.ha-preference-label {
  color:
    var(--ha-text-2);

  font-size: 10px;
}

.ha-density-toggle {
  min-height: 32px;
  padding: 0 9px;

  border:
    1px solid var(--ha-border);

  border-radius: 9px;

  background:
    var(--ha-surface-2);

  color:
    var(--ha-text-1);

  cursor: pointer;

  font-size: 9px;
}

html[data-density="compact"]
.ha-card {
  border-radius:
    var(--ha-r-sm);
}

html[data-density="compact"]
.ha-workspace {
  padding-top: 16px;
}

html[data-density="compact"]
.ha-command-center,
html[data-density="compact"]
.ha-tasks-section,
html[data-density="compact"]
.ha-agents-section,
html[data-density="compact"]
.ha-capability-section,
html[data-density="compact"]
.ha-memory-goals-section,
html[data-density="compact"]
.ha-security-section,
html[data-density="compact"]
.ha-business-section,
html[data-density="compact"]
.ha-advanced-section,
html[data-density="compact"]
.ha-system-section {
  gap: 9px;
}

.ha-screen-reader-status {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;
  clip: rect(0,0,0,0);

  white-space: nowrap;
  border: 0;
}

@media (max-width:760px) {
  .ha-live-sync {
    min-width: 34px;
    width: 34px;
    padding: 0;

    justify-content: center;
  }

  .ha-live-sync-label {
    display: none;
  }

  .ha-command-palette-backdrop {
    padding:
      max(62px, env(safe-area-inset-top))
      8px
      90px;
  }

  .ha-command-palette {
    max-height:
      calc(
        100vh
        - 145px
        - env(safe-area-inset-bottom)
      );

    border-radius: 18px;
  }

  .ha-preferences {
    right: 14px;

    bottom:
      calc(
        82px
        + env(safe-area-inset-bottom)
      );
  }

  .ha-preferences-panel {
    right: 14px;

    bottom:
      calc(
        140px
        + env(safe-area-inset-bottom)
      );
  }
}

@media (prefers-reduced-motion: reduce) {
  .ha-view-enter {
    animation: none;
  }
}

body { background:radial-gradient(circle at 85% -10%, rgba(34,211,238,.10), transparent 35%), var(--ha-bg); }
.ha-card,.ha-chat-shell { border:1px solid var(--ha-border-strong); border-radius:var(--ha-r-lg); box-shadow:0 18px 55px rgba(0,0,0,.24); }
.ha-button { border-radius:12px; font-weight:750; transition:transform .16s ease,box-shadow .16s ease; } .ha-button:hover { transform:translateY(-1px); box-shadow:0 8px 22px rgba(0,0,0,.24); }
.ha-nav-item { border-left:3px solid transparent; border-radius:12px; } .ha-nav-item.active { border-left-color:var(--ha-primary); background:rgba(129,156,255,.14); }
[data-ui-section="command"] {--section-accent:var(--ha-accent-chat)} [data-ui-section="tasks"] {--section-accent:var(--ha-accent-tasks)} [data-ui-section="agents"] {--section-accent:var(--ha-accent-agents)} [data-ui-section="skills"] {--section-accent:var(--ha-accent-skills)} [data-ui-section="tools"] {--section-accent:var(--ha-accent-tools)} [data-ui-section="opportunities"] {--section-accent:var(--ha-accent-opportunities)} [data-ui-section="earnings"] {--section-accent:var(--ha-accent-earnings)} [data-ui-section="approvals"] {--section-accent:var(--ha-accent-approvals)} [data-ui-section="notifications"] {--section-accent:var(--ha-accent-notifications)} [data-ui-section="memory"] {--section-accent:var(--ha-accent-memory)} [data-ui-section="goals"] {--section-accent:var(--ha-accent-goals)} [data-ui-section="system"] {--section-accent:var(--ha-accent-system)} [data-ui-section="settings"] {--section-accent:var(--ha-accent-settings)}
[data-ui-section]:not([hidden]) > .ha-section-heading,[data-ui-section]:not([hidden]) > .ha-chat-header { border-left:4px solid var(--section-accent); padding-left:14px; }
.ha-chat-composer { width:min(100%,920px); margin-inline:auto; display:flex; gap:12px; align-items:flex-end; } .ha-chat-composer textarea { flex:1; min-height:72px; max-height:220px; resize:vertical; }
@media(max-width:700px){.ha-chat-composer{flex-direction:column;align-items:stretch}.ha-chat-composer .ha-button{width:100%;min-height:46px}}
